Compute fast inverse wavelet transform of all 4 subbands of given level and stores result in LL subband of level - 1.
246 {
247 ASSERT(srcLevel > 0 && srcLevel <
m_nLevels);
248 const int destLevel = srcLevel - 1;
251 uint32_t width, height;
252
253
254 if (!destBand->AllocMemory()) return InsufficientMemory;
255 DataT* origin = destBand->
GetBuffer(), * row0, * row1, * row2, * row3;
256
257#ifdef __PGFROISUPPORT__
258 PGFRect destROI = destBand->GetAlignedROI();
259 const uint32_t destWidth = destROI.Width();
260 const uint32_t destHeight = destROI.Height();
261 width = destWidth;
262 height = destHeight;
263
264
265 if (destROI.top & 1) {
266 destROI.top++;
267 origin += destWidth;
268 height--;
269 }
270 if (destROI.left & 1) {
271 destROI.left++;
272 origin++;
273 width--;
274 }
275
276
277 const uint32_t leftD = destROI.left >> 1;
280 const uint32_t topD = destROI.top >> 1;
287
288 uint32_t srcOffsetX[2] = { 0, 0 };
289 uint32_t srcOffsetY[2] = { 0, 0 };
290
291 if (leftD >=
__max(left0, left1)) {
292 srcOffsetX[0] = leftD - left0;
293 srcOffsetX[1] = leftD - left1;
294 } else {
295 if (left0 <= left1) {
296 const uint32_t dx = (left1 - leftD) << 1;
297 destROI.left += dx;
298 origin += dx;
299 width -= dx;
300 srcOffsetX[0] = left1 - left0;
301 } else {
302 const uint32_t dx = (left0 - leftD) << 1;
303 destROI.left += dx;
304 origin += dx;
305 width -= dx;
306 srcOffsetX[1] = left0 - left1;
307 }
308 }
309 if (topD >=
__max(top0, top1)) {
310 srcOffsetY[0] = topD - top0;
311 srcOffsetY[1] = topD - top1;
312 } else {
313 if (top0 <= top1) {
314 const uint32_t dy = (top1 - topD) << 1;
315 destROI.top += dy;
316 origin += dy*destWidth;
317 height -= dy;
318 srcOffsetY[0] = top1 - top0;
319 } else {
320 const uint32_t dy = (top0 - topD) << 1;
321 destROI.top += dy;
322 origin += dy*destWidth;
323 height -= dy;
324 srcOffsetY[1] = top0 - top1;
325 }
326 }
327
332
333#else
334 width = destBand->GetWidth();
335 height = destBand->GetHeight();
336 PGFRect destROI(0, 0, width, height);
337 const uint32_t destWidth = width;
338 const uint32_t destHeight = height;
339
340
343 }
344#endif
345
347
348 row0 = origin; row1 = row0 + destWidth;
350 for (uint32_t k = 0; k < width; k++) {
351 row0[k] -= ((row1[k] +
c1) >> 1);
352 }
353
354
355 row2 = row1 + destWidth; row3 = row2 + destWidth;
356 for (uint32_t i = destROI.top + 2; i < destROI.bottom - 1; i += 2) {
358 for (uint32_t k = 0; k < width; k++) {
359 row2[k] -= ((row1[k] + row3[k] +
c2) >> 2);
360 row1[k] += ((row0[k] + row2[k] +
c1) >> 1);
361 }
364 row0 = row2; row1 = row3; row2 = row1 + destWidth; row3 = row2 + destWidth;
365 }
366
367
368 if (height & 1) {
370 for (uint32_t k = 0; k < width; k++) {
371 row2[k] -= ((row1[k] +
c1) >> 1);
372 row1[k] += ((row0[k] + row2[k] +
c1) >> 1);
373 }
377 row0 = row1; row1 = row2; row2 += destWidth;
378 } else {
379 for (uint32_t k = 0; k < width; k++) {
380 row1[k] += row0[k];
381 }
384 row0 = row1; row1 += destWidth;
385 }
386 } else {
387
388 row0 = origin; row1 = row0 + destWidth;
389
390 for (uint32_t k = 0; k < height; k += 2) {
394 row0 += destWidth << 1; row1 += destWidth << 1;
395 }
396
397 if (height & 1) {
400 }
401 }
402
403
406 }
407
408
409 *w = destWidth;
410 *h = destHeight;
411 *data = destBand->GetBuffer();
412 return NoError;
413 }
void FreeMemory()
Delete the memory buffer of this subband.