ref: 3675b2291cac15e6bc5a9bde9a0da7e00f919aaa
parent: cf7c4732e5be5c881a49f778ba011ea5d656f66e
author: Yunqing Wang <yunqingwang@google.com>
date: Mon Jan 10 11:16:59 EST 2011
Fix bug in motion search The maximum possible MV in 1/8 pel units is (1<<11), which could cause mvcost out of its range that is 1023. Change maximum possible MV in 1/8 pel units to (1<<11)-8 will fix this problem. Change-Id: I5788ed1de773f66658c14f225fb4ab5b1679b74b
--- a/vp8/encoder/mcomp.h
+++ b/vp8/encoder/mcomp.h
@@ -24,7 +24,6 @@
#define MAX_MVSEARCH_STEPS 8 // The maximum number of steps in a step search given the largest allowed initial step
#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS+3)) - 8) // Max full pel mv specified in 1/8 pel units
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1)) // Maximum size of the first step in full pel units
-#define MAX_POSSIBLE_MV (1 << 11) // Maximum MV in 1/8 pel units
extern void print_mode_context(void);
extern int vp8_mv_bit_cost(MV *mv, MV *ref, int *mvcost[2], int Weight);
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1325,10 +1325,10 @@
if (bsi.segment_rd < best_rd)
{
- int col_min = (best_ref_mv->col - MAX_POSSIBLE_MV) >>3;
- int col_max = (best_ref_mv->col + MAX_POSSIBLE_MV) >>3;
- int row_min = (best_ref_mv->row - MAX_POSSIBLE_MV) >>3;
- int row_max = (best_ref_mv->row + MAX_POSSIBLE_MV) >>3;
+ int col_min = (best_ref_mv->col - MAX_FULL_PEL_VAL) >>3;
+ int col_max = (best_ref_mv->col + MAX_FULL_PEL_VAL) >>3;
+ int row_min = (best_ref_mv->row - MAX_FULL_PEL_VAL) >>3;
+ int row_max = (best_ref_mv->row + MAX_FULL_PEL_VAL) >>3;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
@@ -1927,14 +1927,14 @@
x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias, &sr, &near_sadidx[0]);
/* adjust mvp to make sure it is within MV range */
- if(mvp.row > best_ref_mv.row + MAX_POSSIBLE_MV)
- mvp.row = best_ref_mv.row + MAX_POSSIBLE_MV;
- else if(mvp.row < best_ref_mv.row - MAX_POSSIBLE_MV)
- mvp.row = best_ref_mv.row - MAX_POSSIBLE_MV;
- if(mvp.col > best_ref_mv.col + MAX_POSSIBLE_MV)
- mvp.col = best_ref_mv.col + MAX_POSSIBLE_MV;
- else if(mvp.col < best_ref_mv.col - MAX_POSSIBLE_MV)
- mvp.col = best_ref_mv.col - MAX_POSSIBLE_MV;
+ if(mvp.row > best_ref_mv.row + MAX_FULL_PEL_VAL)
+ mvp.row = best_ref_mv.row + MAX_FULL_PEL_VAL;
+ else if(mvp.row < best_ref_mv.row - MAX_FULL_PEL_VAL)
+ mvp.row = best_ref_mv.row - MAX_FULL_PEL_VAL;
+ if(mvp.col > best_ref_mv.col + MAX_FULL_PEL_VAL)
+ mvp.col = best_ref_mv.col + MAX_FULL_PEL_VAL;
+ else if(mvp.col < best_ref_mv.col - MAX_FULL_PEL_VAL)
+ mvp.col = best_ref_mv.col - MAX_FULL_PEL_VAL;
}
// Check to see if the testing frequency for this mode is at its max
@@ -2066,10 +2066,10 @@
int further_steps;
int n;
- int col_min = (best_ref_mv.col - MAX_POSSIBLE_MV) >>3;
- int col_max = (best_ref_mv.col + MAX_POSSIBLE_MV) >>3;
- int row_min = (best_ref_mv.row - MAX_POSSIBLE_MV) >>3;
- int row_max = (best_ref_mv.row + MAX_POSSIBLE_MV) >>3;
+ int col_min = (best_ref_mv.col - MAX_FULL_PEL_VAL) >>3;
+ int col_max = (best_ref_mv.col + MAX_FULL_PEL_VAL) >>3;
+ int row_min = (best_ref_mv.row - MAX_FULL_PEL_VAL) >>3;
+ int row_max = (best_ref_mv.row + MAX_FULL_PEL_VAL) >>3;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;