[FFmpeg-cvslog] libavcodec/qsvenc: add mbbrc to hevc_qsv

Wenbin Chen git at videolan.org
Mon Feb 28 08:40:13 EET 2022


ffmpeg | branch: master | Wenbin Chen <wenbin.chen-at-intel.com at ffmpeg.org> | Mon Feb 21 16:56:56 2022 +0800| [342d4fb0563cafa4e444c83dc4ecfa0d69a71eda] | committer: Haihao Xiang

libavcodec/qsvenc: add mbbrc to hevc_qsv

Add mbbrc to hevc_qsv
For detailed description, please see "mbbrc" part in:
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxextcodingoption2

Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=342d4fb0563cafa4e444c83dc4ecfa0d69a71eda
---

 doc/encoders.texi   | 5 +++++
 libavcodec/qsvenc.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 64e8c5d129..1bd38671ca 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3395,6 +3395,11 @@ Maximum encoded frame size in bytes.
 @item @var{max_slice_size}
 Maximum encoded slice size in bytes.
 
+ at item @var{mbbrc}
+Setting this flag enables macroblock level bitrate control that generally
+improves subjective visual quality. Enabling this flag may have negative impact
+on performance and objective visual quality metric.
+
 @item @var{p_strategy}
 Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
 
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 3008f329e5..49f61ae6bb 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -878,8 +878,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         if (avctx->codec_id == AV_CODEC_ID_H264) {
             if (q->bitrate_limit >= 0)
                 q->extco2.BitrateLimit = q->bitrate_limit ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
-            if (q->mbbrc >= 0)
-                q->extco2.MBBRC = q->mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
 
 #if QSV_HAVE_TRELLIS
             if (avctx->trellis >= 0)
@@ -936,6 +934,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
                 q->extco2.MaxQPP = q->extco2.MaxQPB = q->extco2.MaxQPI;
             }
 #endif
+            if (q->mbbrc >= 0)
+                q->extco2.MBBRC = q->mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
+
             q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2;
             q->extco2.Header.BufferSz = sizeof(q->extco2);
 



More information about the ffmpeg-cvslog mailing list