예제 #1
0
 internal HuffTable(EmbedData d, int l)
 {
     this.dis = d;
     // Get table data from input stream
     this.len = 19 + GetTableData();
     SetSizeTable(); // Flow Chart C.1
     SetCodeTable(); // Flow Chart C.2
     SetOrderCodes(); // Flow Chart C.3
     SetDecoderTables(); // Generate decoder tables Flow Chart F.15
 }
예제 #2
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;
                    }
                }
            }
        }
예제 #3
0
 public void Compress(Stream embeddedData, String password)
 {
     this.embeddedData = new EmbedData(embeddedData);
     this.password = password;
     Compress();
 }