History

avfilter/vf_libplacebo: wrap deprecated opts in FF_API define

Niklas Haas committed 3 years ago

Commit 11eca601 parent 7c130d62 files · +10 −0Browse files

Showing the changes to libavfilter (2 of 2 files). Show all

Unified · Split

2 files
  1. libavfilter/version_major.h +2 −0
  2. libavfilter/vf_libplacebo.c +8 −0
libavfilter/version_major.h+2−0
@@ -35,4 +35,6 @@ · 34 unmodified lines
3535 * the public API and may change, break or disappear at any time.
3636 */
3737
38+#define FF_API_LIBPLACEBO_OPTS (LIBAVFILTER_VERSION_MAJOR < 10)
39+
3840 #endif /* AVFILTER_VERSION_MAJOR_H */
libavfilter/vf_libplacebo.c+8−0
@@ -132,11 +132,14 @@ typedef struct LibplaceboContext { · 131 unmodified lines
132132 int inverse_tonemapping;
133133 float crosstalk;
134134 int tonemapping_lut_size;
135+
136+#if FF_API_LIBPLACEBO_OPTS
135137 /* for backwards compatibility */
136138 float desat_str;
137139 float desat_exp;
138140 int gamut_warning;
139141 int gamut_clipping;
142+#endif
140143
141144 /* pl_dither_params */
142145 int dithering;
@@ -380,6 +383,7 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in) · 237 unmodified lines
380383 pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);
381384 }
382385
386+#if FF_API_LIBPLACEBO_OPTS
383387 /* backwards compatibility with older API */
384388 if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {
385389 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) · 11 unmodified lines
397401 gamut_mode = PL_GAMUT_WARN;
398402 if (s->gamut_clipping)
399403 gamut_mode = PL_GAMUT_DESATURATE;
404+#endif
400405
401406 /* Update render params */
402407 params = (struct pl_render_params) {
@@ -818,11 +823,14 @@ static const AVOption libplacebo_options[] = { · 415 unmodified lines
818823 { "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
819824 { "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC },
820825 { "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC },
826+
827+#if FF_API_LIBPLACEBO_OPTS
821828 /* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */
822829 { "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
823830 { "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
824831 { "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
825832 { "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
833+#endif
826834
827835 { "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" },
828836 { "none", "Disable dithering", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, STATIC, "dither" },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t