diff options
Diffstat (limited to 'vp8/encoder/mcomp.c')
-rw-r--r-- | vp8/encoder/mcomp.c | 231 |
1 files changed, 134 insertions, 97 deletions
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c index dc0edfbc1..8ae6bc749 100644 --- a/vp8/encoder/mcomp.c +++ b/vp8/encoder/mcomp.c @@ -25,16 +25,19 @@ static int mv_mode_cts [4] [2]; int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight) { - // MV costing is based on the distribution of vectors in the previous frame and as such will tend to - // over state the cost of vectors. In addition coding a new vector can have a knock on effect on the - // cost of subsequent vectors and the quality of prediction from NEAR and NEAREST for subsequent blocks. - // The "Weight" parameter allows, to a limited extent, for some account to be taken of these factors. + /* MV costing is based on the distribution of vectors in the previous + * frame and as such will tend to over state the cost of vectors. In + * addition coding a new vector can have a knock on effect on the cost + * of subsequent vectors and the quality of prediction from NEAR and + * NEAREST for subsequent blocks. The "Weight" parameter allows, to a + * limited extent, for some account to be taken of these factors. + */ return ((mvcost[0][(mv->as_mv.row - ref->as_mv.row) >> 1] + mvcost[1][(mv->as_mv.col - ref->as_mv.col) >> 1]) * Weight) >> 7; } static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int error_per_bit) { - // Ignore mv costing if mvcost is NULL + /* Ignore mv costing if mvcost is NULL */ if (mvcost) return ((mvcost[0][(mv->as_mv.row - ref->as_mv.row) >> 1] + mvcost[1][(mv->as_mv.col - ref->as_mv.col) >> 1]) @@ -44,8 +47,8 @@ static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int error_per_bi static int mvsad_err_cost(int_mv *mv, int_mv *ref, int *mvsadcost[2], int error_per_bit) { - // Calculate sad error cost on full pixel basis. - // Ignore mv costing if mvsadcost is NULL + /* Calculate sad error cost on full pixel basis. */ + /* Ignore mv costing if mvsadcost is NULL */ if (mvsadcost) return ((mvsadcost[0][(mv->as_mv.row - ref->as_mv.row)] + mvsadcost[1][(mv->as_mv.col - ref->as_mv.col)]) @@ -59,7 +62,7 @@ void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride) int search_site_count = 0; - // Generate offsets for 4 search sites per step. + /* Generate offsets for 4 search sites per step. */ Len = MAX_FIRST_STEP; x->ss[search_site_count].mv.col = 0; x->ss[search_site_count].mv.row = 0; @@ -69,31 +72,31 @@ void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride) while (Len > 0) { - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = 0; x->ss[search_site_count].mv.row = -Len; x->ss[search_site_count].offset = -Len * stride; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = 0; x->ss[search_site_count].mv.row = Len; x->ss[search_site_count].offset = Len * stride; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = -Len; x->ss[search_site_count].mv.row = 0; x->ss[search_site_count].offset = -Len; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = Len; x->ss[search_site_count].mv.row = 0; x->ss[search_site_count].offset = Len; search_site_count++; - // Contract. + /* Contract. */ Len /= 2; } @@ -106,7 +109,7 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) int Len; int search_site_count = 0; - // Generate offsets for 8 search sites per step. + /* Generate offsets for 8 search sites per step. */ Len = MAX_FIRST_STEP; x->ss[search_site_count].mv.col = 0; x->ss[search_site_count].mv.row = 0; @@ -116,56 +119,56 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) while (Len > 0) { - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = 0; x->ss[search_site_count].mv.row = -Len; x->ss[search_site_count].offset = -Len * stride; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = 0; x->ss[search_site_count].mv.row = Len; x->ss[search_site_count].offset = Len * stride; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = -Len; x->ss[search_site_count].mv.row = 0; x->ss[search_site_count].offset = -Len; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = Len; x->ss[search_site_count].mv.row = 0; x->ss[search_site_count].offset = Len; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = -Len; x->ss[search_site_count].mv.row = -Len; x->ss[search_site_count].offset = -Len * stride - Len; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = Len; x->ss[search_site_count].mv.row = -Len; x->ss[search_site_count].offset = -Len * stride + Len; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = -Len; x->ss[search_site_count].mv.row = Len; x->ss[search_site_count].offset = Len * stride - Len; search_site_count++; - // Compute offsets for search sites. + /* Compute offsets for search sites. */ x->ss[search_site_count].mv.col = Len; x->ss[search_site_count].mv.row = Len; x->ss[search_site_count].offset = Len * stride + Len; search_site_count++; - // Contract. + /* Contract. */ Len /= 2; } @@ -182,13 +185,20 @@ void vp8_init3smotion_compensation(MACROBLOCK *x, int stride) * 32 cols area that is enough for 16x16 macroblock. Later, for SPLITMV, we * could reduce the area. */ -#define MVC(r,c) (mvcost ? ((mvcost[0][(r)-rr] + mvcost[1][(c) - rc]) * error_per_bit + 128 )>>8 : 0) // estimated cost of a motion vector (r,c) -#define PRE(r,c) (y + (((r)>>2) * y_stride + ((c)>>2) -(offset))) // pointer to predictor base of a motionvector -#define SP(x) (((x)&3)<<1) // convert motion vector component to offset for svf calc -#define DIST(r,c) vfp->svf( PRE(r,c), y_stride, SP(c),SP(r), z,b->src_stride,&sse) // returns subpixel variance error function. + +/* estimated cost of a motion vector (r,c) */ +#define MVC(r,c) (mvcost ? ((mvcost[0][(r)-rr] + mvcost[1][(c) - rc]) * error_per_bit + 128 )>>8 : 0) +/* pointer to predictor base of a motionvector */ +#define PRE(r,c) (y + (((r)>>2) * y_stride + ((c)>>2) -(offset))) +/* convert motion vector component to offset for svf calc */ +#define SP(x) (((x)&3)<<1) +/* returns subpixel variance error function. */ +#define DIST(r,c) vfp->svf( PRE(r,c), y_stride, SP(c),SP(r), z,b->src_stride,&sse) #define IFMVCV(r,c,s,e) if ( c >= minc && c <= maxc && r >= minr && r <= maxr) s else e; -#define ERR(r,c) (MVC(r,c)+DIST(r,c)) // returns distortion + motion vector cost -#define CHECK_BETTER(v,r,c) IFMVCV(r,c,{thismse = DIST(r,c); if((v = (MVC(r,c)+thismse)) < besterr) { besterr = v; br=r; bc=c; *distortion = thismse; *sse1 = sse; }}, v=INT_MAX;)// checks if (r,c) has better score than previous best +/* returns distortion + motion vector cost */ +#define ERR(r,c) (MVC(r,c)+DIST(r,c)) +/* checks if (r,c) has better score than previous best */ +#define CHECK_BETTER(v,r,c) IFMVCV(r,c,{thismse = DIST(r,c); if((v = (MVC(r,c)+thismse)) < besterr) { besterr = v; br=r; bc=c; *distortion = thismse; *sse1 = sse; }}, v=INT_MAX;) int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv, int_mv *ref_mv, @@ -227,7 +237,7 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, unsigned char *y; int buf_r1, buf_r2, buf_c1, buf_c2; - // Clamping to avoid out-of-range data access + /* Clamping to avoid out-of-range data access */ buf_r1 = ((bestmv->as_mv.row - 3) < x->mv_row_min)?(bestmv->as_mv.row - x->mv_row_min):3; buf_r2 = ((bestmv->as_mv.row + 3) > x->mv_row_max)?(x->mv_row_max - bestmv->as_mv.row):3; buf_c1 = ((bestmv->as_mv.col - 3) < x->mv_col_min)?(bestmv->as_mv.col - x->mv_col_min):3; @@ -244,19 +254,21 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, offset = (bestmv->as_mv.row) * y_stride + bestmv->as_mv.col; - // central mv + /* central mv */ bestmv->as_mv.row <<= 3; bestmv->as_mv.col <<= 3; - // calculate central point error + /* calculate central point error */ besterr = vfp->vf(y, y_stride, z, b->src_stride, sse1); *distortion = besterr; besterr += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit); - // TODO: Each subsequent iteration checks at least one point in common with the last iteration could be 2 ( if diag selected) + /* TODO: Each subsequent iteration checks at least one point in common + * with the last iteration could be 2 ( if diag selected) + */ while (--halfiters) { - // 1/2 pel + /* 1/2 pel */ CHECK_BETTER(left, tr, tc - 2); CHECK_BETTER(right, tr, tc + 2); CHECK_BETTER(up, tr - 2, tc); @@ -280,7 +292,7 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, break; } - // no reason to check the same one again. + /* no reason to check the same one again. */ if (tr == br && tc == bc) break; @@ -288,8 +300,11 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, tc = bc; } - // TODO: Each subsequent iteration checks at least one point in common with the last iteration could be 2 ( if diag selected) - // 1/4 pel + /* TODO: Each subsequent iteration checks at least one point in common + * with the last iteration could be 2 ( if diag selected) + */ + + /* 1/4 pel */ while (--quarteriters) { CHECK_BETTER(left, tr, tc - 1); @@ -315,7 +330,7 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d, break; } - // no reason to check the same one again. + /* no reason to check the same one again. */ if (tr == br && tc == bc) break; @@ -373,17 +388,17 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, y_stride = pre_stride; #endif - // central mv + /* central mv */ bestmv->as_mv.row <<= 3; bestmv->as_mv.col <<= 3; startmv = *bestmv; - // calculate central point error + /* calculate central point error */ bestmse = vfp->vf(y, y_stride, z, b->src_stride, sse1); *distortion = bestmse; bestmse += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit); - // go left then right and check error + /* go left then right and check error */ this_mv.as_mv.row = startmv.as_mv.row; this_mv.as_mv.col = ((startmv.as_mv.col - 8) | 4); thismse = vfp->svf_halfpix_h(y - 1, y_stride, z, b->src_stride, &sse); @@ -409,7 +424,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, *sse1 = sse; } - // go up then down and check error + /* go up then down and check error */ this_mv.as_mv.col = startmv.as_mv.col; this_mv.as_mv.row = ((startmv.as_mv.row - 8) | 4); thismse = vfp->svf_halfpix_v(y - y_stride, y_stride, z, b->src_stride, &sse); @@ -436,10 +451,8 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, } - // now check 1 more diagonal + /* now check 1 more diagonal */ whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2); - //for(whichdir =0;whichdir<4;whichdir++) - //{ this_mv = startmv; switch (whichdir) @@ -477,10 +490,8 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, *sse1 = sse; } -// } - - // time to check quarter pels. + /* time to check quarter pels. */ if (bestmv->as_mv.row < startmv.as_mv.row) y -= y_stride; @@ -491,7 +502,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, - // go left then right and check error + /* go left then right and check error */ this_mv.as_mv.row = startmv.as_mv.row; if (startmv.as_mv.col & 7) @@ -527,7 +538,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, *sse1 = sse; } - // go up then down and check error + /* go up then down and check error */ this_mv.as_mv.col = startmv.as_mv.col; if (startmv.as_mv.row & 7) @@ -564,11 +575,9 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, } - // now check 1 more diagonal + /* now check 1 more diagonal */ whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2); -// for(whichdir=0;whichdir<4;whichdir++) -// { this_mv = startmv; switch (whichdir) @@ -690,17 +699,17 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, y_stride = pre_stride; #endif - // central mv + /* central mv */ bestmv->as_mv.row <<= 3; bestmv->as_mv.col <<= 3; startmv = *bestmv; - // calculate central point error + /* calculate central point error */ bestmse = vfp->vf(y, y_stride, z, b->src_stride, sse1); *distortion = bestmse; bestmse += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit); - // go left then right and check error + /* go left then right and check error */ this_mv.as_mv.row = startmv.as_mv.row; this_mv.as_mv.col = ((startmv.as_mv.col - 8) | 4); thismse = vfp->svf_halfpix_h(y - 1, y_stride, z, b->src_stride, &sse); @@ -726,7 +735,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, *sse1 = sse; } - // go up then down and check error + /* go up then down and check error */ this_mv.as_mv.col = startmv.as_mv.col; this_mv.as_mv.row = ((startmv.as_mv.row - 8) | 4); thismse = vfp->svf_halfpix_v(y - y_stride, y_stride, z, b->src_stride, &sse); @@ -752,7 +761,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d, *sse1 = sse; } - // now check 1 more diagonal - + /* now check 1 more diagonal - */ whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2); this_mv = startmv; @@ -875,12 +884,12 @@ int vp8_hex_search fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; - // adjust ref_mv to make sure it is within MV range + /* adjust ref_mv to make sure it is within MV range */ vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max); br = ref_mv->as_mv.row; bc = ref_mv->as_mv.col; - // Work out the start point for the search + /* Work out the start point for the search */ base_offset = (unsigned char *)(base_pre + d->offset); this_offset = base_offset + (br * (pre_stride)) + bc; this_mv.as_mv.row = br; @@ -901,8 +910,7 @@ int vp8_hex_search dia_range = 8; #endif - // hex search - //j=0 + /* hex search */ CHECK_BOUNDS(2) if(all_in) @@ -977,7 +985,7 @@ int vp8_hex_search } } - // check 4 1-away neighbors + /* check 4 1-away neighbors */ cal_neighbors: for (j = 0; j < dia_range; j++) { @@ -1066,8 +1074,11 @@ int vp8_diamond_search_sad_c unsigned char *check_here; int thissad; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; @@ -1078,17 +1089,19 @@ int vp8_diamond_search_sad_c best_mv->as_mv.row = ref_row; best_mv->as_mv.col = ref_col; - // Work out the start point for the search + /* Work out the start point for the search */ in_what = (unsigned char *)(base_pre + d->offset + (ref_row * pre_stride) + ref_col); best_address = in_what; - // Check the starting position + /* Check the starting position */ bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff) + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); - // search_param determines the length of the initial step and hence the number of iterations - // 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc. + /* search_param determines the length of the initial step and hence + * the number of iterations 0 = initial step (MAX_FIRST_STEP) pel : + * 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc. + */ ss = &x->ss[search_param * x->searches_per_step]; tot_steps = (x->ss_count / x->searches_per_step) - search_param; @@ -1098,7 +1111,7 @@ int vp8_diamond_search_sad_c { for (j = 0 ; j < x->searches_per_step ; j++) { - // Trap illegal vectors + /* Trap illegal vectors */ this_row_offset = best_mv->as_mv.row + ss[i].mv.row; this_col_offset = best_mv->as_mv.col + ss[i].mv.col; @@ -1189,8 +1202,11 @@ int vp8_diamond_search_sadx4 unsigned char *check_here; unsigned int thissad; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; @@ -1201,17 +1217,19 @@ int vp8_diamond_search_sadx4 best_mv->as_mv.row = ref_row; best_mv->as_mv.col = ref_col; - // Work out the start point for the search + /* Work out the start point for the search */ in_what = (unsigned char *)(base_pre + d->offset + (ref_row * pre_stride) + ref_col); best_address = in_what; - // Check the starting position + /* Check the starting position */ bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff) + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); - // search_param determines the length of the initial step and hence the number of iterations - // 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc. + /* search_param determines the length of the initial step and hence the + * number of iterations 0 = initial step (MAX_FIRST_STEP) pel : 1 = + * (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc. + */ ss = &x->ss[search_param * x->searches_per_step]; tot_steps = (x->ss_count / x->searches_per_step) - search_param; @@ -1221,8 +1239,10 @@ int vp8_diamond_search_sadx4 { int all_in = 1, t; - // To know if all neighbor points are within the bounds, 4 bounds checking are enough instead of - // checking 4 bounds for each points. + /* To know if all neighbor points are within the bounds, 4 bounds + * checking are enough instead of checking 4 bounds for each + * points. + */ all_in &= ((best_mv->as_mv.row + ss[i].mv.row)> x->mv_row_min); all_in &= ((best_mv->as_mv.row + ss[i+1].mv.row) < x->mv_row_max); all_in &= ((best_mv->as_mv.col + ss[i+2].mv.col) > x->mv_col_min); @@ -1263,7 +1283,7 @@ int vp8_diamond_search_sadx4 { for (j = 0 ; j < x->searches_per_step ; j++) { - // Trap illegal vectors + /* Trap illegal vectors */ this_row_offset = best_mv->as_mv.row + ss[i].mv.row; this_col_offset = best_mv->as_mv.col + ss[i].mv.col; @@ -1341,24 +1361,29 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int col_min = ref_col - distance; int col_max = ref_col + distance; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; - // Work out the mid point for the search + /* Work out the mid point for the search */ in_what = base_pre + d->offset; bestaddress = in_what + (ref_row * pre_stride) + ref_col; best_mv->as_mv.row = ref_row; best_mv->as_mv.col = ref_col; - // Baseline value at the centre + /* Baseline value at the centre */ bestsad = fn_ptr->sdf(what, what_stride, bestaddress, in_what_stride, 0x7fffffff) + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); - // Apply further limits to prevent us looking using vectors that stretch beyiond the UMV border + /* Apply further limits to prevent us looking using vectors that + * stretch beyiond the UMV border + */ if (col_min < x->mv_col_min) col_min = x->mv_col_min; @@ -1437,24 +1462,29 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, unsigned int sad_array[3]; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; - // Work out the mid point for the search + /* Work out the mid point for the search */ in_what = base_pre + d->offset; bestaddress = in_what + (ref_row * pre_stride) + ref_col; best_mv->as_mv.row = ref_row; best_mv->as_mv.col = ref_col; - // Baseline value at the centre + /* Baseline value at the centre */ bestsad = fn_ptr->sdf(what, what_stride, bestaddress, in_what_stride, 0x7fffffff) + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); - // Apply further limits to prevent us looking using vectors that stretch beyiond the UMV border + /* Apply further limits to prevent us looking using vectors that stretch + * beyond the UMV border + */ if (col_min < x->mv_col_min) col_min = x->mv_col_min; @@ -1570,24 +1600,29 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, DECLARE_ALIGNED_ARRAY(16, unsigned short, sad_array8, 8); unsigned int sad_array[3]; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; - // Work out the mid point for the search + /* Work out the mid point for the search */ in_what = base_pre + d->offset; bestaddress = in_what + (ref_row * pre_stride) + ref_col; best_mv->as_mv.row = ref_row; best_mv->as_mv.col = ref_col; - // Baseline value at the centre + /* Baseline value at the centre */ bestsad = fn_ptr->sdf(what, what_stride, bestaddress, in_what_stride, 0x7fffffff) + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit); - // Apply further limits to prevent us looking using vectors that stretch beyiond the UMV border + /* Apply further limits to prevent us looking using vectors that stretch + * beyond the UMV border + */ if (col_min < x->mv_col_min) col_min = x->mv_col_min; @@ -1721,9 +1756,11 @@ int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv int_mv this_mv; unsigned int bestsad = INT_MAX; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; @@ -1800,9 +1837,11 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv this_mv; unsigned int bestsad = INT_MAX; - int *mvsadcost[2] = {x->mvsadcost[0], x->mvsadcost[1]}; + int *mvsadcost[2]; int_mv fcenter_mv; + mvsadcost[0] = x->mvsadcost[0]; + mvsadcost[1] = x->mvsadcost[1]; fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; @@ -1906,16 +1945,16 @@ void print_mode_context(void) for (j = 0; j < 6; j++) { - fprintf(f, " { // %d \n", j); + fprintf(f, " { /* %d */\n", j); fprintf(f, " "); for (i = 0; i < 4; i++) { int overal_prob; int this_prob; - int count; // = mv_ref_ct[j][i][0]+mv_ref_ct[j][i][1]; + int count; - // Overall probs + /* Overall probs */ count = mv_mode_cts[i][0] + mv_mode_cts[i][1]; if (count) @@ -1926,7 +1965,7 @@ void print_mode_context(void) if (overal_prob == 0) overal_prob = 1; - // context probs + /* context probs */ count = mv_ref_ct[j][i][0] + mv_ref_ct[j][i][1]; if (count) @@ -1938,8 +1977,6 @@ void print_mode_context(void) this_prob = 1; fprintf(f, "%5d, ", this_prob); - //fprintf(f,"%5d, %5d, %8d,", this_prob, overal_prob, (this_prob << 10)/overal_prob); - //fprintf(f,"%8d, ", (this_prob << 10)/overal_prob); } fprintf(f, " },\n"); |