[Ffmpeg-devel] GCC optimizations

Arpi arpi
Sun May 28 23:53:13 CEST 2006


Hi,

> >>While working on the FLAC encoder, I have come across a problem I've
> >>never encountered.  I am getting completely different results using gcc
> >>with optimization vs. without optimization.  Using -O0 gives me good
> >>results, but using -O1 to -O3 gives bad (but still valid) results.
> > 
> > 
> > You mean that the performance of you code decrease as you increase the
> > optimization level? This seems odd. -O1, -O2, -Os should always be
> > better than -O0 (which is pretty much like macro-expand).
> > 
> 
> Actually, it's not the performance that's the issue.  I get different
> output from the encoder.  File sizes and contents are different.

I guess you're using floating point functions/variables...
gcc does quite messy tricks optimizing fp code, and the result may
be different from unoptimized fpu code, but still valid (less
accurate, but still inside the IEEE/C standard limits)

see also -fast-math option of gcc...

A'rpi




More information about the ffmpeg-devel mailing list