[FFmpeg-trac] #7839(avcodec:new): QVBR breaks mpeg2_qsv
FFmpeg
trac at avcodec.org
Sat Apr 27 00:08:34 EEST 2019
#7839: QVBR breaks mpeg2_qsv
-------------------------------------+-------------------------------------
Reporter: atorp | Owner:
Type: defect | Status: new
Priority: important | Component: avcodec
Version: git-master | Resolution:
Keywords: qsv | Blocked By:
regression |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by atorp):
Hi,
This is my updated '''TEMPORAL''' workaround:
{{{
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index a03ab69..18687be 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -267,10 +267,12 @@ static void dump_video_param(AVCodecContext *avctx,
QSVEncContext *q,
#endif
#endif
+#if QSV_HAVE_CO3
#if QSV_HAVE_GPB
if (avctx->codec_id == AV_CODEC_ID_HEVC)
av_log(avctx, AV_LOG_VERBOSE,"GPB: %s\n",
print_threestate(co3->GPB));
#endif
+#endif
if (avctx->codec_id == AV_CODEC_ID_H264) {
av_log(avctx, AV_LOG_VERBOSE, "Entropy coding: %s;
MaxDecFrameBuffering: %"PRIu16"\n",
@@ -343,7 +345,11 @@ static int select_rc_mode(AVCodecContext *avctx,
QSVEncContext *q)
}
#endif
#if QSV_HAVE_ICQ
+#if QSV_HAVE_QVBR
else if (avctx->global_quality > 0 && !avctx->rc_max_rate) {
+#else
+ else if (avctx->global_quality > 0) {
+#endif
rc_mode = MFX_RATECONTROL_ICQ;
rc_desc = "intelligent constant quality (ICQ)";
}
@@ -598,9 +604,11 @@ static int init_video_param(AVCodecContext *avctx,
QSVEncContext *q)
q->param.mfx.MaxKbps = max_bitrate_kbps /
brc_param_multiplier;
q->param.mfx.BRCParamMultiplier = brc_param_multiplier;
#if QSV_HAVE_QVBR
+#if QSV_HAVE_CO3
if (q->param.mfx.RateControlMethod == MFX_RATECONTROL_QVBR)
q->extco3.QVBRQuality = av_clip(avctx->global_quality, 0,
51);
#endif
+#endif
break;
case MFX_RATECONTROL_CQP:
quant = avctx->global_quality / FF_QP2LAMBDA;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index f2f4d38..6a218d4 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -35,7 +35,7 @@
#include "qsv_internal.h"
#define QSV_HAVE_CO2 QSV_VERSION_ATLEAST(1, 6)
-#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11)
+#define QSV_HAVE_CO3 0
#define QSV_HAVE_CO_VPS QSV_VERSION_ATLEAST(1, 17)
#define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
@@ -53,13 +53,13 @@
#define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3)
#define QSV_HAVE_ICQ 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 0
#define QSV_HAVE_MF 0
#else
#define QSV_HAVE_AVBR 0
#define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 28)
#define QSV_HAVE_VCM 0
-#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 28)
+#define QSV_HAVE_QVBR 0
#define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25)
#endif
}}}
It restores all the functionality lost the the commit of QVBR.
In any case, I recomend to merge part of it with the git-master. The code
of:
{{{
#if QSV_HAVE_ICQ
+#if QSV_HAVE_QVBR
else if (avctx->global_quality > 0 && !avctx->rc_max_rate) {
+#else
+ else if (avctx->global_quality > 0) {
+#endif
}}}
is mandatory as when disabling QVBR with the current code it's impossible
to use the ICQ mode. Futhermore, the check about the use of the CO3
extension are also necessary.
Regards.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7839#comment:20>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list