libpgf  7.21.2
PGF - Progressive Graphics File
WaveletTransform.cpp
Go to the documentation of this file.
1 /*
2  * The Progressive Graphics File; http://www.libpgf.org
3  *
4  * $Date: 2006-05-18 16:03:32 +0200 (Do, 18 Mai 2006) $
5  * $Revision: 194 $
6  *
7  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  */
23 
28 
29 #include "WaveletTransform.h"
30 
31 #define c1 1 // best value 1
32 #define c2 2 // best value 2
33 
35 // Constructor: Constructs a wavelet transform pyramid of given size and levels.
36 // @param width The width of the original image (at level 0) in pixels
37 // @param height The height of the original image (at level 0) in pixels
38 // @param levels The number of levels (>= 0)
39 // @param data Input data of subband LL at level 0
40 CWaveletTransform::CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT* data)
41 : m_nLevels(levels + 1) // m_nLevels in CPGFImage determines the number of FWT steps; this.m_nLevels determines the number subband-planes
42 , m_subband(nullptr)
43 #ifdef __PGFROISUPPORT__
44 , m_indices(nullptr)
45 #endif
46 {
47  ASSERT(m_nLevels > 0 && m_nLevels <= MaxLevel + 1);
48  InitSubbands(width, height, data);
49 }
50 
52 // Initialize size subbands on all levels
53 void CWaveletTransform::InitSubbands(UINT32 width, UINT32 height, DataT* data) {
54  if (m_subband) Destroy();
55 
56  // create subbands
58 
59  // init subbands
60  UINT32 loWidth = width;
61  UINT32 hiWidth = width;
62  UINT32 loHeight = height;
63  UINT32 hiHeight = height;
64 
65  for (int level = 0; level < m_nLevels; level++) {
66  m_subband[level][LL].Initialize(loWidth, loHeight, level, LL); // LL
67  m_subband[level][HL].Initialize(hiWidth, loHeight, level, HL); // HL
68  m_subband[level][LH].Initialize(loWidth, hiHeight, level, LH); // LH
69  m_subband[level][HH].Initialize(hiWidth, hiHeight, level, HH); // HH
70  hiWidth = loWidth >> 1; hiHeight = loHeight >> 1;
71  loWidth = (loWidth + 1) >> 1; loHeight = (loHeight + 1) >> 1;
72  }
73  if (data) {
74  m_subband[0][LL].SetBuffer(data);
75  }
76 }
77 
79 // Compute fast forward wavelet transform of LL subband at given level and
80 // stores result in all 4 subbands of level + 1.
81 // Wavelet transform used in writing a PGF file
82 // Forward Transform of srcBand and split and store it into subbands on destLevel
83 // low pass filter at even positions: 1/8[-1, 2, (6), 2, -1]
84 // high pass filter at odd positions: 1/4[-2, (4), -2]
85 // @param level A wavelet transform pyramid level (>= 0 && < Levels())
86 // @param quant A quantization value (linear scalar quantization)
87 // @return error in case of a memory allocation problem
88 OSError CWaveletTransform::ForwardTransform(int level, int quant) {
89  ASSERT(level >= 0 && level < m_nLevels - 1);
90  const int destLevel = level + 1;
91  ASSERT(m_subband[destLevel]);
92  CSubband* srcBand = &m_subband[level][LL]; ASSERT(srcBand);
93  const UINT32 width = srcBand->GetWidth();
94  const UINT32 height = srcBand->GetHeight();
95  DataT* src = srcBand->GetBuffer(); ASSERT(src);
96  DataT *row0, *row1, *row2, *row3;
97 
98  // Allocate memory for next transform level
99  for (int i=0; i < NSubbands; i++) {
100  if (!m_subband[destLevel][i].AllocMemory()) return InsufficientMemory;
101  }
102 
103  if (height >= FilterSize) { // changed from FilterSizeH to FilterSize
104  // top border handling
105  row0 = src; row1 = row0 + width; row2 = row1 + width;
106  ForwardRow(row0, width);
107  ForwardRow(row1, width);
108  ForwardRow(row2, width);
109  for (UINT32 k=0; k < width; k++) {
110  row1[k] -= ((row0[k] + row2[k] + c1) >> 1); // high pass
111  row0[k] += ((row1[k] + c1) >> 1); // low pass
112  }
113  InterleavedToSubbands(destLevel, row0, row1, width);
114  row0 = row1; row1 = row2; row2 += width; row3 = row2 + width;
115 
116  // middle part
117  for (UINT32 i=3; i < height-1; i += 2) {
118  ForwardRow(row2, width);
119  ForwardRow(row3, width);
120  for (UINT32 k=0; k < width; k++) {
121  row2[k] -= ((row1[k] + row3[k] + c1) >> 1); // high pass filter
122  row1[k] += ((row0[k] + row2[k] + c2) >> 2); // low pass filter
123  }
124  InterleavedToSubbands(destLevel, row1, row2, width);
125  row0 = row2; row1 = row3; row2 = row3 + width; row3 = row2 + width;
126  }
127 
128  // bottom border handling
129  if (height & 1) {
130  for (UINT32 k=0; k < width; k++) {
131  row1[k] += ((row0[k] + c1) >> 1); // low pass
132  }
133  InterleavedToSubbands(destLevel, row1, nullptr, width);
134  row0 = row1; row1 += width;
135  } else {
136  ForwardRow(row2, width);
137  for (UINT32 k=0; k < width; k++) {
138  row2[k] -= row1[k]; // high pass
139  row1[k] += ((row0[k] + row2[k] + c2) >> 2); // low pass
140  }
141  InterleavedToSubbands(destLevel, row1, row2, width);
142  row0 = row1; row1 = row2; row2 += width;
143  }
144  } else {
145  // if height is too small
146  row0 = src; row1 = row0 + width;
147  // first part
148  for (UINT32 k=0; k < height; k += 2) {
149  ForwardRow(row0, width);
150  ForwardRow(row1, width);
151  InterleavedToSubbands(destLevel, row0, row1, width);
152  row0 += width << 1; row1 += width << 1;
153  }
154  // bottom
155  if (height & 1) {
156  InterleavedToSubbands(destLevel, row0, nullptr, width);
157  }
158  }
159 
160  if (quant > 0) {
161  // subband quantization (without LL)
162  for (int i=1; i < NSubbands; i++) {
163  m_subband[destLevel][i].Quantize(quant);
164  }
165  // LL subband quantization
166  if (destLevel == m_nLevels - 1) {
167  m_subband[destLevel][LL].Quantize(quant);
168  }
169  }
170 
171  // free source band
172  srcBand->FreeMemory();
173  return NoError;
174 }
175 
177 // Forward transform one row
178 // low pass filter at even positions: 1/8[-1, 2, (6), 2, -1]
179 // high pass filter at odd positions: 1/4[-2, (4), -2]
180 void CWaveletTransform::ForwardRow(DataT* src, UINT32 width) {
181  if (width >= FilterSize) {
182  UINT32 i = 3;
183 
184  // left border handling
185  src[1] -= ((src[0] + src[2] + c1) >> 1); // high pass
186  src[0] += ((src[1] + c1) >> 1); // low pass
187 
188  // middle part
189  for (; i < width-1; i += 2) {
190  src[i] -= ((src[i-1] + src[i+1] + c1) >> 1); // high pass
191  src[i-1] += ((src[i-2] + src[i] + c2) >> 2); // low pass
192  }
193 
194  // right border handling
195  if (width & 1) {
196  src[i-1] += ((src[i-2] + c1) >> 1); // low pass
197  } else {
198  src[i] -= src[i-1]; // high pass
199  src[i-1] += ((src[i-2] + src[i] + c2) >> 2); // low pass
200  }
201  }
202 }
203 
205 // Copy transformed and interleaved (L,H,L,H,...) rows loRow and hiRow to subbands LL,HL,LH,HH
206 void CWaveletTransform::InterleavedToSubbands(int destLevel, DataT* loRow, DataT* hiRow, UINT32 width) {
207  const UINT32 wquot = width >> 1;
208  const bool wrem = (width & 1);
209  CSubband &ll = m_subband[destLevel][LL], &hl = m_subband[destLevel][HL];
210  CSubband &lh = m_subband[destLevel][LH], &hh = m_subband[destLevel][HH];
211 
212  if (hiRow) {
213  for (UINT32 i=0; i < wquot; i++) {
214  ll.WriteBuffer(*loRow++); // first access, than increment
215  hl.WriteBuffer(*loRow++);
216  lh.WriteBuffer(*hiRow++); // first access, than increment
217  hh.WriteBuffer(*hiRow++);
218  }
219  if (wrem) {
220  ll.WriteBuffer(*loRow);
221  lh.WriteBuffer(*hiRow);
222  }
223  } else {
224  for (UINT32 i=0; i < wquot; i++) {
225  ll.WriteBuffer(*loRow++); // first access, than increment
226  hl.WriteBuffer(*loRow++);
227  }
228  if (wrem) ll.WriteBuffer(*loRow);
229  }
230 }
231 
233 // Compute fast inverse wavelet transform of all 4 subbands of given level and
234 // stores result in LL subband of level - 1.
235 // Inverse wavelet transform used in reading a PGF file
236 // Inverse Transform srcLevel and combine to destBand
237 // low-pass coefficients at even positions, high-pass coefficients at odd positions
238 // inverse filter for even positions: 1/4[-1, (4), -1]
239 // inverse filter for odd positions: 1/8[-1, 4, (6), 4, -1]
240 // @param srcLevel A wavelet transform pyramid level (> 0 && <= Levels())
241 // @param w [out] A pointer to the returned width of subband LL (in pixels)
242 // @param h [out] A pointer to the returned height of subband LL (in pixels)
243 // @param data [out] A pointer to the returned array of image data
244 // @return error in case of a memory allocation problem
245 OSError CWaveletTransform::InverseTransform(int srcLevel, UINT32* w, UINT32* h, DataT** data) {
246  ASSERT(srcLevel > 0 && srcLevel < m_nLevels);
247  const int destLevel = srcLevel - 1;
248  ASSERT(m_subband[destLevel]);
249  CSubband* destBand = &m_subband[destLevel][LL];
250  UINT32 width, height;
251 
252  // allocate memory for the results of the inverse transform
253  if (!destBand->AllocMemory()) return InsufficientMemory;
254  DataT *origin = destBand->GetBuffer(), *row0, *row1, *row2, *row3;
255 
256 #ifdef __PGFROISUPPORT__
257  PGFRect destROI = destBand->GetAlignedROI();
258  const UINT32 destWidth = destROI.Width(); // destination buffer width
259  const UINT32 destHeight = destROI.Height(); // destination buffer height
260  width = destWidth; // destination working width
261  height = destHeight; // destination working height
262 
263  // update destination ROI
264  if (destROI.top & 1) {
265  destROI.top++;
266  origin += destWidth;
267  height--;
268  }
269  if (destROI.left & 1) {
270  destROI.left++;
271  origin++;
272  width--;
273  }
274 
275  // init source buffer position
276  const UINT32 leftD = destROI.left >> 1;
277  const UINT32 left0 = m_subband[srcLevel][LL].GetAlignedROI().left;
278  const UINT32 left1 = m_subband[srcLevel][HL].GetAlignedROI().left;
279  const UINT32 topD = destROI.top >> 1;
280  const UINT32 top0 = m_subband[srcLevel][LL].GetAlignedROI().top;
281  const UINT32 top1 = m_subband[srcLevel][LH].GetAlignedROI().top;
282  ASSERT(m_subband[srcLevel][LH].GetAlignedROI().left == left0);
283  ASSERT(m_subband[srcLevel][HH].GetAlignedROI().left == left1);
284  ASSERT(m_subband[srcLevel][HL].GetAlignedROI().top == top0);
285  ASSERT(m_subband[srcLevel][HH].GetAlignedROI().top == top1);
286 
287  UINT32 srcOffsetX[2] = { 0, 0 };
288  UINT32 srcOffsetY[2] = { 0, 0 };
289 
290  if (leftD >= __max(left0, left1)) {
291  srcOffsetX[0] = leftD - left0;
292  srcOffsetX[1] = leftD - left1;
293  } else {
294  if (left0 <= left1) {
295  const UINT32 dx = (left1 - leftD) << 1;
296  destROI.left += dx;
297  origin += dx;
298  width -= dx;
299  srcOffsetX[0] = left1 - left0;
300  } else {
301  const UINT32 dx = (left0 - leftD) << 1;
302  destROI.left += dx;
303  origin += dx;
304  width -= dx;
305  srcOffsetX[1] = left0 - left1;
306  }
307  }
308  if (topD >= __max(top0, top1)) {
309  srcOffsetY[0] = topD - top0;
310  srcOffsetY[1] = topD - top1;
311  } else {
312  if (top0 <= top1) {
313  const UINT32 dy = (top1 - topD) << 1;
314  destROI.top += dy;
315  origin += dy*destWidth;
316  height -= dy;
317  srcOffsetY[0] = top1 - top0;
318  } else {
319  const UINT32 dy = (top0 - topD) << 1;
320  destROI.top += dy;
321  origin += dy*destWidth;
322  height -= dy;
323  srcOffsetY[1] = top0 - top1;
324  }
325  }
326 
327  m_subband[srcLevel][LL].InitBuffPos(srcOffsetX[0], srcOffsetY[0]);
328  m_subband[srcLevel][HL].InitBuffPos(srcOffsetX[1], srcOffsetY[0]);
329  m_subband[srcLevel][LH].InitBuffPos(srcOffsetX[0], srcOffsetY[1]);
330  m_subband[srcLevel][HH].InitBuffPos(srcOffsetX[1], srcOffsetY[1]);
331 
332 #else
333  width = destBand->GetWidth();
334  height = destBand->GetHeight();
335  PGFRect destROI(0, 0, width, height);
336  const UINT32 destWidth = width; // destination buffer width
337  const UINT32 destHeight = height; // destination buffer height
338 
339  // init source buffer position
340  for (int i = 0; i < NSubbands; i++) {
341  m_subband[srcLevel][i].InitBuffPos();
342  }
343 #endif
344 
345  if (destHeight >= FilterSize) { // changed from FilterSizeH to FilterSize
346  // top border handling
347  row0 = origin; row1 = row0 + destWidth;
348  SubbandsToInterleaved(srcLevel, row0, row1, width);
349  for (UINT32 k = 0; k < width; k++) {
350  row0[k] -= ((row1[k] + c1) >> 1); // even
351  }
352 
353  // middle part
354  row2 = row1 + destWidth; row3 = row2 + destWidth;
355  for (UINT32 i = destROI.top + 2; i < destROI.bottom - 1; i += 2) {
356  SubbandsToInterleaved(srcLevel, row2, row3, width);
357  for (UINT32 k = 0; k < width; k++) {
358  row2[k] -= ((row1[k] + row3[k] + c2) >> 2); // even
359  row1[k] += ((row0[k] + row2[k] + c1) >> 1); // odd
360  }
361  InverseRow(row0, width);
362  InverseRow(row1, width);
363  row0 = row2; row1 = row3; row2 = row1 + destWidth; row3 = row2 + destWidth;
364  }
365 
366  // bottom border handling
367  if (height & 1) {
368  SubbandsToInterleaved(srcLevel, row2, nullptr, width);
369  for (UINT32 k = 0; k < width; k++) {
370  row2[k] -= ((row1[k] + c1) >> 1); // even
371  row1[k] += ((row0[k] + row2[k] + c1) >> 1); // odd
372  }
373  InverseRow(row0, width);
374  InverseRow(row1, width);
375  InverseRow(row2, width);
376  row0 = row1; row1 = row2; row2 += destWidth;
377  } else {
378  for (UINT32 k = 0; k < width; k++) {
379  row1[k] += row0[k];
380  }
381  InverseRow(row0, width);
382  InverseRow(row1, width);
383  row0 = row1; row1 += destWidth;
384  }
385  } else {
386  // height is too small
387  row0 = origin; row1 = row0 + destWidth;
388  // first part
389  for (UINT32 k = 0; k < height; k += 2) {
390  SubbandsToInterleaved(srcLevel, row0, row1, width);
391  InverseRow(row0, width);
392  InverseRow(row1, width);
393  row0 += destWidth << 1; row1 += destWidth << 1;
394  }
395  // bottom
396  if (height & 1) {
397  SubbandsToInterleaved(srcLevel, row0, nullptr, width);
398  InverseRow(row0, width);
399  }
400  }
401 
402  // free memory of the current srcLevel
403  for (int i = 0; i < NSubbands; i++) {
404  m_subband[srcLevel][i].FreeMemory();
405  }
406 
407  // return info
408  *w = destWidth;
409  *h = destHeight;
410  *data = destBand->GetBuffer();
411  return NoError;
412 }
413 
415 // Inverse Wavelet Transform of one row
416 // low-pass coefficients at even positions, high-pass coefficients at odd positions
417 // inverse filter for even positions: 1/4[-1, (4), -1]
418 // inverse filter for odd positions: 1/8[-1, 4, (6), 4, -1]
419 void CWaveletTransform::InverseRow(DataT* dest, UINT32 width) {
420  if (width >= FilterSize) {
421  UINT32 i = 2;
422 
423  // left border handling
424  dest[0] -= ((dest[1] + c1) >> 1); // even
425 
426  // middle part
427  for (; i < width - 1; i += 2) {
428  dest[i] -= ((dest[i-1] + dest[i+1] + c2) >> 2); // even
429  dest[i-1] += ((dest[i-2] + dest[i] + c1) >> 1); // odd
430  }
431 
432  // right border handling
433  if (width & 1) {
434  dest[i] -= ((dest[i-1] + c1) >> 1); // even
435  dest[i-1] += ((dest[i-2] + dest[i] + c1) >> 1); // odd
436  } else {
437  dest[i-1] += dest[i-2]; // odd
438  }
439  }
440 }
441 
443 // Copy transformed coefficients from subbands LL,HL,LH,HH to interleaved format (L,H,L,H,...)
444 void CWaveletTransform::SubbandsToInterleaved(int srcLevel, DataT* loRow, DataT* hiRow, UINT32 width) {
445  const UINT32 wquot = width >> 1;
446  const bool wrem = (width & 1);
447  CSubband &ll = m_subband[srcLevel][LL], &hl = m_subband[srcLevel][HL];
448  CSubband &lh = m_subband[srcLevel][LH], &hh = m_subband[srcLevel][HH];
449 
450  if (hiRow) {
451  #ifdef __PGFROISUPPORT__
452  const bool storePos = wquot < ll.BufferWidth();
453  UINT32 llPos = 0, hlPos = 0, lhPos = 0, hhPos = 0;
454 
455  if (storePos) {
456  // save current src buffer positions
457  llPos = ll.GetBuffPos();
458  hlPos = hl.GetBuffPos();
459  lhPos = lh.GetBuffPos();
460  hhPos = hh.GetBuffPos();
461  }
462  #endif
463 
464  for (UINT32 i=0; i < wquot; i++) {
465  *loRow++ = ll.ReadBuffer();// first access, than increment
466  *loRow++ = hl.ReadBuffer();// first access, than increment
467  *hiRow++ = lh.ReadBuffer();// first access, than increment
468  *hiRow++ = hh.ReadBuffer();// first access, than increment
469  }
470 
471  if (wrem) {
472  *loRow++ = ll.ReadBuffer();// first access, than increment
473  *hiRow++ = lh.ReadBuffer();// first access, than increment
474  }
475 
476  #ifdef __PGFROISUPPORT__
477  if (storePos) {
478  // increment src buffer positions
479  ll.IncBuffRow(llPos);
480  hl.IncBuffRow(hlPos);
481  lh.IncBuffRow(lhPos);
482  hh.IncBuffRow(hhPos);
483  }
484  #endif
485 
486  } else {
487  #ifdef __PGFROISUPPORT__
488  const bool storePos = wquot < ll.BufferWidth();
489  UINT32 llPos = 0, hlPos = 0;
490 
491  if (storePos) {
492  // save current src buffer positions
493  llPos = ll.GetBuffPos();
494  hlPos = hl.GetBuffPos();
495  }
496  #endif
497 
498  for (UINT32 i=0; i < wquot; i++) {
499  *loRow++ = ll.ReadBuffer();// first access, than increment
500  *loRow++ = hl.ReadBuffer();// first access, than increment
501  }
502  if (wrem) *loRow++ = ll.ReadBuffer();
503 
504  #ifdef __PGFROISUPPORT__
505  if (storePos) {
506  // increment src buffer positions
507  ll.IncBuffRow(llPos);
508  hl.IncBuffRow(hlPos);
509  }
510  #endif
511  }
512 }
513 
514 #ifdef __PGFROISUPPORT__
515 void CWaveletTransform::SetROI(PGFRect roi) {
519  const UINT32 delta = (FilterSize >> 1) << m_nLevels;
520 
521  // create tile indices
522  delete[] m_indices;
523  m_indices = new PGFRect[m_nLevels];
524 
525  // enlarge rect: add margin
526  roi.left = (roi.left > delta) ? roi.left - delta : 0;
527  roi.top = (roi.top > delta) ? roi.top - delta : 0;
528  roi.right += delta;
529  roi.bottom += delta;
530 
531  for (int l = 0; l < m_nLevels; l++) {
532  PGFRect alignedROI;
533  PGFRect& indices = m_indices[l];
534  UINT32 nTiles = GetNofTiles(l);
535  CSubband& subband = m_subband[l][LL];
536 
537  // use roi to determine the necessary tile indices (for all subbands the same) and aligned ROI for LL subband
538  subband.SetNTiles(nTiles); // must be called before TileIndex()
539  subband.TileIndex(true, roi.left, roi.top, indices.left, indices.top, alignedROI.left, alignedROI.top);
540  subband.TileIndex(false, roi.right, roi.bottom, indices.right, indices.bottom, alignedROI.right, alignedROI.bottom);
541  subband.SetAlignedROI(alignedROI);
542  ASSERT(l == 0 ||
543  (m_indices[l-1].left >= 2*m_indices[l].left &&
544  m_indices[l-1].top >= 2*m_indices[l].top &&
545  m_indices[l-1].right <= 2*m_indices[l].right &&
546  m_indices[l-1].bottom <= 2*m_indices[l].bottom));
547 
548  // determine aligned ROI of other three subbands
549  PGFRect aroi;
550  UINT32 w, h;
551  for (int b = 1; b < NSubbands; b++) {
552  CSubband& sb = m_subband[l][b];
553  sb.SetNTiles(nTiles); // must be called before TilePosition()
554  sb.TilePosition(indices.left, indices.top, aroi.left, aroi.top, w, h);
555  sb.TilePosition(indices.right - 1, indices.bottom - 1, aroi.right, aroi.bottom, w, h);
556  aroi.right += w;
557  aroi.bottom += h;
558  sb.SetAlignedROI(aroi);
559  }
560 
561  // use aligned ROI of LL subband for next level
562  roi.left = alignedROI.left >> 1;
563  roi.top = alignedROI.top >> 1;
564  roi.right = (alignedROI.right + 1) >> 1;
565  roi.bottom = (alignedROI.bottom + 1) >> 1;
566  }
567 }
568 
569 #endif // __PGFROISUPPORT__
OSError InverseTransform(int level, UINT32 *width, UINT32 *height, DataT **data)
Definition: PGFtypes.h:99
DataT * GetBuffer()
Definition: Subband.h:107
INT32 DataT
Definition: PGFtypes.h:268
void SetBuffer(DataT *b)
Definition: Subband.h:148
bool AllocMemory()
Definition: Subband.cpp:77
void Initialize(UINT32 width, UINT32 height, int level, Orientation orient)
Definition: Subband.cpp:57
void ForwardRow(DataT *buff, UINT32 width)
const UINT32 FilterSize
UINT32 GetBuffPos() const
Definition: Subband.h:151
UINT32 right
Definition: PGFtypes.h:225
Wavelet channel class.
Definition: Subband.h:42
void InitBuffPos()
Definition: Subband.h:162
#define c1
int GetHeight() const
Definition: Subband.h:123
void InverseRow(DataT *buff, UINT32 width)
OSError ForwardTransform(int level, int quant)
#define MaxLevel
maximum number of transform levels
Definition: PGFtypes.h:62
DataT ReadBuffer()
Definition: Subband.h:149
#define __PGFROISUPPORT__
Definition: PGFplatform.h:60
UINT32 Height() const
Definition: PGFtypes.h:258
Definition: PGFtypes.h:99
#define __max(x, y)
Definition: PGFplatform.h:92
int m_nLevels
number of LL levels: one more than header.nLevels in PGFimage
Definition: PGFtypes.h:99
UINT32 top
Definition: PGFtypes.h:225
void SubbandsToInterleaved(int srcLevel, DataT *loRow, DataT *hiRow, UINT32 width)
PGF wavelet transform class.
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
void FreeMemory()
Delete the memory buffer of this subband.
Definition: Subband.cpp:101
void Quantize(int quantParam)
Definition: Subband.cpp:112
UINT32 left
Definition: PGFtypes.h:225
void InterleavedToSubbands(int destLevel, DataT *loRow, DataT *hiRow, UINT32 width)
Definition: PGFtypes.h:99
CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT *data=nullptr)
void InitSubbands(UINT32 width, UINT32 height, DataT *data)
#define c2
void WriteBuffer(DataT val)
Definition: Subband.h:147
Rectangle.
Definition: PGFtypes.h:224
int GetWidth() const
Definition: Subband.h:128
#define NSubbands
number of subbands per level
Definition: PGFtypes.h:63
UINT32 Width() const
Definition: PGFtypes.h:255
UINT32 bottom
Definition: PGFtypes.h:225