Sorry about those bugs - I realized I had the wrong formula
on saturday but didn't get to log in until now. 

Here's the reason for the ((1-fac)/(1+fac)) formula:
say we had x bits per channel.  The fixed bitrate formula is:

  mid = (1+fac)*x
  side= (1-fac)*x

So to keep the same proportion in the VBR code, since we dont know
x, but only the number of bits for the mid channel, we should use:

  side = ((1-fac)/(1+fac)) * mid

I also fixed that bug that Robert pointed out: the VBR code
would not work for mono input.  After sending this message
I'll upload a lame 3.27beta with these fixes.  


The next question is how should 'fac' be computed?  
Right now LAME uses:  

   fac = .33*(.5-ms_ener_ratio[gr])/.5;

ms_ener_ratio used to be the ratio of side channel energy to total
energy, so it would range from 0.0 to 0.35.  (values bigger than 0.35
will not use m/s stereo).  Now ms_ener_ratio is computed in a
different way, but scaled to have rougly the same meaning: 0 = very
little information in the side channel, .5= half the total information
is the side channel and dont use m/s stereo.  

I have no good reason for this formula - I comes from a crude frame by
frame tuning by comparing to the FhG encoder.  I think both George and
Robert pointed out that a mono signal (in a stereo input file) should
should allocate close to 0 bits for the side channel. However, take a
look at castanets.wav.  It is almost mono, with ms_ener_ratio as low
as .03, but FhG uses about a 66/33 split between mid and side
channels.  This is where the .33 comes from in the above formula.

If ms_ener_ratio=0, this means that both left and right channels
have identical masking thresholds, and it is possible that both
channels are different.  If you want to put in a true mono
detection type code, it should probably be based on a true
side-channel-energy/total-energy ratio?

I still cant do listening tests (problems with my home pc), but
it sounds like the #define RH VBR code is really shaping up and
we can get rid of the old code soon!

Mark

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to