The JPEGHuffmanTable class represents a Huffman table read from a JPEG image file. The standard JPEG AC and DC chrominance and luminance values are provided as static fields.
        internal HuffmanTable(JpegHuffmanTable table)
        {
            if (table != null)
            {
                huffval = table.Values;
                bits = table.Lengths;

                GenerateSizeTable();
                GenerateCodeTable();
                GenerateDecoderTables();
            }
            else
            {
                // Encode initialization

                bitsList = new List<short[]>();
                bitsList.Add(JpegHuffmanTable.StdDCLuminance.Lengths);
                bitsList.Add(JpegHuffmanTable.StdACLuminance.Lengths);
                bitsList.Add(JpegHuffmanTable.StdDCChrominance.Lengths);
                bitsList.Add(JpegHuffmanTable.StdACChrominance.Lengths);

                val = new List<short[]>();
                val.Add(JpegHuffmanTable.StdDCLuminance.Values);
                val.Add(JpegHuffmanTable.StdACLuminance.Values);
                val.Add(JpegHuffmanTable.StdDCChrominance.Values);
                val.Add(JpegHuffmanTable.StdACChrominance.Values);

                initHuf();
            }
        }
Esempio n. 2
0
        internal HuffmanTable(JpegHuffmanTable table)
        {
            if (table != null)
            {
                huffval = table.Values;
                bits    = table.Lengths;

                GenerateSizeTable();
                GenerateCodeTable();
                GenerateDecoderTables();
            }
            else
            {
                // Encode initialization

                bitsList = new List <short[]>();
                bitsList.Add(JpegHuffmanTable.StdDCLuminance.Lengths);
                bitsList.Add(JpegHuffmanTable.StdACLuminance.Lengths);
                bitsList.Add(JpegHuffmanTable.StdDCChrominance.Lengths);
                bitsList.Add(JpegHuffmanTable.StdACChrominance.Lengths);

                val = new List <short[]>();
                val.Add(JpegHuffmanTable.StdDCLuminance.Values);
                val.Add(JpegHuffmanTable.StdACLuminance.Values);
                val.Add(JpegHuffmanTable.StdDCChrominance.Values);
                val.Add(JpegHuffmanTable.StdACChrominance.Values);

                initHuf();
            }
        }
Esempio n. 3
0
 internal HuffmanTable(JpegHuffmanTable table)
 {
     if (table != null)
     {
         this.huffval = table.Values;
         this.bits = table.Lengths;
         this.GenerateSizeTable();
         this.GenerateCodeTable();
         this.GenerateDecoderTables();
     }
     else
     {
         this.bitsList = new List<short[]>();
         this.bitsList.Add(JpegHuffmanTable.StdDCLuminance.Lengths);
         this.bitsList.Add(JpegHuffmanTable.StdACLuminance.Lengths);
         this.bitsList.Add(JpegHuffmanTable.StdDCChrominance.Lengths);
         this.bitsList.Add(JpegHuffmanTable.StdACChrominance.Lengths);
         this.val = new List<short[]>();
         this.val.Add(JpegHuffmanTable.StdDCLuminance.Values);
         this.val.Add(JpegHuffmanTable.StdACLuminance.Values);
         this.val.Add(JpegHuffmanTable.StdDCChrominance.Values);
         this.val.Add(JpegHuffmanTable.StdACChrominance.Values);
         this.initHuf();
     }
 }
Esempio n. 4
0
 internal HuffmanTable(JpegHuffmanTable table)
 {
     if (table != null)
     {
         this.huffval = table.Values;
         this.bits    = table.Lengths;
         this.GenerateSizeTable();
         this.GenerateCodeTable();
         this.GenerateDecoderTables();
     }
     else
     {
         this.bitsList = new List <short[]>();
         this.bitsList.Add(JpegHuffmanTable.StdDCLuminance.Lengths);
         this.bitsList.Add(JpegHuffmanTable.StdACLuminance.Lengths);
         this.bitsList.Add(JpegHuffmanTable.StdDCChrominance.Lengths);
         this.bitsList.Add(JpegHuffmanTable.StdACChrominance.Lengths);
         this.val = new List <short[]>();
         this.val.Add(JpegHuffmanTable.StdDCLuminance.Values);
         this.val.Add(JpegHuffmanTable.StdACLuminance.Values);
         this.val.Add(JpegHuffmanTable.StdDCChrominance.Values);
         this.val.Add(JpegHuffmanTable.StdACChrominance.Values);
         this.initHuf();
     }
 }
Esempio n. 5
0
        //private int mcus_per_row(JpegComponent c)
        //{
        //    return (((((this.Width * c.factorH) + (this.Scan.MaxH - 1)) / this.Scan.MaxH) + 7) / 8);
        //}

        public void setHuffmanTables(byte componentID, JpegHuffmanTable ACTable, JpegHuffmanTable DCTable)
        {
            JpegComponent componentById = this.Scan.GetComponentById(componentID);
            if (DCTable != null)
            {
                componentById.setDCTable(DCTable);
            }
            if (ACTable != null)
            {
                componentById.setACTable(ACTable);
            }
        }
Esempio n. 6
0
 public void setDCTable(JpegHuffmanTable table)
 {
     this.DCTable = new HuffmanTable(table);
 }