[FFmpeg-devel] [PATCH] libavcodec/qsvenc: fix mpeg2 encoding

Li, Zhong zhong.li at intel.com
Wed May 15 18:31:24 EEST 2019


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Andreas HÃ¥kon
> Sent: Wednesday, May 15, 2019 8:55 PM
> To: FFmpeg development discussions and patches
> <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc: fix mpeg2 encoding
> 
> Hi,
> 
> 
> > > The difference?
> > > In addition to a few extra little checks, It seems that the
> > > QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11) check fails every time in
> > > Windows (almost in my environment).
> >
> > If QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11) always equal to zero,
> > then co3 won't be set, If codec is MPEG2, co3 won't be set too.
> > I can't see any difference for MPEG2 case.
> 
> Your assumption about QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11) is
> not real.
> This depends on the run-time driver used.
> 
> 
> > > Futhermore, it has more sense to apply the check inside the
> > > conditional preprocessing of #if QSV_HAVE_CO3 and not outside.
> >
> > Make sense, but no difference for run-time result?
> 
> I prefer to make the code as more legible as possible.
> That's the reason for the other additions of #if QSV_HAVE_CO3.
> 
> 
> > > As a summary: I confirm that my patch works. And it's based on your
> > > proposal. So please comment positively to merge it.
> >
> > It is closer to be merged, but need to confirm which exact line of code
> make difference.
> > (Your verification on Windows was appreciated.)
> 
> As I pointed, the QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11) check fails
> in Windows.
> This version runs without problems and resolves the bug (in Windows).

Well, let me to explain with more detail:

V1: 
if (avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
> QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 11)) 

For mpeg2 case, it is always equal to "if (0)" , right? 

V2:
if (avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO)

For mpeg2 case, it is equal to "if (0)" too, right?

Thus why I asked what the difference between V1 and V2 was. 


More information about the ffmpeg-devel mailing list