[MPlayer-dev-eng] Dithering 16-bit output for libmad
mosgalin at VM10124.spb.edu
Mon Jan 31 00:41:19 CET 2005
Hi Reimar D?ffinger!
On 2005.01.30 at 23:48:15 +0100, Reimar D?ffinger wrote next:
> > mad_fixed_t is always 32 bit, except for 64-bit systems, where it is 64
> > bit ;)
> Well, MPlayer filter chain supports 32 bit. And adding 64 bit support
> also would only be a matter of adding conversion routines to af_format.c
> (but that file is getting a bit overloaded already).
I think no one cares about 64 bits in sound. Since AFAIK processing is
done in 32 bits in all major audio applications and stored 32-bits is
almost always 24-bits padded to 32, there is no point in supporting it.
> But I have to admit when MPlayer converts it into 16 bit by only taking
> the most significant bits (in af_format) you would probably loose
There is no problem if it is only in af_format and only once. The
problem is that conversion may occur somewhere in the middle of audio
chain - that's all. After that, only more advanced af_format and 32-bit
output in ad_* drivers is required.
> > Converting some filters to 32 bits would be very easy, but won't it also
> > be rounded in general audio filters interface, i.e. before and/or after
> > filter chain?
> No, it's just plain unspecified data with a lenght there...
But, in libmpcodecs, in ad_libmad.c, there is "unsigned char *buf" that
is assumed to be uint16_t. What can be done about this? Where it is
> > Also, where it is declared that audio filters don't support 32 bit? It's
> > not like "16" is defined somewhere inside or they are returning short
> > ints.
> It is. Look for e.g. AF_FORMAT_S16_NE
OK. Looks good, but I still don't understand about decoders and buf.
> > > > in mplayer's output, but it playbacks the file. The output is 16 bit,
> > > > and even -ao pcm writes 16-bit files, so I can't test whether 24 bits
> > > > would be rounded to 16. And mplayer doesn't play 32-bit files at all.
> > >
> > > There is no reason for that... Can you provide a sample?
> > Hmm.. Do you have audacity? Open a wav file, select 32-bit float output
> > for wav in preferences and try to play the result (codec value will be
> > 0x3).
> Oh, 32 bit float! Now that's more of a problem then...
I think 32 bit in wavs is always float.. Though I guess 32bit integer
format exist too, I never seen it. Don't know why, it's just when
someone spoke of "32-bit wav" he always meant float.
But this isn't really significant, the real part is hacking ao_pcm to
support 24-bit output, in order to have ability to check whether 24-bit
really isn't clipped anywhere.
More information about the MPlayer-dev-eng