Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <Jean-Marc.Valin@csiro.au>2007-12-03 05:54:30 +0300
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>2007-12-03 05:54:30 +0300
commit4841a0a02b4ad2d9625602ca4d7f5bd63753bc53 (patch)
tree4497b782855aab3d1007bf8273f30202e2ace148 /libcelt/vq.c
parentc4541ae786b4d7f39bca6779fee55225b26307d0 (diff)
Intra-frame prediction
Diffstat (limited to 'libcelt/vq.c')
-rw-r--r--libcelt/vq.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libcelt/vq.c b/libcelt/vq.c
index 7be9144..b45f08f 100644
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -218,3 +218,39 @@ void noise_quant(float *x, int N, int K, float *p)
x[i] *= E;
}
}
+
+/* Finds the right offset into Y and copy it */
+void copy_quant(float *x, int N, int K, float *Y, int B, int N0)
+{
+ int i,j;
+ int best=0;
+ float best_score=-1e15;
+ float E;
+ for (i=0;i<N0*B-N;i+=B)
+ {
+ int j;
+ float xy=0, yy=0;
+ float score;
+ for (j=0;j<N;j++)
+ {
+ xy += x[j]*Y[i+j];
+ yy += Y[i+j]*Y[i+j];
+ }
+ score = xy*xy/(.1*yy);
+ if (score > best_score)
+ {
+ best_score = score;
+ best = i;
+ }
+ }
+ //printf ("%d\n", best);
+ E = 1e-10;
+ for (j=0;j<N;j++)
+ {
+ x[j] = Y[best+j];
+ E += x[j]*x[j];
+ }
+ E = 1/sqrt(E);
+ for (j=0;j<N;j++)
+ x[j] *= E;
+}