libpgf 7.26.45
PGF - Progressive Graphics File
Loading...
Searching...
No Matches
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
31namespace pgf {
32 constexpr DataT c1 = 1; // best value 1
33 constexpr DataT c2 = 2; // best value 2
34
36 // Constructor: Constructs a wavelet transform pyramid of given size and levels.
37 // @param width The width of the original image (at level 0) in pixels
38 // @param height The height of the original image (at level 0) in pixels
39 // @param levels The number of levels (>= 0)
40 // @param data Input data of subband LL at level 0
41 CWaveletTransform::CWaveletTransform(uint32_t width, uint32_t height, int levels, DataT* data)
42 : m_nLevels(levels + 1) // m_nLevels in CPGFImage determines the number of FWT steps; this.m_nLevels determines the number subband-planes
43 , m_subband(nullptr)
45 , m_indices(nullptr)
46#endif
47 {
48 ASSERT(m_nLevels > 0 && m_nLevels <= MaxLevel + 1);
49 InitSubbands(width, height, data);
50 }
51
53 // Initialize size subbands on all levels
54 void CWaveletTransform::InitSubbands(uint32_t width, uint32_t height, DataT* data) {
55 if (m_subband) Destroy();
56
57 // create subbands
59
60 // init subbands
61 uint32_t loWidth = width;
62 uint32_t hiWidth = width;
63 uint32_t loHeight = height;
64 uint32_t hiHeight = height;
65
66 for (int level = 0; level < m_nLevels; level++) {
67 m_subband[level][Orient::LL].Initialize(loWidth, loHeight, level, Orient::LL); // LL
68 m_subband[level][Orient::HL].Initialize(hiWidth, loHeight, level, Orient::HL); // HL
69 m_subband[level][Orient::LH].Initialize(loWidth, hiHeight, level, Orient::LH); // LH
70 m_subband[level][Orient::HH].Initialize(hiWidth, hiHeight, level, Orient::HH); // HH
71 hiWidth = loWidth >> 1; hiHeight = loHeight >> 1;
72 loWidth = (loWidth + 1) >> 1; loHeight = (loHeight + 1) >> 1;
73 }
74 if (data) {
76 }
77 }
78
80 // Compute fast forward wavelet transform of LL subband at given level and
81 // stores result in all 4 subbands of level + 1.
82 // Wavelet transform used in writing a PGF file
83 // Forward Transform of srcBand and split and store it into subbands on destLevel
84 // low pass filter at even positions: 1/8[-1, 2, (6), 2, -1]
85 // high pass filter at odd positions: 1/4[-2, (4), -2]
86 // @param level A wavelet transform pyramid level (>= 0 && < Levels())
87 // @param quant A quantization value (linear scalar quantization)
88 // @return error in case of a memory allocation problem
89 OSError CWaveletTransform::ForwardTransform(int level, int quant) {
90 ASSERT(level >= 0 && level < m_nLevels - 1);
91 const int destLevel = level + 1;
92 ASSERT(m_subband[destLevel]);
93 CSubband* srcBand = &m_subband[level][Orient::LL]; ASSERT(srcBand);
94 const uint32_t width = srcBand->GetWidth();
95 const uint32_t height = srcBand->GetHeight();
96 DataT* src = srcBand->GetBuffer(); ASSERT(src);
97 DataT* row0, * row1, * row2, * row3;
98
99 // Allocate memory for next transform level
100 for (int i = 0; i < NSubbands; i++) {
101 if (!m_subband[destLevel][i].AllocMemory()) return InsufficientMemory;
102 }
103
104 if (height >= FilterSize) { // changed from FilterSizeH to FilterSize
105 // top border handling
106 row0 = src; row1 = row0 + width; row2 = row1 + width;
107 ForwardRow(row0, width);
108 ForwardRow(row1, width);
109 ForwardRow(row2, width);
110 for (uint32_t k = 0; k < width; k++) {
111 row1[k] -= ((row0[k] + row2[k] + c1) >> 1); // high pass
112 row0[k] += ((row1[k] + c1) >> 1); // low pass
113 }
114 InterleavedToSubbands(destLevel, row0, row1, width);
115 row0 = row1; row1 = row2; row2 += width; row3 = row2 + width;
116
117 // middle part
118 for (uint32_t i = 3; i < height-1; i += 2) {
119 ForwardRow(row2, width);
120 ForwardRow(row3, width);
121 for (uint32_t k = 0; k < width; k++) {
122 row2[k] -= ((row1[k] + row3[k] + c1) >> 1); // high pass filter
123 row1[k] += ((row0[k] + row2[k] + c2) >> 2); // low pass filter
124 }
125 InterleavedToSubbands(destLevel, row1, row2, width);
126 row0 = row2; row1 = row3; row2 = row3 + width; row3 = row2 + width;
127 }
128
129 // bottom border handling
130 if (height & 1) {
131 for (uint32_t k = 0; k < width; k++) {
132 row1[k] += ((row0[k] + c1) >> 1); // low pass
133 }
134 InterleavedToSubbands(destLevel, row1, nullptr, width);
135 row0 = row1; row1 += width;
136 } else {
137 ForwardRow(row2, width);
138 for (uint32_t k = 0; k < width; k++) {
139 row2[k] -= row1[k]; // high pass
140 row1[k] += ((row0[k] + row2[k] + c2) >> 2); // low pass
141 }
142 InterleavedToSubbands(destLevel, row1, row2, width);
143 row0 = row1; row1 = row2; row2 += width;
144 }
145 } else {
146 // if height is too small
147 row0 = src; row1 = row0 + width;
148 // first part
149 for (uint32_t k = 0; k < height; k += 2) {
150 ForwardRow(row0, width);
151 ForwardRow(row1, width);
152 InterleavedToSubbands(destLevel, row0, row1, width);
153 row0 += width << 1; row1 += width << 1;
154 }
155 // bottom
156 if (height & 1) {
157 InterleavedToSubbands(destLevel, row0, nullptr, width);
158 }
159 }
160
161 if (quant > 0) {
162 // subband quantization (without LL)
163 for (int i = 1; i < NSubbands; i++) {
164 m_subband[destLevel][i].Quantize(quant);
165 }
166 // LL subband quantization
167 if (destLevel == m_nLevels - 1) {
168 m_subband[destLevel][Orient::LL].Quantize(quant);
169 }
170 }
171
172 // free source band
173 srcBand->FreeMemory();
174 return NoError;
175 }
176
178 // Forward transform one row
179 // low pass filter at even positions: 1/8[-1, 2, (6), 2, -1]
180 // high pass filter at odd positions: 1/4[-2, (4), -2]
181 void CWaveletTransform::ForwardRow(DataT* src, uint32_t width) {
182 if (width >= FilterSize) {
183 uint32_t i = 3;
184
185 // left border handling
186 src[1] -= ((src[0] + src[2] + c1) >> 1); // high pass
187 src[0] += ((src[1] + c1) >> 1); // low pass
188
189 // middle part
190 for (; i < width-1; i += 2) {
191 src[i] -= ((src[i-1] + src[i+1] + c1) >> 1); // high pass
192 src[i-1] += ((src[i-2] + src[i] + c2) >> 2); // low pass
193 }
194
195 // right border handling
196 if (width & 1) {
197 src[i-1] += ((src[i-2] + c1) >> 1); // low pass
198 } else {
199 src[i] -= src[i-1]; // high pass
200 src[i-1] += ((src[i-2] + src[i] + c2) >> 2); // low pass
201 }
202 }
203 }
204
206 // Copy transformed and interleaved (L,H,L,H,...) rows loRow and hiRow to subbands LL,HL,LH,HH
207 void CWaveletTransform::InterleavedToSubbands(int destLevel, DataT* loRow, DataT* hiRow, uint32_t width) {
208 const uint32_t wquot = width >> 1;
209 const bool wrem = (width & 1);
210 CSubband& ll = m_subband[destLevel][Orient::LL], & hl = m_subband[destLevel][Orient::HL];
211 CSubband& lh = m_subband[destLevel][Orient::LH], & hh = m_subband[destLevel][Orient::HH];
212
213 if (hiRow) {
214 for (uint32_t i = 0; i < wquot; i++) {
215 ll.WriteBuffer(*loRow++); // first access, than increment
216 hl.WriteBuffer(*loRow++);
217 lh.WriteBuffer(*hiRow++); // first access, than increment
218 hh.WriteBuffer(*hiRow++);
219 }
220 if (wrem) {
221 ll.WriteBuffer(*loRow);
222 lh.WriteBuffer(*hiRow);
223 }
224 } else {
225 for (uint32_t i = 0; i < wquot; i++) {
226 ll.WriteBuffer(*loRow++); // first access, than increment
227 hl.WriteBuffer(*loRow++);
228 }
229 if (wrem) ll.WriteBuffer(*loRow);
230 }
231 }
232
234 // Compute fast inverse wavelet transform of all 4 subbands of given level and
235 // stores result in LL subband of level - 1.
236 // Inverse wavelet transform used in reading a PGF file
237 // Inverse Transform srcLevel and combine to destBand
238 // low-pass coefficients at even positions, high-pass coefficients at odd positions
239 // inverse filter for even positions: 1/4[-1, (4), -1]
240 // inverse filter for odd positions: 1/8[-1, 4, (6), 4, -1]
241 // @param srcLevel A wavelet transform pyramid level (> 0 && <= Levels())
242 // @param w [out] A pointer to the returned width of subband LL (in pixels)
243 // @param h [out] A pointer to the returned height of subband LL (in pixels)
244 // @param data [out] A pointer to the returned array of image data
245 // @return error in case of a memory allocation problem
246 OSError CWaveletTransform::InverseTransform(int srcLevel, uint32_t* w, uint32_t* h, DataT** data) {
247 ASSERT(srcLevel > 0 && srcLevel < m_nLevels);
248 const int destLevel = srcLevel - 1;
249 ASSERT(m_subband[destLevel]);
250 CSubband* destBand = &m_subband[destLevel][Orient::LL];
251 uint32_t width, height;
252
253 // allocate memory for the results of the inverse transform
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(); // destination buffer width
260 const uint32_t destHeight = destROI.Height(); // destination buffer height
261 width = destWidth; // destination working width
262 height = destHeight; // destination working height
263
264 // update destination ROI
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 // init source buffer position
277 const uint32_t leftD = destROI.left >> 1;
278 const uint32_t left0 = m_subband[srcLevel][Orient::LL].GetAlignedROI().left;
279 const uint32_t left1 = m_subband[srcLevel][Orient::HL].GetAlignedROI().left;
280 const uint32_t topD = destROI.top >> 1;
281 const uint32_t top0 = m_subband[srcLevel][Orient::LL].GetAlignedROI().top;
282 const uint32_t top1 = m_subband[srcLevel][Orient::LH].GetAlignedROI().top;
283 ASSERT(m_subband[srcLevel][Orient::LH].GetAlignedROI().left == left0);
284 ASSERT(m_subband[srcLevel][Orient::HH].GetAlignedROI().left == left1);
285 ASSERT(m_subband[srcLevel][Orient::HL].GetAlignedROI().top == top0);
286 ASSERT(m_subband[srcLevel][Orient::HH].GetAlignedROI().top == top1);
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
328 m_subband[srcLevel][pgf::Orient::LL].InitBuffPos(srcOffsetX[0], srcOffsetY[0]);
329 m_subband[srcLevel][pgf::Orient::HL].InitBuffPos(srcOffsetX[1], srcOffsetY[0]);
330 m_subband[srcLevel][pgf::Orient::LH].InitBuffPos(srcOffsetX[0], srcOffsetY[1]);
331 m_subband[srcLevel][pgf::Orient::HH].InitBuffPos(srcOffsetX[1], srcOffsetY[1]);
332
333#else
334 width = destBand->GetWidth();
335 height = destBand->GetHeight();
336 PGFRect destROI(0, 0, width, height);
337 const uint32_t destWidth = width; // destination buffer width
338 const uint32_t destHeight = height; // destination buffer height
339
340 // init source buffer position
341 for (int i = 0; i < NSubbands; i++) {
342 m_subband[srcLevel][i].InitBuffPos();
343 }
344#endif
345
346 if (destHeight >= FilterSize) { // changed from FilterSizeH to FilterSize
347 // top border handling
348 row0 = origin; row1 = row0 + destWidth;
349 SubbandsToInterleaved(srcLevel, row0, row1, width);
350 for (uint32_t k = 0; k < width; k++) {
351 row0[k] -= ((row1[k] + c1) >> 1); // even
352 }
353
354 // middle part
355 row2 = row1 + destWidth; row3 = row2 + destWidth;
356 for (uint32_t i = destROI.top + 2; i < destROI.bottom - 1; i += 2) {
357 SubbandsToInterleaved(srcLevel, row2, row3, width);
358 for (uint32_t k = 0; k < width; k++) {
359 row2[k] -= ((row1[k] + row3[k] + c2) >> 2); // even
360 row1[k] += ((row0[k] + row2[k] + c1) >> 1); // odd
361 }
362 InverseRow(row0, width);
363 InverseRow(row1, width);
364 row0 = row2; row1 = row3; row2 = row1 + destWidth; row3 = row2 + destWidth;
365 }
366
367 // bottom border handling
368 if (height & 1) {
369 SubbandsToInterleaved(srcLevel, row2, nullptr, width);
370 for (uint32_t k = 0; k < width; k++) {
371 row2[k] -= ((row1[k] + c1) >> 1); // even
372 row1[k] += ((row0[k] + row2[k] + c1) >> 1); // odd
373 }
374 InverseRow(row0, width);
375 InverseRow(row1, width);
376 InverseRow(row2, width);
377 row0 = row1; row1 = row2; row2 += destWidth;
378 } else {
379 for (uint32_t k = 0; k < width; k++) {
380 row1[k] += row0[k];
381 }
382 InverseRow(row0, width);
383 InverseRow(row1, width);
384 row0 = row1; row1 += destWidth;
385 }
386 } else {
387 // height is too small
388 row0 = origin; row1 = row0 + destWidth;
389 // first part
390 for (uint32_t k = 0; k < height; k += 2) {
391 SubbandsToInterleaved(srcLevel, row0, row1, width);
392 InverseRow(row0, width);
393 InverseRow(row1, width);
394 row0 += destWidth << 1; row1 += destWidth << 1;
395 }
396 // bottom
397 if (height & 1) {
398 SubbandsToInterleaved(srcLevel, row0, nullptr, width);
399 InverseRow(row0, width);
400 }
401 }
402
403 // free memory of the current srcLevel
404 for (int i = 0; i < NSubbands; i++) {
405 m_subband[srcLevel][i].FreeMemory();
406 }
407
408 // return info
409 *w = destWidth;
410 *h = destHeight;
411 *data = destBand->GetBuffer();
412 return NoError;
413 }
414
416 // Inverse Wavelet Transform of one row
417 // low-pass coefficients at even positions, high-pass coefficients at odd positions
418 // inverse filter for even positions: 1/4[-1, (4), -1]
419 // inverse filter for odd positions: 1/8[-1, 4, (6), 4, -1]
420 void CWaveletTransform::InverseRow(DataT* dest, uint32_t width) {
421 if (width >= FilterSize) {
422 uint32_t i = 2;
423
424 // left border handling
425 dest[0] -= ((dest[1] + c1) >> 1); // even
426
427 // middle part
428 for (; i < width - 1; i += 2) {
429 dest[i] -= ((dest[i-1] + dest[i+1] + c2) >> 2); // even
430 dest[i-1] += ((dest[i-2] + dest[i] + c1) >> 1); // odd
431 }
432
433 // right border handling
434 if (width & 1) {
435 dest[i] -= ((dest[i-1] + c1) >> 1); // even
436 dest[i-1] += ((dest[i-2] + dest[i] + c1) >> 1); // odd
437 } else {
438 dest[i-1] += dest[i-2]; // odd
439 }
440 }
441 }
442
444 // Copy transformed coefficients from subbands LL,HL,LH,HH to interleaved format (L,H,L,H,...)
445 void CWaveletTransform::SubbandsToInterleaved(int srcLevel, DataT* loRow, DataT* hiRow, uint32_t width) {
446 const uint32_t wquot = width >> 1;
447 const bool wrem = (width & 1);
448 CSubband& ll = m_subband[srcLevel][Orient::LL], & hl = m_subband[srcLevel][Orient::HL];
449 CSubband& lh = m_subband[srcLevel][Orient::LH], & hh = m_subband[srcLevel][Orient::HH];
450
451 if (hiRow) {
452#ifdef __PGFROISUPPORT__
453 const bool storePos = wquot < ll.BufferWidth();
454 uint32_t llPos = 0, hlPos = 0, lhPos = 0, hhPos = 0;
455
456 if (storePos) {
457 // save current src buffer positions
458 llPos = ll.GetBuffPos();
459 hlPos = hl.GetBuffPos();
460 lhPos = lh.GetBuffPos();
461 hhPos = hh.GetBuffPos();
462 }
463#endif
464
465 for (uint32_t i = 0; i < wquot; i++) {
466 *loRow++ = ll.ReadBuffer();// first access, than increment
467 *loRow++ = hl.ReadBuffer();// first access, than increment
468 *hiRow++ = lh.ReadBuffer();// first access, than increment
469 *hiRow++ = hh.ReadBuffer();// first access, than increment
470 }
471
472 if (wrem) {
473 *loRow++ = ll.ReadBuffer();// first access, than increment
474 *hiRow++ = lh.ReadBuffer();// first access, than increment
475 }
476
477#ifdef __PGFROISUPPORT__
478 if (storePos) {
479 // increment src buffer positions
480 ll.IncBuffRow(llPos);
481 hl.IncBuffRow(hlPos);
482 lh.IncBuffRow(lhPos);
483 hh.IncBuffRow(hhPos);
484 }
485#endif
486
487 } else {
488#ifdef __PGFROISUPPORT__
489 const bool storePos = wquot < ll.BufferWidth();
490 uint32_t llPos = 0, hlPos = 0;
491
492 if (storePos) {
493 // save current src buffer positions
494 llPos = ll.GetBuffPos();
495 hlPos = hl.GetBuffPos();
496 }
497#endif
498
499 for (uint32_t i = 0; i < wquot; i++) {
500 *loRow++ = ll.ReadBuffer();// first access, than increment
501 *loRow++ = hl.ReadBuffer();// first access, than increment
502 }
503 if (wrem) *loRow++ = ll.ReadBuffer();
504
505#ifdef __PGFROISUPPORT__
506 if (storePos) {
507 // increment src buffer positions
508 ll.IncBuffRow(llPos);
509 hl.IncBuffRow(hlPos);
510 }
511#endif
512 }
513 }
514
515#ifdef __PGFROISUPPORT__
519 void CWaveletTransform::SetROI(PGFRect roi) {
520 const uint32_t delta = (FilterSize >> 1) << m_nLevels;
521
522 // create tile indices
523 delete[] m_indices;
524 m_indices = new PGFRect[m_nLevels];
525
526 // enlarge rect: add margin
527 roi.left = (roi.left > delta) ? roi.left - delta : 0;
528 roi.top = (roi.top > delta) ? roi.top - delta : 0;
529 roi.right += delta;
530 roi.bottom += delta;
531
532 for (int l = 0; l < m_nLevels; l++) {
533 PGFRect alignedROI;
534 PGFRect& indices = m_indices[l];
535 uint32_t nTiles = GetNofTiles(l);
536 CSubband& subband = m_subband[l][pgf::Orient::LL];
537
538 // use roi to determine the necessary tile indices (for all subbands the same) and aligned ROI for LL subband
539 subband.SetNTiles(nTiles); // must be called before TileIndex()
540 subband.TileIndex(true, roi.left, roi.top, indices.left, indices.top, alignedROI.left, alignedROI.top);
541 subband.TileIndex(false, roi.right, roi.bottom, indices.right, indices.bottom, alignedROI.right, alignedROI.bottom);
542 subband.SetAlignedROI(alignedROI);
543 ASSERT(l == 0 ||
544 (m_indices[l-1].left >= 2*m_indices[l].left &&
545 m_indices[l-1].top >= 2*m_indices[l].top &&
546 m_indices[l-1].right <= 2*m_indices[l].right &&
547 m_indices[l-1].bottom <= 2*m_indices[l].bottom));
548
549 // determine aligned ROI of other three subbands
550 PGFRect aroi;
551 uint32_t w, h;
552 for (int b = 1; b < NSubbands; b++) {
553 CSubband& sb = m_subband[l][b];
554 sb.SetNTiles(nTiles); // must be called before TilePosition()
555 sb.TilePosition(indices.left, indices.top, aroi.left, aroi.top, w, h);
556 sb.TilePosition(indices.right - 1, indices.bottom - 1, aroi.right, aroi.bottom, w, h);
557 aroi.right += w;
558 aroi.bottom += h;
559 sb.SetAlignedROI(aroi);
560 }
561
562 // use aligned ROI of LL subband for next level
563 roi.left = alignedROI.left >> 1;
564 roi.top = alignedROI.top >> 1;
565 roi.right = (alignedROI.right + 1) >> 1;
566 roi.bottom = (alignedROI.bottom + 1) >> 1;
567 }
568 }
569
570#endif // __PGFROISUPPORT__
571}
#define __PGFROISUPPORT__
Definition PGFplatform.h:60
#define __max(x, y)
PGF wavelet transform class.
Wavelet channel class.
Definition Subband.h:42
bool AllocMemory()
Definition Subband.cpp:78
DataT * GetBuffer()
Definition Subband.h:107
void FreeMemory()
Delete the memory buffer of this subband.
Definition Subband.cpp:102
DataT ReadBuffer()
Definition Subband.h:149
uint32_t GetBuffPos() const
Definition Subband.h:151
void InitBuffPos()
Definition Subband.h:162
int GetHeight() const
Definition Subband.h:123
void Initialize(uint32_t width, uint32_t height, int level, Orient::Orientation orient)
Definition Subband.cpp:58
void WriteBuffer(DataT val)
Definition Subband.h:147
int GetWidth() const
Definition Subband.h:128
void SetBuffer(DataT *b)
Definition Subband.h:148
void Quantize(int quantParam)
Definition Subband.cpp:113
void InterleavedToSubbands(int destLevel, DataT *loRow, DataT *hiRow, uint32_t width)
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
void ForwardRow(DataT *buff, uint32_t width)
void InitSubbands(uint32_t width, uint32_t height, DataT *data)
CWaveletTransform(uint32_t width, uint32_t height, int levels, DataT *data=nullptr)
OSError ForwardTransform(int level, int quant)
OSError InverseTransform(int level, uint32_t *width, uint32_t *height, DataT **data)
void SubbandsToInterleaved(int srcLevel, DataT *loRow, DataT *hiRow, uint32_t width)
int m_nLevels
number of LL levels: one more than header.nLevels in PGFimage
void InverseRow(DataT *buff, uint32_t width)
constexpr Orientation LL
Definition PGFtypes.h:104
constexpr Orientation HH
Definition PGFtypes.h:107
constexpr Orientation LH
Definition PGFtypes.h:106
constexpr Orientation HL
Definition PGFtypes.h:105
Definition PGFimage.h:33
constexpr DataT c2
constexpr int MaxLevel
maximum number of transform levels
Definition PGFtypes.h:62
constexpr DataT c1
constexpr uint32_t FilterSize
int32_t DataT
Definition PGFtypes.h:367
constexpr int NSubbands
number of subbands per level
Definition PGFtypes.h:63
Rectangle.
Definition PGFtypes.h:258
uint32_t top
Definition PGFtypes.h:259
uint32_t Height() const
Definition PGFtypes.h:307
uint32_t bottom
Definition PGFtypes.h:259
uint32_t right
Definition PGFtypes.h:259
uint32_t Width() const
Definition PGFtypes.h:304
uint32_t left
Definition PGFtypes.h:259