]> git.sesse.net Git - x264/commitdiff
Change the predictors update algorithm
authorAnton Mitrofanov <BugMaster@narod.ru>
Tue, 22 Sep 2015 15:58:24 +0000 (18:58 +0300)
committerHenrik Gramner <henrik@gramner.com>
Sun, 11 Oct 2015 16:44:54 +0000 (18:44 +0200)
Keep predictor offsets more stable. This should fix VBV misprediction in frames
with a large difference in complexity between the top and bottom parts.

encoder/ratecontrol.c

index d49e2a2271a4d15fbeb2154add70007767bb9b93..78051ccc29502f4211f8f927c7160833fe1ed37e 100644 (file)
@@ -2089,7 +2089,8 @@ static void update_predictor( predictor_t *p, float q, float var, float bits )
     if( var < 10 )
         return;
     float old_coeff = p->coeff / p->count;
-    float new_coeff = X264_MAX( bits*q / var, p->coeff_min );
+    float old_offset = p->offset / p->count;
+    float new_coeff = X264_MAX( (bits*q - old_offset) / var, p->coeff_min );
     float new_coeff_clipped = x264_clip3f( new_coeff, old_coeff/range, old_coeff*range );
     float new_offset = bits*q - new_coeff_clipped * var;
     if( new_offset >= 0 )