| 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 #include <limits.h> | 11 #include <limits.h> |
| 12 #include <vp9/encoder/vp9_encodeintra.h> | 12 #include <vp9/encoder/vp9_encodeintra.h> |
| 13 #include <vp9/encoder/vp9_rdopt.h> | 13 #include <vp9/encoder/vp9_rdopt.h> |
| 14 #include <vp9/common/vp9_setupintrarecon.h> | 14 #include <vp9/common/vp9_setupintrarecon.h> |
| 15 #include <vp9/common/vp9_blockd.h> | 15 #include <vp9/common/vp9_blockd.h> |
| 16 #include <vp9/common/vp9_reconinter.h> | 16 #include <vp9/common/vp9_reconinter.h> |
| 17 #include <vp9/common/vp9_systemdependent.h> | 17 #include <vp9/common/vp9_systemdependent.h> |
| 18 #include <vpx_mem/vpx_mem.h> | 18 #include <vpx_mem/vpx_mem.h> |
| 19 #include <vp9/encoder/vp9_segmentation.h> | 19 #include <vp9/encoder/vp9_segmentation.h> |
| 20 | 20 |
| 21 static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi, | 21 static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi, |
| 22 int_mv *ref_mv, | 22 int_mv *ref_mv, |
| 23 int_mv *dst_mv) { | 23 int_mv *dst_mv) { |
| 24 MACROBLOCK *const x = &cpi->mb; | 24 MACROBLOCK *const x = &cpi->mb; |
| 25 MACROBLOCKD *const xd = &x->e_mbd; | 25 MACROBLOCKD *const xd = &x->e_mbd; |
| 26 BLOCK *b = &x->block[0]; | 26 BLOCK *b = &x->block[0]; |
| 27 BLOCKD *d = &xd->block[0]; | 27 BLOCKD *d = &xd->block[0]; |
| 28 vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16]; | 28 vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16]; |
| 29 unsigned int best_err; | 29 unsigned int best_err; |
| 30 int step_param, further_steps; | 30 int step_param; |
| 31 | 31 |
| 32 int tmp_col_min = x->mv_col_min; | 32 int tmp_col_min = x->mv_col_min; |
| 33 int tmp_col_max = x->mv_col_max; | 33 int tmp_col_max = x->mv_col_max; |
| 34 int tmp_row_min = x->mv_row_min; | 34 int tmp_row_min = x->mv_row_min; |
| 35 int tmp_row_max = x->mv_row_max; | 35 int tmp_row_max = x->mv_row_max; |
| 36 int_mv ref_full; | 36 int_mv ref_full; |
| 37 | 37 |
| 38 // Further step/diamond searches as necessary | 38 // Further step/diamond searches as necessary |
| 39 if (cpi->Speed < 8) { | 39 if (cpi->Speed < 8) { |
| 40 step_param = cpi->sf.first_step + ((cpi->Speed > 5) ? 1 : 0); | 40 step_param = cpi->sf.first_step + ((cpi->Speed > 5) ? 1 : 0); |
| 41 further_steps = (cpi->sf.max_step_search_steps - 1) - step_param; | |
| 42 } else { | 41 } else { |
| 43 step_param = cpi->sf.first_step + 2; | 42 step_param = cpi->sf.first_step + 2; |
| 44 further_steps = 0; | |
| 45 } | 43 } |
| 46 | 44 |
| 47 vp9_clamp_mv_min_max(x, ref_mv); | 45 vp9_clamp_mv_min_max(x, ref_mv); |
| 48 | 46 |
| 49 ref_full.as_mv.col = ref_mv->as_mv.col >> 3; | 47 ref_full.as_mv.col = ref_mv->as_mv.col >> 3; |
| 50 ref_full.as_mv.row = ref_mv->as_mv.row >> 3; | 48 ref_full.as_mv.row = ref_mv->as_mv.row >> 3; |
| 51 | 49 |
| 52 /*cpi->sf.search_method == HEX*/ | 50 /*cpi->sf.search_method == HEX*/ |
| 53 best_err = vp9_hex_search( | 51 best_err = vp9_hex_search( |
| 54 x, b, d, | 52 x, b, d, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 66 int distortion; | 64 int distortion; |
| 67 unsigned int sse; | 65 unsigned int sse; |
| 68 best_err = cpi->find_fractional_mv_step( | 66 best_err = cpi->find_fractional_mv_step( |
| 69 x, b, d, | 67 x, b, d, |
| 70 dst_mv, ref_mv, | 68 dst_mv, ref_mv, |
| 71 x->errorperbit, &v_fn_ptr, | 69 x->errorperbit, &v_fn_ptr, |
| 72 NULL, NULL, | 70 NULL, NULL, |
| 73 & distortion, &sse); | 71 & distortion, &sse); |
| 74 } | 72 } |
| 75 | 73 |
| 76 #if CONFIG_PRED_FILTER | |
| 77 // Disable the prediction filter | |
| 78 xd->mode_info_context->mbmi.pred_filter_enabled = 0; | |
| 79 #endif | |
| 80 | |
| 81 vp9_set_mbmode_and_mvs(x, NEWMV, dst_mv); | 74 vp9_set_mbmode_and_mvs(x, NEWMV, dst_mv); |
| 82 vp9_build_1st_inter16x16_predictors_mby(xd, xd->predictor, 16, 0); | 75 vp9_build_1st_inter16x16_predictors_mby(xd, xd->predictor, 16, 0); |
| 83 best_err = vp9_sad16x16(xd->dst.y_buffer, xd->dst.y_stride, | 76 best_err = vp9_sad16x16(xd->dst.y_buffer, xd->dst.y_stride, |
| 84 xd->predictor, 16, INT_MAX); | 77 xd->predictor, 16, INT_MAX); |
| 85 | 78 |
| 86 /* restore UMV window */ | 79 /* restore UMV window */ |
| 87 x->mv_col_min = tmp_col_min; | 80 x->mv_col_min = tmp_col_min; |
| 88 x->mv_col_max = tmp_col_max; | 81 x->mv_col_max = tmp_col_max; |
| 89 x->mv_row_min = tmp_row_min; | 82 x->mv_row_min = tmp_row_min; |
| 90 x->mv_row_max = tmp_row_max; | 83 x->mv_row_max = tmp_row_max; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 assert(q_cur != NULL); | 463 assert(q_cur != NULL); |
| 471 | 464 |
| 472 update_mbgraph_frame_stats(cpi, frame_stats, &q_cur->img, | 465 update_mbgraph_frame_stats(cpi, frame_stats, &q_cur->img, |
| 473 golden_ref, cpi->Source); | 466 golden_ref, cpi->Source); |
| 474 } | 467 } |
| 475 | 468 |
| 476 vp9_clear_system_state(); // __asm emms; | 469 vp9_clear_system_state(); // __asm emms; |
| 477 | 470 |
| 478 separate_arf_mbs(cpi); | 471 separate_arf_mbs(cpi); |
| 479 } | 472 } |
| OLD | NEW |