115 outlink->
w =
ctx->inputs[0]->w;
116 outlink->
h =
ctx->inputs[0]->h;
117 outlink->
format =
ctx->inputs[0]->format;
122 s->hold = outlink->
w;
129 uint8_t black_data[] = { 0x10, 0x80, 0x80, 0x10 };
139 black_data[0] = black_data[3] = 0;
142 outlink->
h, outlink->
format, 1);
147 for (j = 0; j < (!
i ? outlink->
h
148 : -((-outlink->
h) >>
desc->log2_chroma_h)); j++)
149 memset(
s->black_buffers[
i] + j *
s->black_linesizes[
i],
164 uint8_t *dst_data[4],
int dst_linesizes[4],
165 const uint8_t *src_data[4],
const int src_linesizes[4],
171 const uint8_t *
src[4];
173 dst[0] = dst_data[0] + ncol;
174 dst[1] = dst_data[1] + (ncol >>
s->desc->log2_chroma_w);
175 dst[2] = dst_data[2] + (ncol >>
s->desc->log2_chroma_w);
179 src[0] = src_data[0] + ncol;
180 src[1] = src_data[1] + (ncol >>
s->desc->log2_chroma_w);
181 src[2] = src_data[2] + (ncol >>
s->desc->log2_chroma_w);
200 for ( ; ncol <
s->hold; ncol++)
202 (
const uint8_t **)
s->black_buffers,
s->black_linesizes,
209 for (
int in_idx = 0; ncol < nb_buffered; 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,
273 "Not enough frames in the list (%zu/%d), waiting for more.\n",
290 if ((nb_buffered <= 0 || nb_buffered == outlink->
w -
s->pad ||
298 }
else if (ret < 0) {
316#define OFFSET(x) offsetof(TiltandshiftContext, x)
317#define V AV_OPT_FLAG_VIDEO_PARAM
320 { .i64 = 1 }, 0, 1, .flags =
V, .unit =
"tilt" },
325 { .i64 =
TILT_NONE }, INT_MIN, INT_MAX, .flags =
V, .unit =
"start" },
327 { .i64 =
TILT_FRAME }, INT_MIN, INT_MAX, .flags =
V, .unit =
"start" },
329 { .i64 =
TILT_BLACK }, INT_MIN, INT_MAX, .flags =
V, .unit =
"start" },
334 { .i64 =
TILT_NONE }, INT_MIN, INT_MAX, .flags =
V, .unit =
"end" },
336 { .i64 =
TILT_FRAME }, INT_MIN, INT_MAX, .flags =
V, .unit =
"end" },
338 { .i64 =
TILT_BLACK }, INT_MIN, INT_MAX, .flags =
V, .unit =
"end" },
341 { .i64 = 0 }, 0, INT_MAX, .flags =
V, .unit =
"hold" },
343 { .i64 = 0 }, 0, INT_MAX, .flags =
V, .unit =
"pad" },
368 .p.name =
"tiltandshift",
370 .p.priv_class = &tiltandshift_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int request_frame(AVFilterLink *outlink)
const FFFilter ff_vf_tiltandshift
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#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.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_EOF
End of file.
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
size_t av_fifo_can_read(const AVFifo *f)
int av_fifo_peek(const AVFifo *f, void *buf, size_t nb_elems, size_t offset)
Read data from a FIFO without modifying FIFO state.
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_VERBOSE
Detailed information.
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.
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...
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_PIXFMTS_ARRAY(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
Memory handling functions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AVCOL_RANGE_JPEG
Full range content.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ 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 config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVFilterContext * dst
dest filter
int format
agreed upon media format
enum AVColorRange color_range
agreed upon YUV color range
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
const AVPixFmtDescriptor * desc
uint8_t * black_buffers[4]
static const AVFilterPad tiltandshift_outputs[]
static int config_props(AVFilterLink *outlink)
static int output_frame(AVFilterLink *outlink)
static const AVOption tiltandshift_options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static int request_frame(AVFilterLink *outlink)
static const AVFilterPad tiltandshift_inputs[]
static av_cold void uninit(AVFilterContext *ctx)
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)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.