FFmpeg
Macros | Functions | Variables
vf_pullup.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
#include "vf_pullup.h"

Go to the source code of this file.

Macros

#define F_HAVE_BREAKS   1
 
#define F_HAVE_AFFINITY   2
 
#define BREAK_LEFT   1
 
#define BREAK_RIGHT   2
 
#define OFFSET(x)   offsetof(PullupContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define ABS(a)   (((a) ^ ((a) >> 31)) - ((a) >> 31))
 

Functions

 AVFILTER_DEFINE_CLASS (pullup)
 
static int diff_c (const uint8_t *a, const uint8_t *b, ptrdiff_t s)
 
static int comb_c (const uint8_t *a, const uint8_t *b, ptrdiff_t s)
 
static int var_c (const uint8_t *a, const uint8_t *b, ptrdiff_t s)
 
static int alloc_metrics (PullupContext *s, PullupField *f)
 
static void free_field_queue (PullupField *head)
 
static PullupFieldmake_field_queue (PullupContext *s, int len)
 
static int config_input (AVFilterLink *inlink)
 
static PullupBufferpullup_lock_buffer (PullupBuffer *b, int parity)
 
static void pullup_release_buffer (PullupBuffer *b, int parity)
 
static int alloc_buffer (PullupContext *s, PullupBuffer *b)
 
static PullupBufferpullup_get_buffer (PullupContext *s, int parity)
 
static int queue_length (PullupField *begin, PullupField *end)
 
static int find_first_break (PullupField *f, int max)
 
static void compute_breaks (PullupContext *s, PullupField *f0)
 
static void compute_affinity (PullupContext *s, PullupField *f)
 
static int decide_frame_length (PullupContext *s)
 
static PullupFramepullup_get_frame (PullupContext *s)
 
static void pullup_release_frame (PullupFrame *f)
 
static void compute_metric (PullupContext *s, int *dest, PullupField *fa, int pa, PullupField *fb, int pb, int(*func)(const uint8_t *, const uint8_t *, ptrdiff_t))
 
static int check_field_queue (PullupContext *s)
 
static void pullup_submit_field (PullupContext *s, PullupBuffer *b, int parity)
 
static void copy_field (PullupContext *s, PullupBuffer *dst, PullupBuffer *src, int parity)
 
static void pullup_pack_frame (PullupContext *s, PullupFrame *fr)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption pullup_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad pullup_inputs []
 
const AVFilter ff_vf_pullup
 

Macro Definition Documentation

◆ F_HAVE_BREAKS

#define F_HAVE_BREAKS   1

Definition at line 31 of file vf_pullup.c.

◆ F_HAVE_AFFINITY

#define F_HAVE_AFFINITY   2

Definition at line 32 of file vf_pullup.c.

◆ BREAK_LEFT

#define BREAK_LEFT   1

Definition at line 34 of file vf_pullup.c.

◆ BREAK_RIGHT

#define BREAK_RIGHT   2

Definition at line 35 of file vf_pullup.c.

◆ OFFSET

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

Definition at line 37 of file vf_pullup.c.

◆ FLAGS

Definition at line 38 of file vf_pullup.c.

◆ ABS

#define ABS (   a)    (((a) ^ ((a) >> 31)) - ((a) >> 31))

Definition at line 65 of file vf_pullup.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( pullup  )

◆ diff_c()

static int diff_c ( const uint8_t *  a,
const uint8_t *  b,
ptrdiff_t  s 
)
static

Definition at line 67 of file vf_pullup.c.

Referenced by config_input().

◆ comb_c()

static int comb_c ( const uint8_t *  a,
const uint8_t *  b,
ptrdiff_t  s 
)
static

Definition at line 81 of file vf_pullup.c.

Referenced by config_input().

◆ var_c()

static int var_c ( const uint8_t *  a,
const uint8_t *  b,
ptrdiff_t  s 
)
static

Definition at line 96 of file vf_pullup.c.

Referenced by config_input().

◆ alloc_metrics()

static int alloc_metrics ( PullupContext s,
PullupField f 
)
static

Definition at line 109 of file vf_pullup.c.

Referenced by check_field_queue(), and make_field_queue().

◆ free_field_queue()

static void free_field_queue ( PullupField head)
static

Definition at line 124 of file vf_pullup.c.

Referenced by make_field_queue(), and uninit().

◆ make_field_queue()

static PullupField* make_field_queue ( PullupContext s,
int  len 
)
static

Definition at line 141 of file vf_pullup.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 175 of file vf_pullup.c.

◆ pullup_lock_buffer()

static PullupBuffer* pullup_lock_buffer ( PullupBuffer b,
int  parity 
)
static

◆ pullup_release_buffer()

static void pullup_release_buffer ( PullupBuffer b,
int  parity 
)
static

