Go to the documentation of this file.
37 #define CLIP(x) (av_clip_uint8(x))
44 #define PIXEL uint16_t
45 #define MAX ((1 << DEPTH) - 1)
46 #define HALF (1 << (DEPTH - 1))
47 #define CLIP(x) ((int)av_clip_uintp2(x, DEPTH))
61 #define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / MAX))
62 #define SCREEN(x, a, b) (MAX - (x) * ((MAX - (a)) * (MAX - (b)) / MAX))
63 #define BURN(a, b) (((a) == 0) ? (a) : FFMAX(0, MAX - ((MAX - (b)) << DEPTH) / (a)))
64 #define DODGE(a, b) (((a) == MAX) ? (a) : FFMIN(MAX, (((b) << DEPTH) / (MAX - (a)))))
65 #define GEOMETRIC(a, b) (lrintf(sqrtf((unsigned)A * B)))
66 #define INT2FLOAT(x) (x)
67 #define FLOAT2INT(x) (x)
68 #define MDIV (0.125f * (1 << DEPTH))
69 #define LRINTF(x) lrintf(x)
71 #define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / 1.0))
72 #define SCREEN(x, a, b) (1.0 - (x) * ((1.0 - (a)) * (1.0 - (b)) / 1.0))
73 #define BURN(a, b) (((a) <= 0.0) ? (a) : FFMAX(0.0, 1.0 - (1.0 - (b)) / (a)))
74 #define DODGE(a, b) (((a) >= 1.0) ? (a) : FFMIN(1.0, ((b) / (1.0 - (a)))))
75 #define GEOMETRIC(a, b) (sqrtf(fmaxf(A, 0) * fmaxf(B, 0)))
76 #define INT2FLOAT(x) av_int2float(x)
77 #define FLOAT2INT(x) av_float2int(x)
85 #define fn2(a, b) blend_##a##_##b##bit
86 #define fn1(name, depth) fn2(name, depth)
87 #define fn0(name) fn1(name, DEPTH)
89 #define fn(NAME, EXPR) \
90 static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \
91 const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
92 uint8_t *_dst, ptrdiff_t dst_linesize, \
93 ptrdiff_t width, ptrdiff_t height, \
94 FilterParams *param, double *values, int starty) \
96 const PIXEL *top = (const PIXEL *)_top; \
97 const PIXEL *bottom = (const PIXEL *)_bottom; \
98 PIXEL *dst = (PIXEL *)_dst; \
99 const float opacity = param->opacity; \
101 dst_linesize /= sizeof(PIXEL); \
102 top_linesize /= sizeof(PIXEL); \
103 bottom_linesize /= sizeof(PIXEL); \
105 for (int i = 0; i < height; i++) { \
106 for (int j = 0; j < width; j++) { \
107 dst[j] = top[j] + ((EXPR)-top[j]) * opacity; \
109 dst += dst_linesize; \
110 top += top_linesize; \
111 bottom += bottom_linesize; \
117 fn(average, (
A +
B) / 2)
149 fn(harmonic,
A == 0 &&
B == 0 ? 0 : 2LL *
A *
B / (
A +
B))
#define MULTIPLY(x, a, b)
static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b)
multiply two softfloats and handle the rounding off
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static void difference(IPlane *g, IPlane *f, int y0, int y1)
static void interpolate(float *out, float v1, float v2, int size)