community/ffmpeg: fix volatile patches

This commit is contained in:
ptrcnull 2023-10-13 23:28:14 +02:00
parent 4fc638a52e
commit 351aa86f74
5 changed files with 244 additions and 8 deletions

View File

@ -77,10 +77,10 @@ source="https://ffmpeg.org/releases/ffmpeg-$pkgver.tar.xz
libswrescale-5.patch
v4l-ioctl.patch
v4l2-fix.patch
$pkgname-lavu-vulkan-32bit.patch::https://github.com/FFmpeg/FFmpeg/commit/cc76e8340d28438c1ac56ee7dfd774d25e944264.patch
$pkgname-libplacebo-x1.patch::https://github.com/FFmpeg/FFmpeg/commit/11eca6018c40f5ebe6af93cbc4b4dce447d8b3bc.diff
$pkgname-libplacebo-x2.patch::https://github.com/FFmpeg/FFmpeg/commit/1231003c3c6d4839a9e838d06f8e16ee7690958f.diff
$pkgname-binutils-2.41.patch::https://git.videolan.org/?p=ffmpeg.git;a=patch;h=effadce6c756247ea8bae32dc13bb3e6f464f0eb
lavu-vulkan-32bit.patch
libplacebo-x1.patch
libplacebo-x2.patch
binutils-2.41.patch
"
options="!check" # tests/data/hls-lists.append.m3u8 fails
@ -360,8 +360,8 @@ sha512sums="
a86dab2df808de4693f7f4e276d5090fc5c7b34b85dad866de9ce154149050b3030b68bcbe6463c6954ea241ad38f1ed1fff1658f39e193e26284178867aea88 libswrescale-5.patch
c73d751e5d2a8214f0beb1b48fac6829903d46ad7db0dddddf47013193efce487825de495a24408d9a8e3c7f78f15fe62a6c14b54efc80e63dde9903cf08e918 v4l-ioctl.patch
fcb79e7669c7c824bdb5e95c8b6ede2773e6a4ceb244b122a36d881cb8ce41bf4beec139ec67b5ee2df08265bbccc5306e173d7eeabc6e80e82484acf5018bb1 v4l2-fix.patch
7b0ca00e8461cd9f89c55ac71606ee5cc86d6b37d2b33716ef04abec8c4b6b1f9623bfb72ba4744d3ea7dc35bd27d11d45215bddaa67d98e424ba01d2063adc6 ffmpeg-lavu-vulkan-32bit.patch
3d9e9eb57bc538d1093d2d9de59eccabfc9c6f1275d137fcbff93a576b3d863a11b24671bc6986f3fae086078c27d1ca1ffbbc3e384a3fcd11fb50662438b16b ffmpeg-libplacebo-x1.patch
d7ae017f68d73ba26b1218e9ab178c41ad954823939dca2359dc0df9a6e106ea7ffd733bf734f0e7c38f8d28099425054cf9a214331a4a10c182e1a781effa9e ffmpeg-libplacebo-x2.patch
c1141eb8b8d9d02f021fee2290d02b16d924d2fcca9ea971f9438db46c7d83775bc7ffeb87fba6561008c43359684329c7f7f8f82aea7999b252e3ab98617581 ffmpeg-binutils-2.41.patch
7b0ca00e8461cd9f89c55ac71606ee5cc86d6b37d2b33716ef04abec8c4b6b1f9623bfb72ba4744d3ea7dc35bd27d11d45215bddaa67d98e424ba01d2063adc6 lavu-vulkan-32bit.patch
3d9e9eb57bc538d1093d2d9de59eccabfc9c6f1275d137fcbff93a576b3d863a11b24671bc6986f3fae086078c27d1ca1ffbbc3e384a3fcd11fb50662438b16b libplacebo-x1.patch
d7ae017f68d73ba26b1218e9ab178c41ad954823939dca2359dc0df9a6e106ea7ffd733bf734f0e7c38f8d28099425054cf9a214331a4a10c182e1a781effa9e libplacebo-x2.patch
c1141eb8b8d9d02f021fee2290d02b16d924d2fcca9ea971f9438db46c7d83775bc7ffeb87fba6561008c43359684329c7f7f8f82aea7999b252e3ab98617581 binutils-2.41.patch
"

View File

@ -0,0 +1,76 @@
From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sun, 16 Jul 2023 18:18:02 +0300
Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift
instructions within inline assembly
Fixes assembling with binutil as >= 2.41
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 6298f5ed19..ca7e2dffc1 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -35,12 +35,20 @@
static av_always_inline av_const int MULL(int a, int b, unsigned shift)
{
int rt, dummy;
+ if (__builtin_constant_p(shift))
__asm__ (
"imull %3 \n\t"
"shrdl %4, %%edx, %%eax \n\t"
:"=a"(rt), "=d"(dummy)
- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
+ :"a"(a), "rm"(b), "i"(shift & 0x1F)
);
+ else
+ __asm__ (
+ "imull %3 \n\t"
+ "shrdl %4, %%edx, %%eax \n\t"
+ :"=a"(rt), "=d"(dummy)
+ :"a"(a), "rm"(b), "c"((uint8_t)shift)
+ );
return rt;
}
@@ -113,19 +121,31 @@ __asm__ volatile(\
// avoid +32 for shift optimization (gcc should do that ...)
#define NEG_SSR32 NEG_SSR32
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
+ if (__builtin_constant_p(s))
__asm__ ("sarl %1, %0\n\t"
: "+r" (a)
- : "ic" ((uint8_t)(-s))
+ : "i" (-s & 0x1F)
);
+ else
+ __asm__ ("sarl %1, %0\n\t"
+ : "+r" (a)
+ : "c" ((uint8_t)(-s))
+ );
return a;
}
#define NEG_USR32 NEG_USR32
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
+ if (__builtin_constant_p(s))
__asm__ ("shrl %1, %0\n\t"
: "+r" (a)
- : "ic" ((uint8_t)(-s))
+ : "i" (-s & 0x1F)
);
+ else
+ __asm__ ("shrl %1, %0\n\t"
+ : "+r" (a)
+ : "c" ((uint8_t)(-s))
+ );
return a;
}
--
2.30.2

