Re: [FFmpeg-devel] [PATCH v2] doc/encoders: document libjxl encoder options

2022-04-28 Thread Gyan Doshi

Pushed as ec07b1547753864d1fb47eb2747613dddba507b2

On 2022-04-27 08:30 pm, Leo Izen wrote:

Add more detailed documenation for the libjxl encoder
wrapper than is present currently inside libavcodec.
---
  doc/encoders.texi | 35 +++
  1 file changed, 35 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index aac9f25e55..51f0dc3fcb 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1809,6 +1809,41 @@ by ":". See the SVT-AV1 encoder user guide for a list of 
accepted parameters.
  
  @end table
  
+@section libjxl

+
+libjxl JPEG XL encoder wrapper.
+
+Requires the presence of the libjxl headers and library during
+configuration. You need to explicitly configure the build with
+@code{--enable-libjxl}.
+
+@subsection Options
+
+The libjxl wrapper supports the following options:
+
+@table @option
+
+@item distance
+Set the target Butteraugli distance. This is a quality setting: lower
+distance yields higher quality, with distance=1.0 roughly comparable to
+libjpeg Quality 90 for photographic content. Setting distance=0.0 yields
+true lossless encoding. Valid values range between 0.0 and 15.0, and sane
+values rarely exceed 5.0. Setting distance=0.1 is usually attains
+transparency for most input. The default is 1.0.
+
+@item effort
+Set the encoding effort used. Higher effort values produce more consistent
+quality and usually produces a better quality/bpp curve, at the cost of
+more CPU time required. Valid values range from 1 to 9, and the default is 7.
+
+@item modular
+Force the encoder to use Modular mode instead of choosing automatically. The
+default is to use VarDCT for lossy encoding and Modular for lossless. VarDCT
+is generally superior to Modular for lossy encoding but does not support
+lossless encoding.
+
+@end table
+
  @section libkvazaar
  
  Kvazaar H.265/HEVC encoder.


___
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 v08 00/10] make QSV works with the Intel's oneVPL

2022-04-28 Thread Haihao Xiang
The oneAPI Video Processing Library (oneVPL) is a single interface for
encode, decode and video processing[1][2]. oneVPL is a successor to Intel(R) 
Media
SDK, but removed obsolete features. Intel(R) Media SDK lifetime comes to an
end now, new features for new Intel Gen platforms will be supported in oneVPL
only[3].

