示例#1
0
        internal static void Decode(BitReservoir br, int table, out float x, out float y, out float v, out float w)
        {
            var val = DecodeSymbol(br, table);

            v = w = x = y = 0;

            if ((val & 0x8) != 0)
            {
                if (br.Get1Bit() == 1)
                {
                    v = -_floatLookup[1];
                }
                else
                {
                    v = _floatLookup[1];
                }
            }

            if ((val & 0x4) != 0)
            {
                if (br.Get1Bit() == 1)
                {
                    w = -_floatLookup[1];
                }
                else
                {
                    w = _floatLookup[1];
                }
            }

            if ((val & 0x2) != 0)
            {
                if (br.Get1Bit() == 1)
                {
                    x = -_floatLookup[1];
                }
                else
                {
                    x = _floatLookup[1];
                }
            }

            if ((val & 0x1) != 0)
            {
                if (br.Get1Bit() == 1)
                {
                    y = -_floatLookup[1];
                }
                else
                {
                    y = _floatLookup[1];
                }
            }
        }
示例#2
0
        internal static void Decode(BitReservoir br, int table, out float x, out float y)
        {
            if (table == 0 || table == 4 || table == 14)
            {
                x = y = 0;
            }
            else
            {
                var val = DecodeSymbol(br, table);

                var ix = val >> 4;
                var iy = val & 15;

                int linBits = LIN_BITS[table];
                if (linBits > 0 && ix == 15) ix += br.GetBits(linBits);
                if (ix != 0 && br.Get1Bit() != 0)
                {
                    x = -_floatLookup[ix];
                }
                else
                {
                    x = _floatLookup[ix];
                }

                if (linBits > 0 && iy == 15) iy += br.GetBits(linBits);
                if (iy != 0 && br.Get1Bit() != 0)
                {
                    y = -_floatLookup[iy];
                }
                else
                {
                    y = _floatLookup[iy];
                }
            }
        }