aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ra144enc.c
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2012-03-04 13:28:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-10 21:45:55 +0100
commitc3390fd56cf55259ea7665ecea6c8aeddf56e2fc (patch)
tree75bec46420b7d4a9eddbfa499af648922a8bc93c /libavcodec/ra144enc.c
parentdfc99ca04d7698b8f4101dd4f017c1b023ad95f8 (diff)
downloadffmpeg-c3390fd56cf55259ea7665ecea6c8aeddf56e2fc.tar.gz
ra144: use scalarproduct_int16
The buffer holding the coefficients must be padded with 0 so as to use DSP functions that may overread. Currently, the SSE2/3 versions is an example, as they process batches of 16 bytes. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ra144enc.c')
-rw-r--r--libavcodec/ra144enc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index 3558254e56..71f206fda3 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -60,7 +60,9 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
ractx = avctx->priv_data;
ractx->lpc_coef[0] = ractx->lpc_tables[0];
ractx->lpc_coef[1] = ractx->lpc_tables[1];
+ AV_ZERO128(ractx->buffer_a+BLOCKSIZE);
ractx->avctx = avctx;
+ ff_dsputil_init(&ractx->dsp, avctx);
ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER,
FF_LPC_TYPE_LEVINSON);
if (ret < 0)
@@ -334,7 +336,6 @@ static void ra144_encode_subblock(RA144Context *ractx,
float data[BLOCKSIZE] = { 0 }, work[LPC_ORDER + BLOCKSIZE];
float coefs[LPC_ORDER];
float zero[BLOCKSIZE], cba[BLOCKSIZE], cb1[BLOCKSIZE], cb2[BLOCKSIZE];
- int16_t cba_vect[BLOCKSIZE];
int cba_idx, cb1_idx, cb2_idx, gain;
int i, n;
unsigned m[3];
@@ -373,8 +374,8 @@ static void ra144_encode_subblock(RA144Context *ractx,
*/
memcpy(cba, work + LPC_ORDER, sizeof(cba));
- ff_copy_and_dup(cba_vect, ractx->adapt_cb, cba_idx + BLOCKSIZE / 2 - 1);
- m[0] = (ff_irms(cba_vect) * rms) >> 12;
+ ff_copy_and_dup(ractx->buffer_a, ractx->adapt_cb, cba_idx + BLOCKSIZE / 2 - 1);
+ m[0] = (ff_irms(&ractx->dsp, ractx->buffer_a) * rms) >> 12;
}
fixed_cb_search(work + LPC_ORDER, coefs, data, cba_idx, &cb1_idx, &cb2_idx);
for (i = 0; i < BLOCKSIZE; i++) {