Exemplo n.º 1
0
        private string GetBinaryData(JPEGFileHandler extractor)
        {
            string        data     = extractor.CompressedImage;
            StringBuilder sBuilder = new StringBuilder();

            for (int i = 0; i < data.Length; i++)
            {
                sBuilder.Append(Convert.ToString(Convert.ToInt32(data[i].ToString(), 16), 2).PadLeft(4, '0'));
            }

            return(sBuilder.ToString());
        }
Exemplo n.º 2
0
        public EntropyCoder(string path)
        {
            HuffmanTrees      = new List <HuffmanTree>();
            EntropyComponents = new List <EntropyComponent>();
            FileHandler       = new JPEGFileHandler(path);

            HuffmanTrees = BuildHuffmanTrees(FileHandler.DHT);
            foreach (HuffmanTree huffmanTree in HuffmanTrees)
            {
                Console.WriteLine("Huffmantree");
                foreach (string s in huffmanTree.PrintTree())
                {
                    Console.WriteLine(s);
                }
            }
        }