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

Michael Niedermayer michaelni
Sun May 18 18:25:19 CEST 2008

On Sun, May 18, 2008 at 04:59:32PM +0200, Benjamin Larsson wrote:
> 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 ?
> >>> and
> >> 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?

filters can output what they see fit, of course i might reject a patch if
it does something insane but thats a different thing.

> 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.

228651 dezicycles in conv_cast, 16256 runs, 128 skips
108574 dezicycles in conv_lrint, 16321 runs, 63 skips
63418 dezicycles in conv_x87_asm, 16329 runs, 55 skips
51975 dezicycles in conv_x87_asm_ex, 16349 runs, 35 skips
54081 dezicycles in conv_bias, 16351 runs, 33 skips

that is with hand tuned conv_x87_asm_ex and gcc generated conv_bias
if i just hand tune the fmul/fadd loop a little with the integer code left
as gcc generated it i get
46308 dezicycles in conv_bias, 16336 runs, 48 skips

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- 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/20080518/eee61c83/attachment.pgp>

More information about the ffmpeg-devel mailing list