CSJ2K.j2k.entropy.encoder.EBCOTRateAllocator.getLimitedSIndexFromSlope C# (CSharp) 메소드

getLimitedSIndexFromSlope() 개인적인 정적인 메소드

Returns the index of a slope for the summary table, limiting to the admissible values. The index is calculated as RD_SUMMARY_OFF plus the maximum exponent, base 2, that yields a value not larger than the slope itself.

If the value to return is lower than 0, 0 is returned. If it is larger than the maximum table index, then the maximum is returned.

private static getLimitedSIndexFromSlope ( float slope ) : int
slope float The slope value /// ///
리턴 int
        private static int getLimitedSIndexFromSlope(float slope)
        {
            int idx;

            //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'"
            idx = (int) System.Math.Floor(System.Math.Log(slope) / LOG2) + RD_SUMMARY_OFF;

            if (idx < 0)
            {
                return 0;
            }
            else if (idx >= RD_SUMMARY_SIZE)
            {
                return RD_SUMMARY_SIZE - 1;
            }
            else
            {
                return idx;
            }
        }