[Ffmpeg-devel] ac3enc.c modifications

Rich Felker dalias
Thu May 19 21:13:20 CEST 2005


On Thu, May 19, 2005 at 12:30:32PM -0400, Justin Ruggles wrote:
> Simone Karin Lehmann wrote:
> > sample_t was intended to switch between doubles and integers at compile time, 
> > but I didn't finish to fully implement the integer code. This is why you get 
> > silence.
> 
> Oh, ok.  Now it makes sense.
> 
> 
> > ... but the calculations to get these values will be more accurate if you use 
> > doubles. In mdct() there are plenty of multiplications using  sin and cos 
> > factors. Only using integers will give some really great rounding errors. 
> > I've done a lot of testing to this. First I encoded a wav file only using 
> > integers, decoded it back to wav, took audicity to give me spectrum analysis. 
> > Second I did the same procedure with doubles.
> > The spectrum resulting out of the doubles encoding was more closely to 
> > original than only encoding in integer arithmetics.
> 
> I can see where that would work.  Since it uses summations, the rounding
> errors would just keep adding up.  And if you're going for accuracy over
> speed, using floating-point would help.  How does the spectrum vary
> between using floats vs. doubles?
> 
> I was going to suggest keeping mdct_coefs as int32 and just using
> doubles internally in the mdct, but the rematrixing would get a very
> slight accuracy gain with floating point as well.

Float should be removed entirely and replaced with 32bit int. There's
nowhere it makes any difference to quality and the latter is much
faster, and also has the benefit of being well-defined (float behavior
is somewhat implementation-defined and will not pass regression
tests).

Rich





More information about the ffmpeg-devel mailing list