49 if (
s->x +
s->w >
ctx->inputs[0]->w)
50 s->x =
ctx->inputs[0]->w -
s->w;
51 if (
s->y +
s->h >
ctx->inputs[0]->h)
52 s->y =
ctx->inputs[0]->h -
s->h;
57 if (
s->x >=
ctx->inputs[0]->w)
59 if (
s->y >=
ctx->inputs[0]->h)
63 s->w =
ctx->inputs[0]->w -
s->x;
65 s->h =
ctx->inputs[0]->h -
s->y;
67 if (
s->w >
ctx->inputs[0]->w)
68 s->w =
ctx->inputs[0]->w;
69 if (
s->h >
ctx->inputs[0]->h)
70 s->h =
ctx->inputs[0]->h;
88 ctx->inputs[1]->w =
s->w;
89 ctx->inputs[1]->h =
s->h;
101 ctx->outputs[0]->w =
ctx->inputs[0]->w;
102 ctx->outputs[0]->h =
ctx->inputs[0]->h;
103 ctx->outputs[1]->w =
s->w;
104 ctx->outputs[1]->h =
s->h;
127 for (
int i = 0;
i <
ctx->nb_outputs;
i++)
164 for (
int y = 0; y <
src->height; y++) {
165 memmove(
dst->data[0] + (
s->y + y) *
dst->linesize[0] +
s->x *
s->max_step[0],
166 src->data[0] + y *
src->linesize[0],
src->width *
s->max_step[0]);
169 for (
int i = 1;
i < 3;
i++) {
171 for (
int y = 0; y <
src->height; y++) {
172 memmove(
dst->data[
i] + ((
s->y + y) >>
s->vsub) *
dst->linesize[
i] + (
s->x >>
s->hsub) *
s->max_step[
i],
173 src->data[
i] + (y >>
s->vsub) *
src->linesize[
i], (
src->width >>
s->hsub) *
s->max_step[
i]);
179 for (
int y = 0; y <
src->height; y++) {
180 memmove(
dst->data[3] + (
s->y + y) *
dst->linesize[3] +
s->x *
s->max_step[3],
181 src->data[3] + y *
src->linesize[3],
src->width *
s->max_step[3]);
190 if (!
s->feed ||
ctx->is_disabled) {
197 if (ret > 0 &&
ctx->is_disabled)
217 frame->data[0] +=
s->x *
s->max_step[0];
219 for (
int i = 1;
i < 3;
i ++) {
222 frame->data[
i] += (
s->x >>
s->hsub) *
s->max_step[
i];
226 if (
frame->data[3]) {
228 frame->data[3] +=
s->x *
s->max_step[3];
247 if (!
s->feed ||
ctx->is_disabled) {
254 if (!
ctx->is_disabled)
280 for (
size_t n = 0; n <
size; n++) {
318#define OFFSET(x) offsetof(FeedbackContext, x)
319#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
320#define TFLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM)
333 .p.name =
"feedback",
335 .p.priv_class = &feedback_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_feedback
static AVFormatContext * ctx
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
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_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.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
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.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Describe the class of an AVClass context structure.
A link between two filters.
AVFilterContext * src
source filter
AVFilterContext * dst
dest filter
int format
agreed upon media format
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...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int config_input(AVFilterLink *inlink)
static void adjust_parameters(AVFilterContext *ctx, FeedbackContext *s)
static const AVOption feedback_options[]
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static void adjust_pos(AVFilterContext *ctx, FeedbackContext *s)
static int config_output(AVFilterLink *outlink)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.