Go to the documentation of this file.
36 #define CLIP(x) (av_clip_uint8(x))
43 #define PIXEL uint16_t
44 #define MAX ((1 << DEPTH) - 1)
45 #define HALF (1 << (DEPTH - 1))
46 #define CLIP(x) ((int)av_clip_uintp2(x, DEPTH))
60 #define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / MAX))
61 #define SCREEN(x, a, b) (MAX - (x) * ((MAX - (a)) * (MAX - (b)) / MAX))
62 #define BURN(a, b) (((a) == 0) ? (a) : FFMAX(0, MAX - ((MAX - (b)) << DEPTH) / (a)))
63 #define DODGE(a, b) (((a) == MAX) ? (a) : FFMIN(MAX, (((b) << DEPTH) / (MAX - (a)))))
64 #define GEOMETRIC(a, b) (lrintf(sqrtf((unsigned)A * B)))
65 #define INT2FLOAT(x) (x)
66 #define FLOAT2INT(x) (x)
67 #define MDIV (0.125f * (1 << DEPTH))
68 #define LRINTF(x) lrintf(x)
70 #define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / 1.0))
71 #define SCREEN(x, a, b) (1.0 - (x) * ((1.0 - (a)) * (1.0 - (b)) / 1.0))
72 #define BURN(a, b) (((a) <= 0.0) ? (a) : FFMAX(0.0, 1.0 - (1.0 - (b)) / (a)))
73 #define DODGE(a, b) (((a) >= 1.0) ? (a) : FFMIN(1.0, ((b) / (1.0 - (a)))))
74 #define GEOMETRIC(a, b) (sqrtf(fmaxf(A, 0) * fmaxf(B, 0)))
75 #define INT2FLOAT(x) av_int2float(x)
76 #define FLOAT2INT(x) av_float2int(x)
84 #define fn2(a, b) blend_##a##_##b##bit
85 #define fn1(name, depth) fn2(name, depth)
86 #define fn0(name) fn1(name, DEPTH)
88 #define fn(NAME, EXPR) \
89 static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \
90 const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
91 uint8_t *_dst, ptrdiff_t dst_linesize, \
92 ptrdiff_t width, ptrdiff_t height, \
93 FilterParams *param, SliceParams *sliceparam) \
95 const PIXEL *top = (const PIXEL *)_top; \
96 const PIXEL *bottom = (const PIXEL *)_bottom; \
97 PIXEL *dst = (PIXEL *)_dst; \
98 const float opacity = param->opacity; \
100 dst_linesize /= sizeof(PIXEL); \
101 top_linesize /= sizeof(PIXEL); \
102 bottom_linesize /= sizeof(PIXEL); \
104 for (int i = 0; i < height; i++) { \
105 for (int j = 0; j < width; j++) { \
106 dst[j] = top[j] + ((EXPR)-top[j]) * opacity; \
108 dst += dst_linesize; \
109 top += top_linesize; \
110 bottom += bottom_linesize; \
116 fn(average, (
A +
B) / 2)
148 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)