| 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 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 int rate; | 587 int rate; |
| 588 int rate2; | 588 int rate2; |
| 589 int distortion2; | 589 int distortion2; |
| 590 int bestsme = INT_MAX; | 590 int bestsme = INT_MAX; |
| 591 int best_mode_index = 0; | 591 int best_mode_index = 0; |
| 592 unsigned int sse = INT_MAX, best_rd_sse = INT_MAX; | 592 unsigned int sse = INT_MAX, best_rd_sse = INT_MAX; |
| 593 #if CONFIG_TEMPORAL_DENOISING | 593 #if CONFIG_TEMPORAL_DENOISING |
| 594 unsigned int zero_mv_sse = INT_MAX, best_sse = INT_MAX; | 594 unsigned int zero_mv_sse = INT_MAX, best_sse = INT_MAX; |
| 595 #endif | 595 #endif |
| 596 | 596 |
| 597 int sf_improved_mv_pred = cpi->sf.improved_mv_pred; |
| 597 int_mv mvp; | 598 int_mv mvp; |
| 598 | 599 |
| 599 int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; | 600 int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; |
| 600 int saddone=0; | 601 int saddone=0; |
| 601 /* search range got from mv_pred(). It uses step_param levels. (0-7) */ | 602 /* search range got from mv_pred(). It uses step_param levels. (0-7) */ |
| 602 int sr=0; | 603 int sr=0; |
| 603 | 604 |
| 604 unsigned char *plane[4][3]; | 605 unsigned char *plane[4][3]; |
| 605 int ref_frame_map[4]; | 606 int ref_frame_map[4]; |
| 606 int sign_bias = 0; | 607 int sign_bias = 0; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 876 |
| 876 /* Further step/diamond searches as necessary */ | 877 /* Further step/diamond searches as necessary */ |
| 877 step_param = cpi->sf.first_step + speed_adjust; | 878 step_param = cpi->sf.first_step + speed_adjust; |
| 878 | 879 |
| 879 #if CONFIG_MULTI_RES_ENCODING | 880 #if CONFIG_MULTI_RES_ENCODING |
| 880 /* If lower-res drops this frame, then higher-res encoder does | 881 /* If lower-res drops this frame, then higher-res encoder does |
| 881 motion search without any previous knowledge. Also, since | 882 motion search without any previous knowledge. Also, since |
| 882 last frame motion info is not stored, then we can not | 883 last frame motion info is not stored, then we can not |
| 883 use improved_mv_pred. */ | 884 use improved_mv_pred. */ |
| 884 if (cpi->oxcf.mr_encoder_id && !parent_ref_valid) | 885 if (cpi->oxcf.mr_encoder_id && !parent_ref_valid) |
| 885 cpi->sf.improved_mv_pred = 0; | 886 sf_improved_mv_pred = 0; |
| 886 | 887 |
| 887 if (parent_ref_valid && parent_ref_frame) | 888 if (parent_ref_valid && parent_ref_frame) |
| 888 { | 889 { |
| 889 /* Use parent MV as predictor. Adjust search range | 890 /* Use parent MV as predictor. Adjust search range |
| 890 * accordingly. | 891 * accordingly. |
| 891 */ | 892 */ |
| 892 mvp.as_int = parent_ref_mv.as_int; | 893 mvp.as_int = parent_ref_mv.as_int; |
| 893 mvp_full.as_mv.col = parent_ref_mv.as_mv.col>>3; | 894 mvp_full.as_mv.col = parent_ref_mv.as_mv.col>>3; |
| 894 mvp_full.as_mv.row = parent_ref_mv.as_mv.row>>3; | 895 mvp_full.as_mv.row = parent_ref_mv.as_mv.row>>3; |
| 895 | 896 |
| 896 if(dissim <=32) step_param += 3; | 897 if(dissim <=32) step_param += 3; |
| 897 else if(dissim <=128) step_param += 2; | 898 else if(dissim <=128) step_param += 2; |
| 898 else step_param += 1; | 899 else step_param += 1; |
| 899 }else | 900 }else |
| 900 #endif | 901 #endif |
| 901 { | 902 { |
| 902 if(cpi->sf.improved_mv_pred) | 903 if(sf_improved_mv_pred) |
| 903 { | 904 { |
| 904 if(!saddone) | 905 if(!saddone) |
| 905 { | 906 { |
| 906 vp8_cal_sad(cpi,xd,x, recon_yoffset ,&near_sadidx[0] ); | 907 vp8_cal_sad(cpi,xd,x, recon_yoffset ,&near_sadidx[0] ); |
| 907 saddone = 1; | 908 saddone = 1; |
| 908 } | 909 } |
| 909 | 910 |
| 910 vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, | 911 vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, |
| 911 &mvp,x->e_mbd.mode_info_context->mbmi.ref_frame, | 912 &mvp,x->e_mbd.mode_info_context->mbmi.ref_frame, |
| 912 cpi->common.ref_frame_sign_bias, &sr, | 913 cpi->common.ref_frame_sign_bias, &sr, |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1287 error4x4 = pick_intra4x4mby_modes(x, &rate, |
| 1287 &best_sse); | 1288 &best_sse); |
| 1288 if (error4x4 < error16x16) | 1289 if (error4x4 < error16x16) |
| 1289 { | 1290 { |
| 1290 xd->mode_info_context->mbmi.mode = B_PRED; | 1291 xd->mode_info_context->mbmi.mode = B_PRED; |
| 1291 best_rate = rate; | 1292 best_rate = rate; |
| 1292 } | 1293 } |
| 1293 | 1294 |
| 1294 *rate_ = best_rate; | 1295 *rate_ = best_rate; |
| 1295 } | 1296 } |
| OLD | NEW |