[FFmpeg-devel] [PATCH 1/2] lavc/qsvenc_hevc: allow user set more coding options
Xiang, Haihao
haihao.xiang at intel.com
Mon Jun 21 05:15:02 EEST 2021
On Sun, 2021-06-20 at 23:03 +0800, Zhong Li wrote:
> Haihao Xiang <haihao.xiang at intel.com> 于2021年4月25日周日 上午9:32写道:
> >
> > 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
> >
> > 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;
>
> Is this available for hevc ?
> As
> https://spec.oneapi.com/versions/latest/elements/oneVPL/source/appendix/VPL_apnds_f.html
> ,
> "The application can configure an AVC encoder to work in CQP rate
> control mode with HRD model parameters. oneVPL will place HRD
> information to SPS/VUI and choose the appropriate profile/level"
> Looks like only available for AVC?
Yes, this is available for hevc too.
NalHrdConformance is checked in GetDefault::HRDConformanceON()
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/_studio/mfx_lib/encode_hw/hevc/agnostic/base/hevcehw_base_legacy_defaults.cpp#L937-L947
HRDConformanceON() is called when setting the parameters for hevc encoder, see
the backtrace below:
#0 GetDefault::HRDConformanceON(std::function<unsigned short
(HEVCEHW::Base::Defaults::Param const&)>, HEVCEHW::Base::Defaults::Param const&)
(par=...)
at
/home/xhh/graphics/ex/MediaSDK/_studio/mfx_lib/encode_hw/hevc/agnostic/base/hevc
ehw_base_legacy_defaults.cpp:937
#1 0x00007fffef38891d in std::_Function_handler<bool (std::function<bool
(HEVCEHW::Base::Defaults::Param const&)>, HEVCEHW::Base::Defaults::Param
const&), bool (*)(std::function<unsigned short (HEVCEHW::Base::Defaults::Param
const&)>, HEVCEHW::Base::Defaults::Param const&)>::_M_invoke(std::_Any_data
const&, std::function<bool (HEVCEHW::Base::Defaults::Param const&)>&&,
HEVCEHW::Base::Defaults::Param const&) (__functor=..., __args#0=...,
__args#1=...) at /usr/include/c++/8/bits/std_function.h:282
#2 0x00007fffef2fe843 in std::function<bool (std::function<bool
(HEVCEHW::Base::Defaults::Param const&)>, HEVCEHW::Base::Defaults::Param
const&)>::operator()(std::function<bool (HEVCEHW::Base::Defaults::Param
const&)>, HEVCEHW::Base::Defaults::Param const&) const (this=0x5555557e06e0,
__args#0=..., __args#1=...) at /usr/include/c++/8/bits/std_function.h:687
#3 0x00007fffef2fb54e in MfxFeatureBlocks::CallChain<bool,
HEVCEHW::Base::Defaults::Param const&>::Push(std::function<bool
(std::function<bool (HEVCEHW::Base::Defaults::Param const&)>,
HEVCEHW::Base::Defaults::Param const&)>)::{lambda(HEVCEHW::Base::Defaults::Param
const&)#1}::operator()(HEVCEHW::Base::Defaults::Param const&) const
(this=0x5555557e06e0, args#0=...)
at
/home/xhh/graphics/ex/MediaSDK/_studio/mfx_lib/shared/include/feature_blocks/mfx
_feature_blocks_utils.h:293
#4 0x00007fffef302c67 in std::_Function_handler<bool
(HEVCEHW::Base::Defaults::Param const&), MfxFeatureBlocks::CallChain<bool,
HEVCEHW::Base::Defaults::Param const&>::Push(std::function<bool
(std::function<bool (HEVCEHW::Base::Defaults::Param const&)>,
HEVCEHW::Base::Defaults::Param const&)>)::{lambda(HEVCEHW::Base::Defaults::Param
const&)#1}>::_M_invoke(std::_Any_data const&, HEVCEHW::Base::Defaults::Param
const&) (__functor=..., __args#0=...) at
/usr/include/c++/8/bits/std_function.h:282
#5 0x00007fffef2fb4bf in std::function<bool (HEVCEHW::Base::Defaults::Param
const&)>::operator()(HEVCEHW::Base::Defaults::Param const&) const
(this=0x5555557f8750, __args#0=...)
at /usr/include/c++/8/bits/std_function.h:687
#6 0x00007fffef31f21b in SetDefaultEsOptions (par=..., defPar=..., pHEVC=0x0,
pCO=0x5555557e5d60, pCO2=0x5555557e5df0, pCO3=0x5555557e4b80)
at
/home/xhh/graphics/ex/MediaSDK/_studio/mfx_lib/encode_hw/hevc/agnostic/base/hevc
ehw_base_legacy.cpp:3431
#7 0x00007fffef31f9f3 in HEVCEHW::Base::Legacy::SetDefaults
(this=0x5555557fac00, par=..., defPar=..., bExternalFrameAllocator=true)
at
/home/xhh/graphics/ex/MediaSDK/_studio/mfx_lib/encode_hw/hevc/agnostic/base/hevc
ehw_base_legacy.cpp:3527
Thanks
Haihao
More information about the ffmpeg-devel
mailing list