Пример #1
0
        // Constructor Method
        public HuffmanDecode(Stream data)
        {
            size = (int)data.Length;
            dis = new EmbedData(data);
            // Parse out markers and header info
            bool cont = true;
            byte b;

            while (cont)
            {
                b = dis.Read();
                if (b == 255)
                {
                    b = dis.Read();
                    switch (b)
                    {
                        case 192:
                            SetSOF0();
                            break;
                        case 196:
                            SetDHT();
                            break;
                        case 219:
                            SetDQT();
                            break;
                        case 217:
                        case 218:
                            cont = false;
                            break;
                        case DRI:
                            SetDRI();
                            break;
                        default:
                            if (Array.IndexOf(APP, b) > -1)
                            {
                                dis.Seek(dis.ReadInt() - 2, SeekOrigin.Current);
                            }
                            break;
                    }
                }
            }
        }