ref: 0ec7c14e0bca89fe798c939efeb28a248dcc3cab
parent: b155bb8860e52e73f60a71f7c4acaadb4cb41a9c
author: Jean-Marc Valin <[email protected]>
date: Mon Sep 22 06:25:46 EDT 2008
Unb0rked a fixed-point regression caused in 7bb339d
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -206,16 +206,17 @@
celt_word16_t best_num = -VERY_LARGE16;
celt_word16_t best_den = 0;
int best_id = 0;
+ celt_word16_t magnitude = SHL16(1, yshift);
/* The squared magnitude term gets added anyway, so we might as well
add it outside the loop */
- yy = MAC16_16(yy, 1,1);
+ yy = MAC16_16(yy, magnitude,magnitude);
j=0;
do {
celt_word16_t Rxy, Ryy, Ryp;
celt_word16_t num;
/* Select sign based on X[j] alone */
- s = signx[j];
+ s = MULT16_16(signx[j],magnitude);
/* Temporary sums of the new pulse(s) */
Rxy = ROUND16(MAC16_16(xy, s,X[j]), 14);
/* We're multiplying y[j] by two so we don't have to do it here */