Definition at line 229 of file vf_pullup.c.

Referenced by filter_frame(), and pullup_release_frame().

◆ alloc_buffer()

static int alloc_buffer ( PullupContext s,
PullupBuffer b 
)
static

Definition at line 240 of file vf_pullup.c.

Referenced by pullup_get_buffer().

◆ pullup_get_buffer()

static PullupBuffer* pullup_get_buffer ( PullupContext s,
int  parity 
)
static

Definition at line 255 of file vf_pullup.c.

Referenced by filter_frame(), and pullup_pack_frame().

◆ queue_length()

static int queue_length ( PullupField begin,
PullupField end 
)
static

Definition at line 292 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ find_first_break()

static int find_first_break ( PullupField f,
int  max 
)
static

Definition at line 306 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ compute_breaks()

static void compute_breaks ( PullupContext s,
PullupField f0 
)
static

Definition at line 319 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ compute_affinity()

static void compute_affinity ( PullupContext s,
PullupField f 
)
static

Definition at line 360 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ decide_frame_length()

static int decide_frame_length ( PullupContext s)
static

Definition at line 404 of file vf_pullup.c.

Referenced by pullup_get_frame().

◆ pullup_get_frame()

static PullupFrame* pullup_get_frame ( PullupContext s)
static

Definition at line 460 of file vf_pullup.c.

Referenced by filter_frame().

◆ pullup_release_frame()

static void pullup_release_frame ( PullupFrame f)
static

Definition at line 507 of file vf_pullup.c.

Referenced by filter_frame().

◆ compute_metric()

static void compute_metric ( PullupContext s,
int dest,
PullupField fa,
int  pa,
PullupField fb,
int  pb,
int(*)(const uint8_t *, const uint8_t *, ptrdiff_t)  func 
)
static

Definition at line 522 of file vf_pullup.c.

Referenced by pullup_submit_field().

◆ check_field_queue()

static int check_field_queue ( PullupContext s)
static

Definition at line 553 of file vf_pullup.c.

Referenced by pullup_submit_field().

◆ pullup_submit_field()

static void pullup_submit_field ( PullupContext s,
PullupBuffer b,
int  parity 
)
static

Definition at line 577 of file vf_pullup.c.

Referenced by filter_frame().

◆ copy_field()

static void copy_field ( PullupContext s,
PullupBuffer dst,
PullupBuffer src,
int  parity 
)
static

Definition at line 609 of file vf_pullup.c.

Referenced by pullup_pack_frame().

◆ pullup_pack_frame()

static void pullup_pack_frame ( PullupContext s,
PullupFrame fr 
)
static

Definition at line 625 of file vf_pullup.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 651 of file vf_pullup.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 728 of file vf_pullup.c.

Variable Documentation

◆ pullup_options

const AVOption pullup_options[]
static
Initial value:
= {
{ "jl", "set left junk size", OFFSET(junk_left), AV_OPT_TYPE_INT, {.i64=1}, 0, INT_MAX, FLAGS },
{ "jr", "set right junk size", OFFSET(junk_right), AV_OPT_TYPE_INT, {.i64=1}, 0, INT_MAX, FLAGS },
{ "jt", "set top junk size", OFFSET(junk_top), AV_OPT_TYPE_INT, {.i64=4}, 1, INT_MAX, FLAGS },
{ "jb", "set bottom junk size", OFFSET(junk_bottom), AV_OPT_TYPE_INT, {.i64=4}, 1, INT_MAX, FLAGS },
{ "sb", "set strict breaks", OFFSET(strict_breaks), AV_OPT_TYPE_BOOL,{.i64=0},-1, 1, FLAGS },
{ "mp", "set metric plane", OFFSET(metric_plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, .unit = "mp" },
{ "y", "luma", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "mp" },
{ "u", "chroma blue", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "mp" },
{ "v", "chroma red", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "mp" },
{ NULL }
}

Definition at line 40 of file vf_pullup.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ pullup_inputs

const AVFilterPad pullup_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}

Definition at line 743 of file vf_pullup.c.

◆ ff_vf_pullup

const AVFilter ff_vf_pullup
Initial value:
= {
.name = "pullup",
.description = NULL_IF_CONFIG_SMALL("Pullup from field sequence to frames."),
.priv_size = sizeof(PullupContext),
.priv_class = &pullup_class,
}

Definition at line 752 of file vf_pullup.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_pullup.c:175
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
FLAGS
#define FLAGS
Definition: vf_pullup.c:38
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_pullup.c:651
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
pullup_inputs
static const AVFilterPad pullup_inputs[]
Definition: vf_pullup.c:743
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
OFFSET
#define OFFSET(x)
Definition: vf_pullup.c:37
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
PullupContext
Definition: vf_pullup.h:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_pullup.c:55
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_pullup.c:728
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244