[FFmpeg-devel] Audio conversion and floating-point codecs

Måns Rullgård mans
Tue Jul 6 16:13:26 CEST 2010


Peter Ross <pross at xvid.org> writes:

> On Sat, May 15, 2010 at 08:17:51PM +0100, M?ns Rullg?rd wrote:
>> There is a long-standing desire from some to make the floating-point
>> decoders output float samples instead of converting to int16
>> internally, and I agree with the reasons for this.  However, making
>> this change hastily will make decoding orders of magnitude slower on
>> many CPUs.  The reason is that when a decoder outputs float samples,
>> the fast asm code for float-to-int conversion is not used.
>> 
>> In order to change the output format of these decoders without
>> impacting performance, we must first make a few improvements to the
>> avcodec API and to the generic audio format conversion code.
> [...]
>
>> - The decoders should output planar audio instead of interleaved for
>>   multichannel streams.  This probably means introducing
>>   avcodec_decode_audio4() with an AVFrame output.
>
> Q: does it make sense to expand the existing AVFrame structure, or
> define a new struct specific to audio?
>
> #define FF_MAX_CHANNELS  8
> struct AVAudioFrame {
>     uint16_t *data[FF_MAX_CHANNELS];
> };

I've posed the same question myself, without finding a good answer.
Some codecs support a huge number of channels.  I can say for sure,
however, that uint16_t is the wrong data type to use here.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list