[x264-devel] commit: Correct misprediction of bitrate in threaded mode ( Gabriel Bouvigne )
git version control
git at videolan.org
Tue Sep 16 10:54:36 CEST 2008
x264 | branch: master | Gabriel Bouvigne <bouvigne at mp3-tech.org> | Tue Sep 16 01:54:37 2008 -0700| [2042a196655aae035d1ef8164c4d4f46ce83dbee] | committer: Jason Garrett-Glaser
Correct misprediction of bitrate in threaded mode
Improves bitrate accuracy in cases with large numbers of threads.
Loosely based on a patch by BugMaster.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=2042a196655aae035d1ef8164c4d4f46ce83dbee
---
encoder/ratecontrol.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 1559c72..103e73b 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -1348,6 +1348,21 @@ static float rate_estimate_qscale( x264_t *h )
+ h->stat.i_slice_size[SLICE_TYPE_P]
+ h->stat.i_slice_size[SLICE_TYPE_B]);
+ if( h->param.i_threads > 1 )
+ {
+ int j = h->rc - h->thread[0]->rc;
+ int i;
+ for( i=1; i<h->param.i_threads; i++ )
+ {
+ x264_t *t = h->thread[ (j+i)%h->param.i_threads ];
+ double bits = t->rc->frame_size_planned;
+ if( !t->b_thread_active )
+ continue;
+ bits = X264_MAX(bits, x264_ratecontrol_get_estimated_size(t));
+ total_bits += (int64_t)bits;
+ }
+ }
+
if( rcc->b_2pass )
{
rce = *rcc->rce;
More information about the x264-devel
mailing list