]> git.videolan.org Git - x264.git/commitdiff
Improve VBV accuracy
authorGabriel Bouvigne <bouvigne@mp3-tech.org>
Mon, 25 Aug 2008 14:50:45 +0000 (10:50 -0400)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 25 Aug 2008 14:51:38 +0000 (10:51 -0400)
Don't use the previous frame's row SATD as a predictor if it is too different from this frame's row SATD.

encoder/ratecontrol.c

index 5f9ac54746640f272697577f3d681ade9f4ab068..1d41200ba0a0999294a76a4d44f0e348441aad28 100644 (file)
@@ -866,7 +866,8 @@ static double predict_row_size( x264_t *h, int y, int qp )
     double pred_t = 0;
     if( h->sh.i_type != SLICE_TYPE_I
         && h->fref0[0]->i_type == h->fdec->i_type
-        && h->fref0[0]->i_row_satd[y] > 0 )
+        && h->fref0[0]->i_row_satd[y] > 0
+        && (abs(h->fref0[0]->i_row_satd[y] - h->fdec->i_row_satd[y]) < h->fdec->i_row_satd[y]/2))
     {
         pred_t = h->fref0[0]->i_row_bits[y] * h->fdec->i_row_satd[y] / h->fref0[0]->i_row_satd[y]
                  * qp2qscale(h->fref0[0]->i_row_qp[y]) / qp2qscale(qp);