How does the Bit Reservoir work?
Reply #5 – 2006-03-09 06:03:24
Thank you for the in-depth info. As for the frame length and offset information, where is that stored? A web search yields few usable results... AFAIK, each frame has a 32-bit header, followed by optional CRC and the audio data... I've also heard you and others mentioning "side info". What exactly do you mean by that? Is that related to the two channels, or is it just a confusing name for supplemental information? [a href="index.php?act=findpost&pid=370314"][{POST_SNAPBACK}][/a] The "side info" is stored right after the header (and after the CRC, if present). It's just more meta-data like the header. It is usually 32 bytes long, as opposed to the 32 bit header. It contains information like the scaling (which mp3gain changes) and also the location and length of the frame's data. The frame data length is actually divided into 4 parts (for most MP3s) Each frame contains two "granules" (like sub-frames) and two channels, for a total of 4 "parts" of a frame. The side info also says whether the granules use long blocks or short blocks. There is some more stuff in there, but I don't know what the rest does.If I understand correctly, mp3 trimmers work by temporarily restructuring a file so that the bit reservoir eliminated, and then perform cutting on potentially invalid, but self-contained frames. Then the file can be collapsed losslessly again, can it not? Some mp3 trimmers just cut along frame boundaries, causing a bit of bad data. The good ones, however, work similarly to how you described: The frame sizes are changed so that no frame after the cut has data located before the cut (i.e. the bit reservoir is made 0 at the cut) then the parts are separated. [note: when I say "for most mp3s", I mean that it holds for 2-channel audio at 32000, 44100, or 48000 Hz]