CSJ2K.j2k.wavelet.Subband.initChilds C# (CSharp) Method

initChilds() protected method

Initializes the childs of this node with the correct values. The sizes of the child subbands are calculated by taking into account the position of the subband in the canvas.

For the analysis subband gain calculation it is assumed that analysis filters are normalized with a DC gain of 1 and a Nyquist gain of 2.

protected initChilds ( ) : void
return void
        protected internal virtual void initChilds()
        {
            Subband subb_LL = LL;
            Subband subb_HL = HL;
            Subband subb_LH = LH;
            Subband subb_HH = HH;

            // LL subband
            subb_LL.level = level + 1;
            subb_LL.ulcx = (ulcx + 1) >> 1;
            subb_LL.ulcy = (ulcy + 1) >> 1;
            subb_LL.ulx = ulx;
            subb_LL.uly = uly;
            subb_LL.w = ((ulcx + w + 1) >> 1) - subb_LL.ulcx;
            subb_LL.h = ((ulcy + h + 1) >> 1) - subb_LL.ulcy;
            // If this subband in in the all LL path (i.e. it's global orientation
            // is LL) then child LL band contributes to a lower resolution level.
            subb_LL.resLvl = (orientation == WT_ORIENT_LL)?resLvl - 1:resLvl;
            subb_LL.anGainExp = anGainExp;
            subb_LL.sbandIdx = (sbandIdx << 2);
            // HL subband
            subb_HL.orientation = WT_ORIENT_HL;
            subb_HL.level = subb_LL.level;
            subb_HL.ulcx = ulcx >> 1;
            subb_HL.ulcy = subb_LL.ulcy;
            subb_HL.ulx = ulx + subb_LL.w;
            subb_HL.uly = uly;
            subb_HL.w = ((ulcx + w) >> 1) - subb_HL.ulcx;
            subb_HL.h = subb_LL.h;
            subb_HL.resLvl = resLvl;
            subb_HL.anGainExp = anGainExp + 1;
            subb_HL.sbandIdx = (sbandIdx << 2) + 1;
            // LH subband
            subb_LH.orientation = WT_ORIENT_LH;
            subb_LH.level = subb_LL.level;
            subb_LH.ulcx = subb_LL.ulcx;
            subb_LH.ulcy = ulcy >> 1;
            subb_LH.ulx = ulx;
            subb_LH.uly = uly + subb_LL.h;
            subb_LH.w = subb_LL.w;
            subb_LH.h = ((ulcy + h) >> 1) - subb_LH.ulcy;
            subb_LH.resLvl = resLvl;
            subb_LH.anGainExp = anGainExp + 1;
            subb_LH.sbandIdx = (sbandIdx << 2) + 2;
            // HH subband
            subb_HH.orientation = WT_ORIENT_HH;
            subb_HH.level = subb_LL.level;
            subb_HH.ulcx = subb_HL.ulcx;
            subb_HH.ulcy = subb_LH.ulcy;
            subb_HH.ulx = subb_HL.ulx;
            subb_HH.uly = subb_LH.uly;
            subb_HH.w = subb_HL.w;
            subb_HH.h = subb_LH.h;
            subb_HH.resLvl = resLvl;
            subb_HH.anGainExp = anGainExp + 2;
            subb_HH.sbandIdx = (sbandIdx << 2) + 3;
        }