]> git.videolan.org Git - x264.git/commitdiff
Fix bug in weightp analysis
authorJason Garrett-Glaser <darkshikari@gmail.com>
Wed, 25 Nov 2009 06:37:02 +0000 (22:37 -0800)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Wed, 25 Nov 2009 06:37:02 +0000 (22:37 -0800)
Weights weren't reset upon early terminations, so old (wrong) weights could stick around.
Small compression improvement.

encoder/slicetype.c

index d40f7be37385300ec9070cbf604a48a61db8b61f..64c47cbd8ff7212961864e42ca3303a2248af8d1 100644 (file)
@@ -190,7 +190,10 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
 
     //early termination
     if( fabs( ref_mean - fenc_mean ) < 0.5 && fabsf( 1 - (float)fenc_var / ref_var ) < epsilon )
+    {
+        SET_WEIGHT( weights[0], 0, 1, 0, 0 );
         return;
+    }
 
     guess_scale = ref_var ? (float)fenc_var/ref_var : 0;
     get_h264_weight( round( guess_scale * 128 ), 0, &weights[0] );
@@ -211,7 +214,10 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
     origscore = minscore = x264_weight_cost( h, fenc, mcbuf, 0 );
 
     if( !minscore )
+    {
+        SET_WEIGHT( weights[0], 0, 1, 0, 0 );
         return;
+    }
 
     // This gives a slight improvement due to rounding errors but only tests
     // one offset on lookahead.