HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: mavere on 2013-01-04 23:43:34

Title: Bit-perfect AAC/MP3/etc decoding?
Post by: mavere on 2013-01-04 23:43:34
Sorry if this is easily answered elsewhere.

My question is that in a comparison of lossy-format decoders between, let's say, iTunes and Foobar and Winamp, will the output (edit: of a single source file) vary between decoding implementations?

Or is it that once a decoder follows a specified format, all output is equal assuming there are no bugs?
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: DVDdoug on 2013-01-05 00:00:01
Unlike encoding, I believe all decoders are supposed to be the same.

The decoder has a lot simpler task of decoding & reconstructing a wavefrom from whatever data is present.  The encoder has to decide what data to throw-away.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: db1989 on 2013-01-05 00:14:17
Quote
Unlike encoding, I believe all decoders are supposed to be the same.
Within some aurally insignificant reference range. Beyond that, I don’t think differences are uncommon, albeit slight.

Decodes can differ due to differences in rounding between CPUs, programming implementations, dither, etc.

Will the outputs be equal? Perhaps not. Does it matter? Not unless something is broken.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: saratoga on 2013-01-05 00:17:43
My question is that in a comparison of lossy-format decoders between, let's say, iTunes and Foobar and Winamp, will the output vary between decoding implementations?


Yes.  Lossy formats rarely specify a bit perfect output.  Instead a series of test tracks is usually provided with a maximum allowable error for each track.  All compliant implementations should produce output within this specification.

In practice, most software running on PC will be using 32 bit floating point and so will tend to have much greater accuracy then is required.  Some embedded implementations may be less accurate, particularly on 16/24 bit processors and DSPs.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: mjb2006 on 2013-01-05 02:53:43
In AAC there can be Perceptual Noise Substitution (http://wiki.hydrogenaudio.org/index.php?title=Perceptual_Noise_Substitution), so I'm not sure I could expect identical output even from the same decoder.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: benski on 2013-01-05 09:08:10
In AAC there can be Perceptual Noise Substitution (http://wiki.hydrogenaudio.org/index.php?title=Perceptual_Noise_Substitution), so I'm not sure I could expect identical output even from the same decoder.


The random number generator is seeded at the start of the stream from a fixed value, so it is deterministic and repeatable.  That being said, seeking or starting mid-stream will cause differences.

Title: Bit-perfect AAC/MP3/etc decoding?
Post by: IgorC on 2013-01-05 19:31:54
Related topics

Updated compliance testing for Winamp and Foobar (http://www.hydrogenaudio.org/forums/index.php?showtopic=64098&hl=)

MP3 decoding differences, foobar2000 1.2 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=98379&view=findpost&p=817437)

Even if hardware would be perfectly ideal and considering best human hearing abilities, still the precision of MP3 decoding (24 bits) is excessively high.

P.S. The last Apollo player has a ridiculously precise MP3 decoder in 24 bits mode.  http://koti.welho.com/hylinen/apollo/FAQ.html (http://koti.welho.com/hylinen/apollo/FAQ.html)
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: db1989 on 2013-01-05 20:48:34
…in which the author claims that differences that at most represent fluctuations in the least-significant of 24-bits are the answer to the question “Why does Apollo sound so good?”. Should we be directing traffic towards such nonsense?
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: Soap on 2013-01-05 21:11:56
…in which the author claims that differences that at most represent fluctuations in the least-significant of 24-bits are the answer to the question “Why does Apollo sound so good?”. Should we be directing traffic towards such nonsense?


Isn't he saying his error is in the 24th bit while others are 100x worse - ie. 17 bits down?  Or is my math horrid?
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: db1989 on 2013-01-05 21:56:07
Sorry, I did read it wrongly.

Quote
RMS level [of the then-latest version of MAD] is over a hundred times the one produced by Apollo 37zm and the maximum difference is four times the one by Apollo (interestingly the results for MAD 0.11.4b seem to be somewhat better than for the latest one but they are still worse than Apollo's). Actually, the maximum difference of Apollo's output is the smallest possible deviation in 24-bit data, the only smaller possible value would be zero.

So, you’re right; this suggests that MAD produced an RMS between 6–7 bits larger in magnitude than Apollo did, and (I guess) a maximal difference 2 bits larger in magnitude.

I apologise for talking nonsense. :/
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: Soap on 2013-01-05 22:26:51
I apologise for talking nonsense. :/


No, no.  My reading and math both fail me at times.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: db1989 on 2013-01-05 23:14:10
Heh, I’m glad it’s not just me.

Although I welcome higher precision, I still take issue with descriptions like these:
Quote
Why does Apollo sound so good?

The sound quality has always been an important factor when making decisions in the decoder code. Recent addition of 32-bit and 24-bit output has resulted in further improvements in the quality. To prove this, I measured the difference of Apollo 37zm 24-bit output to the MPEG-1 audio layer 3 compliance test reference signal […] Of course, this only goes for the provided test signal, but it should give some picture about the sound quality.

Logic that extrapolates conclusions about sound quality from measurements is not in line with TOS #8 – especially when the reported differences lie beyond the 16th bit – so I’d advise readers not to take this seriously.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: Arnold B. Krueger on 2013-01-07 14:45:42
Unlike encoding, I believe all decoders are supposed to be the same.


The operation of decoders is generally well-known and well-defined.

Evens so, bit perfect can be tough because different hardware implements arithmetic with subtle differences and at the LSB level insignificant variations in things like order of operations can lead to tiny differences.
Title: Bit-perfect AAC/MP3/etc decoding?
Post by: saratoga on 2013-01-07 15:49:39
Evens so, bit perfect can be tough because different hardware implements arithmetic with subtle differences and at the LSB level insignificant variations in things like order of operations can lead to tiny differences.


For mp3 its even more complex because the specification provides filter constants to specified precisions, but does not define the precision of the actual filterbank operations nor their precise implementation.  Thus there is no "exact" value to compare to, only a range of values you should not exceed.

Of course as Arnold points out, these differences are incredibly small and completely irrelevant to audio quality when implemented on modern 32 or 64 bit machines.  They mostly only matter when using 16 bit DSP cores.