FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
vf_yadif.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/cpu.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "yadif.h"
#include <assert.h>

Go to the source code of this file.

Macros

#define PERM_RWP   AV_PERM_WRITE | AV_PERM_PRESERVE | AV_PERM_REUSE
 
#define CHECK(j)
 
#define FILTER
 
#define OFFSET(x)   offsetof(YADIFContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define CONST(name, help, val, unit)   { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
 

Functions

static void filter_line_c (uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode)
 
static void filter_line_c_16bit (uint16_t *dst, uint16_t *prev, uint16_t *cur, uint16_t *next, int w, int prefs, int mrefs, int parity, int mode)
 
static void filter (AVFilterContext *ctx, AVFilterBufferRef *dstpic, int parity, int tff)
 
static int return_frame (AVFilterContext *ctx, int is_second)
 
static int filter_frame (AVFilterLink *link, AVFilterBufferRef *picref)
 
static int request_frame (AVFilterLink *link)
 
 AVFILTER_DEFINE_CLASS (yadif)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx, const char *args)
 
static int config_props (AVFilterLink *link)
 

Variables

static const AVOption yadif_options []
 
static const AVFilterPad avfilter_vf_yadif_inputs []
 
static const AVFilterPad avfilter_vf_yadif_outputs []
 
AVFilter avfilter_vf_yadif
 

Macro Definition Documentation

#define PERM_RWP   AV_PERM_WRITE | AV_PERM_PRESERVE | AV_PERM_REUSE

Definition at line 34 of file vf_yadif.c.

Referenced by filter_frame(), and return_frame().

#define CHECK (   j)
Value:
{ int score = FFABS(cur[mrefs-1+(j)] - cur[prefs-1-(j)])\
+ FFABS(cur[mrefs +(j)] - cur[prefs -(j)])\
+ FFABS(cur[mrefs+1+(j)] - cur[prefs+1-(j)]);\
if (score < spatial_score) {\
spatial_score= score;\
spatial_pred= (cur[mrefs +(j)] + cur[prefs -(j)])>>1;\

Definition at line 36 of file vf_yadif.c.

#define FILTER

Definition at line 44 of file vf_yadif.c.

Referenced by filter_line_c(), and filter_line_c_16bit().

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

Definition at line 300 of file vf_yadif.c.

Definition at line 301 of file vf_yadif.c.

#define CONST (   name,
  help,
  val,
  unit 
)    { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }

Definition at line 303 of file vf_yadif.c.

Function Documentation

static void filter_line_c ( uint8_t dst,
uint8_t prev,
uint8_t cur,
uint8_t next,
int  w,
int  prefs,
int  mrefs,
int  parity,
int  mode 
)
static

Definition at line 84 of file vf_yadif.c.

Referenced by init().

static void filter_line_c_16bit ( uint16_t *  dst,
uint16_t *  prev,
uint16_t *  cur,
uint16_t *  next,
int  w,
int  prefs,
int  mrefs,
int  parity,
int  mode 
)
static

Definition at line 95 of file vf_yadif.c.

Referenced by return_frame().

static void filter ( AVFilterContext ctx,
AVFilterBufferRef dstpic,
int  parity,
int  tff 
)
static

Definition at line 109 of file vf_yadif.c.

Referenced by return_frame().

static int return_frame ( AVFilterContext ctx,
int  is_second 
)
static

Definition at line 171 of file vf_yadif.c.

Referenced by filter_frame(), and request_frame().

static int filter_frame ( AVFilterLink link,
AVFilterBufferRef picref 
)
static

Definition at line 216 of file vf_yadif.c.

Referenced by request_frame().

static int request_frame ( AVFilterLink link)
static

Definition at line 264 of file vf_yadif.c.

AVFILTER_DEFINE_CLASS ( yadif  )
static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 326 of file vf_yadif.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 337 of file vf_yadif.c.

static av_cold int init ( AVFilterContext ctx,
const char *  args 
)
static

Definition at line 369 of file vf_yadif.c.

static int config_props ( AVFilterLink link)
static

Definition at line 394 of file vf_yadif.c.

Variable Documentation

const AVOption yadif_options[]
static
Initial value:
= {
{ "mode", "specify the interlacing mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=YADIF_MODE_SEND_FRAME}, 0, 3, FLAGS, "mode"},
CONST("send_frame", "send one frame for each frame", YADIF_MODE_SEND_FRAME, "mode"),
CONST("send_field", "send one frame for each field", YADIF_MODE_SEND_FIELD, "mode"),
CONST("send_frame_nospatial", "send one frame for each frame, but skip spatial interlacing check", YADIF_MODE_SEND_FRAME_NOSPATIAL, "mode"),
CONST("send_field_nospatial", "send one frame for each field, but skip spatial interlacing check", YADIF_MODE_SEND_FIELD_NOSPATIAL, "mode"),
{ "parity", "specify the assumed picture field parity", OFFSET(parity), AV_OPT_TYPE_INT, {.i64=YADIF_PARITY_AUTO}, -1, 1, FLAGS, "parity" },
CONST("tff", "assume top field first", YADIF_PARITY_TFF, "parity"),
CONST("bff", "assume bottom field first", YADIF_PARITY_BFF, "parity"),
CONST("auto", "auto detect parity", YADIF_PARITY_AUTO, "parity"),
{ "deint", "specify which frames to deinterlace", OFFSET(deint), AV_OPT_TYPE_INT, {.i64=YADIF_DEINT_ALL}, 0, 1, FLAGS, "deint" },
CONST("all", "deinterlace all frames", YADIF_DEINT_ALL, "deint"),
CONST("interlaced", "only deinterlace frames marked as interlaced", YADIF_DEINT_INTERLACED, "deint"),
{NULL},
}

Definition at line 305 of file vf_yadif.c.

const AVFilterPad avfilter_vf_yadif_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.min_perms = AV_PERM_PRESERVE,
},
{ NULL }
}

Definition at line 415 of file vf_yadif.c.

const AVFilterPad avfilter_vf_yadif_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_props,
},
{ NULL }
}

Definition at line 425 of file vf_yadif.c.

AVFilter avfilter_vf_yadif
Initial value:
= {
.name = "yadif",
.description = NULL_IF_CONFIG_SMALL("Deinterlace the input image."),
.priv_size = sizeof(YADIFContext),
.init = init,
.priv_class = &yadif_class,
}

Definition at line 435 of file vf_yadif.c.