[FFmpeg-devel] [PATCH v2 3/6] lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader()

Mark Thompson sw at jkqxz.net
Wed Feb 20 23:31:55 EET 2019

On 20/02/2019 02:58, Zhong Li wrote:
> Using MSDK parser can improve qsv decoder pass rate in some cases (E.g:
> sps declares a wrong level_idc, smaller than it should be).
> And it is necessary for adding new qsv decoders such as MJPEG and VP9
> since current parser can't provide enough information.

Can you explain the problem with level_idc?  Why would the libmfx parser determine a different answer?

Given that you need the current parser anyway (see previous mail), it would likely be more useful to extend it to supply any information which is missing.

> Actually using MFXVideoDECODE_DecodeHeader() was disscussed at
> https://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/175734.html and merged as commit 1acb19d,
> but was overwritten when merged libav patches (commit: 1f26a23) without any explain.

I'm not sure where the explanation for this went; maybe it was only discussed on IRC.

The reason for using the internal parsers is that you need the information before libmfx is initialised at all in the hw_frames_ctx case (i.e. before the get_format callback which will supply the hardware context information), and once you require that anyway there isn't much point in parsing things twice for the same information.

It's probably fine to parse it twice if you want, but the two cases really should be returning the same information.

> v2: split decode header from decode_init, and call it for everyframe to
> detect format/resoultion change. It can fix some regression issues such
> as hevc 10bits decoding.
> Signed-off-by: Zhong Li <zhong.li at intel.com>
> ---
>  libavcodec/qsvdec.c | 172 ++++++++++++++++++++++----------------------
>  libavcodec/qsvdec.h |   2 +
>  2 files changed, 90 insertions(+), 84 deletions(-)

- Mark

More information about the ffmpeg-devel mailing list