FFmpeg
yadif.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVFILTER_YADIF_H
20 #define AVFILTER_YADIF_H
21 
22 #include "libavutil/opt.h"
23 #include "libavutil/pixdesc.h"
24 #include "avfilter.h"
25 #include "ccfifo.h"
26 
27 enum YADIFMode {
28  YADIF_MODE_SEND_FRAME = 0, ///< send 1 frame for each frame
29  YADIF_MODE_SEND_FIELD = 1, ///< send 1 frame for each field
30  YADIF_MODE_SEND_FRAME_NOSPATIAL = 2, ///< send 1 frame for each frame but skips spatial interlacing check
31  YADIF_MODE_SEND_FIELD_NOSPATIAL = 3, ///< send 1 frame for each field but skips spatial interlacing check
32 };
33 
35  YADIF_PARITY_TFF = 0, ///< top field first
36  YADIF_PARITY_BFF = 1, ///< bottom field first
37  YADIF_PARITY_AUTO = -1, ///< auto detection
38 };
39 
40 enum YADIFDeint {
41  YADIF_DEINT_ALL = 0, ///< deinterlace all frames
42  YADIF_DEINT_INTERLACED = 1, ///< only deinterlace frames marked as interlaced
43 };
44 
46  YADIF_FIELD_BACK_END = -1, ///< The last frame in a sequence
47  YADIF_FIELD_END = 0, ///< The first or last field in a sequence
48  YADIF_FIELD_NORMAL = 1, ///< A normal field in the middle of a sequence
49 };
50 
51 typedef struct YADIFContext {
52  const AVClass *class;
53 
54  int mode; ///< YADIFMode
55  int parity; ///< YADIFParity
56  int deint; ///< YADIFDeint
57 
59 
64 
65  void (*filter)(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff);
66 
67  /**
68  * Required alignment for filter_line
69  */
70  void (*filter_line)(void *dst,
71  void *prev, void *cur, void *next,
72  int w, int prefs, int mrefs, int parity, int mode);
73  void (*filter_edges)(void *dst, void *prev, void *cur, void *next,
74  int w, int prefs, int mrefs, int parity, int mode);
75 
77  int eof;
78  uint8_t *temp_line;
81 
82  /*
83  * An algorithm that treats first and/or last fields in a sequence
84  * differently can use this to detect those cases. It is the algorithm's
85  * responsibility to set the value to YADIF_FIELD_NORMAL after processing
86  * the first field.
87  */
88  int current_field; ///< YADIFCurrentField
89 
91 } YADIFContext;
92 
93 void ff_yadif_init_x86(YADIFContext *yadif);
94 
96 
98 
100 
102 
103 extern const AVOption ff_yadif_options[];
104 
105 #endif /* AVFILTER_YADIF_H */
YADIF_MODE_SEND_FIELD
@ YADIF_MODE_SEND_FIELD
send 1 frame for each field
Definition: yadif.h:29
YADIFContext::parity
int parity
YADIFParity.
Definition: yadif.h:55
YADIFContext::temp_line_size
int temp_line_size
Definition: yadif.h:79
opt.h
YADIFContext::frame_pending
int frame_pending
Definition: yadif.h:58
YADIFCurrentField
YADIFCurrentField
Definition: yadif.h:45
ff_yadif_init_x86
void ff_yadif_init_x86(YADIFContext *yadif)
Definition: vf_yadif_init.c:50
YADIFContext::csp
const AVPixFmtDescriptor * csp
Definition: yadif.h:76
YADIFContext::mode
int mode
YADIFMode.
Definition: yadif.h:54
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
pixdesc.h
w
uint8_t w
Definition: llviddspenc.c:38
AVOption
AVOption.
Definition: opt.h:346
YADIF_MODE_SEND_FRAME
@ YADIF_MODE_SEND_FRAME
send 1 frame for each frame
Definition: yadif.h:28
YADIF_MODE_SEND_FIELD_NOSPATIAL
@ YADIF_MODE_SEND_FIELD_NOSPATIAL
send 1 frame for each field but skips spatial interlacing check
Definition: yadif.h:31
ff_yadif_config_output_common
int ff_yadif_config_output_common(AVFilterLink *outlink)
Definition: yadif_common.c:218
YADIF_PARITY_AUTO
@ YADIF_PARITY_AUTO
auto detection
Definition: yadif.h:37
YADIFDeint
YADIFDeint
Definition: yadif.h:40
YADIFContext::deint
int deint
YADIFDeint.
Definition: yadif.h:56
YADIF_MODE_SEND_FRAME_NOSPATIAL
@ YADIF_MODE_SEND_FRAME_NOSPATIAL
send 1 frame for each frame but skips spatial interlacing check
Definition: yadif.h:30
ctx
AVFormatContext * ctx
Definition: movenc.c:48
link
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
Definition: filter_design.txt:23
frame
static AVFrame * frame
Definition: demux_decode.c:54
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
YADIFContext::eof
int eof
Definition: yadif.h:77
YADIFContext::temp_line
uint8_t * temp_line
Definition: yadif.h:78
CCFifo
Definition: ccfifo.h:40
YADIFParity
YADIFParity
Definition: yadif.h:34
ff_yadif_options
const AVOption ff_yadif_options[]
Definition: yadif_common.c:271
YADIFContext::out
AVFrame * out
Definition: yadif.h:63
YADIFContext::filter
void(* filter)(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff)
Definition: yadif.h:65
YADIFContext::prev
AVFrame * prev
Definition: yadif.h:62
YADIFContext::filter_line
void(* filter_line)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int parity, int mode)
Required alignment for filter_line.
Definition: yadif.h:70
YADIFContext::pts_multiplier
int pts_multiplier
Definition: yadif.h:90
YADIFMode
YADIFMode
Definition: yadif.h:27
YADIFContext
Definition: yadif.h:51
YADIF_DEINT_ALL
@ YADIF_DEINT_ALL
deinterlace all frames
Definition: yadif.h:41
YADIFContext::next
AVFrame * next
Definition: yadif.h:61
YADIF_FIELD_END
@ YADIF_FIELD_END
The first or last field in a sequence.
Definition: yadif.h:47
ff_yadif_request_frame
int ff_yadif_request_frame(AVFilterLink *link)
Definition: yadif_common.c:184
avfilter.h
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
YADIF_FIELD_NORMAL
@ YADIF_FIELD_NORMAL
A normal field in the middle of a sequence.
Definition: yadif.h:48
YADIF_DEINT_INTERLACED
@ YADIF_DEINT_INTERLACED
only deinterlace frames marked as interlaced
Definition: yadif.h:42
YADIF_FIELD_BACK_END
@ YADIF_FIELD_BACK_END
The last frame in a sequence.
Definition: yadif.h:46
YADIF_PARITY_TFF
@ YADIF_PARITY_TFF
top field first
Definition: yadif.h:35
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
ff_yadif_uninit
void ff_yadif_uninit(AVFilterContext *ctx)
Definition: yadif_common.c:256
YADIFContext::current_field
int current_field
YADIFCurrentField.
Definition: yadif.h:88
YADIFContext::cc_fifo
CCFifo cc_fifo
Definition: yadif.h:80
ccfifo.h
YADIFContext::cur
AVFrame * cur
Definition: yadif.h:60
ff_yadif_filter_frame
int ff_yadif_filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: yadif_common.c:104
YADIF_PARITY_BFF
@ YADIF_PARITY_BFF
bottom field first
Definition: yadif.h:36
YADIFContext::filter_edges
void(* filter_edges)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int parity, int mode)
Definition: yadif.h:73