[x264-devel] commit: Fix delay calculation with multiple threads (Jason Garrett-Glaser )

git version control git at videolan.org
Sat Aug 8 04:34:36 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Fri Aug  7 10:31:16 2009 -0700| [cb0b71fb981a3c6020d628dc7a41855b81df8d54] | committer: Jason Garrett-Glaser 

Fix delay calculation with multiple threads
Delay frames for threading don't actually count as part of lookahead.

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

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

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 4188baf..6f5bbd5 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -746,11 +746,13 @@ x264_t *x264_encoder_open   ( x264_param_t *param )
 
     /* Init frames. */
     if( h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS )
-        h->frames.i_delay = X264_MAX(h->param.i_bframe,3)*4 + h->param.i_threads - 1;
+        h->frames.i_delay = X264_MAX(h->param.i_bframe,3)*4;
     else
-        h->frames.i_delay = h->param.i_bframe + h->param.i_threads - 1;
+        h->frames.i_delay = h->param.i_bframe;
     if( h->param.rc.b_mb_tree )
         h->frames.i_delay = X264_MAX( h->frames.i_delay, h->param.rc.i_lookahead );
+    h->frames.i_delay += h->param.i_threads - 1;
+    h->frames.i_delay = X264_MIN( h->frames.i_delay, X264_LOOKAHEAD_MAX );
 
     h->frames.i_max_ref0 = h->param.i_frame_reference;
     h->frames.i_max_ref1 = h->sps->vui.i_num_reorder_frames;



More information about the x264-devel mailing list