Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc: Add adaptive_i/b to hevc_qsv
Date: Tue, 23 Aug 2022 05:11:24 +0000
Message-ID: <a17933426281be7a466c4b8de141b5f61846bc2d.camel@intel.com> (raw)
In-Reply-To: <20220817070719.96899-1-wenbin.chen@intel.com>

On Wed, 2022-08-17 at 15:07 +0800, Wenbin Chen wrote:
> Add adaptive_i/b feature to hevc_qsv. Adaptive_i allows changing of
> frame type from P and B to I. Adaptive_b allows changing of frame type
> frome B to P.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  doc/encoders.texi        | 7 +++++++
>  libavcodec/qsvenc.c      | 9 ++++-----
>  libavcodec/qsvenc_hevc.c | 2 ++
>  3 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 6d73f74196..fed798ff42 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -3543,6 +3543,13 @@ Setting this flag turns on or off LowDelayBRC feautre
> in qsv plugin, which provi
>  more accurate bitrate control to minimize the variance of bitstream size
> frame
>  by frame. Value: -1-default 0-off 1-on
>  
> +@item @var{adaptive_i}
> +This flag controls insertion of I frames by the QSV encoder. Turn ON this
> flag
> +to allow changing of frame type from P and B to I.
> +
> +@item @var{adaptive_b}
> +This flag controls changing of frame type from B to P.
> +
>  @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 4831640868..ca5e6f0b6e 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -816,11 +816,6 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>  
>              q->extco2.LookAheadDS = q->look_ahead_downsampling;
>              q->extco2.RepeatPPS   = q->repeat_pps ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
> -
> -            if (q->adaptive_i >= 0)
> -                q->extco2.AdaptiveI = q->adaptive_i ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
> -            if (q->adaptive_b >= 0)
> -                q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          }
>  
>          if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id ==
> AV_CODEC_ID_HEVC) {
> @@ -840,6 +835,10 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>  
>              if (q->b_strategy >= 0)
>                  q->extco2.BRefType = q->b_strategy ? MFX_B_REF_PYRAMID :
> MFX_B_REF_OFF;
> +            if (q->adaptive_i >= 0)
> +                q->extco2.AdaptiveI = q->adaptive_i ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
> +            if (q->adaptive_b >= 0)
> +                q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>              if ((avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx-
> >qmax) ||
>                  (q->max_qp_i >= 0 && q->min_qp_i >= 0 && q->min_qp_i > q-
> >max_qp_i) ||
>                  (q->max_qp_p >= 0 && q->min_qp_p >= 0 && q->min_qp_p > q-
> >max_qp_p) ||
> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
> index e11f5dec4a..19f028c078 100644
> --- a/libavcodec/qsvenc_hevc.c
> +++ b/libavcodec/qsvenc_hevc.c
> @@ -233,6 +233,8 @@ static const AVOption options[] = {
>      QSV_OPTION_DBLK_IDC
>      QSV_OPTION_LOW_DELAY_BRC
>      QSV_OPTION_MAX_MIN_QP
> +    QSV_OPTION_ADAPTIVE_I
> +    QSV_OPTION_ADAPTIVE_B
>  
>      { "idr_interval", "Distance (in I-frames) between IDR frames",
> OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE,
> "idr_interval" },
>      { "begin_only", "Output an IDR-frame only at the beginning of the
> stream", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },

Applied, thx

-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".

      reply	other threads:[~2022-08-23  5:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  7:07 Wenbin Chen
2022-08-23  5:11 ` Xiang, Haihao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a17933426281be7a466c4b8de141b5f61846bc2d.camel@intel.com \
    --to=haihao.xiang-at-intel.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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