From: Fiona Glaser Date: Sun, 6 Sep 2009 02:22:21 +0000 (-0700) Subject: Factor out a redundant RD call in qpel-RD X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1f4237e0b5ba0718e88ef5529567872ea82477a;p=libx264 Factor out a redundant RD call in qpel-RD Fixes a problem that was supposed to be, but didn't, get fully fixed in r1238. --- diff --git a/encoder/analyse.c b/encoder/analyse.c index daf7e67e..68d0e948 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -2574,7 +2574,7 @@ int x264_macroblock_analyse( x264_t *h ) else if( i_partition == D_16x16 ) { x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, analysis.l0.me16x16.i_ref ); - analysis.l0.me16x16.cost = analysis.l0.i_rd16x16; + analysis.l0.me16x16.cost = i_cost; x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0, 0 ); } else if( i_partition == D_16x8 ) @@ -2878,12 +2878,12 @@ int x264_macroblock_analyse( x264_t *h ) { if( i_type == B_L0_L0 ) { - analysis.l0.me16x16.cost = analysis.l0.i_rd16x16; + analysis.l0.me16x16.cost = i_cost; x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0, 0 ); } else if( i_type == B_L1_L1 ) { - analysis.l1.me16x16.cost = analysis.l1.i_rd16x16; + analysis.l1.me16x16.cost = i_cost; x264_me_refine_qpel_rd( h, &analysis.l1.me16x16, analysis.i_lambda2, 0, 1 ); } else if( i_type == B_BI_BI ) diff --git a/encoder/me.c b/encoder/me.c index fd602c86..72a2cc56 100644 --- a/encoder/me.c +++ b/encoder/me.c @@ -1079,7 +1079,7 @@ void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int const int i_pixel = m->i_pixel; ALIGNED_ARRAY_16( uint8_t, pix,[16*16] ); - uint64_t bcost = m->i_pixel == PIXEL_16x16 ? m->cost : COST_MAX64; + uint64_t bcost = COST_MAX64; int bmx = m->mv[0]; int bmy = m->mv[1]; int omx, omy, pmx, pmy, i, j; @@ -1095,7 +1095,10 @@ void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int p_cost_mvx = m->p_cost_mv - pmx; p_cost_mvy = m->p_cost_mv - pmy; COST_MV_SATD( bmx, bmy, bsatd, 0 ); - COST_MV_RD( bmx, bmy, 0, 0, 0 ); + if( m->i_pixel != PIXEL_16x16 ) + COST_MV_RD( bmx, bmy, 0, 0, 0 ) + else + bcost = m->cost; /* check the predicted mv */ if( (bmx != pmx || bmy != pmy)