From 0f0738745170bd3fdd56c0580a164e50b515c12d Mon Sep 17 00:00:00 2001 From: ritsuka Date: Thu, 11 Oct 2007 13:10:41 +0000 Subject: Fixed a problem when using more than 13 b-frames in x264 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1018 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/encx264.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libhb/encx264.c') diff --git a/libhb/encx264.c b/libhb/encx264.c index 7c2d55480..6709716ff 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -23,8 +23,7 @@ hb_work_object_t hb_encx264 = encx264Close }; -// 16 is probably overkill but it's also the maximum for h.264 reference frames -#define MAX_INFLIGHT_FRAMES 16 +#define DTS_BUFFER_SIZE 32 struct hb_work_private_s { @@ -33,8 +32,8 @@ struct hb_work_private_s x264_picture_t pic_in; // Internal queue of DTS start/stop values. - int64_t dts_start[MAX_INFLIGHT_FRAMES]; - int64_t dts_stop[MAX_INFLIGHT_FRAMES]; + int64_t dts_start[DTS_BUFFER_SIZE]; + int64_t dts_stop[DTS_BUFFER_SIZE]; int64_t dts_write_index; int64_t dts_read_index; @@ -304,8 +303,8 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, pv->pic_in.i_qpplus1 = 0; // Remember current PTS value, use as DTS later - pv->dts_start[pv->dts_write_index & (MAX_INFLIGHT_FRAMES-1)] = in->start; - pv->dts_stop[pv->dts_write_index & (MAX_INFLIGHT_FRAMES-1)] = in->stop; + pv->dts_start[pv->dts_write_index & (DTS_BUFFER_SIZE-1)] = in->start; + pv->dts_stop[pv->dts_write_index & (DTS_BUFFER_SIZE-1)] = in->stop; pv->dts_write_index++; /* Feed the input DTS to x264 so it can figure out proper output PTS */ @@ -345,8 +344,8 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, int64_t dts_start, dts_stop; /* Get next DTS value to use */ - dts_start = pv->dts_start[pv->dts_read_index & (MAX_INFLIGHT_FRAMES-1)]; - dts_stop = pv->dts_stop[pv->dts_read_index & (MAX_INFLIGHT_FRAMES-1)]; + dts_start = pv->dts_start[pv->dts_read_index & (DTS_BUFFER_SIZE-1)]; + dts_stop = pv->dts_stop[pv->dts_read_index & (DTS_BUFFER_SIZE-1)]; pv->dts_read_index++; for( i = 0; i < i_nal; i++ ) -- cgit v1.2.3