Hi,
I have a basic doubt here and it concerns programming.
I wrote a program that emulates JPEG compression. Now after performing Huffman compression, I get codes of variable lengths.
If I place them one after another, how is the decoder going to decode the resulting bitstream? How will it know where one code ends and the next one begins?
Eg: "a" is coded as 0101
"b" is coded as 11
So, "aba" = 0101110101.....right?
How is this taken care of? How will it know that the first 4 bits are "a" and the next two are "b" , etc?
One way I can think of is that, since each code is uniquely decodable, if i keep looking up a table after every bit i read .. I will know when I have read a code. But is there a better way to do this?
PS:In my program I just left shifted them and stuffed bits to make them all 16bits in length. SInce this was only for simulation, I didnt care much. But in terms of rate it was really bad.
Thanks !
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 1 of 1
Thread
Similar Threads
-
How to enable Packed bitstream
By john111 in forum Video ConversionReplies: 8Last Post: 4th Jan 2010, 14:17 -
adding packed bitstream to xvids
By pace508 in forum Newbie / General discussionsReplies: 6Last Post: 1st Jan 2009, 16:10 -
What is packet bitstream and what is it good for?
By chupacabra in forum Newbie / General discussionsReplies: 20Last Post: 25th Sep 2007, 08:13 -
Batch Unpacked (bitstream unpacking) ??
By params7 in forum Video ConversionReplies: 0Last Post: 6th Sep 2007, 09:48 -
BitStream Not Compliant with YAMB
By bidomo in forum DVD RippingReplies: 2Last Post: 9th Jul 2007, 23:56