44 #define OFFSET(x) offsetof(GEQContext, x)
45 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
56 static inline double getpix(
void *priv,
double x,
double y,
int plane)
62 const int linesize = picref->
linesize[plane];
63 const int w = picref->
video->
w >> (plane ? geq->
hsub : 0);
64 const int h = picref->
video->
h >> (plane ? geq->
vsub : 0);
66 xi = x = av_clipf(x, 0, w - 2);
67 yi = y = av_clipf(y, 0, h - 2);
72 return (1-y)*((1-x)*src[xi + yi * linesize] + x*src[xi + 1 + yi * linesize])
73 + y *((1-x)*src[xi + (yi+1) * linesize] + x*src[xi + 1 + (yi+1) * linesize]);
78 static double lum(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 0); }
79 static double cb(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 1); }
80 static double cr(
void *priv,
double x,
double y) {
return getpix(priv, x, y, 2); }
82 static const char *
const var_names[] = {
"X",
"Y",
"W",
"H",
"N",
"SW",
"SH",
"T",
NULL };
89 static const char *shorthand[] = {
"lum_expr",
"cb_expr",
"cr_expr",
NULL };
91 geq->
class = &geq_class;
118 for (plane = 0; plane < 3; plane++) {
119 static double (*p[])(
void *, double, double) = {
lum,
cb,
cr };
120 static const char *
const func2_names[] = {
"lum",
"cb",
"cr",
"p",
NULL };
121 double (*func2[])(
void *, double, double) = {
lum,
cb,
cr, p[plane],
NULL };
124 NULL,
NULL, func2_names, func2, 0, ctx);
135 static const enum PixelFormat pix_fmts[] = {
174 for (plane = 0; plane < 3; plane++) {
177 const int linesize = out->
linesize[plane];
178 const int w = inlink->
w >> (plane ? geq->
hsub : 0);
179 const int h = inlink->
h >> (plane ? geq->
vsub : 0);
183 values[
VAR_SW] = w / (double)inlink->
w;
184 values[
VAR_SH] = h / (
double)inlink->
h;
186 for (y = 0; y < h; y++) {
188 for (x = 0; x < w; x++) {
238 .priv_class = &geq_class,