71 case X: max_value = inlink->
w;
break;
72 case Y: max_value = inlink->
h;
break;
73 case W: max_value = inlink->
w -
ctx->region[
X];
break;
74 case H: max_value = inlink->
h -
ctx->region[
Y];
break;
80 "less than zero - using zero instead.\n",
val,
83 }
else if (
val > max_value) {
85 "greater than maximum allowed value %d - "
87 max_value, max_value);
113 uint32_t old_roi_size;
120 nb_roi = sd->
size / old_roi_size + 1;
129 for (
i = 0;
i < nb_roi - 1;
i++) {
131 (sd->
data + old_roi_size *
i);
134 .self_size =
sizeof(*roi),
136 .bottom = old_roi->
bottom,
137 .left = old_roi->
left,
138 .right = old_roi->
right,
144 .self_size =
sizeof(*roi),
145 .top =
ctx->region[
Y],
146 .bottom =
ctx->region[
Y] +
ctx->region[
H],
147 .left =
ctx->region[
X],
148 .right =
ctx->region[
X] +
ctx->region[
W],
149 .qoffset =
ctx->qoffset,
172 .self_size =
sizeof(*roi),
173 .top =
ctx->region[
Y],
174 .bottom =
ctx->region[
Y] +
ctx->region[
H],
175 .left =
ctx->region[
X],
176 .right =
ctx->region[
X] +
ctx->region[
W],
177 .qoffset =
ctx->qoffset,
199 "Error parsing %c expression '%s'.\n",
219#define OFFSET(x) offsetof(AddROIContext, x)
220#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
222 {
"x",
"Region distance from left edge of frame.",
224 {
"y",
"Region distance from top edge of frame.",
226 {
"w",
"Region width.",
228 {
"h",
"Region height.",
231 {
"qoffset",
"Quantisation offset to apply in the region.",
234 {
"clear",
"Remove any existing regions of interest before adding the new one.",
254 .p.priv_class = &addroi_class,
static double val(void *priv, double ch)
const FFFilter ff_vf_addroi
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.
Main libavfilter public API header.
static const uint8_t vars[2][12]
#define i(width, name, range_min, range_max)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
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.
simple arithmetic expression evaluator
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
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.
@ AV_FRAME_DATA_REGIONS_OF_INTEREST
Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is ...
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
A reference to a data buffer.
uint8_t * data
The data buffer.
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 * dst
dest filter
A filter pad used for either input or output.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
Rational number (pair of numerator and denominator).
Structure describing a single Region Of Interest.
uint32_t self_size
Must be set to the size of this data structure (that is, sizeof(AVRegionOfInterest)).
AVRational qoffset
Quantisation offset.
int top
Distance in pixels from the top edge of the frame to the top and bottom edges and from the left edge ...
char * region_str[NB_PARAMS]
AVExpr * region_expr[NB_PARAMS]
static AVFormatContext * ctx
static const char addroi_param_names[]
static const char *const addroi_var_names[]
static av_cold void addroi_uninit(AVFilterContext *avctx)
static const AVFilterPad addroi_inputs[]
static int addroi_config_input(AVFilterLink *inlink)
static av_cold int addroi_init(AVFilterContext *avctx)
static const AVOption addroi_options[]
static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.