#409 FLAC encoder output differs between MinGW/Win32 and Linux

1.3.1
open
Erik
5
2014-08-15
2014-02-16
No

Hello,

output data of flac encoder is different when compiled on Win32 or on Linux. There is no loss of data, decoding back results in the same original data, only the .flac files are not binary identical. (Btw. is it problem at all? Maybe the both different versions of flac files are "within specifications"...?)

Interesting thing: Win64, Linux 32-bit, and Linux 64-bit produces the same results, only the Win32 platform produces different .flac files:

Linux 32-bit == Linux 64-bit == MinGW Win64 != MinGW Win32

When using --compression-level-2 and below (-1 and -0), or when using --max-lpc-order=1 and bellow, the produced flac files are identical on all tested platforms.

Tested on versions (the behaviour is the same):
- 1.3.0
- latest git (2014-02-03/4be8ed8)

OS: Fedora 20 (both 32-bit, 64-bit), flac.exe launched under wine (I could try later directly on M$ Windows if needed)

Example, where the two flac files are identical:
http://scientific.zcu.cz/fedora/mingw-flac-1.3.0-1/tests/linux/l1.flac
http://scientific.zcu.cz/fedora/mingw-flac-1.3.0-1/tests/win32/l1.flac
Command:
flac --max-lpc-order=1 -o l1.flac MarketFull1.wav

Example, where the two flac files are different:
http://scientific.zcu.cz/fedora/mingw-flac-1.3.0-1/tests/linux/l2.flac
http://scientific.zcu.cz/fedora/mingw-flac-1.3.0-1/tests/win32/l2.flac
Command:
flac --max-lpc-order=2 -o l1.flac MarketFull1.wav

Original wave (from lincity-ng):
http://scientific.zcu.cz/fedora/mingw-flac-1.3.0-1/tests/MarketFull1.wav

Discussion

<< < 1 2 (Page 2 of 2)
  • Erik
    Erik
    2014-03-18

    Oliver,

    On the gcc bugtracker, you wrote:

    Changing

    autoc[coeff] += d * data[sample+coeff];

    to

    FLAC__real tmp = d * data[sample+coeff];
    autoc[coeff] += tmp;

    also provides the same results with 32-bit as 64-bit does.

    What file does that apply to?

     
    • That's in FLAC__lpc_compute_autocorrelation() in lpc.c from 1.2.1. I added the patch as attachment.

      As I said I have some changes to review, test and submit (there are already some other reports).

       
      Attachments
  • Erik
    Erik
    2014-03-21

    • status: open --> closed-fixed
    • assigned_to: Erik
     
  • Erik
    Erik
    2014-03-21

    Fixed in:

    commit 70b078cfd5f9d4b0692c33f018cac3c652b14f90
    Author: Erik de Castro Lopo <erikd@mega-nerd.com>
    Date:   Fri Mar 21 19:25:55 2014 +1100
    
    Attempt to fix differences between x86 FPU and SSE calculations.
    
     
  • Thanks - but keep in mind, that it will only fix it for unoptimized builds across toolchains. As soon you optimize the code you will get different results again as per GCC bug report.

     
  • Erik
    Erik
    2014-03-22

    As discussed on the xiph-dev mailing list, the patch that was applied to fix this doesn't have the desired effect with all compilers/platfroms.

    I will be reverting this patch unless someone comes up with a very good reason not to.

     
  • Erik
    Erik
    2014-03-22

    • status: closed-fixed --> open
     
<< < 1 2 (Page 2 of 2)