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)) 50 #define PICK_FINE_BIN(x, y, z) (BINS * ((x) * ((y) >> SHIFT) + (z)) + ((y) & MASK)) 54 int slice_h_start,
int slice_h_end,
int jobnr)
59 const int radius = s->
radius;
67 src_linesize /=
sizeof(
pixel);
68 dst_linesize /=
sizeof(
pixel);
70 memset(cfine, 0, s->
fine_size *
sizeof(*cfine));
71 memset(ccoarse, 0, s->
coarse_size *
sizeof(*ccoarse));
73 srcp = src +
FFMAX(0, slice_h_start - radiusV) * src_linesize;
81 srcp = src +
FFMAX(0, slice_h_start - radiusV - (jobnr != 0)) * src_linesize;
82 for (
int i = 0;
i < radiusV + (jobnr != 0) * (1 + radiusV);
i++) {
83 for (
int j = 0; j <
width; j++) {
92 for (
int i = slice_h_start;
i < slice_h_end;
i++) {
97 p = srcp + src_linesize *
FFMAX(0,
i - radiusV - 1);
98 for (
int j = 0; j <
width; j++) {
103 p = srcp + src_linesize *
FFMIN(
height - 1,
i + radiusV);
104 for (
int j = 0; j <
width; j++) {
110 for (
int j = 0; j < radius; j++)
112 for (
int k = 0; k <
BINS; k++)
113 s->
hmuladd(&fine[k][0], &cfine[BINS * width * k], 2 * radius + 1, BINS);
115 for (
int j = 0; j <
width; j++) {
119 s->
hadd(coarse, &ccoarse[BINS *
FFMIN(j + radius, width - 1)], BINS);
121 for (k = 0; k <
BINS; k++) {
130 if (luc[k] <= j - radius) {
131 memset(&fine[k], 0, BINS *
sizeof(
htype));
132 for (luc[k] = j - radius; luc[k] <
FFMIN(j + radius + 1, width); luc[k]++)
133 s->
hadd(fine[k], &cfine[BINS * (width * k + luc[k])], BINS);
134 if (luc[k] < j + radius + 1) {
135 s->
hmuladd(&fine[k][0], &cfine[BINS * (width * k + width - 1)], j + radius + 1 - width, BINS);
136 luc[k] = j + radius + 1;
139 for (; luc[k] < j + radius + 1; luc[k]++) {
140 s->
hsub(fine[k], &cfine[BINS * (width * k +
FFMAX(luc[k] - 2 * radius - 1, 0))], BINS);
141 s->
hadd(fine[k], &cfine[BINS * (width * k +
FFMIN(luc[k], width - 1))], BINS);
145 s->
hsub(coarse, &ccoarse[BINS *
FFMAX(j - radius, 0)], BINS);
148 for (b = 0; b <
BINS; b++) {
151 dst[j] = BINS * k +
b;
Main libavfilter public API header.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
simple assert() macros that are a bit more flexible than ISO C assert().
void(* hmuladd)(uint16_t *dst, const uint16_t *src, int f, int bins)
void(* hadd)(uint16_t *dst, const uint16_t *src, int bins)
void(* hsub)(uint16_t *dst, const uint16_t *src, int bins)