[FFmpeg-devel] [PATCH v2] avfilter/vf_blend_vulkan: add more blend modes
From: Wu Jianhua This commit includes addition, average, subtract, negation, extremity, difference, darken, lighten, exclusion and phoenix blend modes. Use the commands below to test: (href: https://trac.ffmpeg.org/wiki/Blend) I. make an image for test ffmpeg -f lavfi -i color=s=256x256,geq=r='H-1-Y':g='H-1-Y':b='H-1-Y' -frames 1 \ -y -pix_fmt yuv420p test.jpg II. blend in sw ffmpeg -i test.jpg -vf "split[a][b];[b]transpose[b];[a][b]blend=all_mode=addition,\ pseudocolor=preset=turbo" -y addition_sw.jpg III. blend in vulkan ffmpeg -init_hw_device vulkan -i test.jpg -vf "split[a][b];[b]transpose[b];\ [a]hwupload[a];[b]hwupload[b];[a][b]blend_vulkan=all_mode=addition,hwdownload,\ format=yuv420p,pseudocolor=preset=turbo" -y addition_vulkan.jpg Signed-off-by: Wu Jianhua --- libavfilter/vf_blend_vulkan.c | 47 --- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c index fcc21cbc8d..264fe703b2 100644 --- a/libavfilter/vf_blend_vulkan.c +++ b/libavfilter/vf_blend_vulkan.c @@ -68,10 +68,31 @@ static const char blend_##MODE##_func[] = { \ #define A top #define B bottom +#define MAX vec4(1.0) +#define HALF vec4(0.5) +#define MIN vec4(0.0) + +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + #define FN(EXPR) A + ((EXPR) - A) * opacity DEFINE_BLEND_MODE(NORMAL, A * opacity + B * (1.0f - opacity)) -DEFINE_BLEND_MODE(MULTIPLY, FN(1.0f * A * B / 1.0f)) +DEFINE_BLEND_MODE(ADDITION, FN(min(MAX, A + B))) +DEFINE_BLEND_MODE(AVERAGE,FN((A + B) * HALF)) +DEFINE_BLEND_MODE(SUBTRACT, FN(max(MIN, A - B))) +DEFINE_BLEND_MODE(MULTIPLY, FN(1.0f * A * B / 1.0f)) +DEFINE_BLEND_MODE(NEGATION, FN(MAX - abs(MAX - A - B))) +DEFINE_BLEND_MODE(EXTREMITY, FN(abs(MAX - A - B))) +DEFINE_BLEND_MODE(DIFFERENCE, FN(abs(A - B))) +DEFINE_BLEND_MODE(DARKEN, FN(min(A, B))) +DEFINE_BLEND_MODE(LIGHTEN,FN(max(A, B))) +DEFINE_BLEND_MODE(EXCLUSION, FN(A + B - 2 * A * B / MAX)) +DEFINE_BLEND_MODE(PHOENIX,FN(min(A, B) - max(A, B) + MAX)) static inline void init_blend_func(FilterParamsVulkan *param) { @@ -81,8 +102,18 @@ static inline void init_blend_func(FilterParamsVulkan *param) break; switch (param->mode) { +CASE(ADDITION) +CASE(AVERAGE) +CASE(SUBTRACT) CASE(NORMAL) CASE(MULTIPLY) +CASE(NEGATION) +CASE(EXTREMITY) +CASE(DIFFERENCE) +CASE(DARKEN) +CASE(LIGHTEN) +CASE(EXCLUSION) +CASE(PHOENIX) default: param->blend = NULL; break; } @@ -452,8 +483,18 @@ static const AVOption blend_vulkan_options[] = { { "c2_mode", "set component #2 blend mode", OFFSET(params[2].mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, "mode" }, { "c3_mode", "set component #3 blend mode", OFFSET(params[3].mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, "mode" }, { "all_mode", "set blend mode for all components", OFFSET(all_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, BLEND_NB - 1, FLAGS, "mode" }, -{ "normal", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_NORMAL }, 0, 0, FLAGS, "mode" }, -{ "multiply", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_MULTIPLY }, 0, 0, FLAGS, "mode" }, +{ "addition", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_ADDITION }, 0, 0, FLAGS, "mode" }, +{ "average","", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_AVERAGE}, 0, 0, FLAGS, "mode" }, +{ "subtract", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_SUBTRACT }, 0, 0, FLAGS, "mode" }, +{ "normal", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_NORMAL }, 0, 0, FLAGS, "mode" }, +{ "multiply", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_MULTIPLY }, 0, 0, FLAGS, "mode" }, +{ "negation", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_NEGATION }, 0, 0, FLAGS, "mode" }, +{ "extremity", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_EXTREMITY }, 0, 0, FLAGS, "mode" }, +{ "difference", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_DIFFERENCE }, 0, 0, FLAGS, "mode" }, +{ "darken", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_DARKEN }, 0, 0, FLAGS, "mode" }, +{ "lighten","", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_LIGHTEN}, 0, 0, FLAGS, "mode" }, +{ "exclusion", "", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_EXCLUSION }, 0, 0, FLAGS, "mode" }, +{ "phoenix","", 0, AV_OPT_TYPE_CONST, { .i64 = BLEND_PHOENIX}, 0, 0, FLAGS, "mode" }, { "c0_opacity", "set color component #0 opacity", OFFSET(params[0].opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS }, { "c1_opacity", "set color component #1 opacity", OFFSET(params[1].opacity), AV_OPT_TYPE_DOUBLE, { .dbl = 1 }, 0, 1, FLAGS }, -- 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-re
[FFmpeg-devel] [PATCH v7 00/10] make QSV works with the Intel's oneVPL
From: 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 v7: - Changed the required minimal oneVPL version from 2.2 to 2.6 - Added support for multiple GPUs on Linux - Rebased this patchset against the latest master and fixed bugs [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| 13 + libavutil/hwcontext_d3d11va.h| 5 + libavutil/hwcontext_dxva2.c | 8 + libavutil/hwcontext_dxva2.h | 4 + libavutil/hwcontext_opencl.c | 2 +- libavutil/hwcontext_qsv.c| 444 +++ libavutil/hwcontext_qsv.h| 3 +- libavutil/hwcontext_vaapi.c | 13 + libavutil/hwcontext_vaapi.h | 4 + 25 files changed, 956 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 v7 01/10] configure: ensure --enable-libmfx uses libmfx 1.x
From: 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 7d22c2a345..f3c60d9e40 100755 --- a/configure +++ b/configure @@ -6548,8 +6548,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 v7 02/10] configure: fix the check for MFX_CODEC_VP9
From: 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 f3c60d9e40..31d4f4928b 100755 --- a/configure +++ b/configure @@ -6554,7 +6554,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 v7 03/10] qsv: remove mfx/ prefix from mfx headers
From: 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 31d4f4928b..eacdf03c18 100755 --- a/configure +++ b/configure @@ -6548,13 +6548,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 67d0e3934a..f749e77d3a 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 58186ea7ca..09fc76f6c4 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 6236391357..1a492da74b 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include "libavutil/common.h" #include "libavutil/fifo.h" diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 9b71487666..0170ae14
[FFmpeg-devel] [PATCH v7 04/10] qsv: load user plugin for MFX_VERSION < 2.0
From: 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 f749e77d3a..0eb0d83ac0 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) { @@ -307,6 +311,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; @@ -350,6 +355,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 09fc76f6c4..6d6a6eb239 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 v7 07/10] qsvenc: support MFX_RATECONTROL_LA_EXT when MFX_VERSION < 2.0
From: 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 0170ae14e4..47009c3bf2 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -151,7 +151,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 v7 05/10] qsv: build audio related code when MFX_VERSION < 2.0
From: 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 0eb0d83ac0..063d6dfb0a 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 v7 06/10] qsvenc: support multi-frame encode when MFX_VERSION < 2.0
From: 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 559d7cbe3e..43437c6992 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 v7 08/10] qsv: support OPAQUE memory when MFX_VERSION < 2.0
From: 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 063d6dfb0a..c708964c80 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 6d6a6eb239..c788293286 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 1a492da74b..391e5d1c72 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -178,7 +178,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); @@ -291,10 +295,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 47009c3bf2..adfaf5a280 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1256,6 +1256,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; @@ -1292,6 +1293,7 @@ static int qsv_init_opaque_alloc(AVCodecContext *avctx, QSVEncContext *q) return 0; } +#endif static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q) { @@ -1307,7 +1309,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_M
[FFmpeg-devel] [PATCH v7 09/10] qsv: use a new method to create mfx session when using oneVPL
From: Haihao Xiang In oneVPL, MFXLoad() and MFXCreateSession() are required to create a workable mfx session[1] Add AccelerationMode config filter 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 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| 13 ++ libavutil/hwcontext_d3d11va.h| 5 + libavutil/hwcontext_dxva2.c | 8 + libavutil/hwcontext_dxva2.h | 4 + libavutil/hwcontext_qsv.c| 386 +++ libavutil/hwcontext_qsv.h| 1 + libavutil/hwcontext_vaapi.c | 13 ++ libavutil/hwcontext_vaapi.h | 4 + 21 files changed, 706 insertions(+), 88 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index c708964c80..0a0a42932f 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) { @@ -403,6 +409,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); +
[FFmpeg-devel] [PATCH v7 10/10] configure: add --enable-libvpl option
From: 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 eacdf03c18..aea3ddda05 100755 --- a/configure +++ b/configure @@ -339,6 +339,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] @@ -1917,6 +1918,7 @@ HWACCEL_LIBRARY_NONFREE_LIST=" HWACCEL_LIBRARY_LIST=" $HWACCEL_LIBRARY_NONFREE_LIST libmfx +libvpl mmal omx opencl @@ -6542,22 +6544,35 @@ enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -li 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 supporte
Re: [FFmpeg-devel] [PATCH v6 00/10] make QSV works with the Intel's oneVPL
On Wed, 2021-10-20 at 06:53 +, Soft Works wrote: > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > Jean-Baptiste Kempf > > Sent: Wednesday, October 20, 2021 8:01 AM > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH v6 00/10] make QSV works with the > > Intel's oneVPL > > > > > > > > On Wed, 20 Oct 2021, at 01:00, Soft Works wrote: > > > > -Original Message- > > > > From: ffmpeg-devel On Behalf Of > > > > Jean-Baptiste Kempf > > > > Sent: Tuesday, October 19, 2021 11:19 PM > > > > To: ffmpeg-devel@ffmpeg.org > > > > Subject: Re: [FFmpeg-devel] [PATCH v6 00/10] make QSV works with > > > > the > > > > Intel's oneVPL > > > > > > > > Hello, > > > > > > > > On Fri, 15 Oct 2021, at 22:23, Soft Works wrote: > > > > > I really appreciate all the effort that Intel is taking to > > > > improve > > > > > ffmppeg for QSV hw acceleration, but in this case I'm not > > > > convinced > > > > > that this should be merged into ffmpeg at this time. > > > > > > > > > > [...] > > > > > In its current state, oneVPL is all about removal of features > > > > that > > > > > have existed for a long time. > > > > > > > > > > In its current state, it does not provide a single benefit over > > > > > libmfx 1.x > > > > > > > > Indeed. > > > > But libmfx is not supported anymore by upstream, who's moving to > > > > oneVPL, aka mfx 2.0. > > Intel documents say otherwise: > > "Intel® Media SDK API is nearing its final update. Implementation updates, > such as security patches and critical bug fixes, will continue as needed." > > https://www.intel.com/content/www/us/en/develop/documentation/upgrading-from-msdk-to-onevpl/top/faq/how-long-will-intel-media-sdk-be-available.html > > "For currently available hardware, Intel® Media SDK and oneVPL provide the > same access. Existing applications may continue to use Intel® Media SDK." > > https://www.intel.com/content/www/us/en/develop/documentation/upgrading-from-msdk-to-onevpl/top.html > According to this doc, new features are supported in oneVPL only. We will provide av1_qsv encoder which is available for --enable-libvpl only, Please see https://github.com/intel-media-ci/ffmpeg/pull/515/commits/f4b500cb977f9506092831fda8f34b207feae618 if you are interested. 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 v7 09/10] qsv: use a new method to create mfx session when using oneVPL
On Fri, Mar 11, 2022 at 9:18 AM Xiang, Haihao wrote: > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > index 8ab96bad25..e0e820f164 100644 > --- a/libavutil/hwcontext_d3d11va.c > +++ b/libavutil/hwcontext_d3d11va.c > @@ -525,6 +525,13 @@ static void d3d11va_device_uninit(AVHWDeviceContext > *hwdev) > } > } > > +static void d3d11va_device_free(AVHWDeviceContext *ctx) > +{ > +AVD3D11VADeviceContext *hwctx = ctx->hwctx; > + > +av_free(hwctx->device_name); > +} > + > static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, > AVDictionary *opts, int flags) > { > @@ -537,6 +544,8 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, > const char *device, > int is_debug = !!av_dict_get(opts, "debug", NULL, 0); > int ret; > > +ctx->free = d3d11va_device_free; > + > // (On UWP we can't check this.) > #if !HAVE_UWP > if (!LoadLibrary("d3d11_1sdklayers.dll")) > @@ -561,6 +570,10 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, > const char *device, > if (FAILED(IDXGIFactory2_EnumAdapters(pDXGIFactory, adapter, > &pAdapter))) > pAdapter = NULL; > IDXGIFactory2_Release(pDXGIFactory); > + > +device_hwctx->device_name = av_strdup(device); > +if (!device_hwctx->device_name) > +return AVERROR(ENOMEM); > } > } > > diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h > index 77d2d72f1b..41a315b9e6 100644 > --- a/libavutil/hwcontext_d3d11va.h > +++ b/libavutil/hwcontext_d3d11va.h > @@ -94,6 +94,11 @@ typedef struct AVD3D11VADeviceContext { > void (*lock)(void *lock_ctx); > void (*unlock)(void *lock_ctx); > void *lock_ctx; > + > +/** > + * The string for the used adapter > + */ > +char *device_name; > } AVD3D11VADeviceContext; > > /** > diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c > index 53d00fa815..6967357093 100644 > --- a/libavutil/hwcontext_dxva2.c > +++ b/libavutil/hwcontext_dxva2.c > @@ -431,6 +431,7 @@ static void dxva2_device_free(AVHWDeviceContext *ctx) > dlclose(priv->dxva2lib); > > av_freep(&ctx->user_opaque); > +av_free(hwctx->device_name); > } > > static int dxva2_device_create9(AVHWDeviceContext *ctx, UINT adapter) > @@ -571,6 +572,13 @@ static int dxva2_device_create(AVHWDeviceContext *ctx, > const char *device, > return AVERROR_UNKNOWN; > } > > +if (device) { > +hwctx->device_name = av_strdup(device); > + > +if (!hwctx->device_name) > +return AVERROR(ENOMEM); > +} > + > return 0; > } > > diff --git a/libavutil/hwcontext_dxva2.h b/libavutil/hwcontext_dxva2.h > index e1b79bc0de..253ddbed51 100644 > --- a/libavutil/hwcontext_dxva2.h > +++ b/libavutil/hwcontext_dxva2.h > @@ -38,6 +38,10 @@ > */ > typedef struct AVDXVA2DeviceContext { > IDirect3DDeviceManager9 *devmgr; > +/** > + * The string for the used adapter > + */ > +char *device_name; > } AVDXVA2DeviceContext; > > /** Why are these device names required? I would think deriving a child device would use the actual device, eg. ID3D11Device or IDirect3DDeviceManager9 (and whatever for VAAPI), and not some string (that may or may not even be set). It feels quite a bit icky to store these in the context just for qsv to do... what with? - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 4/4] vaapi_encode_h265: Query encoding block sizes and features
From: Mark Thompson Signed-off-by: Fei Wang --- libavcodec/vaapi_encode_h265.c | 114 +++-- 1 file changed, 108 insertions(+), 6 deletions(-) diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index e486e64eb9..11eca5989b 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -56,6 +56,9 @@ typedef struct VAAPIEncodeH265Context { VAAPIEncodeContext common; // Encoder features. +uint32_t va_features; +// Block size info. +uint32_t va_bs; uint32_t ctu_size; uint32_t min_cb_size; @@ -427,9 +430,9 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) vps->vps_max_latency_increase_plus1[i]; } -// These have to come from the capabilities of the encoder. We have no -// way to query them, so just hardcode parameters which work on the Intel -// driver. +// These values come from the capabilities of the first encoder +// implementation in the i965 driver on Intel Skylake. They may +// fail badly with other platforms or drivers. // CTB size from 8x8 to 32x32. sps->log2_min_luma_coding_block_size_minus3 = 0; sps->log2_diff_max_min_luma_coding_block_size = 2; @@ -447,6 +450,42 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) sps->pcm_enabled_flag = 0; +// update sps setting according to queried result +#if VA_CHECK_VERSION(1, 13, 0) +if (priv->va_features) { +VAConfigAttribValEncHEVCFeatures features = { .value = priv->va_features }; + +// Enable feature if get queried result is VA_FEATURE_SUPPORTED | VA_FEATURE_REQUIRED +sps->amp_enabled_flag = +!!features.bits.amp; +sps->sample_adaptive_offset_enabled_flag = +!!features.bits.sao; +sps->sps_temporal_mvp_enabled_flag = +!!features.bits.temporal_mvp; +sps->pcm_enabled_flag = +!!features.bits.pcm; +} + +if (priv->va_bs) { +VAConfigAttribValEncHEVCBlockSizes bs = { .value = priv->va_bs }; +sps->log2_min_luma_coding_block_size_minus3 = +ff_ctz(priv->min_cb_size) - 3; +sps->log2_diff_max_min_luma_coding_block_size = +ff_ctz(priv->ctu_size) - ff_ctz(priv->min_cb_size); + +sps->log2_min_luma_transform_block_size_minus2 = +bs.bits.log2_min_luma_transform_block_size_minus2; +sps->log2_diff_max_min_luma_transform_block_size = +bs.bits.log2_max_luma_transform_block_size_minus2 - +bs.bits.log2_min_luma_transform_block_size_minus2; + +sps->max_transform_hierarchy_depth_inter = +bs.bits.max_max_transform_hierarchy_depth_inter; +sps->max_transform_hierarchy_depth_intra = +bs.bits.max_max_transform_hierarchy_depth_intra; +} +#endif + // STRPSs should ideally be here rather than defined individually in // each slice, but the structure isn't completely fixed so for now // don't bother. @@ -539,6 +578,23 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) pps->cu_qp_delta_enabled_flag = (ctx->va_rc_mode != VA_RC_CQP); pps->diff_cu_qp_delta_depth = 0; +// update pps setting according to queried result +#if VA_CHECK_VERSION(1, 13, 0) +if (priv->va_features) { +VAConfigAttribValEncHEVCFeatures features = { .value = priv->va_features }; +if (ctx->va_rc_mode != VA_RC_CQP) +pps->cu_qp_delta_enabled_flag = +!!features.bits.cu_qp_delta; + +pps->transform_skip_enabled_flag = +!!features.bits.transform_skip; +// set diff_cu_qp_delta_depth as its max value if cu_qp_delta enabled. Otherwise +// 0 will make cu_qp_delta invalid. +if (pps->cu_qp_delta_enabled_flag) +pps->diff_cu_qp_delta_depth = sps->log2_diff_max_min_luma_coding_block_size; +} +#endif + if (ctx->tile_rows && ctx->tile_cols) { int uniform_spacing; @@ -640,8 +696,8 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) .coded_buf = VA_INVALID_ID, -.collocated_ref_pic_index = 0xff, - +.collocated_ref_pic_index = sps->sps_temporal_mvp_enabled_flag ? +0 : 0xff, .last_picture = 0, .pic_init_qp= pps->init_qp_minus26 + 26, @@ -674,6 +730,8 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) .entropy_coding_sync_enabled_flag = pps->entropy_coding_sync_enabled_flag, .loop_filter_across_tiles_enabled_flag = pps->loop_filter_across_tiles_enabled_flag, +.pps_loop_filter_across_slices_enabled_flag = +pps->pps_loop_filter_across_slices_enabled_flag, .scaling_list_data_present_flag = (sps->sps_scaling_list_data_present_flag |
[FFmpeg-devel] [PATCH v4 3/4] vaapi_encode_h265: Explicitly set and correct some flags
From: Mark Thompson max_14bit_constraint_flag should be set if the bit depth is not greater than 14 (currently always true). one_picture_only_flag should not be set because we don't support the still picture profiles. general_profile_compatibility_flag should be set according to general_profile_idc instead of bit depth. Signed-off-by: Fei Wang --- libavcodec/vaapi_encode_h265.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 099a68cc1b..e486e64eb9 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -303,17 +303,21 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) ptl->general_profile_idc = avctx->profile; ptl->general_tier_flag = priv->tier; -if (chroma_format == 1) { -ptl->general_profile_compatibility_flag[1] = bit_depth == 8; -ptl->general_profile_compatibility_flag[2] = bit_depth <= 10; +ptl->general_profile_compatibility_flag[ptl->general_profile_idc] = 1; + +if (ptl->general_profile_compatibility_flag[1]) +ptl->general_profile_compatibility_flag[2] = 1; +if (ptl->general_profile_compatibility_flag[3]) { +ptl->general_profile_compatibility_flag[1] = 1; +ptl->general_profile_compatibility_flag[2] = 1; } -ptl->general_profile_compatibility_flag[4] = 1; ptl->general_progressive_source_flag= 1; ptl->general_interlaced_source_flag = 0; ptl->general_non_packed_constraint_flag = 1; ptl->general_frame_only_constraint_flag = 1; +ptl->general_max_14bit_constraint_flag = bit_depth <= 14; ptl->general_max_12bit_constraint_flag = bit_depth <= 12; ptl->general_max_10bit_constraint_flag = bit_depth <= 10; ptl->general_max_8bit_constraint_flag = bit_depth == 8; @@ -323,6 +327,7 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) ptl->general_max_monochrome_constraint_flag = chroma_format == 0; ptl->general_intra_constraint_flag = ctx->gop_size == 1; +ptl->general_one_picture_only_constraint_flag = 0; ptl->general_lower_bit_rate_constraint_flag = 1; -- 2.25.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 v4 1/4] lavc/vaapi_encode_h265: Add GPB frame support for hevc_vaapi
From: Linjie Fu Use GPB frames to replace regular P/B frames if backend driver does not support it. - GPB: Generalized P and B picture. Regular P/B frames replaced by B frames with previous-predict only, L0 == L1. Normal B frames still have 2 different ref_lists and allow bi-prediction Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- update: 1. Add b to gpb. 2. Optimise debug message. libavcodec/vaapi_encode.c | 74 +++--- libavcodec/vaapi_encode.h | 2 + libavcodec/vaapi_encode_h265.c | 24 ++- 3 files changed, 93 insertions(+), 7 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 3bf379b1a0..bdba9726b2 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -848,9 +848,13 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, pic->b_depth = current_depth; vaapi_encode_add_ref(avctx, pic, start, 1, 1, 0); -vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); +if (!ctx->b_to_gpb) +vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); +else +vaapi_encode_add_ref(avctx, pic, end, 0, 1, 0); + for (ref = end->refs[1]; ref; ref = ref->refs[1]) vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); } @@ -871,8 +875,11 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, vaapi_encode_add_ref(avctx, pic, pic, 0, 1, 0); vaapi_encode_add_ref(avctx, pic, start, 1, 1, 0); -vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); +if (!ctx->b_to_gpb) +vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); +else +vaapi_encode_add_ref(avctx, pic, end, 0, 1, 0); for (ref = end->refs[1]; ref; ref = ref->refs[1]) vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); @@ -1845,6 +1852,51 @@ static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) ref_l1 = attr.value >> 16 & 0x; } +ctx->p_to_gpb = 0; +ctx->b_to_gpb = 0; + +#if VA_CHECK_VERSION(1, 9, 0) +if (!(ctx->codec->flags & FLAG_INTRA_ONLY || +avctx->gop_size <= 1)) { +attr = (VAConfigAttrib) { VAConfigAttribPredictionDirection }; +vas = vaGetConfigAttributes(ctx->hwctx->display, +ctx->va_profile, +ctx->va_entrypoint, +&attr, 1); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_WARNING, "Failed to query prediction direction " + "attribute: %d (%s).\n", vas, vaErrorStr(vas)); +return AVERROR_EXTERNAL; +} else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { +av_log(avctx, AV_LOG_VERBOSE, "Driver does not report any additional " + "prediction constraints.\n"); +} else { +if (((ref_l0 > 0 || ref_l1 > 0) && !(attr.value & VA_PREDICTION_DIRECTION_PREVIOUS)) || +((ref_l1 == 0) && (attr.value & (VA_PREDICTION_DIRECTION_FUTURE | VA_PREDICTION_DIRECTION_BI_NOT_EMPTY { +av_log(avctx, AV_LOG_ERROR, "Driver report incorrect prediction " + "direction attribute.\n"); +return AVERROR_EXTERNAL; +} + +if (!(attr.value & VA_PREDICTION_DIRECTION_FUTURE)) { +if (ref_l0 > 0 && ref_l1 > 0) { +ctx->b_to_gpb = 1; +av_log(avctx, AV_LOG_VERBOSE, "Driver support previous prediction " + "only for B-frames.\n"); +} +} + +if (attr.value & VA_PREDICTION_DIRECTION_BI_NOT_EMPTY) { +if (ref_l0 > 0 && ref_l1 > 0) { +ctx->p_to_gpb = 1; +av_log(avctx, AV_LOG_VERBOSE, "Driver does not support P-frames, " + "replacing them with previous prediction only B-frames.\n"); +} +} +} +} +#endif + if (ctx->codec->flags & FLAG_INTRA_ONLY || avctx->gop_size <= 1) { av_log(avctx, AV_LOG_VERBOSE, "Using intra frames only.\n"); @@ -1855,14 +1907,24 @@ static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) return AVERROR(EINVAL); } else if (!(ctx->codec->flags & FLAG_B_PICTURES) || ref_l1 < 1 || avctx->max_b_frames < 1) { -av_log(avctx, AV_LOG_VERBOSE, "Using intra and P-frames " - "(supported references: %d / %d).\n", ref_l0, ref_l1); +if (ctx->p_to_gpb) + av_log(avctx, AV_LOG_VERBOSE, "Using intra and B-frames " + "(supported references: %d / %d).\n", + ref_l0, ref_l1); +else +
[FFmpeg-devel] [PATCH v4 2/4] vaapi_encode: Move block size calculation after entrypoint selection
From: Mark Thompson The block size can be dependent on the profile and entrypoint selected. It defaults to 16x16, with codecs able to override this choice with their own function. Signed-off-by: Fei Wang --- libavcodec/vaapi_encode.c | 16 libavcodec/vaapi_encode.h | 7 +++ libavcodec/vaapi_encode_h265.c | 32 ++-- libavcodec/vaapi_encode_mjpeg.c | 18 +++--- libavcodec/vaapi_encode_mpeg2.c | 3 --- libavcodec/vaapi_encode_vp8.c | 3 --- libavcodec/vaapi_encode_vp9.c | 16 7 files changed, 76 insertions(+), 19 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index bdba9726b2..d0aebad681 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -2074,6 +2074,8 @@ static av_cold int vaapi_encode_init_slice_structure(AVCodecContext *avctx) return 0; } +av_assert0(ctx->slice_block_height > 0 && ctx->slice_block_width > 0); + ctx->slice_block_rows = (avctx->height + ctx->slice_block_height - 1) / ctx->slice_block_height; ctx->slice_block_cols = (avctx->width + ctx->slice_block_width - 1) / @@ -2463,6 +2465,20 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) if (err < 0) goto fail; +if (ctx->codec->get_encoder_caps) { +err = ctx->codec->get_encoder_caps(avctx); +if (err < 0) +goto fail; +} else { +// Assume 16x16 blocks. +ctx->surface_width = FFALIGN(avctx->width, 16); +ctx->surface_height = FFALIGN(avctx->height, 16); +if (ctx->codec->flags & FLAG_SLICE_CONTROL) { +ctx->slice_block_width = 16; +ctx->slice_block_height = 16; +} +} + err = vaapi_encode_init_rate_control(avctx); if (err < 0) goto fail; diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index 4ce1df0c6f..8a0b9a1e48 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -377,6 +377,13 @@ typedef struct VAAPIEncodeType { // factor depending on RC mode. int default_quality; +// Determine encode parameters like block sizes for surface alignment +// and slices. This may need to query the profile and entrypoint, +// which will be available when this function is called. If not set, +// assume that all blocks are 16x16 and that surfaces should be +// aligned to match this. +int (*get_encoder_caps)(AVCodecContext *avctx); + // Perform any extra codec-specific configuration after the // codec context is initialised (set up the private data and // add any necessary global parameters). diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 25b9a707d2..099a68cc1b 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -55,6 +55,10 @@ typedef struct VAAPIEncodeH265Picture { typedef struct VAAPIEncodeH265Context { VAAPIEncodeContext common; +// Encoder features. +uint32_t ctu_size; +uint32_t min_cb_size; + // User options. int qp; int aud; @@ -1098,6 +1102,27 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, return 0; } +static av_cold int vaapi_encode_h265_get_encoder_caps(AVCodecContext *avctx) +{ +VAAPIEncodeContext *ctx = avctx->priv_data; +VAAPIEncodeH265Context *priv = avctx->priv_data; + +if (!priv->ctu_size) { +priv->ctu_size = 32; +priv->min_cb_size = 16; +} +av_log(avctx, AV_LOG_VERBOSE, "Using CTU size %dx%d, " + "min CB size %dx%d.\n", priv->ctu_size, priv->ctu_size, + priv->min_cb_size, priv->min_cb_size); + +ctx->surface_width = FFALIGN(avctx->width, priv->min_cb_size); +ctx->surface_height = FFALIGN(avctx->height, priv->min_cb_size); + +ctx->slice_block_width = ctx->slice_block_height = priv->ctu_size; + +return 0; +} + static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; @@ -1167,6 +1192,7 @@ static const VAAPIEncodeType vaapi_encode_type_h265 = { .default_quality = 25, +.get_encoder_caps = &vaapi_encode_h265_get_encoder_caps, .configure = &vaapi_encode_h265_configure, .picture_priv_data_size = sizeof(VAAPIEncodeH265Picture), @@ -1212,12 +1238,6 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx) VA_ENC_PACKED_HEADER_SLICE| // Slice headers. VA_ENC_PACKED_HEADER_MISC; // SEI -ctx->surface_width = FFALIGN(avctx->width, 16); -ctx->surface_height = FFALIGN(avctx->height, 16); - -// CTU size is currently hard-coded to 32. -ctx->slice_block_width = ctx->slice_block_height = 32; - if (priv->qp > 0) ctx->explicit_qp = priv->qp; diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c ind
[FFmpeg-devel] [PATCH] avcodec/pngenc: support writing iCCP chunks
From: Niklas Haas encode_zbuf is mostly a mirror image of decode_zbuf. Other than that, the code is pretty straightforward. Special care needs to be taken to avoid writing more than 79 characters of the profile description (the maximum supported). Also add a FATE transcode test to ensure that the ICC profile gets encoded correctly. --- libavcodec/pngenc.c| 77 +- tests/fate/image.mak | 3 ++ tests/ref/fate/png-icc | 8 + 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/png-icc diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 3ebcc1e571..24530bb62f 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -28,6 +28,7 @@ #include "apng.h" #include "libavutil/avassert.h" +#include "libavutil/bprint.h" #include "libavutil/crc.h" #include "libavutil/libm.h" #include "libavutil/opt.h" @@ -343,6 +344,65 @@ static int png_get_gama(enum AVColorTransferCharacteristic trc, uint8_t *buf) return 1; } +static int encode_zbuf(AVBPrint *bp, const uint8_t *data, size_t size) +{ +z_stream zstream; +unsigned char *buf; +unsigned buf_size; +int ret; + +zstream.zalloc = ff_png_zalloc, +zstream.zfree = ff_png_zfree, +zstream.opaque = NULL; +if (deflateInit(&zstream, Z_DEFAULT_COMPRESSION) != Z_OK) +return AVERROR_EXTERNAL; +zstream.next_in = data; +zstream.avail_in = size; + +for (;;) { +av_bprint_get_buffer(bp, 2, &buf, &buf_size); +if (buf_size < 2) { +deflateEnd(&zstream); +return AVERROR(ENOMEM); +} + +zstream.next_out = buf; +zstream.avail_out = buf_size - 1; +ret = deflate(&zstream, Z_FINISH); +if (ret != Z_OK && ret != Z_STREAM_END) { +deflateEnd(&zstream); +return AVERROR_EXTERNAL; +} + +bp->len += zstream.next_out - buf; +if (ret == Z_STREAM_END) { +deflateEnd(&zstream); +return 0; +} +} +} + +static int png_get_iccp(AVBPrint *bp, const AVFrameSideData *sd, char **buf_out) +{ +const AVDictionaryEntry *name; +int ret; + +av_bprint_init(bp, 0, AV_BPRINT_SIZE_UNLIMITED); + +/* profile header */ +name = av_dict_get(sd->metadata, "name", NULL, 0); +av_bprintf(bp, "%.79s", (name && name->value[0]) ? name->value : "icc"); +av_bprint_chars(bp, 0, 2); /* terminating \0 and compression method */ + +/* profile data */ +if ((ret = encode_zbuf(bp, sd->data, sd->size))) { +av_bprint_finalize(bp, NULL); +return ret; +} + +return av_bprint_finalize(bp, buf_out); +} + static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) { AVFrameSideData *side_data; @@ -399,7 +459,22 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) if (png_get_gama(pict->color_trc, s->buf)) png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4); -/* put the palette if needed */ +side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_ICC_PROFILE); +if (side_data && side_data->size) { +AVBPrint bp; +char *buf; +int ret; + +if ((ret = png_get_iccp(&bp, side_data, &buf))) { +av_log(avctx, AV_LOG_WARNING, "Failed writing iCCP chunk: %s\n", + av_err2str(ret)); +} else { +png_write_chunk(&s->bytestream, MKTAG('i', 'C', 'C', 'P'), buf, bp.size); +av_free(buf); +} +} + +/* put the palette if needed, must be after colorspace information */ if (s->color_type == PNG_COLOR_TYPE_PALETTE) { int has_alpha, alpha, i; unsigned int v; diff --git a/tests/fate/image.mak b/tests/fate/image.mak index 573d398915..e7b156836f 100644 --- a/tests/fate/image.mak +++ b/tests/fate/image.mak @@ -385,6 +385,9 @@ FATE_PNG_PROBE += fate-png-side-data fate-png-side-data: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_frames \ -i $(TARGET_SAMPLES)/png1/lena-int_rgb24.png +FATE_PNG_PROBE += fate-png-icc +fate-png-icc: CMD = transcode png_pipe $(TARGET_SAMPLES)/png1/lena-int_rgb24.png image2 "-c copy" + FATE_PNG-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG) FATE_PNG_PROBE-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG_PROBE) FATE_IMAGE += $(FATE_PNG-yes) diff --git a/tests/ref/fate/png-icc b/tests/ref/fate/png-icc new file mode 100644 index 00..5bce1ea0c4 --- /dev/null +++ b/tests/ref/fate/png-icc @@ -0,0 +1,8 @@ +3cdc46a9c844249cae5c048078d0694d *tests/data/fate/png-icc.image2 +40194 tests/data/fate/png-icc.image2 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 128x128 +#sar 0: 2835/2835 +0, 0, 0,1,49152, 0xe0013dee -- 2.35.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-de
[FFmpeg-devel] [PATCH v2] avcodec/pngenc: support writing iCCP chunks
From: Niklas Haas encode_zbuf is mostly a mirror image of decode_zbuf. Other than that, the code is pretty straightforward. Special care needs to be taken to avoid writing more than 79 characters of the profile description (the maximum supported). Also add a FATE transcode test to ensure that the ICC profile gets encoded correctly. --- Oops. `-c copy` doesn't actually test the PNG writing code. Need to use `-c png` instead. Fixed in v2. --- libavcodec/pngenc.c| 77 +- tests/fate/image.mak | 3 ++ tests/ref/fate/png-icc | 8 + 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/png-icc diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 3ebcc1e571..24530bb62f 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -28,6 +28,7 @@ #include "apng.h" #include "libavutil/avassert.h" +#include "libavutil/bprint.h" #include "libavutil/crc.h" #include "libavutil/libm.h" #include "libavutil/opt.h" @@ -343,6 +344,65 @@ static int png_get_gama(enum AVColorTransferCharacteristic trc, uint8_t *buf) return 1; } +static int encode_zbuf(AVBPrint *bp, const uint8_t *data, size_t size) +{ +z_stream zstream; +unsigned char *buf; +unsigned buf_size; +int ret; + +zstream.zalloc = ff_png_zalloc, +zstream.zfree = ff_png_zfree, +zstream.opaque = NULL; +if (deflateInit(&zstream, Z_DEFAULT_COMPRESSION) != Z_OK) +return AVERROR_EXTERNAL; +zstream.next_in = data; +zstream.avail_in = size; + +for (;;) { +av_bprint_get_buffer(bp, 2, &buf, &buf_size); +if (buf_size < 2) { +deflateEnd(&zstream); +return AVERROR(ENOMEM); +} + +zstream.next_out = buf; +zstream.avail_out = buf_size - 1; +ret = deflate(&zstream, Z_FINISH); +if (ret != Z_OK && ret != Z_STREAM_END) { +deflateEnd(&zstream); +return AVERROR_EXTERNAL; +} + +bp->len += zstream.next_out - buf; +if (ret == Z_STREAM_END) { +deflateEnd(&zstream); +return 0; +} +} +} + +static int png_get_iccp(AVBPrint *bp, const AVFrameSideData *sd, char **buf_out) +{ +const AVDictionaryEntry *name; +int ret; + +av_bprint_init(bp, 0, AV_BPRINT_SIZE_UNLIMITED); + +/* profile header */ +name = av_dict_get(sd->metadata, "name", NULL, 0); +av_bprintf(bp, "%.79s", (name && name->value[0]) ? name->value : "icc"); +av_bprint_chars(bp, 0, 2); /* terminating \0 and compression method */ + +/* profile data */ +if ((ret = encode_zbuf(bp, sd->data, sd->size))) { +av_bprint_finalize(bp, NULL); +return ret; +} + +return av_bprint_finalize(bp, buf_out); +} + static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) { AVFrameSideData *side_data; @@ -399,7 +459,22 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) if (png_get_gama(pict->color_trc, s->buf)) png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4); -/* put the palette if needed */ +side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_ICC_PROFILE); +if (side_data && side_data->size) { +AVBPrint bp; +char *buf; +int ret; + +if ((ret = png_get_iccp(&bp, side_data, &buf))) { +av_log(avctx, AV_LOG_WARNING, "Failed writing iCCP chunk: %s\n", + av_err2str(ret)); +} else { +png_write_chunk(&s->bytestream, MKTAG('i', 'C', 'C', 'P'), buf, bp.size); +av_free(buf); +} +} + +/* put the palette if needed, must be after colorspace information */ if (s->color_type == PNG_COLOR_TYPE_PALETTE) { int has_alpha, alpha, i; unsigned int v; diff --git a/tests/fate/image.mak b/tests/fate/image.mak index 573d398915..da4f3709e9 100644 --- a/tests/fate/image.mak +++ b/tests/fate/image.mak @@ -385,6 +385,9 @@ FATE_PNG_PROBE += fate-png-side-data fate-png-side-data: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_frames \ -i $(TARGET_SAMPLES)/png1/lena-int_rgb24.png +FATE_PNG_PROBE += fate-png-icc +fate-png-icc: CMD = transcode png_pipe $(TARGET_SAMPLES)/png1/lena-int_rgb24.png image2 "-c png" + FATE_PNG-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG) FATE_PNG_PROBE-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG_PROBE) FATE_IMAGE += $(FATE_PNG-yes) diff --git a/tests/ref/fate/png-icc b/tests/ref/fate/png-icc new file mode 100644 index 00..d3cf55263e --- /dev/null +++ b/tests/ref/fate/png-icc @@ -0,0 +1,8 @@ +7e412f6a9e2c7fcb674336e5c104518d *tests/data/fate/png-icc.image2 +49398 tests/data/fate/png-icc.image2 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 128x128 +#sar 0: 2835/2835 +0, 0, 0,1,49152, 0xe0013dee -- 2.35.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.
Re: [FFmpeg-devel] [PATCH v2] avcodec/pngenc: support writing iCCP chunks
On Fri, 11 Mar 2022 11:17:42 +0100 Niklas Haas wrote: > Oops. `-c copy` doesn't actually test the PNG writing code. Need to use > `-c png` instead. Fixed in v2. Hmm, actually, even this doesn't work. I can comment out the iCCP writing code and the iCCP chunk still gets written, somehow. Even though the file hash is different from the `-c copy` case! Any idea how to force a re-encode? ___ 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 v2] avcodec/pngenc: support writing iCCP chunks
Niklas Haas: > On Fri, 11 Mar 2022 11:17:42 +0100 Niklas Haas wrote: >> Oops. `-c copy` doesn't actually test the PNG writing code. Need to use >> `-c png` instead. Fixed in v2. > > Hmm, actually, even this doesn't work. I can comment out the iCCP > writing code and the iCCP chunk still gets written, somehow. Even though > the file hash is different from the `-c copy` case! > > Any idea how to force a re-encode? What makes you believe that an iCCP chunk gets written? Is it the size of the framecrc output? The reason for this is that this is the output of the decoded png frame and not the hash of the demuxed packet or the output file. The latter is included in the +7e412f6a9e2c7fcb674336e5c104518d *tests/data/fate/png-icc.image2. Comparing +49398 tests/data/fate/png-icc.image2 and the relevant line from V1 shows that there is indeed more output. You could use -c copy on the encoded file; and you can also use ffprobe to directly inspect the side data. - 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".
Re: [FFmpeg-devel] [PATCH v2] avcodec/pngenc: support writing iCCP chunks
Niklas Haas: > From: Niklas Haas > > encode_zbuf is mostly a mirror image of decode_zbuf. Other than that, > the code is pretty straightforward. Special care needs to be taken to > avoid writing more than 79 characters of the profile description (the > maximum supported). > > Also add a FATE transcode test to ensure that the ICC profile gets > encoded correctly. > --- > Oops. `-c copy` doesn't actually test the PNG writing code. Need to use > `-c png` instead. Fixed in v2. > --- > libavcodec/pngenc.c| 77 +- > tests/fate/image.mak | 3 ++ > tests/ref/fate/png-icc | 8 + > 3 files changed, 87 insertions(+), 1 deletion(-) > create mode 100644 tests/ref/fate/png-icc > > diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c > index 3ebcc1e571..24530bb62f 100644 > --- a/libavcodec/pngenc.c > +++ b/libavcodec/pngenc.c > @@ -28,6 +28,7 @@ > #include "apng.h" > > #include "libavutil/avassert.h" > +#include "libavutil/bprint.h" > #include "libavutil/crc.h" > #include "libavutil/libm.h" > #include "libavutil/opt.h" > @@ -343,6 +344,65 @@ static int png_get_gama(enum > AVColorTransferCharacteristic trc, uint8_t *buf) > return 1; > } > > +static int encode_zbuf(AVBPrint *bp, const uint8_t *data, size_t size) > +{ > +z_stream zstream; > +unsigned char *buf; > +unsigned buf_size; > +int ret; > + > +zstream.zalloc = ff_png_zalloc, > +zstream.zfree = ff_png_zfree, > +zstream.opaque = NULL; > +if (deflateInit(&zstream, Z_DEFAULT_COMPRESSION) != Z_OK) > +return AVERROR_EXTERNAL; > +zstream.next_in = data; > +zstream.avail_in = size; > + > +for (;;) { > +av_bprint_get_buffer(bp, 2, &buf, &buf_size); > +if (buf_size < 2) { > +deflateEnd(&zstream); > +return AVERROR(ENOMEM); > +} > + > +zstream.next_out = buf; > +zstream.avail_out = buf_size - 1; > +ret = deflate(&zstream, Z_FINISH); > +if (ret != Z_OK && ret != Z_STREAM_END) { > +deflateEnd(&zstream); > +return AVERROR_EXTERNAL; > +} > + > +bp->len += zstream.next_out - buf; > +if (ret == Z_STREAM_END) { > +deflateEnd(&zstream); > +return 0; > +} > +} > +} > + > +static int png_get_iccp(AVBPrint *bp, const AVFrameSideData *sd, char > **buf_out) > +{ > +const AVDictionaryEntry *name; > +int ret; > + > +av_bprint_init(bp, 0, AV_BPRINT_SIZE_UNLIMITED); > + > +/* profile header */ > +name = av_dict_get(sd->metadata, "name", NULL, 0); > +av_bprintf(bp, "%.79s", (name && name->value[0]) ? name->value : "icc"); > +av_bprint_chars(bp, 0, 2); /* terminating \0 and compression method */ > + > +/* profile data */ > +if ((ret = encode_zbuf(bp, sd->data, sd->size))) { > +av_bprint_finalize(bp, NULL); > +return ret; > +} > + > +return av_bprint_finalize(bp, buf_out); 1. This is not how should work with an AVBPrint -- you are throwing the small-string optimization away here. 2. Using an AVBPrint with its dynamic reallocations is probably not good here at all: It is easy to get a good upper bound via deflateBound() which allows to omit the reallocations/the loop. (I should probably have applied https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210317163202.672493-1-andreas.rheinha...@gmail.com/) > +} > + > static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) > { > AVFrameSideData *side_data; > @@ -399,7 +459,22 @@ static int encode_headers(AVCodecContext *avctx, const > AVFrame *pict) > if (png_get_gama(pict->color_trc, s->buf)) > png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, > 4); > > -/* put the palette if needed */ > +side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_ICC_PROFILE); > +if (side_data && side_data->size) { > +AVBPrint bp; > +char *buf; > +int ret; > + > +if ((ret = png_get_iccp(&bp, side_data, &buf))) { > +av_log(avctx, AV_LOG_WARNING, "Failed writing iCCP chunk: %s\n", > + av_err2str(ret)); 3. You should error out in case of error. > +} else { > +png_write_chunk(&s->bytestream, MKTAG('i', 'C', 'C', 'P'), buf, > bp.size); 4. The size of this chunk is not accounted for in the max_packet_size. (You are lucky that the current estimate for max_packet_size is too generous (the zstream is not reset/flushed for each row, so it should be deflatebound(alldata) instead of height*deflatebound(data_from_one_row)).) > +av_free(buf); > +} > +} > + > +/* put the palette if needed, must be after colorspace information */ > if (s->color_type == PNG_COLOR_TYPE_PALETTE) { > int has_alpha, alpha, i; > unsigned int v; > diff --git a/tests/fate/image.mak b/tests/fate/image.mak > index 573d398915..da4f3709e9 100644 > --- a/tests/fate
Re: [FFmpeg-devel] [PATCH 00/13] [RFC] Reduce unnecessary recompilation
On Wed, 23 Feb 2022, Martin Storsjö wrote: When updating the ffmpeg source, one quite often ends up in a situation where practically all of the codebase (or all of a library) gets rebuilt, due to updates to headers that are included in most files. In some cases, full rebuilds are warranted of course, but they could also be avoided in many cases - e.g. such as if the minor/micro version of a library has been bumped, or if a new component (codec, demuxer, filter etc) has been enabled (or removed if reconfiguring with an older source version). Very few source files are affected by exactly what the full library version is, or by the full list of enabled components. To avoid such rebuilds, I've got a proof of concept patchset that splits headers, so that most source files avoid including the bits that change often and that shouldn't affect how they are built. - The version.h headers are split into a separate version_major.h which contains only the major library version, and accompanying FF_API_* defines. The main library headers only include version_major.h, and files that need the exact version (e.g. LIB_VERSION* or LIB_IDENT) can include version.h explicitly. This is a minor break of the public API though, as definitions that used to be available no longer are. This works mostly fine for most libraries, but there's little point in splitting libavutil/version.h, because LIBAVUTIL_VERSION_INT is used in every source file that defines an AVClass. By splitting version.h, and update to the minor/micro version numbers of all libraries except avutil now would require recompiling 30 files instead of 1653 before. (This change also should lower the barrier to and reduce the risk of forgetting to bump the version numbers, which one otherwise often postpones while working on a patch, as it forces rebuilds.) - config.h is split into a separate config_components.h that includes the list of enabled/disabled components (corresponding to $ALL_COMPONENTS in configure). One could consider splitting up config.h even more, but that probably gives less benefit compared to the amount of churn. Surprisingly, a nontrivial number of source files do depend on the state of specific encoders/decoders/components, so quite a few files do end up requiring including config_components.h. (Also this change can possibly break compilation of source files that require external dependencies that I haven't tested.) In practice, this reduces the number of rebuilt source files from 1979 to 193, if there's a change to the list of enabled components but not to the rest of config.h. What do you think - is it worth the slight churn to avoid pointless rebuilds? Ping - I never got any feedback on the general concept of this patchset; is either of the refactorings worthwhile? I'll post a rebased version of the patchset, which also should fix the build errors that Michael noted. (It's quite expected that the last patch, splitting up config.h, will require changes in some conditionally compiled files that haven't been included in my test builds.) // Martin ___ 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 1/9] libavcodec: Split version.h
This avoids including version.h in all source files, avoiding unnecessary rebuilds when the version number is bumped. Only version_major.h is included by the main header, which defines availability of e.g. FF_API_* macros, and which is bumped much less often. --- fftools/cmdutils.c | 1 + fftools/ffmpeg.c | 1 + fftools/ffprobe.c | 1 + libavcodec/Makefile| 1 + libavcodec/aacenc.c| 1 + libavcodec/avcodec.c | 1 + libavcodec/avcodec.h | 2 +- libavcodec/codec.h | 2 +- libavcodec/dpxenc.c| 1 + libavcodec/j2kenc.c| 1 + libavcodec/libvorbisenc.c | 1 + libavcodec/mjpegenc_common.c | 1 + libavcodec/mpeg4videoenc.c | 1 + libavcodec/options_table.h | 2 +- libavcodec/packet.h| 2 +- libavcodec/pthread_frame.c | 2 +- libavcodec/tiffenc.c | 1 + libavcodec/vaapi_encode_h264.c | 1 + libavcodec/vc2enc.c| 1 + libavcodec/version.h | 28 ++--- libavcodec/version_major.h | 55 ++ libavformat/movenc.c | 1 + 22 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 libavcodec/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 4b50e15eef..869b5ec012 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -55,6 +55,7 @@ #include "libavutil/ffversion.h" #include "libavutil/version.h" #include "libavcodec/bsf.h" +#include "libavcodec/version.h" #include "cmdutils.h" #if HAVE_SYS_RESOURCE_H #include diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 9a3fdc636d..7b8342fd0e 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -64,6 +64,7 @@ #include "libavutil/thread.h" #include "libavutil/threadmessage.h" #include "libavcodec/mathops.h" +#include "libavcodec/version.h" #include "libavformat/os_support.h" # include "libavfilter/avfilter.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 66206b66d9..6f4ce52eb5 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -30,6 +30,7 @@ #include "libavformat/avformat.h" #include "libavcodec/avcodec.h" +#include "libavcodec/version.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index cd929da8e6..22063e43a7 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -22,6 +22,7 @@ HEADERS = ac3_parser.h \ qsv.h \ vdpau.h \ version.h \ + version_major.h \ videotoolbox.h\ vorbis_parser.h \ xvmc.h\ diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index a1004c3e98..38f2d15f78 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -41,6 +41,7 @@ #include "mpeg4audio.h" #include "sinewin.h" #include "profiles.h" +#include "version.h" #include "aac.h" #include "aactab.h" diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 92639dda6b..838c009a19 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -39,6 +39,7 @@ #include "frame_thread_encoder.h" #include "internal.h" #include "thread.h" +#include "version.h" #include "libavutil/ffversion.h" const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 79af8dcc05..6e2be910dc 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -43,7 +43,7 @@ #include "codec_id.h" #include "defs.h" #include "packet.h" -#include "version.h" +#include "version_major.h" /** * @defgroup libavc libavcodec diff --git a/libavcodec/codec.h b/libavcodec/codec.h index a8147ec21f..42dd95d225 100644 --- a/libavcodec/codec.h +++ b/libavcodec/codec.h @@ -31,7 +31,7 @@ #include "libavutil/samplefmt.h" #include "libavcodec/codec_id.h" -#include "libavcodec/version.h" +#include "libavcodec/version_major.h" /** * @addtogroup lavc_core diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c index 0db6aa832d..c4f9ae09bb 100644 --- a/libavcodec/dpxenc.c +++ b/libavcodec/dpxenc.c @@ -25,6 +25,7 @@ #include "avcodec.h" #include "encode.h" #include "internal.h" +#include "version.h" typedef struct DPXContext { int big_endian; diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index c06752f43a..95573c6799 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -70,6 +70,7 @@ #include "internal.h" #include "bytestream.h" #include "jpeg2000.h" +#include "version.h" #include "libavutil/common.h" #inc
[FFmpeg-devel] [PATCH v2 2/9] libavformat: Split version.h
--- fftools/cmdutils.c| 1 + fftools/ffprobe.c | 1 + libavdevice/pulse_audio_dec.c | 1 + libavdevice/pulse_audio_enc.c | 1 + libavformat/Makefile | 1 + libavformat/avformat.h| 2 +- libavformat/avio.h| 2 +- libavformat/flacenc.c | 1 + libavformat/framehash.c | 1 + libavformat/matroskaenc.c | 1 + libavformat/mmf.c | 1 + libavformat/movenc.c | 1 + libavformat/mux.c | 1 + libavformat/mxfenc.c | 1 + libavformat/nutenc.c | 1 + libavformat/oggenc.c | 1 + libavformat/rtmpproto.c | 1 + libavformat/rtsp.c| 1 + libavformat/rtspdec.c | 1 + libavformat/utils.c | 1 + libavformat/version.h | 23 ++- libavformat/version_major.h | 53 +++ 22 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 libavformat/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 869b5ec012..87f410e975 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -32,6 +32,7 @@ #include "config.h" #include "compat/va_copy.h" #include "libavformat/avformat.h" +#include "libavformat/version.h" #include "libavfilter/avfilter.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 6f4ce52eb5..7e70b549f3 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -29,6 +29,7 @@ #include #include "libavformat/avformat.h" +#include "libavformat/version.h" #include "libavcodec/avcodec.h" #include "libavcodec/version.h" #include "libavutil/avassert.h" diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c index b23d08e4d3..5a42f71ede 100644 --- a/libavdevice/pulse_audio_dec.c +++ b/libavdevice/pulse_audio_dec.c @@ -30,6 +30,7 @@ #include "libavformat/avformat.h" #include "libavformat/internal.h" +#include "libavformat/version.h" #include "pulse_audio_common.h" #include "timefilter.h" diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index 4ff425d33f..7b50517fc7 100644 --- a/libavdevice/pulse_audio_enc.c +++ b/libavdevice/pulse_audio_enc.c @@ -23,6 +23,7 @@ #include #include "libavformat/avformat.h" #include "libavformat/internal.h" +#include "libavformat/version.h" #include "libavutil/channel_layout.h" #include "libavutil/internal.h" #include "libavutil/opt.h" diff --git a/libavformat/Makefile b/libavformat/Makefile index 322c8e7896..27d553c20e 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -4,6 +4,7 @@ DESC = FFmpeg container format library HEADERS = avformat.h\ avio.h\ version.h \ + version_major.h \ OBJS = allformats.o \ avio.o \ diff --git a/libavformat/avformat.h b/libavformat/avformat.h index b4b8075ae6..d37a582838 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -319,7 +319,7 @@ #include "libavutil/log.h" #include "avio.h" -#include "libavformat/version.h" +#include "libavformat/version_major.h" struct AVFormatContext; struct AVStream; diff --git a/libavformat/avio.h b/libavformat/avio.h index ca970b1ce3..3ed9175a9b 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -33,7 +33,7 @@ #include "libavutil/dict.h" #include "libavutil/log.h" -#include "libavformat/version.h" +#include "libavformat/version_major.h" /** * Seeking works like for a local file. diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index b267197ccc..88dbe87af4 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -30,6 +30,7 @@ #include "flacenc.h" #include "id3v2.h" #include "internal.h" +#include "version.h" #include "vorbiscomment.h" diff --git a/libavformat/framehash.c b/libavformat/framehash.c index 04c40825b9..43b8ab3be2 100644 --- a/libavformat/framehash.c +++ b/libavformat/framehash.c @@ -20,6 +20,7 @@ #include "libavutil/channel_layout.h" #include "internal.h" +#include "version.h" int ff_framehash_write_header(AVFormatContext *s) { diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 38d9485288..e8df5db3bd 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -35,6 +35,7 @@ #include "isom.h" #include "matroska.h" #include "riff.h" +#include "version.h" #include "vorbiscomment.h" #include "wv.h" diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 0c067a1025..e836390bff 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -26,6 +26,7 @@ #include "pcm.h" #include "rawenc.h" #include "riff.h" +#include "version.h" typedef struct MMFContext { int64_t atrpos, atsqpos, awapos; diff --git a/libavformat/movenc.c b/liba
[FFmpeg-devel] [PATCH v2 3/9] libavdevice: Split version.h
--- fftools/cmdutils.c | 1 + fftools/ffprobe.c | 1 + libavdevice/Makefile| 1 + libavdevice/avdevice.c | 1 + libavdevice/avdevice.h | 2 +- libavdevice/version.h | 10 ++ libavdevice/version_major.h | 37 + 7 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 libavdevice/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 87f410e975..21ec11226e 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -35,6 +35,7 @@ #include "libavformat/version.h" #include "libavfilter/avfilter.h" #include "libavdevice/avdevice.h" +#include "libavdevice/version.h" #include "libswscale/swscale.h" #include "libswresample/swresample.h" #include "libpostproc/postprocess.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 7e70b549f3..04160d9674 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -53,6 +53,7 @@ #include "libavutil/timecode.h" #include "libavutil/timestamp.h" #include "libavdevice/avdevice.h" +#include "libavdevice/version.h" #include "libswscale/swscale.h" #include "libswresample/swresample.h" #include "libpostproc/postprocess.h" diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 53efda0514..99fea7133a 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -3,6 +3,7 @@ DESC= FFmpeg device handling library HEADERS = avdevice.h\ version.h \ + version_major.h \ OBJS= alldevices.o \ avdevice.o\ diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 8f460c7564..833d200054 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -22,6 +22,7 @@ #include "avdevice.h" #include "internal.h" #include "config.h" +#include "version.h" #include "libavutil/ffversion.h" const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION; diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index 6f24976dcc..6de0e33819 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -19,7 +19,7 @@ #ifndef AVDEVICE_AVDEVICE_H #define AVDEVICE_AVDEVICE_H -#include "version.h" +#include "version_major.h" /** * @file diff --git a/libavdevice/version.h b/libavdevice/version.h index 05234e7f21..513c0bb1bc 100644 --- a/libavdevice/version.h +++ b/libavdevice/version.h @@ -27,7 +27,8 @@ #include "libavutil/version.h" -#define LIBAVDEVICE_VERSION_MAJOR 59 +#include "version_major.h" + #define LIBAVDEVICE_VERSION_MINOR 5 #define LIBAVDEVICE_VERSION_MICRO 100 @@ -41,11 +42,4 @@ #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION) -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ -#define FF_API_DEVICE_CAPABILITIES (LIBAVDEVICE_VERSION_MAJOR < 60) - #endif /* AVDEVICE_VERSION_H */ diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h new file mode 100644 index 00..d255ff6992 --- /dev/null +++ b/libavdevice/version_major.h @@ -0,0 +1,37 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVDEVICE_VERSION_MAJOR_H +#define AVDEVICE_VERSION_MAJOR_H + +/** + * @file + * @ingroup lavd + * Libavdevice version macros + */ + +#define LIBAVDEVICE_VERSION_MAJOR 59 + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ +#define FF_API_DEVICE_CAPABILITIES (LIBAVDEVICE_VERSION_MAJOR < 60) + +#endif /* AVDEVICE_VERSION_MAJOR_H */ -- 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 "
[FFmpeg-devel] [PATCH v2 4/9] libpostproc: Split version.h
--- fftools/cmdutils.c | 1 + fftools/ffprobe.c | 1 + libpostproc/Makefile| 1 + libpostproc/postprocess.c | 1 + libpostproc/postprocess.h | 2 +- libpostproc/version.h | 3 ++- libpostproc/version_major.h | 31 +++ 7 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 libpostproc/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 21ec11226e..f52015708c 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -39,6 +39,7 @@ #include "libswscale/swscale.h" #include "libswresample/swresample.h" #include "libpostproc/postprocess.h" +#include "libpostproc/version.h" #include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 04160d9674..203f062935 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -57,6 +57,7 @@ #include "libswscale/swscale.h" #include "libswresample/swresample.h" #include "libpostproc/postprocess.h" +#include "libpostproc/version.h" #include "cmdutils.h" #include "libavutil/thread.h" diff --git a/libpostproc/Makefile b/libpostproc/Makefile index 34317193a8..f7debb8eeb 100644 --- a/libpostproc/Makefile +++ b/libpostproc/Makefile @@ -4,6 +4,7 @@ FFLIBS = avutil HEADERS = postprocess.h\ version.h\ + version_major.h \ OBJS = postprocess.o diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c index 2ca7a3779d..b954dc2eaa 100644 --- a/libpostproc/postprocess.c +++ b/libpostproc/postprocess.c @@ -89,6 +89,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks //#define DEBUG_BRIGHTNESS #include "postprocess.h" #include "postprocess_internal.h" +#include "version.h" #include "libavutil/avstring.h" #include "libavutil/ppc/util_altivec.h" diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h index ba456cf3e0..cf4e78c83a 100644 --- a/libpostproc/postprocess.h +++ b/libpostproc/postprocess.h @@ -34,7 +34,7 @@ * @{ */ -#include "libpostproc/version.h" +#include "libpostproc/version_major.h" /** * Return the LIBPOSTPROC_VERSION_INT constant. diff --git a/libpostproc/version.h b/libpostproc/version.h index e8bd6afdc8..4459d251d4 100644 --- a/libpostproc/version.h +++ b/libpostproc/version.h @@ -28,7 +28,8 @@ #include "libavutil/version.h" -#define LIBPOSTPROC_VERSION_MAJOR 56 +#include "version_major.h" + #define LIBPOSTPROC_VERSION_MINOR 4 #define LIBPOSTPROC_VERSION_MICRO 100 diff --git a/libpostproc/version_major.h b/libpostproc/version_major.h new file mode 100644 index 00..7afc4dbb72 --- /dev/null +++ b/libpostproc/version_major.h @@ -0,0 +1,31 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROC_VERSION_MAJOR_H +#define POSTPROC_VERSION_MAJOR_H + +/** + * @file + * Libpostproc version macros + */ + +#define LIBPOSTPROC_VERSION_MAJOR 56 + +#endif /* POSTPROC_VERSION_MAJOR_H */ -- 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 v2 5/9] libswresample: Split version.h
--- fftools/cmdutils.c| 1 + fftools/ffprobe.c | 1 + libswresample/Makefile| 1 + libswresample/swresample.c| 1 + libswresample/swresample.h| 2 +- libswresample/version.h | 3 ++- libswresample/version_major.h | 31 +++ 7 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 libswresample/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index f52015708c..dd5d4f5849 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -38,6 +38,7 @@ #include "libavdevice/version.h" #include "libswscale/swscale.h" #include "libswresample/swresample.h" +#include "libswresample/version.h" #include "libpostproc/postprocess.h" #include "libpostproc/version.h" #include "libavutil/attributes.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 203f062935..7d8ab0392e 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -56,6 +56,7 @@ #include "libavdevice/version.h" #include "libswscale/swscale.h" #include "libswresample/swresample.h" +#include "libswresample/version.h" #include "libpostproc/postprocess.h" #include "libpostproc/version.h" #include "cmdutils.h" diff --git a/libswresample/Makefile b/libswresample/Makefile index f528427f55..b74ee20987 100644 --- a/libswresample/Makefile +++ b/libswresample/Makefile @@ -4,6 +4,7 @@ FFLIBS = avutil HEADERS = swresample.h \ version.h \ + version_major.h\ OBJS = audioconvert.o\ dither.o \ diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 16734c9df9..82e979c4c9 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -24,6 +24,7 @@ #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/internal.h" +#include "version.h" #include diff --git a/libswresample/swresample.h b/libswresample/swresample.h index c7b84fbcac..aebdbafcfc 100644 --- a/libswresample/swresample.h +++ b/libswresample/swresample.h @@ -124,7 +124,7 @@ #include "libavutil/frame.h" #include "libavutil/samplefmt.h" -#include "libswresample/version.h" +#include "libswresample/version_major.h" /** * @name Option constants diff --git a/libswresample/version.h b/libswresample/version.h index 61d0057cf5..9a514e6d6f 100644 --- a/libswresample/version.h +++ b/libswresample/version.h @@ -28,7 +28,8 @@ #include "libavutil/version.h" -#define LIBSWRESAMPLE_VERSION_MAJOR 4 +#include "version_major.h" + #define LIBSWRESAMPLE_VERSION_MINOR 4 #define LIBSWRESAMPLE_VERSION_MICRO 100 diff --git a/libswresample/version_major.h b/libswresample/version_major.h new file mode 100644 index 00..7f265c2073 --- /dev/null +++ b/libswresample/version_major.h @@ -0,0 +1,31 @@ +/* + * Version macros. + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWRESAMPLE_VERSION_MAJOR_H +#define SWRESAMPLE_VERSION_MAJOR_H + +/** + * @file + * Libswresample version macros + */ + +#define LIBSWRESAMPLE_VERSION_MAJOR 4 + +#endif /* SWRESAMPLE_VERSION_MAJOR_H */ -- 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 v2 6/9] libswscale: Split version.h
--- fftools/cmdutils.c | 1 + fftools/ffprobe.c | 1 + libswscale/Makefile| 1 + libswscale/swscale.h | 2 +- libswscale/utils.c | 1 + libswscale/version.h | 9 ++--- libswscale/version_major.h | 35 +++ 7 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 libswscale/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index dd5d4f5849..d5cadec695 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -37,6 +37,7 @@ #include "libavdevice/avdevice.h" #include "libavdevice/version.h" #include "libswscale/swscale.h" +#include "libswscale/version.h" #include "libswresample/swresample.h" #include "libswresample/version.h" #include "libpostproc/postprocess.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 7d8ab0392e..f36397a6ff 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -55,6 +55,7 @@ #include "libavdevice/avdevice.h" #include "libavdevice/version.h" #include "libswscale/swscale.h" +#include "libswscale/version.h" #include "libswresample/swresample.h" #include "libswresample/version.h" #include "libpostproc/postprocess.h" diff --git a/libswscale/Makefile b/libswscale/Makefile index a0ec71e06f..1f02b56421 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -3,6 +3,7 @@ DESC = FFmpeg image rescaling library HEADERS = swscale.h \ version.h \ + version_major.h \ OBJS = alphablend.o \ hscale.o \ diff --git a/libswscale/swscale.h b/libswscale/swscale.h index daa53dc01e..07c69e1ae7 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -33,7 +33,7 @@ #include "libavutil/frame.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" -#include "version.h" +#include "version_major.h" /** * @defgroup libsws libswscale diff --git a/libswscale/utils.c b/libswscale/utils.c index 34f7f0b869..e86c151f67 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -59,6 +59,7 @@ #include "rgb2rgb.h" #include "swscale.h" #include "swscale_internal.h" +#include "version.h" static SwsVector *sws_getIdentityVec(void); static void sws_addVec(SwsVector *a, SwsVector *b); diff --git a/libswscale/version.h b/libswscale/version.h index 0e5583aa47..c13db31c43 100644 --- a/libswscale/version.h +++ b/libswscale/version.h @@ -26,7 +26,8 @@ #include "libavutil/version.h" -#define LIBSWSCALE_VERSION_MAJOR 6 +#include "version_major.h" + #define LIBSWSCALE_VERSION_MINOR 5 #define LIBSWSCALE_VERSION_MICRO 100 @@ -40,10 +41,4 @@ #define LIBSWSCALE_IDENT"SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ - #endif /* SWSCALE_VERSION_H */ diff --git a/libswscale/version_major.h b/libswscale/version_major.h new file mode 100644 index 00..2f8418780c --- /dev/null +++ b/libswscale/version_major.h @@ -0,0 +1,35 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_VERSION_MAJOR_H +#define SWSCALE_VERSION_MAJOR_H + +/** + * @file + * swscale version macros + */ + +#define LIBSWSCALE_VERSION_MAJOR 6 + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#endif /* SWSCALE_VERSION_MAJOR_H */ -- 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 v2 7/9] libavfilter: Split version.h
--- fftools/cmdutils.c | 1 + fftools/ffprobe.c | 1 + libavfilter/Makefile| 1 + libavfilter/avfilter.c | 1 + libavfilter/avfilter.h | 2 +- libavfilter/version.h | 13 ++-- libavfilter/version_major.h | 42 + 7 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 libavfilter/version_major.h diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index d5cadec695..9cceb68412 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -34,6 +34,7 @@ #include "libavformat/avformat.h" #include "libavformat/version.h" #include "libavfilter/avfilter.h" +#include "libavfilter/version.h" #include "libavdevice/avdevice.h" #include "libavdevice/version.h" #include "libswscale/swscale.h" diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index f36397a6ff..48c39d2540 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -60,6 +60,7 @@ #include "libswresample/version.h" #include "libpostproc/postprocess.h" #include "libpostproc/version.h" +#include "libavfilter/version.h" #include "cmdutils.h" #include "libavutil/thread.h" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 56d33e6480..d5fc27a575 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -5,6 +5,7 @@ HEADERS = avfilter.h \ buffersink.h \ buffersrc.h \ version.h \ + version_major.h \ OBJS = allfilters.o \ audio.o \ diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 1f37a70179..859c5b837b 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -43,6 +43,7 @@ #include "formats.h" #include "framepool.h" #include "internal.h" +#include "version.h" #include "libavutil/ffversion.h" const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index b105dc3159..37effcf5cd 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -47,7 +47,7 @@ #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "libavfilter/version.h" +#include "libavfilter/version_major.h" /** * Return the LIBAVFILTER_VERSION_INT constant. diff --git a/libavfilter/version.h b/libavfilter/version.h index 9a890c014f..40fa8d9c47 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -29,7 +29,8 @@ #include "libavutil/version.h" -#define LIBAVFILTER_VERSION_MAJOR 8 +#include "version_major.h" + #define LIBAVFILTER_VERSION_MINOR 27 #define LIBAVFILTER_VERSION_MICRO 100 @@ -44,14 +45,4 @@ #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ - -#define FF_API_SWS_PARAM_OPTION (LIBAVFILTER_VERSION_MAJOR < 9) -#define FF_API_BUFFERSINK_ALLOC (LIBAVFILTER_VERSION_MAJOR < 9) -#define FF_API_PAD_COUNT(LIBAVFILTER_VERSION_MAJOR < 9) - #endif /* AVFILTER_VERSION_H */ diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h new file mode 100644 index 00..de0cf6e979 --- /dev/null +++ b/libavfilter/version_major.h @@ -0,0 +1,42 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VERSION_MAJOR_H +#define AVFILTER_VERSION_MAJOR_H + +/** + * @file + * @ingroup lavfi + * Libavfilter version macros + */ + +#define LIBAVFILTER_VERSION_MAJOR 8 + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#define FF_API_SWS_PARAM_OPTION (LIBAVFILTER_
[FFmpeg-devel] [PATCH v2 8/9] doc: Add an entry to APIchanges about no longer implicitly including version.h
--- doc/APIchanges | 6 ++ 1 file changed, 6 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index ccc4f24b28..365a9747c9 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,12 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-*-* - xx - all libraries + No longer implicitly include lib/version.h in lib/.h. + Users who depend on defines from these files (LIB_VERSION*, + LIB_IDENT) must explicitly include these headers instead of + relying on them being included implicitly. + 2022-03-10 - xx - lavu 57.23.100 - cpu.h Add AV_CPU_FLAG_AVX512ICL. -- 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 v2 9/9] configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. --- configure | 17 +++-- fftools/ffplay.c | 1 + libavcodec/8svx.c | 2 ++ libavcodec/a64multienc.c | 2 ++ libavcodec/aac_ac3_parser.c| 2 ++ libavcodec/aactab.c| 1 + libavcodec/aarch64/h264cmc_neon.S | 2 ++ libavcodec/ac3_parser.c| 1 + libavcodec/ac3dec.c| 2 ++ libavcodec/ac3enc.c| 1 + libavcodec/ac3enc_template.c | 2 ++ libavcodec/adpcm.c | 3 +++ libavcodec/adpcmenc.c | 2 ++ libavcodec/allcodecs.c | 1 + libavcodec/aptxdec.c | 2 ++ libavcodec/aptxenc.c | 2 ++ libavcodec/arm/flacdsp_init_arm.c | 1 + libavcodec/arm/h264cmc_neon.S | 2 ++ libavcodec/assdec.c| 1 + libavcodec/assenc.c| 2 ++ libavcodec/asvdec.c| 1 + libavcodec/asvenc.c| 2 ++ libavcodec/audiotoolboxdec.c | 1 + libavcodec/av1dec.c| 2 ++ libavcodec/binkaudio.c | 2 ++ libavcodec/bintext.c | 2 ++ libavcodec/bsf.c | 1 + libavcodec/cyuv.c | 2 ++ libavcodec/dxva2_av1.c | 2 ++ libavcodec/dxva2_h264.c| 2 ++ libavcodec/dxva2_hevc.c| 2 ++ libavcodec/dxva2_mpeg2.c | 2 ++ libavcodec/dxva2_vc1.c | 2 ++ libavcodec/dxva2_vp9.c | 2 ++ libavcodec/flashsv.c | 2 ++ libavcodec/g726.c | 3 +++ libavcodec/gsmdec.c| 2 ++ libavcodec/h263dec.c | 2 ++ libavcodec/h264_slice.c| 2 ++ libavcodec/h264dec.c | 2 ++ libavcodec/hevcdec.c | 2 ++ libavcodec/huffyuvdec.c| 2 ++ libavcodec/huffyuvenc.c| 2 ++ libavcodec/idctdsp.c | 1 + libavcodec/iff.c | 2 ++ libavcodec/imc.c | 1 + libavcodec/ituh263dec.c| 2 ++ libavcodec/ituh263enc.c| 2 ++ libavcodec/lcldec.c| 2 ++ libavcodec/libgsmdec.c | 1 + libavcodec/libgsmenc.c | 1 + libavcodec/libopencore-amr.c | 2 ++ libavcodec/libvpx.c| 1 + libavcodec/libvpxdec.c | 2 ++ libavcodec/libvpxenc.c | 2 ++ libavcodec/libx264.c | 2 ++ libavcodec/me_cmp.c| 1 + libavcodec/metasound_data.c| 1 + libavcodec/mjpegdec.c | 2 ++ libavcodec/mjpegenc.c | 2 ++ libavcodec/mlpdec.c| 2 ++ libavcodec/mlpenc.c| 2 ++ libavcodec/mpeg12dec.c | 2 ++ libavcodec/mpeg12enc.c | 1 + libavcodec/mpeg4videodec.c | 2 ++ libavcodec/mpegaudiodec_fixed.c| 1 + libavcodec/mpegaudiodec_float.c| 1 + libavcodec/mpegvideo.c | 2 ++ libavcodec/mpegvideo_enc.c | 2 ++ libavcodec/mpegvideo_motion.c | 2 ++ libavcodec/msmpeg4.c | 2 ++ libavcodec/msmpeg4dec.c| 2 ++ libavcodec/mvcdec.c| 2 ++ libavcodec/options.c | 2 ++ libavcodec/opus_pvq.c | 2 ++ libavcodec/pcm.c | 1 + libavcodec/pngdec.c| 2 ++ libavcodec/pnmdec.c| 2 ++ libavcodec/pnmenc.c| 2 ++ libavcodec/proresdec2.c| 2 ++ libavcodec/qpeldsp.c | 1 + libavcodec/r210dec.c | 1 + libavcodec/r210enc.c | 2 ++ libavcodec/rv34_parser.c | 2 ++ libavcodec/sonic.c | 3 +++ libavcodec/sp5xdec.c | 2 ++ libavcodec/speedhq.c | 1 + libavcodec/speedhqenc.c| 2 ++ libavcodec/srtdec.c| 2 ++ libavcodec/srtenc.c| 2 ++ libavcodec/textdec.c | 2 ++ libavcodec/v408dec.c | 2 ++ libavcodec/v408enc.c | 2 ++ libavcodec/vc1dec.c| 2 ++ libavcodec/vc1dsp.c| 2 ++ libavcodec/videotoolbox.c | 1 + libavcodec/vorbis_parser.c | 2 ++ libavcodec/vp3.c | 2 ++ libavcodec/vp56dsp.c | 1 + libavcodec/vp8.c | 2 ++ libavcodec/vp8dsp.c| 2 ++ libavcodec/vp9.c | 2 ++ libavcodec/wmadec.c| 2 ++ libavcodec/wmaenc.c| 2 ++ libavcodec/x86/flacdsp_init.c | 1 + libavcodec/x86/hpeldsp_init.c | 2 ++ libavfilter/aeval.c| 2 ++ libavfilter/af_afade.c | 2 ++ libavfilter/af_agate.c | 2 ++ libavfilter/af_biquads.c | 2 +
[FFmpeg-devel] [PATCH] libavutil/hwcontext_vaapi: Re-enable support for libva v1
Commit e050959103f375e6494937fa28ef2c4d2d15c9ef implemented passing in modifiers by using the PRIME_2 memory type, which only exists in v2 of the library. To still support v1 of the library, conditionally compile using VA_CHECK_VERSION() for both the new code and the old code before the commit. --- libavutil/hwcontext_vaapi.c | 57 - 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 994b744e4d..799490442e 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -1026,7 +1026,12 @@ static void vaapi_unmap_from_drm(AVHWFramesContext *dst_fc, static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, const AVFrame *src, int flags) { +#if VA_CHECK_VERSION(2, 0, 0) VAAPIFramesContext *src_vafc = src_fc->internal->priv; +int use_prime2; +#else +int k; +#endif AVHWFramesContext *dst_fc = (AVHWFramesContext*)dst->hw_frames_ctx->data; AVVAAPIDeviceContext *dst_dev = dst_fc->device_ctx->hwctx; @@ -1034,10 +1039,28 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, const VAAPIFormatDescriptor *format_desc; VASurfaceID surface_id; VAStatus vas = VA_STATUS_SUCCESS; -int use_prime2; uint32_t va_fourcc; int err, i, j; +#if !VA_CHECK_VERSION(2, 0, 0) +unsigned long buffer_handle; +VASurfaceAttribExternalBuffers buffer_desc; +VASurfaceAttrib attrs[2] = { +{ +.type = VASurfaceAttribMemoryType, +.flags = VA_SURFACE_ATTRIB_SETTABLE, +.value.type= VAGenericValueTypeInteger, +.value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME, +}, +{ +.type = VASurfaceAttribExternalBufferDescriptor, +.flags = VA_SURFACE_ATTRIB_SETTABLE, +.value.type= VAGenericValueTypePointer, +.value.value.p = &buffer_desc, +} +}; +#endif + desc = (AVDRMFrameDescriptor*)src->data[0]; if (desc->nb_objects != 1) { @@ -1072,6 +1095,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, format_desc = vaapi_format_from_fourcc(va_fourcc); av_assert0(format_desc); +#if VA_CHECK_VERSION(2, 0, 0) use_prime2 = !src_vafc->prime_2_import_unsupported && desc->objects[0].format_modifier != DRM_FORMAT_MOD_INVALID; if (use_prime2) { @@ -1183,6 +1207,37 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, &surface_id, 1, buffer_attrs, FF_ARRAY_ELEMS(buffer_attrs)); } +#else +buffer_handle = desc->objects[0].fd; +buffer_desc.pixel_format = va_fourcc; +buffer_desc.width= src_fc->width; +buffer_desc.height = src_fc->height; +buffer_desc.data_size= desc->objects[0].size; +buffer_desc.buffers = &buffer_handle; +buffer_desc.num_buffers = 1; +buffer_desc.flags= 0; + +k = 0; +for (i = 0; i < desc->nb_layers; i++) { +for (j = 0; j < desc->layers[i].nb_planes; j++) { +buffer_desc.pitches[k] = desc->layers[i].planes[j].pitch; +buffer_desc.offsets[k] = desc->layers[i].planes[j].offset; +++k; +} +} +buffer_desc.num_planes = k; + +if (format_desc->chroma_planes_swapped && +buffer_desc.num_planes == 3) { +FFSWAP(uint32_t, buffer_desc.pitches[1], buffer_desc.pitches[2]); +FFSWAP(uint32_t, buffer_desc.offsets[1], buffer_desc.offsets[2]); +} + +vas = vaCreateSurfaces(dst_dev->display, format_desc->rt_format, + src->width, src->height, + &surface_id, 1, + attrs, FF_ARRAY_ELEMS(attrs)); +#endif if (vas != VA_STATUS_SUCCESS) { av_log(dst_fc, AV_LOG_ERROR, "Failed to create surface from DRM " "object: %d (%s).\n", vas, vaErrorStr(vas)); -- 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 v2] avcodec/pngenc: support writing iCCP chunks
On Fri, 11 Mar 2022 12:05:13 +0100 Andreas Rheinhardt wrote: > Niklas Haas: > > On Fri, 11 Mar 2022 11:17:42 +0100 Niklas Haas wrote: > >> Oops. `-c copy` doesn't actually test the PNG writing code. Need to use > >> `-c png` instead. Fixed in v2. > > > > Hmm, actually, even this doesn't work. I can comment out the iCCP > > writing code and the iCCP chunk still gets written, somehow. Even though > > the file hash is different from the `-c copy` case! > > > > Any idea how to force a re-encode? > > What makes you believe that an iCCP chunk gets written? Is it the size > of the framecrc output? The reason for this is that this is the output > of the decoded png frame and not the hash of the demuxed packet or the > output file. The latter is included in the > +7e412f6a9e2c7fcb674336e5c104518d *tests/data/fate/png-icc.image2. > Comparing +49398 tests/data/fate/png-icc.image2 and the relevant line > from V1 shows that there is indeed more output. > You could use -c copy on the encoded file; and you can also use ffprobe > to directly inspect the side data. > > - Andreas I was running the ffmpeg command (as printed by `make fate-png-icc V=1`) directly and using `exiftool` to look at the png-icc.image2 file it wrote. But it looks as though I accidentally ran the `-c copy` command twice during testing. With the `-c png`, the iCCP chunk is written by the new code, as intended. So never mind this comment. V2 appears to be testing correctly. ___ 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 v2] avcodec/pngenc: support writing iCCP chunks
On Fri, 11 Mar 2022 12:18:13 +0100 Andreas Rheinhardt wrote: > 1. This is not how should work with an AVBPrint -- you are throwing the > small-string optimization away here. Noted, though consider: many ICC profiles used in practice are small enough to fit inside the 1000 byte buffer. Especially the (absurdly common) case of an embedded sRGB profile. As an example, exporting a blank image in GIMP to PNG using the default settings produces a file with a 388-byte deflate compressed iCCP chunk. But I don't think this is performance critical enough to warrant skipping the `malloc` call, and it's definitely to allocate once than re-allocate in a loop. > 2. Using an AVBPrint with its dynamic reallocations is probably not good > here at all: It is easy to get a good upper bound via deflateBound() > which allows to omit the reallocations/the loop. (I should probably have > applied This is a good idea. I didn't realize this existed. I'll switch to using this function. ___ 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 v7 09/10] qsv: use a new method to create mfx session when using oneVPL
On Fri, 2022-03-11 at 09:35 +0100, Hendrik Leppkes wrote: > On Fri, Mar 11, 2022 at 9:18 AM Xiang, Haihao > wrote: > > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > > index 8ab96bad25..e0e820f164 100644 > > --- a/libavutil/hwcontext_d3d11va.c > > +++ b/libavutil/hwcontext_d3d11va.c > > @@ -525,6 +525,13 @@ static void d3d11va_device_uninit(AVHWDeviceContext > > *hwdev) > > } > > } > > > > +static void d3d11va_device_free(AVHWDeviceContext *ctx) > > +{ > > +AVD3D11VADeviceContext *hwctx = ctx->hwctx; > > + > > +av_free(hwctx->device_name); > > +} > > + > > static int d3d11va_device_create(AVHWDeviceContext *ctx, const char > > *device, > > AVDictionary *opts, int flags) > > { > > @@ -537,6 +544,8 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, > > const char *device, > > int is_debug = !!av_dict_get(opts, "debug", NULL, 0); > > int ret; > > > > +ctx->free = d3d11va_device_free; > > + > > // (On UWP we can't check this.) > > #if !HAVE_UWP > > if (!LoadLibrary("d3d11_1sdklayers.dll")) > > @@ -561,6 +570,10 @@ static int d3d11va_device_create(AVHWDeviceContext > > *ctx, const char *device, > > if (FAILED(IDXGIFactory2_EnumAdapters(pDXGIFactory, adapter, > > &pAdapter))) > > pAdapter = NULL; > > IDXGIFactory2_Release(pDXGIFactory); > > + > > +device_hwctx->device_name = av_strdup(device); > > +if (!device_hwctx->device_name) > > +return AVERROR(ENOMEM); > > } > > } > > > > diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h > > index 77d2d72f1b..41a315b9e6 100644 > > --- a/libavutil/hwcontext_d3d11va.h > > +++ b/libavutil/hwcontext_d3d11va.h > > @@ -94,6 +94,11 @@ typedef struct AVD3D11VADeviceContext { > > void (*lock)(void *lock_ctx); > > void (*unlock)(void *lock_ctx); > > void *lock_ctx; > > + > > +/** > > + * The string for the used adapter > > + */ > > +char *device_name; > > } AVD3D11VADeviceContext; > > > > /** > > diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c > > index 53d00fa815..6967357093 100644 > > --- a/libavutil/hwcontext_dxva2.c > > +++ b/libavutil/hwcontext_dxva2.c > > @@ -431,6 +431,7 @@ static void dxva2_device_free(AVHWDeviceContext *ctx) > > dlclose(priv->dxva2lib); > > > > av_freep(&ctx->user_opaque); > > +av_free(hwctx->device_name); > > } > > > > static int dxva2_device_create9(AVHWDeviceContext *ctx, UINT adapter) > > @@ -571,6 +572,13 @@ static int dxva2_device_create(AVHWDeviceContext *ctx, > > const char *device, > > return AVERROR_UNKNOWN; > > } > > > > +if (device) { > > +hwctx->device_name = av_strdup(device); > > + > > +if (!hwctx->device_name) > > +return AVERROR(ENOMEM); > > +} > > + > > return 0; > > } > > > > diff --git a/libavutil/hwcontext_dxva2.h b/libavutil/hwcontext_dxva2.h > > index e1b79bc0de..253ddbed51 100644 > > --- a/libavutil/hwcontext_dxva2.h > > +++ b/libavutil/hwcontext_dxva2.h > > @@ -38,6 +38,10 @@ > > */ > > typedef struct AVDXVA2DeviceContext { > > IDirect3DDeviceManager9 *devmgr; > > +/** > > + * The string for the used adapter > > + */ > > +char *device_name; > > } AVDXVA2DeviceContext; > > > > /** > > Why are these device names required? I would think deriving a child > device would use the actual device, eg. ID3D11Device or > IDirect3DDeviceManager9 (and whatever for VAAPI), and not some string > (that may or may not even be set). > It feels quite a bit icky to store these in the context just for qsv > to do... what with? Yes, it is a little ugly here. MediaSDK or oneVPL application creates mfx session and the device (dxva2, d3d11va or vaapi), then pass this device to the SDK through MFXVideoCORE_SetHandle(). implementation is introduced in oneVPL ( 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. 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 v8 1/1] avformat: Add IPFS protocol support.
On Wed, Mar 9, 2022 at 10:36 AM Michael Niedermayer wrote: > On Wed, Mar 09, 2022 at 01:30:30AM +0100, Mark Gaiser wrote: > > On Wed, Mar 9, 2022 at 12:45 AM Michael Niedermayer < > mich...@niedermayer.cc> > > wrote: > > > > > On Tue, Mar 08, 2022 at 01:49:22PM +0100, Mark Gaiser wrote: > > > > On Fri, Mar 4, 2022 at 7:09 PM Michael Niedermayer < > > > mich...@niedermayer.cc> > > > > wrote: > > > > > > > > > On Thu, Mar 03, 2022 at 03:58:53PM +0100, Mark Gaiser wrote: > > > > > > On Tue, Mar 1, 2022 at 11:01 PM Michael Niedermayer < > > > > > mich...@niedermayer.cc> > > > > > > wrote: > > > > > > > > > > > > > On Mon, Feb 28, 2022 at 02:09:15PM +0100, Tomas Härdin wrote: > > > > > > > > sön 2022-02-27 klockan 15:29 +0100 skrev Mark Gaiser: > > > > > > > > > Ping 2 > > > > > > > > > > > > > > > > > > I'd really like to get this merged! > > > > > > > > > This kinda blocks me right now from proceeding with IPFS > > > > > integration > > > > > > > > > in > > > > > > > > > Kodi, MPV and VLC. Implementations in those (who rely on > > > ffmpeg) > > > > > are > > > > > > > > > significantly easier once this patch is finally landed in > > > ffmpeg. > > > > > > > > > > > > > > > > I'd like to hear at least one other dev chime in on this one > > > > > > > > > > > > > > what exactly are you not sure about ? > > > > > > > what exactly needs a 2nd look ? > > > > > > > > > > > > > > > > > > > My assumption. > > > > > > In general just a second look by someone other than Tomas. > > > > > > And, as he was skeptical about this patch at first, likely > another > > > > > opinion > > > > > > if this makes sense to add in ffmpeg. > > > > > > To me it does very much but i'm biased :) > > > > > > > > > > ipfs support makes sense to be added to ffmpeg. ive seen ipfs urls > and > > > ive > > > > > already been annoyed that some tools dont "just" work with them. > > > > > While if i compare this to many other formats which i have never > seen > > > > > outside the context of FFmpeg. So from this biased single sample > that i > > > > > am, ipfs seems more widespread and thats why iam in favor of its > > > support > > > > > > > > > > thx > > > > > > > > > > Great to have your support :) > > > > Reading that is quite motivating to work on it, no joke! > > > > > > > > Just to be clear here. Having this in ffmpeg won't make it "just > work" > > > yet. > > > > For a minimal feeling of "hey, it works out of the box" you'd need: > > > > - The next or version after the next IPFS. > > > > - MPV support which relies on this patch to even be supported in mpv > > > > - Have a node running locally > > > > > > if theres no local node it should fallback to a public node > > > ATM > > > IPFS_GATEWAY=https://dweb.link ./ffplay ipfs://... > > > works > > > so such a fallback is all thats needed for it to just work > > > > > > > Yes, the beauty of gateways. > > > > Are you suggesting that I update the patch to add this default? > > Iam not sure > > > > I would prefer not to add that even though it would give a feeling of > "just > > works". > > > I'm mostly concerned about the bandwidth usage it could cause on that > site. > > you could add more than one > you could point people to https://ipfs.io/ipns/ipnso.com/ to let them > select > their own or maybe theres a better way > > > > But also about potential hacks. If this is a default and well used then > it > > becomes quite appealing for hackers to take control of dweb.link and send > > back data that wasn't requested. > > Thats a valid concern but not adding a default is not really solving this > Because what do most people do then ? > They google for a gateway and pick the first that works. > Thats plausibly not going to give them the fastest nor the most secure nor > even not the same as the last million people searching. > > To setup a ipfs node on ones own machiene, first it would be needed that > this > is VERY simple and clean > if i run "apt search ipfs", theres none, so that already fails here > but for the fun, i tried to search for ipfs node on the app store on my > iphone > no, also nothing. > > so i dont think "install an ipfs node" is really a viable solution for the > average joe. > > we have a wide range of platforms, linux, windows, android, ios just to > name > the major ones. This protocol should work on all of them. > I think a default gateway is the easy way to make that happen, asking the > user to set a gateway will already leave android and iphone users probably > wondering how to do that. Is there a way ? > > So really iam not saying "add a default", iam really saying "make it work > for everyone", its ok if the user has to choose one or set some default but > it really has to work on all platforms and with all user apps using > libavformat. It should not be specific to mpv or windows/linux > > you can also print a big nasty warning that a default is used and the user > should really setup their own node and why that is better. > Sorry for the belayed response but i had
[FFmpeg-devel] [PATCH v3 9/9] configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. --- Patchwork notified me that the previous round failed building libavdevice/alsa.c due to missing an include of the new header. I now did grepping for constants like CONFIG_.*{MUXER|CODER|...} to find other files that might need including that header. Now there should be much less risk of breaking things in configs with components I haven't tested. --- configure | 17 +++-- fftools/ffplay.c| 1 + libavcodec/8svx.c | 2 ++ libavcodec/a64multienc.c| 2 ++ libavcodec/aac_ac3_parser.c | 2 ++ libavcodec/aactab.c | 1 + libavcodec/aarch64/h264cmc_neon.S | 2 ++ libavcodec/ac3_parser.c | 1 + libavcodec/ac3dec.c | 2 ++ libavcodec/ac3dec_float.c | 3 +++ libavcodec/ac3enc.c | 1 + libavcodec/ac3enc_template.c| 2 ++ libavcodec/adpcm.c | 3 +++ libavcodec/adpcmenc.c | 2 ++ libavcodec/allcodecs.c | 1 + libavcodec/amfenc.c | 1 + libavcodec/aptxdec.c| 2 ++ libavcodec/aptxenc.c| 2 ++ libavcodec/arm/flacdsp_init_arm.c | 1 + libavcodec/arm/h264cmc_neon.S | 2 ++ libavcodec/assdec.c | 1 + libavcodec/assenc.c | 2 ++ libavcodec/asvdec.c | 1 + libavcodec/asvenc.c | 2 ++ libavcodec/audiotoolboxdec.c| 1 + libavcodec/av1dec.c | 2 ++ libavcodec/binkaudio.c | 2 ++ libavcodec/bintext.c| 2 ++ libavcodec/bsf.c| 1 + libavcodec/crystalhd.c | 2 ++ libavcodec/cuviddec.c | 2 ++ libavcodec/cyuv.c | 2 ++ libavcodec/dxva2_av1.c | 2 ++ libavcodec/dxva2_h264.c | 2 ++ libavcodec/dxva2_hevc.c | 2 ++ libavcodec/dxva2_mpeg2.c| 2 ++ libavcodec/dxva2_vc1.c | 2 ++ libavcodec/dxva2_vp9.c | 2 ++ libavcodec/flashsv.c| 2 ++ libavcodec/g726.c | 3 +++ libavcodec/gsmdec.c | 2 ++ libavcodec/h263dec.c| 2 ++ libavcodec/h264_slice.c | 2 ++ libavcodec/h264dec.c| 2 ++ libavcodec/hevcdec.c| 2 ++ libavcodec/huffyuvdec.c | 2 ++ libavcodec/huffyuvenc.c | 2 ++ libavcodec/idctdsp.c| 1 + libavcodec/iff.c| 2 ++ libavcodec/imc.c| 1 + libavcodec/ituh263dec.c | 2 ++ libavcodec/ituh263enc.c | 2 ++ libavcodec/lcldec.c | 2 ++ libavcodec/libgsmdec.c | 1 + libavcodec/libgsmenc.c | 1 + libavcodec/libopencore-amr.c| 2 ++ libavcodec/libvpx.c | 1 + libavcodec/libvpxdec.c | 2 ++ libavcodec/libvpxenc.c | 2 ++ libavcodec/libx264.c| 2 ++ libavcodec/me_cmp.c | 1 + libavcodec/mediacodecdec.c | 2 ++ libavcodec/metasound_data.c | 1 + libavcodec/mjpegdec.c | 2 ++ libavcodec/mjpegenc.c | 2 ++ libavcodec/mlpdec.c | 2 ++ libavcodec/mlpenc.c | 2 ++ libavcodec/mpeg12dec.c | 2 ++ libavcodec/mpeg12enc.c | 1 + libavcodec/mpeg4videodec.c | 2 ++ libavcodec/mpegaudiodec_fixed.c | 1 + libavcodec/mpegaudiodec_float.c | 1 + libavcodec/mpegaudiodec_template.c | 2 ++ libavcodec/mpegvideo.c | 2 ++ libavcodec/mpegvideo_enc.c | 2 ++ libavcodec/mpegvideo_motion.c | 2 ++ libavcodec/msmpeg4.c| 2 ++ libavcodec/msmpeg4dec.c | 2 ++ libavcodec/mvcdec.c | 2 ++ libavcodec/nvdec.c | 1 + libavcodec/nvdec_mjpeg.c| 2 ++ libavcodec/nvdec_mpeg12.c | 2 ++ libavcodec/nvdec_vc1.c | 2 ++ libavcodec/nvenc.c | 1 + libavcodec/options.c| 2 ++ libavcodec/options_table.h | 2 ++ libavcodec/opus_pvq.c | 2 ++ libavcodec/pcm.c| 1 + libavcodec/pngdec.c | 2 ++ libavcodec/pnmdec.c | 2 ++ libavcodec/pnmenc.c | 2 ++ libavcodec/proresdec2.c | 2 ++ libavcodec/qpeldsp.c| 1 + libavcodec/qsvdec.c | 2 ++ libavcodec/qsvenc.c | 2 ++ libavcodec/r210dec.c| 1 + libavcodec/r210enc.c| 2 ++ libavcodec/rv34_parser.c| 2 ++ libavcodec/sonic.c | 3 +++ libavcodec/sp5xdec.c
Re: [FFmpeg-devel] [PATCH 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Fix below error message when timecode packet is written. > "Application provided duration: -9223372036854775808 / timestamp: > -9223372036854775808 is out of range for mov/mp4 format" > > try to reproduce by: > ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 test.mov > > Note although error message is printed, the timecode packet will be written > anyway. So > the patch 2/2 will try to change the log level to warning. > > The first two test case of fate-lavf-ismv have timecode setting, so the crc > of ref data is different. > Fixes ticket #9488 > > Signed-off-by: Limin Wang > --- > libavformat/movenc.c | 2 ++ > tests/ref/lavf/ismv | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index 4c86891..74b94cd 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -6383,6 +6383,8 @@ static int mov_create_timecode_track(AVFormatContext > *s, int index, int src_inde > pkt->data = data; > pkt->stream_index = index; > pkt->flags = AV_PKT_FLAG_KEY; > +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), > (AVRational){1,mov->movie_timescale}); > +pkt->duration = av_rescale_q(1, av_inv_q(rate), > (AVRational){1,mov->movie_timescale}); > pkt->size = 4; > AV_WB32(pkt->data, tc.start); > ret = ff_mov_write_packet(s, pkt); > diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv > index ac7f72b..723b432 100644 > --- a/tests/ref/lavf/ismv > +++ b/tests/ref/lavf/ismv > @@ -1,7 +1,7 @@ > -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv > +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv > 313169 tests/data/lavf/lavf.ismv > tests/data/lavf/lavf.ismv CRC=0x9d9a638a > -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv > +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv > 322075 tests/data/lavf/lavf.ismv > tests/data/lavf/lavf.ismv CRC=0xe8130120 > 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv > -- > 1.8.3.1 > will apply the patch set tomorrow unless there are any objections. -- Thanks, Limin Wang ___ 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 v7 09/10] qsv: use a new method to create mfx session when using oneVPL
On Fri, Mar 11, 2022 at 2:43 PM Xiang, Haihao wrote: > > On Fri, 2022-03-11 at 09:35 +0100, Hendrik Leppkes wrote: > > On Fri, Mar 11, 2022 at 9:18 AM Xiang, Haihao > > wrote: > > > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > > > index 8ab96bad25..e0e820f164 100644 > > > --- a/libavutil/hwcontext_d3d11va.c > > > +++ b/libavutil/hwcontext_d3d11va.c > > > @@ -525,6 +525,13 @@ static void d3d11va_device_uninit(AVHWDeviceContext > > > *hwdev) > > > } > > > } > > > > > > +static void d3d11va_device_free(AVHWDeviceContext *ctx) > > > +{ > > > +AVD3D11VADeviceContext *hwctx = ctx->hwctx; > > > + > > > +av_free(hwctx->device_name); > > > +} > > > + > > > static int d3d11va_device_create(AVHWDeviceContext *ctx, const char > > > *device, > > > AVDictionary *opts, int flags) > > > { > > > @@ -537,6 +544,8 @@ static int d3d11va_device_create(AVHWDeviceContext > > > *ctx, > > > const char *device, > > > int is_debug = !!av_dict_get(opts, "debug", NULL, 0); > > > int ret; > > > > > > +ctx->free = d3d11va_device_free; > > > + > > > // (On UWP we can't check this.) > > > #if !HAVE_UWP > > > if (!LoadLibrary("d3d11_1sdklayers.dll")) > > > @@ -561,6 +570,10 @@ static int d3d11va_device_create(AVHWDeviceContext > > > *ctx, const char *device, > > > if (FAILED(IDXGIFactory2_EnumAdapters(pDXGIFactory, adapter, > > > &pAdapter))) > > > pAdapter = NULL; > > > IDXGIFactory2_Release(pDXGIFactory); > > > + > > > +device_hwctx->device_name = av_strdup(device); > > > +if (!device_hwctx->device_name) > > > +return AVERROR(ENOMEM); > > > } > > > } > > > > > > diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h > > > index 77d2d72f1b..41a315b9e6 100644 > > > --- a/libavutil/hwcontext_d3d11va.h > > > +++ b/libavutil/hwcontext_d3d11va.h > > > @@ -94,6 +94,11 @@ typedef struct AVD3D11VADeviceContext { > > > void (*lock)(void *lock_ctx); > > > void (*unlock)(void *lock_ctx); > > > void *lock_ctx; > > > + > > > +/** > > > + * The string for the used adapter > > > + */ > > > +char *device_name; > > > } AVD3D11VADeviceContext; > > > > > > /** > > > diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c > > > index 53d00fa815..6967357093 100644 > > > --- a/libavutil/hwcontext_dxva2.c > > > +++ b/libavutil/hwcontext_dxva2.c > > > @@ -431,6 +431,7 @@ static void dxva2_device_free(AVHWDeviceContext *ctx) > > > dlclose(priv->dxva2lib); > > > > > > av_freep(&ctx->user_opaque); > > > +av_free(hwctx->device_name); > > > } > > > > > > static int dxva2_device_create9(AVHWDeviceContext *ctx, UINT adapter) > > > @@ -571,6 +572,13 @@ static int dxva2_device_create(AVHWDeviceContext > > > *ctx, > > > const char *device, > > > return AVERROR_UNKNOWN; > > > } > > > > > > +if (device) { > > > +hwctx->device_name = av_strdup(device); > > > + > > > +if (!hwctx->device_name) > > > +return AVERROR(ENOMEM); > > > +} > > > + > > > return 0; > > > } > > > > > > diff --git a/libavutil/hwcontext_dxva2.h b/libavutil/hwcontext_dxva2.h > > > index e1b79bc0de..253ddbed51 100644 > > > --- a/libavutil/hwcontext_dxva2.h > > > +++ b/libavutil/hwcontext_dxva2.h > > > @@ -38,6 +38,10 @@ > > > */ > > > typedef struct AVDXVA2DeviceContext { > > > IDirect3DDeviceManager9 *devmgr; > > > +/** > > > + * The string for the used adapter > > > + */ > > > +char *device_name; > > > } AVDXVA2DeviceContext; > > > > > > /** > > > > Why are these device names required? I would think deriving a child > > device would use the actual device, eg. ID3D11Device or > > IDirect3DDeviceManager9 (and whatever for VAAPI), and not some string > > (that may or may not even be set). > > It feels quite a bit icky to store these in the context just for qsv > > to do... what with? > > Yes, it is a little ugly here. MediaSDK or oneVPL application creates mfx > session and the device (dxva2, d3d11va or vaapi), then pass this device to the > SDK through MFXVideoCORE_SetHandle(). implementation is introduced in oneVPL ( > 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 th
Re: [FFmpeg-devel] [PATCH 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
lance.lmw...@gmail.com: > On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: >> From: Limin Wang >> >> Fix below error message when timecode packet is written. >> "Application provided duration: -9223372036854775808 / timestamp: >> -9223372036854775808 is out of range for mov/mp4 format" >> >> try to reproduce by: >> ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 test.mov >> >> Note although error message is printed, the timecode packet will be written >> anyway. So >> the patch 2/2 will try to change the log level to warning. >> >> The first two test case of fate-lavf-ismv have timecode setting, so the crc >> of ref data is different. >> Fixes ticket #9488 >> >> Signed-off-by: Limin Wang >> --- >> libavformat/movenc.c | 2 ++ >> tests/ref/lavf/ismv | 4 ++-- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/libavformat/movenc.c b/libavformat/movenc.c >> index 4c86891..74b94cd 100644 >> --- a/libavformat/movenc.c >> +++ b/libavformat/movenc.c >> @@ -6383,6 +6383,8 @@ static int mov_create_timecode_track(AVFormatContext >> *s, int index, int src_inde >> pkt->data = data; >> pkt->stream_index = index; >> pkt->flags = AV_PKT_FLAG_KEY; >> +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), >> (AVRational){1,mov->movie_timescale}); >> +pkt->duration = av_rescale_q(1, av_inv_q(rate), >> (AVRational){1,mov->movie_timescale}); >> pkt->size = 4; >> AV_WB32(pkt->data, tc.start); >> ret = ff_mov_write_packet(s, pkt); >> diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv >> index ac7f72b..723b432 100644 >> --- a/tests/ref/lavf/ismv >> +++ b/tests/ref/lavf/ismv >> @@ -1,7 +1,7 @@ >> -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv >> +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv >> 313169 tests/data/lavf/lavf.ismv >> tests/data/lavf/lavf.ismv CRC=0x9d9a638a >> -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv >> +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv >> 322075 tests/data/lavf/lavf.ismv >> tests/data/lavf/lavf.ismv CRC=0xe8130120 >> 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv >> -- >> 1.8.3.1 >> > > will apply the patch set tomorrow unless there are any objections. > You have not really answered whether the current files or the new files are spec-incompliant; you have just reported that one byte is different. - 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] movenc: Use LIBAVFORMAT_IDENT instead of LIBAVCODEC_IDENT
The muxer seems to have had one seemingly accidental use of LIBAVCODEC_IDENT, while LIBAVFORMAT_IDENT probably is the relevant one (which is used multiple times in the same file). Signed-off-by: Martin Storsjö --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 4c868919ae..a2c2145354 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4108,7 +4108,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) avio_wb16(pb, 0x021C); /* data */ if (!(s->flags & AVFMT_FLAG_BITEXACT)) -mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); +mov_write_psp_udta_tag(pb, LIBAVFORMAT_IDENT, "eng", 0x04); mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03); -- 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 v2 5/5] avcodec/x86/hevc_mc: add qpel_h64_8_avx512icl
All 5/5 LGTM. ___ 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/2] avcodec/flashsv: Avoid copying packet
Signed-off-by: Andreas Rheinhardt --- libavcodec/flashsv.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 00f77f4902..5f0bc0c6df 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -44,7 +44,7 @@ #include "internal.h" typedef struct BlockInfo { -uint8_t *pos; +const uint8_t *pos; int size; } BlockInfo; @@ -59,7 +59,8 @@ typedef struct FlashSVContext { int ver; const uint32_t *pal; int is_keyframe; -uint8_t*keyframedata; +const uint8_t *keyframedata; +AVBufferRef*keyframedata_buf; uint8_t*keyframe; BlockInfo *blocks; uint8_t*deflate_block; @@ -138,7 +139,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx) return 0; } -static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size) +static int flashsv2_prime(FlashSVContext *s, const uint8_t *src, int size) { z_stream zs; int zret; // Zlib return code @@ -355,10 +356,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, /* we care for keyframes only in Screen Video v2 */ s->is_keyframe = (avpkt->flags & AV_PKT_FLAG_KEY) && (s->ver == 2); if (s->is_keyframe) { -int err; -if ((err = av_reallocp(&s->keyframedata, avpkt->size)) < 0) +int err = av_buffer_replace(&s->keyframedata_buf, avpkt->buf); +if (err < 0) return err; -memcpy(s->keyframedata, avpkt->data, avpkt->size); +s->keyframedata = avpkt->data; } if(s->ver == 2 && !s->blocks) s->blocks = av_mallocz((v_blocks + !!v_part) * (h_blocks + !!h_part) * @@ -566,7 +567,7 @@ static av_cold int flashsv2_decode_end(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; -av_freep(&s->keyframedata); +av_buffer_unref(&s->keyframedata_buf); av_freep(&s->blocks); av_freep(&s->keyframe); av_freep(&s->deflate_block); -- 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 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
On Fri, Mar 11, 2022 at 03:04:32PM +0100, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: > >> From: Limin Wang > >> > >> Fix below error message when timecode packet is written. > >> "Application provided duration: -9223372036854775808 / timestamp: > >> -9223372036854775808 is out of range for mov/mp4 format" > >> > >> try to reproduce by: > >> ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 test.mov > >> > >> Note although error message is printed, the timecode packet will be > >> written anyway. So > >> the patch 2/2 will try to change the log level to warning. > >> > >> The first two test case of fate-lavf-ismv have timecode setting, so the > >> crc of ref data is different. > >> Fixes ticket #9488 > >> > >> Signed-off-by: Limin Wang > >> --- > >> libavformat/movenc.c | 2 ++ > >> tests/ref/lavf/ismv | 4 ++-- > >> 2 files changed, 4 insertions(+), 2 deletions(-) > >> > >> diff --git a/libavformat/movenc.c b/libavformat/movenc.c > >> index 4c86891..74b94cd 100644 > >> --- a/libavformat/movenc.c > >> +++ b/libavformat/movenc.c > >> @@ -6383,6 +6383,8 @@ static int mov_create_timecode_track(AVFormatContext > >> *s, int index, int src_inde > >> pkt->data = data; > >> pkt->stream_index = index; > >> pkt->flags = AV_PKT_FLAG_KEY; > >> +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), > >> (AVRational){1,mov->movie_timescale}); > >> +pkt->duration = av_rescale_q(1, av_inv_q(rate), > >> (AVRational){1,mov->movie_timescale}); > >> pkt->size = 4; > >> AV_WB32(pkt->data, tc.start); > >> ret = ff_mov_write_packet(s, pkt); > >> diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv > >> index ac7f72b..723b432 100644 > >> --- a/tests/ref/lavf/ismv > >> +++ b/tests/ref/lavf/ismv > >> @@ -1,7 +1,7 @@ > >> -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv > >> +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv > >> 313169 tests/data/lavf/lavf.ismv > >> tests/data/lavf/lavf.ismv CRC=0x9d9a638a > >> -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv > >> +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv > >> 322075 tests/data/lavf/lavf.ismv > >> tests/data/lavf/lavf.ismv CRC=0xe8130120 > >> 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv > >> -- > >> 1.8.3.1 > >> > > > > will apply the patch set tomorrow unless there are any objections. > > > > You have not really answered whether the current files or the new files > are spec-incompliant; you have just reported that one byte is different. Sorry, I think I have said both current and new file is spec-compliant in the last email. By Quicktime file format specs: Section Timecode Sample Description, all tmcd field isn't used pts/dts. As for where is the different for one byte, it's caused by pkt->duration. The old is 0(uninitialized), after the patch it's 33(1 frame duration). > > - 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". -- Thanks, Limin Wang ___ 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/2] avcodec/flashsv: Avoid deflating data
Currently priming the zlib decompressor involves compressing data directly after having decompressed it and decompressing it again in order to set the "dictionary" and to initialize the adler32-checksum. Yet this is wasteful and can be simplified by synthetizing the compressed data via non-compressed blocks. This reduced the amount of allocations for the decoding part of fate-vsynth1-flashsv2, namely from total heap usage: 9,135 allocs, 9,135 frees, 376,503,427 bytes allocated to total heap usage: 2,373 allocs, 2,373 frees, 14,144,083 bytes allocated Signed-off-by: Andreas Rheinhardt --- Unfortunately one can't simply use inflateSetDictionary() to set the dictionary, as this does not initialize the adler32-checksum. More precisely, the main adler32 does not cover the dictionary data; so it would decode correctly, but one would get checksum errors. Notice that I do not have a single flashsv2 file that has not been created by our encoder and it might be that our encoder is wrong. Looking at the mailing list archive showed lots of mails that complain about the paucacity of samples. The spec simply speaks of "the ZLIB priming technique of compression". How very helpful. libavcodec/flashsv.c | 89 +++- 1 file changed, 38 insertions(+), 51 deletions(-) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 5f0bc0c6df..e284439972 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -63,11 +63,10 @@ typedef struct FlashSVContext { AVBufferRef*keyframedata_buf; uint8_t*keyframe; BlockInfo *blocks; -uint8_t*deflate_block; -int deflate_block_size; int color_depth; int zlibprime_curr, zlibprime_prev; int diff_start, diff_height; +uint8_t tmp[UINT16_MAX]; } FlashSVContext; static int decode_hybrid(const uint8_t *sptr, const uint8_t *sptr_end, uint8_t *dptr, int dx, int dy, @@ -141,41 +140,59 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx) static int flashsv2_prime(FlashSVContext *s, const uint8_t *src, int size) { -z_stream zs; int zret; // Zlib return code +static const uint8_t zlib_header[] = { 0x78, 0x01 }; +uint8_t *data = s->tmpblock; +unsigned remaining; if (!src) return AVERROR_INVALIDDATA; -zs.zalloc = NULL; -zs.zfree = NULL; -zs.opaque = NULL; - s->zstream.next_in = src; s->zstream.avail_in = size; -s->zstream.next_out = s->tmpblock; +s->zstream.next_out = data; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); - -if (deflateInit(&zs, 0) != Z_OK) -return -1; -zs.next_in = s->tmpblock; -zs.avail_in = s->block_size * 3 - s->zstream.avail_out; -zs.next_out = s->deflate_block; -zs.avail_out = s->deflate_block_size; -deflate(&zs, Z_SYNC_FLUSH); -deflateEnd(&zs); +remaining = s->block_size * 3 - s->zstream.avail_out; if ((zret = inflateReset(&s->zstream)) != Z_OK) { av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return AVERROR_UNKNOWN; } -s->zstream.next_in = s->deflate_block; -s->zstream.avail_in = s->deflate_block_size - zs.avail_out; -s->zstream.next_out = s->tmpblock; -s->zstream.avail_out = s->block_size * 3; +/* Create input for zlib that is equivalent to encoding the output + * from above and decoding it again (the net result of this is that + * the dictionary of past decoded data is correctly primed and + * the adler32 checksum is correctly initialized). + * This is accomplished by synthetizing blocks of uncompressed data + * out of the output from above. See section 3.2.4 of RFC 1951. */ +s->zstream.next_in = zlib_header; +s->zstream.avail_in = sizeof(zlib_header); inflate(&s->zstream, Z_SYNC_FLUSH); +while (remaining > 0) { +unsigned block_size = FFMIN(UINT16_MAX, remaining); +uint8_t header[5]; +/* Bit 0: Non-last-block, bits 1-2: BTYPE for uncompressed block */ +header[0] = 0; +/* Block size */ +AV_WL16(header + 1, block_size); +/* Block size (one's complement) */ +AV_WL16(header + 3, block_size ^ 0x); +s->zstream.next_in = header; +s->zstream.avail_in = sizeof(header); +s->zstream.next_out = s->tmp; +s->zstream.avail_out = sizeof(s->tmp); +zret = inflate(&s->zstream, Z_SYNC_FLUSH); +if (zret != Z_OK) +return AVERROR_UNKNOWN; +s->zstream.next_in = data; +s->zstream.avail_in = block_size; +zret = inflate(&s->zstream, Z_SYNC_FLUSH); +if (zret != Z_OK) +return AVERROR_UNKNOWN; +data += block_size; +remaining -= block_size; +} return 0; } @@ -248,22 +265,6 @@ static int flashsv_decode_block(AVCodecContext *avctx, const AV
Re: [FFmpeg-devel] [PATCH 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
lance.lmw...@gmail.com: > On Fri, Mar 11, 2022 at 03:04:32PM +0100, Andreas Rheinhardt wrote: >> lance.lmw...@gmail.com: >>> On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: From: Limin Wang Fix below error message when timecode packet is written. "Application provided duration: -9223372036854775808 / timestamp: -9223372036854775808 is out of range for mov/mp4 format" try to reproduce by: ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 test.mov Note although error message is printed, the timecode packet will be written anyway. So the patch 2/2 will try to change the log level to warning. The first two test case of fate-lavf-ismv have timecode setting, so the crc of ref data is different. Fixes ticket #9488 Signed-off-by: Limin Wang --- libavformat/movenc.c | 2 ++ tests/ref/lavf/ismv | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 4c86891..74b94cd 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6383,6 +6383,8 @@ static int mov_create_timecode_track(AVFormatContext *s, int index, int src_inde pkt->data = data; pkt->stream_index = index; pkt->flags = AV_PKT_FLAG_KEY; +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), (AVRational){1,mov->movie_timescale}); +pkt->duration = av_rescale_q(1, av_inv_q(rate), (AVRational){1,mov->movie_timescale}); pkt->size = 4; AV_WB32(pkt->data, tc.start); ret = ff_mov_write_packet(s, pkt); diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv index ac7f72b..723b432 100644 --- a/tests/ref/lavf/ismv +++ b/tests/ref/lavf/ismv @@ -1,7 +1,7 @@ -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv 313169 tests/data/lavf/lavf.ismv tests/data/lavf/lavf.ismv CRC=0x9d9a638a -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv 322075 tests/data/lavf/lavf.ismv tests/data/lavf/lavf.ismv CRC=0xe8130120 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv -- 1.8.3.1 >>> >>> will apply the patch set tomorrow unless there are any objections. >>> >> >> You have not really answered whether the current files or the new files >> are spec-incompliant; you have just reported that one byte is different. > > Sorry, I think I have said both current and new file is spec-compliant in the > last > email. > You stated that you think that both files are valid, but you also said that you don't even know what this byte that is different actually means. > By Quicktime file format specs: > Section Timecode Sample Description, all tmcd field isn't used pts/dts. > > As for where is the different for one byte, it's caused by pkt->duration. The > old is 0(uninitialized), after the patch it's 33(1 frame duration). > The text about Timecode Sample Description reads as follows: "Frame duration: A 32-bit integer that indicates how long each frame lasts in real time." This implies that only one of the two files can be spec-compliant. I am not a mov/ISOBMFF expert, but it seems to me that the current way of doing things is wrong. But I wonder about whether your patch is correct for vfr content. Doesn't the property of being vfr need to be reflected in the timecodes somehow (with different durations for different packets)? - 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".
Re: [FFmpeg-devel] [PATCH] libavfilter: zscale performance optimization >4x
Awesome, thanks! On Thu, Mar 10, 2022 at 9:45 PM Paul B Mahol wrote: > > > On Thu, Mar 10, 2022 at 7:41 PM Victoria Zhislina > wrote: > >> Paul and all, do you have any chances to view my patch from Feb,19? I >> assume I'\ve fixed all you've kindly pointed out and even more. Please >> correct me if I'm wrong. The only question remaining is - are you ok >> with the combination of threading and conditional filter operation (= do >> something if it is really required only) or you prefer to split it to 2 >> separate corresponding patches. I'd prefer the first option because it >> makes git ffmpeg repo and ffmpeg development cleaner not dirtier... >> > > Patch was already applied and some found issues fixed. > > >> >> On Tue, Feb 22, 2022 at 11:15 AM Paul B Mahol wrote: >> >>> On Tue, Feb 22, 2022 at 9:15 AM Paul B Mahol wrote: >>> >>> > >>> > >>> > On Tue, Feb 22, 2022 at 6:25 AM Lynne wrote: >>> > >>> >> 19 Feb 2022, 14:58 by niva...@gmail.com: >>> >> >>> >> > By ffmpeg threading support implementation via frame slicing and >>> doing >>> >> > zimg_filter_graph_build that used to take 30-60% of each frame >>> processig >>> >> > only if necessary (some parameters changed) >>> >> > the performance increase vs original version >>> >> > in video downscale and color conversion >4x is seen >>> >> > on 64 cores Intel Xeon, 3x on i7-6700K (4 cores with HT) >>> >> > >>> >> > Signed-off-by: Victoria Zhislina >>> >> > >>> >> >>> >> Can't you patch such a feature into the upstream instead? >>> >> >>> > >>> > zscale already have own threading ability, but is very hard to use it, >>> > last time i tried. >>> > >>> >>> I mean zimg. >>> >>> >>> > >>> > >>> >> ___ >>> >> ffmpeg-devel mailing list >>> >> ffmpeg-devel@ffmpeg.org >>> >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >> >>> >> To unsubscribe, visit link above, or email >>> >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". >>> >> >>> > >>> ___ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> To unsubscribe, visit link above, or email >>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". >>> >> ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 1/7] avformat/imf: relocate static function imf_time_to_ts()
From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index 3ce850b75a..b98af020d2 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -154,6 +154,25 @@ static int imf_uri_is_dos_abs_path(const char *string) return 0; } +static int imf_time_to_ts(int64_t *ts, AVRational t, AVRational time_base) +{ +int dst_num; +int dst_den; +AVRational r; + +r = av_div_q(t, time_base); + +if ((av_reduce(&dst_num, &dst_den, r.num, r.den, INT64_MAX) != 1)) +return 1; + +if (dst_den != 1) +return 1; + +*ts = dst_num; + +return 0; +} + /** * Parse a ASSETMAP XML file to extract the UUID-URI mapping of assets. * @param s the current format context, if any (can be NULL). @@ -772,25 +791,6 @@ static int get_resource_context_for_timestamp(AVFormatContext *s, IMFVirtualTrac return AVERROR_STREAM_NOT_FOUND; } -static int imf_time_to_ts(int64_t *ts, AVRational t, AVRational time_base) -{ -int dst_num; -int dst_den; -AVRational r; - -r = av_div_q(t, time_base); - -if ((av_reduce(&dst_num, &dst_den, r.num, r.den, INT64_MAX) != 1)) -return 1; - -if (dst_den != 1) -return 1; - -*ts = dst_num; - -return 0; -} - static int imf_read_packet(AVFormatContext *s, AVPacket *pkt) { IMFVirtualTrackResourcePlaybackCtx *resource = NULL; -- 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 v4 2/7] avformat/imf: add support for input seeking
From: Pierre-Anthony Lemieux The IMF demuxer did not implement AVInputFormat::read_seek2(), resulting in inefficient input seeking. Addresses https://trac.ffmpeg.org/ticket/9648 Byte- and frame-seeking are not supported. --- libavformat/imfdec.c | 129 ++- 1 file changed, 102 insertions(+), 27 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index b98af020d2..f208b262c3 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -359,13 +359,15 @@ static IMFAssetLocator *find_asset_map_locator(IMFAssetLocatorMap *asset_map, FF } static int open_track_resource_context(AVFormatContext *s, - IMFVirtualTrackResourcePlaybackCtx *track_resource) + IMFVirtualTrackPlaybackCtx *track, + int32_t resource_index) { IMFContext *c = s->priv_data; int ret = 0; -int64_t entry_point; +int64_t seek_offset = 0; AVDictionary *opts = NULL; AVStream *st; +IMFVirtualTrackResourcePlaybackCtx *track_resource = track->resources + resource_index; if (track_resource->ctx) { av_log(s, @@ -416,32 +418,27 @@ static int open_track_resource_context(AVFormatContext *s, st = track_resource->ctx->streams[0]; -/* Warn if the resource time base does not match the file time base */ -if (av_cmp_q(st->time_base, av_inv_q(track_resource->resource->base.edit_rate))) -av_log(s, - AV_LOG_WARNING, - "Incoherent source stream timebase " AVRATIONAL_FORMAT - "regarding resource edit rate: " AVRATIONAL_FORMAT, - st->time_base.num, - st->time_base.den, - track_resource->resource->base.edit_rate.den, - track_resource->resource->base.edit_rate.num); - -entry_point = av_rescale_q(track_resource->resource->base.entry_point, st->time_base, - av_inv_q(track_resource->resource->base.edit_rate)); - -if (entry_point) { -av_log(s, - AV_LOG_DEBUG, - "Seek at resource %s entry point: %" PRIu32 "\n", - track_resource->locator->absolute_uri, - track_resource->resource->base.entry_point); -ret = avformat_seek_file(track_resource->ctx, 0, entry_point, entry_point, entry_point, 0); +/* Determine the seek offset into the Track File, taking into account: + * - the current timestamp within the virtual track + * - the entry point of the resource + */ +if (imf_time_to_ts(&seek_offset, + av_sub_q(track->current_timestamp, track_resource->ts_offset), + st->time_base)) +av_log(s, AV_LOG_WARNING, "Incoherent stream timebase " AVRATIONAL_FORMAT + "and composition timeline position: " AVRATIONAL_FORMAT "\n", + st->time_base.num, st->time_base.den, + track->current_timestamp.den, track->current_timestamp.num); + +if (seek_offset) { +av_log(s, AV_LOG_DEBUG, "Seek at resource %s entry point: %" PRIi64 "\n", + track_resource->locator->absolute_uri, seek_offset); +ret = avformat_seek_file(track_resource->ctx, 0, seek_offset, seek_offset, seek_offset, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Could not seek at %" PRId64 "on %s: %s\n", - entry_point, + seek_offset, track_resource->locator->absolute_uri, av_err2str(ret)); avformat_close_input(&track_resource->ctx); @@ -584,7 +581,7 @@ static int set_context_streams_from_tracks(AVFormatContext *s) AVStream *first_resource_stream; /* Open the first resource of the track to get stream information */ -ret = open_track_resource_context(s, &c->tracks[i]->resources[0]); +ret = open_track_resource_context(s, c->tracks[i], 0); if (ret) return ret; first_resource_stream = c->tracks[i]->resources[0].ctx->streams[0]; @@ -774,7 +771,7 @@ static int get_resource_context_for_timestamp(AVFormatContext *s, IMFVirtualTrac "Switch resource on track %d: re-open context\n", track->index); -ret = open_track_resource_context(s, track->resources + i); +ret = open_track_resource_context(s, track, i); if (ret != 0) return ret; if (track->current_resource_index > 0) @@ -942,6 +939,83 @@ static int imf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } +static void rescale_interval(AVRational tb_in, AVRational tb_out, + int64_t *min_ts, int64_t *ts, int64_t *max_ts) +{ +*ts = av_rescale_q(*ts, tb_in, tb_out); +*min_ts = av_rescale_q_rnd(*min_ts, tb_i
[FFmpeg-devel] [PATCH v4 3/7] avformat/imf: clean-up and reduce logging
From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 93 ++-- 1 file changed, 29 insertions(+), 64 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index f208b262c3..ac212b05e1 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -203,11 +203,8 @@ static int parse_imf_asset_map_from_xml_dom(AVFormatContext *s, } if (asset_map_element->type != XML_ELEMENT_NODE || av_strcasecmp(asset_map_element->name, "AssetMap")) { -av_log(s, - AV_LOG_ERROR, - "Unable to parse asset map XML - wrong root node name[%s] type[%d]\n", - asset_map_element->name, - (int)asset_map_element->type); +av_log(s, AV_LOG_ERROR, "Unable to parse asset map XML - wrong root node name[%s] type[%d]\n", + asset_map_element->name, (int)asset_map_element->type); return AVERROR_INVALIDDATA; } @@ -333,11 +330,8 @@ static int parse_assetmap(AVFormatContext *s, const char *url) ret = parse_imf_asset_map_from_xml_dom(s, doc, &c->asset_locator_map, base_url); if (!ret) -av_log(s, - AV_LOG_DEBUG, - "Found %d assets from %s\n", - c->asset_locator_map.asset_count, - url); +av_log(s, AV_LOG_DEBUG, "Found %d assets from %s\n", + c->asset_locator_map.asset_count, url); xmlFreeDoc(doc); @@ -370,9 +364,7 @@ static int open_track_resource_context(AVFormatContext *s, IMFVirtualTrackResourcePlaybackCtx *track_resource = track->resources + resource_index; if (track_resource->ctx) { -av_log(s, - AV_LOG_DEBUG, - "Input context already opened for %s.\n", +av_log(s, AV_LOG_DEBUG, "Input context already opened for %s.\n", track_resource->locator->absolute_uri); return 0; } @@ -400,11 +392,8 @@ static int open_track_resource_context(AVFormatContext *s, NULL, &opts); if (ret < 0) { -av_log(s, - AV_LOG_ERROR, - "Could not open %s input context: %s\n", - track_resource->locator->absolute_uri, - av_err2str(ret)); +av_log(s, AV_LOG_ERROR, "Could not open %s input context: %s\n", + track_resource->locator->absolute_uri, av_err2str(ret)); goto cleanup; } av_dict_free(&opts); @@ -427,8 +416,7 @@ static int open_track_resource_context(AVFormatContext *s, st->time_base)) av_log(s, AV_LOG_WARNING, "Incoherent stream timebase " AVRATIONAL_FORMAT "and composition timeline position: " AVRATIONAL_FORMAT "\n", - st->time_base.num, st->time_base.den, - track->current_timestamp.den, track->current_timestamp.num); + AVRATIONAL_ARG(st->time_base), AVRATIONAL_ARG(track->current_timestamp)); if (seek_offset) { av_log(s, AV_LOG_DEBUG, "Seek at resource %s entry point: %" PRIi64 "\n", @@ -465,9 +453,7 @@ static int open_track_file_resource(AVFormatContext *s, asset_locator = find_asset_map_locator(&c->asset_locator_map, track_file_resource->track_file_uuid); if (!asset_locator) { -av_log(s, - AV_LOG_ERROR, - "Could not find asset locator for UUID: " FF_IMF_UUID_FORMAT "\n", +av_log(s, AV_LOG_ERROR, "Could not find asset locator for UUID: " FF_IMF_UUID_FORMAT "\n", UID_ARG(track_file_resource->track_file_uuid)); return AVERROR_INVALIDDATA; } @@ -618,9 +604,7 @@ static int open_cpl_tracks(AVFormatContext *s) if (c->cpl->main_image_2d_track) { if ((ret = open_virtual_track(s, c->cpl->main_image_2d_track, track_index++)) != 0) { -av_log(s, - AV_LOG_ERROR, - "Could not open image track " FF_IMF_UUID_FORMAT "\n", +av_log(s, AV_LOG_ERROR, "Could not open image track " FF_IMF_UUID_FORMAT "\n", UID_ARG(c->cpl->main_image_2d_track->base.id_uuid)); return ret; } @@ -628,9 +612,7 @@ static int open_cpl_tracks(AVFormatContext *s) for (uint32_t i = 0; i < c->cpl->main_audio_track_count; i++) { if ((ret = open_virtual_track(s, &c->cpl->main_audio_tracks[i], track_index++)) != 0) { -av_log(s, - AV_LOG_ERROR, - "Could not open audio track " FF_IMF_UUID_FORMAT "\n", +av_log(s, AV_LOG_ERROR, "Could not open audio track " FF_IMF_UUID_FORMAT "\n", UID_ARG(c->cpl->main_audio_tracks[i].base.id_uuid)); return ret; } @@ -706,13 +688,9 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma AVRational minimum_timestamp = av_make_q(INT32_MAX, 1); for (uint32_t i = c->track_count; i > 0; i--) {
[FFmpeg-devel] [PATCH v4 4/7] avformat/seek: add ff_rescale_interval() function
From: Pierre-Anthony Lemieux Refactors a function used by avformat/concat and avformat/imf. --- libavformat/internal.h | 20 libavformat/seek.c | 10 ++ 2 files changed, 30 insertions(+) diff --git a/libavformat/internal.h b/libavformat/internal.h index f24c68703f..5529403a68 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -1023,4 +1023,24 @@ void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputForm */ int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size); +/** + * Rescales a timestamp and the endpoints of an interval to which the temstamp + * belongs, from a timebase `tb_in` to a timebase `tb_out`. + * + * The upper (lower) bound of the output interval is rounded up (down) such that + * the output interval always falls within the intput interval. The timestamp is + * rounded to the nearest integer and halfway cases away from zero, and can + * therefore fall outside of the output interval. + * + * Useful to simplify the rescaling of the arguments of AVInputFormat::read_seek2() + * + * @param[in] tb_in Timebase of the input `min_ts`, `ts` and `max_ts` + * @param[in] tb_out Timebase of the ouput `min_ts`, `ts` and `max_ts` + * @param[in,out] min_ts Lower bound of the interval + * @param[in,out] ts Timestamp + * @param[in,out] max_ts Upper bound of the interval + */ +void ff_rescale_interval(AVRational tb_in, AVRational tb_out, + int64_t *min_ts, int64_t *ts, int64_t *max_ts); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/seek.c b/libavformat/seek.c index 405ca316b3..890aea7f8a 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -751,3 +751,13 @@ int avformat_flush(AVFormatContext *s) ff_read_frame_flush(s); return 0; } + +void ff_rescale_interval(AVRational tb_in, AVRational tb_out, + int64_t *min_ts, int64_t *ts, int64_t *max_ts) +{ +*ts = av_rescale_q(*ts, tb_in, tb_out); +*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, + AV_ROUND_UP | AV_ROUND_PASS_MINMAX); +*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, + AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); +} -- 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 v4 5/7] avformat/tests: add test for ff_rescale_interval()
From: Pierre-Anthony Lemieux --- libavformat/Makefile | 1 + libavformat/tests/.gitignore | 1 + libavformat/tests/seek_utils.c | 57 ++ tests/fate/libavformat.mak | 5 +++ 4 files changed, 64 insertions(+) create mode 100644 libavformat/tests/seek_utils.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 6566e40cac..3acc939551 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -707,6 +707,7 @@ SKIPHEADERS-$(CONFIG_NETWORK)+= network.h rtsp.h TESTPROGS = seek\ url \ +seek_utils # async \ FIFO-MUXER-TESTPROGS-$(CONFIG_NETWORK) += fifo_muxer diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore index aabf76345e..cdd0cce061 100644 --- a/libavformat/tests/.gitignore +++ b/libavformat/tests/.gitignore @@ -6,3 +6,4 @@ /seek /srtp /url +/seek_utils diff --git a/libavformat/tests/seek_utils.c b/libavformat/tests/seek_utils.c new file mode 100644 index 00..cc679dca05 --- /dev/null +++ b/libavformat/tests/seek_utils.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Pierre-Anthony Lemieux + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavformat/internal.h" + +int main(void) +{ + int64_t ts_min; + int64_t ts; + int64_t ts_max; + + ts_min = 10; + ts = 20; + ts_max = 30; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(10, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 1 || ts != 2 || ts_max != 3) +return 1; + + ts_min = 10; + ts = 32; + ts_max = 32; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 11 || ts_max != 10) +return 1; + + ts_min = 10; + ts = 10; + ts_max = 32; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 3 || ts_max != 10) +return 1; + + return 0; +} diff --git a/tests/fate/libavformat.mak b/tests/fate/libavformat.mak index 59ff0ebc8d..d2acb4c9e0 100644 --- a/tests/fate/libavformat.mak +++ b/tests/fate/libavformat.mak @@ -26,6 +26,11 @@ FATE_LIBAVFORMAT-$(CONFIG_IMF_DEMUXER) += fate-imf fate-imf: libavformat/tests/imf$(EXESUF) fate-imf: CMD = run libavformat/tests/imf$(EXESUF) +FATE_LIBAVFORMAT += fate-seek_utils +fate-seek_utils: libavformat/tests/seek_utils$(EXESUF) +fate-seek_utils: CMD = run libavformat/tests/seek_utils$(EXESUF) +fate-seek_utils: CMP = null + FATE_LIBAVFORMAT += $(FATE_LIBAVFORMAT-yes) FATE-$(CONFIG_AVFORMAT) += $(FATE_LIBAVFORMAT) fate-libavformat: $(FATE_LIBAVFORMAT) -- 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 v4 7/7] avformat/concat: refactor to use ff_rescale_interval()
From: Pierre-Anthony Lemieux --- libavformat/concatdec.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 0603c6e254..cfe1329105 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -816,16 +816,6 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) return 0; } -static void rescale_interval(AVRational tb_in, AVRational tb_out, - int64_t *min_ts, int64_t *ts, int64_t *max_ts) -{ -*ts = av_rescale_q(*ts, tb_in, tb_out); -*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, - AV_ROUND_UP | AV_ROUND_PASS_MINMAX); -*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, - AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); -} - static int try_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { @@ -838,8 +828,8 @@ static int try_seek(AVFormatContext *avf, int stream, if (stream >= 0) { if (stream >= cat->avf->nb_streams) return AVERROR(EIO); -rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, - &min_ts, &ts, &max_ts); +ff_rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, +&min_ts, &ts, &max_ts); } return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags); } @@ -853,8 +843,8 @@ static int real_seek(AVFormatContext *avf, int stream, if (stream >= 0) { if (stream >= avf->nb_streams) return AVERROR(EINVAL); -rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, - &min_ts, &ts, &max_ts); +ff_rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, +&min_ts, &ts, &max_ts); } left = 0; -- 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 v4 6/7] avformat/imf: refactor to use ff_rescale_interval()
From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 20 ++-- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index ac212b05e1..a19e431df3 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -904,14 +904,6 @@ static int imf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } -static void rescale_interval(AVRational tb_in, AVRational tb_out, - int64_t *min_ts, int64_t *ts, int64_t *max_ts) -{ -*ts = av_rescale_q(*ts, tb_in, tb_out); -*min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); -*max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); -} - static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb) { int dst_num; @@ -937,13 +929,13 @@ static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts, /* rescale timestamps to Composition edit units */ if (stream_index < 0) -rescale_interval(AV_TIME_BASE_Q, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); +ff_rescale_interval(AV_TIME_BASE_Q, +av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), +&min_ts, &ts, &max_ts); else -rescale_interval(s->streams[stream_index]->time_base, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); +ff_rescale_interval(s->streams[stream_index]->time_base, +av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), +&min_ts, &ts, &max_ts); /* requested timestamp bounds are too close */ if (max_ts < min_ts) -- 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 2/3] tools/target_dec_fuzzer: Adjust threshold for DFA
Fixes: Timeout Fixes: 45351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFA_fuzzer-5768895011618816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index cef71e1e0a..23b0184059 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -157,6 +157,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32;break; case AV_CODEC_ID_CFHD:maxpixels /= 128; break; case AV_CODEC_ID_COOK:maxsamples /= 1<<20; break; +case AV_CODEC_ID_DFA: maxpixels /= 1024; break; case AV_CODEC_ID_DIRAC: maxpixels /= 8192; break; case AV_CODEC_ID_DST: maxsamples /= 1<<20; break; case AV_CODEC_ID_DVB_SUBTITLE: av_dict_set_int(&opts, "compute_clut", -2, 0); break; -- 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 1/3] avcodec/mjpegbdec: Set buf_size
Fixes: Timeout Fixes: 45170/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5874820431085568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mjpegbdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c index 218be41192..c3d3125142 100644 --- a/libavcodec/mjpegbdec.c +++ b/libavcodec/mjpegbdec.c @@ -57,6 +57,7 @@ static int mjpegb_decode_frame(AVCodecContext *avctx, buf_end = buf + buf_size; s->got_picture = 0; s->adobe_transform = -1; +s->buf_size = buf_size; read_header: /* reset on every SOI */ -- 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 3/3] avcodec/dfa: Optimize output reshuffle loop
18035 -> 4018 dezicycles (Tested with LOGOS.DFA, gcc 7, 3950X) Signed-off-by: Michael Niedermayer --- libavcodec/dfa.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 0cf3641a38..ab78d66763 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -388,9 +388,17 @@ static int dfa_decode_frame(AVCodecContext *avctx, for (i = 0; i < avctx->height; i++) { if(version == 0x100) { int j; -for(j = 0; j < avctx->width; j++) { -dst[j] = buf[ (i&3)*(avctx->width /4) + (j/4) + - ((j&3)*(avctx->height/4) + (i/4))*avctx->width]; +const uint8_t *buf1 = buf + (i&3)*(avctx->width/4) + (i/4)*avctx->width; +int stride = (avctx->height/4)*avctx->width; +for(j = 0; j < avctx->width/4; j++) { +dst[4*j+0] = buf1[j + 0*stride]; +dst[4*j+1] = buf1[j + 1*stride]; +dst[4*j+2] = buf1[j + 2*stride]; +dst[4*j+3] = buf1[j + 3*stride]; +} +j *= 4; +for(; j < avctx->width; j++) { +dst[j] = buf1[(j/4) + (j&3)*stride]; } } else { memcpy(dst, buf, avctx->width); -- 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 1/2] avformat/movenc: initialize pts/dts/duration of timecode packet
On Fri, Mar 11, 2022 at 05:16:09PM +0100, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > On Fri, Mar 11, 2022 at 03:04:32PM +0100, Andreas Rheinhardt wrote: > >> lance.lmw...@gmail.com: > >>> On Wed, Mar 02, 2022 at 09:58:31PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Fix below error message when timecode packet is written. > "Application provided duration: -9223372036854775808 / timestamp: > -9223372036854775808 is out of range for mov/mp4 format" > > try to reproduce by: > ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 > test.mov > > Note although error message is printed, the timecode packet will be > written anyway. So > the patch 2/2 will try to change the log level to warning. > > The first two test case of fate-lavf-ismv have timecode setting, so the > crc of ref data is different. > Fixes ticket #9488 > > Signed-off-by: Limin Wang > --- > libavformat/movenc.c | 2 ++ > tests/ref/lavf/ismv | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index 4c86891..74b94cd 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -6383,6 +6383,8 @@ static int > mov_create_timecode_track(AVFormatContext *s, int index, int src_inde > pkt->data = data; > pkt->stream_index = index; > pkt->flags = AV_PKT_FLAG_KEY; > +pkt->pts = pkt->dts = av_rescale_q(tc.start, av_inv_q(rate), > (AVRational){1,mov->movie_timescale}); > +pkt->duration = av_rescale_q(1, av_inv_q(rate), > (AVRational){1,mov->movie_timescale}); > pkt->size = 4; > AV_WB32(pkt->data, tc.start); > ret = ff_mov_write_packet(s, pkt); > diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv > index ac7f72b..723b432 100644 > --- a/tests/ref/lavf/ismv > +++ b/tests/ref/lavf/ismv > @@ -1,7 +1,7 @@ > -48fb8d7a5d19bd60f3a49ccf4b7d6593 *tests/data/lavf/lavf.ismv > +7a24b73c096ec0f13f0f7a2d9101c4c1 *tests/data/lavf/lavf.ismv > 313169 tests/data/lavf/lavf.ismv > tests/data/lavf/lavf.ismv CRC=0x9d9a638a > -d19cd8e310a2e94fe0a0d11c5dc29217 *tests/data/lavf/lavf.ismv > +79646383fd099d45ad0d0c2791c601dd *tests/data/lavf/lavf.ismv > 322075 tests/data/lavf/lavf.ismv > tests/data/lavf/lavf.ismv CRC=0xe8130120 > 3b6023766845b51b075aed474c00f73c *tests/data/lavf/lavf.ismv > -- > 1.8.3.1 > > >>> > >>> will apply the patch set tomorrow unless there are any objections. > >>> > >> > >> You have not really answered whether the current files or the new files > >> are spec-incompliant; you have just reported that one byte is different. > > > > Sorry, I think I have said both current and new file is spec-compliant in > > the last > > email. > > > > You stated that you think that both files are valid, but you also said > that you don't even know what this byte that is different actually means. > > > By Quicktime file format specs: > > Section Timecode Sample Description, all tmcd field isn't used pts/dts. > > > > As for where is the different for one byte, it's caused by pkt->duration. > > The > > old is 0(uninitialized), after the patch it's 33(1 frame duration). > > > > The text about Timecode Sample Description reads as follows: "Frame > duration: A 32-bit integer that indicates how long each frame lasts in > real time." This implies that only one of the two files can be > spec-compliant. I am not a mov/ISOBMFF expert, but it seems to me that > the current way of doing things is wrong. But I wonder about whether > your patch is correct for vfr content. Doesn't the property of being vfr > need to be reflected in the timecodes somehow (with different durations > for different packets)? No, it's packet duration, not tmcd frame duration, my patch have do nothing for that.(see movenc.c:2348). In addition, for timecode, I don't think vfr is supported. The tmcd track just contains one packet with the frame number(4byte), so the packet data is used by start of timecode. So I set the dts/pts is avoid the following code think it's invalid packet. If you wonder the patch will change something, I can update the patch keep packet duration to default zero, then we can the fate data untouched, for the following track_duration will use it and make the crc of output is different. > > - 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". -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-de
Re: [FFmpeg-devel] [PATCH v4 1/7] avformat/imf: relocate static function imf_time_to_ts()
lgtm. Will apply in a few days. ___ 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".