Bug 80497 - mpeglib problem playing mp3
Summary: mpeglib problem playing mp3
Status: RESOLVED FIXED
Alias: None
Product: arts
Classification: Unmaintained
Component: libartskde (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Multimedia Developers
URL:
Keywords:
: 80581 80976 81676 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-27 20:03 UTC by Unknown
Modified: 2004-07-14 19:11 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2004-04-27 20:03:31 UTC
Version:            (using KDE KDE 3.2.2)
Installed from:    Debian testing/unstable Packages
OS:          Linux

I encountered a problem playing mp3 files with juk, noatun, kaboodle, amarok, artsplay and mpeglibartsplay. The playback sounds strange since I upgraded from KDE 3.2.1 to 3.2.2. I think the reason must be _mpeglib_ or _libarts-mpeglib_: xmms, xine/kaffeine and alsaplayer play these mp3s without problem and converting files to ogg solves the problem too.
The problem is also mentioned in a debian list:
http://lists.debian.org/debian-kde/2004/debian-kde-200404/msg00164.html

Martin
Comment 1 Stanislav Karchebny 2004-04-27 20:07:17 UTC
I confirm. The mp3 sound becamy floppy and high and low frequencies are distorted weirdly. (Mids are bearable though)
Comment 2 Allan Sandfeld 2004-04-27 21:55:19 UTC
Have this problem been seen by anyone outside Debian installation?
Comment 3 Stanislav Karchebny 2004-04-27 22:37:45 UTC
I'm not using Debian (using Gentoo instead), and its a hand-built KDE from CVS (as of two days).
Comment 4 Allan Sandfeld 2004-04-27 23:05:40 UTC
Okay. Since the difference is between 3.2.1 and 3.2.2, there is an off-chance it is related to the changes that happend in ALSA. 

What aRts driver are you using?
And does the problem occur if you install an older aRts with a newer KDE (and mpeglib)?
Comment 5 Unknown 2004-04-27 23:21:37 UTC
-> comment #4
- debian arts package version is 1.2.2-1
- I have to test that last question of you.
 - Do you mean _older_ or _newer_ mpeglib by "(and mpeglib)"?
 - Do mean "mpeglib" or "libarts1-mpeglib" by "mpeglib"?
Comment 6 Allan Sandfeld 2004-04-27 23:37:26 UTC
I mean a newer mpeglib as it is part of kde-multimedia, and with mpeglib I mean both libarts1-mpeglib and mpeglib in Debian terms.

I basically wants to narrow down if bug happens in newer aRts or mpeglib, and testing with mixed versions could do it.
Comment 7 Unknown 2004-04-27 23:54:30 UTC
apt doesn't seem to give me the possibility to downgrade the arts package. But take a look at the link to the debian list I mentioned in my original bug report. There somebody solved the problem by downgrading mpeglib and libarts1-mpeglib.

Or could somebody else (Stanislav ?) make the downgrade test of his arts package if still necessary?
Comment 8 Stanislav Karchebny 2004-04-28 05:24:13 UTC
I tried with both latest CVS HEAD arts and latest ARTS_1_1_BRANCH with new mpeglib/mpeglib_artsplug, the problem seems to persist.
I'll test more in the evening.
(Been playing for two hours with it yesterday, funnily mpeglib changes are mostly memleaks cleanup between KDE_3_2_1_RELEASE and HEAD)
Comment 9 Stanislav Karchebny 2004-04-28 05:26:55 UTC
Btw, I'm using alsa output with 2.6.5 kernel. It was all nice until recent kde upgrade.
I also have an mp3 file that perfectly reproduces the problem, so i'm using it for testing.
Comment 10 Christian Muehlhaeuser 2004-04-28 12:15:37 UTC
same here since (approx.) March 17 (kde_branch, self-compiled).

kernel: 2.6.5 / 2.6.6-rc2

regards,
muesli
Comment 11 Christian Muehlhaeuser 2004-04-29 09:24:34 UTC
*** Bug 80581 has been marked as a duplicate of this bug. ***
Comment 12 Hans Dembinski 2004-04-29 13:55:37 UTC
Hi there,

I don't know, if you need this information anymore, but I have proof, that it's the mpeglib or the mpeglib-plugin that makes the trouble. I downgraded both packages in debian from unstable (version 3.2.2) to testing (version 3.1.5) but left the newer arts. since then everything is ok. Also, if I deinstall the mpeglib plugin, then arts sucks CPU as hell (perhaps one could remove this bad performance code from arts or inherit the mpeglib code completely?) but plays mp3 nicely.

Greetz,
HD
Comment 13 Nicholas Pilon 2004-04-29 16:14:36 UTC
I should note that this bug is NOT related in any way to ALSA. I am using arts with OSS output, and I still get the problem. I also did not get the problem before installing the 3.2.2 libarts1-mpeglib package, though I did get 50-75% CPU utilization when using arts for ANYTHING. Downgreading to the 3.1.5 libarts1-mpeglib and mpeglib Debian packages solves the problem.
Comment 14 Stanislav Karchebny 2004-04-29 16:34:07 UTC
I think we've narrowed to problem to be in mpeglib or mpeglib_artsplug.

The only problem I see is that there are _no_ commits that could look too suspicious within this month.

But! To me, reverting to kdemm from KDE_3_2_1_RELEASE does NOT fix the problem, so it might've been introduced earlier.
Comment 15 Stanislav Karchebny 2004-04-29 19:11:10 UTC
I have narrowed the problem even further.
Building latest HEAD kdemm/mpeglib with "-O0" helps to prevent those nasty "quips" and "gulps". I would have to analyze generated machine code to find where gcc borks, but I'll leave it to our assembly gurus, don't feel like doing it atm.
Comment 16 Christian Muehlhaeuser 2004-04-29 19:38:33 UTC
berkus: thanks for all your work :-)
Comment 17 Stanislav Karchebny 2004-04-29 20:41:24 UTC
I spotted the file responsible for bug: its
mpeglib/lib/splay/mpeglayer3.cpp
Compiling it with optimizations other than -O0 causes things to break.
Comment 18 Thiago Macieira 2004-05-14 02:04:52 UTC
I can't confirm. HEAD CVS dated 20040510, g++ 3.3.3 compiled with -O2 -march=athlon-tbird -mmmx -m3dnow.

