~ubuntu-branches/ubuntu/raring/digikam/raring-proposed

« back to all changes in this revision

Viewing changes to core/libs/3rdparty/libpgf/Subband.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-07-13 18:30:11 UTC
  • mfrom: (1.2.40) (82.1.1 quantal-proposed)
  • Revision ID: package-import@ubuntu.com-20120713183011-3tjthisigeoe651z
* New upstream release (LP: #1022972)
  - Use libtiff-dev instead of libtiff4-dev
  - Drop duplicate build dep on libtiff4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
/////////////////////////////////////////////////////////////////////
34
34
// Default constructor
35
 
CSubband::CSubband() : m_size(0), m_data(0)
 
35
CSubband::CSubband() 
 
36
: m_size(0)
 
37
, m_data(0)
36
38
#ifdef __PGFROISUPPORT__
37
 
, m_ROIs(0), m_dataWidth(0) 
 
39
, m_nTiles(0)
38
40
#endif
39
41
{
40
42
}
56
58
        m_data = 0;
57
59
        m_dataPos = 0;
58
60
#ifdef __PGFROISUPPORT__
59
 
        m_ROIs = 0;
60
 
        m_dataWidth = width;
 
61
        m_ROI.left = 0;
 
62
        m_ROI.top = 0;
 
63
        m_ROI.right = m_width;
 
64
        m_ROI.bottom = m_height;
 
65
        m_nTiles = 0;
61
66
#endif
62
67
}
63
68
 
64
 
 
65
69
/////////////////////////////////////////////////////////////////////
66
70
// Allocate a memory buffer to store all wavelet coefficients of this subband.
67
 
// @return True if the allocation did work without any problems
 
71
// @return True if the allocation works without any problems
68
72
bool CSubband::AllocMemory() {
69
73
        UINT32 oldSize = m_size;
70
74
 
71
75
#ifdef __PGFROISUPPORT__
72
 
        if (m_ROIs) {
73
 
                // reset dataWidth and size
74
 
                const PGFRect& roi = m_ROIs->GetROI(m_level);
75
 
                m_dataWidth = __min(m_width, roi.right) - roi.left;
76
 
                ASSERT(m_dataWidth > 0);
77
 
                m_size = m_dataWidth*(__min(m_height, roi.bottom) - roi.top);
78
 
        }
 
76
        m_size = BufferWidth()*m_ROI.Height();
79
77
#endif
80
78
        ASSERT(m_size > 0);
81
79
 
212
210
 
213
211
#ifdef __PGFROISUPPORT__
214
212
        if (tile) {
 
213
                UINT32 xPos, yPos, w, h;
 
214
 
215
215
                // compute tile position and size
216
 
                const PGFRect& roi = m_ROIs->GetROI(m_level);
217
 
                UINT32 xPos, yPos, w, h;
218
216
                TilePosition(tileX, tileY, xPos, yPos, w, h);
219
 
 
220
 
                // read values into buffer using partitiong scheme
221
 
                decoder.Partition(this, quantParam, w, h, (xPos - roi.left) + (yPos - roi.top)*m_dataWidth, m_dataWidth);
 
217
                
 
218
                ASSERT(xPos >= m_ROI.left && yPos >= m_ROI.top);
 
219
                decoder.Partition(this, quantParam, w, h, (xPos - m_ROI.left) + (yPos - m_ROI.top)*BufferWidth(), BufferWidth());
222
220
        } else 
223
221
#endif
224
222
        {
250
248
        // 8 9 A B
251
249
        // C D E F
252
250
 
253
 
        UINT32 nTiles = m_ROIs->GetNofTiles(m_level);
 
251
        UINT32 nTiles = m_nTiles;
254
252
        ASSERT(tileX < nTiles); ASSERT(tileY < nTiles);
255
253
        UINT32 m;
256
254
        UINT32 left = 0, right = nTiles;