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

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
35 * the public API and may change, break or disappear at any time.35 * the public API and may change, break or disappear at any time.
36 */36 */
37 37
38#define FF_API_LIBPLACEBO_OPTS (LIBAVFILTER_VERSION_MAJOR < 10)
39
38#endif /* AVFILTER_VERSION_MAJOR_H */40#endif /* AVFILTER_VERSION_MAJOR_H */
libavfilter/vf_libplacebo.c+8−0
@@ -132,11 +132,14 @@ typedef struct LibplaceboContext { · 131 unmodified lines
132 int inverse_tonemapping;132 int inverse_tonemapping;
133 float crosstalk;133 float crosstalk;
134 int tonemapping_lut_size;134 int tonemapping_lut_size;
135
136#if FF_API_LIBPLACEBO_OPTS
135 /* for backwards compatibility */137 /* for backwards compatibility */
136 float desat_str;138 float desat_str;
137 float desat_exp;139 float desat_exp;
138 int gamut_warning;140 int gamut_warning;
139 int gamut_clipping;141 int gamut_clipping;
142#endif
140 143
141 /* pl_dither_params */144 /* pl_dither_params */
142 int dithering;145 int dithering;
@@ -380,6 +383,7 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in) · 237 unmodified lines
380 pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);383 pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);
381 }384 }
382 385
386#if FF_API_LIBPLACEBO_OPTS
383 /* backwards compatibility with older API */387 /* backwards compatibility with older API */
384 if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {388 if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {
385 float str = s->desat_str < 0.0f ? 0.9f : s->desat_str;389 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
397 gamut_mode = PL_GAMUT_WARN;401 gamut_mode = PL_GAMUT_WARN;
398 if (s->gamut_clipping)402 if (s->gamut_clipping)
399 gamut_mode = PL_GAMUT_DESATURATE;403 gamut_mode = PL_GAMUT_DESATURATE;
404#endif
400 405
401 /* Update render params */406 /* Update render params */
402 params = (struct pl_render_params) {407 params = (struct pl_render_params) {
@@ -818,11 +823,14 @@ static const AVOption libplacebo_options[] = { · 415 unmodified lines
818 { "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },823 { "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
819 { "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC },824 { "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC },
820 { "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC },825 { "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
821 /* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */828 /* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */
822 { "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },829 { "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
823 { "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },830 { "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
824 { "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },831 { "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
825 { "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },832 { "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
833#endif
826 834
827 { "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" },835 { "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" },
828 { "none", "Disable dithering", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, STATIC, "dither" },836 { "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