avfilter/vf_interlace: fix numerical options

Regression since 9c01cdb94e

Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
This commit is contained in:
Thomas Mundt 2018-08-23 23:37:10 +02:00 committed by Paul B Mahol
parent cc24665f44
commit f4438e387e
2 changed files with 22 additions and 6 deletions

View File

@ -34,8 +34,8 @@
#include "avfilter.h"
#define TINTERLACE_FLAG_VLPF 01
#define TINTERLACE_FLAG_EXACT_TB 2
#define TINTERLACE_FLAG_CVLPF 4
#define TINTERLACE_FLAG_CVLPF 2
#define TINTERLACE_FLAG_EXACT_TB 4
enum TInterlaceMode {
MODE_MERGE = 0,
@ -49,6 +49,11 @@ enum TInterlaceMode {
MODE_NB,
};
enum InterlaceScanMode {
MODE_TFF = 0,
MODE_BFF,
};
typedef struct TInterlaceContext {
const AVClass *class;
int mode; ///< TInterlaceMode, interlace mode selected

View File

@ -60,10 +60,10 @@ static const AVOption tinterlace_options[] = {
AVFILTER_DEFINE_CLASS(tinterlace);
static const AVOption interlace_options[] = {
{ "scan", "scanning mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_INTERLEAVE_TOP}, 0, MODE_NB-1, FLAGS, "mode"},
{ "tff", "top field first", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_TOP}, INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "bff", "bottom field first", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_BOTTOM}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
{ "lowpass", "set vertical low-pass filter", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = TINTERLACE_FLAG_VLPF}, 0,INT_MAX, 0, "flags" },
{ "scan", "scanning mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MODE_TFF}, 0, 1, FLAGS, "mode"},
{ "tff", "top field first", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
{ "bff", "bottom field first", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
{ "lowpass", "set vertical low-pass filter", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = TINTERLACE_FLAG_VLPF}, 0, 2, 0, "flags" },
{ "off", "disable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, FLAGS, "flags" },
{ "linear", "linear vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
{ "complex", "complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
@ -511,6 +511,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
return ret;
}
static int init_interlace(AVFilterContext *ctx)
{
TInterlaceContext *tinterlace = ctx->priv;
if (tinterlace->mode <= MODE_BFF)
tinterlace->mode += MODE_INTERLEAVE_TOP;
return 0;
}
static const AVFilterPad tinterlace_inputs[] = {
{
.name = "default",
@ -545,6 +555,7 @@ AVFilter ff_vf_interlace = {
.name = "interlace",
.description = NULL_IF_CONFIG_SMALL("Convert progressive video into interlaced."),
.priv_size = sizeof(TInterlaceContext),
.init = init_interlace,
.uninit = uninit,
.query_formats = query_formats,
.inputs = tinterlace_inputs,