]> granicus.if.org Git - libx264/commitdiff
Implicit weights in B16x16 analysis were swapped.
authorLoren Merritt <pengvado@videolan.org>
Thu, 24 Feb 2005 13:00:34 +0000 (13:00 +0000)
committerLoren Merritt <pengvado@videolan.org>
Thu, 24 Feb 2005 13:00:34 +0000 (13:00 +0000)
patch by Radek Czyz.

git-svn-id: svn://svn.videolan.org/x264/trunk@140 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/analyse.c

index 4b89a223b625bbe409855110f1323ee9808c9212..d55ab7650cdb463f4b44dbe44e2fe7cbf0a768c7 100644 (file)
@@ -832,6 +832,7 @@ static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
     uint8_t pix1[16*16], pix2[16*16];
     uint8_t *src2;
     int stride2 = 16;
+    int src2_ref, pix1_ref;
 
     x264_me_t m;
     int i_ref;
@@ -914,6 +915,8 @@ static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
                         pix1, 16,
                         a->l1.me16x16.mv[0], a->l1.me16x16.mv[1],
                         16, 16 );
+        src2_ref = a->l0.i_ref;
+        pix1_ref = a->l1.i_ref;
     } 
     else
     {
@@ -926,9 +929,15 @@ static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )
                         pix2, &stride2,
                         a->l1.me16x16.mv[0], a->l1.me16x16.mv[1],
                         16, 16 );
+        src2_ref = a->l1.i_ref;
+        pix1_ref = a->l0.i_ref;
     }
 
-    WEIGHTED_AVG( PIXEL_16x16, pix1, 16, src2, stride2 );
+    if( h->param.analyse.b_weighted_bipred )
+        h->pixf.avg_weight[PIXEL_16x16]( pix1, 16, src2, stride2,
+                h->mb.bipred_weight[pix1_ref][src2_ref] );
+    else
+        h->pixf.avg[PIXEL_16x16]( pix1, 16, src2, stride2 );
 
     a->i_cost16x16bi = h->pixf.satd[PIXEL_16x16]( h->mb.pic.p_fenc[0], h->mb.pic.i_stride[0], pix1, 16 )
                      + a->i_lambda * ( bs_size_te( h->sh.i_num_ref_idx_l0_active - 1, a->l0.i_ref )