ref: 017d4455da669a536ca2390567b2477dededf5b5
parent: b60340f7e311a6126920afed74661c60d87f9d9d
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 26 11:19:03 EST 2008
pitch gain is now celt_pgain_t
--- a/libcelt/arch.h
+++ b/libcelt/arch.h
@@ -54,6 +54,7 @@
typedef celt_word32_t celt_sig_t;
typedef celt_word16_t celt_norm_t;
typedef celt_word32_t celt_ener_t;
+typedef double celt_pgain_t;
#define Q15ONE 32767
@@ -63,6 +64,8 @@
#define NORM_SCALING_1 0.000061035
#define ENER_SCALING 16384.f
#define ENER_SCALING_1 0.000061035
+#define PGAIN_SCALING 1.f
+#define PGAIN_SCALING_1 1.f
#define VERY_SMALL 0
#define VERY_LARGE32 ((celt_word32_t)2147483647)
@@ -95,6 +98,7 @@
typedef float celt_sig_t;
typedef float celt_norm_t;
typedef float celt_ener_t;
+typedef float celt_pgain_t;
#define Q15ONE 1.0f
@@ -104,6 +108,8 @@
#define NORM_SCALING_1 1.f
#define ENER_SCALING 1.f
#define ENER_SCALING_1 1.f
+#define PGAIN_SCALING 1.f
+#define PGAIN_SCALING_1 1.f
#define VERY_SMALL 1e-15f
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -144,7 +144,7 @@
/* Compute the best gain for each "pitch band" */
-void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains, celt_ener_t *bank)
+void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_pgain_t *gains, celt_ener_t *bank)
{
int i, B;
const int *eBands = m->eBands;
@@ -192,7 +192,7 @@
}
/* Apply the (quantised) gain to each "pitch band" */
-void pitch_quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains)
+void pitch_quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_pgain_t *gains)
{
int i, B;
const int *pBands = m->pBands;
--- a/libcelt/bands.h
+++ b/libcelt/bands.h
@@ -69,9 +69,9 @@
* @param gains Gain computed for each pitch band (returned)
* @param bank Square root of the energy for each band
*/
-void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains, celt_ener_t *bank);
+void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_pgain_t *gains, celt_ener_t *bank);
-void pitch_quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains);
+void pitch_quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_pgain_t *gains);
/** Quantisation/encoding of the residual spectrum
* @param m Mode data
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -231,7 +231,7 @@
VARDECL(celt_norm_t *P);
VARDECL(float *mask);
VARDECL(celt_ener_t *bandE);
- VARDECL(float *gains);
+ VARDECL(celt_pgain_t *gains);
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
@@ -245,7 +245,7 @@
ALLOC(P, B*C*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
ALLOC(mask, B*C*N, float); /**< Masking curve */
ALLOC(bandE,st->mode->nbEBands*C, celt_ener_t);
- ALLOC(gains,st->mode->nbPBands, float);
+ ALLOC(gains,st->mode->nbPBands, celt_pgain_t);
N4 = (N-st->overlap)/2;
@@ -579,7 +579,7 @@
VARDECL(celt_norm_t *X);
VARDECL(celt_norm_t *P);
VARDECL(celt_ener_t *bandE);
- VARDECL(float *gains);
+ VARDECL(celt_pgain_t *gains);
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
@@ -592,7 +592,7 @@
ALLOC(X, C*B*N, celt_norm_t); /**< Interleaved normalised MDCTs */
ALLOC(P, C*B*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
ALLOC(bandE, st->mode->nbEBands*C, celt_ener_t);
- ALLOC(gains, st->mode->nbPBands, float);
+ ALLOC(gains, st->mode->nbPBands, celt_pgain_t);
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
--- a/libcelt/quant_pitch.c
+++ b/libcelt/quant_pitch.c
@@ -62,7 +62,7 @@
return best_index;
}
-int quant_pitch(float *gains, int len, ec_enc *enc)
+int quant_pitch(celt_pgain_t *gains, int len, ec_enc *enc)
{
int i, id;
VARDECL(float *g2);
@@ -78,7 +78,7 @@
return id!=0;
}
-int unquant_pitch(float *gains, int len, ec_dec *dec)
+int unquant_pitch(celt_pgain_t *gains, int len, ec_dec *dec)
{
int i, id;
id = ec_dec_uint(dec, 128);
--- a/libcelt/quant_pitch.h
+++ b/libcelt/quant_pitch.h
@@ -32,13 +32,14 @@
#ifndef QUANT_PITCH_H
#define QUANT_PITCH_H
+#include "arch.h"
#include "entenc.h"
#include "entdec.h"
/** If this returns 0, the gain is zero (don't encode the pitch index) */
-int quant_pitch(float *gains, int len, ec_enc *enc);
+int quant_pitch(celt_pgain_t *gains, int len, ec_enc *enc);
/** If this returns 0, the gain is zero (don't decode the pitch index) */
-int unquant_pitch(float *gains, int len, ec_dec *dec);
+int unquant_pitch(celt_pgain_t *gains, int len, ec_dec *dec);
#endif /* QUANT_PITCH_H */