45 #define OFFSET(x) offsetof(GEQContext, x)
46 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
58 static inline double getpix(
void *priv,
double x,
double y,
int plane)
64 const int linesize = picref->
linesize[plane];
65 const int w = picref->
video->
w >> ((plane == 1 || plane == 2) ? geq->
hsub : 0);
66 const int h = picref->
video->
h >> ((plane == 1 || plane == 2) ? geq->
vsub : 0);
71 xi = x = av_clipf(x, 0, w - 2);
72 yi = y = av_clipf(y, 0, h - 2);
77 return (1-y)*((1-x)*src[xi + yi * linesize] + x*src[xi + 1 + yi * linesize])
78 + y *((1-x)*src[xi + (yi+1) * linesize] + x*src[xi + 1 + (yi+1) * linesize]);
83 static double lum(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 0); }
84 static double cb(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 1); }
85 static double cr(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 2); }
86 static double alpha(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 3); }
88 static const char *
const var_names[] = {
"X",
"Y",
"W",
"H",
"N",
"SW",
"SH",
"T",
NULL };
95 static const char *shorthand[] = {
"lum_expr",
"cb_expr",
"cr_expr",
"alpha_expr",
NULL };
97 geq->
class = &geq_class;
127 for (plane = 0; plane < 4; plane++) {
128 static double (*p[])(
void *, double, double) = {
lum,
cb,
cr,
alpha };
129 static const char *
const func2_names[] = {
"lum",
"cb",
"cr",
"alpha",
"p",
NULL };
130 double (*func2[])(
void *, double, double) = {
lum,
cb,
cr,
alpha, p[plane],
NULL };
133 NULL,
NULL, func2_names, func2, 0, ctx);
144 static const enum PixelFormat pix_fmts[] = {
185 for (plane = 0; plane < geq->
planes && out->
data[plane]; plane++) {
188 const int linesize = out->
linesize[plane];
189 const int w = inlink->
w >> ((plane == 1 || plane == 2) ? geq->
hsub : 0);
190 const int h = inlink->
h >> ((plane == 1 || plane == 2) ? geq->
vsub : 0);
194 values[
VAR_SW] = w / (double)inlink->
w;
195 values[
VAR_SH] = h / (
double)inlink->
h;
197 for (y = 0; y < h; y++) {
199 for (x = 0; x < w; x++) {
249 .priv_class = &geq_class,