Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: add mbbrc to hevc_qsv
@ 2022-02-21  8:56 Wenbin Chen
  2022-02-28  6:39 ` Xiang, Haihao
  0 siblings, 1 reply; 2+ messages in thread
From: Wenbin Chen @ 2022-02-21  8:56 UTC (permalink / raw)
  To: ffmpeg-devel

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@intel.com>
---
 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 bfb6c7eef6..4325fdd6b0 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3404,6 +3404,11 @@ Maximum encoded frame size in bytes.
 @item @var{max_slice_size}
 Maximum encoded slice size in bytes.
 
+@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 07be4287b7..3aed0508a4 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -877,8 +877,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)
@@ -935,6 +933,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);
 
-- 
2.32.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: add mbbrc to hevc_qsv
  2022-02-21  8:56 [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: add mbbrc to hevc_qsv Wenbin Chen
@ 2022-02-28  6:39 ` Xiang, Haihao
  0 siblings, 0 replies; 2+ messages in thread
From: Xiang, Haihao @ 2022-02-28  6:39 UTC (permalink / raw)
  To: ffmpeg-devel

On Mon, 2022-02-21 at 16:56 +0800, Wenbin Chen wrote:
> 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@intel.com>
> ---
>  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 bfb6c7eef6..4325fdd6b0 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -3404,6 +3404,11 @@ Maximum encoded frame size in bytes.
>  @item @var{max_slice_size}
>  Maximum encoded slice size in bytes.
>  
> +@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 07be4287b7..3aed0508a4 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -877,8 +877,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)
> @@ -935,6 +933,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);
>  

LGTM, applied

-Haihao

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-28  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21  8:56 [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: add mbbrc to hevc_qsv Wenbin Chen
2022-02-28  6:39 ` Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git