FFmpeg
Macros | Functions | Variables
vf_pullup.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.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 32 of file vf_pullup.c.

◆ F_HAVE_AFFINITY

#define F_HAVE_AFFINITY   2

Definition at line 33 of file vf_pullup.c.

◆ BREAK_LEFT

#define BREAK_LEFT   1

Definition at line 35 of file vf_pullup.c.

◆ BREAK_RIGHT

#define BREAK_RIGHT   2

Definition at line 36 of file vf_pullup.c.

◆ OFFSET

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

Definition at line 38 of file vf_pullup.c.

◆ FLAGS

Definition at line 39 of file vf_pullup.c.

◆ ABS

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

Definition at line 66 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 68 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 82 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 97 of file vf_pullup.c.

Referenced by config_input().

◆ alloc_metrics()

static int alloc_metrics ( PullupContext s,
PullupField f 
)
static

Definition at line 110 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 125 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 142 of file vf_pullup.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 176 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 230 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 241 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 256 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 293 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 307 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ compute_breaks()

static void compute_breaks ( PullupContext s,
PullupField f0 
)
static

Definition at line 320 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ compute_affinity()

static void compute_affinity ( PullupContext s,
PullupField f 
)
static

Definition at line 361 of file vf_pullup.c.

Referenced by decide_frame_length().

◆ decide_frame_length()

static int decide_frame_length ( PullupContext s)
static

Definition at line 405 of file vf_pullup.c.

Referenced by pullup_get_frame().

◆ pullup_get_frame()

static PullupFrame* pullup_get_frame ( PullupContext s)
static

Definition at line 461 of file vf_pullup.c.

Referenced by filter_frame().

◆ pullup_release_frame()

static void pullup_release_frame ( PullupFrame f)
static

Definition at line 508 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 523 of file vf_pullup.c.

Referenced by pullup_submit_field().

◆ check_field_queue()

static int check_field_queue ( PullupContext s)
static

Definition at line 554 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 578 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 610 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 626 of file vf_pullup.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 652 of file vf_pullup.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 729 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 41 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 744 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 753 of file vf_pullup.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_pullup.c:176
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
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:39
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_pullup.c:652
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:744
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:38
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_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
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:56
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:94
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:729
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
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
Underlying C type is int.
Definition: opt.h:327
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
Special option type for declaring named constants.
Definition: opt.h:299