Revision f27e1d64 libavcodec/dsputil.c
libavcodec/dsputil.c  

3930  3930 
dst[i*step] = src0[i] * src1[i] + src2[i] + src3; 
3931  3931 
} 
3932  3932  
3933 
void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){ 

3934 
int i; 

3935 
for(i=0; i<len; i++) 

3936 
dst[i] = src0[i]*win[leni1] + src1[i]*win[i] + add_bias; 

3937 
} 

3938  
3939 
static av_always_inline int float_to_int16_one(const float *src){ 

3940 
int_fast32_t tmp = *(const int32_t*)src; 

3941 
if(tmp & 0xf0000){ 

3942 
tmp = (0x43c0ffff  tmp)>>31; 

3943 
// is this faster on some gcc/cpu combinations? 

3944 
// if(tmp > 0x43c0ffff) tmp = 0xFFFF; 

3945 
// else tmp = 0; 

3946 
} 

3947 
return tmp  0x8000; 

3948 
} 

3949  
3933  3950 
void ff_float_to_int16_c(int16_t *dst, const float *src, long len){ 
3934  3951 
int i; 
3935 
for(i=0; i<len; i++) { 

3936 
int_fast32_t tmp = ((const int32_t*)src)[i]; 

3937 
if(tmp & 0xf0000){ 

3938 
tmp = (0x43c0ffff  tmp)>>31; 

3939 
// is this faster on some gcc/cpu combinations? 

3940 
// if(tmp > 0x43c0ffff) tmp = 0xFFFF; 

3941 
// else tmp = 0; 

3952 
for(i=0; i<len; i++) 

3953 
dst[i] = float_to_int16_one(src+i); 

3954 
} 

3955  
3956 
void ff_float_to_int16_interleave_c(int16_t *dst, const float *src, long len, int channels){ 

3957 
int i,j,c; 

3958 
if(channels==2){ 

3959 
for(i=0; i<len; i++){ 

3960 
dst[2*i] = float_to_int16_one(src+i); 

3961 
dst[2*i+1] = float_to_int16_one(src+i+len); 

3942  3962 
} 
3943 
dst[i] = tmp  0x8000; 

3963 
}else{ 

3964 
for(c=0; c<channels; c++, src+=len) 

3965 
for(i=0, j=c; i<len; i++, j+=channels) 

3966 
dst[j] = float_to_int16_one(src+i); 

3944  3967 
} 
3945  3968 
} 
3946  3969  
...  ...  
4450  4473 
c>vector_fmul = vector_fmul_c; 
4451  4474 
c>vector_fmul_reverse = vector_fmul_reverse_c; 
4452  4475 
c>vector_fmul_add_add = ff_vector_fmul_add_add_c; 
4476 
c>vector_fmul_window = ff_vector_fmul_window_c; 

4453  4477 
c>float_to_int16 = ff_float_to_int16_c; 
4478 
c>float_to_int16_interleave = ff_float_to_int16_interleave_c; 

4454  4479 
c>add_int16 = add_int16_c; 
4455  4480 
c>sub_int16 = sub_int16_c; 
4456  4481 
c>scalarproduct_int16 = scalarproduct_int16_c; 
Also available in: Unified diff