[FFmpeg-devel] [PATCH] Add SAMPLE_FMT_S24 audioconverter

madshi dear
Mon Aug 4 09:01:31 CEST 2008


Michael Niedermayer schrieb:
 > Iam against this patch.
 > The code that stores 24bit PCM in int32_t should shift it
 > left appropriately so it is SAMPLE_FMT_S32.

But in that case the information that the audio data is only
24bit and not 32bit is lost, isn't it? Sometimes it's useful
to know that only 24bit of the audio information are filled
with useful data.

Just one example: If you want to end up with a high bit
depth FLAC track, you want to use 24bit because FLAC
encoders/decoders currently don't support 32bit. Now
if your buffer contains true 32bit audio data you should
normally downconvert this to 24bit for FLAC compression
by using TPDF dithering or even noise shaping. However,
if you know that you only have 24bit audio data to begin
with while the remaining 8bits in int32_t are all zeroed
out, you absolutely want to NOT do any dithering.

And that's the key point: If you have data in int32_t
and you want to end up with a lower bitdepth than 32bit,
you need to know how many bits in that int32_t buffer
are actually filled with real audio data. Because the correct
algorithm to do the bitdepth reduction depends on that
information.

Regards, madshi.




More information about the ffmpeg-devel mailing list