FFmpeg  4.0
Macros | Functions | Variables
vf_tinterlace.c File Reference

temporal field interlace filter, ported from MPlayer/libmpcodecs More...

#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
#include "avfilter.h"
#include "internal.h"
#include "tinterlace.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(TInterlaceContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define FULL_SCALE_YUVJ_FORMATS   AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
 
#define FIELD_UPPER   0
 
#define FIELD_LOWER   1
 
#define FIELD_UPPER_AND_LOWER   2
 

Functions

 AVFILTER_DEFINE_CLASS (tinterlace)
 
static int query_formats (AVFilterContext *ctx)
 
static void lowpass_line_c (uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
 
static void lowpass_line_c_16 (uint8_t *dst8, ptrdiff_t width, const uint8_t *src8, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
 
static void lowpass_line_complex_c (uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
 
static void lowpass_line_complex_c_16 (uint8_t *dst8, ptrdiff_t width, const uint8_t *src8, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_out_props (AVFilterLink *outlink)
 
static void copy_picture_field (TInterlaceContext *tinterlace, uint8_t *dst[4], int dst_linesize[4], const uint8_t *src[4], int src_linesize[4], enum AVPixelFormat format, int w, int src_h, int src_field, int interleave, int dst_field, int flags)
 Copy picture field from src to dst. More...
 
static int filter_frame (AVFilterLink *inlink, AVFrame *picref)
 

Variables

static const AVOption tinterlace_options []
 
static enum AVPixelFormat full_scale_yuvj_pix_fmts []
 
static const AVRational standard_tbs []
 
static const AVFilterPad tinterlace_inputs []
 
static const AVFilterPad tinterlace_outputs []
 
AVFilter ff_vf_tinterlace
 

Detailed Description

temporal field interlace filter, ported from MPlayer/libmpcodecs

Definition in file vf_tinterlace.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(TInterlaceContext, x)

Definition at line 36 of file vf_tinterlace.c.

◆ FLAGS

Definition at line 37 of file vf_tinterlace.c.

◆ FULL_SCALE_YUVJ_FORMATS

Definition at line 62 of file vf_tinterlace.c.

Referenced by query_formats().

◆ FIELD_UPPER

#define FIELD_UPPER   0

Definition at line 284 of file vf_tinterlace.c.

Referenced by copy_picture_field(), and filter_frame().

◆ FIELD_LOWER

#define FIELD_LOWER   1

Definition at line 285 of file vf_tinterlace.c.

Referenced by copy_picture_field(), and filter_frame().

◆ FIELD_UPPER_AND_LOWER

#define FIELD_UPPER_AND_LOWER   2

Definition at line 286 of file vf_tinterlace.c.

Referenced by copy_picture_field(), and filter_frame().

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( tinterlace  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 75 of file vf_tinterlace.c.

◆ lowpass_line_c()

static void lowpass_line_c ( uint8_t dstp,
ptrdiff_t  width,
const uint8_t srcp,
ptrdiff_t  mref,
ptrdiff_t  pref,
int  clip_max 
)
static

Definition at line 97 of file vf_tinterlace.c.

Referenced by config_out_props().

◆ lowpass_line_c_16()

static void lowpass_line_c_16 ( uint8_t dst8,
ptrdiff_t  width,
const uint8_t src8,
ptrdiff_t  mref,
ptrdiff_t  pref,
int  clip_max 
)
static

Definition at line 111 of file vf_tinterlace.c.

Referenced by config_out_props().

◆ lowpass_line_complex_c()

static void lowpass_line_complex_c ( uint8_t dstp,
ptrdiff_t  width,
const uint8_t srcp,
ptrdiff_t  mref,
ptrdiff_t  pref,
int  clip_max 
)
static

Definition at line 129 of file vf_tinterlace.c.

Referenced by config_out_props().

◆ lowpass_line_complex_c_16()

static void lowpass_line_complex_c_16 ( uint8_t dst8,
ptrdiff_t  width,
const uint8_t src8,
ptrdiff_t  mref,
ptrdiff_t  pref,
int  clip_max 
)
static

Definition at line 156 of file vf_tinterlace.c.

Referenced by config_out_props().

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 191 of file vf_tinterlace.c.

◆ config_out_props()

static int config_out_props ( AVFilterLink outlink)
static

Definition at line 200 of file vf_tinterlace.c.

◆ copy_picture_field()

static void copy_picture_field ( TInterlaceContext tinterlace,
uint8_t dst[4],
int  dst_linesize[4],
const uint8_t src[4],
int  src_linesize[4],
enum AVPixelFormat  format,
int  w,
int  src_h,
int  src_field,
int  interleave,
int  dst_field,
int  flags 
)
inlinestatic

Copy picture field from src to dst.

Parameters
src_fieldcopy from upper, lower field or both
interleaveleave a padding line between each copied line
dst_fieldcopy to upper or lower field, only meaningful when interleave is selected
flagscontext flags

Definition at line 298 of file vf_tinterlace.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame picref 
)
static

Definition at line 348 of file vf_tinterlace.c.

Variable Documentation

◆ tinterlace_options

const AVOption tinterlace_options[]
static
Initial value:
= {
{"mode", "select interlace mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_MERGE}, 0, MODE_NB-1, FLAGS, "mode"},
{"merge", "merge fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_MERGE}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"drop_even", "drop even fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_DROP_EVEN}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"drop_odd", "drop odd fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_DROP_ODD}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"pad", "pad alternate lines with black", 0, AV_OPT_TYPE_CONST, {.i64=MODE_PAD}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"interleave_top", "interleave top and bottom fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_TOP}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"interleave_bottom", "interleave bottom and top fields", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLEAVE_BOTTOM}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"interlacex2", "interlace fields from two consecutive frames", 0, AV_OPT_TYPE_CONST, {.i64=MODE_INTERLACEX2}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"mergex2", "merge fields keeping same frame rate", 0, AV_OPT_TYPE_CONST, {.i64=MODE_MERGEX2}, INT_MIN, INT_MAX, FLAGS, "mode"},
{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 0, "flags" },
{"low_pass_filter", "enable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
{"vlpf", "enable vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
{"complex_filter", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
{"cvlpf", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
{"exact_tb", "force a timebase which can represent timestamps exactly", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_EXACT_TB}, INT_MIN, INT_MAX, FLAGS, "flags" },
{NULL}
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: vf_tinterlace.c:36
#define TINTERLACE_FLAG_CVLPF
Definition: tinterlace.h:38
static int flags
Definition: log.c:55
#define TINTERLACE_FLAG_VLPF
Definition: tinterlace.h:36
#define FLAGS
Definition: vf_tinterlace.c:37
#define TINTERLACE_FLAG_EXACT_TB
Definition: tinterlace.h:37
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83

Definition at line 39 of file vf_tinterlace.c.

◆ full_scale_yuvj_pix_fmts

enum AVPixelFormat full_scale_yuvj_pix_fmts[]
static
Initial value:

Definition at line 65 of file vf_tinterlace.c.

Referenced by config_out_props().

◆ standard_tbs

const AVRational standard_tbs[]
static
Initial value:
= {
{1, 25},
{1, 30},
{1001, 30000},
}

Definition at line 69 of file vf_tinterlace.c.

◆ tinterlace_inputs

const AVFilterPad tinterlace_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)

Definition at line 500 of file vf_tinterlace.c.

◆ tinterlace_outputs

const AVFilterPad tinterlace_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_out_props,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_out_props(AVFilterLink *outlink)

Definition at line 509 of file vf_tinterlace.c.

◆ ff_vf_tinterlace

AVFilter ff_vf_tinterlace
Initial value:
= {
.name = "tinterlace",
.description = NULL_IF_CONFIG_SMALL("Perform temporal field interlacing."),
.priv_size = sizeof(TInterlaceContext),
.priv_class = &tinterlace_class,
}
static int query_formats(AVFilterContext *ctx)
Definition: vf_tinterlace.c:75
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad tinterlace_outputs[]
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static const AVFilterPad tinterlace_inputs[]

Definition at line 518 of file vf_tinterlace.c.