pitch gain is now celt_pgain_t
This commit is contained in:
parent
b60340f7e3
commit
017d4455da
6 changed files with 19 additions and 12 deletions
|
@ -54,6 +54,7 @@ typedef celt_int32_t celt_word32_t;
|
||||||
typedef celt_word32_t celt_sig_t;
|
typedef celt_word32_t celt_sig_t;
|
||||||
typedef celt_word16_t celt_norm_t;
|
typedef celt_word16_t celt_norm_t;
|
||||||
typedef celt_word32_t celt_ener_t;
|
typedef celt_word32_t celt_ener_t;
|
||||||
|
typedef double celt_pgain_t;
|
||||||
|
|
||||||
#define Q15ONE 32767
|
#define Q15ONE 32767
|
||||||
|
|
||||||
|
@ -63,6 +64,8 @@ typedef celt_word32_t celt_ener_t;
|
||||||
#define NORM_SCALING_1 0.000061035
|
#define NORM_SCALING_1 0.000061035
|
||||||
#define ENER_SCALING 16384.f
|
#define ENER_SCALING 16384.f
|
||||||
#define ENER_SCALING_1 0.000061035
|
#define ENER_SCALING_1 0.000061035
|
||||||
|
#define PGAIN_SCALING 1.f
|
||||||
|
#define PGAIN_SCALING_1 1.f
|
||||||
|
|
||||||
#define VERY_SMALL 0
|
#define VERY_SMALL 0
|
||||||
#define VERY_LARGE32 ((celt_word32_t)2147483647)
|
#define VERY_LARGE32 ((celt_word32_t)2147483647)
|
||||||
|
@ -95,6 +98,7 @@ typedef float celt_word32_t;
|
||||||
typedef float celt_sig_t;
|
typedef float celt_sig_t;
|
||||||
typedef float celt_norm_t;
|
typedef float celt_norm_t;
|
||||||
typedef float celt_ener_t;
|
typedef float celt_ener_t;
|
||||||
|
typedef float celt_pgain_t;
|
||||||
|
|
||||||
#define Q15ONE 1.0f
|
#define Q15ONE 1.0f
|
||||||
|
|
||||||
|
@ -104,6 +108,8 @@ typedef float celt_ener_t;
|
||||||
#define NORM_SCALING_1 1.f
|
#define NORM_SCALING_1 1.f
|
||||||
#define ENER_SCALING 1.f
|
#define ENER_SCALING 1.f
|
||||||
#define ENER_SCALING_1 1.f
|
#define ENER_SCALING_1 1.f
|
||||||
|
#define PGAIN_SCALING 1.f
|
||||||
|
#define PGAIN_SCALING_1 1.f
|
||||||
|
|
||||||
|
|
||||||
#define VERY_SMALL 1e-15f
|
#define VERY_SMALL 1e-15f
|
||||||
|
|
|
@ -144,7 +144,7 @@ void denormalise_bands(const CELTMode *m, celt_norm_t *X, celt_sig_t *freq, celt
|
||||||
|
|
||||||
|
|
||||||
/* Compute the best gain for each "pitch band" */
|
/* 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;
|
int i, B;
|
||||||
const int *eBands = m->eBands;
|
const int *eBands = m->eBands;
|
||||||
|
@ -192,7 +192,7 @@ void compute_pitch_gain(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the (quantised) gain to each "pitch band" */
|
/* 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;
|
int i, B;
|
||||||
const int *pBands = m->pBands;
|
const int *pBands = m->pBands;
|
||||||
|
|
|
@ -69,9 +69,9 @@ void denormalise_bands(const CELTMode *m, celt_norm_t *X, celt_sig_t *freq, celt
|
||||||
* @param gains Gain computed for each pitch band (returned)
|
* @param gains Gain computed for each pitch band (returned)
|
||||||
* @param bank Square root of the energy for each band
|
* @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
|
/** Quantisation/encoding of the residual spectrum
|
||||||
* @param m Mode data
|
* @param m Mode data
|
||||||
|
|
|
@ -231,7 +231,7 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
|
||||||
VARDECL(celt_norm_t *P);
|
VARDECL(celt_norm_t *P);
|
||||||
VARDECL(float *mask);
|
VARDECL(float *mask);
|
||||||
VARDECL(celt_ener_t *bandE);
|
VARDECL(celt_ener_t *bandE);
|
||||||
VARDECL(float *gains);
|
VARDECL(celt_pgain_t *gains);
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
if (check_mode(st->mode) != CELT_OK)
|
||||||
return CELT_INVALID_MODE;
|
return CELT_INVALID_MODE;
|
||||||
|
@ -245,7 +245,7 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
|
||||||
ALLOC(P, B*C*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
|
ALLOC(P, B*C*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
|
||||||
ALLOC(mask, B*C*N, float); /**< Masking curve */
|
ALLOC(mask, B*C*N, float); /**< Masking curve */
|
||||||
ALLOC(bandE,st->mode->nbEBands*C, celt_ener_t);
|
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;
|
N4 = (N-st->overlap)/2;
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm
|
||||||
VARDECL(celt_norm_t *X);
|
VARDECL(celt_norm_t *X);
|
||||||
VARDECL(celt_norm_t *P);
|
VARDECL(celt_norm_t *P);
|
||||||
VARDECL(celt_ener_t *bandE);
|
VARDECL(celt_ener_t *bandE);
|
||||||
VARDECL(float *gains);
|
VARDECL(celt_pgain_t *gains);
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
if (check_mode(st->mode) != CELT_OK)
|
||||||
return CELT_INVALID_MODE;
|
return CELT_INVALID_MODE;
|
||||||
|
@ -592,7 +592,7 @@ int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm
|
||||||
ALLOC(X, C*B*N, celt_norm_t); /**< Interleaved normalised 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(P, C*B*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
|
||||||
ALLOC(bandE, st->mode->nbEBands*C, celt_ener_t);
|
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)
|
if (check_mode(st->mode) != CELT_OK)
|
||||||
return CELT_INVALID_MODE;
|
return CELT_INVALID_MODE;
|
||||||
|
|
|
@ -62,7 +62,7 @@ int vq_index(float *in, const float *codebook, int len, int entries)
|
||||||
return best_index;
|
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;
|
int i, id;
|
||||||
VARDECL(float *g2);
|
VARDECL(float *g2);
|
||||||
|
@ -78,7 +78,7 @@ int quant_pitch(float *gains, int len, ec_enc *enc)
|
||||||
return id!=0;
|
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;
|
int i, id;
|
||||||
id = ec_dec_uint(dec, 128);
|
id = ec_dec_uint(dec, 128);
|
||||||
|
|
|
@ -32,13 +32,14 @@
|
||||||
#ifndef QUANT_PITCH_H
|
#ifndef QUANT_PITCH_H
|
||||||
#define QUANT_PITCH_H
|
#define QUANT_PITCH_H
|
||||||
|
|
||||||
|
#include "arch.h"
|
||||||
#include "entenc.h"
|
#include "entenc.h"
|
||||||
#include "entdec.h"
|
#include "entdec.h"
|
||||||
|
|
||||||
/** If this returns 0, the gain is zero (don't encode the pitch index) */
|
/** 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) */
|
/** 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 */
|
#endif /* QUANT_PITCH_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue