32 #define pixel uint16_t
36 #define htype uint16_t
41 #define SHIFT ((DEPTH + 1) / 2)
42 #define BINS (1 << SHIFT)
43 #define MASK (BINS - 1)
44 #define fn3(a,b) a##_##b
45 #define fn2(a,b) fn3(a,b)
46 #define fn(a) fn2(a, DEPTH)
48 #define PICK_COARSE_BIN(x, y) (BINS * (x) + ((y) >> SHIFT))
49 #define PICK_FINE_BIN(x, y, z) (BINS * ((x) * ((y) >> SHIFT) + (z)) + ((y) & MASK))
52 uint8_t *ddst,
int dst_linesize,
int width,
int height,
53 int slice_h_start,
int slice_h_end,
int jobnr)
56 htype *ccoarse =
s->coarse[jobnr];
57 htype *cfine =
s->fine[jobnr];
58 const int radius =
s->radius;
59 const int radiusV =
s->radiusV;
66 src_linesize /=
sizeof(
pixel);
67 dst_linesize /=
sizeof(
pixel);
69 memset(cfine, 0,
s->fine_size *
sizeof(*cfine));
70 memset(ccoarse, 0,
s->coarse_size *
sizeof(*ccoarse));
72 srcp =
src +
FFMAX(0, slice_h_start - radiusV) * src_linesize;
80 srcp =
src +
FFMAX(0, slice_h_start - radiusV - (jobnr != 0)) * src_linesize;
81 for (
int i = 0;
i < radiusV + (jobnr != 0) * (1 + radiusV);
i++) {
82 for (
int j = 0; j <
width; j++) {
91 for (
int i = slice_h_start;
i < slice_h_end;
i++) {
96 p = srcp + src_linesize *
FFMAX(0,
i - radiusV - 1);
97 for (
int j = 0; j <
width; j++) {
102 p = srcp + src_linesize *
FFMIN(
height - 1,
i + radiusV);
103 for (
int j = 0; j <
width; j++) {
108 s->hmuladd(coarse, &ccoarse[0], radius,
BINS);
109 for (
int j = 0; j < radius; j++)
110 s->hadd(coarse, &ccoarse[
BINS * j],
BINS);
111 for (
int k = 0; k <
BINS; k++)
112 s->hmuladd(&fine[k][0], &cfine[
BINS *
width * k], 2 * radius + 1,
BINS);
114 for (
int j = 0; j <
width; j++) {
120 for (k = 0; k <
BINS; k++) {
129 if (luc[k] <= j - radius) {
130 memset(&fine[k], 0,
BINS *
sizeof(
htype));
131 for (luc[k] = j - radius; luc[k] <
FFMIN(j + radius + 1,
width); luc[k]++)
133 if (luc[k] < j + radius + 1) {
135 luc[k] = j + radius + 1;
138 for (; luc[k] < j + radius + 1; luc[k]++) {
150 dst[j] =
BINS * k +
b;