From 26b0e89fc72928ba67e2f4b5b490abcd114a99f3 Mon Sep 17 00:00:00 2001 From: Rodeo Date: Mon, 1 Jul 2013 02:04:02 +0000 Subject: [PATCH] QSV: enc_qsv: improve DTS generation with B-pyramid and large number of consecutive B-refs. This is hackier than I imagined; clearly my code could benefit from some improvement. git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/qsv@5627 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/enc_qsv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index 431b3969b..21a1f42f7 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -106,7 +106,7 @@ struct hb_work_private_s int64_t start; } next_chapter; -#define BFRM_DELAY_MAX 2 // for B-pyramid +#define BFRM_DELAY_MAX 5 // for DTS generation (when MSDK < 1.6) int bfrm_delay; int bfrm_workaround; @@ -620,9 +620,9 @@ int qsv_enc_init( av_qsv_context* qsv, hb_work_private_t * pv ){ // check whether B-frames are used and compute the delay pv->bfrm_delay = pv->codec_profile == MFX_PROFILE_AVC_BASELINE ? 0 : 1; - if (pv->bfrm_delay) + if (pv->bfrm_delay && (hb_qsv_info->capabilities & HB_QSV_CAP_BPYRAMID)) { - pv->bfrm_delay += !!(hb_qsv_info->capabilities & HB_QSV_CAP_BPYRAMID); + pv->bfrm_delay = BFRM_DELAY_MAX; } if (qsv_encode->m_mfxVideoParam.mfx.GopRefDist > 0) { @@ -922,6 +922,7 @@ int encqsvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, * 0 -> ipts0, ipts1, ipts2... * 1 -> ipts0 - ipts1, ipts1 - ipts1, ipts1, ipts2... * 2 -> ipts0 - ipts2, ipts1 - ipts2, ipts2 - ipts2, ipts1, ipts2... + * and so on. */ if (pv->bfrm_delay && pv->bfrm_workaround) { -- 2.40.0