Sound again: got me much better quality

Gunther Hermann gunther.hermann at web.de
Mon Mar 19 10:31:25 CET 2001


OK, as stated in previous mail, I have been unsatisfied
with sound quality in vlc so far. This weekend I had time
to look into this matter and found two points worth noting:

(1) the sample rate on the audio output device isn't set 
    properly
(2) the ac3 decoder seems to be no good.

When considering sound quality I took as reference the decoder
and extracting tool of Aaron Holtzman (http://ess.engr.uvic.ca/~aholtzma/).
With this, you can extract and decode the ac3 audio stream of
any vob file, and the quality is surely as good as in any
commercial windoze player. Actually, the vlc ac3 decoder is
based on his code.

All test where made on the intro music of 'Ususal Suspects' DVD
(and other stuff, of course, but this music is very sensitive to
bad playback).

A description of my (linux) system is given at the bottom of this mail.

To (1):
you can check right away that the sample rate on the output device
(/dev/dsp in my case) is set before any ac3 frame has been decoded,
to a default value of 41100. This has considerable impact on the
quality of (the many) 48k streams, but of course is easily fixed being a
simple thread synchronization problem. I didn't actually fix it
but let vlc write me out the sample rate and then restarted vlc
with the corresponding 'parameter' set (this to all users who wonder
what the 'parameters' in vlc --longhelp are: they are environment
variables you can set before starting vlc)

To (2):
this actually was my starting point, because I suspected the decoder
right from the beginning. To verify my suspicion I simply exchanged
the decoder, using Aaron's instead. Procedure was as follows:
* took Aarons ac3 lib source and prepended all global symbols
  with 'ah_' to avoid name clashing when linking to vlc (this
  done by search/replace on tags table)
* disabled the vlc ac3 decoder by simply commenting out the frame
  decoding portions in the ac3dec thread function
* added a callback function for libac3 to fill a buffer from the
  vlc ac3decoder bytestream (this was a hack because it meant to
  make the decoder structure global)
* added frame decoding calls to libac3 to the vlc ac3dec thread function
* linked libac3 statically into vlc.
Thus exchanging the ac3 decoder in vlc I found sound improved
but not as I expected, and only after that I found the sample 
rate bug mentioned above (you don't mind me calling it a bug).

To be fair to the decoder I reenabled the original vlc decoder
and played the stream with the correct output sample rate to
verify that, even in case the rate is correct, the vlc decoder
has negative impact. I could verify this, i.e. Aarons decoder
gives better results when plugged into vlc, even in the case
of correct output sample rate.

These points apply to vlc 0.2.62 as well as 0.2.63, but I actually
tried on 62 (because 63 is bad). With these changes - Aarons libac3
decoder plugged into vlc and correct sample rate set by hand - 
I got me sound quality very close to that of Aarons extraction tool 
(it is still some 'ringing' left, but it's really tolerable). In
other words: I'm very happy.

Clearly, if the ac3 decoder were buggy, it would be a pain to fix it,
so I know what I'm saying here. But I believe the decoder is no good
and I think I could convince me of this.

Best regards
Gunther


** my system ********************************************

MB  : Asus P3B
CPU : PIII 600
RAM : 256 MB
VID : Asus V7700 GeForce2
SND : Ensonique 1371
OS  : SuSE Linux 7.1 (i.e. 2.4pre12, XFree 4.0.1)

So far, I modified the default SuSE installation
for me as follows:
- installed kernel 2.4.2
- use kernel sound driver es1371 (instead of alsa)
- use latest proprietary Nvidia graphics driver (0.97xx)

*********************************************************

_______________________________________________________________________________
Alles unter einem Dach: Informationen, Fun, E-Mails. Bei WEB.DE: http://web.de
Die große Welt der Kommunikation: E-Mail, Fax, SMS, WAP: http://freemail.web.de





More information about the vlc mailing list