I'm listening to an MP3 on JuK, playing through aRts and through ALSA (Linux kernel 2.6.6). No distortions that I can hear.

Can you check if you have other optimisations enabled (-march especially).
Comment 19 Florian Evers 2004-05-14 10:18:04 UTC
Same here.

I compiled my system (Gentoo, KDE 3.2.2) with some agressive CFLAGS
(march=athlon-mp, -O3 etc.pp.). The same bug here on my system!

I recompiled kdemultimedia with _only_ -O0, and now it works. :-)
Comment 20 Thiago Macieira 2004-05-14 15:15:44 UTC
Florian: can you try rebuilding kdemultimedia/mpeglib with -O2 -march=athlon-tbird and see if it produces faulty code?
Comment 21 Florian Evers 2004-05-14 18:09:58 UTC
Ok, I'm going to test it.
But you have to wait... I'll build it on sunday evening, not enough time to do it right now :-(

Regards!
Comment 22 Allan Sandfeld 2004-05-15 17:52:23 UTC
I finally managed to reproduce too with CVS-HEAD and my usual optimizations ("-O2 -march=athlon -ffast-math").

It is not very noticiable here. It only happens on some numbers and only on the bass where some kind of "flopping" bass sound appears.

Thiago, maybe you have a the bug too on a similarly difficult-to-detect level?
Comment 23 Allan Sandfeld 2004-05-15 19:22:26 UTC
I can also confirm that compiling lib/splay/mpeglayer3.cpp without optimizations solves the problem. Compiling it with just the -O1 optimization introduces it again. I've been unable to trace it to any specific optimization enabled by O1 (disabling them doesnt help).

