Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: mp3 decoding (Read 2167 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

mp3 decoding

I am developing an mp3_2_wav converter.
while decoding granules, I am frequently getting 2-3 bits unused from what the corresponding value of part2_3_length for that granule is.
Is this normal?
For example if part2_3_length = 607, only 605 or 604 values will be used in huffman codes, the rest(2 or 3 bits) do not form any valid huffman code.
Can sombody let me know if this is normal? or there is a problem in my decoding?
Please help.
Kr,
Aviral

 

mp3 decoding

Reply #1
Quote
I am developing an mp3_2_wav converter.
while decoding granules, I am frequently getting 2-3 bits unused from what the corresponding value of part2_3_length for that granule is.
Is this normal?
For example if part2_3_length = 607, only 605 or 604 values will be used in huffman codes, the rest(2 or 3 bits) do not form any valid huffman code.
Can sombody let me know if this is normal? or there is a problem in my decoding?
Please help.
Kr,
Aviral
[a href="index.php?act=findpost&pid=251644"][{POST_SNAPBACK}][/a]


Since no-body has answered this question, and now that I have found the answer myself, I will mysef answer it, so that someone else may benifit form it in future.
Yes it is normal to get 2-3 bits unused from part2_3_length number of bits. These remaining bits may not form a huffman code, or, sometimes, they may be insufficient number of bits to fill in all the 'sign' bits of the huffman code just read. For example if the expected number of sign bits are 4, and the remaining no of part2_3_length bits is less than 4. In both the cases, ISO dist10 code, reads the remaining bits from the next 'part2_3_length'  and then make out a huffman code or the sign bits. So some of the bits from the part2_3_length of next granule are thus common to the current granule as well, as per the working of the ISO dist10 code. That is how it works!
Kr,
Aviral MIttal.