Help - Search - Members - Calendar
Full Version: Coefficient & sample size
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
Sebastian Mares
Hello!

I am having some problems finding the correct values for some calculations. For the frame size, I use the following formula:

CODE

Frame Number = Audio Size / (Coefficient * Bit Rate * 1000 / Sampling Rate + Padding)


Here is a table with the coefficient values I use:

QUOTE
MPEG 1 Layer 1 = 48
MPEG 1 Layer 2 = 144
MPEG 1 Layer 3 = 144

MPEG 2(.5) Layer 1 = 24
MPEG 2(.5) Layer 2 = 144
MPEG 2(.5) Layer 3 = 72


For the duration, here is my formula:

CODE
Duration = Frame Number * Sample Size / Sampling Rate


And here is my table with the sample sizes:

QUOTE
MPEG 1 Layer 1 = 384
MPEG 1 Layer 2 = 1152
MPEG 1 Layer 3 = 1152

MPEG 2(.5) Layer 1 = 192
MPEG 2(.5) Layer 2 = 1152
MPEG 2(.5) Layer 3 = 576


In "amiga_mpega.c" however, I found the following:

CODE

static const int smpls[2][4]={
/* Layer x  I   II   III */
       {0,384,1152,1152}, /* MPEG-1     */
       {0,384,1152, 576}  /* MPEG-2(.5) */
};


As you can see, the MPEG 2(.5) Layer 1 value is 384 and not 192 as I suppose.

Could someone please tell me what the right values are?

Regards,
Sebastian Mares
Sebastian Mares
One more thing... Do you know if the Xing / VBRI "size" information counts the Xing / VBRI tag itself?
smack
I have no definitve answer to your questions. Did you have a look at different decoders to see how they handle that? I can recommend amp11 by Niklas Beisert, the sources are quite easy to understand and have been very helpful for me when I wrote my own MPEG audio decoder some years ago.

Decoding engines source codes @ mp3-tech.org
Amp11Lib (sources and binaries)


Edit: of course you should also look at the MAD sources, since it is considered "the best" decoder by a lot of people.
Sebastian Mares
The problem is that most decoders I tried can only handle MP2 and MP3, not MP1.

I will have a look at the pages you posted. smile.gif
Sebastian Mares
OK, it seems that for Layer 1, the coefficient is 48 in both MPEG versions and the sample size is 384, again, in both versions.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.