| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| 11 | 11 | 
| 12 #include <stdio.h> | 12 #include <stdio.h> | 
| 13 #include <math.h> | 13 #include <math.h> | 
| 14 #include <limits.h> | 14 #include <limits.h> | 
| 15 #include <assert.h> | 15 #include <assert.h> | 
| 16 #include "vpx_config.h" | 16 #include "vpx_config.h" | 
| 17 #include "vp8_rtcd.h" | 17 #include "vp8_rtcd.h" | 
| 18 #include "vp8/common/pragmas.h" |  | 
| 19 #include "tokenize.h" | 18 #include "tokenize.h" | 
| 20 #include "treewriter.h" | 19 #include "treewriter.h" | 
| 21 #include "onyx_int.h" | 20 #include "onyx_int.h" | 
| 22 #include "modecosts.h" | 21 #include "modecosts.h" | 
| 23 #include "encodeintra.h" | 22 #include "encodeintra.h" | 
| 24 #include "pickinter.h" | 23 #include "pickinter.h" | 
| 25 #include "vp8/common/entropymode.h" | 24 #include "vp8/common/entropymode.h" | 
| 26 #include "vp8/common/reconinter.h" | 25 #include "vp8/common/reconinter.h" | 
| 27 #include "vp8/common/reconintra4x4.h" | 26 #include "vp8/common/reconintra4x4.h" | 
| 28 #include "vp8/common/findnearmv.h" | 27 #include "vp8/common/findnearmv.h" | 
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1929         int i; | 1928         int i; | 
| 1930         for (i = 0; i < 16; i++) | 1929         for (i = 0; i < 16; i++) | 
| 1931         { | 1930         { | 
| 1932             best_mode->bmodes[i] = x->e_mbd.block[i].bmi; | 1931             best_mode->bmodes[i] = x->e_mbd.block[i].bmi; | 
| 1933         } | 1932         } | 
| 1934     } | 1933     } | 
| 1935 } | 1934 } | 
| 1936 | 1935 | 
| 1937 void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, | 1936 void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, | 
| 1938                             int recon_uvoffset, int *returnrate, | 1937                             int recon_uvoffset, int *returnrate, | 
| 1939                             int *returndistortion, int *returnintra) | 1938                             int *returndistortion, int *returnintra, | 
|  | 1939                             int mb_row, int mb_col) | 
| 1940 { | 1940 { | 
| 1941     BLOCK *b = &x->block[0]; | 1941     BLOCK *b = &x->block[0]; | 
| 1942     BLOCKD *d = &x->e_mbd.block[0]; | 1942     BLOCKD *d = &x->e_mbd.block[0]; | 
| 1943     MACROBLOCKD *xd = &x->e_mbd; | 1943     MACROBLOCKD *xd = &x->e_mbd; | 
| 1944     int_mv best_ref_mv_sb[2]; | 1944     int_mv best_ref_mv_sb[2]; | 
| 1945     int_mv mode_mv_sb[2][MB_MODE_COUNT]; | 1945     int_mv mode_mv_sb[2][MB_MODE_COUNT]; | 
| 1946     int_mv best_ref_mv; | 1946     int_mv best_ref_mv; | 
| 1947     int_mv *mode_mv; | 1947     int_mv *mode_mv; | 
| 1948     MB_PREDICTION_MODE this_mode; | 1948     MB_PREDICTION_MODE this_mode; | 
| 1949     int num00; | 1949     int num00; | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 1967     int sr=0; | 1967     int sr=0; | 
| 1968 | 1968 | 
| 1969     unsigned char *plane[4][3]; | 1969     unsigned char *plane[4][3]; | 
| 1970     int ref_frame_map[4]; | 1970     int ref_frame_map[4]; | 
| 1971     int sign_bias = 0; | 1971     int sign_bias = 0; | 
| 1972 | 1972 | 
| 1973     int intra_rd_penalty =  10* vp8_dc_quant(cpi->common.base_qindex, | 1973     int intra_rd_penalty =  10* vp8_dc_quant(cpi->common.base_qindex, | 
| 1974                                              cpi->common.y1dc_delta_q); | 1974                                              cpi->common.y1dc_delta_q); | 
| 1975 | 1975 | 
| 1976 #if CONFIG_TEMPORAL_DENOISING | 1976 #if CONFIG_TEMPORAL_DENOISING | 
| 1977     unsigned int zero_mv_sse = INT_MAX, best_sse = INT_MAX, | 1977     unsigned int zero_mv_sse = UINT_MAX, best_sse = UINT_MAX, | 
| 1978             best_rd_sse = INT_MAX; | 1978             best_rd_sse = UINT_MAX; | 
| 1979 #endif | 1979 #endif | 
| 1980 | 1980 | 
| 1981     mode_mv = mode_mv_sb[sign_bias]; | 1981     mode_mv = mode_mv_sb[sign_bias]; | 
| 1982     best_ref_mv.as_int = 0; | 1982     best_ref_mv.as_int = 0; | 
| 1983     best_mode.rd = INT_MAX; | 1983     best_mode.rd = INT_MAX; | 
| 1984     best_mode.yrd = INT_MAX; | 1984     best_mode.yrd = INT_MAX; | 
| 1985     best_mode.intra_rd = INT_MAX; | 1985     best_mode.intra_rd = INT_MAX; | 
| 1986     vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb)); | 1986     vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb)); | 
| 1987     vpx_memset(&best_mode.mbmode, 0, sizeof(best_mode.mbmode)); | 1987     vpx_memset(&best_mode.mbmode, 0, sizeof(best_mode.mbmode)); | 
| 1988     vpx_memset(&best_mode.bmodes, 0, sizeof(best_mode.bmodes)); | 1988     vpx_memset(&best_mode.bmodes, 0, sizeof(best_mode.bmodes)); | 
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2504                     x->rd_thresh_mult[best_mode_index] - best_adjustment : | 2504                     x->rd_thresh_mult[best_mode_index] - best_adjustment : | 
| 2505                     MIN_THRESHMULT; | 2505                     MIN_THRESHMULT; | 
| 2506         x->rd_threshes[best_mode_index] = | 2506         x->rd_threshes[best_mode_index] = | 
| 2507             (cpi->rd_baseline_thresh[best_mode_index] >> 7) * | 2507             (cpi->rd_baseline_thresh[best_mode_index] >> 7) * | 
| 2508                 x->rd_thresh_mult[best_mode_index]; | 2508                 x->rd_thresh_mult[best_mode_index]; | 
| 2509     } | 2509     } | 
| 2510 | 2510 | 
| 2511 #if CONFIG_TEMPORAL_DENOISING | 2511 #if CONFIG_TEMPORAL_DENOISING | 
| 2512     if (cpi->oxcf.noise_sensitivity) | 2512     if (cpi->oxcf.noise_sensitivity) | 
| 2513     { | 2513     { | 
|  | 2514         int block_index = mb_row * cpi->common.mb_cols + mb_col; | 
| 2514         if (x->best_sse_inter_mode == DC_PRED) | 2515         if (x->best_sse_inter_mode == DC_PRED) | 
| 2515         { | 2516         { | 
| 2516             /* No best MV found. */ | 2517             /* No best MV found. */ | 
| 2517             x->best_sse_inter_mode = best_mode.mbmode.mode; | 2518             x->best_sse_inter_mode = best_mode.mbmode.mode; | 
| 2518             x->best_sse_mv = best_mode.mbmode.mv; | 2519             x->best_sse_mv = best_mode.mbmode.mv; | 
| 2519             x->need_to_clamp_best_mvs = best_mode.mbmode.need_to_clamp_mvs; | 2520             x->need_to_clamp_best_mvs = best_mode.mbmode.need_to_clamp_mvs; | 
| 2520             x->best_reference_frame = best_mode.mbmode.ref_frame; | 2521             x->best_reference_frame = best_mode.mbmode.ref_frame; | 
| 2521             best_sse = best_rd_sse; | 2522             best_sse = best_rd_sse; | 
| 2522         } | 2523         } | 
| 2523         vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse, | 2524         vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse, | 
| 2524                                 recon_yoffset, recon_uvoffset); | 2525                                 recon_yoffset, recon_uvoffset, | 
|  | 2526                                 &cpi->common.lf_info, mb_row, mb_col, | 
|  | 2527                                 block_index); | 
| 2525 | 2528 | 
| 2526 | 2529 | 
| 2527         /* Reevaluate ZEROMV after denoising. */ | 2530         /* Reevaluate ZEROMV after denoising. */ | 
| 2528         if (best_mode.mbmode.ref_frame == INTRA_FRAME && | 2531         if (best_mode.mbmode.ref_frame == INTRA_FRAME && | 
| 2529             x->best_zeromv_reference_frame != INTRA_FRAME) | 2532             x->best_zeromv_reference_frame != INTRA_FRAME) | 
| 2530         { | 2533         { | 
| 2531             int this_rd = INT_MAX; | 2534             int this_rd = INT_MAX; | 
| 2532             int disable_skip = 0; | 2535             int disable_skip = 0; | 
| 2533             int other_cost = 0; | 2536             int other_cost = 0; | 
| 2534             int this_ref_frame = x->best_zeromv_reference_frame; | 2537             int this_ref_frame = x->best_zeromv_reference_frame; | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2630         x->e_mbd.mode_info_context->mbmi.mode = B_PRED; | 2633         x->e_mbd.mode_info_context->mbmi.mode = B_PRED; | 
| 2631         rate += rate4x4; | 2634         rate += rate4x4; | 
| 2632     } | 2635     } | 
| 2633     else | 2636     else | 
| 2634     { | 2637     { | 
| 2635         rate += rate16x16; | 2638         rate += rate16x16; | 
| 2636     } | 2639     } | 
| 2637 | 2640 | 
| 2638     *rate_ = rate; | 2641     *rate_ = rate; | 
| 2639 } | 2642 } | 
| OLD | NEW | 
|---|