[flac-dev] [PATCH] Re: Bug in FLAC or in GCC or somewhere else?

lvqcl lvqcl.mail at gmail.com
Sun Jun 1 03:58:43 PDT 2014


lvqcl wrote:

> I noticed that 32-bit flac (from git) compiled with GCC 4.8.3 or 4.9.0
> calculates incorrect ReplayGain values. The most common value it produces
> is -55.17 dB.

It seems that it's a bug in GCC: it cannot correctly calculate the value
of 'elems * (1. - RMS_PERCENTILE)' in the line

     upper = (Int32_t) ceil (elems * (1. - RMS_PERCENTILE));

Since elems * (1. - RMS_PERCENTILE) == elems * (1. - 0.95) ==
  == elems * 0.05 == elems / 20.0   it is possible to replace ceil(...)
with (elems / 20 + (elems % 20) ? 1 : 0).

Patch attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rg_analysis.patch
Type: application/octet-stream
Size: 749 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20140601/67c1035e/attachment.obj 


More information about the flac-dev mailing list