summaryrefslogtreecommitdiffstats
path: root/libhb/enc_qsv.c
diff options
context:
space:
mode:
authormaxd <[email protected]>2017-11-30 13:12:59 +0100
committerScott <[email protected]>2017-12-04 18:55:01 +0000
commite35ed035e615e6e570cdc3b9c6a4ce9d88f912a5 (patch)
tree95fbb612e823ce05640626a42f9734e4a8c20f80 /libhb/enc_qsv.c
parent18a0161a336e0ec00e8e088d619e0e763e5b7585 (diff)
QSV: adjusting QP range to address all values
Diffstat (limited to 'libhb/enc_qsv.c')
-rw-r--r--libhb/enc_qsv.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c
index 765777f7e..228eb401c 100644
--- a/libhb/enc_qsv.c
+++ b/libhb/enc_qsv.c
@@ -978,10 +978,21 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
else
{
// introduced in API 1.1
+ // HEVC 10b has QP range as [-12;51]
+ // with shift +12 needed to be in QSV's U16 range
+ unsigned int low_limit = 0;
+ unsigned int shift = 0;
+
+ if (pv->param.videoParam->mfx.CodecProfile == MFX_PROFILE_HEVC_MAIN10)
+ {
+ low_limit = -12;
+ shift = 12;
+ }
pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_CQP;
- pv->param.videoParam->mfx.QPI = HB_QSV_CLIP3(0, 51, job->vquality + pv->param.rc.cqp_offsets[0]);
- pv->param.videoParam->mfx.QPP = HB_QSV_CLIP3(0, 51, job->vquality + pv->param.rc.cqp_offsets[1]);
- pv->param.videoParam->mfx.QPB = HB_QSV_CLIP3(0, 51, job->vquality + pv->param.rc.cqp_offsets[2]);
+ pv->param.videoParam->mfx.QPI = HB_QSV_CLIP3(low_limit, 51, job->vquality + pv->param.rc.cqp_offsets[0]) + shift;
+ pv->param.videoParam->mfx.QPP = HB_QSV_CLIP3(low_limit, 51, job->vquality + pv->param.rc.cqp_offsets[1]) + shift;
+ pv->param.videoParam->mfx.QPB = HB_QSV_CLIP3(low_limit, 51, job->vquality + pv->param.rc.cqp_offsets[2]) + shift;
+
// CQP + ExtBRC can cause bad output
pv->param.codingOption2.ExtBRC = MFX_CODINGOPTION_OFF;
}