[mythtv] [PATCH] The chipmunks are back

Jim Radford radford+myth at blackbean.org
Fri Oct 10 11:30:35 EDT 2003


On Fri, Oct 10, 2003 at 12:44:33PM -0400, Isaac Richards wrote:
> Well, since the driver is returning the exact sampling rate instead
> of an approximation, that doesn't really count as 'broken', I don't
> think.

Agreed.

> Main problem is lame only accepts the standard frequencies..

Yep.  Actually, I think this might be a restriction of mpeg itself
(three bits is enough to represent all frequencies, right?;).

> Shouldn't be too hard for someone to revert the code in NVR.cpp 

I even sent a patch for this. :-)

> and add some stuff to clamp the returned value from the ioctl to
> normal values.

Given this line from lame_init_params()

  gfp->out_samplerate = map2MP3Frequency( (int)( 0.97 * gfp->in_samplerate ) ); /* round up with a margin of 3% */

I'd say the "round up" part is the bug (in lame, not myth) and should
be fixed here:

  int map2MP3Frequency(int freq)
  {
      if (freq <=  8000) return  8000;
      if (freq <= 11025) return 11025;
      if (freq <= 12000) return 12000;
      if (freq <= 16000) return 16000;
      if (freq <= 22050) return 22050;
      if (freq <= 24000) return 24000;
      if (freq <= 32000) return 32000;
      if (freq <= 44100) return 44100;
      
      return 48000;
  }

I'll leave the details to someone with the hardware to test it on.

-Jim


More information about the mythtv-dev mailing list