comparison dsputil.c @ 7203:87b1dfb5a98d libavcodec

Add several vector functions used by Monkey's Audio decoder to dsputil
author kostya
date Sun, 06 Jul 2008 06:06:55 +0000
parents e88e719b5e77
children 7f3d6509628b
comparison
equal deleted inserted replaced
7202:2a4ac127112c 7203:87b1dfb5a98d
3942 } 3942 }
3943 dst[i] = tmp - 0x8000; 3943 dst[i] = tmp - 0x8000;
3944 } 3944 }
3945 } 3945 }
3946 3946
3947 static void add_int16_c(int16_t * v1, int16_t * v2, int order)
3948 {
3949 while (order--)
3950 *v1++ += *v2++;
3951 }
3952
3953 static void sub_int16_c(int16_t * v1, int16_t * v2, int order)
3954 {
3955 while (order--)
3956 *v1++ -= *v2++;
3957 }
3958
3959 static int32_t scalarproduct_int16_c(int16_t * v1, int16_t * v2, int order, int shift)
3960 {
3961 int res = 0;
3962
3963 while (order--)
3964 res += (*v1++ * *v2++) >> shift;
3965
3966 return res;
3967 }
3968
3947 #define W0 2048 3969 #define W0 2048
3948 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ 3970 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
3949 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ 3971 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
3950 #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */ 3972 #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
3951 #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */ 3973 #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
4427 #endif 4449 #endif
4428 c->vector_fmul = vector_fmul_c; 4450 c->vector_fmul = vector_fmul_c;
4429 c->vector_fmul_reverse = vector_fmul_reverse_c; 4451 c->vector_fmul_reverse = vector_fmul_reverse_c;
4430 c->vector_fmul_add_add = ff_vector_fmul_add_add_c; 4452 c->vector_fmul_add_add = ff_vector_fmul_add_add_c;
4431 c->float_to_int16 = ff_float_to_int16_c; 4453 c->float_to_int16 = ff_float_to_int16_c;
4454 c->add_int16 = add_int16_c;
4455 c->sub_int16 = sub_int16_c;
4456 c->scalarproduct_int16 = scalarproduct_int16_c;
4432 4457
4433 c->shrink[0]= ff_img_copy_plane; 4458 c->shrink[0]= ff_img_copy_plane;
4434 c->shrink[1]= ff_shrink22; 4459 c->shrink[1]= ff_shrink22;
4435 c->shrink[2]= ff_shrink44; 4460 c->shrink[2]= ff_shrink44;
4436 c->shrink[3]= ff_shrink88; 4461 c->shrink[3]= ff_shrink88;