[x264-devel] commit: Fix bug in weightp analysis (Jason Garrett-Glaser )

git version control git at videolan.org
Fri Nov 27 06:22:46 CET 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Nov 24 22:37:02 2009 -0800| [626affea98f4db9208cbf0e3db78f23804defd0c] | committer: Jason Garrett-Glaser 

Fix bug in weightp analysis
Weights weren't reset upon early terminations, so old (wrong) weights could stick around.
Small compression improvement.

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

 encoder/slicetype.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index d40f7be..64c47cb 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -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.



More information about the x264-devel mailing list