コード例 #1
0
        /// <summary> Splits the current subband in its four subbands. It changes the status
        /// of this element (from a leaf to a node, and sets the filters), creates
        /// the childs and initializes them. An IllegalArgumentException is thrown
        /// if this subband is not a leaf.
        ///
        /// <p>It uses the initChilds() method to initialize the childs.</p>
        ///
        /// </summary>
        /// <param name="hfilter">The horizontal wavelet filter used to decompose this
        /// subband. It has to be a AnWTFilter object.
        ///
        /// </param>
        /// <param name="vfilter">The vertical wavelet filter used to decompose this
        /// subband. It has to be a AnWTFilter object.
        ///
        /// </param>
        /// <returns> A reference to the LL leaf (subb_LL).
        ///
        /// </returns>
        /// <seealso cref="Subband.initChilds">
        ///
        /// </seealso>
        protected internal override Subband split(WaveletFilter hfilter, WaveletFilter vfilter)
        {
            // Test that this is a node
            if (isNode)
            {
                throw new System.ArgumentException();
            }

            // Modify this element into a node and set the filters
            isNode       = true;
            this.hFilter = (AnWTFilter)hfilter;
            this.vFilter = (AnWTFilter)vfilter;

            // Create childs
            subb_LL = new SubbandAn();
            subb_LH = new SubbandAn();
            subb_HL = new SubbandAn();
            subb_HH = new SubbandAn();

            // Assign parent
            subb_LL.parentband = this;
            subb_HL.parentband = this;
            subb_LH.parentband = this;
            subb_HH.parentband = this;

            // Initialize childs
            initChilds();

            // Return reference to LL subband
            return(subb_LL);
        }
コード例 #2
0
        /// <summary> Calculates the parameters of the SubbandAn objects that depend on the
        /// Quantizer. The 'stepWMSE' field is calculated for each subband which is
        /// a leaf in the tree rooted at 'sb', for the specified component. The
        /// subband tree 'sb' must be the one for the component 'n'.
        ///
        /// </summary>
        /// <param name="sb">The root of the subband tree.
        ///
        /// </param>
        /// <param name="c">The component index
        ///
        /// </param>
        /// <seealso cref="SubbandAn.stepWMSE">
        ///
        /// </seealso>
        protected internal override void  calcSbParams(SubbandAn sb, int c)
        {
            float baseStep;

            if (sb.stepWMSE > 0f)
            {
                // parameters already calculated
                return;
            }
            if (!sb.isNode)
            {
                if (isReversible(tIdx, c))
                {
                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                    sb.stepWMSE = (float)System.Math.Pow(2, -(src.getNomRangeBits(c) << 1)) * sb.l2Norm * sb.l2Norm;
                }
                else
                {
                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Float.floatValue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                    baseStep = (float)((System.Single)qsss.getTileCompVal(tIdx, c));
                    if (isDerived(tIdx, c))
                    {
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        sb.stepWMSE = baseStep * baseStep * (float)System.Math.Pow(2, (sb.anGainExp - sb.level) << 1) * sb.l2Norm * sb.l2Norm;
                    }
                    else
                    {
                        sb.stepWMSE = baseStep * baseStep;
                    }
                }
            }
            else
            {
                calcSbParams((SubbandAn)sb.LL, c);
                calcSbParams((SubbandAn)sb.HL, c);
                calcSbParams((SubbandAn)sb.LH, c);
                calcSbParams((SubbandAn)sb.HH, c);
                sb.stepWMSE = 1f;                 // Signal that we already calculated this branch
            }
        }
コード例 #3
0
 /// <summary> Calculates the parameters of the SubbandAn objects that depend on the
 /// Quantizer. The 'stepWMSE' field is calculated for each subband which is
 /// a leaf in the tree rooted at 'sb', for the specified component. The
 /// subband tree 'sb' must be the one for the component 'n'.
 ///
 /// </summary>
 /// <param name="sb">The root of the subband tree.
 ///
 /// </param>
 /// <param name="n">The component index.
 ///
 /// </param>
 /// <seealso cref="SubbandAn.stepWMSE">
 ///
 /// </seealso>
 protected internal abstract void calcSbParams(SubbandAn sb, int n);