Go to the documentation of this file.
76 if (
s->input ==
NULL) {
119 outlink->
w =
ctx->inputs[0]->w;
120 outlink->
h =
ctx->inputs[0]->h;
121 outlink->
format =
ctx->inputs[0]->format;
126 s->hold = outlink->
w;
133 uint8_t black_data[] = { 0x10, 0x80, 0x80, 0x10 };
143 black_data[0] = black_data[3] = 0;
146 outlink->
h, outlink->
format, 1);
151 for (j = 0; j < (!
i ? outlink->
h
152 : -((-outlink->
h) >>
desc->log2_chroma_h)); j++)
153 memset(
s->black_buffers[
i] + j *
s->black_linesizes[
i],
168 uint8_t *dst_data[4],
int dst_linesizes[4],
169 const uint8_t *src_data[4],
const int src_linesizes[4],
175 const uint8_t *
src[4];
177 dst[0] = dst_data[0] + ncol;
178 dst[1] = dst_data[1] + (ncol >>
s->desc->log2_chroma_w);
179 dst[2] = dst_data[2] + (ncol >>
s->desc->log2_chroma_w);
183 src[0] = src_data[0] + ncol;
184 src[1] = src_data[1] + (ncol >>
s->desc->log2_chroma_w);
185 src[2] = src_data[2] + (ncol >>
s->desc->log2_chroma_w);
203 for ( ; ncol <
s->hold; ncol++)
205 (
const uint8_t **)
s->black_buffers,
s->black_linesizes,
211 for ( ; ncol <
s->input_size; ncol++) {
215 (
const uint8_t **)
src->data,
src->linesize,
227 for ( ; ncol < outlink->
w; ncol++)
229 (
const uint8_t **)
s->prev->data,
230 s->prev->linesize, ncol, 1);
232 for ( ; ncol < outlink->
w; ncol++)
234 (
const uint8_t **)
s->black_buffers,
s->black_linesizes,
268 if (!
s->eof_recv &&
s->input_size < outlink->
w -
s->pad) {
269 av_log(
ctx,
AV_LOG_DEBUG,
"Not enough frames in the list (%zu/%d), waiting for more.\n",
s->input_size, outlink->
w -
s->pad);
284 if ((
s->input_size <= 0 ||
s->input_size == outlink->
w -
s->pad ||
s->end ==
TILT_NONE) &&
s->eof_recv) {
291 }
else if (
ret < 0) {
296 while (
s->input_size) {
308 #define OFFSET(x) offsetof(TiltandshiftContext, x)
309 #define V AV_OPT_FLAG_VIDEO_PARAM
312 { .i64 = 1 }, 0, 1, .flags =
V, .unit =
"tilt" },
317 { .i64 =
TILT_NONE }, INT_MIN, INT_MAX, .flags =
V, .unit =
"start" },
319 { .i64 =
TILT_FRAME }, INT_MIN, INT_MAX, .flags =
V, .unit =
"start" },
321 { .i64 =
TILT_BLACK }, INT_MIN, INT_MAX, .flags =
V, .unit =
"start" },
326 { .i64 =
TILT_NONE }, INT_MIN, INT_MAX, .flags =
V, .unit =
"end" },
328 { .i64 =
TILT_FRAME }, INT_MIN, INT_MAX, .flags =
V, .unit =
"end" },
330 { .i64 =
TILT_BLACK }, INT_MIN, INT_MAX, .flags =
V, .unit =
"end" },
333 { .i64 = 0 }, 0, INT_MAX, .flags =
V, .unit =
"hold" },
335 { .i64 = 0 }, 0, INT_MAX, .flags =
V, .unit =
"pad" },
360 .
name =
"tiltandshift",
363 .priv_class = &tiltandshift_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
AVPixelFormat
Pixel format.
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 all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const AVFilterPad tiltandshift_inputs[]
#define FILTER_PIXFMTS_ARRAY(array)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AVERROR_EOF
End of file.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
void * opaque
Frame owner's private data.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
@ AVCOL_RANGE_JPEG
Full range content.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
#define AV_LOG_VERBOSE
Detailed information.
static void list_remove_head(TiltandshiftContext *s)
const char * name
Filter name.
static av_cold void uninit(AVFilterContext *ctx)
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void * priv
private data for use by the filter
A filter pad used for either input or output.
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const AVFilter ff_vf_tiltandshift
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_OUTPUTS(array)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
static int request_frame(AVFilterLink *outlink)
static const AVFilterPad tiltandshift_outputs[]
static enum AVPixelFormat pix_fmts[]
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int format
agreed upon media format
AVFilterContext * src
source filter
const AVPixFmtDescriptor * desc
static int config_props(AVFilterLink *outlink)
#define i(width, name, range_min, range_max)
int w
agreed upon image width
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
const char * name
Pad name.
static const AVOption tiltandshift_options[]
static int list_add_frame(TiltandshiftContext *s, AVFrame *frame)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int h
agreed upon image height
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int output_frame(AVFilterLink *outlink)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static void copy_column(AVFilterLink *outlink, uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], int ncol, int tilt)
uint8_t * black_buffers[4]
void av_image_copy(uint8_t *const dst_data[4], const int dst_linesizes[4], const uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
enum AVColorRange color_range
agreed upon YUV color range
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
AVFILTER_DEFINE_CLASS(tiltandshift)