[FFmpeg-devel] [PATCH] unscaled float 2 int conversion

Benjamin Larsson banan
Sun May 18 16:59:32 CEST 2008


Michael Niedermayer wrote:
> On Sun, May 18, 2008 at 12:12:04AM +0200, Benjamin Larsson wrote:
>> [...]
>>>> so how should we go forward from this when we work on 
>>>> implementing a new audio api. The codecs should output samples in their 
>>>> native format, that is what I think most of us agree on. But what is the 
>>>> native format for a codec outputting samples in float when running in 
>>>> simd mode and the same when running in non simd mode ?
>>> SAMPLE_FMT_FLT
>>> and
>>> SAMPLE_FMT_FLT_BIAS_385
>> The reason I keep bitching about this is that SAMPLE_FMT_FLT_BIAS_385
>> output is cumbersome to use if you want to add a filter after you have
>> decoded a codec frame.
> 
> I do not understand this problem. Each filter (if we ever do have audio
> filters) supports specific formats and convertion filters would be
> insterted as needed.
> Only the convertion filter needs to care about SAMPLE_FMT_FLT_BIAS_385.

Ok, but would you mandate that all future float filters support
outputting both float and SAMPLE_FMT_FLT_BIAS_385 or would it be allowed
for a filter to only output float?

The reason I'm asking is that if filters are allowed to only output
float then we need another float2int function that doesn't use the bias
trick. codec(float)->filter(float)->float2int16(int16)

And can you rerun the benchmarks on your P3 but not prescale the float
buffer. Ie change to this and.

tmpa[i] = in[i]* (1.0/32768) + 385;

The reason I'm wondering is that sometimes it's not trivial to get the
scaling for free and then you would have to do it during the loop to add
the bias. I suspect that it is slower on platforms where it matter.

MvH
Benjamin Larsson




More information about the ffmpeg-devel mailing list