aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-10-04 01:26:50 +0100
committerMans Rullgard <mans@mansr.com>2012-10-05 22:33:32 +0100
commit642b4efaf7b3055ab4b26bda252149eb35babc4b (patch)
tree33f7bf3b7bab6dc5d23cbb4fbb54f8f7b7e68f6c /libavcodec
parentbcf07a15a0aea23d2aa3eb71ea6ec7b3d21892ac (diff)
downloadffmpeg-642b4efaf7b3055ab4b26bda252149eb35babc4b.tar.gz
ppc: fmtconvert: kill VLA in float_to_int16_interleave_altivec()
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ppc/fmtconvert_altivec.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/libavcodec/ppc/fmtconvert_altivec.c b/libavcodec/ppc/fmtconvert_altivec.c
index db2c25800b..129891ad9b 100644
--- a/libavcodec/ppc/fmtconvert_altivec.c
+++ b/libavcodec/ppc/fmtconvert_altivec.c
@@ -83,6 +83,22 @@ static void float_to_int16_altivec(int16_t *dst, const float *src, long len)
}
}
+static void float_to_int16_stride_altivec(int16_t *dst, const float *src,
+ long len, int stride)
+{
+ int i, j;
+ vector signed short d, s;
+
+ for (i = 0; i < len - 7; i += 8) {
+ d = float_to_int16_one_altivec(src + i);
+ for (j = 0; j < 8; j++) {
+ s = vec_splat(d, j);
+ vec_ste(s, 0, dst);
+ dst += stride;
+ }
+ }
+}
+
static void float_to_int16_interleave_altivec(int16_t *dst, const float **src,
long len, int channels)
{
@@ -124,13 +140,8 @@ static void float_to_int16_interleave_altivec(int16_t *dst, const float **src,
}
}
} else {
- DECLARE_ALIGNED(16, int16_t, tmp)[len];
- int c, j;
- for (c = 0; c < channels; c++) {
- float_to_int16_altivec(tmp, src[c], len);
- for (i = 0, j = c; i < len; i++, j+=channels)
- dst[j] = tmp[i];
- }
+ for (i = 0; i < channels; i++)
+ float_to_int16_stride_altivec(dst + i, src[i], len, channels);
}
}
}