IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
MP3 decoding differences, foobar2000 1.2 beta 1
Arite
post Dec 17 2012, 20:54
Post #1





Group: Members
Posts: 37
Joined: 31-May 07
Member No.: 43904



foobar2000 v1.2 has switched to using FFmpeg for decoding MP3s (and other codecs). I believe before (v1.1.18 and earlier) it used mpg123 for decoding.

I thought I'd compare the decoded WAV files from an MP3 file (AFAIK FhG encoder) created using v1.1.18 and v1.2 beta 1, respectively.

foobar2000 v1.1.18:
CODE
Track converted successfully.
Total encoding time: 0:06.396, 16.88x realtime

foobar2000 v1.2 beta 1:
CODE
Track converted successfully.
Total encoding time: 0:00.593, 182.08x realtime

That's quite a notable speed change smile.gif (next test was only 2x as fast though).

However doing a bit compare yields:
CODE
Differences found: 14232 sample(s), starting at 1.1842404 second(s), peak: 0.0000305 at 1.1842404 second(s), 2ch

Is this normal/to be expected? My understanding is that mpg123 is the/one of the most accurate decoders.

I tried it on another file (LAME 3.98r -V 0 encoded) and that also failed the bit compare test. Decoding speeds:
CODE
v1.1.18:
Track converted successfully.
Total encoding time: 0:02.964, 112.78x realtime

v1.2 beta 1:
Track converted successfully.
Total encoding time: 0:01.435, 232.96x realtime

^So about 2x as fast - could be due to FFmpeg being multi threaded.

Bit comparing:
CODE
Differences found: 76491 sample(s), starting at 0.5605442 second(s), peak: 0.0000305 at 0.5605442 second(s), 2ch

My question is why is FFmpeg's MP3 decoding different, and is it more or less accurate than mpg123?

Cheers, Arite.

This post has been edited by Arite: Dec 17 2012, 20:55
Go to the top of the page
+Quote Post
Andreasvb
post Dec 17 2012, 22:43
Post #2





Group: Members
Posts: 1337
Joined: 6-March 04
From: Sweden
Member No.: 12509



Not sure, but it's the decoder that's changed.
The encoder is the same, or does it affect as well?

Decoder = Playback.
Encoder = Converting.



--------------------
Windows 8.1u1 Pro x64 Media Center // foobar2000 1.3.3
Go to the top of the page
+Quote Post
Arite
post Dec 17 2012, 23:48
Post #3





Group: Members
Posts: 37
Joined: 31-May 07
Member No.: 43904



QUOTE (Andreasvb @ Dec 17 2012, 21:43) *
Not sure, but it's the decoder that's changed.

Yes:
QUOTE
FFmpeg is now used for MP3, AAC and Vorbis decoding


QUOTE (Andreasvb @ Dec 17 2012, 21:43) *
The encoder is the same, or does it affect as well?

No, encoding is the same - LAME is used (I used a custom profile with lame.exe anyway).

To clarify, I didn't encode any MP3 files - just decompressed the same MP3 file(s) to WAV using v1.1.18 and then v1.2 beta 1 and did a bit compare on the uncompressed files.

Arite.
Go to the top of the page
+Quote Post
mezenga
post Dec 17 2012, 23:50
Post #4





Group: Members
Posts: 121
Joined: 10-May 03
Member No.: 6509



QUOTE (Arite @ Dec 17 2012, 11:54) *
My question is why is FFmpeg's MP3 decoding different, and is it more or less accurate than mpg123?

Same results here.
My guess would be rounding differences due optimizations at code or compiler level.
Itīs probably nothing to worry about.
Go to the top of the page
+Quote Post
Andreasvb
post Dec 18 2012, 01:08
Post #5





Group: Members
Posts: 1337
Joined: 6-March 04
From: Sweden
Member No.: 12509



Don't know why you would decompress an MP3 to WAV, in any case as it's not lossless.
But great that it's faster now. smile.gif


--------------------
Windows 8.1u1 Pro x64 Media Center // foobar2000 1.3.3
Go to the top of the page
+Quote Post
kode54
post Dec 18 2012, 02:25
Post #6





Group: Admin
Posts: 4608
Joined: 15-December 02
Member No.: 4082



At 16 bit integer precision, the peak difference you measured is confined to the least significant bit. I suggest you try again, decoding to 32 bit (floating point) WAV files, you should find that the difference is a lot smaller.
Go to the top of the page
+Quote Post
Arite
post Dec 18 2012, 02:43
Post #7





