[FFmpeg-devel] Some ideas for a tiny set of audio conversion functions..

Andreas Öman andreas
Sat Nov 17 17:56:45 CET 2007


Benjamin Larsson wrote:
> Andreas ?man wrote:
>> ... or a replacement of DSPContext->float_to_int16()
>>
>> I've been given this some thought and I've come up with
>> some thoughts that I realized into code.
>>
>> The idea is to support
>>
>> * any number of channels
>> * both planar and interleaved data
>> * mixing of multiple sources into one output channel
>>
>> If this is the right way to go i'll continue to write some
>> convenience functions, SSE-implementations and make some test
>> with the current codecs that output floats internally.
>>
>> The file is currently just standalone.
>>
>> Comments?
>>
> 
> We need support for fixed point down mixing also. Otherwise ffmpeg will
> be to slow for embedded platforms. 

Is it okay to still represent 'gain' as a float or do we
need to get rid of the 'float' concept entirely for the
fixed point case. (I was thinking the fixed-point versions
could convert 'gain' to its internal multipliers)

> And I'm not so sure the generic
> functions are flexible enough.  Can you do a
> 
> Left channel: Front Left + Surround Left + Center + LFE
> Right channel: Front Right + Surround Right + Center + LFE
> 
> with this code ?

Sure,

dst[0].sources -> A -> B -> C -> D
                   |    |    |    |
                   |    |    |    +-- LFE
                   |    |    +------- Center
                   |    +------------ Points to sL source
                   +----------------- Points to L source


dst[1].sources -> E -> F -> G -> H
                   |    |    |    |
                   |    |    |    +-- LFE
                   |    |    +------- Center
                   |    +------------ Points to sR source
                   +----------------- Points to R source

Each source (A-H) can have its own 'gain'

ie. there may be multiple 'source' structs pointing to the
same set of data, but used for different destinations and with
different gain. It would then the up to the conversion
functions to be as 'smart' as possible with the sources.

Another way might be that we create three structs

a) Destination

b) "Mixer" (which contains the gain and points to source)

c) Source, containing a (void *) and interleaving.

But i'm not sure it makes much of a difference.




More information about the ffmpeg-devel mailing list