70 case X: max_value = inlink->
w;
break;
71 case Y: max_value = inlink->
h;
break;
72 case W: max_value = inlink->
w -
ctx->region[
X];
break;
73 case H: max_value = inlink->
h -
ctx->region[
Y];
break;
79 "less than zero - using zero instead.\n",
val,
82 }
else if (
val > max_value) {
84 "greater than maximum allowed value %d - "
86 max_value, max_value);
112 uint32_t old_roi_size;
119 nb_roi = sd->
size / old_roi_size + 1;
128 for (
i = 0;
i < nb_roi - 1;
i++) {
130 (sd->
data + old_roi_size *
i);
135 .bottom = old_roi->
bottom,
136 .left = old_roi->
left,
137 .right = old_roi->
right,
144 .top =
ctx->region[
Y],
145 .bottom =
ctx->region[
Y] +
ctx->region[
H],
146 .left =
ctx->region[
X],
147 .right =
ctx->region[
X] +
ctx->region[
W],
148 .qoffset =
ctx->qoffset,
172 .top =
ctx->region[
Y],
173 .bottom =
ctx->region[
Y] +
ctx->region[
H],
174 .left =
ctx->region[
X],
175 .right =
ctx->region[
X] +
ctx->region[
W],
176 .qoffset =
ctx->qoffset,
198 "Error parsing %c expression '%s'.\n",
218 #define OFFSET(x) offsetof(AddROIContext, x)
219 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
221 {
"x",
"Region distance from left edge of frame.",
223 {
"y",
"Region distance from top edge of frame.",
225 {
"w",
"Region width.",
227 {
"h",
"Region height.",
230 {
"qoffset",
"Quantisation offset to apply in the region.",
233 {
"clear",
"Remove any existing regions of interest before adding the new one.",
266 .priv_class = &addroi_class,
static double val(void *priv, double ch)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
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]
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
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(buffer_size_t size)
Allocate an AVBuffer of the given size using av_malloc().
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, buffer_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.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
@ 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.
common internal API header
#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.
const char * name
Pad name.
const char * name
Filter name.
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 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)
AVFILTER_DEFINE_CLASS(addroi)
static av_cold int addroi_init(AVFilterContext *avctx)
static const AVOption addroi_options[]
static const AVFilterPad addroi_outputs[]
static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame)