private void waveletTreeReconstruction(DataBlk img, SubbandSyn sb, int c)
{
DataBlk subbData;
// If the current subband is a leaf then get the data from the source
if (!sb.isNode)
{
int i, m, n;
System.Object src_data, dst_data;
Coord ncblks;
if (sb.w == 0 || sb.h == 0)
{
return ; // If empty subband do nothing
}
// Get all code-blocks in subband
if (dtype == DataBlk.TYPE_INT)
{
subbData = new DataBlkInt();
}
else
{
subbData = new DataBlkFloat();
}
ncblks = sb.numCb;
dst_data = img.Data;
for (m = 0; m < ncblks.y; m++)
{
for (n = 0; n < ncblks.x; n++)
{
subbData = src.getInternCodeBlock(c, m, n, sb, subbData);
src_data = subbData.Data;
// Copy the data line by line
for (i = subbData.h - 1; i >= 0; i--)
{
// CONVERSION PROBLEM
Array.Copy((System.Array)src_data, subbData.offset + i * subbData.scanw, (System.Array)dst_data, (subbData.uly + i) * img.w + subbData.ulx, subbData.w);
}
}
}
}
else if (sb.isNode)
{
// Reconstruct the lower resolution levels if the current subbands
// is a node
//Perform the reconstruction of the LL subband
waveletTreeReconstruction(img, (SubbandSyn) sb.LL, c);
if (sb.resLvl <= reslvl - maxImgRes + ndl[c])
{
//Reconstruct the other subbands
waveletTreeReconstruction(img, (SubbandSyn) sb.HL, c);
waveletTreeReconstruction(img, (SubbandSyn) sb.LH, c);
waveletTreeReconstruction(img, (SubbandSyn) sb.HH, c);
//Perform the 2D wavelet decomposition of the current subband
wavelet2DReconstruction(img, (SubbandSyn) sb, c);
}
}
}