Group: Members
Posts: 37
Joined: 31-May 07
Member No.: 43904



Thanks - I re-did the comparison at 32-bit; the result (second file):
CODE
Differences found: 28403558 sample(s), starting at 0.0000000 second(s), peak: 0.0000030 at 238.6302495 second(s), 1ch

The peak is ~1 order of magnitude lower.

I'm presuming by the responses this is to be expected and there's nothing to worry about, and the differences are due to e.g. compiler-based rounding differences as mezenga says?

Cheers, Arite.
Go to the top of the page
+Quote Post
nu774
post Dec 18 2012, 04:13
Post #8





Group: Developer
Posts: 522
Joined: 22-November 10
From: Japan
Member No.: 85902



Looks like channel mapping of 6.1ch AAC is incorrect: Attached File  6.1ch.m4a ( 239.67K ) Number of downloads: 61

Both of ffmpeg and avconv (correctly) decode this file as L R C LFE BL BR BC, but fb2k seems to decode it as L R LFE BL BR FLC FRC.
Is that due to version difference of libavcodec/libavutil, or some other reason? In my environment libavutil-52.dll was being used.
Go to the top of the page
+Quote Post
Garf
post Dec 18 2012, 09:21
Post #9


Server Admin


Group: Admin
Posts: 4884
Joined: 24-September 01
Member No.: 13



QUOTE (Arite @ Dec 18 2012, 02:43) *
I'm presuming by the responses this is to be expected and there's nothing to worry about, and the differences are due to e.g. compiler-based rounding differences as mezenga says?


Yes. Not only due to the compiler, also due to the decoder structure/optimizations.

There are some rules for what defines a "correct/compliant" MP3 decoder, see for example:
http://www.underbit.com/resources/mpeg/audio/compliance

Both the old and new fb2k decoder should pass at full compliance. (Your 24-bit test confirms this)

Vorbis and AAC should give similar results.
Go to the top of the page
+Quote Post
Garf
post Dec 18 2012, 09:26
Post #10


Server Admin


Group: Admin
Posts: 4884
Joined: 24-September 01
Member No.: 13



By the way, when decoding to disk your disk is going to be a limiting factor, not the decoder itself. Try foo_benchmark.

The speedup also differs depending on the generation of your CPU. Having AVX is a lot faster, failing that having SSE is still a lot faster, failing that 3DNow, etc...
Go to the top of the page
+Quote Post
Peter
post Dec 18 2012, 13:15
Post #11


foobar2000 developer


Group: Admin
Posts: 3275
Joined: 30-September 01
Member No.: 84



QUOTE (nu774 @ Dec 18 2012, 04:13) *
Looks like channel mapping of 6.1ch AAC is incorrect: Attached File  6.1ch.m4a ( 239.67K ) Number of downloads: 61

Both of ffmpeg and avconv (correctly) decode this file as L R C LFE BL BR BC, but fb2k seems to decode it as L R LFE BL BR FLC FRC.
Is that due to version difference of libavcodec/libavutil, or some other reason? In my environment libavutil-52.dll was being used.

