Apply patches for libplacebo
This commit is contained in:
parent
4d26310d1d
commit
b5a29aa6c4
73
0001-avfilter-vf_libplacebo-remove-deprecated-field.patch
Normal file
73
0001-avfilter-vf_libplacebo-remove-deprecated-field.patch
Normal file
@ -0,0 +1,73 @@
|
||||
From 1231003c3c6d4839a9e838d06f8e16ee7690958f Mon Sep 17 00:00:00 2001
|
||||
From: Niklas Haas <git@haasn.dev>
|
||||
Date: Mon, 13 Mar 2023 14:33:16 +0100
|
||||
Subject: [PATCH] avfilter/vf_libplacebo: remove deprecated field
|
||||
|
||||
This has not been functional since a year ago, including in our current
|
||||
minimum dependency of libplacebo (v4.192.0). It also causes build errors
|
||||
against libplacebo v6, so it needs to be removed from the code. We can
|
||||
keep the option around for now, but it should also be removed soon.
|
||||
|
||||
Signed-off-by: Niklas Haas <git@haasn.dev>
|
||||
Signed-off-by: James Almer <jamrial@gmail.com>
|
||||
---
|
||||
doc/filters.texi | 3 ---
|
||||
libavfilter/vf_libplacebo.c | 7 ++++---
|
||||
2 files changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
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 },
|
||||
--
|
||||
2.39.2
|
||||
|
@ -0,0 +1,76 @@
|
||||
From 11eca6018c40f5ebe6af93cbc4b4dce447d8b3bc Mon Sep 17 00:00:00 2001
|
||||
From: Niklas Haas <git@haasn.dev>
|
||||
Date: Mon, 13 Mar 2023 15:10:26 +0100
|
||||
Subject: [PATCH] avfilter/vf_libplacebo: wrap deprecated opts in FF_API define
|
||||
|
||||
Signed-off-by: Niklas Haas <git@haasn.dev>
|
||||
Signed-off-by: James Almer <jamrial@gmail.com>
|
||||
---
|
||||
libavfilter/version_major.h | 2 ++
|
||||
libavfilter/vf_libplacebo.c | 8 ++++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
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" },
|
||||
--
|
||||
2.39.2
|
||||
|
@ -118,6 +118,9 @@ Patch2: ffmpeg-new-coder-errors.patch
|
||||
# Allow to build with fdk-aac-free
|
||||
# See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112
|
||||
Patch3: ffmpeg-allow-fdk-aac-free.patch
|
||||
# Backport upstream patches for libplacebo v5.264
|
||||
Patch4: 0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch
|
||||
Patch5: 0001-avfilter-vf_libplacebo-remove-deprecated-field.patch
|
||||
|
||||
# Set up dlopen for openh264
|
||||
Patch1001: ffmpeg-dlopen-openh264.patch
|
||||
|
Loading…
x
Reference in New Issue
Block a user