Re: [FFmpeg-devel] [PATCH v4 03/10] qsv: remove mfx/ prefix from mfx headers

2021-09-29 Thread Xiang, Haihao
On Tue, 2021-09-28 at 16:48 -0300, James Almer wrote:
> On 9/23/2021 3:28 AM, Haihao Xiang wrote:
> > The following Cflags has been added to libmfx.pc, so mfx/ prefix is no
> > longer needed when including mfx headers in FFmpeg.
> > Cflags: -I${includedir} -I${includedir}/mfx
> > 
> > Some old versions of libmfx have the following Cflags in libmfx.pc
> > Cflags: -I${includedir}
> > 
> > We may add -I${includedir}/mfx to CFLAGS when running 'configure
> > --enable-libmfx' for old versions of libmfx, if so, mfx headers without
> > mfx/ prefix can be included too.
> > 
> > If libmfx comes without pkg-config support, we may do a small change to
> > the settings of the environment(e.g. set -I/opt/intel/mediasdk/include/mfx
> > instead of -I/opt/intel/mediasdk/include to CFLAGS), then the build can
> > find the mfx headers without mfx/ prefix
> > 
> > After applying this change, we won't need to change #include for mfx
> > headers when mfx headers are installed under a new directory.
> > 
> > This is in preparation for oneVPL support (mfx headers in oneVPL are
> > installed under vpl directory)
> > ---
> >   configure| 13 +
> >   libavcodec/qsv.c |  8 
> >   libavcodec/qsv.h |  2 +-
> >   libavcodec/qsv_internal.h|  2 +-
> >   libavcodec/qsvdec.c  |  2 +-
> >   libavcodec/qsvenc.c  |  2 +-
> >   libavcodec/qsvenc.h  |  2 +-
> >   libavcodec/qsvenc_h264.c |  2 +-
> >   libavcodec/qsvenc_hevc.c |  2 +-
> >   libavcodec/qsvenc_jpeg.c |  2 +-
> >   libavcodec/qsvenc_mpeg2.c|  2 +-
> >   libavcodec/qsvenc_vp9.c  |  2 +-
> >   libavfilter/qsvvpp.h |  2 +-
> >   libavfilter/vf_deinterlace_qsv.c |  2 +-
> >   libavfilter/vf_scale_qsv.c   |  2 +-
> >   libavutil/hwcontext_opencl.c |  2 +-
> >   libavutil/hwcontext_qsv.c|  2 +-
> >   libavutil/hwcontext_qsv.h|  2 +-
> >   18 files changed, 29 insertions(+), 24 deletions(-)
> > 
> > diff --git a/configure b/configure
> > index 21c744e627..9655a5823e 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6434,13 +6434,18 @@ enabled liblensfun&& require_pkg_config
> > liblensfun lensfun lensfun.h lf_
> >   # Media SDK or Intel Media Server Studio, these don't come with
> >   # pkg-config support.  Instead, users should make sure that the build
> >   # can find the libraries and headers through other means.
> > -enabled libmfx&& { { check_pkg_config libmfx "libmfx < 2.0"
> > "mfx/mfxvideo.h" MFXInit ||
> > - { require "libmfx < 2.0" "mfx/mfxvideo.h"
> > MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-
> > config"; } } &&
> > +
> > +enabled libmfx&& { { check_pkg_config libmfx "libmfx < 2.0"
> > "mfxvideo.h" MFXInit ||
> > +# Some old versions of libmfx have the following settings in libmfx.pc:
> > +#   includedir=/usr/include
> > +#   Cflags: -I${includedir}
> > +# So add -I${includedir}/mfx to CFLAGS
> > + { check_pkg_config libmfx "libmfx < 2.0"
> > "mfx/mfxvideo.h" MFXInit && add_cflags -I$($pkg_config 
> > --variable=includedir 
> > libmfx)/mfx; } ||
> 
> add_cflags ${libmfx_cflags}/mfx

Because /usr/include is a system path, `pkg-config --cflags libmfx` returns
nothing and libmfx_cflags is set to nothing. Hence the result `add_cflags
${libmfx_cflags}/mfx` is /mfx, which is wrong for libmfx.

> 
> > + { require "libmfx < 2.0" "mfxvideo.h"
> > MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-
> > config"; } } &&
> >  warn "build FFmpeg against libmfx 1.x,
> > obsolete features of libmfx such as OPAQUE memory,\n"\
> >   "multi-frame encode, user plugins and
> > LA_EXT rate control mode are enabled"; }
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 03/10] qsv: remove mfx/ prefix from mfx headers

2021-09-28 Thread James Almer

On 9/23/2021 3:28 AM, Haihao Xiang wrote:

The following Cflags has been added to libmfx.pc, so mfx/ prefix is no
longer needed when including mfx headers in FFmpeg.
Cflags: -I${includedir} -I${includedir}/mfx

Some old versions of libmfx have the following Cflags in libmfx.pc
Cflags: -I${includedir}

We may add -I${includedir}/mfx to CFLAGS when running 'configure
--enable-libmfx' for old versions of libmfx, if so, mfx headers without
mfx/ prefix can be included too.

If libmfx comes without pkg-config support, we may do a small change to
the settings of the environment(e.g. set -I/opt/intel/mediasdk/include/mfx
instead of -I/opt/intel/mediasdk/include to CFLAGS), then the build can
find the mfx headers without mfx/ prefix

After applying this change, we won't need to change #include for mfx
headers when mfx headers are installed under a new directory.

This is in preparation for oneVPL support (mfx headers in oneVPL are
installed under vpl directory)
---
  configure| 13 +
  libavcodec/qsv.c |  8 
  libavcodec/qsv.h |  2 +-
  libavcodec/qsv_internal.h|  2 +-
  libavcodec/qsvdec.c  |  2 +-
  libavcodec/qsvenc.c  |  2 +-
  libavcodec/qsvenc.h  |  2 +-
  libavcodec/qsvenc_h264.c |  2 +-
  libavcodec/qsvenc_hevc.c |  2 +-
  libavcodec/qsvenc_jpeg.c |  2 +-
  libavcodec/qsvenc_mpeg2.c|  2 +-
  libavcodec/qsvenc_vp9.c  |  2 +-
  libavfilter/qsvvpp.h |  2 +-
  libavfilter/vf_deinterlace_qsv.c |  2 +-
  libavfilter/vf_scale_qsv.c   |  2 +-
  libavutil/hwcontext_opencl.c |  2 +-
  libavutil/hwcontext_qsv.c|  2 +-
  libavutil/hwcontext_qsv.h|  2 +-
  18 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index 21c744e627..9655a5823e 100755
--- a/configure
+++ b/configure
@@ -6434,13 +6434,18 @@ enabled liblensfun&& require_pkg_config 
liblensfun lensfun lensfun.h lf_
  # Media SDK or Intel Media Server Studio, these don't come with
  # pkg-config support.  Instead, users should make sure that the build
  # can find the libraries and headers through other means.
-enabled libmfx&& { { check_pkg_config libmfx "libmfx < 2.0" 
"mfx/mfxvideo.h" MFXInit ||
- { require "libmfx < 2.0" "mfx/mfxvideo.h" MFXInit "-llibmfx 
$advapi32_extralibs" && warn "using libmfx without pkg-config"; } } &&
+
+enabled libmfx&& { { check_pkg_config libmfx "libmfx < 2.0" 
"mfxvideo.h" MFXInit ||
+# Some old versions of libmfx have the following settings in libmfx.pc:
+#   includedir=/usr/include
+#   Cflags: -I${includedir}
+# So add -I${includedir}/mfx to CFLAGS
+ { check_pkg_config libmfx "libmfx < 2.0" 
"mfx/mfxvideo.h" MFXInit && add_cflags -I$($pkg_config --variable=includedir libmfx)/mfx; } 
||


add_cflags ${libmfx_cflags}/mfx


+ { require "libmfx < 2.0" "mfxvideo.h" MFXInit "-llibmfx 
$advapi32_extralibs" && warn "using libmfx without pkg-config"; } } &&
 warn "build FFmpeg against libmfx 1.x, obsolete 
features of libmfx such as OPAQUE memory,\n"\
  "multi-frame encode, user plugins and LA_EXT 
rate control mode are enabled"; }

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4 03/10] qsv: remove mfx/ prefix from mfx headers

2021-09-23 Thread Haihao Xiang
The following Cflags has been added to libmfx.pc, so mfx/ prefix is no
longer needed when including mfx headers in FFmpeg.
   Cflags: -I${includedir} -I${includedir}/mfx

Some old versions of libmfx have the following Cflags in libmfx.pc
   Cflags: -I${includedir}

We may add -I${includedir}/mfx to CFLAGS when running 'configure
--enable-libmfx' for old versions of libmfx, if so, mfx headers without
mfx/ prefix can be included too.

If libmfx comes without pkg-config support, we may do a small change to
the settings of the environment(e.g. set -I/opt/intel/mediasdk/include/mfx
instead of -I/opt/intel/mediasdk/include to CFLAGS), then the build can
find the mfx headers without mfx/ prefix

After applying this change, we won't need to change #include for mfx
headers when mfx headers are installed under a new directory.

This is in preparation for oneVPL support (mfx headers in oneVPL are
installed under vpl directory)
---
 configure| 13 +
 libavcodec/qsv.c |  8 
 libavcodec/qsv.h |  2 +-
 libavcodec/qsv_internal.h|  2 +-
 libavcodec/qsvdec.c  |  2 +-
 libavcodec/qsvenc.c  |  2 +-
 libavcodec/qsvenc.h  |  2 +-
 libavcodec/qsvenc_h264.c |  2 +-
 libavcodec/qsvenc_hevc.c |  2 +-
 libavcodec/qsvenc_jpeg.c |  2 +-
 libavcodec/qsvenc_mpeg2.c|  2 +-
 libavcodec/qsvenc_vp9.c  |  2 +-
 libavfilter/qsvvpp.h |  2 +-
 libavfilter/vf_deinterlace_qsv.c |  2 +-
 libavfilter/vf_scale_qsv.c   |  2 +-
 libavutil/hwcontext_opencl.c |  2 +-
 libavutil/hwcontext_qsv.c|  2 +-
 libavutil/hwcontext_qsv.h|  2 +-
 18 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index 21c744e627..9655a5823e 100755
--- a/configure
+++ b/configure
@@ -6434,13 +6434,18 @@ enabled liblensfun&& require_pkg_config 
liblensfun lensfun lensfun.h lf_
 # Media SDK or Intel Media Server Studio, these don't come with
 # pkg-config support.  Instead, users should make sure that the build
 # can find the libraries and headers through other means.
-enabled libmfx&& { { check_pkg_config libmfx "libmfx < 2.0" 
"mfx/mfxvideo.h" MFXInit ||
- { require "libmfx < 2.0" "mfx/mfxvideo.h" 
MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without 
pkg-config"; } } &&
+
+enabled libmfx&& { { check_pkg_config libmfx "libmfx < 2.0" 
"mfxvideo.h" MFXInit ||
+# Some old versions of libmfx have the following settings in libmfx.pc:
+#   includedir=/usr/include
+#   Cflags: -I${includedir}
+# So add -I${includedir}/mfx to CFLAGS
+ { check_pkg_config libmfx "libmfx < 2.0" 
"mfx/mfxvideo.h" MFXInit && add_cflags -I$($pkg_config --variable=includedir 
libmfx)/mfx; } ||
+ { require "libmfx < 2.0" "mfxvideo.h" MFXInit 
"-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } } &&
warn "build FFmpeg against libmfx 1.x, obsolete 
features of libmfx such as OPAQUE memory,\n"\
 "multi-frame encode, user plugins and 
LA_EXT rate control mode are enabled"; }
-
 if enabled libmfx; then
-   check_cc MFX_CODEC_VP9 "mfx/mfxdefs.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
+   check_cc MFX_CODEC_VP9 "mfxdefs.h mfxstructures.h" "MFX_CODEC_VP9"
 fi
 
 enabled libmodplug&& require_pkg_config libmodplug libmodplug 
libmodplug/modplug.h ModPlug_Load
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 9d08485c92..84f0401b0f 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -18,9 +18,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -39,7 +39,7 @@
 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
 
 #if QSV_VERSION_ATLEAST(1, 12)
-#include "mfx/mfxvp8.h"
+#include "mfxvp8.h"
 #endif
 
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h
index b77158ec26..04ae0d6f34 100644
--- a/libavcodec/qsv.h
+++ b/libavcodec/qsv.h
@@ -21,7 +21,7 @@
 #ifndef AVCODEC_QSV_H
 #define AVCODEC_QSV_H
 
-#include 
+#include 
 
 #include "libavutil/buffer.h"
 
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 8090b748b3..24c3e9307e 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -39,7 +39,7 @@
 #include "libavutil/hwcontext_vaapi.h"
 #endif
 
-#include 
+#include 
 
 #include "libavutil/frame.h"
 
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 8bce9f2cf0..1cadb846f5 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include "libavutil/common.h"
 #include "libavutil/fifo.h"
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index