38static 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
65 s->h = (inlink->
h + 15) >> 4;
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];
187 .p.priv_class = &qp_class,
static int config_input(AVFilterLink *inlink)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
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_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.
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_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_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
@ AV_FRAME_DATA_VIDEO_ENC_PARAMS
Encoding parameters for a video frame, as described by AVVideoEncParams.
#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.
static const char *const var_names[]
Describe the class of an AVClass context structure.
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.
Data structure for storing block-level encoding information.
Video encoding parameters for a given frame.
enum AVVideoEncParamsType type
Type of the parameters (the codec they are used with).
unsigned int nb_blocks
Number of blocks in the array.
int32_t qp
Base quantisation parameter for the frame.
static AVFormatContext * ctx
static const AVFilterPad qp_inputs[]
static int config_input(AVFilterLink *inlink)
static const AVOption qp_options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
#define BLOCK_QP_DELTA(block_idx)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
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 nb_blocks AVEncodeInfoBlock in the given AVFr...
static av_always_inline AVVideoBlockParams * av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
Get the block at the specified idx.
@ AV_VIDEO_ENC_PARAMS_MPEG2