summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-08-25 19:48:14 +0000
committerRodeo <[email protected]>2013-08-25 19:48:14 +0000
commit3e700c6e8f0054679d56b7bc5869a48f892a2291 (patch)
treecd5605c1a054078df16c80891d126f34a208d9ce /libhb
parent986883897ba4dd0064cc34caf23f5890485a06ef (diff)
QSV: don't use AVBR rate control.
User testing shows it's unreliable, and VBR works just as well for that purpose. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5749 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/enc_qsv.c58
-rw-r--r--libhb/qsv_common.c6
2 files changed, 21 insertions, 43 deletions
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c
index c1c832a81..0c8a221e5 100644
--- a/libhb/enc_qsv.c
+++ b/libhb/enc_qsv.c
@@ -600,6 +600,7 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
else if (pv->param.rc.lookahead < 0)
{
if (pv->param.rc.vbv_max_bitrate > 0 ||
+ pv->param.rc.vbv_buffer_size > 0 ||
pv->param.videoParam->mfx.FrameInfo.PicStruct != MFX_PICSTRUCT_PROGRESSIVE)
{
// lookahead doesn't support VBV or interlaced encoding
@@ -621,62 +622,43 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
// introduced in API 1.7
pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_LA;
pv->param.videoParam->mfx.TargetKbps = job->vbitrate;
- if (pv->param.rc.vbv_max_bitrate > 0)
+ if (pv->param.rc.vbv_max_bitrate > 0 ||
+ pv->param.rc.vbv_buffer_size > 0)
{
hb_log("encqsvInit: MFX_RATECONTROL_LA, ignoring VBV");
}
}
- else if (job->vbitrate == pv->param.rc.vbv_max_bitrate)
+ else
{
// introduced in API 1.0
- pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_CBR;
- pv->param.videoParam->mfx.MaxKbps = job->vbitrate;
- pv->param.videoParam->mfx.TargetKbps = job->vbitrate;
- pv->param.videoParam->mfx.BufferSizeInKB = (pv->param.rc.vbv_buffer_size / 8);
- // only set BufferSizeInKB and InitialDelayInKB is bufsize is set
- // else Media SDK will pick some good values for us automatically
- if (pv->param.rc.vbv_buffer_size > 0)
+ if (job->vbitrate == pv->param.rc.vbv_max_bitrate)
{
- if (pv->param.rc.vbv_buffer_init > 1.0)
- {
- pv->param.videoParam->mfx.InitialDelayInKB = (pv->param.rc.vbv_buffer_init / 8);
- }
- else
- {
- pv->param.videoParam->mfx.InitialDelayInKB = (pv->param.rc.vbv_buffer_size *
- pv->param.rc.vbv_buffer_init / 8);
- }
- pv->param.videoParam->mfx.BufferSizeInKB = (pv->param.rc.vbv_buffer_size / 8);
+ pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_CBR;
}
- }
- else if (pv->param.rc.vbv_max_bitrate > 0)
- {
- // introduced in API 1.0
- pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_VBR;
- pv->param.videoParam->mfx.MaxKbps = pv->param.rc.vbv_max_bitrate;
- pv->param.videoParam->mfx.TargetKbps = job->vbitrate;
- // only set BufferSizeInKB and InitialDelayInKB is bufsize is set
- // else Media SDK will pick some good values for us automatically
+ else
+ {
+ pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_VBR;
+ }
+ // only set BufferSizeInKB, InitialDelayInKB and MaxKbps if we have
+ // them - otheriwse Media SDK will pick values for us automatically
if (pv->param.rc.vbv_buffer_size > 0)
{
if (pv->param.rc.vbv_buffer_init > 1.0)
{
pv->param.videoParam->mfx.InitialDelayInKB = (pv->param.rc.vbv_buffer_init / 8);
}
- else
+ else if (pv->param.rc.vbv_buffer_init > 0.0)
{
pv->param.videoParam->mfx.InitialDelayInKB = (pv->param.rc.vbv_buffer_size *
pv->param.rc.vbv_buffer_init / 8);
}
pv->param.videoParam->mfx.BufferSizeInKB = (pv->param.rc.vbv_buffer_size / 8);
}
- }
- else
- {
- // introduced in API 1.3
- // Media SDK will set Accuracy and Convergence for us automatically
- pv->param.videoParam->mfx.RateControlMethod = MFX_RATECONTROL_AVBR;
- pv->param.videoParam->mfx.TargetKbps = job->vbitrate;
+ if (pv->param.rc.vbv_max_bitrate > 0)
+ {
+ pv->param.videoParam->mfx.MaxKbps = pv->param.rc.vbv_max_bitrate;
+ }
+ pv->param.videoParam->mfx.TargetKbps = job->vbitrate;
}
}
else
@@ -832,10 +814,6 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
{
switch (videoParam.mfx.RateControlMethod)
{
- case MFX_RATECONTROL_AVBR:
- hb_log("encqsvInit: RateControlMethod AVBR TargetKbps %"PRIu16"",
- videoParam.mfx.TargetKbps);
- break;
case MFX_RATECONTROL_LA:
hb_log("encqsvInit: RateControlMethod LA TargetKbps %"PRIu16" LookAheadDepth %"PRIu16"",
videoParam.mfx.TargetKbps, option2->LookAheadDepth);
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index 7cc0bb70c..6028331cb 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -734,9 +734,9 @@ int hb_qsv_param_default(hb_qsv_param_t *param, mfxVideoParam *videoParam)
param->rc.cqp_offsets[0] = 0;
param->rc.cqp_offsets[1] = 2;
param->rc.cqp_offsets[2] = 4;
- param->rc.vbv_max_bitrate = 0;
- param->rc.vbv_buffer_size = 0;
- param->rc.vbv_buffer_init = .5;
+ param->rc.vbv_max_bitrate = 0; // set automatically
+ param->rc.vbv_buffer_size = 0; // set automatically
+ param->rc.vbv_buffer_init = .0; // set automatically
// introduced in API 1.0
memset(videoParam, 0, sizeof(mfxVideoParam));