CSJ2K.j2k.wavelet.synthesis.InvWTFull.waveletTreeReconstruction C# (CSharp) Method

waveletTreeReconstruction() private method

Performs the inverse wavelet transform on the whole component. It iteratively reconstructs the subbands from leaves up to the root node. This method is recursive, the first call to it the 'sb' must be the root of the subband tree. The method will then process the entire subband tree by calling itslef recursively.
private waveletTreeReconstruction ( CSJ2K.j2k.image.DataBlk img, CSJ2K.j2k.wavelet.synthesis.SubbandSyn sb, int c ) : void
img CSJ2K.j2k.image.DataBlk The buffer for the image/wavelet data. /// ///
sb CSJ2K.j2k.wavelet.synthesis.SubbandSyn The subband to reconstruct. /// ///
c int The index of the component to reconstruct /// ///
return void
        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);
                }
            }
        }