40#define MAX_NB_THREADS 32
49static const char *
const var_names[] = {
"X",
"Y",
"W",
"H",
"N",
"SW",
"SH",
"T",
NULL };
73#define OFFSET(x) offsetof(GEQContext, x)
74#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
102static inline double getpix(
void *priv,
double x,
double y,
int plane)
107 const uint8_t *
src = picref->
data[plane];
108 int linesize = picref->
linesize[plane];
121 yn =
FFMIN(yi + 1,
h - 1);
126 if (geq->
bps > 8 && geq->
bps <= 16) {
127 const uint16_t *src16 = (
const uint16_t*)
src;
130 return (1-y)*((1-x)*src16[
xi + yi * linesize] + x*src16[xn + yi * linesize])
131 + y *((1-x)*src16[
xi + yn * linesize] + x*src16[xn + yn * linesize]);
132 }
else if (geq->
bps == 32) {
133 const float *src32 = (
const float*)
src;
136 return (1-y)*((1-x)*src32[
xi + yi * linesize] + x*src32[xn + yi * linesize])
137 + y *((1-x)*src32[
xi + yn * linesize] + x*src32[xn + yn * linesize]);
138 }
else if (geq->
bps == 8) {
139 return (1-y)*((1-x)*
src[
xi + yi * linesize] + x*
src[xn + yi * linesize])
140 + y *((1-x)*
src[
xi + yn * linesize] + x*
src[xn + yn * linesize]);
146 if (geq->
bps > 8 && geq->
bps <= 16) {
147 const uint16_t *src16 = (
const uint16_t*)
src;
150 return src16[
xi + yi * linesize];
151 }
else if (geq->
bps == 32) {
152 const float *src32 = (
const float*)
src;
155 return src32[
xi + yi * linesize];
156 }
else if (geq->
bps == 8) {
157 return src[
xi + yi * linesize];
168 const uint8_t *
src = picref->
data[plane];
169 int linesize = picref->
linesize[plane];
177 else if (geq->
bps > 8 && geq->
bps <= 16)
179 for (yi = 0; yi <
h; yi ++) {
180 if (geq->
bps > 8 && geq->
bps <= 16) {
181 const uint16_t *src16 = (
const uint16_t*)
src;
185 linesum += src16[
xi + yi * linesize];
188 }
else if (geq->
bps == 8) {
192 linesum +=
src[
xi + yi * linesize];
195 }
else if (geq->
bps == 32) {
196 const float *src32 = (
const float*)
src;
200 linesum += src32[
xi + yi * linesize];
217 }
else if (y >
h - 1) {
221 if (x == -1)
return 0;
224 if (y == -1)
return 0;
234 const uint8_t *
src = picref->
data[plane];
246static double lum(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 0); }
247static double cb(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 1); }
248static double cr(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 2); }
249static double alpha(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 3); }
304 for (plane = 0; plane <
NB_PLANES; plane++) {
309 static const char *
const func2_yuv_names[] = {
310 "lum" ,
"cb" ,
"cr" ,
"alpha" ,
"p",
311 "lumsum",
"cbsum",
"crsum",
"alphasum",
"psum",
313 static const char *
const func2_rgb_names[] = {
314 "g" ,
"b" ,
"r" ,
"alpha" ,
"p",
315 "gsum",
"bsum",
"rsum",
"alphasum",
"psum",
317 const char *
const *
func2_names = geq->
is_rgb ? func2_rgb_names : func2_yuv_names;
322 int counter[10] = {0};
332 geq->
needs_sum[plane] = counter[5] + counter[6] + counter[7] + counter[8] + counter[9];
388 geq->
bps =
desc->comp[0].depth;
406 const int plane = td->
plane;
425 for (x = 0; x <
width; x++) {
431 }
else if (geq->
bps <= 16) {
435 for (x = 0; x <
width; x++) {
445 for (x = 0; x <
width; x++) {
477 for (plane = 0; plane < geq->
planes &&
out->data[plane]; plane++) {
480 const int linesize =
out->linesize[plane];
483 geq->
dst =
out->data[plane];
484 geq->
dst16 = (uint16_t*)
out->data[plane];
485 geq->
dst32 = (
float*)
out->data[plane];
532 .p.priv_class = &geq_class,
static int interpolation(DeclickChannel *c, const double *src, int ar_order, double *acoefficients, int *index, int nb_errors, double *auxiliary, double *interpolated)
static double(*const func2[])(void *, double, double)
static const char *const func2_names[]
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.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
char * av_asprintf(const char *fmt,...)
#define i(width, name, range_min, range_max)
#define xi(width, name, var, range_min, range_max, subs,...)
#define AV_CEIL_RSHIFT(a, b)
int(* init)(AVBSFContext *ctx)
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.
int av_expr_count_func(AVExpr *e, unsigned *counter, int size, int arg)
Track the presence of user provided functions and their number of occurrences in a parsed expression.
simple arithmetic expression evaluator
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ 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_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static const int16_t alpha[]
static enum AVPixelFormat rgb_pix_fmts[]
static enum AVPixelFormat yuv_pix_fmts[]
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
Memory handling functions.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
static const char *const var_names[]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_GRAYF32
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
#define FF_ARRAY_ELEMS(a)
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
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Link properties exposed to filter code, but not external callers.
AVFrame * picref
current input buffer
AVExpr * e[NB_PLANES][MAX_NB_THREADS]
expressions for each plane and thread
int vsub
chroma subsampling
double values[VAR_VARS_NB]
expression values
uint16_t * dst16
reference pointer to the 16bits output
uint8_t * dst
reference pointer to the 8bits output
int planes
number of planes
float * dst32
reference pointer to the 32bits output
double * pixel_sums[NB_PLANES]
char * expr_str[4+3]
expression strings for each plane
Used for passing data between threads.
#define av_malloc_array(a, b)
static AVFormatContext * ctx
static double lum(void *priv, double x, double y, int plane)
static double crsub(void *priv, double x, double y)
static int slice_geq_filter(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static av_cold void geq_uninit(AVFilterContext *ctx)
static double getpix(void *priv, double x, double y, int plane)
static int calculate_sums(GEQContext *geq, int plane, int w, int h)
static double alphasum(void *priv, double x, double y)
static int geq_config_props(AVFilterLink *inlink)
static double cbsum(void *priv, double x, double y)
static double getpix_integrate(void *priv, double x, double y, int plane)
static const AVFilterPad geq_inputs[]
static double getpix_integrate_internal(GEQContext *geq, int x, int y, int plane, int w, int h)
static double lum(void *priv, double x, double y)
static double cr(void *priv, double x, double y)
static int geq_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static double lumsum(void *priv, double x, double y)
static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
static const AVOption geq_options[]
static av_cold int geq_init(AVFilterContext *ctx)
static double cb(void *priv, double x, double y)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)