It is recommended to use oneVPL for new work, even for currently available
hardwares[4]. Hence, this patchset added a new option --enable-onevpl to bring
the support for oneVPL in QSV, new features for oneVPL will be implemented in
other patchset, for example, we are implementing av1_qsv encoder
(https://github.com/intel-media-ci/ffmpeg/pull/515).

option --enble-libmfx still works with Intel(R) Media SDK.

Note user can't enable onevpl and libmfx together.

oneVPL dispatcher:
https://github.com/oneapi-src/oneVPL

oneVPL GPU runtime for new Intel Gen platforms:
https://github.com/oneapi-src/oneVPL-intel-gpu

v8:
  - Fix mfx session creation for D3D11VA and DXVA2
  - Rebased this patchset against the latest master

[1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/index.html
[2] https://www.intel.com/content/www/us/en/developer/tools/oneapi/onevpl.html
[3] https://github.com/Intel-Media-SDK/MediaSDK/#media-sdk-support-matrix
[4] 
https://www.intel.com/content/www/us/en/develop/documentation/upgrading-from-msdk-to-onevpl/top.html

Haihao Xiang (10):
  configure: ensure --enable-libmfx uses libmfx 1.x
  configure: fix the check for MFX_CODEC_VP9
  qsv: remove mfx/ prefix from mfx headers
  qsv: load user plugin for MFX_VERSION < 2.0
  qsv: build audio related code when MFX_VERSION < 2.0
  qsvenc: support multi-frame encode when MFX_VERSION < 2.0
  qsvenc: support MFX_RATECONTROL_LA_EXT when MFX_VERSION < 2.0
  qsv: support OPAQUE memory when MFX_VERSION < 2.0
  qsv: use a new method to create mfx session when using oneVPL
  configure: add --enable-libvpl option

 configure|  29 +-
 libavcodec/qsv.c | 220 ++--
 libavcodec/qsv.h |   4 +-
 libavcodec/qsv_internal.h|   6 +-
 libavcodec/qsvdec.c  |  21 +-
 libavcodec/qsvenc.c  |  25 +-
 libavcodec/qsvenc.h  |   9 +-
 libavcodec/qsvenc_h264.c |   3 +-
 libavcodec/qsvenc_hevc.c |   3 +-
 libavcodec/qsvenc_jpeg.c |   3 +-
 libavcodec/qsvenc_mpeg2.c|   3 +-
 libavcodec/qsvenc_vp9.c  |   3 +-
 libavfilter/qsvvpp.c | 145 +++-
 libavfilter/qsvvpp.h |  12 +-
 libavfilter/vf_deinterlace_qsv.c |  73 ++--
 libavfilter/vf_scale_qsv.c   |  88 ++---
 libavutil/hwcontext_d3d11va.c|   7 +
 libavutil/hwcontext_opencl.c |   2 +-
 libavutil/hwcontext_qsv.c| 573 ---
 libavutil/hwcontext_qsv.h|   3 +-
 libavutil/hwcontext_vaapi.c  |  13 +
 libavutil/hwcontext_vaapi.h  |   4 +
 22 files changed, 1062 insertions(+), 187 deletions(-)

-- 
2.17.1

___
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 v08 01/10] configure: ensure --enable-libmfx uses libmfx 1.x

2022-04-28 Thread Haihao Xiang
Intel's oneVPL is a successor to MediaSDK, but removed some obsolete
features of MediaSDK[1]. Some early versions of oneVPL still uses libmfx
as library name[2], however some of obsolete features, including OPAQUE
memory, multi-frame encode, user plugins and LA_EXT rate control mode
etc, have been enabled in QSV, so user can not use --enable-libmfx to
enable QSV if using an early version of oneVPL SDK. In order to make
sure user builds FFmpeg against a right version of libmfx, this patch
added a check for the version of libmfx and warning message about the
used obsolete features.

[1] 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html
[2] https://github.com/oneapi-src/oneVPL
---
 configure | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 196873c4aa..81e7d43d22 100755
--- a/configure
+++ b/configure
@@ -6565,8 +6565,11 @@ 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 "mfx/mfxvideo.h" 
MFXInit ||
-   { require libmfx "mfx/mfxvideo.h" MFXInit 
"-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
+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"; } } &&
+   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/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
 fi
-- 
2.17.1

___
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 v08 02/10] configure: fix the check for MFX_CODEC_VP9

2022-04-28 Thread Haihao Xiang
The data structures for VP9 in mfxvp9.h is wrapped by
MFX_VERSION_NEXT, which means those data structures have never been used
in a public release. Actually MFX_CODEC_VP9 and other VP9 stuffs is
added in mfxstructures.h. In addition, mfxdefs.h is included in
mfxvp9.h, so we may use the check in this patch for MFX_CODEC_VP9

This is in preparation for oneVPL support because mfxvp9.h is removed
from oneVPL [1]

[1]: https://github.com/oneapi-src/oneVPL
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 81e7d43d22..939c6e86f9 100755
--- a/configure
+++ b/configure
@@ -6571,7 +6571,7 @@ enabled libmfx&& { { check_pkg_config libmfx 
"libmfx < 2.0" "mfx/mfx
 "multi-frame encode, user plugins and 
LA_EXT rate control mode are enabled"; }
 
 if enabled libmfx; then
-   check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
+   check_cc MFX_CODEC_VP9 "mfx/mfxdefs.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
 fi
 
 enabled libmodplug&& require_pkg_config libmodplug libmodplug 
libmodplug/modplug.h ModPlug_Load
-- 
2.17.1

___
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 v08 03/10] qsv: remove mfx/ prefix from mfx headers

2022-04-28 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 939c6e86f9..e163c743e1 100755
--- a/configure
+++ b/configure
@@ -6565,13 +6565,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${libmfx_incdir}/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 b86c20b153..95e721566a 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 e2aecdcbd6..49d5797fbc 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 5fc5bed4c8..b75559f083 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include "libavutil/common.h"
 #include "libavutil/fifo.h"
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index fbb22ca436..2ba4b8e90c 100644
--- a/libav

[FFmpeg-devel] [PATCH v08 04/10] qsv: load user plugin for MFX_VERSION < 2.0

2022-04-28 Thread Haihao Xiang
User plugin isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
preparation for oneVPL Support

[1]: 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
 libavcodec/qsv.c  | 8 +++-
 libavcodec/qsv_internal.h | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 95e721566a..f66b388625 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -19,7 +19,6 @@
  */
 
 #include 
-#include 
 #include 
 
 #include 
@@ -37,11 +36,16 @@
 #include "qsv_internal.h"
 
 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
+#define QSV_HAVE_USER_PLUGIN!QSV_ONEVPL
 
 #if QSV_VERSION_ATLEAST(1, 12)
 #include "mfxvp8.h"
 #endif
 
+#if QSV_HAVE_USER_PLUGIN
+#include 
+#endif
+
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
 {
 switch (codec_id) {
@@ -343,6 +347,7 @@ enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type)
 static int qsv_load_plugins(mfxSession session, const char *load_plugins,
 void *logctx)
 {
+#if QSV_HAVE_USER_PLUGIN
 if (!load_plugins || !*load_plugins)
 return 0;
 
@@ -386,6 +391,7 @@ load_plugin_fail:
 if (err < 0)
 return err;
 }
+#endif
 
 return 0;
 
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 49d5797fbc..4c1ccc7342 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -62,6 +62,8 @@
 ((MFX_VERSION.Major > (MAJOR)) ||   \
 (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
 
+#define QSV_ONEVPL   QSV_VERSION_ATLEAST(2, 0)
+
 typedef struct QSVMid {
 AVBufferRef *hw_frames_ref;
 mfxHDLPair *handle_pair;
-- 
2.17.1

___
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 v08 05/10] qsv: build audio related code when MFX_VERSION < 2.0

2022-04-28 Thread Haihao Xiang
Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
preparation for oneVPL support

[1]: 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
 libavcodec/qsv.c | 5 +
 libavfilter/qsvvpp.c | 6 ++
 libavfilter/qsvvpp.h | 2 ++
 3 files changed, 13 insertions(+)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index f66b388625..4e35003ad5 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -37,6 +37,7 @@
 
 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
 #define QSV_HAVE_USER_PLUGIN!QSV_ONEVPL
+#define QSV_HAVE_AUDIO  !QSV_ONEVPL
 
 #if QSV_VERSION_ATLEAST(1, 12)
 #include "mfxvp8.h"
@@ -137,8 +138,10 @@ static const struct {
 { MFX_ERR_INVALID_VIDEO_PARAM,  AVERROR(EINVAL), "invalid video 
parameters" },
 { MFX_ERR_UNDEFINED_BEHAVIOR,   AVERROR_BUG, "undefined behavior"  
 },
 { MFX_ERR_DEVICE_FAILED,AVERROR(EIO),"device failed"   
 },
+#if QSV_HAVE_AUDIO
 { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio 
parameters"},
 { MFX_ERR_INVALID_AUDIO_PARAM,  AVERROR(EINVAL), "invalid audio 
parameters" },
+#endif
 
 { MFX_WRN_IN_EXECUTION, 0,   "operation in 
execution"   },
 { MFX_WRN_DEVICE_BUSY,  0,   "device busy" 
 },
@@ -148,7 +151,9 @@ static const struct {
 { MFX_WRN_VALUE_NOT_CHANGED,0,   "value is saturated"  
 },
 { MFX_WRN_OUT_OF_RANGE, 0,   "value out of range"  
 },
 { MFX_WRN_FILTER_SKIPPED,   0,   "filter skipped"  
 },
+#if QSV_HAVE_AUDIO
 { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0,   "incompatible audio 
parameters"},
+#endif
 };
 
 /**
diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 954f882637..3647891d13 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -38,6 +38,8 @@
 #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
 
+#define QSV_HAVE_AUDIO !QSV_ONEVPL
+
 static const AVRational default_tb = { 1, 9 };
 
 typedef struct QSVAsyncFrame {
@@ -100,8 +102,10 @@ static const struct {
 { MFX_ERR_INVALID_VIDEO_PARAM,  AVERROR(EINVAL), "invalid video 
parameters" },
 { MFX_ERR_UNDEFINED_BEHAVIOR,   AVERROR_BUG, "undefined behavior"  
 },
 { MFX_ERR_DEVICE_FAILED,AVERROR(EIO),"device failed"   
 },
+#if QSV_HAVE_AUDIO
 { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio 
parameters"},
 { MFX_ERR_INVALID_AUDIO_PARAM,  AVERROR(EINVAL), "invalid audio 
parameters" },
+#endif
 
 { MFX_WRN_IN_EXECUTION, 0,   "operation in 
execution"   },
 { MFX_WRN_DEVICE_BUSY,  0,   "device busy" 
 },
@@ -111,7 +115,9 @@ static const struct {
 { MFX_WRN_VALUE_NOT_CHANGED,0,   "value is saturated"  
 },
 { MFX_WRN_OUT_OF_RANGE, 0,   "value out of range"  
 },
 { MFX_WRN_FILTER_SKIPPED,   0,   "filter skipped"  
 },
+#if QSV_HAVE_AUDIO
 { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0,   "incompatible audio 
parameters"},
+#endif
 };
 
 static int qsv_map_error(mfxStatus mfx_err, const char **desc)
diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
index 543c58a967..802abd987d 100644
--- a/libavfilter/qsvvpp.h
+++ b/libavfilter/qsvvpp.h
@@ -40,6 +40,8 @@
 ((MFX_VERSION.Major > (MAJOR)) ||   \
 (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
 
+#define QSV_ONEVPL   QSV_VERSION_ATLEAST(2, 0)
+
 typedef struct QSVFrame {
 AVFrame  *frame;
 mfxFrameSurface1 surface;
-- 
2.17.1

___
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 v08 06/10] qsvenc: support multi-frame encode when MFX_VERSION < 2.0

2022-04-28 Thread Haihao Xiang
Multi-frame encode isn't supported for MFX_VERSION >= 2.0[1][2]. This is
in preparation for oneVPL support

[1]: 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
 libavcodec/qsvenc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 58d1ab346c..8aa1e251b3 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -67,7 +67,7 @@
 #define QSV_HAVE_ICQQSV_VERSION_ATLEAST(1, 28)
 #define QSV_HAVE_VCM0
 #define QSV_HAVE_QVBR   QSV_VERSION_ATLEAST(1, 28)
-#define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25)
+#define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25) && !QSV_ONEVPL
 #endif
 
 #if !QSV_HAVE_LA_DS
-- 
2.17.1

___
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 v08 08/10] qsv: support OPAQUE memory when MFX_VERSION < 2.0

2022-04-28 Thread Haihao Xiang
OPAQUE memory isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
preparation for oneVPL support

[1]: 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
 libavcodec/qsv.c |  4 ++
 libavcodec/qsv.h |  2 +
 libavcodec/qsv_internal.h|  1 +
 libavcodec/qsvdec.c  |  9 
 libavcodec/qsvenc.c  | 21 +
 libavcodec/qsvenc.h  |  2 +
 libavfilter/qsvvpp.c | 26 ++-
 libavfilter/qsvvpp.h |  3 ++
 libavfilter/vf_deinterlace_qsv.c | 57 +---
 libavfilter/vf_scale_qsv.c   | 74 ++--
 libavutil/hwcontext_qsv.c| 56 +---
 11 files changed, 181 insertions(+), 74 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 4e35003ad5..ad9f4df3f2 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -89,10 +89,14 @@ static const struct {
 } qsv_iopatterns[] = {
 {MFX_IOPATTERN_IN_VIDEO_MEMORY, "input is video memory surface"
 },
 {MFX_IOPATTERN_IN_SYSTEM_MEMORY,"input is system memory surface"   
 },
+#if QSV_HAVE_OPAQUE
 {MFX_IOPATTERN_IN_OPAQUE_MEMORY,"input is opaque memory surface"   
 },
+#endif
 {MFX_IOPATTERN_OUT_VIDEO_MEMORY,"output is video memory surface"   
 },
 {MFX_IOPATTERN_OUT_SYSTEM_MEMORY,   "output is system memory surface"  
 },
+#if QSV_HAVE_OPAQUE
 {MFX_IOPATTERN_OUT_OPAQUE_MEMORY,   "output is opaque memory surface"  
 },
+#endif
 };
 
 int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern,
diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h
index 04ae0d6f34..c156b08d07 100644
--- a/libavcodec/qsv.h
+++ b/libavcodec/qsv.h
@@ -61,6 +61,8 @@ typedef struct AVQSVContext {
  * required by the encoder and the user-provided value nb_opaque_surfaces.
  * The array of the opaque surfaces will be exported to the caller through
  * the opaque_surfaces field.
+ *
+ * The caller must set this field to zero for oneVPL (MFX_VERSION >= 2.0)
  */
 int opaque_alloc;
 
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 4c1ccc7342..5c26914b4c 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -63,6 +63,7 @@
 (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
 
 #define QSV_ONEVPL   QSV_VERSION_ATLEAST(2, 0)
+#define QSV_HAVE_OPAQUE  !QSV_ONEVPL
 
 typedef struct QSVMid {
 AVBufferRef *hw_frames_ref;
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index b75559f083..cd0a0f9cc1 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -187,7 +187,11 @@ static int qsv_init_session(AVCodecContext *avctx, 
QSVContext *q, mfxSession ses
 
 ret = ff_qsv_init_session_frames(avctx, &q->internal_qs.session,
  &q->frames_ctx, q->load_plugins,
+#if QSV_HAVE_OPAQUE
  q->iopattern == 
MFX_IOPATTERN_OUT_OPAQUE_MEMORY,
+#else
+ 0,
+#endif
  q->gpu_copy);
 if (ret < 0) {
 av_buffer_unref(&q->frames_ctx.hw_frames_ctx);
@@ -300,10 +304,15 @@ static int qsv_decode_preinit(AVCodecContext *avctx, 
QSVContext *q, enum AVPixel
 AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx;
 
 if (!iopattern) {
+#if QSV_HAVE_OPAQUE
 if (frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME)
 iopattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
 else if (frames_hwctx->frame_type & 
MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
 iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
+#else
+if (frames_hwctx->frame_type & 
MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
+iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
+#endif
 }
 }
 
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index fa8960a0ad..decb49b4f5 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1275,6 +1275,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, 
QSVEncContext *q)
 return 0;
 }
 
+#if QSV_HAVE_OPAQUE
 static int qsv_init_opaque_alloc(AVCodecContext *avctx, QSVEncContext *q)
 {
 AVQSVContext *qsv = avctx->hwaccel_context;
@@ -1311,6 +1312,7 @@ static int qsv_init_opaque_alloc(AVCodecContext *avctx, 
QSVEncContext *q)
 
 return 0;
 }
+#endif
 
 static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q)
 {
@@ -1326,7 +1328,11 @@ static int qsvenc_init_session(AVCodecContext *avctx, 
QSVEncContext *q)
 
 ret = ff_qsv_init_session_frames(avctx, &q->internal_qs.session,
  &q->frames_ctx, q->load_plugins,
+#if QSV_HAVE_OPAQUE
  q->param.IOPattern == 
MFX_IOPATTERN_IN_OPAQUE_MEMORY,
+#else
+  

[FFmpeg-devel] [PATCH v08 07/10] qsvenc: support MFX_RATECONTROL_LA_EXT when MFX_VERSION < 2.0

2022-04-28 Thread Haihao Xiang
MFX_RATECONTROL_LA_EXT isn't supported for MFX_VERSION >= 2.0[1][2].
This is in preparation for oneVPL support

[1]: 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 2ba4b8e90c..fa8960a0ad 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -153,7 +153,7 @@ static const struct {
 #if QSV_HAVE_VCM
 { MFX_RATECONTROL_VCM, "VCM" },
 #endif
-#if QSV_VERSION_ATLEAST(1, 10)
+#if QSV_VERSION_ATLEAST(1, 10) && !QSV_ONEVPL
 { MFX_RATECONTROL_LA_EXT,  "LA_EXT" },
 #endif
 #if QSV_HAVE_LA_HRD
-- 
2.17.1

___
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 v08 09/10] qsv: use a new method to create mfx session when using oneVPL

2022-04-28 Thread Haihao Xiang
In oneVPL, MFXLoad() and MFXCreateSession() are required to create a
workable mfx session[1]

Add config filters for D3D9/D3D11 session (galinart)

The default device is changed to d3d11va for oneVPL when both d3d11va
and dxva2 are enabled on Microsoft Windows

This is in preparation for oneVPL support

[1] 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher

Co-authored-by: galinart 
Signed-off-by: galinart 
---
 libavcodec/qsv.c | 197 ++--
 libavcodec/qsv_internal.h|   1 +
 libavcodec/qsvdec.c  |  10 +
 libavcodec/qsvenc.h  |   3 +
 libavcodec/qsvenc_h264.c |   1 -
 libavcodec/qsvenc_hevc.c |   1 -
 libavcodec/qsvenc_jpeg.c |   1 -
 libavcodec/qsvenc_mpeg2.c|   1 -
 libavcodec/qsvenc_vp9.c  |   1 -
 libavfilter/qsvvpp.c | 113 ++-
 libavfilter/qsvvpp.h |   5 +
 libavfilter/vf_deinterlace_qsv.c |  14 +-
 libavfilter/vf_scale_qsv.c   |  12 +-
 libavutil/hwcontext_d3d11va.c|   7 +
 libavutil/hwcontext_qsv.c| 515 ---
 libavutil/hwcontext_qsv.h|   1 +
 libavutil/hwcontext_vaapi.c  |  13 +
 libavutil/hwcontext_vaapi.h  |   4 +
 18 files changed, 812 insertions(+), 88 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index ad9f4df3f2..2892699728 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -47,6 +47,12 @@
 #include 
 #endif
 
+#if QSV_ONEVPL
+#include 
+#else
+#define MFXUnload(a) do { } while(0)
+#endif
+
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
 {
 switch (codec_id) {
@@ -439,6 +445,164 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 }
 #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE
 
+#if QSV_ONEVPL
+
+static int qsv_create_mfx_session(AVCodecContext *avctx,
+  mfxIMPL implementation,
+  mfxVersion *pver,
+  int gpu_copy,
+  mfxSession *psession,
+  void **ploader)
+{
+mfxStatus sts;
+mfxLoader loader = NULL;
+mfxSession session = NULL;
+mfxConfig cfg;
+mfxVariant impl_value;
+uint32_t impl_idx = 0;
+
+*psession = NULL;
+
+/* Don't create a new MFX loader if the input loader is valid */
+if (*ploader == NULL) {
+av_log(avctx, AV_LOG_VERBOSE,
+   "Use Intel(R) oneVPL to create MFX session, the required "
+   "implementation version is %d.%d\n",
+   pver->Major, pver->Minor);
+
+loader = MFXLoad();
+
+if (!loader) {
+av_log(avctx, AV_LOG_ERROR, "Error creating a MFX loader\n");
+goto fail;
+}
+
+/* Create configurations for implementation */
+cfg = MFXCreateConfig(loader);
+
+if (!cfg) {
+av_log(avctx, AV_LOG_ERROR, "Error creating a MFX 
configurations\n");
+goto fail;
+}
+
+impl_value.Type = MFX_VARIANT_TYPE_U32;
+impl_value.Data.U32 = (implementation == MFX_IMPL_SOFTWARE) ?
+MFX_IMPL_TYPE_SOFTWARE : MFX_IMPL_TYPE_HARDWARE;
+sts = MFXSetConfigFilterProperty(cfg,
+ (const mfxU8 
*)"mfxImplDescription.Impl", impl_value);
+
+if (sts != MFX_ERR_NONE) {
+av_log(avctx, AV_LOG_ERROR, "Error adding a MFX configuration "
+   "property: %d\n", sts);
+goto fail;
+}
+
+impl_value.Type = MFX_VARIANT_TYPE_U32;
+impl_value.Data.U32 = pver->Version;
+sts = MFXSetConfigFilterProperty(cfg,
+ (const mfxU8 
*)"mfxImplDescription.ApiVersion.Version",
+ impl_value);
+
+if (sts != MFX_ERR_NONE) {
+av_log(avctx, AV_LOG_ERROR, "Error adding a MFX configuration "
+   "property: %d\n", sts);
+goto fail;
+}
+} else {
+av_log(avctx, AV_LOG_VERBOSE,
+   "Use Intel(R) oneVPL to create MFX session with the specified 
MFX loader\n");
+
+loader = *ploader;
+}
+
+while (1) {
+/* Enumerate all implementations */
+mfxImplDescription *impl_desc;
+
+sts = MFXEnumImplementations(loader, impl_idx,
+ MFX_IMPLCAPS_IMPLDESCSTRUCTURE,
+ (mfxHDL *)&impl_desc);
+
+/* Failed to find an available implementation */
+if (sts == MFX_ERR_NOT_FOUND)
+break;
+else if (sts != MFX_ERR_NONE) {
+impl_idx++;
+continue;
+}
+
+sts = MFXCreateSession(loader, impl_idx, &session);
+MFXDispReleaseImplDescription(loader, impl_desc);
+
+if (sts == MFX_ERR_NONE)
+break;
+
+impl_idx++;
+}
+
+ 

[FFmpeg-devel] [PATCH v08 10/10] configure: add --enable-libvpl option

2022-04-28 Thread Haihao Xiang
This allows user to build FFmpeg against Intel oneVPL. oneVPL 2.6
is the required minimum version when building Intel oneVPL code.

It will fail to run configure script if both libmfx and libvpl are
enabled.

It is recommended to use oneVPL for new work, even for currently available
hardwares [1]

Note the preferred child device type is d3d11va for libvpl on Windows.
The commands below will use d3d11va if d3d11va is available on Windows.
$ ffmpeg -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -qsv_device 0 -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -init_hw_device qsv=qsv:hw_any -hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=0 -hwaccel qsv -c:v 
h264_qsv ...

User may use child_device_type option to specify child device type to
dxva2 or derive a qsv device from a dxva2 device
$ ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=0,child_device_type=dxva2 
-hwaccel qsv -c:v h264_qsv ...
$ ffmpeg -init_hw_device dxva2=d3d9:0 -init_hw_device qsv=qsv@d3d9 -hwaccel qsv 
-c:v h264_qsv ...

[1] 
https://www.intel.com/content/www/us/en/develop/documentation/upgrading-from-msdk-to-onevpl/top.html
---
 configure | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index e163c743e1..cea185fc9b 100755
--- a/configure
+++ b/configure
@@ -341,6 +341,7 @@ External library support:
   --disable-ffnvcodec  disable dynamically linked Nvidia code [autodetect]
   --enable-libdrm  enable DRM code (Linux) [no]
   --enable-libmfx  enable Intel MediaSDK (AKA Quick Sync Video) code 
via libmfx [no]
+  --enable-libvpl  enable Intel oneVPL code via libvpl if libmfx is 
not used [no]
   --enable-libnpp  enable Nvidia Performance Primitives-based code [no]
   --enable-mmalenable Broadcom Multi-Media Abstraction Layer 
(Raspberry Pi) via MMAL [no]
   --disable-nvdec  disable Nvidia video decoding acceleration (via 
hwaccel) [autodetect]
@@ -1921,6 +1922,7 @@ HWACCEL_LIBRARY_NONFREE_LIST="
 HWACCEL_LIBRARY_LIST="
 $HWACCEL_LIBRARY_NONFREE_LIST
 libmfx
+libvpl
 mmal
 omx
 opencl
@@ -6559,22 +6561,35 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 0.8.1" 
kvazaar.h kvz_api_get
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_new
+
+if enabled libmfx && enabled libvpl; then
+   die "ERROR: can not use libmfx and libvpl together"
 # While it may appear that require is being used as a pkg-config
 # fallback for libmfx, it is actually being used to detect a different
 # installation route altogether.  If libmfx is installed via the Intel
 # 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" 
"mfxvideo.h" MFXInit ||
+elif enabled libmfx; then
+{ 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${libmfx_incdir}/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"; }
+  { check_pkg_config libmfx "libmfx < 2.0" "mfx/mfxvideo.h" MFXInit && 
add_cflags -I${libmfx_incdir}/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"
+elif enabled libvpl; then
+# Consider pkg-config only. The name of libmfx is still passed to 
check_pkg_config function for --enable-libvpl option
+# because QSV has dependency on libmfx, we can use the same dependency if 
using libmfx in this check. The package name
+# is extracted from "vpl >= 2.6"
+check_pkg_config libmfx "vpl >= 2.6" "mfxvideo.h mfxdispatcher.h" MFXLoad 
&& \
+warn "build FFmpeg against oneVPL 2.6+, OPAQUE memory, multi-frame 
encode, user plugins\n"\
+ "and LA_EXT rate control mode in FFmpeg QSV won't be supported." 
||
+

Re: [FFmpeg-devel] [PATCH v7 09/10] qsv: use a new method to create mfx session when using oneVPL

2022-04-28 Thread Xiang, Haihao
On Wed, 2022-04-06 at 03:58 +, Xiang, Haihao wrote:

[...]
> > > 
> > > 
> 
> 
https://spec.oneapi.io/versions/latest/elements/oneVPL/source/API_ref/VPL_disp_api_struct.html#structmfx_impl_description
> > > > > ) and user must select an available implementation before the creation
> > > > > of
> > > > > mfx
> > > > > session, however the device handle is unknown in the SDK when
> > > > > selecting
> > > > > an
> > > > > available implementation, the SDK provides a method to select
> > > > > implementation
> > > > > via
> > > > > the given adapter (on Windows) or DRI device node (on Linux). The
> > > > > default
> > > > > implementation will be selected if child device name is unknown.
> > > > > 
> > > > 
> > > > First of all, whoever made that API should get a stern message.
> > > > Expecting to properly interoperate with the dominant platform APIs
> > > > should be a primary goal, and it sounds like it was somehow shoehorned
> > > > in after the fact.
> > > > 
> > > > For D3D11 for example, you can get the IDXGIAdapter a device was
> > > > created from, isn't there enough information in there to pass-on
> > > > without storing a string field?
> > > > IDXGIAdapter::GetDesc has tons of identification information to
> > > > identify the device in use.
> > > > 
> > > > D3D9 probably has something similar, haven't checked right now.
> > > 
> > > 
> > > Thanks for the info, I may get AdapterLuid from the adapter description,
> > > however
> > > the required parameter in oneVPL is the index of the adapter, is there a
> > > way
> > > to
> > > map AdapterLuid to adapter index ? (Sorry for this dumb question)
> > > 
> > > There is `IDirect3DDeviceManager9 *devmgr` only in AVDXVA2DeviceContext
> > > for
> > > D3D9, it seems we have to add other members to get adapter description.
> > > 
> > > As for vaapi, there is no API to get the used DRI device from VADisplay
> > > handle,
> > > we have to store this info in AVVAAPIDeviceContext, and I prefer using the
> > > same
> > > way for d3d9 & d3d11va too.
> > > 
> > 
> > I'm not sure about VAAPI, but not storing a string just for this one
> > purpose seems like a win to me.
> > What values would
> > mfxImplDescription.mfxDeviceDescription.device.DeviceID contain, and
> > would that perhaps match something in the D3D11 or DXVA2 device
> > description?
> > 
> > You already have big alternate pathes inside those functions for
> > windows or vaapi, so that doesn't seem like a big step to handle
> > separately.
> 
> Thanks, I will try other members in mfxImplDescription and update you whether
> it
> is doable.


We updated the patch not to change AVD3D11VADeviceContext and
AVDXVA2DeviceContext. Could you take a look when you have time ?

https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295760.html

Thanks
Haihao

___
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] avcodec/wmadec: fix WMA gapless playback

2022-04-28 Thread Mika Fischer

Hi,

I think this patch, which was applied on 2021-09-12 in 
19802d170a304f5853d92e01d0513b9e06897d61 and is included in n5.0 and 
n5.0.1 causes a regression.


This is the (shortened) diff for the test decoding in the patch:

diff --git a/tests/ref/fate/flcl1905 b/tests/ref/fate/flcl1905
index 5f5245ebcf..d702139db8 100644
--- a/tests/ref/fate/flcl1905
+++ b/tests/ref/fate/flcl1905
@@ -1,6 +1,4 @@
 packet|[...]|pts=0|pts_time=0.00|[...]
-frame|[...]|pts=0|pts_time=0.00|[...]
-frame|[...]|pts=N/A|pts_time=N/A|[...]
 frame|[...]|pts=N/A|pts_time=N/A|[...]


As can be seen, the patch causes the first two frames to be dropped, 
which might be OK to better conform to the MS decoder.


The problem is that only the first frame had the timestamp info from the 
packet. Since that got dropped, now the first frame decoded from the 
packet has no timestamp info.


This causes us issues since we assumed that the first audio frame 
decoded after seeking always has timestamp info.


Best regards,
 Mika Fischer
___
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 v3 2/2] avformat/movenc: sidx earliest_presentation_time is applied after editlist

2022-04-28 Thread zhilizhao(赵志立)



> On Mar 29, 2022, at 12:50 PM, Zhao Zhili  wrote:
> 
> Fix #8334
> ---
> libavformat/movenc.c  |  6 +-
> tests/ref/fate/movenc | 10 +-
> 2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 46d66c29c2..079fc70d4a 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -4753,7 +4753,8 @@ static int mov_write_sidx_tag(AVIOContext *pb,
> 
> if (track->entry) {
> entries = 1;
> -presentation_time = track->cluster[0].dts + track->cluster[0].cts;
> +presentation_time = track->cluster[0].dts + track->cluster[0].cts -
> +track->start_dts - track->start_cts;
> duration = track->end_pts -
>(track->cluster[0].dts + track->cluster[0].cts);
> starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE;
> @@ -4768,6 +4769,9 @@ static int mov_write_sidx_tag(AVIOContext *pb,
> if (entries <= 0)
> return 0;
> presentation_time = track->frag_info[0].time;
> +/* presentation_time <= 0 is handled by mov_add_tfra_entries() */
> +if (presentation_time > 0)
> +presentation_time -= track->start_dts + track->start_cts;
> }
> 
> avio_wb32(pb, 0); /* size */

Will apply tomorrow. The issue in ticket 8334 has been hidden by the
use_tfdt flag, which ignored sidx timestamp. The real issue is in mp4 muxer.


___
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] Fix AVX-512-VNNI__hevc_qpel_filters_avx512icl_v_%1

2022-04-28 Thread Felix LeClair
Issue: On extremely new hardware using either IceLake or super sets of 
Intel IceLakes avx512 instructions,
commit d4cd8830bdac3e26c8e75cd92e574c159fecc4f7 causes build issues. 
Specifically a NASM macro expansion of

qpel_filter_v is never properly defined/initialized.

The issue is the definition was erroneously placed inside a conditional 
which will not trigger unless
the original definition failed (has to do with if PIC is defined, 
becomes a bit of a catch 22)


Specifically the error is
```
X86ASM  libavcodec/x86/hevc_mc.o
libavcodec/x86/hevc_mc.asm:1854: error: symbol `..@88472.table' not defined
libavcodec/x86/hevc_mc.asm:1806: ... from macro 
`HEVC_PUT_HEVC_QPEL_HV_AVX512ICL' defined here

libavcodec/x86/hevc_mc.asm:1730: ... from macro `QPEL_FILTER_V' defined here
...
repeats a few times...
...
make: *** [ffbuild/common.mak:100: libavcodec/x86/hevc_mc.o] Error 1
```
Specific error was discussed by kurosu and myself (fclc) on the 
ffmpeg-devel irc.


This commit fixes the above by swapping lines 1796 and 1795, moving the 
define out of the conditional


Side note: It seems fate didn't pick up on this, may merit looking into 
(as mentioned by nevcairiel).


Signed-off-by: Felix LeClair (FCLC) 
Signed-off-by: FelixCLC (FCLC) 
---
 libavcodec/x86/hevc_mc.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm
index c07948dd9b..e159adccc7 100644
--- a/libavcodec/x86/hevc_mc.asm
+++ b/libavcodec/x86/hevc_mc.asm
@@ -1792,8 +1792,8 @@ cglobal hevc_put_hevc_qpel_hv%1_%2, 6, 7, 27, dst, 
src, srcstride, height, mx, m

 subsrcq, tmpq
 sub myq, 1
 shl myq, 5
-%ifdef PIC
 %define %%table hevc_qpel_filters_avx512icl_v_%1
+%ifdef PIC
 lea tmpq, [%%table]
 %define FILTER tmpq
 %else
--
2.32.0

___
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] avformat/avio: use av_match_name to match protocol lists

2022-04-28 Thread Leo Izen

On 4/20/22 16:33, Leo Izen wrote:

This swaps av_match_list to av_match_name inside ffurl_connect,
which allows ALL to be treated as a valid value on the whitelist
or blacklist in accordance with the behavior described in the
documentation.
---
  libavformat/avio.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

This has been on the ML for a week, can someone take a look at it? 
Thanks in advance.


Leo Izen (thebombzen)


___
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-v2] Fix AVX-512-VNNI__hevc_qpel_filters_avx512icl_v_%_2

2022-04-28 Thread Felix LeClair
Issue: On extremely new hardware using either IceLake or super sets of 
Intel IceLakes avx512 instructions,
commit d4cd8830bdac3e26c8e75cd92e574c159fecc4f7 causes build issues. 
Specifically a NASM macro expansion of

qpel_filter_v is never properly defined/initialized.

The issue is the definition was erroneously placed inside a conditional 
which will not trigger unless
the original definition failed (has to do with if PIC is defined, 
becomes a bit of a catch 22)


Specifically the error is
```
X86ASMlibavcodec/x86/hevc_mc.o
libavcodec/x86/hevc_mc.asm:1854: error: symbol `..@88472.table' not defined
libavcodec/x86/hevc_mc.asm:1806: ... from macro 
`HEVC_PUT_HEVC_QPEL_HV_AVX512ICL' defined here

libavcodec/x86/hevc_mc.asm:1730: ... from macro `QPEL_FILTER_V' defined here
...
repeats a few times...
...
make: *** [ffbuild/common.mak:100: libavcodec/x86/hevc_mc.o] Error 1
```
Specific error was discussed by kurosu and myself (fclc) on the 
ffmpeg-devel irc.


This commit fixes the above by swapping lines 1796 and 1795, moving the 
define out of the conditional


Side note: It seems fate didn't pick up on this, may merit looking into 
(as mentioned by nevcairiel).


Signed-off-by: FelixCLC (FCLC) 
---
 libavcodec/x86/hevc_mc.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm
index c07948dd9b..e159adccc7 100644
--- a/libavcodec/x86/hevc_mc.asm
+++ b/libavcodec/x86/hevc_mc.asm
@@ -1792,8 +1792,8 @@ cglobal hevc_put_hevc_qpel_hv%1_%2, 6, 7, 27, dst, 
src, srcstride, height, mx, m

 subsrcq, tmpq
 sub myq, 1
 shl myq, 5
-%ifdef PIC
 %define %%table hevc_qpel_filters_avx512icl_v_%1
+%ifdef PIC
 lea tmpq, [%%table]
 %define FILTER tmpq
 %else
--
2.32.0

___
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 v5 1/4] doc/examples/transcode_aac: Don't ignore last encoded frame

2022-04-28 Thread Andreas Unterweger
The last encoded frame is now fetched on EOF. It was previously left
in the encoder and caused a "1 frame left in queue" warning.

Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 9102e55f16..c9b93f6439 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -377,6 +377,8 @@ static int decode_audio_frame(AVFrame *frame,
 if (error < 0)
 return error;

+*data_present = 0;
+*finished = 0;
 /* Read one audio frame from the input file into a temporary packet. */
 if ((error = av_read_frame(input_format_context, input_packet)) < 0) {
 /* If we are at the end of the file, flush the decoder below. */
@@ -555,7 +557,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo,
 AVFrame *input_frame = NULL;
 /* Temporary storage for the converted input samples. */
 uint8_t **converted_input_samples = NULL;
-int data_present = 0;
+int data_present;
 int ret = AVERROR_EXIT;

 /* Initialize temporary storage for one input frame. */
@@ -675,18 +677,17 @@ static int encode_audio_frame(AVFrame *frame,
 frame->pts = pts;
 pts += frame->nb_samples;
 }
-
+
+*data_present = 0;
 /* Send the audio frame stored in the temporary packet to the encoder.
  * The output audio stream encoder is used to do this. */
 error = avcodec_send_frame(output_codec_context, frame);
-/* The encoder signals that it has nothing more to encode. */
-if (error == AVERROR_EOF) {
-error = 0;
-goto cleanup;
-} else if (error < 0) {
-fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
-av_err2str(error));
-goto cleanup;
+/* Check for errors, but proceed with fetching encoded samples if the
+ *  encoder signals that it has nothing more to encode. */
+if (error < 0 && error != AVERROR_EOF) {
+  fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
+  av_err2str(error));
+  goto cleanup;
 }

 /* Receive one encoded frame from the encoder. */
@@ -857,7 +858,6 @@ int main(int argc, char **argv)
 int data_written;
 /* Flush the encoder as it may have delayed frames. */
 do {
-data_written = 0;
 if (encode_audio_frame(NULL, output_format_context,
output_codec_context, &data_written))
 goto cleanup;
-- 
2.30.2
___
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 v5 2/4] doc/examples/transcode_aac: Set decoder packet timebase

2022-04-28 Thread Andreas Unterweger
Previously, the default timebase caused two warnings during decoding
about not being able to update timestamps for skipped and discarded
samples, respectively.

Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index c9b93f6439..52548f080d 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -62,6 +62,7 @@ static int open_input_file(const char *filename,
 {
 AVCodecContext *avctx;
 const AVCodec *input_codec;
+const AVStream *stream;
 int error;

 /* Open the input file to read from it. */
@@ -88,9 +89,11 @@ static int open_input_file(const char *filename,
 avformat_close_input(input_format_context);
 return AVERROR_EXIT;
 }
+
+stream = (*input_format_context)->streams[0];

 /* Find a decoder for the audio stream. */
-if (!(input_codec =
avcodec_find_decoder((*input_format_context)->streams[0]->codecpar->codec_id)))
{
+if (!(input_codec = avcodec_find_decoder(stream->codecpar->codec_id))) {
 fprintf(stderr, "Could not find input codec\n");
 avformat_close_input(input_format_context);
 return AVERROR_EXIT;
@@ -105,7 +108,7 @@ static int open_input_file(const char *filename,
 }

 /* Initialize the stream parameters with demuxer information. */
-error = avcodec_parameters_to_context(avctx,
(*input_format_context)->streams[0]->codecpar);
+error = avcodec_parameters_to_context(avctx, stream->codecpar);
 if (error < 0) {
 avformat_close_input(input_format_context);
 avcodec_free_context(&avctx);
@@ -120,6 +123,9 @@ static int open_input_file(const char *filename,
 avformat_close_input(input_format_context);
 return error;
 }
+
+/* Set the packet timebase for the decoder. */
+avctx->pkt_timebase = stream->time_base;

 /* Save the decoder context for easier access later. */
 *input_codec_context = avctx;
-- 
2.30.2
___
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 v5 3/4] doc/examples/transcode_aac: AAC encoder is no longer experimental

2022-04-28 Thread Andreas Unterweger
Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 52548f080d..909aa1cb73 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -211,9 +211,6 @@ static int open_output_file(const char *filename,
 avctx->sample_fmt = output_codec->sample_fmts[0];
 avctx->bit_rate   = OUTPUT_BIT_RATE;

-/* Allow the use of the experimental AAC encoder. */
-avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
-
 /* Set the sample rate for the container. */
 stream->time_base.den = input_codec_context->sample_rate;
 stream->time_base.num = 1;
-- 
2.30.2
___
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 v5 4/4] doc/examples/transcode_aac: Bump date

2022-04-28 Thread Andreas Unterweger
Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 909aa1cb73..1b372782ab 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018 Andreas Unterweger
+ * Copyright (c) 2013-2022 Andreas Unterweger
  *
  * This file is part of FFmpeg.
  *
-- 
2.30.2
___
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 1/3] lavc/aarch64: fix hevc sao band filter

2022-04-28 Thread J. Dekker
The SAO band filter can be called with non-multiples of 8, we round up
to the nearest multiple of 8 to account for this.

Signed-off-by: J. Dekker 
---
 libavcodec/aarch64/hevcdsp_init_aarch64.c | 10 +-
 libavcodec/aarch64/hevcdsp_sao_neon.S |  8 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c 
b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index 1e40be740c..c8963e6104 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -75,11 +75,11 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, 
const int bit_depth)
 c->idct_dc[1]  = ff_hevc_idct_8x8_dc_8_neon;
 c->idct_dc[2]  = ff_hevc_idct_16x16_dc_8_neon;
 c->idct_dc[3]  = ff_hevc_idct_32x32_dc_8_neon;
-// This function is disabled, as it doesn't handle widths that aren't
-// an even multiple of 8 correctly. fate-hevc doesn't exercise that
-// for the current size, but if enabled for bigger sizes, the cases
-// of non-multiple of 8 seem to arise.
-//c->sao_band_filter[0]  = ff_hevc_sao_band_filter_8x8_8_neon;
+c->sao_band_filter[0]  =
+c->sao_band_filter[1]  =
+c->sao_band_filter[2]  =
+c->sao_band_filter[3]  =
+c->sao_band_filter[4]  = ff_hevc_sao_band_filter_8x8_8_neon;
 }
 if (bit_depth == 10) {
 c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S 
b/libavcodec/aarch64/hevcdsp_sao_neon.S
index d523bf584d..e07e0cea2d 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -41,7 +41,11 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
 and w10, w10, #0x1F
 strhw9, [sp, x10, lsl #1]
 bne 0b
+add w6,  w6,  #7
+bic w6,  w6,  #7
 ld1 {v16.16b-v19.16b}, [sp], #64
+sub x2,  x2,  x6
+sub x3,  x3,  x6
 moviv20.8h,   #1
 1:  mov w8,  w6// beginning of line
 2:  // Simple layout for accessing 16bit values
@@ -52,7 +56,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
 // |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|
 // +--->
 //i-0 i-1 i-2 i-3
-ld1 {v2.8b}, [x1]  // dst[x] = 
av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
+ld1 {v2.8b}, [x1], #8  // dst[x] = 
av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
 uxtlv0.8h,  v2.8b  // load src[x]
 ushrv2.8h,  v0.8h, #3  // >> BIT_DEPTH - 3
 shl v1.8h,  v2.8h, #1  // low (x2, accessing short)
@@ -61,7 +65,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
 tbx v2.16b, {v16.16b-v19.16b}, v1.16b // table
 add v1.8h,  v0.8h, v2.8h   // src[x] + table
 sqxtun  v4.8b,  v1.8h  // clip + narrow
-st1 {v4.8b}, [x0]  // store
+st1 {v4.8b}, [x0], #8  // store
 subsw8, w8,  #8// done 8 pixels
 bne 2b
 subsw7, w7,  #1// finished line, prep. new
-- 
2.32.0 (Apple Git-132)

___
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 2/3] lavc/aarch64: add hevc sao edge 16x16

2022-04-28 Thread J. Dekker
bench on AWS Graviton:

hevc_sao_edge_16x16_8_c: 1857.0
hevc_sao_edge_16x16_8_neon: 211.0
hevc_sao_edge_32x32_8_c: 7802.2
hevc_sao_edge_32x32_8_neon: 808.2
hevc_sao_edge_48x48_8_c: 16764.2
hevc_sao_edge_48x48_8_neon: 1796.5
hevc_sao_edge_64x64_8_c: 32647.5
hevc_sao_edge_64x64_8_neon: 3118.5

Signed-off-by: J. Dekker 
---
 libavcodec/aarch64/hevcdsp_init_aarch64.c |  8 ++-
 libavcodec/aarch64/hevcdsp_sao_neon.S | 66 +++
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c 
b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index c8963e6104..df521bb083 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -57,8 +57,8 @@ void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, 
uint8_t *_src,
   ptrdiff_t stride_dst, ptrdiff_t stride_src,
   int16_t *sao_offset_val, int sao_left_class,
   int width, int height);
-
-
+void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, 
ptrdiff_t stride_dst,
+  int16_t *sao_offset_val, int eo, int 
width, int height);
 
 av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
 {
@@ -80,6 +80,10 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, 
const int bit_depth)
 c->sao_band_filter[2]  =
 c->sao_band_filter[3]  =
 c->sao_band_filter[4]  = ff_hevc_sao_band_filter_8x8_8_neon;
+c->sao_edge_filter[1]  =
+c->sao_edge_filter[2]  =
+c->sao_edge_filter[3]  =
+c->sao_edge_filter[4]  = ff_hevc_sao_edge_filter_16x16_8_neon;
 }
 if (bit_depth == 10) {
 c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S 
b/libavcodec/aarch64/hevcdsp_sao_neon.S
index e07e0cea2d..0315c479df 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -74,3 +74,69 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
 bne 1b
 ret
 endfunc
+
+// ASSUMES STRIDE_SRC = 192
+.Lsao_edge_pos:
+.word 1 // horizontal
+.word 192 // vertical
+.word 192 + 1 // 45 degree
+.word 192 - 1 // 135 degree
+
+// ff_hevc_sao_edge_filter_16x16_8_neon(char *dst, char *src, ptrdiff 
stride_dst,
+//  int16 *sao_offset_val, int eo, int 
width, int height)
+function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
+adr x7, .Lsao_edge_pos
+ld1 {v3.8h}, [x3]  // load sao_offset_val
+add w5,  w5,  #0xF
+bic w5,  w5,  #0xF
+ldr w4, [x7, w4, uxtw #2]  // stride_src
+mov v3.h[7], v3.h[0]   // reorder to [1,2,0,3,4]
+mov v3.h[0], v3.h[1]
+mov v3.h[1], v3.h[2]
+mov v3.h[2], v3.h[7]
+// split 16bit values into two tables
+uzp2v1.16b, v3.16b, v3.16b // sao_offset_val -> upper
+uzp1v0.16b, v3.16b, v3.16b // sao_offset_val -> lower
+moviv2.16b, #2
+mov x15, #192
+// strides between end of line and next src/dst
+sub x15, x15, x5   // stride_src - width
+sub x16, x2, x5// stride_dst - width
+mov x11, x1// copy base src
+1:  // new line
+mov x14, x5// copy width
+sub x12, x11, x4   // src_a (prev) = src - 
sao_edge_pos
+add x13, x11, x4   // src_b (next) = src + 
sao_edge_pos
+2:  // process 16 bytes
+ld1 {v3.16b}, [x11], #16   // load src
+ld1 {v4.16b}, [x12], #16   // load src_a (prev)
+ld1 {v5.16b}, [x13], #16   // load src_b (next)
+cmhiv16.16b, v4.16b, v3.16b// (prev > cur)
+cmhiv17.16b, v3.16b, v4.16b// (cur > prev)
+cmhiv18.16b, v5.16b, v3.16b// (next > cur)
+cmhiv19.16b, v3.16b, v5.16b// (cur > next)
+sub v20.16b, v16.16b, v17.16b  // diff0 = CMP(cur, prev) = 
(cur > prev) - (cur < prev)
+sub v21.16b, v18.16b, v19.16b  // diff1 = CMP(cur, next) = 
(cur > next) - (cur < next)
+add v20.16b, v20.16b, v21.16b  // diff = diff0 + diff1
+add v20.16b, v20.16b, v2.16b   // offset_val = diff + 2
+tbl v16.16b, {v0.16b}, v20.16b
+tbl v17.16b, {v1.16b}, v20.16b
+uxtlv20.8h, v3.8b  // src[0:7]
+uxtl2   v21.8h, v3.

[FFmpeg-devel] [PATCH 3/3] lavc/aarch64: add hevc sao edge 8x8

2022-04-28 Thread J. Dekker
bench on AWS Graviton:

hevc_sao_edge_8x8_8_c: 516.0
hevc_sao_edge_8x8_8_neon: 81.0

Signed-off-by: J. Dekker 
---
 libavcodec/aarch64/hevcdsp_init_aarch64.c |  3 ++
 libavcodec/aarch64/hevcdsp_sao_neon.S | 51 +++
 2 files changed, 54 insertions(+)

diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c 
b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index df521bb083..2002530266 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -59,6 +59,8 @@ void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, 
uint8_t *_src,
   int width, int height);
 void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, 
ptrdiff_t stride_dst,
   int16_t *sao_offset_val, int eo, int 
width, int height);
+void ff_hevc_sao_edge_filter_8x8_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst,
+  int16_t *sao_offset_val, int eo, int 
width, int height);
 
 av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
 {
@@ -80,6 +82,7 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, 
const int bit_depth)
 c->sao_band_filter[2]  =
 c->sao_band_filter[3]  =
 c->sao_band_filter[4]  = ff_hevc_sao_band_filter_8x8_8_neon;
+c->sao_edge_filter[0]  = ff_hevc_sao_edge_filter_8x8_8_neon;
 c->sao_edge_filter[1]  =
 c->sao_edge_filter[2]  =
 c->sao_edge_filter[3]  =
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S 
b/libavcodec/aarch64/hevcdsp_sao_neon.S
index 0315c479df..efd8112af4 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -140,3 +140,54 @@ function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
 // no lines to filter
 ret
 endfunc
+
+// ff_hevc_sao_edge_filter_8x8_8_neon(char *dst, char *src, ptrdiff stride_dst,
+//int16 *sao_offset_val, int eo, int 
width, int height)
+function ff_hevc_sao_edge_filter_8x8_8_neon, export=1
+adr x7, .Lsao_edge_pos
+ldr w4, [x7, w4, uxtw #2]
+ld1 {v3.8h}, [x3]
+mov v3.h[7], v3.h[0]
+mov v3.h[0], v3.h[1]
+mov v3.h[1], v3.h[2]
+mov v3.h[2], v3.h[7]
+uzp2v1.16b, v3.16b, v3.16b
+uzp1v0.16b, v3.16b, v3.16b
+moviv2.16b, #2
+add x16, x0, x2
+lsl x2,  x2, #1
+mov x15, #192
+mov x8,  x1
+sub x9,  x1, x4
+add x10, x1, x4
+lsr w17, w6, #1
+1:  ld1 {v3.d}[0], [ x8], x15
+ld1 {v4.d}[0], [ x9], x15
+ld1 {v5.d}[0], [x10], x15
+ld1 {v3.d}[1], [ x8], x15
+ld1 {v4.d}[1], [ x9], x15
+ld1 {v5.d}[1], [x10], x15
+cmhiv16.16b, v4.16b, v3.16b
+cmhiv17.16b, v3.16b, v4.16b
+cmhiv18.16b, v5.16b, v3.16b
+cmhiv19.16b, v3.16b, v5.16b
+sub v20.16b, v16.16b, v17.16b
+sub v21.16b, v18.16b, v19.16b
+add v20.16b, v20.16b, v21.16b
+add v20.16b, v20.16b, v2.16b
+tbl v16.16b, {v0.16b}, v20.16b
+tbl v17.16b, {v1.16b}, v20.16b
+uxtlv20.8h, v3.8b
+uxtl2   v21.8h, v3.16b
+zip1v18.16b, v16.16b, v17.16b
+zip2v19.16b, v16.16b, v17.16b
+sqadd   v20.8h, v18.8h, v20.8h
+sqadd   v21.8h, v19.8h, v21.8h
+sqxtun  v6.8b, v20.8h
+sqxtun  v7.8b, v21.8h
+st1 {v6.8b}, [ x0], x2
+st1 {v7.8b}, [x16], x2
+subsx17, x17, #1
+b.ne1b
+ret
+endfunc
-- 
2.32.0 (Apple Git-132)

___
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 1/3] lavc/aarch64: fix hevc sao band filter

2022-04-28 Thread J. Dekker
On 28 Apr 2022, at 15:42, J. Dekker wrote:

> The SAO band filter can be called with non-multiples of 8, we round up
> to the nearest multiple of 8 to account for this.

Martin mentioned he wanted checkasm to check these extra cases. Still working 
on the best way to do this, will post soon.

-- 
J. Dekker
___
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 v6 1/4] doc/examples/transcode_aac: Don't ignore last encoded frame

2022-04-28 Thread Andreas Unterweger
The last encoded frame is now fetched on EOF. It was previously left
in the encoder and caused a "1 frame left in queue" warning.

Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 9102e55f16..c9b93f6439 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -377,6 +377,8 @@ static int decode_audio_frame(AVFrame *frame,
 if (error < 0)
 return error;

+*data_present = 0;
+*finished = 0;
 /* Read one audio frame from the input file into a temporary packet. */
 if ((error = av_read_frame(input_format_context, input_packet)) < 0) {
 /* If we are at the end of the file, flush the decoder below. */
@@ -555,7 +557,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo,
 AVFrame *input_frame = NULL;
 /* Temporary storage for the converted input samples. */
 uint8_t **converted_input_samples = NULL;
-int data_present = 0;
+int data_present;
 int ret = AVERROR_EXIT;

 /* Initialize temporary storage for one input frame. */
@@ -675,18 +677,17 @@ static int encode_audio_frame(AVFrame *frame,
 frame->pts = pts;
 pts += frame->nb_samples;
 }
-
+
+*data_present = 0;
 /* Send the audio frame stored in the temporary packet to the encoder.
  * The output audio stream encoder is used to do this. */
 error = avcodec_send_frame(output_codec_context, frame);
-/* The encoder signals that it has nothing more to encode. */
-if (error == AVERROR_EOF) {
-error = 0;
-goto cleanup;
-} else if (error < 0) {
-fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
-av_err2str(error));
-goto cleanup;
+/* Check for errors, but proceed with fetching encoded samples if the
+ *  encoder signals that it has nothing more to encode. */
+if (error < 0 && error != AVERROR_EOF) {
+  fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
+  av_err2str(error));
+  goto cleanup;
 }

 /* Receive one encoded frame from the encoder. */
@@ -857,7 +858,6 @@ int main(int argc, char **argv)
 int data_written;
 /* Flush the encoder as it may have delayed frames. */
 do {
-data_written = 0;
 if (encode_audio_frame(NULL, output_format_context,
output_codec_context, &data_written))
 goto cleanup;
-- 
2.30.2
___
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 v6 2/4] doc/examples/transcode_aac: Set decoder packet timebase

2022-04-28 Thread Andreas Unterweger
Previously, the default timebase caused two warnings during decoding
about not being able to update timestamps for skipped and discarded
samples, respectively.

Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index c9b93f6439..52548f080d 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -62,6 +62,7 @@ static int open_input_file(const char *filename,
 {
 AVCodecContext *avctx;
 const AVCodec *input_codec;
+const AVStream *stream;
 int error;

 /* Open the input file to read from it. */
@@ -88,9 +89,11 @@ static int open_input_file(const char *filename,
 avformat_close_input(input_format_context);
 return AVERROR_EXIT;
 }
+
+stream = (*input_format_context)->streams[0];

 /* Find a decoder for the audio stream. */
-if (!(input_codec =
avcodec_find_decoder((*input_format_context)->streams[0]->codecpar->codec_id)))
{
+if (!(input_codec = avcodec_find_decoder(stream->codecpar->codec_id))) {
 fprintf(stderr, "Could not find input codec\n");
 avformat_close_input(input_format_context);
 return AVERROR_EXIT;
@@ -105,7 +108,7 @@ static int open_input_file(const char *filename,
 }

 /* Initialize the stream parameters with demuxer information. */
-error = avcodec_parameters_to_context(avctx,
(*input_format_context)->streams[0]->codecpar);
+error = avcodec_parameters_to_context(avctx, stream->codecpar);
 if (error < 0) {
 avformat_close_input(input_format_context);
 avcodec_free_context(&avctx);
@@ -120,6 +123,9 @@ static int open_input_file(const char *filename,
 avformat_close_input(input_format_context);
 return error;
 }
+
+/* Set the packet timebase for the decoder. */
+avctx->pkt_timebase = stream->time_base;

 /* Save the decoder context for easier access later. */
 *input_codec_context = avctx;
-- 
2.30.2
___
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 v6 3/4] doc/examples/transcode_aac: AAC encoder is no longer experimental

2022-04-28 Thread Andreas Unterweger
Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 52548f080d..909aa1cb73 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -211,9 +211,6 @@ static int open_output_file(const char *filename,
 avctx->sample_fmt = output_codec->sample_fmts[0];
 avctx->bit_rate   = OUTPUT_BIT_RATE;

-/* Allow the use of the experimental AAC encoder. */
-avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
-
 /* Set the sample rate for the container. */
 stream->time_base.den = input_codec_context->sample_rate;
 stream->time_base.num = 1;
-- 
2.30.2
___
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 v6 4/4] doc/examples/transcode_aac: Bump date

2022-04-28 Thread Andreas Unterweger
Signed-off-by: Andreas Unterweger 
---
 doc/examples/transcode_aac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 909aa1cb73..1b372782ab 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018 Andreas Unterweger
+ * Copyright (c) 2013-2022 Andreas Unterweger
  *
  * This file is part of FFmpeg.
  *
-- 
2.30.2
___
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 2/2] doc/examples/transcode_aac: Set decoder packet timebase

2022-04-28 Thread Andreas Unterweger
On Thu, 28 Apr 2022 at 05:23, Andreas Rheinhardt
 wrote:
>
> Andreas Unterweger:
> > Previously, the default timebase caused two warnings during decoding
> > about not being able to update timestamps for skipped and discarded
> > samples, respectively.
> >
> > Signed-off-by: Andreas Unterweger 
> > ---
> >  doc/examples/transcode_aac.c | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
> > index c9b93f6439..6197369756 100644
> > --- a/doc/examples/transcode_aac.c
> > +++ b/doc/examples/transcode_aac.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2013-2018 Andreas Unterweger
> > + * Copyright (c) 2013-2022 Andreas Unterweger
> >   *
> >   * This file is part of FFmpeg.
> >   *
> > @@ -120,6 +120,10 @@ static int open_input_file(const char *filename,
> >  avformat_close_input(input_format_context);
> >  return error;
> >  }
> > +
> > +/* Set the packet timebase for the decoder. The input file's sample
> > + * rate is used as the denominator for simplicity. */
> > +avctx->pkt_timebase = (AVRational) { 1, avctx->sample_rate };
> >
> >  /* Save the decoder context for easier access later. */
> >  *input_codec_context = avctx;
>
> The timebase of the packets sent to the decoder is given by
> AVStream.time_base; this need not be the natural time base (i.e. the
> inverse of the sample rate).
>
> - Andreas

I changed the code in versions 5 and 6 to use the stream time base.
However, the new patches, again, seem to cause issues in Patchwork. I
don't know what is the issue exactly. I double-checked for broken
lines before sending the e-mails. I prepared version 5 and 6 exactly
as version 4, which is fine (green) on Patchwork.
Is the patch o.k. now in terms of its content, and, if so, how can I
send it in such a way that Patchwork is happy?

Best,
Andreas
___
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] Fix AVX-512-VNNI_hevc_qpel_filters_avx512icl

2022-04-28 Thread Felix LeClair
Issue: On extremely new hardware using either IceLake or super sets of 
Intel IceLakes avx512 instructions, commit 
d4cd8830bdac3e26c8e75cd92e574c159fecc4f7 causes build issues. 
Specifically a NASM macro expansion of qpel_filter_v is never properly 
defined/initialized.


The issue is the definition was erroneously placed inside a conditional 
which will not trigger unless the original definition failed (has to do 
with if PIC is defined, becomes a bit of a catch 22)

Specifically the error is

X86ASMlibavcodec/x86/hevc_mc.o
libavcodec/x86/hevc_mc.asm:1854: error: symbol `..@88472.table' not defined
libavcodec/x86/hevc_mc.asm:1806: ... from macro 
`HEVC_PUT_HEVC_QPEL_HV_AVX512ICL' defined here

libavcodec/x86/hevc_mc.asm:1730: ... from macro `QPEL_FILTER_V' defined here
...
repeats a few times...
...
make: *** [ffbuild/common.mak:100: libavcodec/x86/hevc_mc.o] Error 1
```
Specific error was discussed by kurosu and myself (fclc) on the 
ffmpeg-devel irc.


This commit fixes the above by swapping lines 1796 and 1795, moving the 
define out of the conditional


Side note: It seems fate didn't pick up on this, may merit looking into 
(as mentioned by nevcairiel).


Signed-off-by: Felix LeClair (FCLC) 
---
 libavcodec/x86/hevc_mc.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm
index c07948dd9b..e159adccc7 100644
--- a/libavcodec/x86/hevc_mc.asm
+++ b/libavcodec/x86/hevc_mc.asm
@@ -1792,8 +1792,8 @@ cglobal hevc_put_hevc_qpel_hv%1_%2, 6, 7, 27, dst, 
src, srcstride, height, mx, m

 subsrcq, tmpq
 sub myq, 1
 shl myq, 5
-%ifdef PIC
 %define %%table hevc_qpel_filters_avx512icl_v_%1
+%ifdef PIC
 lea tmpq, [%%table]
 %define FILTER tmpq
 %else
--
2.32.0

___
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] avcodec/h264dec: Skip late SEI

2022-04-28 Thread Michael Niedermayer
Fixes: Race condition
Fixes: 
clusterfuzz-testcase-minimized-mediasource_MP2T_AVC_pipeline_integration_fuzzer-6282675434094592

Found-by: google ClusterFuzz
Tested-by: Dan Sanders 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/h264dec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index d80bc6b17f..2a5b53ea56 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -672,6 +672,10 @@ static int decode_nal_units(H264Context *h, const uint8_t 
*buf, int buf_size)
 avpriv_request_sample(avctx, "data partitioning");
 break;
 case H264_NAL_SEI:
+if (h->setup_finished) {
+avpriv_request_sample(avctx, "Late SEI");
+break;
+}
 ret = ff_h264_sei_decode(&h->sei, &nal->gb, &h->ps, avctx);
 h->has_recovery_point = h->has_recovery_point || 
h->sei.recovery_point.recovery_frame_cnt != -1;
 if (avctx->debug & FF_DEBUG_GREEN_MD)
-- 
2.17.1

___
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 3/3] lavc/aarch64: add hevc sao edge 8x8

2022-04-28 Thread Martin Storsjö

On Thu, 28 Apr 2022, J. Dekker wrote:


bench on AWS Graviton:

hevc_sao_edge_8x8_8_c: 516.0
hevc_sao_edge_8x8_8_neon: 81.0

Signed-off-by: J. Dekker 
---
libavcodec/aarch64/hevcdsp_init_aarch64.c |  3 ++
libavcodec/aarch64/hevcdsp_sao_neon.S | 51 +++
2 files changed, 54 insertions(+)

diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c 
b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index df521bb083..2002530266 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -59,6 +59,8 @@ void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, 
uint8_t *_src,
  int width, int height);
void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst,
  int16_t *sao_offset_val, int eo, int 
width, int height);
+void ff_hevc_sao_edge_filter_8x8_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t 
stride_dst,
+  int16_t *sao_offset_val, int eo, int 
width, int height);

av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
{
@@ -80,6 +82,7 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, 
const int bit_depth)
c->sao_band_filter[2]  =
c->sao_band_filter[3]  =
c->sao_band_filter[4]  = ff_hevc_sao_band_filter_8x8_8_neon;
+c->sao_edge_filter[0]  = ff_hevc_sao_edge_filter_8x8_8_neon;
c->sao_edge_filter[1]  =
c->sao_edge_filter[2]  =
c->sao_edge_filter[3]  =
diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S 
b/libavcodec/aarch64/hevcdsp_sao_neon.S
index 0315c479df..efd8112af4 100644
--- a/libavcodec/aarch64/hevcdsp_sao_neon.S
+++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
@@ -140,3 +140,54 @@ function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
// no lines to filter
ret
endfunc
+
+// ff_hevc_sao_edge_filter_8x8_8_neon(char *dst, char *src, ptrdiff stride_dst,
+//int16 *sao_offset_val, int eo, int 
width, int height)
+function ff_hevc_sao_edge_filter_8x8_8_neon, export=1
+adr x7, .Lsao_edge_pos
+ldr w4, [x7, w4, uxtw #2]
+ld1 {v3.8h}, [x3]
+mov v3.h[7], v3.h[0]
+mov v3.h[0], v3.h[1]
+mov v3.h[1], v3.h[2]
+mov v3.h[2], v3.h[7]
+uzp2v1.16b, v3.16b, v3.16b
+uzp1v0.16b, v3.16b, v3.16b
+moviv2.16b, #2
+add x16, x0, x2
+lsl x2,  x2, #1
+mov x15, #192
+mov x8,  x1
+sub x9,  x1, x4
+add x10, x1, x4
+lsr w17, w6, #1


Compared with the previously applied (and reverted) patch, here, you 
previously had "mov x17, #4". I guess that'd mean the function only ever 
produced 8 output rows, while it now uses the real height parameter? Was 
this change a no-op (height is always 8?) or was this another hidden bug 
in the previous implementation?



+1:  ld1 {v3.d}[0], [ x8], x15
+ld1 {v4.d}[0], [ x9], x15
+ld1 {v5.d}[0], [x10], x15
+ld1 {v3.d}[1], [ x8], x15
+ld1 {v4.d}[1], [ x9], x15
+ld1 {v5.d}[1], [x10], x15
+cmhiv16.16b, v4.16b, v3.16b
+cmhiv17.16b, v3.16b, v4.16b
+cmhiv18.16b, v5.16b, v3.16b
+cmhiv19.16b, v3.16b, v5.16b
+sub v20.16b, v16.16b, v17.16b
+sub v21.16b, v18.16b, v19.16b
+add v20.16b, v20.16b, v21.16b
+add v20.16b, v20.16b, v2.16b
+tbl v16.16b, {v0.16b}, v20.16b
+tbl v17.16b, {v1.16b}, v20.16b
+uxtlv20.8h, v3.8b
+uxtl2   v21.8h, v3.16b
+zip1v18.16b, v16.16b, v17.16b
+zip2v19.16b, v16.16b, v17.16b
+sqadd   v20.8h, v18.8h, v20.8h
+sqadd   v21.8h, v19.8h, v21.8h
+sqxtun  v6.8b, v20.8h
+sqxtun  v7.8b, v21.8h
+st1 {v6.8b}, [ x0], x2
+st1 {v7.8b}, [x16], x2
+subsx17, x17, #1


This could be "subs w6, w6, #2" and you wouldn't need the lsr instruction 
at all. And you could place the subs before the two st1 instructions to 
reduce latency between them a little. (The same thing goes for moving subs 
further away from the branch that uses its outcome in the previous patch 
too.) But as this is just a reapply of a previously committed and reverted 
patch, I guess it's fine this way too...


The patchset otherwise looks good to me, modulo the question about the 
difference to the previous patchset abov

Re: [FFmpeg-devel] [PATCH] avformat/avio: use av_match_name to match protocol lists

2022-04-28 Thread Michael Niedermayer
On Thu, Apr 28, 2022 at 08:43:21AM -0400, Leo Izen wrote:
> On 4/20/22 16:33, Leo Izen wrote:
> > This swaps av_match_list to av_match_name inside ffurl_connect,
> > which allows ALL to be treated as a valid value on the whitelist
> > or blacklist in accordance with the behavior described in the
> > documentation.
> > ---
> >   libavformat/avio.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> This has been on the ML for a week, can someone take a look at it? Thanks in
> advance.

protocol whitelist documents ALL
protocol blacklist is undocumented
codec whitelist does not document ALL
format whitelist does not document ALL

There may be a very valid reason but i cannot remember it

also adding entries with - to the blacklist disables them. Iam not sure
if this is great. One could assume that adding an entry to the backlist
would increase but never decrease what is blocked

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn


signature.asc
Description: PGP signature
___
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 01/13] fate/qt: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/qt.mak | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/tests/fate/qt.mak b/tests/fate/qt.mak
index 6e71f6e4d1..42e5fd9107 100644
--- a/tests/fate/qt.mak
+++ b/tests/fate/qt.mak
@@ -1,52 +1,52 @@
-FATE_QT-$(call DEMDEC, MOV, EIGHTBPS) += fate-8bps
+FATE_QT-$(call FRAMECRC, MOV, EIGHTBPS, SCALE_FILTER ARESAMPLE_FILTER) += 
fate-8bps
 fate-8bps: CMD = framecrc -i $(TARGET_SAMPLES)/8bps/full9iron-partial.mov 
-pix_fmt rgb24 -vf scale -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, QDM2) += fate-qdm2
+FATE_QT-$(call ENCDEC, PCM_S16LE QDM2, PCM_S16LE MOV, PIPE_PROTOCOL) += 
fate-qdm2
 fate-qdm2: CMD = pcm -i $(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.mov
 fate-qdm2: CMP = oneoff
 fate-qdm2: REF = $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.pcm
 fate-qdm2: FUZZ = 2
 
-FATE_QT-$(call DEMDEC, MOV, PCM_ALAW) += fate-qt-alaw-mono
+FATE_QT-$(call ENCDEC, PCM_S16LE PCM_ALAW, MOV PCM_S16LE) += fate-qt-alaw-mono
 fate-qt-alaw-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-1-16-B-alaw.mov -f s16le
 
-FATE_QT-$(call DEMDEC, MOV, PCM_ALAW) += fate-qt-alaw-stereo
+FATE_QT-$(call ENCDEC, PCM_S16LE PCM_ALAW, MOV PCM_S16LE) += 
fate-qt-alaw-stereo
 fate-qt-alaw-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-B-alaw.mov -f s16le
 
-FATE_QT-$(call DEMDEC, MOV, ADPCM_IMA_QT) += fate-qt-ima4-mono
+FATE_QT-$(call ENCDEC, PCM_S16LE ADPCM_IMA_QT, PCM_S16LE MOV, 
ARESAMPLE_FILTER) += fate-qt-ima4-mono
 fate-qt-ima4-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-1-16-B-ima4.mov -f s16le -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, ADPCM_IMA_QT) += fate-qt-ima4-stereo
+FATE_QT-$(call ENCDEC, PCM_S16LE ADPCM_IMA_QT, PCM_S16LE MOV, 
ARESAMPLE_FILTER) += fate-qt-ima4-stereo
 fate-qt-ima4-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-B-ima4.mov -f s16le -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, MACE3) += fate-qt-mac3-mono
+FATE_QT-$(call ENCDEC, PCM_S16LE MACE3, PCM_S16LE MOV, ARESAMPLE_FILTER) += 
fate-qt-mac3-mono
 fate-qt-mac3-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-1-8-MAC3.mov -f s16le -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, MACE3) += fate-qt-mac3-stereo
+FATE_QT-$(call ENCDEC, PCM_S16LE MACE3, PCM_S16LE MOV, ARESAMPLE_FILTER) += 
fate-qt-mac3-stereo
 fate-qt-mac3-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-8-MAC3.mov -f s16le -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, MACE6) += fate-qt-mac6-mono
+FATE_QT-$(call ENCDEC, PCM_S16LE MACE6, PCM_S16LE MOV, ARESAMPLE_FILTER) += 
fate-qt-mac6-mono
 fate-qt-mac6-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-1-8-MAC6.mov -f s16le -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, MACE6) += fate-qt-mac6-stereo
+FATE_QT-$(call ENCDEC, PCM_S16LE MACE6, PCM_S16LE MOV, ARESAMPLE_FILTER) += 
fate-qt-mac6-stereo
 fate-qt-mac6-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-8-MAC6.mov -f s16le -af aresample
 
-FATE_QT-$(call DEMDEC, MOV, PCM_MULAW) += fate-qt-ulaw-mono
+FATE_QT-$(call ENCDEC, PCM_S16LE PCM_MULAW, PCM_S16LE MOV) += fate-qt-ulaw-mono
 fate-qt-ulaw-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-1-16-B-ulaw.mov -f s16le
 
-FATE_QT-$(call DEMDEC, MOV, PCM_MULAW) += fate-qt-ulaw-stereo
+FATE_QT-$(call ENCDEC, PCM_S16LE PCM_MULAW, PCM_S16LE MOV) += 
fate-qt-ulaw-stereo
 fate-qt-ulaw-stereo: CMD = md5 -i 
$(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-B-ulaw.mov -f s16le
 
-FATE_QT-$(call DEMDEC, MOV, QDRAW) += fate-quickdraw
+FATE_QT-$(call FRAMECRC, MOV, QDRAW, SCALE_FILTER) += fate-quickdraw
 fate-quickdraw: CMD = framecrc -i $(TARGET_SAMPLES)/quickdraw/Airplane.mov 
-pix_fmt rgb24 -vf scale
 
-FATE_QT-$(call DEMDEC, MOV, RPZA) += fate-rpza
+FATE_QT-$(call FRAMECRC, MOV, RPZA, SCALE_FILTER) += fate-rpza
 fate-rpza: CMD = framecrc -i $(TARGET_SAMPLES)/rpza/rpza2.mov -t 2 -pix_fmt 
rgb24 -vf scale
 
-FATE_QT-$(call DEMDEC, MOV, SVQ1) += fate-svq1
+FATE_QT-$(call FRAMECRC, MOV, SVQ1) += fate-svq1
 fate-svq1: CMD = framecrc -i $(TARGET_SAMPLES)/svq1/marymary-shackles.mov -an 
-t 10
 
-FATE_QT-$(call DEMDEC, MOV, SVQ1) += fate-svq1-headerswap
+FATE_QT-$(call FRAMECRC, MOV, SVQ1) += fate-svq1-headerswap
 fate-svq1-headerswap: CMD = framecrc -i 
$(TARGET_SAMPLES)/svq1/ct_ending_cut.mov -frames 4
 
 FATE_SVQ3 += fate-svq3-1
@@ -59,7 +59,7 @@ fate-svq3-2: CMD = framecrc -flags +bitexact -ignore_editlist 
1 -i $(TARGET_SAMP
 FATE_SVQ3 += fate-svq3-watermark
 fate-svq3-watermark: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/svq3/svq3_watermark.mov
 
-FATE_QT-$(call ALLYES, MOV_DEMUXER SVQ3_DECODER ZLIB) += $(FATE_SVQ3)
+FATE_QT-$(call FRAMECRC, MOV, SVQ3, ZLIB) += $(FATE_SVQ3)
 fate-svq3: $(FATE_SVQ3)
 
 FATE_QT += $(FATE_QT-yes)
-- 
2.32.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-re

[FFmpeg-devel] [PATCH 02/13] fate/canopus: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/canopus.mak | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/fate/canopus.mak b/tests/fate/canopus.mak
index 3d664ff911..4e50716813 100644
--- a/tests/fate/canopus.mak
+++ b/tests/fate/canopus.mak
@@ -8,7 +8,8 @@ fate-canopus-cllc-rgb: CMD = framecrc -i 
$(TARGET_SAMPLES)/cllc/sample-cllc-rgb.
 FATE_CANOPUS_CLLC += fate-canopus-cllc-yuy2-noblock
 fate-canopus-cllc-yuy2-noblock: CMD = framecrc -i 
$(TARGET_SAMPLES)/cllc/sample-cllc-yuy2-noblock.avi
 
-FATE_SAMPLES_FFMPEG-$(call DEMDEC, AVI, CLLC) += $(FATE_CANOPUS_CLLC)
+FATE_CANOPUS_CLLC   := $(if $(call FRAMECRC, AVI, CLLC), $(FATE_CANOPUS_CLLC))
+FATE_SAMPLES_FFMPEG += $(FATE_CANOPUS_CLLC)
 fate-canopus-cllc: $(FATE_CANOPUS_CLLC)
 
 #lossy
@@ -21,7 +22,8 @@ fate-canopus-hq_hqa-hqa: CMD = framecrc -i 
$(TARGET_SAMPLES)/canopus/hqa.avi
 FATE_CANOPUS_HQ_HQA += fate-canopus-hq_hqa-inter
 fate-canopus-hq_hqa-inter: CMD = framecrc -i 
$(TARGET_SAMPLES)/canopus/hq25i.avi
 
-FATE_SAMPLES_FFMPEG-$(call DEMDEC, AVI, HQ_HQA) += $(FATE_CANOPUS_HQ_HQA)
+FATE_CANOPUS_HQ_HQA := $(if $(call FRAMECRC, AVI, HQ_HQA), 
$(FATE_CANOPUS_HQ_HQA))
+FATE_SAMPLES_FFMPEG += $(FATE_CANOPUS_HQ_HQA)
 fate-canopus-hq_hqa: $(FATE_CANOPUS_HQ_HQA)
 
 FATE_CANOPUS_HQX += fate-canopus-hqx422
@@ -30,5 +32,6 @@ fate-canopus-hqx422: CMD = framecrc -i 
$(TARGET_SAMPLES)/canopus/hqx422.avi -pix
 FATE_CANOPUS_HQX += fate-canopus-hqx422a
 fate-canopus-hqx422a: CMD = framecrc -i $(TARGET_SAMPLES)/canopus/hqx422a.avi 
-pix_fmt yuv422p16be -an -vf scale
 
-FATE_SAMPLES_FFMPEG-$(call DEMDEC, AVI, HQX) += $(FATE_CANOPUS_HQX)
+FATE_CANOPUS_HQX:= $(if $(call FRAMECRC, AVI, HQX, SCALE_FILTER), 
$(FATE_CANOPUS_HQX))
+FATE_SAMPLES_FFMPEG += $(FATE_CANOPUS_HQX)
 fate-canopus-hqx: $(FATE_CANOPUS_HQX)
-- 
2.32.0

___
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 03/13] fate/dnxhd: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/dnxhd.mak | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/fate/dnxhd.mak b/tests/fate/dnxhd.mak
index 59f3f90e91..f261766b53 100644
--- a/tests/fate/dnxhd.mak
+++ b/tests/fate/dnxhd.mak
@@ -1,15 +1,18 @@
-FATE_DNXHD = fate-dnxhd-mbaff \
- fate-dnxhr-444   \
- fate-dnxhr-12bit \
- fate-dnxhr-parse \
+FATE_DNXHD = fate-dnxhr-parse \
  fate-dnxhr-prefix1   \
  fate-dnxhr-prefix2   \
  fate-dnxhr-prefix3   \
  fate-dnxhr-prefix4   \
  fate-dnxhr-prefix5
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, DNXHD) += $(FATE_DNXHD)
-fate-dnxhd: $(FATE_DNXHD) $(FATE_VCODEC_DNXHD)
+FATE_DNXHD_SCALE := fate-dnxhd-mbaff \
+fate-dnxhr-444   \
+fate-dnxhr-12bit \
+
+FATE_DNXHD-$(call FRAMECRC, MOV, DNXHD) += $(FATE_DNXHD)
+FATE_DNXHD-$(call FRAMECRC, MOV, DNXHD, SCALE_FILTER) += $(FATE_DNXHD_SCALE)
+FATE_SAMPLES_FFMPEG += $(FATE_DNXHD-yes)
+fate-dnxhd: $(FATE_DNXHD-yes) $(FATE_VCODEC_DNXHD)
 
 fate-dnxhd-mbaff: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/dnxhd100_cid1260.mov -pix_fmt yuv422p10le -vf scale
 fate-dnxhr-444:   CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/dnxhr444_cid1270.mov -pix_fmt yuv444p10le -vf scale
-- 
2.32.0

___
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 04/13] fate/ea: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/ea.mak | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/tests/fate/ea.mak b/tests/fate/ea.mak
index 7667102ce7..2d1ac6e50c 100644
--- a/tests/fate/ea.mak
+++ b/tests/fate/ea.mak
@@ -1,25 +1,23 @@
-FATE_SAMPLES_EA-$(call DEMDEC, EA_CDATA, ADPCM_EA_XAS) += fate-ea-cdata
+FATE_SAMPLES_EA-$(call ENCDEC, PCM_S16LE ADPCM_EA_XAS, PCM_S16LE EA_CDATA, 
ARESAMPLE_FILTER) += fate-ea-cdata
 fate-ea-cdata: CMD = md5 -i 
$(TARGET_SAMPLES)/ea-cdata/166b084d.46410f77.0009b440.24be960c.cdata -f s16le 
-af aresample
 
-FATE_SAMPLES_EA-$(call DEMDEC, EA, EACMV) += fate-ea-cmv
+FATE_SAMPLES_EA-$(call FRAMECRC, EA, EACMV, SCALE_FILTER) += fate-ea-cmv
 fate-ea-cmv: CMD = framecrc -i $(TARGET_SAMPLES)/ea-cmv/TITLE.CMV -pix_fmt 
rgb24 -vf scale
 
-FATE_SAMPLES_EA-$(call DEMDEC, EA, EAMAD) += fate-ea-mad
+FATE_SAMPLES_EA-$(call FRAMECRC, EA, EAMAD) += fate-ea-mad
 fate-ea-mad: CMD = framecrc -i $(TARGET_SAMPLES)/ea-mad/NFS6LogoE.mad -an
 
-FATE_SAMPLES_EA-$(call DEMDEC, EA, EATGQ) += fate-ea-tgq
+FATE_SAMPLES_EA-$(call FRAMECRC, EA, EATGQ) += fate-ea-tgq
 fate-ea-tgq: CMD = framecrc -i $(TARGET_SAMPLES)/ea-tgq/v27.tgq -an
 
-FATE_EA_TGV += fate-ea-tgv-1
+FATE_EA_TGV-$(call FRAMECRC, EA, EATGV, SCALE_FILTER) += fate-ea-tgv-1 
fate-ea-tgv-2
 fate-ea-tgv-1: CMD = framecrc -i $(TARGET_SAMPLES)/ea-tgv/INTRO8K-partial.TGV 
-pix_fmt rgb24 -an -vf scale
-
-FATE_EA_TGV += fate-ea-tgv-2
 fate-ea-tgv-2: CMD = framecrc -i $(TARGET_SAMPLES)/ea-tgv/INTEL_S.TGV -pix_fmt 
rgb24 -an -vf scale
 
-FATE_SAMPLES_EA-$(call DEMDEC, EA, EATGV) += $(FATE_EA_TGV)
-fate-ea-tgv: $(FATE_EA_TGV)
+FATE_SAMPLES_EA-yes += $(FATE_EA_TGV-yes)
+fate-ea-tgv: $(FATE_EA_TGV-yes)
 
-FATE_SAMPLES_EA-$(call DEMDEC, EA, EATQI) += fate-ea-tqi
+FATE_SAMPLES_EA-$(call FRAMECRC, EA, EATQI) += fate-ea-tqi
 fate-ea-tqi: CMD = framecrc -i 
$(TARGET_SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:v 26 -an
 
 FATE_SAMPLES_FFMPEG += $(FATE_SAMPLES_EA-yes)
-- 
2.32.0

___
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 05/13] fate/vbn: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/vbn.mak | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/fate/vbn.mak b/tests/fate/vbn.mak
index 044b110ac1..6c3fe82c99 100644
--- a/tests/fate/vbn.mak
+++ b/tests/fate/vbn.mak
@@ -30,7 +30,9 @@ tests/data/raw-rgb24.vbn: TAG = GEN
 tests/data/raw-rgb24.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i 
$(TARGET_SAMPLES)/png1/lena-rgb24.png -nostdin -c:v vbn -format raw 
$(TARGET_PATH)/$@ -y 2>/dev/null
 
-VBN_REFCMP_DEPS = PSNR_FILTER METADATA_FILTER VBN_ENCODER VBN_DECODER 
IMAGE2_MUXER IMAGE2_DEMUXER PNG_DECODER
+FATE_VBN-$(call ENCDEC2, VBN, WRAPPED_AVFRAME PNG, IMAGE2,\
+ PSNR_FILTER METADATA_FILTER SCALE_FILTER \
+ NULL_MUXER PIPE_PROTOCOL) += $(FATE_VBN)
 
-FATE_SAMPLES_FFMPEG-$(call ALLYES, $(VBN_REFCMP_DEPS)) += $(FATE_VBN)
-fate-vbn: $(FATE_VBN)
+FATE_SAMPLES_FFMPEG += $(FATE_VBN-yes)
+fate-vbn: $(FATE_VBN-yes)
-- 
2.32.0

___
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 06/13] fate/vbn, tests/fate-run: Delete intermediate VBN-files after tests

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate-run.sh  | 22 ++
 tests/fate/vbn.mak | 24 ++--
 2 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index a96ff049b0..3c62246c8a 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -393,16 +393,30 @@ cmp_metadata(){
 }
 
 refcmp_metadata_files(){
-refcmp=$1
-pixfmt=$2
-file1=$3
-file2=$4
+file1=$1
+file2=$2
+refcmp=$3
+pixfmt=$4
 fuzz=${5:-0.001}
 ffmpeg -auto_conversion_filters $FLAGS -i $file1 $FLAGS -i $file2 
$ENC_OPTS \
 -lavfi 
"[0:v]format=${pixfmt}[v0];[1:v]format=${pixfmt}[v1];[v0][v1]${refcmp},metadata=print:file=-"
 \
 -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f 
${base}/refcmp-metadata.awk -
 }
 
+refcmp_metadata_transcode(){
+srcfile=$1
+enc_opt=$2
+enc_fmt=$3
+enc_ext=$4
+shift 4
+encfile="${outdir}/${test}.${enc_ext}"
+cleanfiles="$cleanfiles $encfile"
+tsrcfile=$(target_path $srcfile)
+tencfile=$(target_path $encfile)
+ffmpeg $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS -y -f $enc_fmt 
$tencfile || return
+refcmp_metadata_files $tencfile $tsrcfile "$@"
+}
+
 pixfmt_conversion(){
 conversion="${test#pixfmt-}"
 outdir="tests/data/pixfmt"
diff --git a/tests/fate/vbn.mak b/tests/fate/vbn.mak
index 6c3fe82c99..91ce3c9639 100644
--- a/tests/fate/vbn.mak
+++ b/tests/fate/vbn.mak
@@ -2,34 +2,14 @@ fate-vbn-%: VBN_FILE = tests/data/$(subst fate-vbn-,,$(@)).vbn
 fate-vbn-%: PIX_FMT = rgba
 fate-vbn-raw-rgb24: PIX_FMT = rgb24
 fate-vbn-%: SRC = $(TARGET_SAMPLES)/png1/lena-$(PIX_FMT).png
-fate-vbn-%: CMD = refcmp_metadata_files psnr $(PIX_FMT) $(VBN_FILE) $(SRC)
-
-fate-vbn-dxt1: tests/data/dxt1.vbn
-fate-vbn-dxt5: tests/data/dxt5.vbn
-fate-vbn-raw-rgba: tests/data/raw-rgba.vbn
-fate-vbn-raw-rgb24: tests/data/raw-rgb24.vbn
+fate-vbn-%: ENC_OPTS = -c:v vbn -format $(word 3,$(subst -, ,$(@)))
+fate-vbn-%: CMD = refcmp_metadata_transcode "$(SRC)" "$(ENC_OPTS)" image2 vbn 
psnr $(PIX_FMT)
 
 FATE_VBN += fate-vbn-dxt1
 FATE_VBN += fate-vbn-dxt5
 FATE_VBN += fate-vbn-raw-rgba
 FATE_VBN += fate-vbn-raw-rgb24
 
-tests/data/dxt1.vbn: TAG = GEN
-tests/data/dxt1.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i 
$(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt1 
$(TARGET_PATH)/$@ -y 2>/dev/null
-
-tests/data/dxt5.vbn: TAG = GEN
-tests/data/dxt5.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i 
$(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt5 
$(TARGET_PATH)/$@ -y 2>/dev/null
-
-tests/data/raw-rgba.vbn: TAG = GEN
-tests/data/raw-rgba.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i 
$(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format raw 
$(TARGET_PATH)/$@ -y 2>/dev/null
-
-tests/data/raw-rgb24.vbn: TAG = GEN
-tests/data/raw-rgb24.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i 
$(TARGET_SAMPLES)/png1/lena-rgb24.png -nostdin -c:v vbn -format raw 
$(TARGET_PATH)/$@ -y 2>/dev/null
-
 FATE_VBN-$(call ENCDEC2, VBN, WRAPPED_AVFRAME PNG, IMAGE2,\
  PSNR_FILTER METADATA_FILTER SCALE_FILTER \
  NULL_MUXER PIPE_PROTOCOL) += $(FATE_VBN)
-- 
2.32.0

___
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 07/13] fate/vpx: Remove unnecessary eval

2022-04-28 Thread Andreas Rheinhardt
Possible since ca96e337169093979d7c763064ad9dae12b3108c
and ef8c93e2f18c624d0c266687e43ab99af7921dd3.

Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/vpx.mak | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 990d4e5adb..a59971b092 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -85,26 +85,22 @@ fate-vp7: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp7/potter-40.vp7
 VP8_SUITE = 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017
 
 define FATE_VP8_SUITE
-FATE_VP8-$(call DEMDEC, IVF, VP8) += fate-vp8-test-vector$(2)-$(1)
-fate-vp8-test-vector$(2)-$(1): CMD = framemd5 $(3) -i 
$(TARGET_SAMPLES)/vp8-test-vectors-r1/vp80-00-comprehensive-$(1).ivf
-fate-vp8-test-vector$(2)-$(1): REF = 
$(SRC_PATH)/tests/ref/fate/vp8-test-vector-$(1)
+FATE_VP8-$(call DEMDEC, IVF, VP8) += fate-vp8-test-vector-$(1)
+fate-vp8-test-vector-$(1): CMD = framemd5 -i 
$(TARGET_SAMPLES)/vp8-test-vectors-r1/vp80-00-comprehensive-$(1).ivf
+fate-vp8-test-vector-$(1): REF = 
$(SRC_PATH)/tests/ref/fate/vp8-test-vector-$(1)
 endef
 
-define FATE_VP8_FULL
-$(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N),$(1),$(2
+$(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N
 
 # FIXME this file contains two frames with identical timestamps,
 # so ffmpeg drops one of them
-FATE_VP8-$(call DEMDEC, IVF, VP8) += fate-vp8-sign-bias$(1)
-fate-vp8-sign-bias$(1): CMD = framemd5 $(2) -i 
$(TARGET_SAMPLES)/vp8/sintel-signbias.ivf
-fate-vp8-sign-bias$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-sign-bias
+FATE_VP8-$(call DEMDEC, IVF, VP8) += fate-vp8-sign-bias
+fate-vp8-sign-bias: CMD = framemd5 -i $(TARGET_SAMPLES)/vp8/sintel-signbias.ivf
+fate-vp8-sign-bias: REF = $(SRC_PATH)/tests/ref/fate/vp8-sign-bias
 
-FATE_VP8-$(call DEMDEC, MATROSKA, VP8) += fate-vp8-size-change$(1)
-fate-vp8-size-change$(1): CMD = framemd5 $(2) -flags +bitexact -i 
$(TARGET_SAMPLES)/vp8/frame_size_change.webm -frames:v 30 -sws_flags 
bitexact+bilinear
-fate-vp8-size-change$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-size-change
-endef
-
-$(eval $(call FATE_VP8_FULL))
+FATE_VP8-$(call DEMDEC, MATROSKA, VP8) += fate-vp8-size-change
+fate-vp8-size-change: CMD = framemd5 -flags +bitexact -i 
$(TARGET_SAMPLES)/vp8/frame_size_change.webm -frames:v 30 -sws_flags 
bitexact+bilinear
+fate-vp8-size-change: REF = $(SRC_PATH)/tests/ref/fate/vp8-size-change
 
 FATE_SAMPLES_AVCONV += $(FATE_VP8-yes)
 fate-vp8: $(FATE_VP8-yes)
@@ -131,7 +127,6 @@ VP9_SIZE_B = 196 198 200 202 208 210 224 226
 VP9_CHROMA_SUBSAMPLE = 422 440 444
 VP9_HIGH_BITDEPTH = 10 12
 
-define FATE_VP9_FULL
 $(foreach Q,$(VP9_Q),$(eval $(call FATE_VP9_SUITE,00-quantizer-$(Q
 $(foreach SHARP,$(VP9_SHARP),$(eval $(call 
FATE_VP9_SUITE,01-sharpness-$(SHARP
 $(foreach W,$(VP9_SIZE_A),$(eval $(foreach H,$(VP9_SIZE_A),$(eval $(call 
FATE_VP9_SUITE,02-size-$(W)x$(H))
@@ -153,9 +148,7 @@ $(eval $(call FATE_VP9_SUITE,segmentation-sf-akiyo))
 $(eval $(call FATE_VP9_SUITE,tiling-pedestrian))
 $(eval $(call FATE_VP9_SUITE,trac3849))
 $(eval $(call FATE_VP9_SUITE,trac4359))
-endef
 
-$(eval $(call FATE_VP9_FULL))
 FATE_VP9-$(CONFIG_IVF_DEMUXER) += fate-vp9-05-resize
 fate-vp9-05-resize: CMD = framemd5 -i 
$(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-05-resize.ivf -s 352x288 -sws_flags 
bitexact+bilinear
 fate-vp9-05-resize: REF = $(SRC_PATH)/tests/ref/fate/vp9-05-resize
-- 
2.32.0

___
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 08/13] tests/Makefile: Add FRAMEMD5 auxiliary function

2022-04-28 Thread Andreas Rheinhardt
Similar to FRAMECRC for framecrc tests.

Signed-off-by: Andreas Rheinhardt 
---
 tests/Makefile | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/Makefile b/tests/Makefile
index 6e8fc5906e..b4252a991b 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -88,6 +88,10 @@ REMUX = $(call ALLYES, $(firstword $(1))_MUXER $(lastword 
$(1))_DEMUXER \
 
 DEMDEC  = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER) $(3) FILE_PROTOCOL)
 ENCMUX  = $(call ALLYES, $(1:%=%_ENCODER) $(2)_MUXER   $(3))
+
+FRAMEMD5 = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER) $(3)  \
+  PCM_S16LE_ENCODER RAWVIDEO_ENCODER FRAMEMD5_MUXER   \
+  PIPE_PROTOCOL FILE_PROTOCOL)
 FRAMECRC = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER) $(3)  \
   PCM_S16LE_ENCODER RAWVIDEO_ENCODER FRAMECRC_MUXER   \
   PIPE_PROTOCOL FILE_PROTOCOL)
-- 
2.32.0

___
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 09/13] fate/vpx: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/Makefile |  2 +-
 tests/fate/vpx.mak | 68 --
 2 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index b4252a991b..5de9ad4c9f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -245,7 +245,7 @@ $(FATE_FFMPEG) $(FATE_FFMPEG_FFPROBE) 
$(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMP
 $(FATE_FFPROBE) $(FATE_FFMPEG_FFPROBE) $(FATE_SAMPLES_FFPROBE) 
$(FATE_SAMPLES_FFMPEG_FFPROBE): ffprobe$(PROGSSUF)$(EXESUF)
 
 $(FATE_SAMPLES_FASTSTART): tools/qt-faststart$(EXESUF)
-$(FATE_SAMPLES_DUMP_DATA): tools/venc_data_dump$(EXESUF)
+$(FATE_SAMPLES_DUMP_DATA) $(FATE_SAMPLES_DUMP_DATA-yes): 
tools/venc_data_dump$(EXESUF)
 $(FATE_SAMPLES_SCALE_SLICE): tools/scale_slice_test$(EXESUF)
 
 ifdef SAMPLES
diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index a59971b092..dc8e9e04b7 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -4,10 +4,10 @@ fate-truemotion1-15: CMD = framecrc -i 
$(TARGET_SAMPLES)/duck/phant2-940.duk -pi
 FATE_TRUEMOTION1 += fate-truemotion1-24
 fate-truemotion1-24: CMD = framecrc -i 
$(TARGET_SAMPLES)/duck/sonic3dblast_intro-partial.avi -pix_fmt rgb24 -an -vf 
scale
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TRUEMOTION1) += $(FATE_TRUEMOTION1)
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, AVI, TRUEMOTION1, SCALE_FILTER) += 
$(FATE_TRUEMOTION1)
 fate-truemotion1: $(FATE_TRUEMOTION1)
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TRUEMOTION2) += fate-truemotion2
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, AVI, TRUEMOTION2) += fate-truemotion2
 fate-truemotion2: CMD = framecrc -i $(TARGET_SAMPLES)/duck/tm20.avi
 
 FATE_TRUEMOTION2RT += fate-truemotion2rt-low
@@ -19,73 +19,75 @@ fate-truemotion2rt-mid: CMD = framecrc -i 
$(TARGET_SAMPLES)/duck/tr20_mid.avi -a
 FATE_TRUEMOTION2RT += fate-truemotion2rt-high
 fate-truemotion2rt-high: CMD = framecrc -i 
$(TARGET_SAMPLES)/duck/tr20_high.avi -an
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TRUEMOTION2RT) += $(FATE_TRUEMOTION2RT)
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, AVI, TRUEMOTION2RT) += 
$(FATE_TRUEMOTION2RT)
 fate-truemotion2rt: $(FATE_TRUEMOTION2RT)
 
-FATE_VP3-$(call DEMDEC, MATROSKA, THEORA) += fate-theora-coeff-level64
+FATE_VP3-$(call FRAMECRC, MATROSKA, THEORA) += fate-theora-coeff-level64
 fate-theora-coeff-level64: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp3/coeff_level64.mkv
 
-FATE_VP3-$(call DEMDEC, OGG, THEORA) += fate-theora-offset
+FATE_VP3-$(call FRAMECRC, OGG, THEORA) += fate-theora-offset
 fate-theora-offset: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp3/offset_test.ogv
 
-FATE_VP3-$(call DEMDEC, AVI, VP3) += fate-vp31
+FATE_VP3-$(call FRAMECRC, AVI, VP3) += fate-vp31
 fate-vp31: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/vp3/vp31.avi
 
 FATE_SAMPLES_AVCONV += $(FATE_VP3-yes)
 fate-vp3: $(FATE_VP3-yes)
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP4) += fate-vp4
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, AVI, VP4) += fate-vp4
 fate-vp4: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp4/KTkvw8dg1J8.avi
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP5) += fate-vp5
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, AVI, VP5) += fate-vp5
 fate-vp5: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp5/potter512-400-partial.avi -an
 
-FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp60
+FATE_VP6-$(call FRAMECRC, EA, VP6) += fate-vp60
 fate-vp60: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/ea-vp6/g36.vp6
 
-FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp61
+FATE_VP6-$(call FRAMECRC, EA, VP6) += fate-vp61
 fate-vp61: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/ea-vp6/MovieSkirmishGondor.vp6 -t 4
 
-FATE_VP6-$(call DEMDEC, MOV, VP6A) += fate-vp6a
+FATE_VP6-$(call FRAMECRC, MOV, VP6A) += fate-vp6a
 fate-vp6a: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.mov
 
-FATE_VP6-$(call DEMDEC, MOV, VP6A) += fate-vp6a-skip_alpha
+FATE_VP6-$(call FRAMECRC, MOV, VP6A) += fate-vp6a-skip_alpha
 fate-vp6a-skip_alpha: CMD = framecrc -flags +bitexact -skip_alpha 1 -i 
$(TARGET_SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.mov
 
-FATE_VP6-$(call DEMDEC, FLV, VP6F) += fate-vp6f
+FATE_VP6-$(call FRAMECRC, FLV, VP6F) += fate-vp6f
 fate-vp6f: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/flash-vp6/clip1024.flv
 
-FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest
+FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest
 fate-webm-dash-manifest: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f 
webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" -
 
-FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += 
fate-webm-dash-manifest-unaligned-video-streams
+FATE_WEBM_DAS

[FFmpeg-devel] [PATCH 10/13] fate/vpx: Move webm-dash-manifest tests to a new file

2022-04-28 Thread Andreas Rheinhardt
These tests have basically nothing to do with VPX (they do not even
require the decoder).

Signed-off-by: Andreas Rheinhardt 
---
 tests/Makefile|  1 +
 tests/fate/vpx.mak| 20 
 tests/fate/webm-dash-manifest.mak | 21 +
 3 files changed, 22 insertions(+), 20 deletions(-)
 create mode 100644 tests/fate/webm-dash-manifest.mak

diff --git a/tests/Makefile b/tests/Makefile
index 5de9ad4c9f..ea5e939cf5 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -219,6 +219,7 @@ include $(SRC_PATH)/tests/fate/vorbis.mak
 include $(SRC_PATH)/tests/fate/vpx.mak
 include $(SRC_PATH)/tests/fate/vqf.mak
 include $(SRC_PATH)/tests/fate/wavpack.mak
+include $(SRC_PATH)/tests/fate/webm-dash-manifest.mak
 include $(SRC_PATH)/tests/fate/wma.mak
 include $(SRC_PATH)/tests/fate/xvid.mak
 
diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index dc8e9e04b7..a5c7ab0365 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -55,26 +55,6 @@ fate-vp6a-skip_alpha: CMD = framecrc -flags +bitexact 
-skip_alpha 1 -i $(TARGET_
 FATE_VP6-$(call FRAMECRC, FLV, VP6F) += fate-vp6f
 fate-vp6f: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/flash-vp6/clip1024.flv
 
-FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest
-fate-webm-dash-manifest: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f 
webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" -
-
-FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest-unaligned-video-streams
-fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -nostdin 
-f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video3.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
-
-FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest-unaligned-audio-streams
-fate-webm-dash-manifest-unaligned-audio-streams: CMD = run $(FFMPEG) -nostdin 
-f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio3.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
-
-FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest-representations
-fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
-
-FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest-live
-fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c 
copy -map 0 -map 1 -fflags +bitexact -f webm_dash_manifest -live 1 
-adaptation_sets "id=0,streams=0 id=1,streams=1" -chunk_start_index 1 
-chunk_duration_ms 5000 -time_shift_buffer_depth 7200 -minimum_update_period 60 
-
-
-FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest-live-bandwidth
-fate-webm-dash-manifest-live-bandwidth: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -bandwidth 100 -i 
$(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 
-bandwidth 200 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 
-map 1 -fflags +bitexact -f webm_dash_manifest -live 1 -adaptation_sets 
"id=0,streams=0 id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 
-time_shift_buffer_depth 7200 -minimum_update_period 60 -
-
-FATE_VP8-$(call DEMMUX, WEBM_DASH_MANIFEST, WEBM_DASH_MANIFEST, PIPE_PROTOCOL) 
+= $(FATE_WEBM_DASH_MANIFEST)
-
 FATE_VP8-$(call FRAMECRC, MATROSKA, VP8) += fate-vp8-2451
 fate-vp8-2451: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp8/RRSF49-short.webm -vsync cfr -an
 
diff --git a/tests/fate/webm-dash-manifest.mak 
b/tests/fate/webm-dash-manifest.mak
new file mode 100644
index 00..664bb1
--- /dev/null
+++ b/tests/fate/webm-dash-manifest.mak
@@ -0,0 +1,21 @@
+FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest
+fate-webm-dash-manifest: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f 
webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" -
+
+FATE_WEBM_DASH_MANIFEST += fate-webm-dash-manifest-unaligned-video-streams
+fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -nostdin 
-f web

[FFmpeg-devel] [PATCH 11/13] fate/prores: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/prores.mak | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fate/prores.mak b/tests/fate/prores.mak
index f2c11259dd..9e05b33b9f 100644
--- a/tests/fate/prores.mak
+++ b/tests/fate/prores.mak
@@ -6,9 +6,9 @@ FATE_PRORES = fate-prores-422   
\
   fate-prores-alpha_skip\
   fate-prores-transparency  \
   fate-prores-transparency_skip \
-  fate-prores-gray  \
+  $(if $(CONFIG_ARESAMPLE_FILTER),fate-prores-gray) \
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PRORES) += $(FATE_PRORES)
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MOV, PRORES, SCALE_FILTER) += 
$(FATE_PRORES)
 fate-prores: $(FATE_PRORES)
 
 fate-prores-422:   CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422.mov -pix_fmt yuv422p10le 
-vf scale
@@ -25,4 +25,4 @@ fate-prores-gray:  CMD = framecrc -flags +bitexact -c:a 
aac_fixed -i $(TARGE
 FATE_PRORES_METADATA_BSF += fate-prores-metadata
 fate-prores-metadata: CMD = md5 -i 
$(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -c:v copy -bsf:v 
prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m 
-bitexact -f mov
 
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PRORES_METADATA_BSF) += 
$(FATE_PRORES_METADATA_BSF)
+FATE_SAMPLES_FFMPEG-$(call DEMMUX, MOV, MOV, PRORES_METADATA_BSF) += 
$(FATE_PRORES_METADATA_BSF)
-- 
2.32.0

___
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 12/13] fate/gif: Fix test requirements

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/gif.mak | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/fate/gif.mak b/tests/fate/gif.mak
index a5147c0e38..bf604464aa 100644
--- a/tests/fate/gif.mak
+++ b/tests/fate/gif.mak
@@ -13,18 +13,17 @@ fate-gif-gray: CMD = framecrc -i 
$(TARGET_SAMPLES)/gif/Newtons_cradle_animation_
 FATE_GIF += fate-gif-deal
 fate-gif-deal: CMD = framecrc -i $(TARGET_SAMPLES)/gif/deal.gif -vsync cfr 
-pix_fmt bgra -auto_conversion_filters
 
+FATE_GIF-$(call FRAMECRC, GIF, GIF, SCALE_FILTER) += $(FATE_GIF)
+
 fate-gifenc%: fate-gif-color
 fate-gifenc%: PIXFMT = $(word 3, $(subst -, ,$(@)))
 fate-gifenc%: SRC = $(TARGET_SAMPLES)/gif/tc217.gif
 fate-gifenc%: CMD = framecrc -i $(SRC) -c:v gif -pix_fmt $(PIXFMT) -sws_flags 
+accurate_rnd+bitexact -vf scale
 
 FATE_GIF_ENC_PIXFMT = rgb8 bgr8 rgb4_byte bgr4_byte gray pal8
-FATE_GIF_ENC-$(call ENCDEC, GIF, GIF) = $(FATE_GIF_ENC_PIXFMT:%=fate-gifenc-%)
+FATE_GIF_ENC-$(call ENCDEC, GIF, FRAMECRC GIF, SCALE_FILTER PIPE_PROTOCOL) = 
$(FATE_GIF_ENC_PIXFMT:%=fate-gifenc-%)
 
-FATE_GIF += $(FATE_GIF_ENC-yes)
 fate-gifenc: $(FATE_GIF_ENC-yes)
 
-FATE_GIF-$(call DEMDEC, GIF, GIF) += $(FATE_GIF)
-
-FATE_SAMPLES_AVCONV += $(FATE_GIF-yes)
-fate-gif: $(FATE_GIF-yes)
+FATE_SAMPLES_FFMPEG += $(FATE_GIF-yes) $(FATE_GIF_ENC-yes)
+fate-gif: $(FATE_GIF-yes) $(FATE_GIF_ENC-yes)
-- 
2.32.0

___
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 13/13] fate/gif: Remove nonsense requirement

2022-04-28 Thread Andreas Rheinhardt
It seems as if it was intended to declare fate-gif-color as prerequisite
of the fate-gifenc% tests. Yet the latter do not need anything from
the former, so this would be unnecessary. Furthermore, given that this
line has no associated recipe, it actually cancels implicit rules for
fate-gifenc% instead of adding a prerequisite.

Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/gif.mak | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/fate/gif.mak b/tests/fate/gif.mak
index bf604464aa..1eef2a1026 100644
--- a/tests/fate/gif.mak
+++ b/tests/fate/gif.mak
@@ -15,7 +15,6 @@ fate-gif-deal: CMD = framecrc -i 
$(TARGET_SAMPLES)/gif/deal.gif -vsync cfr -pix_
 
 FATE_GIF-$(call FRAMECRC, GIF, GIF, SCALE_FILTER) += $(FATE_GIF)
 
-fate-gifenc%: fate-gif-color
 fate-gifenc%: PIXFMT = $(word 3, $(subst -, ,$(@)))
 fate-gifenc%: SRC = $(TARGET_SAMPLES)/gif/tc217.gif
 fate-gifenc%: CMD = framecrc -i $(SRC) -c:v gif -pix_fmt $(PIXFMT) -sws_flags 
+accurate_rnd+bitexact -vf scale
-- 
2.32.0

___
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] avformat/avio: use av_match_name to match protocol lists

2022-04-28 Thread Leo Izen



On 4/28/22 16:28, Michael Niedermayer wrote:

On Thu, Apr 28, 2022 at 08:43:21AM -0400, Leo Izen wrote:

On 4/20/22 16:33, Leo Izen wrote:

This swaps av_match_list to av_match_name inside ffurl_connect,
which allows ALL to be treated as a valid value on the whitelist
or blacklist in accordance with the behavior described in the
documentation.
---
   libavformat/avio.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)


protocol whitelist documents ALL
protocol blacklist is undocumented
codec whitelist does not document ALL
format whitelist does not document ALL

This patch only affects the protocol list, and I could change it so it 
only affects the whitelist, not the blacklist. Thoughts?


-Leo Izen (thebombzen)


___
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 1/4] avfilter/vf_colormap: Properly uninit FFFrameSync, fix leak

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_colormap.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/vf_colormap.c b/libavfilter/vf_colormap.c
index 1e82514ade..9edc89f105 100644
--- a/libavfilter/vf_colormap.c
+++ b/libavfilter/vf_colormap.c
@@ -537,6 +537,13 @@ static int activate(AVFilterContext *ctx)
 return ff_framesync_activate(&s->fs);
 }
 
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ColorMapContext *const s = ctx->priv;
+
+ff_framesync_uninit(&s->fs);
+}
+
 static const AVFilterPad inputs[] = {
 {
 .name = "default",
@@ -574,4 +581,5 @@ const AVFilter ff_vf_colormap = {
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
  AVFILTER_FLAG_SLICE_THREADS,
 .process_command = ff_filter_process_command,
+.uninit= uninit,
 };
-- 
2.32.0

___
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 2/4] avfilter/vf_colormap: Fix declaration-after-statement

2022-04-28 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_colormap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavfilter/vf_colormap.c b/libavfilter/vf_colormap.c
index 9edc89f105..a0d6d7be27 100644
--- a/libavfilter/vf_colormap.c
+++ b/libavfilter/vf_colormap.c
@@ -129,8 +129,7 @@ static void gauss_solve_triangular(const double *A, const 
int *p, double *b, int
 }
 
 for(int k = n - 1; k > 0; k--) {
-b[k] /= A[k + n * k];
-double t = b[k];
+double t = b[k] /= A[k + n * k];
 for (int i = 0; i < k; i++)
 b[i] -= A[k + n * i] * t;
 }
-- 
2.32.0

___
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 3/4] avfilter/vf_colormap: Remove unnecessary headers

2022-04-28 Thread Andreas Rheinhardt
In particular remove config_components.h in order to avoid unnecessary
rebuilds.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_colormap.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavfilter/vf_colormap.c b/libavfilter/vf_colormap.c
index a0d6d7be27..d5c5bec39c 100644
--- a/libavfilter/vf_colormap.c
+++ b/libavfilter/vf_colormap.c
@@ -23,15 +23,10 @@
  * Compute a look-up table from map of colors.
  */
 
-#include "config_components.h"
-
 #include "libavutil/attributes.h"
-#include "libavutil/avstring.h"
 #include "libavutil/common.h"
 #include "libavutil/opt.h"
-#include "libavutil/pixdesc.h"
 #include "avfilter.h"
-#include "formats.h"
 #include "internal.h"
 #include "framesync.h"
 #include "video.h"
-- 
2.32.0

___
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 4/4] avfilter/vf_colormap: Avoid allocation of small array

2022-04-28 Thread Andreas Rheinhardt
The number of elements is always two or three.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_colormap.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_colormap.c b/libavfilter/vf_colormap.c
index d5c5bec39c..106333ced8 100644
--- a/libavfilter/vf_colormap.c
+++ b/libavfilter/vf_colormap.c
@@ -24,6 +24,7 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/opt.h"
 #include "avfilter.h"
@@ -134,20 +135,15 @@ static void gauss_solve_triangular(const double *A, const 
int *p, double *b, int
 
 static int gauss_solve(double *A, double *b, int n)
 {
-int *p = av_calloc(n, sizeof(*p));
+int p[3] = { 0 };
 
-if (!p)
-return 1;
+av_assert2(n <= FF_ARRAY_ELEMS(p));
 
-if (!gauss_make_triangular(A, p, n)) {
-av_freep(&p);
+if (!gauss_make_triangular(A, p, n))
 return 1;
-}
 
 gauss_solve_triangular(A, p, b, n);
 
-av_freep(&p);
-
 return 0;
 }
 
-- 
2.32.0

___
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] Fix AVX-512-VNNI_hevc_qpel_filters_avx512icl

2022-04-28 Thread Wu Jianhua
> Felix LeClair:
> Sent: 2022年4月29日 1:17
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH] Fix AVX-512-VNNI_hevc_qpel_filters_avx512icl
>
> This commit fixes the above by swapping lines 1796 and 1795, moving the
> define out of the conditional
>
> subsrcq, tmpq
>  sub myq, 1
>  shl myq, 5
> -%ifdef PIC
>  %define %%table hevc_qpel_filters_avx512icl_v_%1
>+%ifdef PIC
>  lea tmpq, [%%table]
> %define FILTER tmpq
> %else
>--

