Go to the documentation of this file.
36 #define CLIP(x) (av_clip_uint8(x))
37 #define BUILD_TYPE_SPECIFIC_FUNCS
43 #define BUILD_TYPE_SPECIFIC_FUNCS
45 #define PIXEL uint16_t
46 #define MAX ((1 << DEPTH) - 1)
47 #define HALF (1 << (DEPTH - 1))
48 #define CLIP(x) ((int)av_clip_uintp2(x, DEPTH))
50 #define BUILD_TYPE_SPECIFIC_FUNCS
65 #define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / MAX))
66 #define SCREEN(x, a, b) (MAX - (x) * ((MAX - (a)) * (MAX - (b)) / MAX))
67 #define BURN(a, b) (((a) == 0) ? (a) : FFMAX(0, MAX - ((MAX - (b)) << DEPTH) / (a)))
68 #define DODGE(a, b) (((a) == MAX) ? (a) : FFMIN(MAX, (((b) << DEPTH) / (MAX - (a)))))
69 #define GEOMETRIC(a, b) (lrintf(sqrtf((unsigned)A * B)))
70 #define INT2FLOAT(x) (x)
71 #define FLOAT2INT(x) (x)
72 #define MDIV (0.125f * (1 << DEPTH))
73 #define LRINTF(x) lrintf(x)
75 #define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / 1.0))
76 #define SCREEN(x, a, b) (1.0 - (x) * ((1.0 - (a)) * (1.0 - (b)) / 1.0))
77 #define BURN(a, b) (((a) <= 0.0) ? (a) : FFMAX(0.0, 1.0 - (1.0 - (b)) / (a)))
78 #define DODGE(a, b) (((a) >= 1.0) ? (a) : FFMIN(1.0, ((b) / (1.0 - (a)))))
79 #define GEOMETRIC(a, b) (sqrtf(fmaxf(A, 0) * fmaxf(B, 0)))
80 #define INT2FLOAT(x) av_int2float(x)
81 #define FLOAT2INT(x) av_float2int(x)
89 #define fn2(a, b) blend_##a##_##b##bit
90 #define fn1(name, depth) fn2(name, depth)
91 #define fn0(name) fn1(name, DEPTH)
93 #define fn(NAME, EXPR) \
94 static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \
95 const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
96 uint8_t *_dst, ptrdiff_t dst_linesize, \
97 ptrdiff_t width, ptrdiff_t height, \
98 FilterParams *param, SliceParams *sliceparam) \
100 const float opacity = param->opacity; \
102 for (int i = 0; i < height; i++) { \
103 const PIXEL *top = (const PIXEL *)_top; \
104 const PIXEL *bottom = (const PIXEL *)_bottom; \
105 PIXEL *dst = (PIXEL *)_dst; \
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; \
145 #ifdef BUILD_TYPE_SPECIFIC_FUNCS
146 fn(average, (
A +
B) / 2)
155 fn(harmonic,
A == 0 &&
B == 0 ? 0 : 2LL *
A *
B / (
A +
B))
156 #undef BUILD_TYPE_SPECIFIC_FUNCS
#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)