Commit 8bb9824f authored by Zhong Li's avatar Zhong Li Committed by Maxym Dmytrychenko

qsvenc: AVBR is not supported on non-windows OS

AVBR is supported from API 1.3 but only available for Windows
Signed-off-by: 's avatarZhong Li <zhong.li@intel.com>
Signed-off-by: 's avatarMaxym Dmytrychenko <maxim.d33@gmail.com>
parent e412d683
...@@ -84,7 +84,9 @@ static const struct { ...@@ -84,7 +84,9 @@ static const struct {
{ MFX_RATECONTROL_CBR, "CBR" }, { MFX_RATECONTROL_CBR, "CBR" },
{ MFX_RATECONTROL_VBR, "VBR" }, { MFX_RATECONTROL_VBR, "VBR" },
{ MFX_RATECONTROL_CQP, "CQP" }, { MFX_RATECONTROL_CQP, "CQP" },
#if QSV_HAVE_AVBR
{ MFX_RATECONTROL_AVBR, "AVBR" }, { MFX_RATECONTROL_AVBR, "AVBR" },
#endif
#if QSV_HAVE_LA #if QSV_HAVE_LA
{ MFX_RATECONTROL_LA, "LA" }, { MFX_RATECONTROL_LA, "LA" },
#endif #endif
...@@ -163,11 +165,14 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, ...@@ -163,11 +165,14 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
} else if (info->RateControlMethod == MFX_RATECONTROL_CQP) { } else if (info->RateControlMethod == MFX_RATECONTROL_CQP) {
av_log(avctx, AV_LOG_VERBOSE, "QPI: %"PRIu16"; QPP: %"PRIu16"; QPB: %"PRIu16"\n", av_log(avctx, AV_LOG_VERBOSE, "QPI: %"PRIu16"; QPP: %"PRIu16"; QPB: %"PRIu16"\n",
info->QPI, info->QPP, info->QPB); info->QPI, info->QPP, info->QPB);
} else if (info->RateControlMethod == MFX_RATECONTROL_AVBR) { }
#if QSV_HAVE_AVBR
else if (info->RateControlMethod == MFX_RATECONTROL_AVBR) {
av_log(avctx, AV_LOG_VERBOSE, av_log(avctx, AV_LOG_VERBOSE,
"TargetKbps: %"PRIu16"; Accuracy: %"PRIu16"; Convergence: %"PRIu16"\n", "TargetKbps: %"PRIu16"; Accuracy: %"PRIu16"; Convergence: %"PRIu16"\n",
info->TargetKbps, info->Accuracy, info->Convergence); info->TargetKbps, info->Accuracy, info->Convergence);
} }
#endif
#if QSV_HAVE_LA #if QSV_HAVE_LA
else if (info->RateControlMethod == MFX_RATECONTROL_LA else if (info->RateControlMethod == MFX_RATECONTROL_LA
#if QSV_HAVE_LA_HRD #if QSV_HAVE_LA_HRD
...@@ -333,10 +338,14 @@ static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q) ...@@ -333,10 +338,14 @@ static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q)
else if (avctx->rc_max_rate == avctx->bit_rate) { else if (avctx->rc_max_rate == avctx->bit_rate) {
rc_mode = MFX_RATECONTROL_CBR; rc_mode = MFX_RATECONTROL_CBR;
rc_desc = "constant bitrate (CBR)"; rc_desc = "constant bitrate (CBR)";
} else if (!avctx->rc_max_rate) { }
#if QSV_HAVE_AVBR
else if (!avctx->rc_max_rate) {
rc_mode = MFX_RATECONTROL_AVBR; rc_mode = MFX_RATECONTROL_AVBR;
rc_desc = "average variable bitrate (AVBR)"; rc_desc = "average variable bitrate (AVBR)";
} else { }
#endif
else {
rc_mode = MFX_RATECONTROL_VBR; rc_mode = MFX_RATECONTROL_VBR;
rc_desc = "variable bitrate (VBR)"; rc_desc = "variable bitrate (VBR)";
} }
...@@ -522,11 +531,13 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) ...@@ -522,11 +531,13 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->param.mfx.QPB = av_clip(quant * fabs(avctx->b_quant_factor) + avctx->b_quant_offset, 0, 51); q->param.mfx.QPB = av_clip(quant * fabs(avctx->b_quant_factor) + avctx->b_quant_offset, 0, 51);
break; break;
#if QSV_HAVE_AVBR
case MFX_RATECONTROL_AVBR: case MFX_RATECONTROL_AVBR:
q->param.mfx.TargetKbps = avctx->bit_rate / 1000; q->param.mfx.TargetKbps = avctx->bit_rate / 1000;
q->param.mfx.Convergence = q->avbr_convergence; q->param.mfx.Convergence = q->avbr_convergence;
q->param.mfx.Accuracy = q->avbr_accuracy; q->param.mfx.Accuracy = q->avbr_accuracy;
break; break;
#endif
#if QSV_HAVE_LA #if QSV_HAVE_LA
case MFX_RATECONTROL_LA: case MFX_RATECONTROL_LA:
q->param.mfx.TargetKbps = avctx->bit_rate / 1000; q->param.mfx.TargetKbps = avctx->bit_rate / 1000;
......
...@@ -46,10 +46,12 @@ ...@@ -46,10 +46,12 @@
#define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11) #define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11)
#if defined(_WIN32) #if defined(_WIN32)
#define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3)
#define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8)
#define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8)
#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11) #define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11)
#else #else
#define QSV_HAVE_AVBR 0
#define QSV_HAVE_ICQ 0 #define QSV_HAVE_ICQ 0
#define QSV_HAVE_VCM 0 #define QSV_HAVE_VCM 0
#define QSV_HAVE_QVBR 0 #define QSV_HAVE_QVBR 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment