[x264-devel] commit: Factor out a redundant RD call in qpel-RD (Jason Garrett-Glaser )

git version control git at videolan.org
Sun Sep 6 19:37:01 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Sep  5 19:22:21 2009 -0700| [e553a4cc858649b951e9dee456c717f5f5dcd3e9] | committer: Jason Garrett-Glaser 

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.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=e553a4cc858649b951e9dee456c717f5f5dcd3e9
---

 encoder/analyse.c |    6 +++---
 encoder/me.c      |    7 +++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/encoder/analyse.c b/encoder/analyse.c
index 92b5ae5..a3f7cd8 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 df034c6..f92c9c1 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)



More information about the x264-devel mailing list