CSJ2K.j2k.wavelet.analysis.ForwWTFull.wavelet2DDecomposition C# (CSharp) Method

wavelet2DDecomposition() private method

Performs the 2D forward wavelet transform on a subband of the initial band. This method will successively perform 1D filtering steps on all lines and then all columns of the subband. In this class only filters with floating point implementations can be used.
private wavelet2DDecomposition ( CSJ2K.j2k.image.DataBlk band, SubbandAn subband, int c ) : void
band CSJ2K.j2k.image.DataBlk The band containing the float data to decompose /// ///
subband SubbandAn The structure containing the coordinates of the subband /// in the whole band to decompose. /// ///
c int The index of the current component to decompose /// ///
return void
        private void wavelet2DDecomposition(DataBlk band, SubbandAn subband, int c)
        {
            int ulx, uly, w, h;
            int band_w, band_h;

            // If subband is empty (i.e. zero size) nothing to do
            if (subband.w == 0 || subband.h == 0)
            {
                return ;
            }

            ulx = subband.ulx;
            uly = subband.uly;
            w = subband.w;
            h = subband.h;
            band_w = getTileCompWidth(tIdx, c);
            band_h = getTileCompHeight(tIdx, c);

            if (intData)
            {
                //Perform the decompositions if the filter is implemented with an
                //integer arithmetic.
                int i, j;
                int offset;
                int[] tmpVector = new int[System.Math.Max(w, h)];
                int[] data = ((DataBlkInt) band).DataInt;

                //Perform the vertical decomposition
                if (subband.ulcy % 2 == 0)
                {
                    // Even start index => use LPF
                    for (j = 0; j < w; j++)
                    {
                        offset = uly * band_w + ulx + j;
                        for (i = 0; i < h; i++)
                            tmpVector[i] = data[offset + (i * band_w)];
                        subband.vFilter.analyze_lpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + ((h + 1) / 2) * band_w, band_w);
                    }
                }
                else
                {
                    // Odd start index => use HPF
                    for (j = 0; j < w; j++)
                    {
                        offset = uly * band_w + ulx + j;
                        for (i = 0; i < h; i++)
                            tmpVector[i] = data[offset + (i * band_w)];
                        subband.vFilter.analyze_hpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + (h / 2) * band_w, band_w);
                    }
                }

                //Perform the horizontal decomposition.
                if (subband.ulcx % 2 == 0)
                {
                    // Even start index => use LPF
                    for (i = 0; i < h; i++)
                    {
                        offset = (uly + i) * band_w + ulx;
                        for (j = 0; j < w; j++)
                            tmpVector[j] = data[offset + j];
                        subband.hFilter.analyze_lpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + (w + 1) / 2, 1);
                    }
                }
                else
                {
                    // Odd start index => use HPF
                    for (i = 0; i < h; i++)
                    {
                        offset = (uly + i) * band_w + ulx;
                        for (j = 0; j < w; j++)
                            tmpVector[j] = data[offset + j];
                        subband.hFilter.analyze_hpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + w / 2, 1);
                    }
                }
            }
            else
            {
                //Perform the decompositions if the filter is implemented with a
                //float arithmetic.
                int i, j;
                int offset;
                float[] tmpVector = new float[System.Math.Max(w, h)];
                float[] data = ((DataBlkFloat) band).DataFloat;

                //Perform the vertical decomposition.
                if (subband.ulcy % 2 == 0)
                {
                    // Even start index => use LPF
                    for (j = 0; j < w; j++)
                    {
                        offset = uly * band_w + ulx + j;
                        for (i = 0; i < h; i++)
                            tmpVector[i] = data[offset + (i * band_w)];
                        subband.vFilter.analyze_lpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + ((h + 1) / 2) * band_w, band_w);
                    }
                }
                else
                {
                    // Odd start index => use HPF
                    for (j = 0; j < w; j++)
                    {
                        offset = uly * band_w + ulx + j;
                        for (i = 0; i < h; i++)
                            tmpVector[i] = data[offset + (i * band_w)];
                        subband.vFilter.analyze_hpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + (h / 2) * band_w, band_w);
                    }
                }
                //Perform the horizontal decomposition.
                if (subband.ulcx % 2 == 0)
                {
                    // Even start index => use LPF
                    for (i = 0; i < h; i++)
                    {
                        offset = (uly + i) * band_w + ulx;
                        for (j = 0; j < w; j++)
                            tmpVector[j] = data[offset + j];
                        subband.hFilter.analyze_lpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + (w + 1) / 2, 1);
                    }
                }
                else
                {
                    // Odd start index => use HPF
                    for (i = 0; i < h; i++)
                    {
                        offset = (uly + i) * band_w + ulx;
                        for (j = 0; j < w; j++)
                            tmpVector[j] = data[offset + j];
                        subband.hFilter.analyze_hpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + w / 2, 1);
                    }
                }
            }
        }