34 const int wd = (int)(1 + (
width >> (l - 1))), ht = (
int)(1 + (
height >> (l - 1)));
37 for(
int j = 0; j < ht - 1; j++)
39 for(
int i = 0; i < wd - 1; i++) weight_a[l][(
size_t)j * wd + i] =
gbuf(buf, i << (l - 1), j << (l - 1));
40 weight_a[l][j * wd + (wd - 1)] = 0.0f;
42 for(
int i = 0; i < wd; i++)
43 weight_a[l][(ht-1) * wd + i] = 0.0f;
45 const int step = 1 << l;
46 const int st = step / 2;
50 if(tmp_width_buf == NULL)
return;
53#pragma omp parallel for default(none) \
54 dt_omp_firstprivate(height, l, st, step, tmp_width_buf, scratch_size, wd, width) \
55 dt_omp_sharedconst(buf) \
60 for(
int j = 0; j <
height; j++)
65 for(
int i = 0; i <
width - st; i += st) tmp[i] =
gweight(i, j, i + st, j);
68 for(; i <
width - st; i += step)
69 for(ch = 0; ch < 3; ch++)
70 gbuf(buf, i, j) -= (tmp[i - st] *
gbuf(buf, i - st, j) + tmp[i] *
gbuf(buf, i + st, j))
71 / (tmp[i - st] + tmp[i]);
73 for(ch = 0; ch < 3; ch++)
gbuf(buf, i, j) -=
gbuf(buf, i - st, j);
75 for(ch = 0; ch < 3; ch++)
gbuf(buf, 0, j) +=
gbuf(buf, st, j) * 0.5f;
76 for(i = step; i <
width - st; i += step)
77 for(ch = 0; ch < 3; ch++)
78 gbuf(buf, i, j) += (tmp[i - st] *
gbuf(buf, i - st, j) + tmp[i] *
gbuf(buf, i + st, j))
79 / (2.0 * (tmp[i - st] + tmp[i]));
81 for(ch = 0; ch < 3; ch++)
gbuf(buf, i, j) +=
gbuf(buf, i - st, j) * .5f;
87 if(tmp_height_buf == NULL)
return;
90#pragma omp parallel for default(none) \
91 dt_omp_firstprivate(height, l, st, step, tmp_height_buf, scratch_size, wd, width) \
92 dt_omp_sharedconst(buf) \
97 for(
int i = 0; i <
width; i++)
102 for(
int j = 0; j <
height - st; j += st) tmp[j] =
gweight(i, j, i, j + st);
105 for(; j <
height - st; j += step)
106 for(ch = 0; ch < 3; ch++)
107 gbuf(buf, i, j) -= (tmp[j - st] *
gbuf(buf, i, j - st) + tmp[j] *
gbuf(buf, i, j + st))
108 / (tmp[j - st] + tmp[j]);
110 for(ch = 0; ch < 3; ch++)
gbuf(buf, i, j) -=
gbuf(buf, i, j - st);
112 for(ch = 0; ch < 3; ch++)
gbuf(buf, i, 0) +=
gbuf(buf, i, st) * 0.5;
113 for(j = step; j <
height - st; j += step)
114 for(ch = 0; ch < 3; ch++)
115 gbuf(buf, i, j) += (tmp[j - st] *
gbuf(buf, i, j - st) + tmp[j] *
gbuf(buf, i, j + st))
116 / (2.0 * (tmp[j - st] + tmp[j]));
118 for(ch = 0; ch < 3; ch++)
gbuf(buf, i, j) +=
gbuf(buf, i, j - st) * .5f;
126 const int step = 1 << l;
127 const int st = step / 2;
128 const int wd = (int)(1 + (
width >> (l - 1)));
132 if(tmp_height_buf == NULL)
return;
135#pragma omp parallel for default(none) \
136 dt_omp_firstprivate(height, l, st, step, tmp_height_buf, scratch_size, wd, width) \
137 shared(weight_a, buf) \
140 for(
int i = 0; i <
width; i++)
145 for(j = 0; j <
height - st; j += st) tmp[j] =
gweight(i, j, i, j + st);
147 for(
int ch = 0; ch < 3; ch++)
gbuf(buf, i, 0) -=
gbuf(buf, i, st) * 0.5f;
148 for(j = step; j <
height - st; j += step)
149 for(
int ch = 0; ch < 3; ch++)
150 gbuf(buf, i, j) -= (tmp[j - st] *
gbuf(buf, i, j - st) + tmp[j] *
gbuf(buf, i, j + st))
151 / (2.0 * (tmp[j - st] + tmp[j]));
153 for(
int ch = 0; ch < 3; ch++)
gbuf(buf, i, j) -=
gbuf(buf, i, j - st) * .5f;
155 for(j = st; j <
height - st; j += step)
156 for(
int ch = 0; ch < 3; ch++)
157 gbuf(buf, i, j) += (tmp[j - st] *
gbuf(buf, i, j - st) + tmp[j] *
gbuf(buf, i, j + st))
158 / (tmp[j - st] + tmp[j]);
160 for(
int ch = 0; ch < 3; ch++)
gbuf(buf, i, j) +=
gbuf(buf, i, j - st);
166 if(tmp_width_buf == NULL)
return;
169#pragma omp parallel for default(none) \
170 dt_omp_firstprivate(height, l, st, step, tmp_width_buf, scratch_size, wd, width) \
171 shared(weight_a, buf) \
174 for(
int j = 0; j <
height; j++)
178 for(
int i = 0; i <
width - st; i += st) tmp[i] =
gweight(i, j, i + st, j);
180 for(
int ch = 0; ch < 3; ch++)
gbuf(buf, 0, j) -=
gbuf(buf, st, j) * 0.5f;
182 for(i = step; i <
width - st; i += step)
183 for(
int ch = 0; ch < 3; ch++)
184 gbuf(buf, i, j) -= (tmp[i - st] *
gbuf(buf, i - st, j) + tmp[i] *
gbuf(buf, i + st, j))
185 / (2.0 * (tmp[i - st] + tmp[i]));
187 for(
int ch = 0; ch < 3; ch++)
gbuf(buf, i, j) -=
gbuf(buf, i - st, j) * 0.5f;
189 for(i = st; i <
width - st; i += step)
190 for(
int ch = 0; ch < 3; ch++)
191 gbuf(buf, i, j) += (tmp[i - st] *
gbuf(buf, i - st, j) + tmp[i] *
gbuf(buf, i + st, j))
192 / (tmp[i - st] + tmp[i]);
194 for(
int ch = 0; ch < 3; ch++)
gbuf(buf, i, j) +=
gbuf(buf, i - st, j);
#define gweight(i, j, ii, jj)
Definition equalizer_eaw.h:22
static void dt_iop_equalizer_iwtf(float *buf, float **weight_a, const int l, const int width, const int height)
Definition equalizer_eaw.h:124
static void dt_iop_equalizer_wtf(float *const buf, float **weight_a, const int l, const int width, const int height)
Definition equalizer_eaw.h:32