Go to the documentation of this file.
42 #define OFFSET(x) offsetof(MultiplyContext, x)
43 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
74 static void multiply(
const uint8_t *ssrc,
const uint8_t *rref, uint8_t *ddst,
77 const float *
src = (
const float *)ssrc;
78 const float *
ref = (
const float *)rref;
79 float *
dst = (
float *)ddst;
81 for (
int x = 0; x <
w; x++) {
92 const float scale =
s->scale;
95 for (
int p = 0; p <
s->nb_planes; p++) {
96 const ptrdiff_t src_linesize = td->
src->linesize[p];
97 const ptrdiff_t ref_linesize = td->
ref->linesize[p];
98 const ptrdiff_t dst_linesize = td->
dst->
linesize[p];
99 const int w = td->
src->width;
100 const int h = td->
src->height;
102 const int slice_end = (
h * (jobnr+1)) / nb_jobs;
107 if (!((1 << p) &
s->planes)) {
137 if (
ctx->is_disabled) {
174 "(size %dx%d) do not match the corresponding "
175 "second input link %s parameters (%dx%d)\n",
177 ctx->input_pads[1].name,
ref->w,
ref->h);
245 .priv_class = &multiply_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
AVRational time_base
Time base for the incoming frames.
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
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
#define FILTER_PIXFMTS_ARRAY(array)
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int multiply_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
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
AVFILTER_DEFINE_CLASS(multiply)
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
@ EXT_INFINITY
Extend the frame to infinity.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
Link properties exposed to filter code, but not external callers.
static const struct @466 planes[]
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
@ EXT_STOP
Completely stop all streams with this one.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
static int process_frame(FFFrameSync *fs)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static const AVFilterPad multiply_inputs[]
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define FILTER_OUTPUTS(array)
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.
#define fs(width, name, subs,...)
static const AVFilterPad multiply_outputs[]
const AVFilter ff_vf_multiply
static av_cold void uninit(AVFilterContext *ctx)
static FilterLink * ff_filter_link(AVFilterLink *link)
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 source
static enum AVPixelFormat pix_fmts[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define AV_PIX_FMT_GBRPF32
AVFilterContext * src
source filter
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.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
int w
agreed upon image width
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
static void multiply(const uint8_t *ssrc, const uint8_t *rref, uint8_t *ddst, float scale, float offset, int w)
const char * name
Pad name.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
int h
agreed upon image height
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
#define AV_PIX_FMT_GBRAPF32
static int ref[MAX_W *MAX_W]
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
static int config_output(AVFilterLink *outlink)
static int activate(AVFilterContext *ctx)
static const int factor[16]
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static void scale(int *out, const int *in, const int w, const int h, const int shift)
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static const AVOption multiply_options[]
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
static int config_input(AVFilterLink *inlink)