Mercurial > libavcodec.hg
comparison ppc/float_altivec.c @ 8365:d33b47d1f4c1 libavcodec
add AltiVec implementation of int32_to_float_fmul_scalar
author | gpoirier |
---|---|
date | Wed, 17 Dec 2008 09:47:06 +0000 |
parents | 8313d5901c5c |
children | 93a3020d9636 |
comparison
equal
deleted
inserted
replaced
8364:4a01f7144da5 | 8365:d33b47d1f4c1 |
---|---|
145 vec_st(t1, 15, dst+i); | 145 vec_st(t1, 15, dst+i); |
146 vec_st(t0, 0, dst+i); | 146 vec_st(t0, 0, dst+i); |
147 } | 147 } |
148 else | 148 else |
149 ff_vector_fmul_add_add_c(dst, src0, src1, src2, src3, len, step); | 149 ff_vector_fmul_add_add_c(dst, src0, src1, src2, src3, len, step); |
150 } | |
151 | |
152 | |
153 static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) | |
154 { | |
155 union { | |
156 vector float v; | |
157 float s[4]; | |
158 } mul_u; | |
159 int i; | |
160 vector float src1, src2, dst1, dst2, mul_v, zero; | |
161 | |
162 zero = (vector float)vec_splat_u32(0); | |
163 mul_u.s[0] = mul; | |
164 mul_v = vec_splat(mul_u.v, 0); | |
165 | |
166 for(i=0; i<len; i+=8) { | |
167 src1 = vec_ctf(vec_ld(0, src+i), 0); | |
168 src2 = vec_ctf(vec_ld(16, src+i), 0); | |
169 dst1 = vec_madd(src1, mul_v, zero); | |
170 dst2 = vec_madd(src2, mul_v, zero); | |
171 vec_st(dst1, 0, dst+i); | |
172 vec_st(dst2, 16, dst+i); | |
173 } | |
150 } | 174 } |
151 | 175 |
152 | 176 |
153 static vector signed short | 177 static vector signed short |
154 float_to_int16_one_altivec(const float *src) | 178 float_to_int16_one_altivec(const float *src) |
238 void float_init_altivec(DSPContext* c, AVCodecContext *avctx) | 262 void float_init_altivec(DSPContext* c, AVCodecContext *avctx) |
239 { | 263 { |
240 c->vector_fmul = vector_fmul_altivec; | 264 c->vector_fmul = vector_fmul_altivec; |
241 c->vector_fmul_reverse = vector_fmul_reverse_altivec; | 265 c->vector_fmul_reverse = vector_fmul_reverse_altivec; |
242 c->vector_fmul_add_add = vector_fmul_add_add_altivec; | 266 c->vector_fmul_add_add = vector_fmul_add_add_altivec; |
267 c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; | |
243 if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { | 268 if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { |
244 c->float_to_int16 = float_to_int16_altivec; | 269 c->float_to_int16 = float_to_int16_altivec; |
245 c->float_to_int16_interleave = float_to_int16_interleave_altivec; | 270 c->float_to_int16_interleave = float_to_int16_interleave_altivec; |
246 } | 271 } |
247 } | 272 } |