HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - Tech => Topic started by: Ravi on 2009-06-10 19:37:07

Title: MP3 main data pointer:
Post by: Ravi on 2009-06-10 19:37:07
Hi All,

        I am facing a new problem while decoding the Mp3 frames. My main data pointer of few frames is pointing to back in between the "header+side info" of the previous frames. for example:

  Lets assume a frame starts at byte 4086 of Mp3 file.

    So the header of the frame will end at byte  (4086 + 4 =) 4090
  and if side info is 32 bytes the side info will end at (4090 + 32 =) 4122.
  So the header + side info for this frame lies between 4086 to 4122
 
  Assume that the length of the frame is 418 bytes. So the next frame will start from (4086 + 418 =) 4514
  Now in the new frame starting from 4514th byte the main data begin value indicated by first 9 bits of side info is 410.
  This means that the main data will start from the byte number 4514 - 410 = 4104th byte which is in between 4086 to 4122( the range of header + side info of previous frame)

Is there a possibility of such case? (I think answer of this question is yes as I am facing it in a file).
Another question is that if such case can happen then how to deal with it?

Thanks in Advance
  -R/\\/I-
Title: MP3 main data pointer:
Post by: Ravi on 2009-06-10 19:41:34
There is one calculation wrong above so I added this as a reply to correct it. All correction are marked by *.

I am facing a new problem while decoding the Mp3 frames. My main data pointer of few frames is pointing to back in between the "header+side info" of the previous frames. for example:

Lets assume a frame starts at byte 4086 of Mp3 file.

So the header of the frame will end at byte (4086 + 4 =) 4090
and if side info is 32 bytes the side info will end at (4090 + 32 =) 4122.
So the header + side info for this frame lies between 4086 to 4122

Assume that the length of the frame is 418 bytes. So the next frame will start from (4086 + 418 =) 4504*
Now in the new frame starting from 4504th byte the main data begin value indicated by first 9 bits of side info is 410.
This means that the main data will start from the byte number 4504* - 410 = 4094*th byte which is in between 4086 to 4122( the range of header + side info of previous frame)

Is there a possibility of such case? (I think answer of this question is yes as I am facing it in a file).
Another question is that if such case can happen then how to deal with it?

Thanks in Advance
-R/\\/I-
Title: MP3 main data pointer:
Post by: SebastianG on 2009-06-16 19:18:12
I am facing a new problem while decoding the Mp3 frames. My main data pointer of few frames is pointing to back in between the "header+side info" of the previous frames.


You are supposed to buffer the main data bits separately from the header and the side info block. Create a FIFO of size 511+max_frame_size and fill it with main data bits only. Use that buffer for decoding the main data bits.

Cheers!
SG