[FFmpeg-devel] [PATCH] deprecate SAMPLE_FMT_S24

Michael Niedermayer michaelni
Sun Aug 17 17:10:39 CEST 2008


On Sun, Aug 17, 2008 at 04:37:49PM +0200, Aurelien Jacobs wrote:
> Michael Niedermayer wrote:
> 
> > On Sun, Aug 17, 2008 at 03:32:30PM +0200, Aurelien Jacobs wrote:
> > > Peter Ross wrote:
> > > 
> > > > This patch flags SAMPLE_FMT_S24 as deprecated.
> > > 
> > > So what will happen if a user suply a 32-bits pcm sample and re-encode
> > > it with a supposedly lossless encoder which only support 24-bits ?
> > > There is no way to tell the user that the encoding won't be lossless.
> > > There is also no way for the 24-bits encoder to apply dithering to
> > > 32-bits samples (it would mess-up the real 24-bits samples stored in
> > > 32-bits).
> > > Also, what happens if you transcode a 24-bits sample to wav (pcm) ?
> > > The "encoder" will have no way to know that it's a 24-bits sample
> > > and will store it as 32-bits. This is a huge waste of bytes.
> > > 
> > > IMO, SAMPLE_FMT_S24 is useful, even if it's treated internally the
> > > exact same way as SAMPLE_FMT_S32. This allows encoders to behave
> > > more sensibly if desired.
> > 
> > and 20bit 22bit 18bit ...
> > 
> > I think a field in AVCodecContext that simply contains the number of
> > bits in there would be more flexible.
> 
> I'm fine with another field in AVCodecContext.
> As long as encoders have way to know the number of actually meaningful
> bits in their input, that's fine.

> It may be enough to set the output avctx->bits_per_sample to the same
> value as the input one in ffmpeg.c or something like that.

bits_per_sample can NOT be used as SAMPLE_FMT_* bit count.
It has a different and docuented purpose, it describes the coded bitstream
and not the decoded samples, they match in bits only for lossless codecs.

example:
the a demuxer sets bits_per_sample to 4 and passes the data to a ADPCM
decoder which has SAMPLE_FMT_S16 output with 13 significant bits the
last 3 being always 0


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/20080817/fc071d16/attachment.pgp>



More information about the ffmpeg-devel mailing list