Go to the documentation of this file.
69 case X: max_value =
inlink->w;
break;
70 case Y: max_value =
inlink->h;
break;
71 case W: max_value =
inlink->w -
ctx->region[
X];
break;
72 case H: max_value =
inlink->h -
ctx->region[
Y];
break;
78 "less than zero - using zero instead.\n",
val,
81 }
else if (
val > max_value) {
83 "greater than maximum allowed value %d - "
85 max_value, max_value);
111 uint32_t old_roi_size;
118 nb_roi = sd->
size / old_roi_size + 1;
127 for (
i = 0;
i < nb_roi - 1;
i++) {
129 (sd->
data + old_roi_size *
i);
134 .bottom = old_roi->
bottom,
135 .left = old_roi->
left,
136 .right = old_roi->
right,
143 .top =
ctx->region[
Y],
144 .bottom =
ctx->region[
Y] +
ctx->region[
H],
145 .left =
ctx->region[
X],
146 .right =
ctx->region[
X] +
ctx->region[
W],
147 .qoffset =
ctx->qoffset,
171 .top =
ctx->region[
Y],
172 .bottom =
ctx->region[
Y] +
ctx->region[
H],
173 .left =
ctx->region[
X],
174 .right =
ctx->region[
X] +
ctx->region[
W],
175 .qoffset =
ctx->qoffset,
197 "Error parsing %c expression '%s'.\n",
217 #define OFFSET(x) offsetof(AddROIContext, x)
218 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
220 {
"x",
"Region distance from left edge of frame.",
222 {
"y",
"Region distance from top edge of frame.",
224 {
"w",
"Region width.",
226 {
"h",
"Region height.",
229 {
"qoffset",
"Quantisation offset to apply in the region.",
232 {
"clear",
"Remove any existing regions of interest before adding the new one.",
265 .priv_class = &addroi_class,
#define AV_LOG_WARNING
Something somehow does not look correct.
AVBufferRef * av_buffer_alloc(buffer_size_t size)
Allocate an AVBuffer of the given size using av_malloc().
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
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
uint8_t * data
The data buffer.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, buffer_size_t size)
Add a new side data to a frame.
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.
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
A link between two filters.
char * region_str[NB_PARAMS]
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
void * priv
private data for use by the filter
static const AVFilterPad addroi_outputs[]
static double val(void *priv, double ch)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Structure describing a single Region Of Interest.
static const char addroi_param_names[]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const AVFilterPad outputs[]
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
static av_cold int addroi_init(AVFilterContext *avctx)
Describe the class of an AVClass context structure.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static const uint8_t vars[2][12]
Rational number (pair of numerator and denominator).
uint32_t self_size
Must be set to the size of this data structure (that is, sizeof(AVRegionOfInterest)).
AVFILTER_DEFINE_CLASS(addroi)
AVFrameSideData * av_frame_new_side_data_from_buf(AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf)
Add a new side data to a frame from an existing AVBufferRef.
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 inputs
static const AVOption addroi_options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
static int addroi_config_input(AVFilterLink *inlink)
static const AVFilterPad addroi_inputs[]
int top
Distance in pixels from the top edge of the frame to the top and bottom edges and from the left edge ...
static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame)
const char * name
Pad name.
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
static av_cold void addroi_uninit(AVFilterContext *avctx)
AVExpr * region_expr[NB_PARAMS]
A reference to a data buffer.
Structure to hold side data for an AVFrame.
@ AV_FRAME_DATA_REGIONS_OF_INTEREST
Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is ...
AVRational qoffset
Quantisation offset.
static const char *const addroi_var_names[]
AVFilterLink ** outputs
array of pointers to output links