Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: differences in flac encoding win32 vs. linux? (Read 2788 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

differences in flac encoding win32 vs. linux?

hi,

today i noticed something strange. the same .wav file encoded by the win32 binary is bigger than the one encoded by the linux binary. both binaries are from the flac homepage, no 3rd party compiles or self-compiled ones.

the output of metaflac --show-md5sum is identical and both files check ok. the files were created with the exact same options --best --verify --cuesheet=[...] so no difference in metadata size or padding.

the difference is 394667771 bytes (win32) vs. 394651091 bytes (linux) = 16680 bytes, so it's quite a difference imho.

what's the explanation for this?

edit: ideally, i'd expect both binaries to give bit-identical output, but since the actual sound data yields the same md5 checksum, i'm confident that there is no difference in the actual audio data. however, this makes a 16K difference even more confusing.

edit2: after some more testing: the p4-optimised win32 binary from http://www.rarewares.org/files/lossless/flac-1.1.2-P4.zip produces output bit-identical to the win32 binary from the flac homepage. furthermore, a self-compiled (from pkgsrc) binary for netbsd produces bit-identical output to the linux binary. must be some architectural difference between win32 and unix-like systems then?

differences in flac encoding win32 vs. linux?

Reply #1
Before making any conclusions, I'd try copying one flac to the other system and comparing file sizes.

Or if you have a md5sum program on each system, use that to verify the whole flac (not just the audio portion) rather than the file length.

differences in flac encoding win32 vs. linux?

Reply #2
Quote
Before making any conclusions, I'd try copying one flac to the other system and comparing file sizes.
please note that i'm not implying that flac doesn't treat my audio data right :)

but a (binary) file doesn't change its size by copying it from one computer to the other (not regarding text file transformation like cr+lf conversion between win32 and unix, but this is completely irrelevant here).

Quote
Or if you have a md5sum program on each system, use that to verify the whole flac (not just the audio portion) rather than the file length.
if the sizes differ, what's the point in hashing? a prerequisite of using hashes to compare data is that the data is of equal size to begin with. the flac files as a whole are definitely different. the audio data itself is not.

i'm more curious than worried, although i'd feel safer if i knew that code produced fixed results for given inputs, no matter where it's run. this is especially true for such a purist's topic like lossless audio. i, for one, feel a bit weird knowing that win32 binaries possibly include some "junk" that could very well be left out. you know, the usual perfectionist crap :)

however, maybe this does indeed hint to an issue with the code that could be improved. i'm going to try to find out *jumps into hex editor*

differences in flac encoding win32 vs. linux?

Reply #3
I can confirm what you saw.

With 1.1.2 Windows frontend and 1.1.2 NetBSD i386 pkgsrc, the maximum framesize is different:

Windows: 10410
NetBSD: 10405

Also, each seekpoint offset is slightly different. I don't have an explanation for this.

 

differences in flac encoding win32 vs. linux?

Reply #4
there are multiple code paths through the encoder; the ones that can make a difference are the floating point parts in LPC analysis.  there is a generic C one (which may differ compiler-to-compiler), and several assembly ones (altivec, mmx, 3dnow, sse, etc) that are selected at run-time and/or enabled/disabled at compile time.  definitely an sse binary will yield different FLACs than non-sse.  also other minor things like padding size can affect it.

nothing to worry about.

Josh