View File

@ -0,0 +1,46 @@
From cc76e8340d28438c1ac56ee7dfd774d25e944264 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Thu, 2 Mar 2023 17:27:30 +0100
Subject: [PATCH] lavu/vulkan: fix handle type for 32-bit targets
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes compilation with clang which errors out on Wint-conversion.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
---
libavutil/hwcontext_vulkan.c | 2 +-
libavutil/vulkan.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 5b86aa65e906..ffd4f5dec4ec 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1149,7 +1149,7 @@ static void free_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
av_freep(&cmd->queues);
av_freep(&cmd->bufs);
- cmd->pool = NULL;
+ cmd->pool = VK_NULL_HANDLE;
}
static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index d1ea1e24fb82..90922c6cf3de 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -122,7 +122,11 @@ typedef struct FFVulkanPipeline {
VkDescriptorSetLayout *desc_layout;
VkDescriptorPool desc_pool;
VkDescriptorSet *desc_set;
+#if VK_USE_64_BIT_PTR_DEFINES == 1
void **desc_staging;
+#else
+ uint64_t *desc_staging;
+#endif
VkDescriptorSetLayoutBinding **desc_binding;
VkDescriptorUpdateTemplate *desc_template;
int *desc_set_initialized;

View File

@ -0,0 +1,61 @@
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 899dfdb27dba..1decc4012ee0 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,4 +35,6 @@
* the public API and may change, break or disappear at any time.
*/
+#define FF_API_LIBPLACEBO_OPTS (LIBAVFILTER_VERSION_MAJOR < 10)
+
#endif /* AVFILTER_VERSION_MAJOR_H */
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 7cd495de2619..d75723289069 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -132,11 +132,14 @@ typedef struct LibplaceboContext {
int inverse_tonemapping;
float crosstalk;
int tonemapping_lut_size;
+
+#if FF_API_LIBPLACEBO_OPTS
/* for backwards compatibility */
float desat_str;
float desat_exp;
int gamut_warning;
int gamut_clipping;
+#endif
/* pl_dither_params */
int dithering;
@@ -380,6 +383,7 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in)
pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);
}
+#if FF_API_LIBPLACEBO_OPTS
/* backwards compatibility with older API */
if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {
float str = s->desat_str < 0.0f ? 0.9f : s->desat_str;
@@ -397,6 +401,7 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in)
gamut_mode = PL_GAMUT_WARN;
if (s->gamut_clipping)
gamut_mode = PL_GAMUT_DESATURATE;
+#endif
/* Update render params */
params = (struct pl_render_params) {
@@ -818,11 +823,14 @@ static const AVOption libplacebo_options[] = {
{ "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC },
{ "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC },
+
+#if FF_API_LIBPLACEBO_OPTS
/* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */
{ "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
{ "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
{ "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
{ "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
+#endif
{ "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" },
{ "none", "Disable dithering", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, STATIC, "dither" },

View File

@ -0,0 +1,53 @@
diff --git a/doc/filters.texi b/doc/filters.texi
index 7a7b2ba4e79e..77b594f69cb1 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16242,9 +16242,6 @@ Disable linear light scaling.
@item disable_builtin
Disable built-in GPU sampling (forces LUT).
-@item force_icc_lut
-Force the use of a full ICC 3DLUT for gamut mapping.
-
@item disable_fbos
Forcibly disable FBOs, resulting in loss of almost all functionality, but
offering the maximum possible speed.
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index d75723289069..757dc519e9ad 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -97,7 +97,6 @@ typedef struct LibplaceboContext {
float polar_cutoff;
int disable_linear;
int disable_builtin;
- int force_icc_lut;
int force_dither;
int disable_fbos;
@@ -139,6 +138,7 @@ typedef struct LibplaceboContext {
float desat_exp;
int gamut_warning;
int gamut_clipping;
+ int force_icc_lut;
#endif
/* pl_dither_params */
@@ -463,7 +463,6 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in)
.polar_cutoff = s->polar_cutoff,
.disable_linear_scaling = s->disable_linear,
.disable_builtin_scalers = s->disable_builtin,
- .force_icc_lut = s->force_icc_lut,
.force_dither = s->force_dither,
.disable_fbos = s->disable_fbos,
};
@@ -855,7 +854,9 @@ static const AVOption libplacebo_options[] = {
{ "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0.0, 1.0, DYNAMIC },
{ "disable_linear", "Disable linear scaling", OFFSET(disable_linear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ "disable_builtin", "Disable built-in scalers", OFFSET(disable_builtin), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
- { "force_icc_lut", "Force the use of a full ICC 3DLUT for color mapping", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
+#if FF_API_LIBPLACEBO_OPTS
+ { "force_icc_lut", "Deprecated, does nothing", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
+#endif
{ "force_dither", "Force dithering", OFFSET(force_dither), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ "disable_fbos", "Force-disable FBOs", OFFSET(disable_fbos), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ NULL },