Bug fixed for beta 2, thanks for reporting.
(Bug wasn't even new to fb2k 1.2 it seems)
Go to the top of the page
+Quote Post
lvqcl
post Dec 18 2012, 15:58
Post #12





Group: Developer
Posts: 3361
Joined: 2-December 07
Member No.: 49183



MP3 decoding speed via foo_benchmark. Test file: 221kbps (LAME 3.97 -V2, stereo, 44.1k). Test CPU: Intel Core2, SSE up tp 4.1.

1.1.18: 210x realtime; 1.2 b1: 463x realtime.
Go to the top of the page
+Quote Post
nu774
post Dec 18 2012, 16:10
Post #13





Group: Developer
Posts: 522
Joined: 22-November 10
From: Japan
Member No.: 85902



Thanks for quick fix.
In my environment (Core i5 mobile), MP3 decoding speed is around 560x-580x or so, and now it's faster than Apple's decoder (410x or so).
Go to the top of the page
+Quote Post
Arite
post Dec 18 2012, 19:49
Post #14





Group: Members
Posts: 37
Joined: 31-May 07
Member No.: 43904



QUOTE (Garf @ Dec 18 2012, 08:21) *
QUOTE (Arite @ Dec 18 2012, 02:43) *
I'm presuming by the responses this is to be expected and there's nothing to worry about, and the differences are due to e.g. compiler-based rounding differences as mezenga says?


Yes. Not only due to the compiler, also due to the decoder structure/optimizations.

There are some rules for what defines a "correct/compliant" MP3 decoder, see for example:
http://www.underbit.com/resources/mpeg/audio/compliance

Both the old and new fb2k decoder should pass at full compliance. (Your 24-bit test confirms this)

Vorbis and AAC should give similar results.

OK, thanks smile.gif.

QUOTE (Garf @ Dec 18 2012, 08:26) *
By the way, when decoding to disk your disk is going to be a limiting factor, not the decoder itself. Try foo_benchmark.

The speedup also differs depending on the generation of your CPU. Having AVX is a lot faster, failing that having SSE is still a lot faster, failing that 3DNow, etc...

Cheers - my results using foo_benchmark:

v1.1.18:
CODE
Total length: 5:34.307
Info Read time: 0:00.001
Opening time: 0:00.003
Decoding time: 0:01.736
192.349x realtime

v1.2 beta 1:
CODE
Total length: 5:34.307
Info Read time: 0:00.000
Opening time: 0:00.092
Decoding time: 0:00.768
434.987x realtime

Still over 2x smile.gif.

Arite.
Go to the top of the page
+Quote Post
PHOYO
post Dec 18 2012, 23:44
Post #15





Group: Members
Posts: 128
Joined: 20-May 04
Member No.: 14212



FFmpeg can decode TAK so why not support it out of the box?
Go to the top of the page
+Quote Post
IgorC
post Dec 19 2012, 00:30
Post #16





Group: Members
Posts: 1556
Joined: 3-January 05
From: ARG/RUS
Member No.: 18803



Atom N2600.

LC-AAC ~128 kbps

single thread mode for both versions.

1.1.18 - 54x
1.2b1 - 171x

Nice speed up.
Go to the top of the page
+Quote Post
mezenga
post Dec 19 2012, 03:40
Post #17





Group: Members
Posts: 121
Joined: 10-May 03
Member No.: 6509



QUOTE (PHOYO @ Dec 18 2012, 15:44) *
FFmpeg can decode TAK so why not support it out of the box?

Because it is a reverse engineering work developed without format specification guidance and released just a few months ago.

Discussion here

ITOH, foosionīs TAK Decoder is a mature, fully compilant component based on the official tak decoding library.

This post has been edited by mezenga: Dec 19 2012, 03:46
Go to the top of the page
+Quote Post
Heliologue
post Dec 22 2012, 04:58
Post #18





Group: Members
Posts: 105
Joined: 17-September 06
Member No.: 35303



While I understand why 1.2 may choose to not use ffmpeg for new codecs like TAK, I'm curious as to why it does't use it for, e.g., FLAC. Perhaps there as simply no performance benefit? foobar2000's decoding is already quite fast for me (> LAME decoding in 1.1.18).
Go to the top of the page
+Quote Post
Porcus
post Dec 22 2012, 13:03
Post #19





Group: Members
Posts: 1842
Joined: 30-November 06
Member No.: 38207



QUOTE (Arite @ Dec 17 2012, 20:54) *
My question is why is FFmpeg's MP3 decoding different, and is it more or less accurate than mpg123?


Two different possibilities: roundoff and non-conforming files. In the first case, the differences are unlikely to be audible. In the second case, there is AFAIK no standardized workaround files that do not really conform to the MP3 specification. (That is not to say that one will not produce more annoying artifacts than the other.)


--------------------
One day in the Year of the Fox came a time remembered well
Go to the top of the page
+Quote Post
lvqcl
post Dec 22 2012, 15:07
Post #20





Group: Developer
Posts: 3361
Joined: 2-December 07
Member No.: 49183



BTW fb2k 1.2b2 decodes SBR part of HE-AAC files differently than 1.1.18.

foo_bitcompare shows that 1.1.18 is closer to e.g. Winamp. But from spectrograms, 1.2b2 is closer to Winamp.
Go to the top of the page
+Quote Post
Garf
post Dec 23 2012, 11:06
Post #21


Server Admin


Group: Admin
Posts: 4884
Joined: 24-September 01
Member No.: 13



QUOTE (Heliologue @ Dec 22 2012, 04:58) *
While I understand why 1.2 may choose to not use ffmpeg for new codecs like TAK, I'm curious as to why it does't use it for, e.g., FLAC. Perhaps there as simply no performance benefit? foobar2000's decoding is already quite fast for me (> LAME decoding in 1.1.18).


IIRC this was tested and ffmpeg is no faster than the official FLAC decoder.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 28th August 2014 - 09:18