[x264-devel] Use integer math for filler size calculation
Anton Mitrofanov
git at videolan.org
Wed Apr 13 04:04:28 CEST 2011
x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Apr 6 22:48:57 2011 +0400| [529bbefe6cb2dfcde967bff97528d70e14cea5c7] | committer: Jason Garrett-Glaser
Use integer math for filler size calculation
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=529bbefe6cb2dfcde967bff97528d70e14cea5c7
---
encoder/ratecontrol.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 3abd198..ce9a93e 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -1828,7 +1828,8 @@ static int update_vbv( x264_t *h, int bits )
if( h->sps->vui.hrd.b_cbr_hrd && rct->buffer_fill_final > buffer_size )
{
- filler = ceil( (rct->buffer_fill_final - buffer_size) / (8. * h->sps->vui.i_time_scale) );
+ int64_t scale = (int64_t)h->sps->vui.i_time_scale * 8;
+ filler = (rct->buffer_fill_final - buffer_size + scale - 1) / scale;
bits = X264_MAX( (FILLER_OVERHEAD - h->param.b_annexb), filler ) * 8;
rct->buffer_fill_final -= (uint64_t)bits * h->sps->vui.i_time_scale;
}
More information about the x264-devel
mailing list