Go to the documentation of this file.
38 static const char *
const var_names[] = {
"known",
"qp",
"x",
"y",
"w",
"h",
NULL };
40 #define OFFSET(x) offsetof(QPContext, x)
41 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
66 s->qstride = (
inlink->w + 15) >> 4;
67 for (
i = -129;
i < 128;
i++) {
68 double var_values[] = {
i != -129,
i,
NAN,
NAN,
s->qstride,
s->h, 0};
71 if (
isnan(temp_val)) {
72 if(strchr(
s->qp_expr_str,
'x') || strchr(
s->qp_expr_str,
'y'))
73 s->evaluate_per_mb = 1;
97 int8_t in_qp_global = 0;
101 if (!
s->qp_expr_str ||
ctx->is_disabled)
112 in_qp_global = par_in->
qp;
126 (
s->evaluate_per_mb || sd_in) ?
127 s->h *
s->qstride : 0);
133 #define BLOCK_QP_DELTA(block_idx) \
134 (par_in ? av_video_enc_params_block(par_in, block_idx)->delta_qp : 0)
136 if (
s->evaluate_per_mb) {
139 for (y = 0; y <
s->h; y++)
140 for (x = 0; x <
s->qstride; x++) {
141 unsigned int block_idx = y *
s->qstride + x;
144 double var_values[] = { !!sd_in, qp, x, y,
s->qstride,
s->h, 0};
152 b->delta_qp =
lrintf(temp_val);
157 for (y = 0; y <
s->h; y++)
158 for (x = 0; x <
s->qstride; x++) {
159 unsigned int block_idx = y *
s->qstride + x;
161 b->delta_qp =
s->lut[129 + (int8_t)(in_qp_global +
BLOCK_QP_DELTA(block_idx))];
164 par_out->
qp =
s->lut[0];
190 .priv_class = &qp_class,
int32_t qp
Base quantisation parameter for the frame.
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
static const char *const var_names[]
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.
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.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
A link between two filters.
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.
@ AV_VIDEO_ENC_PARAMS_MPEG2
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Video encoding parameters for a given frame.
A filter pad used for either input or output.
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
enum AVVideoEncParamsType type
Type of the parameters (the codec they are used with).
#define FILTER_OUTPUTS(array)
Describe the class of an AVClass context structure.
static int config_input(AVFilterLink *inlink)
AVVideoEncParams * av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType type, unsigned int nb_blocks)
Allocates memory for AVEncodeInfoFrame plus an array of.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
unsigned int nb_blocks
Number of blocks in the array.
#define i(width, name, range_min, range_max)
Data structure for storing block-level encoding information.
const char * name
Pad name.
@ AV_FRAME_DATA_VIDEO_ENC_PARAMS
Encoding parameters for a video frame, as described by AVVideoEncParams.
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Structure to hold side data for an AVFrame.
static const AVOption qp_options[]
static const AVFilterPad qp_inputs[]
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define BLOCK_QP_DELTA(block_idx)
static av_always_inline AVVideoBlockParams * av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
Get the block at the specified.
@ 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...
AVFILTER_DEFINE_CLASS(qp)