Skip to content

Commit 6c2ecc4

Browse files
committed
Improve fixed-point PVQ search accuracy
Better handling of small-magnitude vectors
1 parent 8f1a7f9 commit 6c2ecc4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

celt/vq.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,13 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch)
216216
(void)arch;
217217
ALLOC(y, N, celt_norm);
218218
ALLOC(signx, N, int);
219-
norm_scaledown(X, N, NORM_SHIFT-14);
220-
219+
#ifdef FIXED_POINT
220+
{
221+
int shift = (celt_ilog2(1+celt_inner_prod_norm_shift(X, X, N, arch))+1)/2;
222+
shift = IMAX(0, shift+(NORM_SHIFT-14)-14);
223+
norm_scaledown(X, N, shift);
224+
}
225+
#endif
221226
/* Get rid of the sign */
222227
sum = 0;
223228
j=0; do {

0 commit comments

Comments
 (0)