61 uint32_t loWidth = width;
62 uint32_t hiWidth = width;
63 uint32_t loHeight = height;
64 uint32_t hiHeight = height;
66 for (
int level = 0; level <
m_nLevels; level++) {
71 hiWidth = loWidth >> 1; hiHeight = loHeight >> 1;
72 loWidth = (loWidth + 1) >> 1; loHeight = (loHeight + 1) >> 1;
90 ASSERT(level >= 0 && level <
m_nLevels - 1);
91 const int destLevel = level + 1;
94 const uint32_t width = srcBand->
GetWidth();
95 const uint32_t height = srcBand->
GetHeight();
97 DataT* row0, * row1, * row2, * row3;
101 if (!
m_subband[destLevel][i].AllocMemory())
return InsufficientMemory;
106 row0 = src; row1 = row0 + width; row2 = row1 + width;
110 for (uint32_t k = 0; k < width; k++) {
111 row1[k] -= ((row0[k] + row2[k] +
c1) >> 1);
112 row0[k] += ((row1[k] +
c1) >> 1);
115 row0 = row1; row1 = row2; row2 += width; row3 = row2 + width;
118 for (uint32_t i = 3; i < height-1; i += 2) {
121 for (uint32_t k = 0; k < width; k++) {
122 row2[k] -= ((row1[k] + row3[k] +
c1) >> 1);
123 row1[k] += ((row0[k] + row2[k] +
c2) >> 2);
126 row0 = row2; row1 = row3; row2 = row3 + width; row3 = row2 + width;
131 for (uint32_t k = 0; k < width; k++) {
132 row1[k] += ((row0[k] +
c1) >> 1);
135 row0 = row1; row1 += width;
138 for (uint32_t k = 0; k < width; k++) {
140 row1[k] += ((row0[k] + row2[k] +
c2) >> 2);
143 row0 = row1; row1 = row2; row2 += width;
147 row0 = src; row1 = row0 + width;
149 for (uint32_t k = 0; k < height; k += 2) {
153 row0 += width << 1; row1 += width << 1;
247 ASSERT(srcLevel > 0 && srcLevel <
m_nLevels);
248 const int destLevel = srcLevel - 1;
251 uint32_t width, height;
254 if (!destBand->
AllocMemory())
return InsufficientMemory;
255 DataT* origin = destBand->
GetBuffer(), * row0, * row1, * row2, * row3;
257#ifdef __PGFROISUPPORT__
258 PGFRect destROI = destBand->GetAlignedROI();
259 const uint32_t destWidth = destROI.
Width();
260 const uint32_t destHeight = destROI.
Height();
265 if (destROI.
top & 1) {
270 if (destROI.
left & 1) {
277 const uint32_t leftD = destROI.
left >> 1;
280 const uint32_t topD = destROI.
top >> 1;
288 uint32_t srcOffsetX[2] = { 0, 0 };
289 uint32_t srcOffsetY[2] = { 0, 0 };
291 if (leftD >=
__max(left0, left1)) {
292 srcOffsetX[0] = leftD - left0;
293 srcOffsetX[1] = leftD - left1;
295 if (left0 <= left1) {
296 const uint32_t dx = (left1 - leftD) << 1;
300 srcOffsetX[0] = left1 - left0;
302 const uint32_t dx = (left0 - leftD) << 1;
306 srcOffsetX[1] = left0 - left1;
309 if (topD >=
__max(top0, top1)) {
310 srcOffsetY[0] = topD - top0;
311 srcOffsetY[1] = topD - top1;
314 const uint32_t dy = (top1 - topD) << 1;
316 origin += dy*destWidth;
318 srcOffsetY[0] = top1 - top0;
320 const uint32_t dy = (top0 - topD) << 1;
322 origin += dy*destWidth;
324 srcOffsetY[1] = top0 - top1;
336 PGFRect destROI(0, 0, width, height);
337 const uint32_t destWidth = width;
338 const uint32_t destHeight = height;
348 row0 = origin; row1 = row0 + destWidth;
350 for (uint32_t k = 0; k < width; k++) {
351 row0[k] -= ((row1[k] +
c1) >> 1);
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);
364 row0 = row2; row1 = row3; row2 = row1 + destWidth; row3 = row2 + destWidth;
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);
377 row0 = row1; row1 = row2; row2 += destWidth;
379 for (uint32_t k = 0; k < width; k++) {
384 row0 = row1; row1 += destWidth;
388 row0 = origin; row1 = row0 + destWidth;
390 for (uint32_t k = 0; k < height; k += 2) {
394 row0 += destWidth << 1; row1 += destWidth << 1;
446 const uint32_t wquot = width >> 1;
447 const bool wrem = (width & 1);
452#ifdef __PGFROISUPPORT__
453 const bool storePos = wquot < ll.BufferWidth();
454 uint32_t llPos = 0, hlPos = 0, lhPos = 0, hhPos = 0;
459 hlPos = hl.GetBuffPos();
461 hhPos = hh.GetBuffPos();
465 for (uint32_t i = 0; i < wquot; i++) {
467 *loRow++ = hl.ReadBuffer();
469 *hiRow++ = hh.ReadBuffer();
477#ifdef __PGFROISUPPORT__
480 ll.IncBuffRow(llPos);
481 hl.IncBuffRow(hlPos);
482 lh.IncBuffRow(lhPos);
483 hh.IncBuffRow(hhPos);
488#ifdef __PGFROISUPPORT__
489 const bool storePos = wquot < ll.BufferWidth();
490 uint32_t llPos = 0, hlPos = 0;
495 hlPos = hl.GetBuffPos();
499 for (uint32_t i = 0; i < wquot; i++) {
501 *loRow++ = hl.ReadBuffer();
505#ifdef __PGFROISUPPORT__
508 ll.IncBuffRow(llPos);
509 hl.IncBuffRow(hlPos);