[FFmpeg-devel] [RFC] LPCM 24 bits support

Michael Niedermayer michaelni
Thu Apr 17 22:49:08 CEST 2008


On Thu, Apr 17, 2008 at 09:10:07PM +0100, M?ns Rullg?rd wrote:
[...]
> > +                    }
> > +                else if (24 == avctx->bits_per_sample)
> > +                    for (c=0; c < 2*avctx->channels; c++, src+=2, src_LSB++ )
> > +                        *ap++ = (src[0]<<16) + (src[1]<<8) + *src_LSB;
> > +
> > +                src = src_LSB;
> > +
> > +                for (c=0; c < avctx->channels*2; c++)
> > +                    *samples++ = audio24[c] >> 8;
> 
> What's the point in saving 24 bits per sample to a temporary buffer,
> only to discard the low 8 bits later?  Also, properly rounding the
> values to 16 bits (rather than truncating) might be preferable.

truncation is ok, the 0.5 DC error is not something a physically existing
object could hear.

also trivial rounding like (x+128)>>8 has a problem, namely
0xFFFFFF+128 = 0x100007F
and >>8 = 0x10000

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080417/945680d2/attachment.pgp>



More information about the ffmpeg-devel mailing list