LGTM. Thanks for the fix!

Best regards,
Jianhua



___
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 v5 1/2] lavc/vaapi_encode: add support for maxframesize

2022-04-28 Thread Xiang, Haihao
On Fri, 2022-04-22 at 13:36 +0800, Fei Wang wrote:
> From: Linjie Fu 
> 
> Add support for max frame size:
> - max_frame_size (bytes) to indicate the max allowed size for frame.
> 
> If the frame size exceeds the limitation, encoder will to control the frame
> size by adjusting QP value.
> 
> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \
> -v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \
> -c:v h264_vaapi -profile:v main -g 30 -rc_mode VBR -b:v 500k   \
> -bf 3 -max_frame_size 4 -vframes 100 -y ./max_frame_size.h264
> 
> Max frame size was enabled since VA-API version (0, 33, 0), but query is
> available
> since (1, 5, 0). It will be passed as a parameter in picParam and should be
> set
> for each frame.
> 
> Signed-off-by: Linjie Fu 
> Signed-off-by: Fei Wang 
> ---
> Change:
> 1. use VAEncMiscParameterTypeMaxFrameSize to set max frame  parameters,
> which is a more generic way.
> 
>  libavcodec/vaapi_encode.c | 65 +++
>  libavcodec/vaapi_encode.h | 10 +-
>  2 files changed, 74 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 0e2f5ed447..c2a39bc4ed 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -365,6 +365,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
>  goto fail;
>  }
>  
> +#if VA_CHECK_VERSION(1, 5, 0)
> +if (ctx->max_frame_size) {
> +err = vaapi_encode_make_misc_param_buffer(avctx, pic,
> +  VAEncMiscParameterTypeMaxFr
> ameSize,
> +  &ctx->mfs_params,
> +  sizeof(ctx->mfs_params));
> +if (err < 0)
> +goto fail;
> +}
> +#endif
> +
>  if (pic->type == PICTURE_TYPE_IDR) {
>  if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE &&
>  ctx->codec->write_sequence_header) {
> @@ -1869,6 +1880,54 @@ rc_mode_found:
>  return 0;
>  }
>  
> +static av_cold int vaapi_encode_init_max_frame_size(AVCodecContext *avctx)
> +{
> +#if VA_CHECK_VERSION(1, 5, 0)
> +VAAPIEncodeContext  *ctx = avctx->priv_data;
> +VAConfigAttrib  attr = { VAConfigAttribMaxFrameSize };
> +VAStatus vas;
> +
> +vas = vaGetConfigAttributes(ctx->hwctx->display,
> +ctx->va_profile,
> +ctx->va_entrypoint,
> +&attr, 1);
> +if (vas != VA_STATUS_SUCCESS) {
> +ctx->max_frame_size = 0;
> +av_log(avctx, AV_LOG_ERROR, "Failed to query max frame size "
> +   "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
> +return AVERROR_EXTERNAL;
> +}
> +
> +if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
> +ctx->max_frame_size = 0;
> +av_log(avctx, AV_LOG_WARNING, "Max frame size attribute "
> +   "is not supported.\n");
> +} else {
> +VAConfigAttribValMaxFrameSize attr_mfs;
> +attr_mfs.value = attr.value;
> +// Prefer to use VAEncMiscParameterTypeMaxFrameSize for max frame
> size.
> +if (!attr_mfs.bits.max_frame_size && attr_mfs.bits.multiple_pass) {
> +ctx->max_frame_size = 0;
> +av_log(avctx, AV_LOG_WARNING, "Driver only support multiple pass
> "
> +   "max frame size which have not been implemented in
> FFmpeg.\n");
> +return 0;
> +}
> +
> +ctx->mfs_params = (VAEncMiscParameterBufferMaxFrameSize){
> +.max_frame_size = ctx->max_frame_size * 8,
> +};
> +
> +av_log(avctx, AV_LOG_VERBOSE, "Max Frame Size: %d bytes.\n",
> +   ctx->max_frame_size);
> +}
> +#else
> +av_log(avctx, AV_LOG_WARNING, "Max Frame Size is not support with "
> +   "this VA version.\n");
> +#endif
> +
> +return 0;
> +}
> +
>  static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx)
>  {
>  VAAPIEncodeContext *ctx = avctx->priv_data;
> @@ -2548,6 +2607,12 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
>  goto fail;
>  }
>  
> +if (ctx->va_rc_mode != VA_RC_CQP && ctx->max_frame_size) {
> +err = vaapi_encode_init_max_frame_size(avctx);
> +if (err < 0)
> +goto fail;
> +}

Set ctx->max_frame_size to 0 for CQP, otherwise
VAEncMiscParameterTypeMaxFrameSize will be passed to the underlying driver for
CQP when ctx->max_frame_size is non-zero. 

Thanks
Haihao

> +
>  vas = vaCreateConfig(ctx->hwctx->display,
>   ctx->va_profile, ctx->va_entrypoint,
>   ctx->config_attributes, ctx->nb_config_attributes,
> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> index af0588c30b..359f954fff 100644
> --- a/libavcodec/vaapi_encode.h
> +++ b/libavcodec/vaapi_encode.h
> @@