[FFmpeg-devel] [PATCH] libavcodec: QSV protect GPB code with CO3 define

Andreas Håkon andreas.hakon at protonmail.com
Mon Apr 22 15:20:42 EEST 2019


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, 22 de April de 2019 13:33, Li, Zhong <zhong.li at intel.com> wrote:

> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> > Of Andreas Håkon via ffmpeg-devel
> > Sent: Thursday, April 18, 2019 6:11 PM
> > To: FFmpeg development discussions and patches
> > ffmpeg-devel at ffmpeg.org
> > Cc: Andreas Håkon andreas.hakon at protonmail.com
> > Subject: [FFmpeg-devel] [PATCH] libavcodec: QSV protect GPB code with
> > CO3 define
> > Hi,
> > In response to this ticket I provide the first part of the patch:
> > https://trac.ffmpeg.org/ticket/7839
> > This QSV_HAVE_GPB code needs to be protected by QSV_HAVE_CO3.
> > Regards.
> > A.H.
>
> Why it is must? It is impossible that QSV_HAVE_GPB is enabled but QSV_HAVE_CO3 is not enabled.
> QSV_HAVE_GPB is enabled by MSDK API v1.18, but QSV_HAVE_CO3 is API V1.11.
>

Hi Li,

> Why it is must?

Let me to explain why:

- The "#if QSV_HAVE_GPB" only appears two times inside "/libavcodec/qsvenc.c":
  1. https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qsvenc.c#L756
  2. https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qsvenc.c#L270

In the first occurrence (line #756) the code is protected by one
"#if QSV_HAVE_CO3". This is necessary because if QSV_HAVE_CO3 is not enabled
then the code fails when using "extco3.GPB". The original author
(which I think was you) included the test with sound common sense.

In the second occurrence (line #270) where my patch is applied, the code isn't
protected. The reason is because this code is changed **after**. And the
developer forgot to protect it.

So my patch is a simple fixing.

> It is impossible that QSV_HAVE_GPB is enabled but QSV_HAVE_CO3 is not enabled.
> QSV_HAVE_GPB is enabled by MSDK API v1.18, but QSV_HAVE_CO3 is API V1.11.

This isn't true in all cases. As described in "https://trac.ffmpeg.org/ticket/7839"
one current bug breaks the "mpeg2_qsv" encoder. One solution is to MANUALLY
disable the QVBR. This can be done with a simple "#define QSV_HAVE_QVBR 0". Even
if you compile with a recent version of the SDK > v1.11.

But the problem is then that this implies too to disable "QSV_HAVE_CO3". And
doing this the code doesn't compile as this patch isn't applied.

So, the best solution is to merge this patch. It enables then the option to
disable manually what you like, and the code compiles clean.

Please, accept the patch.
Thank you!
A.H.


---


More information about the ffmpeg-devel mailing list