Commit 18ddc02a authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Separating types for normalised vs. denormalised data paths

parent 14806ab9
......@@ -88,11 +88,14 @@ typedef celt_int32_t celt_word32_t;
#endif
#else
#else /* FIXED_POINT */
typedef float celt_word16_t;
typedef float celt_word32_t;
typedef float celt_sig_t;
typedef float celt_norm_t;
#define Q15ONE 1.0f
#define LPC_SCALING 1.f
#define SIG_SCALING 1.f
......@@ -163,7 +166,7 @@ typedef float celt_word32_t;
#define PDIV32(a,b) (((celt_word32_t)(a))/(celt_word32_t)(b))
#endif
#endif /* !FIXED_POINT */
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
......@@ -173,14 +176,14 @@ typedef float celt_word32_t;
#define BITS_PER_CHAR 16
#define LOG2_BITS_PER_CHAR 4
#else
#else /* CONFIG_TI_C54X */
#define BYTES_PER_CHAR 1
#define BITS_PER_CHAR 8
#define LOG2_BITS_PER_CHAR 3
#endif
#endif /* !CONFIG_TI_C54X */
#endif
#endif /* ARCH_H */
......@@ -42,7 +42,7 @@
/** Applies a series of rotations so that pulses are spread like a two-sided
exponential. The effect of this is to reduce the tonal noise created by the
sparse spectrum resulting from the pulse codebook */
static void exp_rotation(float *X, int len, float theta, int dir, int stride, int iter)
static void exp_rotation(celt_norm_t *X, int len, float theta, int dir, int stride, int iter)
{
int i, k;
float c, s;
......@@ -70,7 +70,7 @@ static void exp_rotation(float *X, int len, float theta, int dir, int stride, in
}
/* Compute the amplitude (sqrt energy) in each of the bands */
void compute_band_energies(const CELTMode *m, float *X, float *bank)
void compute_band_energies(const CELTMode *m, celt_sig_t *X, float *bank)
{
int i, c, B, C;
const int *eBands = m->eBands;
......@@ -92,7 +92,7 @@ void compute_band_energies(const CELTMode *m, float *X, float *bank)
}
/* Normalise each band such that the energy is one. */
void normalise_bands(const CELTMode *m, float *X, float *bank)
void normalise_bands(const CELTMode *m, celt_sig_t *freq, celt_norm_t *X, float *bank)
{
int i, c, B, C;
const int *eBands = m->eBands;
......@@ -105,23 +105,24 @@ void normalise_bands(const CELTMode *m, float *X, float *bank)
int j;
float g = 1.f/(1e-10+bank[i*C+c]);
for (j=B*eBands[i];j<B*eBands[i+1];j++)
X[j*C+c] *= g;
X[j*C+c] = freq[j*C+c]*g;
}
}
for (i=B*C*eBands[m->nbEBands];i<B*C*eBands[m->nbEBands+1];i++)
X[i] = 0;
}
void renormalise_bands(const CELTMode *m, float *X)
void renormalise_bands(const CELTMode *m, celt_norm_t *X)
{
VARDECL(float *tmpE);
ALLOC(tmpE, m->nbEBands*m->nbChannels, float);
compute_band_energies(m, X, tmpE);
normalise_bands(m, X, tmpE);
/* FIXME: This isn't right */
normalise_bands(m, X, X, tmpE);
}
/* De-normalise the energy to produce the synthesis from the unit-energy bands */
void denormalise_bands(const CELTMode *m, float *X, float *bank)
void denormalise_bands(const CELTMode *m, celt_norm_t *X, celt_sig_t *freq, float *bank)
{
int i, c, B, C;
const int *eBands = m->eBands;
......@@ -134,16 +135,16 @@ void denormalise_bands(const CELTMode *m, float *X, float *bank)
int j;
float g = bank[i*C+c];
for (j=B*eBands[i];j<B*eBands[i+1];j++)
X[j*C+c] *= g;
freq[j*C+c] = X[j*C+c] * g;
}
}
for (i=B*C*eBands[m->nbEBands];i<B*C*eBands[m->nbEBands+1];i++)
X[i] = 0;
freq[i] = 0;
}
/* Compute the best gain for each "pitch band" */
void compute_pitch_gain(const CELTMode *m, float *X, float *P, float *gains, float *bank)
void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains, float *bank)
{
int i, B;
const int *eBands = m->eBands;
......@@ -191,7 +192,7 @@ void compute_pitch_gain(const CELTMode *m, float *X, float *P, float *gains, flo
}
/* Apply the (quantised) gain to each "pitch band" */
void pitch_quant_bands(const CELTMode *m, float *X, float *P, float *gains)
void pitch_quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains)
{
int i, B;
const int *pBands = m->pBands;
......@@ -209,18 +210,18 @@ void pitch_quant_bands(const CELTMode *m, float *X, float *P, float *gains)
/* Quantisation of the residual */
void quant_bands(const CELTMode *m, float *X, float *P, float *W, int total_bits, ec_enc *enc)
void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *W, int total_bits, ec_enc *enc)
{
int i, j, B, bits;
const int *eBands = m->eBands;
float alpha = .7;
VARDECL(float *norm);
VARDECL(celt_norm_t *norm);
VARDECL(int *pulses);
VARDECL(int *offsets);
B = m->nbMdctBlocks*m->nbChannels;
ALLOC(norm, B*eBands[m->nbEBands+1], float);
ALLOC(norm, B*eBands[m->nbEBands+1], celt_norm_t);
ALLOC(pulses, m->nbEBands, int);
ALLOC(offsets, m->nbEBands, int);
......@@ -271,18 +272,18 @@ void quant_bands(const CELTMode *m, float *X, float *P, float *W, int total_bits
}
/* Decoding of the residual */
void unquant_bands(const CELTMode *m, float *X, float *P, int total_bits, ec_dec *dec)
void unquant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, int total_bits, ec_dec *dec)
{
int i, j, B, bits;
const int *eBands = m->eBands;
float alpha = .7;
VARDECL(float *norm);
VARDECL(celt_norm_t *norm);
VARDECL(int *pulses);
VARDECL(int *offsets);
B = m->nbMdctBlocks*m->nbChannels;
ALLOC(norm, B*eBands[m->nbEBands+1], float);
ALLOC(norm, B*eBands[m->nbEBands+1], celt_norm_t);
ALLOC(pulses, m->nbEBands, int);
ALLOC(offsets, m->nbEBands, int);
......@@ -326,7 +327,7 @@ void unquant_bands(const CELTMode *m, float *X, float *P, int total_bits, ec_dec
X[i] = 0;
}
void stereo_mix(const CELTMode *m, float *X, float *bank, int dir)
void stereo_mix(const CELTMode *m, celt_norm_t *X, float *bank, int dir)
{
int i, B, C;
const int *eBands = m->eBands;
......
......@@ -32,7 +32,7 @@
#ifndef BANDS_H
#define BANDS_H
#include "arch.h"
#include "modes.h"
#include "entenc.h"
#include "entdec.h"
......@@ -43,7 +43,7 @@
* @param X Spectrum
* @param bands Square root of the energy for each band (returned)
*/
void compute_band_energies(const CELTMode *m, float *X, float *bands);
void compute_band_energies(const CELTMode *m, celt_sig_t *X, float *bands);
/** Normalise each band of X such that the energy in each band is
equal to 1
......@@ -51,16 +51,16 @@ void compute_band_energies(const CELTMode *m, float *X, float *bands);
* @param X Spectrum (returned normalised)
* @param bands Square root of the energy for each band
*/
void normalise_bands(const CELTMode *m, float *X, float *bands);
void normalise_bands(const CELTMode *m, celt_sig_t *freq, celt_norm_t *X, float *bands);
void renormalise_bands(const CELTMode *m, float *X);
void renormalise_bands(const CELTMode *m, celt_norm_t *X);
/** Denormalise each band of X to restore full amplitude
* @param m Mode data
* @param X Spectrum (returned de-normalised)
* @param bands Square root of the energy for each band
*/
void denormalise_bands(const CELTMode *m, float *X, float *bands);
void denormalise_bands(const CELTMode *m, celt_norm_t *X, celt_sig_t *freq, float *bands);
/** Compute the pitch predictor gain for each pitch band
* @param m Mode data
......@@ -69,9 +69,9 @@ void denormalise_bands(const CELTMode *m, float *X, float *bands);
* @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, float *X, float *P, float *gains, float *bank);
void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains, float *bank);
void pitch_quant_bands(const CELTMode *m, float *X, float *P, float *gains);
void pitch_quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *gains);
/** Quantisation/encoding of the residual spectrum
* @param m Mode data
......@@ -81,7 +81,7 @@ void pitch_quant_bands(const CELTMode *m, float *X, float *P, float *gains);
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
* @param enc Entropy encoder
*/
void quant_bands(const CELTMode *m, float *X, float *P, float *W, int total_bits, ec_enc *enc);
void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *W, int total_bits, ec_enc *enc);
/** Decoding of the residual spectrum
* @param m Mode data
......@@ -90,8 +90,8 @@ void quant_bands(const CELTMode *m, float *X, float *P, float *W, int total_bits
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
* @param dec Entropy decoder
*/
void unquant_bands(const CELTMode *m, float *X, float *P, int total_bits, ec_dec *dec);
void unquant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, int total_bits, ec_dec *dec);
void stereo_mix(const CELTMode *m, float *X, float *bank, int dir);
void stereo_mix(const CELTMode *m, celt_norm_t *X, float *bank, int dir);
#endif /* BANDS_H */
......@@ -76,9 +76,9 @@ struct CELTEncoder {
struct PsyDecay psy;
float *window;
float *in_mem;
float *mdct_overlap;
float *out_mem;
celt_sig_t *in_mem;
celt_sig_t *mdct_overlap;
celt_sig_t *out_mem;
float *oldBandE;
};
......@@ -113,9 +113,9 @@ CELTEncoder *celt_encoder_create(const CELTMode *mode)
psydecay_init(&st->psy, MAX_PERIOD*C/2, st->mode->Fs);
st->window = celt_alloc(2*N*sizeof(float));
st->in_mem = celt_alloc(N*C*sizeof(float));
st->mdct_overlap = celt_alloc(N*C*sizeof(float));
st->out_mem = celt_alloc(MAX_PERIOD*C*sizeof(float));
st->in_mem = celt_alloc(N*C*sizeof(celt_sig_t));
st->mdct_overlap = celt_alloc(N*C*sizeof(celt_sig_t));
st->out_mem = celt_alloc(MAX_PERIOD*C*sizeof(celt_sig_t));
for (i=0;i<2*N;i++)
st->window[i] = 0;
for (i=0;i<st->overlap;i++)
......@@ -162,14 +162,14 @@ void celt_encoder_destroy(CELTEncoder *st)
}
/** Apply window and compute the MDCT for all sub-frames and all channels in a frame */
static float compute_mdcts(mdct_lookup *mdct_lookup, float *window, float *in, float *out, int N, int B, int C)
static float compute_mdcts(mdct_lookup *mdct_lookup, float *window, celt_sig_t *in, celt_sig_t *out, int N, int B, int C)
{
int i, c;
float E = 1e-15;
VARDECL(float *x);
VARDECL(float *tmp);
ALLOC(x, 2*N, float);
ALLOC(tmp, N, float);
VARDECL(celt_sig_t *x);
VARDECL(celt_sig_t *tmp);
ALLOC(x, 2*N, celt_sig_t);
ALLOC(tmp, N, celt_sig_t);
for (c=0;c<C;c++)
{
for (i=0;i<B;i++)
......@@ -190,13 +190,13 @@ static float compute_mdcts(mdct_lookup *mdct_lookup, float *window, float *in, f
}
/** Compute the IMDCT and apply window for all sub-frames and all channels in a frame */
static void compute_inv_mdcts(mdct_lookup *mdct_lookup, float *window, float *X, float *out_mem, float *mdct_overlap, int N, int overlap, int B, int C)
static void compute_inv_mdcts(mdct_lookup *mdct_lookup, float *window, celt_sig_t *X, celt_sig_t *out_mem, celt_sig_t *mdct_overlap, int N, int overlap, int B, int C)
{
int i, c, N4;
VARDECL(float *x);
VARDECL(float *tmp);
ALLOC(x, 2*N, float);
ALLOC(tmp, N, float);
VARDECL(celt_sig_t *x);
VARDECL(celt_sig_t *tmp);
ALLOC(x, 2*N, celt_sig_t);
ALLOC(tmp, N, celt_sig_t);
N4 = (N-overlap)/2;
for (c=0;c<C;c++)
{
......@@ -225,9 +225,10 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
int has_pitch;
int pitch_index;
float curr_power, pitch_power;
VARDECL(float *in);
VARDECL(float *X);
VARDECL(float *P);
VARDECL(celt_sig_t *in);
VARDECL(celt_sig_t *freq);
VARDECL(celt_norm_t *X);
VARDECL(celt_norm_t *P);
VARDECL(float *mask);
VARDECL(float *bandE);
VARDECL(float *gains);
......@@ -238,9 +239,10 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
N = st->block_size;
B = st->nb_blocks;
C = st->mode->nbChannels;
ALLOC(in, (B+1)*C*N, float);
ALLOC(X, B*C*N, float); /**< Interleaved signal MDCTs */
ALLOC(P, B*C*N, float); /**< Interleaved pitch MDCTs*/
ALLOC(in, (B+1)*C*N, celt_sig_t);
ALLOC(freq, B*C*N, celt_sig_t); /**< Interleaved signal MDCTs */
ALLOC(X, B*C*N, celt_norm_t); /**< Interleaved normalised MDCTs */
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, float);
ALLOC(gains,st->mode->nbPBands, float);
......@@ -266,7 +268,7 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
}
/*for (i=0;i<(B+1)*C*N;i++) printf ("%f(%d) ", in[i], i); printf ("\n");*/
/* Compute MDCTs */
curr_power = compute_mdcts(&st->mdct_lookup, st->window, in, X, N, B, C);
curr_power = compute_mdcts(&st->mdct_lookup, st->window, in, freq, N, B, C);
#if 0 /* Mask disabled until it can be made to do something useful */
compute_mdct_masking(X, mask, B*C*N, st->Fs);
......@@ -291,9 +293,6 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
}
find_spectral_pitch(st->fft, &st->psy, in, st->out_mem, MAX_PERIOD, (B+1)*N, C, &pitch_index);
/* Compute MDCTs of the pitch part */
pitch_power = compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, P, N, B, C);
/*printf ("%f %f\n", curr_power, pitch_power);*/
/*int j;
for (j=0;j<B*N;j++)
......@@ -303,11 +302,15 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
printf ("\n");*/
/* Band normalisation */
compute_band_energies(st->mode, X, bandE);
normalise_bands(st->mode, X, bandE);
compute_band_energies(st->mode, freq, bandE);
normalise_bands(st->mode, freq, X, bandE);
/*for (i=0;i<st->mode->nbEBands;i++)printf("%f ", bandE[i]);printf("\n");*/
/*for (i=0;i<N*B*C;i++)printf("%f ", X[i]);printf("\n");*/
/* Compute MDCTs of the pitch part */
pitch_power = compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, freq, N, B, C);
quant_energy(st->mode, bandE, st->oldBandE, nbCompressedBytes*8/3, &st->enc);
if (C==2)
......@@ -321,8 +324,8 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
/* Normalise the pitch vector as well (discard the energies) */
VARDECL(float *bandEp);
ALLOC(bandEp, st->mode->nbEBands*st->mode->nbChannels, float);
compute_band_energies(st->mode, P, bandEp);
normalise_bands(st->mode, P, bandEp);
compute_band_energies(st->mode, freq, bandEp);
normalise_bands(st->mode, freq, P, bandEp);
if (C==2)
stereo_mix(st->mode, P, bandE, 1);
......@@ -360,16 +363,17 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
quant_bands(st->mode, X, P, mask, nbCompressedBytes*8, &st->enc);
if (C==2)
{
stereo_mix(st->mode, X, bandE, -1);
renormalise_bands(st->mode, X);
renormalise_bands(st->mode, X);
}
/* Synthesis */
denormalise_bands(st->mode, X, bandE);
denormalise_bands(st->mode, X, freq, bandE);
CELT_MOVE(st->out_mem, st->out_mem+C*B*N, C*(MAX_PERIOD-B*N));
compute_inv_mdcts(&st->mdct_lookup, st->window, X, st->out_mem, st->mdct_overlap, N, st->overlap, B, C);
compute_inv_mdcts(&st->mdct_lookup, st->window, freq, st->out_mem, st->mdct_overlap, N, st->overlap, B, C);
/* De-emphasis and put everything back at the right place in the synthesis history */
for (c=0;c<C;c++)
{
......@@ -449,8 +453,8 @@ struct CELTDecoder {
mdct_lookup mdct_lookup;
float *window;
float *mdct_overlap;
float *out_mem;
celt_sig_t *mdct_overlap;
celt_sig_t *out_mem;
float *oldBandE;
......@@ -481,8 +485,8 @@ CELTDecoder *celt_decoder_create(const CELTMode *mode)
mdct_init(&st->mdct_lookup, 2*N);
st->window = celt_alloc(2*N*sizeof(float));
st->mdct_overlap = celt_alloc(N*C*sizeof(float));
st->out_mem = celt_alloc(MAX_PERIOD*C*sizeof(float));
st->mdct_overlap = celt_alloc(N*C*sizeof(celt_sig_t));
st->out_mem = celt_alloc(MAX_PERIOD*C*sizeof(celt_sig_t));
for (i=0;i<2*N;i++)
st->window[i] = 0;
......@@ -530,20 +534,20 @@ static void celt_decode_lost(CELTDecoder *st, short *pcm)
{
int i, c, N, B, C;
int pitch_index;
VARDECL(float *X);
VARDECL(celt_sig_t *freq);
N = st->block_size;
B = st->nb_blocks;
C = st->mode->nbChannels;
ALLOC(X,C*B*N, float); /**< Interleaved signal MDCTs */
ALLOC(freq,C*B*N, celt_sig_t); /**< Interleaved signal MDCTs */
pitch_index = st->last_pitch_index;
/* Use the pitch MDCT as the "guessed" signal */
compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, X, N, B, C);
compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, freq, N, B, C);
CELT_MOVE(st->out_mem, st->out_mem+C*B*N, C*(MAX_PERIOD-B*N));
/* Compute inverse MDCTs */
compute_inv_mdcts(&st->mdct_lookup, st->window, X, st->out_mem, st->mdct_overlap, N, st->overlap, B, C);
compute_inv_mdcts(&st->mdct_lookup, st->window, freq, st->out_mem, st->mdct_overlap, N, st->overlap, B, C);
for (c=0;c<C;c++)
{
......@@ -569,8 +573,9 @@ int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm
int pitch_index;
ec_dec dec;
ec_byte_buffer buf;
VARDECL(float *X);
VARDECL(float *P);
VARDECL(celt_sig_t *freq);
VARDECL(celt_norm_t *X);
VARDECL(celt_norm_t *P);
VARDECL(float *bandE);
VARDECL(float *gains);
......@@ -581,8 +586,9 @@ int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm
B = st->nb_blocks;
C = st->mode->nbChannels;
ALLOC(X, C*B*N, float); /**< Interleaved signal MDCTs */
ALLOC(P, C*B*N, float); /**< Interleaved pitch MDCTs*/
ALLOC(freq, C*B*N, celt_sig_t); /**< Interleaved signal MDCTs */
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, float);
ALLOC(gains, st->mode->nbPBands, float);
......@@ -614,13 +620,13 @@ int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm
}
/* Pitch MDCT */
compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, P, N, B, C);
compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, freq, N, B, C);
{
VARDECL(float *bandEp);
ALLOC(bandEp, st->mode->nbEBands*C, float);
compute_band_energies(st->mode, P, bandEp);
normalise_bands(st->mode, P, bandEp);
compute_band_energies(st->mode, freq, bandEp);
normalise_bands(st->mode, freq, P, bandEp);
}
if (C==2)
......@@ -633,17 +639,17 @@ int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm
unquant_bands(st->mode, X, P, len*8, &dec);
if (C==2)
{
stereo_mix(st->mode, X, bandE, -1);
renormalise_bands(st->mode, X);
renormalise_bands(st->mode, X);
}
/* Synthesis */
denormalise_bands(st->mode, X, bandE);
denormalise_bands(st->mode, X, freq, bandE);
CELT_MOVE(st->out_mem, st->out_mem+C*B*N, C*(MAX_PERIOD-B*N));
/* Compute inverse MDCTs */
compute_inv_mdcts(&st->mdct_lookup, st->window, X, st->out_mem, st->mdct_overlap, N, st->overlap, B, C);
compute_inv_mdcts(&st->mdct_lookup, st->window, freq, st->out_mem, st->mdct_overlap, N, st->overlap, B, C);
for (c=0;c<C;c++)
{
......
......@@ -70,7 +70,7 @@ struct NBest {
float yp;
};
void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc *enc)
void alg_quant(celt_norm_t *x, float *W, int N, int K, celt_norm_t *p, float alpha, ec_enc *enc)
{
int L = 3;
VARDECL(float *_y);
......@@ -306,7 +306,7 @@ void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc *
/** Decode pulse vector and combine the result with the pitch vector to produce
the final normalised signal in the current band. */
void alg_unquant(float *x, int N, int K, float *p, float alpha, ec_dec *dec)
void alg_unquant(celt_norm_t *x, int N, int K, celt_norm_t *p, float alpha, ec_dec *dec)
{
int i;
float Rpp=0, Ryp=0, Ryy=0;
......@@ -347,7 +347,7 @@ void alg_unquant(float *x, int N, int K, float *p, float alpha, ec_dec *dec)
static const float pg[11] = {1.f, .75f, .65f, 0.6f, 0.6f, .6f, .55f, .55f, .5f, .5f, .5f};
void intra_prediction(float *x, float *W, int N, int K, float *Y, float *P, int B, int N0, ec_enc *enc)
void intra_prediction(celt_norm_t *x, float *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc)
{
int i,j;
int best=0;
......@@ -416,7 +416,7 @@ void intra_prediction(float *x, float *W, int N, int K, float *Y, float *P, int
}
void intra_unquant(float *x, int N, int K, float *Y, float *P, int B, int N0, ec_dec *dec)
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)
{
int j;
int sign;
......@@ -457,7 +457,7 @@ void intra_unquant(float *x, int N, int K, float *Y, float *P, int B, int N0, ec
}
}
void intra_fold(float *x, int N, float *Y, float *P, int B, int N0, int Nmax)
void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t *P, int B, int N0, int Nmax)
{
int i, j;
float E;
......
......@@ -51,7 +51,7 @@
* @param alpha compression factor to apply in the pitch direction (magic!)
* @param enc Entropy encoder state
*/
void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc *enc);
void alg_quant(celt_norm_t *x, float *W, int N, int K, celt_norm_t *p, float alpha, ec_enc *enc);
/** Algebraic pulse decoder
* @param x Decoded normalised spectrum (returned)
......@@ -61,7 +61,7 @@ void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc *
* @param alpha compression factor in the pitch direction (magic!)
* @param dec Entropy decoder state
*/
void alg_unquant(float *x, int N, int K, float *p, float alpha, ec_dec *dec);
void alg_unquant(celt_norm_t *x, int N, int K, celt_norm_t *p, float alpha, ec_dec *dec);
/** Intra-frame predictor that matches a section of the current frame (at lower
* frequencies) to encode the current band.
......@@ -75,11 +75,11 @@ void alg_unquant(float *x, int N, int K, float *p, float alpha, ec_dec *dec);
* @param N0 Number of valid offsets
* @param enc Entropy encoder state
*/
void intra_prediction(float *x, float *W, int N, int K, float *Y, float *P, int B, int N0, ec_enc *enc);
void intra_prediction(celt_norm_t *x, float *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc);
void intra_unquant(float *x, int N, int K, float *Y, float *P, int B, int N0, ec_dec *dec);
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);
/** 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(float *x, int N, float *Y, float *P, int B, int N0, int Nmax);
void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t *P, int B, int N0, int Nmax);
#endif /* VQ_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment