comparison dsputil.c @ 10219:87ae4a167138 libavcodec

Add some dsputil functions useful for AAC decoder
author mru
date Tue, 22 Sep 2009 00:48:41 +0000
parents 658b2ca35e22
children 4d1b9ca628fc
comparison
equal deleted inserted replaced
10218:84a9a55135f4 10219:87ae4a167138
4087 dst[i] = s0*wj - s1*wi + add_bias; 4087 dst[i] = s0*wj - s1*wi + add_bias;
4088 dst[j] = s0*wi + s1*wj + add_bias; 4088 dst[j] = s0*wi + s1*wj + add_bias;
4089 } 4089 }
4090 } 4090 }
4091 4091
4092 static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
4093 int len)
4094 {
4095 int i;
4096 for (i = 0; i < len; i++)
4097 dst[i] = src[i] * mul;
4098 }
4099
4100 static void vector_fmul_sv_scalar_2_c(float *dst, const float *src,
4101 const float **sv, float mul, int len)
4102 {
4103 int i;
4104 for (i = 0; i < len; i += 2, sv++) {
4105 dst[i ] = src[i ] * sv[0][0] * mul;
4106 dst[i+1] = src[i+1] * sv[0][1] * mul;
4107 }
4108 }
4109
4110 static void vector_fmul_sv_scalar_4_c(float *dst, const float *src,
4111 const float **sv, float mul, int len)
4112 {
4113 int i;
4114 for (i = 0; i < len; i += 4, sv++) {
4115 dst[i ] = src[i ] * sv[0][0] * mul;
4116 dst[i+1] = src[i+1] * sv[0][1] * mul;
4117 dst[i+2] = src[i+2] * sv[0][2] * mul;
4118 dst[i+3] = src[i+3] * sv[0][3] * mul;
4119 }
4120 }
4121
4122 static void sv_fmul_scalar_2_c(float *dst, const float **sv, float mul,
4123 int len)
4124 {
4125 int i;
4126 for (i = 0; i < len; i += 2, sv++) {
4127 dst[i ] = sv[0][0] * mul;
4128 dst[i+1] = sv[0][1] * mul;
4129 }
4130 }
4131
4132 static void sv_fmul_scalar_4_c(float *dst, const float **sv, float mul,
4133 int len)
4134 {
4135 int i;
4136 for (i = 0; i < len; i += 4, sv++) {
4137 dst[i ] = sv[0][0] * mul;
4138 dst[i+1] = sv[0][1] * mul;
4139 dst[i+2] = sv[0][2] * mul;
4140 dst[i+3] = sv[0][3] * mul;
4141 }
4142 }
4143
4144 static void butterflies_float_c(float *restrict v1, float *restrict v2,
4145 int len)
4146 {
4147 int i;
4148 for (i = 0; i < len; i++) {
4149 float t = v1[i] - v2[i];
4150 v1[i] += v2[i];
4151 v2[i] = t;
4152 }
4153 }
4154
4155 static float scalarproduct_float_c(const float *v1, const float *v2, int len)
4156 {
4157 float p = 0.0;
4158 int i;
4159
4160 for (i = 0; i < len; i++)
4161 p += v1[i] * v2[i];
4162
4163 return p;
4164 }
4165
4092 static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){ 4166 static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){
4093 int i; 4167 int i;
4094 for(i=0; i<len; i++) 4168 for(i=0; i<len; i++)
4095 dst[i] = src[i] * mul; 4169 dst[i] = src[i] * mul;
4096 } 4170 }
4720 c->float_to_int16 = ff_float_to_int16_c; 4794 c->float_to_int16 = ff_float_to_int16_c;
4721 c->float_to_int16_interleave = ff_float_to_int16_interleave_c; 4795 c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
4722 c->add_int16 = add_int16_c; 4796 c->add_int16 = add_int16_c;
4723 c->sub_int16 = sub_int16_c; 4797 c->sub_int16 = sub_int16_c;
4724 c->scalarproduct_int16 = scalarproduct_int16_c; 4798 c->scalarproduct_int16 = scalarproduct_int16_c;
4799 c->scalarproduct_float = scalarproduct_float_c;
4800 c->butterflies_float = butterflies_float_c;
4801 c->vector_fmul_scalar = vector_fmul_scalar_c;
4802
4803 c->vector_fmul_sv_scalar[0] = vector_fmul_sv_scalar_2_c;
4804 c->vector_fmul_sv_scalar[1] = vector_fmul_sv_scalar_4_c;
4805
4806 c->sv_fmul_scalar[0] = sv_fmul_scalar_2_c;
4807 c->sv_fmul_scalar[1] = sv_fmul_scalar_4_c;
4725 4808
4726 c->shrink[0]= ff_img_copy_plane; 4809 c->shrink[0]= ff_img_copy_plane;
4727 c->shrink[1]= ff_shrink22; 4810 c->shrink[1]= ff_shrink22;
4728 c->shrink[2]= ff_shrink44; 4811 c->shrink[2]= ff_shrink44;
4729 c->shrink[3]= ff_shrink88; 4812 c->shrink[3]= ff_shrink88;