Go to the documentation of this file.
41 static const char *
const var_names[] = {
"known",
"qp",
"x",
"y",
"w",
"h",
NULL };
43 #define OFFSET(x) offsetof(QPContext, x)
44 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
69 s->qstride = (
inlink->w + 15) >> 4;
70 for (
i = -129;
i < 128;
i++) {
71 double var_values[] = {
i != -129,
i,
NAN,
NAN,
s->qstride,
s->h, 0};
74 if (
isnan(temp_val)) {
75 if(strchr(
s->qp_expr_str,
'x') || strchr(
s->qp_expr_str,
'y'))
76 s->evaluate_per_mb = 1;
100 int8_t in_qp_global = 0;
104 if (!
s->qp_expr_str ||
ctx->is_disabled)
115 in_qp_global = par_in->
qp;
129 (
s->evaluate_per_mb || sd_in) ?
130 s->h *
s->qstride : 0);
136 #define BLOCK_QP_DELTA(block_idx) \
137 (par_in ? av_video_enc_params_block(par_in, block_idx)->delta_qp : 0)
139 if (
s->evaluate_per_mb) {
142 for (y = 0; y <
s->h; y++)
143 for (x = 0; x <
s->qstride; x++) {
144 unsigned int block_idx = y *
s->qstride + x;
147 double var_values[] = { !!sd_in, qp, x, y,
s->qstride,
s->h, 0};
155 b->delta_qp =
lrintf(temp_val);
160 for (y = 0; y <
s->h; y++)
161 for (x = 0; x <
s->qstride; x++) {
162 unsigned int block_idx = y *
s->qstride + x;
164 b->delta_qp =
s->lut[129 + (int8_t)(in_qp_global +
BLOCK_QP_DELTA(block_idx))];
167 par_out->
qp =
s->lut[0];
200 .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.
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.
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_INPUTS(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)
static const AVFilterPad qp_outputs[]
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[]
#define FILTER_OUTPUTS(array)
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)
AVFILTER_DEFINE_CLASS(qp)