Example #1
0
File: LZSS.cs Project: kgober/FSX
            private Int32 GetSymbol(BitReaderB reader)
            {
                Int32 code = 0, len = 0;
                Int32 p = T - 1;            // start at root

                while (mTree[p].L != -1)
                {
                    Int32 bit = reader.Next(1);
                    if (bit == -1)
                    {
                        return(-1);
                    }
                    p      = (bit == 0) ? mTree[p].L : mTree[p].R;
                    code <<= 1;
                    code  += bit;
                    len++;
                }
                return(mTree[p].R);
            }
Example #2
0
File: LZSS.cs Project: kgober/FSX
            private Int32 GetPosition(BitReaderB reader)
            {
                switch (reader.Next(4))
                {
                case 0: return(0x000 | reader.Next(5));

                case 1: return(0x020 | reader.Next(5));

                case 2: return(0x040 | reader.Next(6));

                case 3: return(0x080 | reader.Next(6));

                case 4: return(0x0c0 | reader.Next(6));

                case 5: return(0x100 | reader.Next(7));

                case 6: return(0x180 | reader.Next(7));

                case 7: return(0x200 | reader.Next(7));

                case 8: return(0x280 | reader.Next(7));

                case 9: return(0x300 | reader.Next(8));

                case 10: return(0x400 | reader.Next(8));

                case 11: return(0x500 | reader.Next(8));

                case 12: return(0x600 | reader.Next(9));

                case 13: return(0x800 | reader.Next(9));

                case 14: return(0xa00 | reader.Next(9));

                case 15: return(0xc00 | reader.Next(10));
                }
                return(-1);
            }