]> granicus.if.org Git - handbrake/commitdiff
QSV: enc_qsv: improve DTS generation with B-pyramid and large number of consecutive...
authorRodeo <tdskywalker@gmail.com>
Mon, 1 Jul 2013 02:04:02 +0000 (02:04 +0000)
committerRodeo <tdskywalker@gmail.com>
Mon, 1 Jul 2013 02:04:02 +0000 (02:04 +0000)
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

index 431b3969bd3c07a89b43144dbdc36620b2bf792e..21a1f42f7e4f0964bbb0a34142fe1321de3f9e85 100644 (file)
@@ -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)
             {