From: Rodeo Date: Sun, 15 Dec 2013 20:15:56 +0000 (+0000) Subject: QSV: check whether b_pyramid is respected in the non-workaround path too. X-Git-Tag: 0.10.0~600 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c193ab25bef0c3e1fa83603baa374cb2d65466ae;p=handbrake QSV: check whether b_pyramid is respected in the non-workaround path too. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5931 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index 78f7aab87..3e54315b0 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -1437,35 +1437,36 @@ int encqsvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, buf->s.duration = duration; if (pv->bfrm_delay) { + if ((pv->frames_out == 0) && + (hb_qsv_info->capabilities & HB_QSV_CAP_MSDK_API_1_6) && + (hb_qsv_info->capabilities & HB_QSV_CAP_H264_BPYRAMID)) + { + // with B-pyramid, the delay may be more than 1 frame, + // so compute the actual delay based on the initial DTS + // provided by MSDK; also, account for rounding errors + // (e.g. 24000/1001 fps @ 90kHz -> 3753.75 ticks/frame) + pv->bfrm_delay = HB_QSV_CLIP3(1, BFRM_DELAY_MAX, + ((task->bs->TimeStamp - + task->bs->DecodeTimeStamp + + (duration / 2)) / duration)); + // check whether b_pyramid is respected, log if needed + if ((pv->param.gop.b_pyramid != 0 && pv->bfrm_delay <= 1) || + (pv->param.gop.b_pyramid == 0 && pv->bfrm_delay >= 2)) + { + hb_log( "encqsvWork: b_pyramid %d not respected (delay: %d)", + pv->param.gop.b_pyramid, pv->bfrm_delay); + } + } + if (!pv->bfrm_workaround) { buf->s.renderOffset = task->bs->DecodeTimeStamp; } else { - // MSDK API < 1.6 or VFR, so generate our own DTS - if ((pv->frames_out == 0) && - (hb_qsv_info->capabilities & HB_QSV_CAP_MSDK_API_1_6) && - (hb_qsv_info->capabilities & HB_QSV_CAP_H264_BPYRAMID)) - { - // with B-pyramid, the delay may be more than 1 frame, - // so compute the actual delay based on the initial DTS - // provided by MSDK; also, account for rounding errors - // (e.g. 24000/1001 fps @ 90kHz -> 3753.75 ticks/frame) - pv->bfrm_delay = ((task->bs->TimeStamp - - task->bs->DecodeTimeStamp + - (duration / 2)) / duration); - pv->bfrm_delay = FFMAX(pv->bfrm_delay, 1); - pv->bfrm_delay = FFMIN(pv->bfrm_delay, BFRM_DELAY_MAX); - // check whether b_pyramid is respected, log if needed - if ((pv->param.gop.b_pyramid != 0 && pv->bfrm_delay <= 1) || - (pv->param.gop.b_pyramid == 0 && pv->bfrm_delay >= 2)) - { - hb_log("encqsvWork: b_pyramid %d not respected (delay: %d)", - pv->param.gop.b_pyramid, pv->bfrm_delay); - } - } /* + * MSDK API < 1.6 or VFR + * * Generate VFR-compatible output DTS based on input PTS. * * Depends on the B-frame delay: