ref: ba11d78372ef22f240aea5235af3036760abe1fa
parent: 2146e649c84ff7a96ac17d5e07d7828ee5d0a118
author: Jean-Marc Valin <[email protected]>
date: Mon Apr 21 17:59:37 EDT 2008
Passing the mode to the intra prediction functions so the single-channel case can be optimised
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -329,9 +329,9 @@
{
q -= 1;
if (q<0)
- intra_fold(X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], C, eBands[i], eBands[m->nbEBands+1]);
+ intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], eBands[i], eBands[m->nbEBands+1]);
else
- intra_prediction(X+C*eBands[i], W+C*eBands[i], eBands[i+1]-eBands[i], q, norm, P+C*eBands[i], C, eBands[i], enc);
+ intra_prediction(m, X+C*eBands[i], W+C*eBands[i], eBands[i+1]-eBands[i], q, norm, P+C*eBands[i], eBands[i], enc);
}
if (q > 0)
@@ -387,9 +387,9 @@
{
q -= 1;
if (q<0)
- intra_fold(X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], C, eBands[i], eBands[m->nbEBands+1]);
+ intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], eBands[i], eBands[m->nbEBands+1]);
else
- intra_unquant(X+C*eBands[i], eBands[i+1]-eBands[i], q, norm, P+C*eBands[i], C, eBands[i], dec);
+ intra_unquant(m, X+C*eBands[i], eBands[i+1]-eBands[i], q, norm, P+C*eBands[i], eBands[i], dec);
}
if (q > 0)
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -267,7 +267,7 @@
#define MAX_INTRA 32
#define LOG_MAX_INTRA 5
-void intra_prediction(celt_norm_t * restrict x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int C, int N0, ec_enc *enc)
+void intra_prediction(const CELTMode *m, celt_norm_t * restrict x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int N0, ec_enc *enc)
{
int i,j,c;
int best=0;
@@ -280,6 +280,7 @@
int max_pos = N0-N;
celt_word32_t yy=0;
VARDECL(celt_norm_t, Xr);
+ const int C = CHANNELS(m);
SAVE_STACK;
ALLOC(Xr, C*N, celt_norm_t);
@@ -382,7 +383,7 @@
RESTORE_STACK;
}
-void intra_unquant(celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int C, int N0, ec_dec *dec)
+void intra_unquant(const CELTMode *m, celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int N0, ec_dec *dec)
{
int j, c;
int sign;
@@ -390,6 +391,7 @@
int best;
celt_word32_t E;
celt_word16_t pred_gain;
+ const int C = CHANNELS(m);
int max_pos = N0-N;
if (max_pos > MAX_INTRA)
max_pos = MAX_INTRA;
@@ -430,12 +432,13 @@
}
}
-void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int C, int N0, int Nmax)
+void intra_fold(const CELTMode *m, celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int Nmax)
{
int i, j;
celt_word32_t E;
celt_word16_t g;
-
+ const int C = CHANNELS(m);
+
E = EPSILON;
if (N0 >= (Nmax>>1))
{
--- a/libcelt/vq.h
+++ b/libcelt/vq.h
@@ -38,8 +38,8 @@
#include "entenc.h"
#include "entdec.h"
+#include "modes.h"
-
/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of
* the pitch and a combination of pulses such that its norm is still equal
* to 1. This is the function that will typically require the most CPU.
@@ -73,11 +73,11 @@
* @param N0 Number of valid offsets
* @param enc Entropy encoder state
*/
-void intra_prediction(celt_norm_t * restrict x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int B, int N0, ec_enc *enc);
+void intra_prediction(const CELTMode *m, celt_norm_t * restrict x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int N0, ec_enc *enc);
-void intra_unquant(celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_dec *dec);
+void intra_unquant(const CELTMode *m, celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t *P, int N0, ec_dec *dec);
/** Encode the entire band as a "fold" from other parts of the spectrum. No bits required (only use is case of an emergency!) */
-void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t *P, int B, int N0, int Nmax);
+void intra_fold(const CELTMode *m, celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t *P, int N0, int Nmax);
#endif /* VQ_H */