I am guessing the bug is introduced by the distos moving to gcc-3.3 from gcc-3.2 rather than the move from KDE 3.2.1 to KDE 3.2.2, since mpeglayer3.cpp haven't been changed since 1999.
Comment 24 Nicholas Pilon 2004-05-15 19:23:58 UTC
Allan, that's what makes the bug so hard to spot. The distortion isn't noticable for a lot of songs... Then you suddenly find a song that its really noticable on.
Comment 25 Stanislav Karchebny 2004-05-15 23:39:52 UTC
As I said, I have a perfect test case: K-PAX OST - Grand Central. At 1:04 into the song where percussions start - the distortion is quite heavy.

I'm looking into what may be causing this misoptimization now.
Comment 26 Allan Sandfeld 2004-05-16 00:50:51 UTC
Compiling splay/mpeglayer3.cpp with g++-3.2 removes the problem as well. 

Now to figure out if it is a gcc-3.3 or old mpeglib bug..

I am using "Yes, You Can" from Jewel - 0304. It starts with some good bass, so I can tell if it is working within the first 5 seconds of the song.
Comment 27 Stanislav Karchebny 2004-05-16 03:25:12 UTC
http://berk.upnet.ru/files/80497-testcase.mp3 (6Mb)
my testcase
please link to yours, i can provide webspace if you need
i will cut the sample down when i get my audacity to work =)
Comment 28 Stanislav Karchebny 2004-05-16 06:35:13 UTC
CVS commit by karchebny: 

* Fix that nasty misoptimization bug.

* Would anyone mind if I clean up these Augean stables, or is it better to just drop mpeglib altogether? .)

CCMAIL: 80497-done@bugs.kde.org


  M +2 -2      mpeglayer3.cpp   1.6


--- kdemultimedia/mpeglib/lib/splay/mpeglayer3.cpp  #1.5:1.6
@@ -907,6 +907,6 @@ void Mpegtoraw::layer3dequantizesample(i
 
         do{
-          out[0][index]=factor*TO_FOUR_THIRDS[in[0][index++]];
-          out[0][index]=factor*TO_FOUR_THIRDS[in[0][index++]];
+          out[0][index]=factor*TO_FOUR_THIRDS[in[0][index]];index++;
+          out[0][index]=factor*TO_FOUR_THIRDS[in[0][index]];index++;
         }while(--count);
       }


Comment 29 Stefan Gehn 2004-05-16 11:49:04 UTC
*** Bug 81676 has been marked as a duplicate of this bug. ***
Comment 30 Allan Sandfeld 2004-05-16 13:39:16 UTC
Stanislav: I have a plugin that can playback ogg/flac/mp3/wav effectively 
obsoleting mpeglib for all it is currently used for. I plan to add it to kdemultimedia before KDE 3.3, so dont waste too much time on it.
Comment 31 Stanislav Karchebny 2004-05-17 08:52:01 UTC
Great, then I'm not going to waste time on this mess.
Comment 32 matze 2004-05-17 11:15:17 UTC
Allan: Does your plugin implement streaming? You cannot obsolete mpeglib for mp3 without implementing the streaming interface, that would be a regression.
Comment 33 Unknown 2004-06-13 11:48:41 UTC
For those who can't wait for a fixed version of the Debian mpeglib package I found this link. The package is built with -o0.
http://www.marm.org.uk/mpeglib_3.2.2-1_i386.deb
Comment 34 Joe Ferris 2004-06-17 00:10:13 UTC
Recompiling arts and kdemultimedia with -O0 fixed the problem.
Comment 35 Stanislav Karchebny 2004-06-17 17:02:16 UTC
> Recompiling arts and kdemultimedia with -O0 fixed the problem. 
 
Do you people ever read?
Comment 36 Allan Sandfeld 2004-07-14 19:11:06 UTC
*** Bug 80976 has been marked as a duplicate of this bug. ***