1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avfilter/libplacebo: add deinterlacing options

These were introduced in libplacebo API version 220. We actually already
map the field by default, but deinterlacing was never enabled unless the user
explicitly forced it using extra_ops.
This commit is contained in:
Niklas Haas
2025-02-16 16:13:22 +01:00
parent 58875417af
commit 794cba812e
2 changed files with 36 additions and 0 deletions

View File

@@ -16615,6 +16615,25 @@ Enable sigmoidal compression during upscaling. Reduces ringing slightly.
Enabled by default. Enabled by default.
@end table @end table
@subsubsection Deinterlacing
Deinterlacing is automatically supported when frames are tagged as interlaced,
however frames are not deinterlaced unless a deinterlacing algorithm is chosen.
@table @option
@item deinterlace
The the deinterlacing algorithm to use.
@table @samp
@item weave
No deinterlacing, weave fields together into a single frame. This is the default.
@item bob
Naive bob deinterlacing, simply repeat each field line twice.
@item yadif
Yet another deinterlacing filter. See the @ref{yadif} filter for more details.
@end table
@item skip_spatial_check
Skip the spatial deinterlacing check when using @code{yadif} deinterlacing.
@end table
@subsubsection Debanding @subsubsection Debanding
Libplacebo comes with a built-in debanding filter that is good at counteracting Libplacebo comes with a built-in debanding filter that is good at counteracting
many common sources of banding and blocking. Turning this on is highly many common sources of banding and blocking. Turning this on is highly

View File

@@ -49,6 +49,7 @@ static inline AVFrame *pl_get_mapped_avframe(const struct pl_frame *frame)
typedef struct pl_options_t { typedef struct pl_options_t {
// Backwards compatibility shim of this struct // Backwards compatibility shim of this struct
struct pl_render_params params; struct pl_render_params params;
struct pl_deinterlace_params deinterlace_params;
struct pl_deband_params deband_params; struct pl_deband_params deband_params;
struct pl_sigmoid_params sigmoid_params; struct pl_sigmoid_params sigmoid_params;
struct pl_color_adjustment color_adjustment; struct pl_color_adjustment color_adjustment;
@@ -211,6 +212,10 @@ typedef struct LibplaceboContext {
int force_dither; int force_dither;
int disable_fbos; int disable_fbos;
/* pl_deinterlace_params */
int deinterlace;
int skip_spatial_check;
/* pl_deband_params */ /* pl_deband_params */
int deband; int deband;
int deband_iterations; int deband_iterations;
@@ -369,6 +374,11 @@ static int update_settings(AVFilterContext *ctx)
pl_options opts = s->opts; pl_options opts = s->opts;
int gamut_mode = s->gamut_mode; int gamut_mode = s->gamut_mode;
opts->deinterlace_params = *pl_deinterlace_params(
.algo = s->deinterlace,
.skip_spatial_check = s->skip_spatial_check,
);
opts->deband_params = *pl_deband_params( opts->deband_params = *pl_deband_params(
.iterations = s->deband_iterations, .iterations = s->deband_iterations,
.threshold = s->deband_threshold, .threshold = s->deband_threshold,
@@ -433,6 +443,7 @@ static int update_settings(AVFilterContext *ctx)
.corner_rounding = s->corner_rounding, .corner_rounding = s->corner_rounding,
#endif #endif
.deinterlace_params = &opts->deinterlace_params,
.deband_params = s->deband ? &opts->deband_params : NULL, .deband_params = s->deband ? &opts->deband_params : NULL,
.sigmoid_params = s->sigmoid ? &opts->sigmoid_params : NULL, .sigmoid_params = s->sigmoid ? &opts->sigmoid_params : NULL,
.color_adjustment = &opts->color_adjustment, .color_adjustment = &opts->color_adjustment,
@@ -1355,6 +1366,12 @@ static const AVOption libplacebo_options[] = {
{ "apply_filmgrain", "Apply film grain metadata", OFFSET(apply_filmgrain), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC }, { "apply_filmgrain", "Apply film grain metadata", OFFSET(apply_filmgrain), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
{ "apply_dolbyvision", "Apply Dolby Vision metadata", OFFSET(apply_dovi), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC }, { "apply_dolbyvision", "Apply Dolby Vision metadata", OFFSET(apply_dovi), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
{ "deinterlace", "Deinterlacing mode", OFFSET(deinterlace), AV_OPT_TYPE_INT, {.i64 = PL_DEINTERLACE_WEAVE}, 0, PL_DEINTERLACE_ALGORITHM_COUNT - 1, DYNAMIC, .unit = "deinterlace" },
{ "weave", "Weave fields together (no-op)", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DEINTERLACE_WEAVE}, 0, 0, STATIC, .unit = "deinterlace" },
{ "bob", "Naive bob deinterlacing", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DEINTERLACE_BOB}, 0, 0, STATIC, .unit = "deinterlace" },
{ "yadif", "Yet another deinterlacing filter", 0, AV_OPT_TYPE_CONST, {.i64 = PL_DEINTERLACE_YADIF}, 0, 0, STATIC, .unit = "deinterlace" },
{ "skip_spatial_check", "Skip yadif spatial check", OFFSET(skip_spatial_check), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ "deband", "Enable debanding", OFFSET(deband), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, { "deband", "Enable debanding", OFFSET(deband), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
{ "deband_iterations", "Deband iterations", OFFSET(deband_iterations), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 16, DYNAMIC }, { "deband_iterations", "Deband iterations", OFFSET(deband_iterations), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 16, DYNAMIC },
{ "deband_threshold", "Deband threshold", OFFSET(deband_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 4.0}, 0.0, 1024.0, DYNAMIC }, { "deband_threshold", "Deband threshold", OFFSET(deband_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 4.0}, 0.0, 1024.0, DYNAMIC },