Compute fast inverse wavelet transform of all 4 subbands of given level and stores result in LL subband of level - 1.
244 ASSERT(srcLevel > 0 && srcLevel <
m_nLevels);
245 const int destLevel = srcLevel - 1;
248 UINT32 width, height;
251 if (!destBand->
AllocMemory())
return InsufficientMemory;
252 DataT *origin = destBand->
GetBuffer(), *row0, *row1, *row2, *row3;
254 #ifdef __PGFROISUPPORT__ 255 PGFRect destROI = destBand->GetAlignedROI();
256 const UINT32 destWidth = destROI.
Width();
257 const UINT32 destHeight = destROI.
Height();
262 if (destROI.
top & 1) {
267 if (destROI.
left & 1) {
274 const UINT32 leftD = destROI.
left >> 1;
275 const UINT32 left0 =
m_subband[srcLevel][
LL].GetAlignedROI().left;
276 const UINT32 left1 =
m_subband[srcLevel][
HL].GetAlignedROI().left;
277 const UINT32 topD = destROI.
top >> 1;
278 const UINT32 top0 =
m_subband[srcLevel][
LL].GetAlignedROI().top;
279 const UINT32 top1 =
m_subband[srcLevel][
LH].GetAlignedROI().top;
280 ASSERT(
m_subband[srcLevel][
LH].GetAlignedROI().left == left0);
281 ASSERT(
m_subband[srcLevel][
HH].GetAlignedROI().left == left1);
282 ASSERT(
m_subband[srcLevel][
HL].GetAlignedROI().top == top0);
283 ASSERT(
m_subband[srcLevel][
HH].GetAlignedROI().top == top1);
285 UINT32 srcOffsetX[2] = { 0, 0 };
286 UINT32 srcOffsetY[2] = { 0, 0 };
288 if (leftD >=
__max(left0, left1)) {
289 srcOffsetX[0] = leftD - left0;
290 srcOffsetX[1] = leftD - left1;
292 if (left0 <= left1) {
293 const UINT32 dx = (left1 - leftD) << 1;
297 srcOffsetX[0] = left1 - left0;
299 const UINT32 dx = (left0 - leftD) << 1;
303 srcOffsetX[1] = left0 - left1;
306 if (topD >=
__max(top0, top1)) {
307 srcOffsetY[0] = topD - top0;
308 srcOffsetY[1] = topD - top1;
311 const UINT32 dy = (top1 - topD) << 1;
313 origin += dy*destWidth;
315 srcOffsetY[0] = top1 - top0;
317 const UINT32 dy = (top0 - topD) << 1;
319 origin += dy*destWidth;
321 srcOffsetY[1] = top0 - top1;
333 PGFRect destROI(0, 0, width, height);
334 const UINT32 destWidth = width;
335 const UINT32 destHeight = height;
345 row0 = origin; row1 = row0 + destWidth;
347 for (UINT32 k = 0; k < width; k++) {
348 row0[k] -= ((row1[k] +
c1) >> 1);
352 row2 = row1 + destWidth; row3 = row2 + destWidth;
353 for (UINT32 i = destROI.
top + 2; i < destROI.
bottom - 1; i += 2) {
355 for (UINT32 k = 0; k < width; k++) {
356 row2[k] -= ((row1[k] + row3[k] +
c2) >> 2);
357 row1[k] += ((row0[k] + row2[k] +
c1) >> 1);
361 row0 = row2; row1 = row3; row2 = row1 + destWidth; row3 = row2 + destWidth;
367 for (UINT32 k = 0; k < width; k++) {
368 row2[k] -= ((row1[k] +
c1) >> 1);
369 row1[k] += ((row0[k] + row2[k] +
c1) >> 1);
374 row0 = row1; row1 = row2; row2 += destWidth;
376 for (UINT32 k = 0; k < width; k++) {
381 row0 = row1; row1 += destWidth;
385 row0 = origin; row1 = row0 + destWidth;
387 for (UINT32 k = 0; k < height; k += 2) {
391 row0 += destWidth << 1; row1 += destWidth << 1;
void FreeMemory()
Delete the memory buffer of this subband.
#define NSubbands
number of subbands per level