41 #define OFFSET(x) offsetof(InterlaceContext, x) 42 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 44 {
"scan",
"scanning mode",
OFFSET(scan),
46 {
"tff",
"top field first", 0,
48 {
"bff",
"bottom field first", 0,
52 {
"off",
"disable vertical low-pass filter", 0,
54 {
"linear",
"linear vertical low-pass filter", 0,
56 {
"complex",
"complex vertical low-pass filter", 0,
65 ptrdiff_t pref,
int clip_max)
67 const uint8_t *srcp_above = srcp + mref;
68 const uint8_t *srcp_below = srcp + pref;
70 for (i = 0; i < linesize; i++) {
74 dstp[i] = (1 + srcp[i] + srcp[i] + srcp_above[i] + srcp_below[i]) >> 2;
79 const uint8_t *src8, ptrdiff_t mref,
80 ptrdiff_t pref,
int clip_max)
82 uint16_t *
dstp = (uint16_t *)dst8;
83 const uint16_t *
srcp = (
const uint16_t *)src8;
84 const uint16_t *srcp_above = srcp + mref / 2;
85 const uint16_t *srcp_below = srcp + pref / 2;
87 for (i = 0; i < linesize; i++) {
99 ptrdiff_t pref,
int clip_max)
101 const uint8_t *srcp_above = srcp + mref;
102 const uint8_t *srcp_below = srcp + pref;
103 const uint8_t *srcp_above2 = srcp + mref * 2;
104 const uint8_t *srcp_below2 = srcp + pref * 2;
105 int i, src_x, src_ab;
106 for (i = 0; i < linesize; i++) {
110 src_x = srcp[i] << 1;
111 src_ab = srcp_above[i] + srcp_below[i];
112 dstp[i] = av_clip_uint8((4 + ((srcp[i] + src_x + src_ab) << 1)
113 - srcp_above2[i] - srcp_below2[i]) >> 3);
117 if (src_ab > src_x) {
118 if (dstp[i] < srcp[i])
120 }
else if (dstp[i] > srcp[i])
126 const uint8_t *src8, ptrdiff_t mref,
127 ptrdiff_t pref,
int clip_max)
129 uint16_t *
dstp = (uint16_t *)dst8;
130 const uint16_t *
srcp = (
const uint16_t *)src8;
131 const uint16_t *srcp_above = srcp + mref / 2;
132 const uint16_t *srcp_below = srcp + pref / 2;
133 const uint16_t *srcp_above2 = srcp + mref;
134 const uint16_t *srcp_below2 = srcp + pref;
135 int i, dst_le, src_le, src_x, src_ab;
136 for (i = 0; i < linesize; i++) {
143 dst_le = av_clip((4 + ((src_le + src_x + src_ab) << 1)
145 -
av_le2ne16(srcp_below2[i])) >> 3, 0, clip_max);
149 if (src_ab > src_x) {
154 }
else if (dst_le > src_le) {
220 "the resulting video will be aliased rather than interlaced.\n");
223 outlink->
w = inlink->
w;
224 outlink->
h = inlink->
h;
251 int cols = (plane == 1 || plane == 2) ? -(-inlink->
w) >> hsub : inlink->
w;
252 int lines = (plane == 1 || plane == 2) ?
AV_CEIL_RSHIFT(inlink->
h, vsub) : inlink->
h;
270 for (j = lines; j > 0; j--) {
272 ptrdiff_t mref = -pref;
273 if (j >= (lines - x))
275 else if (j <= (1 + x))
277 s->
lowpass_line(dstp, cols, srcp, mref, pref, clip_max);
278 dstp += dstp_linesize;
279 srcp += srcp_linesize;
307 "video is already interlaced, adjusting framerate only\n");
361 .priv_class = &interlace_class,
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
static const AVFilterPad inputs[]
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
int h
agreed upon image height
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static enum AVPixelFormat formats_supported[]
static int query_formats(AVFilterContext *ctx)
BYTE int const BYTE * srcp
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
static int config_out_props(AVFilterLink *outlink)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static const AVFilterPad outputs[]
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_LOG_VERBOSE
Detailed information.
int interlaced_frame
The content of the picture is interlaced.
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void(* lowpass_line)(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#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:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
uint8_t nb_components
The number of components each pixel has, (1-4)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
progressive to interlaced content filter, inspired by heavy debugging of tinterlace filter...
AVFilterContext * src
source filter
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int format
agreed upon media format
static av_cold void uninit(AVFilterContext *ctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVFILTER_DEFINE_CLASS(interlace)
static void copy_picture_field(InterlaceContext *s, AVFrame *src_frame, AVFrame *dst_frame, AVFilterLink *inlink, enum FieldType field_type, int lowpass)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static void lowpass_line_c(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
const char * name
Filter name.
static void lowpass_line_complex_c(uint8_t *dstp, ptrdiff_t linesize, const uint8_t *srcp, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
void ff_interlace_init_x86(InterlaceContext *interlace, int depth)
AVFilterLink ** outputs
array of pointers to output links
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
static const AVOption interlace_options[]
common internal and external API header
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
static void lowpass_line_c_16(uint8_t *dst8, ptrdiff_t linesize, const uint8_t *src8, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
int top_field_first
If the content is interlaced, is top field displayed first.
AVFilterContext * dst
dest filter
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
static void lowpass_line_complex_c_16(uint8_t *dst8, ptrdiff_t linesize, const uint8_t *src8, ptrdiff_t mref, ptrdiff_t pref, int clip_max)
void ff_interlace_init(InterlaceContext *s, int depth)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
const AVPixFmtDescriptor * csp
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_CEIL_RSHIFT(a, b)