ref: 50d11168830d3fee73490c2cec71e943a7c69373
parent: 4841a0a02b4ad2d9625602ca4d7f5bd63753bc53
author: Jean-Marc Valin <[email protected]>
date: Mon Dec 3 09:34:52 EST 2007
Fixed intra-frame prediction (added sign)
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -224,7 +224,8 @@
{
int i,j;
int best=0;
- float best_score=-1e15;
+ float best_score=0;
+ float s = 1;
float E;
for (i=0;i<N0*B-N;i+=B)
{
@@ -236,18 +237,22 @@
xy += x[j]*Y[i+j];
yy += Y[i+j]*Y[i+j];
}
- score = xy*xy/(.1*yy);
+ score = xy*xy/(.001+yy);
if (score > best_score)
{
best_score = score;
best = i;
+ if (xy>0)
+ s = 1;
+ else
+ s = -1;
}
}
- //printf ("%d\n", best);
+ //printf ("%d %f\n", best, best_score);
E = 1e-10;
for (j=0;j<N;j++)
{
- x[j] = Y[best+j];
+ x[j] = s*Y[best+j];
E += x[j]*x[j];
}
E = 1/sqrt(E);