[FFmpeg-devel] [PATCH 1/2] lavc/qsvenc_hevc: allow user set more coding options

Xiang, Haihao haihao.xiang at intel.com
Fri Jun 18 04:29:22 EEST 2021


> The SDK supports NalHrdConformance, RecoveryPointSEI and AUDelimiter for
> hevc encoder, so we may allow user to set these coding options like what
> we did for h264_qsv encoder.
> 
> '-strict xxx' to turn on / off NalHrdConformance
> '-recovery_point_sei xxx' to turn on / off RecoveryPointSEI
> '-aud xxx' to turn on / off AUDelimiter

Hi Zhong and Mark,

Could you please have a look at this patch ? User may set some same options for
h264_qsv and hevc_qsv encoders after applying this patch.

Thanks
Haihao


> 
> Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
> ---
>  libavcodec/qsvenc.c      | 15 ++++++++++++---
>  libavcodec/qsvenc_hevc.c |  2 ++
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 566a5c8552..aeb010e456 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -290,6 +290,10 @@ static void dump_video_param(AVCodecContext *avctx,
> QSVEncContext *q,
>                 "NalHrdConformance: %s; SingleSeiNalUnit: %s;
> VuiVclHrdParameters: %s VuiNalHrdParameters: %s\n",
>                 print_threestate(co->NalHrdConformance), print_threestate(co-
> >SingleSeiNalUnit),
>                 print_threestate(co->VuiVclHrdParameters),
> print_threestate(co->VuiNalHrdParameters));
> +    } else if (avctx->codec_id == AV_CODEC_ID_HEVC) {
> +        av_log(avctx, AV_LOG_VERBOSE,
> +               "NalHrdConformance: %s; VuiNalHrdParameters: %s\n",
> +               print_threestate(co->NalHrdConformance), print_threestate(co-
> >VuiNalHrdParameters));
>      }
>  
>      av_log(avctx, AV_LOG_VERBOSE, "FrameRateExtD: %"PRIu32"; FrameRateExtN:
> %"PRIu32" \n",
> @@ -676,15 +680,20 @@ FF_ENABLE_DEPRECATION_WARNINGS
>              q->extco.CAVLC = q->cavlc ? MFX_CODINGOPTION_ON
>                                        : MFX_CODINGOPTION_UNKNOWN;
>  
> +            if (q->single_sei_nal_unit >= 0)
> +                q->extco.SingleSeiNalUnit = q->single_sei_nal_unit ?
> MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
> +
> +            q->extco.MaxDecFrameBuffering = q->max_dec_frame_buffering;
> +        }
> +
> +        if (avctx->codec_id == AV_CODEC_ID_H264 ||
> +            avctx->codec_id == AV_CODEC_ID_HEVC) {
>              if (avctx->strict_std_compliance != FF_COMPLIANCE_NORMAL)
>                  q->extco.NalHrdConformance = avctx->strict_std_compliance >
> FF_COMPLIANCE_NORMAL ?
>                                               MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>  
> -            if (q->single_sei_nal_unit >= 0)
> -                q->extco.SingleSeiNalUnit = q->single_sei_nal_unit ?
> MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
>              if (q->recovery_point_sei >= 0)
>                  q->extco.RecoveryPointSEI = q->recovery_point_sei ?
> MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
> -            q->extco.MaxDecFrameBuffering = q->max_dec_frame_buffering;
>              q->extco.AUDelimiter          = q->aud ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          }
>  
> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
> index 347f30655e..aa02361d1d 100644
> --- a/libavcodec/qsvenc_hevc.c
> +++ b/libavcodec/qsvenc_hevc.c
> @@ -246,6 +246,8 @@ static const AVOption options[] = {
>  
>      { "tile_cols",  "Number of columns for tiled
> encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0,
> UINT16_MAX, VE },
>      { "tile_rows",  "Number of rows for tiled
> encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0,
> UINT16_MAX, VE },
> +    { "recovery_point_sei", "Insert recovery point SEI
> messages",       OFFSET(qsv.recovery_point_sei),      AV_OPT_TYPE_INT, { .i64
> = -1 },               -1,          1, VE },
> +    { "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud),
> AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE},
>  
>      { NULL },
>  };


More information about the ffmpeg-devel mailing list