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,
197 "Error parsing %s 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,
int top
Distance in pixels from the top edge of the frame to the top and bottom edges and from the left edge ...
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
int h
agreed upon image height
static const AVOption addroi_options[]
static av_cold void addroi_uninit(AVFilterContext *avctx)
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.
static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVExpr * region_expr[NB_PARAMS]
AVRational qoffset
Quantisation offset.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
const char * name
Pad name.
#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.
Structure to hold side data for an AVFrame.
uint32_t self_size
Must be set to the size of this data structure (that is, sizeof(AVRegionOfInterest)).
A filter pad used for either input or output.
A link between two filters.
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
simple assert() macros that are a bit more flexible than ISO C assert().
int w
agreed upon image width
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.
Structure describing a single Region Of Interest.
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static const uint8_t vars[2][12]
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
AVFILTER_DEFINE_CLASS(addroi)
static const char *const addroi_var_names[]
uint8_t * data
The data buffer.
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
Describe the class of an AVClass context structure.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
Rational number (pair of numerator and denominator).
Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is ...
static const AVFilterPad addroi_outputs[]
const char * name
Filter name.
static const char * addroi_param_names[]
char * region_str[NB_PARAMS]
AVFilterLink ** outputs
array of pointers to output links
static av_cold int addroi_init(AVFilterContext *avctx)
A reference to a data buffer.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
static int addroi_config_input(AVFilterLink *inlink)
static double val(void *priv, double ch)
simple arithmetic expression evaluator
static const AVFilterPad addroi_inputs[]