[Ffmpeg-devel] [RFC] Feature request

Loren Merritt lorenm
Sat Aug 19 01:49:43 CEST 2006

On Sat, 19 Aug 2006, Benjamin Larsson wrote:

> Hi, the ff_float_to_int16 function doesn't take a step argument would it
> be ok to add a step argument to the function? The cook and wma decoder
> interleaves the output directly from float so it's not possible to use
> ff_float_to_int16 without reordering the floatdata first.

That's possible, but it would be faster to have one function that takes 
pointers to some mono streams, and converts and interleaves them. And I 
even wrote such during the vorbis optimization, though it turned out not 
to help vorbis.
Can you use this?

void float_to_int16_interleave_c(int16_t *dst, float **src, int len, int channels){
     int i,j,k;
     for(i=k=0; i<len; i++){
         for(j=0; j<channels; j++, k++){
             int tmp = lrintf(src[j][i]);
             if(tmp < -32768) tmp = -32768;
             else if(tmp > 32767) tmp = 32767;
             dst[k] = tmp;

--Loren Merritt

More information about the ffmpeg-devel mailing list