]> granicus.if.org Git - libx264/commitdiff
Fix case in which MB-tree didn't propagate all data correctly
authorAnton Mitrofanov <BugMaster@narod.ru>
Wed, 28 Oct 2009 19:57:11 +0000 (12:57 -0700)
committerFiona Glaser <fiona@x264.com>
Thu, 29 Oct 2009 20:55:43 +0000 (13:55 -0700)
Should improve quality in all cases.
Also some minor cosmetic improvements.

encoder/slicetype.c

index 8414dbb17300507e1cd91efca3988f99c8993ca1..00f89c3fd32f849f2a42d9324540008a0785516e 100644 (file)
@@ -506,7 +506,7 @@ static void x264_macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t
         i--;
     last_nonb = i;
 
-    if( last_nonb < 0 )
+    if( last_nonb < idx )
         return;
 
     memset( frames[last_nonb]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
@@ -519,14 +519,14 @@ static void x264_macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t
             break;
         x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, last_nonb, 0 );
         memset( frames[cur_nonb]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
-        x264_macroblock_tree_propagate( h, frames, cur_nonb, last_nonb, last_nonb );
-        while( frames[i]->i_type == X264_TYPE_B && i > 0 )
+        while( i > cur_nonb )
         {
             x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, i, 0 );
             memset( frames[i]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) );
             x264_macroblock_tree_propagate( h, frames, cur_nonb, last_nonb, i );
             i--;
         }
+        x264_macroblock_tree_propagate( h, frames, cur_nonb, last_nonb, last_nonb );
         last_nonb = cur_nonb;
     }