33 #define pixel uint16_t
37 #define htype uint16_t
42 #define SHIFT ((DEPTH + 1) / 2)
43 #define BINS (1 << SHIFT)
44 #define MASK (BINS - 1)
45 #define fn3(a,b) a##_##b
46 #define fn2(a,b) fn3(a,b)
47 #define fn(a) fn2(a, DEPTH)
49 #define PICK_COARSE_BIN(x, y) (BINS * (x) + (((y) >> SHIFT) & MASK))
50 #define PICK_FINE_BIN(x, y, z) (BINS * ((x) * (((y) >> SHIFT) & MASK) + (z)) + ((y) & MASK))
54 int slice_h_start,
int slice_h_end,
int jobnr)
57 htype *ccoarse =
s->coarse[jobnr];
58 htype *cfine =
s->fine[jobnr];
59 const int radius =
s->radius;
60 const int radiusV =
s->radiusV;
67 htype *coarse =
s->row_coarse[jobnr];
69 htype *luc =
s->row_luc[jobnr];
72 src_linesize /=
sizeof(
pixel);
73 dst_linesize /=
sizeof(
pixel);
75 memset(cfine, 0,
s->fine_size *
sizeof(*cfine));
76 memset(ccoarse, 0,
s->coarse_size *
sizeof(*ccoarse));
78 srcp =
src +
FFMAX(0, slice_h_start - radiusV) * src_linesize;
86 srcp =
src +
FFMAX(0, slice_h_start - radiusV - (jobnr != 0)) * src_linesize;
87 for (
int i = 0;
i < radiusV + (jobnr != 0) * (1 + radiusV);
i++) {
88 for (
int j = 0; j <
width; j++) {
97 for (
int i = slice_h_start;
i < slice_h_end;
i++) {
99 memset(coarse, 0,
BINS *
sizeof(*coarse));
100 memset(fine, 0,
BINS *
BINS *
sizeof(**fine));
101 memset(luc, 0,
BINS *
sizeof(*luc));
108 p = srcp + src_linesize *
FFMAX(0,
i - radiusV - 1);
109 for (
int j = 0; j <
width; j++) {
114 p = srcp + src_linesize *
FFMIN(
height - 1,
i + radiusV);
115 for (
int j = 0; j <
width; j++) {
120 s->hmuladd(coarse, &ccoarse[0], radius,
BINS);
121 for (
int j = 0; j < radius; j++)
122 s->hadd(coarse, &ccoarse[
BINS * j],
BINS);
123 for (
int k = 0; k <
BINS; k++)
124 s->hmuladd(&fine[k][0], &cfine[
BINS *
width * k], 2 * radius + 1,
BINS);
126 for (
int j = 0; j <
width; j++) {
132 for (k = 0; k <
BINS; k++) {
141 if (luc[k] <= j - radius) {
142 memset(&fine[k], 0,
BINS *
sizeof(
htype));
143 for (luc[k] = j - radius; luc[k] <
FFMIN(j + radius + 1,
width); luc[k]++)
145 if (luc[k] < j + radius + 1) {
147 luc[k] = j + radius + 1;
150 for (; luc[k] < j + radius + 1; luc[k]++) {
162 dst[j] =
BINS * k +
b;
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Main libavfilter public API header.
common internal API header