59 void (*filter_line)(uint8_t *dst,
60 uint8_t *prev, uint8_t *cur, uint8_t *next,
61 int w,
int prefs,
int mrefs,
int parity,
int mode);
67 { int score = FFABS(cur[mrefs-1+(j)] - cur[prefs-1-(j)])\
68 + FFABS(cur[mrefs +(j)] - cur[prefs -(j)])\
69 + FFABS(cur[mrefs+1+(j)] - cur[prefs+1-(j)]);\
70 if (score < spatial_score) {\
71 spatial_score= score;\
72 spatial_pred= (cur[mrefs +(j)] + cur[prefs -(j)])>>1;\
75 for (x = 0; x < w; x++) { \
77 int d = (prev2[0] + next2[0])>>1; \
79 int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
80 int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; \
81 int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \
82 int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); \
83 int spatial_pred = (c+e)>>1; \
84 int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e) \
85 + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1; \
87 CHECK(-1) CHECK(-2) }} }} \
88 CHECK( 1) CHECK( 2) }} }} \
91 int b = (prev2[2*mrefs] + next2[2*mrefs])>>1; \
92 int f = (prev2[2*prefs] + next2[2*prefs])>>1; \
93 int max = FFMAX3(d-e, d-c, FFMIN(b-c, f-e)); \
94 int min = FFMIN3(d-e, d-c, FFMAX(b-c, f-e)); \
96 diff = FFMAX3(diff, min, -max); \
99 if (spatial_pred > d + diff) \
100 spatial_pred = d + diff; \
101 else if (spatial_pred < d - diff) \
102 spatial_pred = d - diff; \
104 dst[0] = spatial_pred; \
115 uint8_t *prev, uint8_t *cur, uint8_t *next,
116 int w,
int prefs,
int mrefs,
int parity,
int mode)
119 uint8_t *
prev2 = parity ? prev : cur ;
120 uint8_t *
next2 = parity ? cur : next;
126 uint16_t *prev, uint16_t *cur, uint16_t *next,
127 int w,
int prefs,
int mrefs,
int parity,
int mode)
130 uint16_t *
prev2 = parity ? prev : cur ;
131 uint16_t *
next2 = parity ? cur : next;
150 if (i == 1 || i == 2) {
156 for (y = 0; y < h; y++) {
157 if ((y ^ parity) & 1) {
158 uint8_t *prev = &yadif->
prev->
data[i][y*refs];
159 uint8_t *cur = &yadif->
cur ->
data[i][y*refs];
160 uint8_t *next = &yadif->
next->
data[i][y*refs];
162 int mode = y==1 || y+2==h ? 2 : yadif->
mode;
163 yadif->
filter_line(dst, prev, cur, next, w, y+1<h ? refs : -refs, y ? -refs : refs, parity ^ tff, mode);
166 &yadif->
cur->
data[i][y*refs], w*df);
171 __asm__
volatile(
"emms \n\t" : : :
"memory");
187 for (i = 0; i < 3; i++)
199 if (yadif->
parity == -1) {
218 filter(ctx, yadif->
out, tff ^ !is_second, tff);
249 yadif->
next = picref;
305 }
while (!yadif->
cur);
320 if (val==1 && !yadif->
next) {
325 assert(yadif->
next || !val);
330 return val * ((yadif->
mode&1)+1);
void ff_yadif_filter_line_mmx(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
AVFilterBufferRef * avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
Request a picture buffer with a specific set of permissions.
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 void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
AVFilterBufferRefVideoProps * video
video buffer specific properties
int linesize[8]
number of bytes per line
static void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
Copy properties of src to dst, without copying the actual data.
int h
agreed upon image height
#define AV_PERM_REUSE
can output the buffer multiple times, with the same contents each time
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define AV_PERM_READ
can read from the buffer
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
AVFilterLink ** inputs
array of pointers to input links
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
static int request_frame(AVFilterLink *link)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
int top_field_first
field order
void avfilter_end_frame(AVFilterLink *link)
Notifie the next filter that the current frame has finished.
void(* filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
int64_t pts
presentation timestamp.
A filter pad used for either input or output.
Y , 16bpp, little-endian.
A link between two filters.
uint16_t depth_minus1
number of bits in the component minus 1
void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
#define AV_CPU_FLAG_SSSE3
Conroe SSSE3 functions.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
AVFilterBufferRef * avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
default handler for get_video_buffer() for video inputs
void av_log(void *avcl, int level, const char *fmt,...)
AVFilterFormats * avfilter_make_format_list(const int *fmts)
Create a list of supported formats.
static void return_frame(AVFilterContext *ctx, int is_second)
static int query_formats(AVFilterContext *ctx)
const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB]
The array of all the pixel format descriptors.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int w
agreed upon image width
int auto_enable
0: deinterlace all frames 1: only deinterlace frames marked as interlaced
int avfilter_poll_frame(AVFilterLink *link)
Poll a frame from the filter chain.
uint8_t nb_components
The number of components each pixel has, (1-4)
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
AVFilterContext * src
source filter
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)
void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
Send a slice to the next filter.
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
int format
agreed upon media format
void ff_yadif_filter_line_ssse3(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode)
void avfilter_unref_buffer(AVFilterBufferRef *ref)
Remove a reference to a buffer.
static int poll_frame(AVFilterLink *link)
A reference to an AVFilterBuffer.
static void end_frame(AVFilterLink *link)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AV_CPU_FLAG_MMX
standard MMX
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
AVFilterBufferRef * avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
Add a new reference to a buffer.
void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
Notify the next filter of the start of a frame.
AVFilter avfilter_vf_yadif
int avfilter_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
int parity
0: top field first 1: bottom field first -1: auto-detection
const char * name
filter name
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
AVFilterLink ** outputs
array of pointers to output links
#define AV_PERM_PRESERVE
nobody else can overwrite the buffer
const AVPixFmtDescriptor * csp
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
static AVFilterBufferRef * get_video_buffer(AVFilterLink *link, int perms, int w, int h)
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
int interlaced
is frame interlaced
common internal and external API header
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
#define AV_PERM_WRITE
can write to the buffer
static av_cold void uninit(AVFilterContext *ctx)
void ff_yadif_filter_line_sse2(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode)
AVFilterContext * dst
dest filter
static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
uint8_t * data[8]
picture/audio data for each plane
#define AV_CPU_FLAG_SSE2
PIV SSE2 functions.
int mode
0: send 1 frame for each frame 1: send 1 frame for each field 2: like 0 but skips spatial interlacing...
#define AV_NOPTS_VALUE
Undefined timestamp value.
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)