34 ptrdiff_t synthw =
width << 1;
40 for (y = 0; y <
height; y++) {
41 for (x = 0; x <
width; x++) {
42 linell[x] = synthl[(x << 1)];
43 linehl[x] = synthl[(x << 1) + 1];
44 linelh[x] = synthl[(x << 1) + synthw];
45 linehh[x] = synthl[(x << 1) + synthw + 1];
47 synthl += synthw << 1;
60 const ptrdiff_t synth_width =
width << 1;
61 const ptrdiff_t synth_height =
height << 1;
67 for (y = 0; y < synth_height; y++) {
68 for (x = 0; x < synth_width; x++)
69 synthl[x] = datal[x] << 1;
70 synthl += synth_width;
76 for (y = 0; y < synth_height; y++) {
78 synthl[1] -= (8*synthl[0] + 9*synthl[2] - synthl[4] + 8) >> 4;
79 for (x = 1; x <
width - 2; x++)
80 synthl[2*x + 1] -= (9*synthl[2*x] + 9*synthl[2*x + 2] - synthl[2*x + 4] -
81 synthl[2 * x - 2] + 8) >> 4;
82 synthl[synth_width - 1] -= (17*synthl[synth_width - 2] -
83 synthl[synth_width - 4] + 8) >> 4;
84 synthl[synth_width - 3] -= (8*synthl[synth_width - 2] +
85 9*synthl[synth_width - 4] -
86 synthl[synth_width - 6] + 8) >> 4;
88 synthl[0] += (synthl[1] + synthl[1] + 2) >> 2;
89 for (x = 1; x <
width - 1; x++)
90 synthl[2*x] += (synthl[2*x - 1] + synthl[2*x + 1] + 2) >> 2;
92 synthl[synth_width - 2] += (synthl[synth_width - 3] +
93 synthl[synth_width - 1] + 2) >> 2;
94 synthl += synth_width;
98 synthl = synth + synth_width;
99 for (x = 0; x < synth_width; x++)
100 synthl[x] -= (8*synthl[x - synth_width] + 9*synthl[x + synth_width] -
101 synthl[x + 3 * synth_width] + 8) >> 4;
103 synthl = synth + (synth_width << 1);
104 for (y = 1; y <
height - 2; y++) {
105 for (x = 0; x < synth_width; x++)
106 synthl[x + synth_width] -= (9*synthl[x] +
107 9*synthl[x + 2 * synth_width] -
108 synthl[x - 2 * synth_width] -
109 synthl[x + 4 * synth_width] + 8) >> 4;
110 synthl += synth_width << 1;
113 synthl = synth + (synth_height - 1) * synth_width;
114 for (x = 0; x < synth_width; x++) {
115 synthl[x] -= (17*synthl[x - synth_width] -
116 synthl[x - 3*synth_width] + 8) >> 4;
117 synthl[x - 2*synth_width] -= (9*synthl[x - 3*synth_width] +
118 8*synthl[x - 1*synth_width] - synthl[x - 5*synth_width] + 8) >> 4;
123 for (x = 0; x < synth_width; x++)
124 synthl[x] += (synthl[x + synth_width] + synthl[x + synth_width] + 2) >> 2;
126 synthl = synth + (synth_width << 1);
127 for (y = 1; y <
height - 1; y++) {
128 for (x = 0; x < synth_width; x++)
129 synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
130 synthl += synth_width << 1;
133 synthl = synth + (synth_height - 2) * synth_width;
134 for (x = 0; x < synth_width; x++)
135 synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
145 const ptrdiff_t synth_width =
width << 1;
146 const ptrdiff_t synth_height =
height << 1;
152 for (y = 0; y < synth_height; y++) {
153 for (x = 0; x < synth_width; x++)
154 synthl[x] = datal[x] << 1;
155 synthl += synth_width;
161 for (y = 0; y < synth_height; y++) {
163 for (x = 0; x <
width - 1; x++)
164 synthl[2 * x + 1] -= (synthl[2 * x] + synthl[2 * x + 2] + 1) >> 1;
166 synthl[synth_width - 1] -= (2*synthl[synth_width - 2] + 1) >> 1;
169 synthl[0] += (2*synthl[1] + 2) >> 2;
170 for (x = 1; x <
width - 1; x++)
171 synthl[2 * x] += (synthl[2 * x - 1] + synthl[2 * x + 1] + 2) >> 2;
173 synthl[synth_width - 2] += (synthl[synth_width - 3] + synthl[synth_width - 1] + 2) >> 2;
175 synthl += synth_width;
179 synthl = synth + synth_width;
180 for (x = 0; x < synth_width; x++)
181 synthl[x] -= (synthl[x - synth_width] + synthl[x + synth_width] + 1) >> 1;
183 synthl = synth + (synth_width << 1);
184 for (y = 1; y <
height - 1; y++) {
185 for (x = 0; x < synth_width; x++)
186 synthl[x + synth_width] -= (synthl[x] + synthl[x + synth_width * 2] + 1) >> 1;
187 synthl += (synth_width << 1);
190 synthl = synth + (synth_height - 1) * synth_width;
191 for (x = 0; x < synth_width; x++)
192 synthl[x] -= (2*synthl[x - synth_width] + 1) >> 1;
196 for (x = 0; x < synth_width; x++)
197 synthl[x] += (2*synthl[synth_width + x] + 2) >> 2;
199 synthl = synth + (synth_width << 1);
200 for (y = 1; y <
height - 1; y++) {
201 for (x = 0; x < synth_width; x++)
202 synthl[x] += (synthl[x + synth_width] + synthl[x - synth_width] + 2) >> 2;
203 synthl += (synth_width << 1);
206 synthl = synth + (synth_height - 2)*synth_width;
207 for (x = 0; x < synth_width; x++)
208 synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
220 const ptrdiff_t synth_width =
width << 1;
221 const ptrdiff_t synth_height =
height << 1;
224 for (y = 0; y < synth_height; y++) {
225 for (x = 0; x < synth_width; x += 2) {
226 synthl[y*synth_width + x + 1] = (datal[y*
stride + x + 1] <<
s) -
228 synthl[y*synth_width + x] = (datal[y*
stride + x + 0] <<
s) +
229 ((synthl[y*synth_width + x + 1] + 1) >> 1);
234 for (x = 0; x < synth_width; x++) {
235 for (y = 0; y < synth_height; y += 2) {
236 synthl[(y + 1)*synth_width + x] = synthl[(y + 1)*synth_width + x] -
237 synthl[y*synth_width + x];
238 synthl[y*synth_width + x] = synthl[y*synth_width + x] +
239 ((synthl[(y + 1)*synth_width + x] + 1) >> 1);
259 int p_height,
int slice_w,
int slice_h)
267 s->buffer =
av_calloc((p_stride + slice_w)*(p_height + slice_h),
sizeof(
dwtcoef));
271 s->padding = (slice_h >> 1)*p_stride + (slice_w >> 1);
272 s->buffer +=
s->padding;