added a "cc6_" prior to all file names, functions and global variables
This commit is contained in:
parent
fdbcc7ac3c
commit
b518f0cd96
12 changed files with 291 additions and 291 deletions
|
@ -665,7 +665,7 @@ int cc6_celt_encode_float(cc6_CELTEncoder * __restrict st, const cc6_celt_sig_t
|
|||
|
||||
cc6_compute_band_energies(st->mode, freq, bandE);
|
||||
for (i=0;i<st->mode->nbEBands*C;i++)
|
||||
bandLogE[i] = amp2Log(bandE[i]);
|
||||
bandLogE[i] = cc6_amp2Log(bandE[i]);
|
||||
|
||||
/* Don't use intra energy when we're operating at low bit-rate */
|
||||
intra_ener = st->force_intra || (st->delayedIntra && nbCompressedBytes > st->mode->nbEBands);
|
||||
|
|
|
@ -35,19 +35,19 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _PITCH_H
|
||||
#define _PITCH_H
|
||||
#ifndef cc6__PITCH_H
|
||||
#define cc6__PITCH_H
|
||||
|
||||
#include "cc6_kiss_fftr.h"
|
||||
#include "cc6_psy.h"
|
||||
#include "cc6_modes.h"
|
||||
|
||||
kiss_fftr_cfg pitch_state_alloc(int max_lag);
|
||||
void pitch_state_free(kiss_fftr_cfg st);
|
||||
cc6_kiss_fftr_cfg cc6_pitch_state_alloc(int max_lag);
|
||||
void cc6_pitch_state_free(cc6_kiss_fftr_cfg st);
|
||||
|
||||
/** Find the optimal delay for the pitch prediction. Computation is
|
||||
done in the frequency domain, both to save time and to make it
|
||||
easier to apply psychoacoustic weighting */
|
||||
void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t *x, const celt_sig_t *y, const celt_word16_t *window, celt_word16_t * __restrict X, int len, int max_pitch, int *pitch);
|
||||
void cc6_find_spectral_pitch(const cc6_CELTMode *m, cc6_kiss_fftr_cfg fft, const struct cc6_PsyDecay *decay, const cc6_celt_sig_t *x, const cc6_celt_sig_t *y, const cc6_celt_word16_t *window, cc6_celt_word16_t * __restrict X, int len, int max_pitch, int *pitch);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,29 +28,29 @@
|
|||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef PSY_H
|
||||
#define PSY_H
|
||||
#ifndef cc6_PSY_H
|
||||
#define cc6_PSY_H
|
||||
|
||||
#include "cc6_arch.h"
|
||||
#include "cc6_celt.h"
|
||||
|
||||
struct PsyDecay {
|
||||
/*celt_word16_t *decayL;*/
|
||||
const celt_word16_t * __restrict decayR;
|
||||
struct cc6_PsyDecay {
|
||||
/*cc6_celt_word16_t *decayL;*/
|
||||
const cc6_celt_word16_t * __restrict decayR;
|
||||
};
|
||||
|
||||
/** Pre-compute the decay of the psycho-acoustic spreading function */
|
||||
void psydecay_init(struct PsyDecay *decay, int len, celt_int32_t Fs);
|
||||
void cc6_psydecay_init(struct cc6_PsyDecay *decay, int len, cc6_celt_int32_t Fs);
|
||||
|
||||
/** Free the memory allocated for the spreading function */
|
||||
void psydecay_clear(struct PsyDecay *decay);
|
||||
void cc6_psydecay_clear(struct cc6_PsyDecay *decay);
|
||||
|
||||
/** Compute the masking curve for an input (DFT) spectrum X */
|
||||
void compute_masking(const struct PsyDecay *decay, celt_word16_t *X, celt_mask_t *mask, int len);
|
||||
void cc6_compute_masking(const struct cc6_PsyDecay *decay, cc6_celt_word16_t *X, cc6_celt_mask_t *mask, int len);
|
||||
|
||||
/** Compute the masking curve for an input (MDCT) spectrum X */
|
||||
void compute_mdct_masking(const struct PsyDecay *decay, celt_word32_t *X, celt_word16_t *tonality, celt_word16_t *long_window, celt_mask_t *mask, int len);
|
||||
void cc6_compute_mdct_masking(const struct cc6_PsyDecay *decay, cc6_celt_word32_t *X, cc6_celt_word16_t *tonality, cc6_celt_word16_t *long_window, cc6_celt_mask_t *mask, int len);
|
||||
|
||||
void compute_tonality(const CELTMode *m, celt_word16_t * __restrict X, celt_word16_t * mem, int len, celt_word16_t *tonality, int mdct_size);
|
||||
void cc6_compute_tonality(const cc6_CELTMode *m, cc6_celt_word16_t * __restrict X, cc6_celt_word16_t * mem, int len, cc6_celt_word16_t *tonality, int mdct_size);
|
||||
|
||||
#endif /* PSY_H */
|
||||
#endif /* cc6_PSY_H */
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef QUANT_BANDS
|
||||
#define QUANT_BANDS
|
||||
#ifndef cc6_QUANT_BANDS
|
||||
#define cc6_QUANT_BANDS
|
||||
|
||||
#include "cc6_arch.h"
|
||||
#include "cc6_modes.h"
|
||||
|
@ -38,33 +38,33 @@
|
|||
#include "cc6_entdec.h"
|
||||
#include "cc6_mathops.h"
|
||||
|
||||
static __inline celt_word16_t amp2Log(celt_word32_t amp)
|
||||
static __inline cc6_celt_word16_t cc6_amp2Log(cc6_celt_word32_t amp)
|
||||
{
|
||||
return celt_log2(MAX32(QCONST32(.001f,14),SHL32(amp,2)));
|
||||
return cc6_celt_log2(cc6_MAX32(cc6_QCONST32(.001f,14),cc6_SHL32(amp,2)));
|
||||
}
|
||||
|
||||
static __inline celt_word32_t log2Amp(celt_word16_t lg)
|
||||
static __inline cc6_celt_word32_t cc6_log2Amp(cc6_celt_word16_t lg)
|
||||
{
|
||||
return PSHR32(celt_exp2(SHL16(lg,3)),4);
|
||||
return cc6_PSHR32(cc6_celt_exp2(cc6_SHL16(lg,3)),4);
|
||||
}
|
||||
|
||||
int *quant_prob_alloc(const CELTMode *m);
|
||||
void quant_prob_free(int *freq);
|
||||
int *cc6_quant_prob_alloc(const cc6_CELTMode *m);
|
||||
void cc6_quant_prob_free(int *freq);
|
||||
|
||||
void compute_fine_allocation(const CELTMode *m, int *bits, int budget);
|
||||
void cc6_compute_fine_allocation(const cc6_CELTMode *m, int *bits, int budget);
|
||||
|
||||
int intra_decision(celt_word16_t *eBands, celt_word16_t *oldEBands, int len);
|
||||
int cc6_intra_decision(cc6_celt_word16_t *eBands, cc6_celt_word16_t *oldEBands, int len);
|
||||
|
||||
unsigned quant_coarse_energy(const CELTMode *m, celt_word16_t *eBands, celt_word16_t *oldEBands, int budget, int intra, int *prob, celt_word16_t *error, ec_enc *enc);
|
||||
unsigned cc6_quant_coarse_energy(const cc6_CELTMode *m, cc6_celt_word16_t *eBands, cc6_celt_word16_t *oldEBands, int budget, int intra, int *prob, cc6_celt_word16_t *error, cc6_ec_enc *enc);
|
||||
|
||||
void quant_fine_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, celt_word16_t *error, int *fine_quant, ec_enc *enc);
|
||||
void cc6_quant_fine_energy(const cc6_CELTMode *m, cc6_celt_ener_t *eBands, cc6_celt_word16_t *oldEBands, cc6_celt_word16_t *error, int *fine_quant, cc6_ec_enc *enc);
|
||||
|
||||
void quant_energy_finalise(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, celt_word16_t *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc);
|
||||
void cc6_quant_energy_finalise(const cc6_CELTMode *m, cc6_celt_ener_t *eBands, cc6_celt_word16_t *oldEBands, cc6_celt_word16_t *error, int *fine_quant, int *fine_priority, int bits_left, cc6_ec_enc *enc);
|
||||
|
||||
void unquant_coarse_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int budget, int intra, int *prob, ec_dec *dec);
|
||||
void cc6_unquant_coarse_energy(const cc6_CELTMode *m, cc6_celt_ener_t *eBands, cc6_celt_word16_t *oldEBands, int budget, int intra, int *prob, cc6_ec_dec *dec);
|
||||
|
||||
void unquant_fine_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int *fine_quant, ec_dec *dec);
|
||||
void cc6_unquant_fine_energy(const cc6_CELTMode *m, cc6_celt_ener_t *eBands, cc6_celt_word16_t *oldEBands, int *fine_quant, cc6_ec_dec *dec);
|
||||
|
||||
void unquant_energy_finalise(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec);
|
||||
void cc6_unquant_energy_finalise(const cc6_CELTMode *m, cc6_celt_ener_t *eBands, cc6_celt_word16_t *oldEBands, int *fine_quant, int *fine_priority, int bits_left, cc6_ec_dec *dec);
|
||||
|
||||
#endif /* QUANT_BANDS */
|
||||
#endif /* cc6_QUANT_BANDS */
|
||||
|
|
|
@ -29,32 +29,32 @@
|
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef RATE_H
|
||||
#define RATE_H
|
||||
#ifndef cc6_RATE_H
|
||||
#define cc6_RATE_H
|
||||
|
||||
#define MAX_PULSES 128
|
||||
#define LOG_MAX_PULSES 7
|
||||
#define cc6_MAX_PULSES 128
|
||||
#define cc6_LOG_MAX_PULSES 7
|
||||
|
||||
#define BITRES 4
|
||||
#define BITROUND 8
|
||||
#define BITOVERFLOW 30000
|
||||
#define cc6_BITRES 4
|
||||
#define cc6_BITROUND 8
|
||||
#define cc6_BITOVERFLOW 30000
|
||||
|
||||
#include "cc6_cwrs.h"
|
||||
|
||||
static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, int N, int bits)
|
||||
static __inline int cc6_bits2pulses(const cc6_CELTMode *m, const cc6_celt_int16_t *cache, int N, int bits)
|
||||
{
|
||||
int i;
|
||||
int lo, hi;
|
||||
lo = 0;
|
||||
hi = MAX_PULSES-1;
|
||||
hi = cc6_MAX_PULSES-1;
|
||||
|
||||
#if 0 /* Disabled until we can make that useful */
|
||||
/* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
|
||||
if (bits > cache[MAX_PULSES-1] && N<=4)
|
||||
/* Use of more than cc6_MAX_PULSES is disabled until we are able to cwrs that decently */
|
||||
if (bits > cache[cc6_MAX_PULSES-1] && N<=4)
|
||||
{
|
||||
/*int pulses;
|
||||
pulses = 127;
|
||||
while (16 + log2_frac(2*(pulses+1)*(pulses+1) + 1, 4) <= bits && pulses < 32767)
|
||||
while (16 + cc6_log2_frac(2*(pulses+1)*(pulses+1) + 1, 4) <= bits && pulses < 32767)
|
||||
pulses++;*/
|
||||
lo = 127;
|
||||
switch (N)
|
||||
|
@ -64,7 +64,7 @@ static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, in
|
|||
for (i=0;i<10;i++)
|
||||
{
|
||||
int pulses = (lo+hi)>>1;
|
||||
if (log2_frac(((UMUL16_16(pulses,pulses)>>1)+1)>>1, 4) > bits)
|
||||
if (cc6_log2_frac(((cc6_UMUL16_16(pulses,pulses)>>1)+1)>>1, 4) > bits)
|
||||
hi = pulses;
|
||||
else
|
||||
lo = pulses;
|
||||
|
@ -75,7 +75,7 @@ static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, in
|
|||
for (i=0;i<10;i++)
|
||||
{
|
||||
int pulses = (lo+hi)>>1;
|
||||
if (log2_frac((UMUL32(UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4) > bits)
|
||||
if (cc6_log2_frac((cc6_UMUL32(cc6_UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4) > bits)
|
||||
hi = pulses;
|
||||
else
|
||||
lo = pulses;
|
||||
|
@ -88,7 +88,7 @@ static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, in
|
|||
/* Instead of using the "bisection condition" we use a fixed number of
|
||||
iterations because it should be faster */
|
||||
/*while (hi-lo != 1)*/
|
||||
for (i=0;i<LOG_MAX_PULSES;i++)
|
||||
for (i=0;i<cc6_LOG_MAX_PULSES;i++)
|
||||
{
|
||||
int mid = (lo+hi)>>1;
|
||||
/* OPT: Make sure this is implemented with a conditional move */
|
||||
|
@ -104,19 +104,19 @@ static __inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, in
|
|||
}
|
||||
|
||||
|
||||
static __inline int pulses2bits(const celt_int16_t *cache, int N, int pulses)
|
||||
static __inline int cc6_pulses2bits(const cc6_celt_int16_t *cache, int N, int pulses)
|
||||
{
|
||||
#if 0 /* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
|
||||
#if 0 /* Use of more than cc6_MAX_PULSES is disabled until we are able to cwrs that decently */
|
||||
if (pulses > 127)
|
||||
{
|
||||
int bits;
|
||||
switch (N)
|
||||
{
|
||||
case 3:
|
||||
bits = log2_frac(((UMUL16_16(pulses,pulses)>>1)+1)>>1, 4);
|
||||
bits = cc6_log2_frac(((cc6_UMUL16_16(pulses,pulses)>>1)+1)>>1, 4);
|
||||
break;
|
||||
case 4:
|
||||
bits = log2_frac((UMUL32(UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4);
|
||||
bits = cc6_log2_frac((cc6_UMUL32(cc6_UMUL16_16(pulses,pulses)+2,pulses))/3<<3, 4);
|
||||
break;
|
||||
}
|
||||
/*printf ("%d <- %d\n", bits, pulses);*/
|
||||
|
@ -127,7 +127,7 @@ static __inline int pulses2bits(const celt_int16_t *cache, int N, int pulses)
|
|||
}
|
||||
|
||||
/** Computes a cache of the pulses->bits mapping in each band */
|
||||
celt_int16_t **compute_alloc_cache(CELTMode *m, int C);
|
||||
cc6_celt_int16_t **cc6_compute_alloc_cache(cc6_CELTMode *m, int C);
|
||||
|
||||
/** Compute the pulse allocation, i.e. how many pulses will go in each
|
||||
* band.
|
||||
|
@ -138,7 +138,7 @@ celt_int16_t **compute_alloc_cache(CELTMode *m, int C);
|
|||
@param pulses Number of pulses per band (returned)
|
||||
@return Total number of bits allocated
|
||||
*/
|
||||
void compute_allocation(const CELTMode *m, int *offsets, int total, int *pulses, int *ebits, int *fine_priority);
|
||||
void cc6_compute_allocation(const cc6_CELTMode *m, int *offsets, int total, int *pulses, int *ebits, int *fine_priority);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef STACK_ALLOC_H
|
||||
#define STACK_ALLOC_H
|
||||
#ifndef cc6_STACK_ALLOC_H
|
||||
#define cc6_STACK_ALLOC_H
|
||||
|
||||
#ifdef USE_ALLOCA
|
||||
# ifdef WIN32
|
||||
|
@ -48,7 +48,7 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* @def ALIGN(stack, size)
|
||||
* @def cc6_ALIGN(stack, size)
|
||||
*
|
||||
* Aligns the stack to a 'size' boundary
|
||||
*
|
||||
|
@ -57,7 +57,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @def PUSH(stack, size, type)
|
||||
* @def cc6_PUSH(stack, size, type)
|
||||
*
|
||||
* Allocates 'size' elements of type 'type' on the stack
|
||||
*
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @def VARDECL(var)
|
||||
* @def cc6_VARDECL(var)
|
||||
*
|
||||
* Declare variable on stack
|
||||
*
|
||||
|
@ -75,7 +75,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @def ALLOC(var, size, type)
|
||||
* @def cc6_ALLOC(var, size, type)
|
||||
*
|
||||
* Allocate 'size' elements of 'type' on stack
|
||||
*
|
||||
|
@ -87,26 +87,26 @@
|
|||
|
||||
#if defined(VAR_ARRAYS)
|
||||
|
||||
#define VARDECL(type, var)
|
||||
#define ALLOC(var, size, type) type var[size]
|
||||
#define SAVE_STACK
|
||||
#define RESTORE_STACK
|
||||
#define ALLOC_STACK
|
||||
#define cc6_VARDECL(type, var)
|
||||
#define cc6_ALLOC(var, size, type) type var[size]
|
||||
#define cc6_SAVE_STACK
|
||||
#define cc6_RESTORE_STACK
|
||||
#define cc6_ALLOC_STACK
|
||||
|
||||
#elif defined(USE_ALLOCA)
|
||||
|
||||
#define VARDECL(type, var) type *var
|
||||
#define ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size)))
|
||||
#define SAVE_STACK
|
||||
#define RESTORE_STACK
|
||||
#define ALLOC_STACK
|
||||
#define cc6_VARDECL(type, var) type *var
|
||||
#define cc6_ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size)))
|
||||
#define cc6_SAVE_STACK
|
||||
#define cc6_RESTORE_STACK
|
||||
#define cc6_ALLOC_STACK
|
||||
|
||||
#else
|
||||
|
||||
#ifdef CELT_C
|
||||
char *global_stack=0;
|
||||
char *cc6_global_stack=0;
|
||||
#else
|
||||
extern char *global_stack;
|
||||
extern char *cc6_global_stack;
|
||||
#endif /*CELT_C*/
|
||||
|
||||
#ifdef ENABLE_VALGRIND
|
||||
|
@ -114,31 +114,31 @@ extern char *global_stack;
|
|||
#include <valgrind/memcheck.h>
|
||||
|
||||
#ifdef CELT_C
|
||||
char *global_stack_top=0;
|
||||
char *cc6_global_stack_top=0;
|
||||
#else
|
||||
extern char *global_stack_top;
|
||||
extern char *cc6_global_stack_top;
|
||||
#endif /*CELT_C*/
|
||||
|
||||
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
||||
#define PUSH(stack, size, type) (VALGRIND_MAKE_MEM_NOACCESS(stack, global_stack_top-stack),ALIGN((stack),sizeof(type)/sizeof(char)),VALGRIND_MAKE_MEM_UNDEFINED(stack, ((size)*sizeof(type)/sizeof(char))),(stack)+=(2*(size)*sizeof(type)/sizeof(char)),(type*)((stack)-(2*(size)*sizeof(type)/sizeof(char))))
|
||||
#define RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack))
|
||||
#define ALLOC_STACK ((global_stack = (global_stack==0) ? ((global_stack_top=celt_alloc_scratch(GLOBAL_STACK_SIZE*2)+(GLOBAL_STACK_SIZE*2))-(GLOBAL_STACK_SIZE*2)) : global_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack))
|
||||
#define cc6_ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
||||
#define cc6_PUSH(stack, size, type) (VALGRIND_MAKE_MEM_NOACCESS(stack, cc6_global_stack_top-stack),cc6_ALIGN((stack),sizeof(type)/sizeof(char)),VALGRIND_MAKE_MEM_UNDEFINED(stack, ((size)*sizeof(type)/sizeof(char))),(stack)+=(2*(size)*sizeof(type)/sizeof(char)),(type*)((stack)-(2*(size)*sizeof(type)/sizeof(char))))
|
||||
#define cc6_RESTORE_STACK ((cc6_global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(cc6_global_stack, cc6_global_stack_top-cc6_global_stack))
|
||||
#define cc6_ALLOC_STACK ((cc6_global_stack = (cc6_global_stack==0) ? ((cc6_global_stack_top=cc6_celt_alloc_scratch(cc6_GLOBAL_STACK_SIZE*2)+(cc6_GLOBAL_STACK_SIZE*2))-(cc6_GLOBAL_STACK_SIZE*2)) : cc6_global_stack),VALGRIND_MAKE_MEM_NOACCESS(cc6_global_stack, cc6_global_stack_top-cc6_global_stack))
|
||||
|
||||
#else
|
||||
|
||||
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
||||
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))
|
||||
#define RESTORE_STACK (global_stack = _saved_stack)
|
||||
#define ALLOC_STACK (global_stack = (global_stack==0) ? celt_alloc_scratch(GLOBAL_STACK_SIZE) : global_stack)
|
||||
#define cc6_ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
||||
#define cc6_PUSH(stack, size, type) (cc6_ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))
|
||||
#define cc6_RESTORE_STACK (cc6_global_stack = _saved_stack)
|
||||
#define cc6_ALLOC_STACK (cc6_global_stack = (cc6_global_stack==0) ? cc6_celt_alloc_scratch(cc6_GLOBAL_STACK_SIZE) : cc6_global_stack)
|
||||
|
||||
#endif /*ENABLE_VALGRIND*/
|
||||
|
||||
#include "os_support.h"
|
||||
#define VARDECL(type, var) type *var
|
||||
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
|
||||
#define SAVE_STACK char *_saved_stack = global_stack;
|
||||
#define cc6_VARDECL(type, var) type *var
|
||||
#define cc6_ALLOC(var, size, type) var = cc6_PUSH(cc6_global_stack, size, type)
|
||||
#define cc6_SAVE_STACK char *_saved_stack = cc6_global_stack;
|
||||
|
||||
#endif /*VAR_ARRAYS*/
|
||||
|
||||
|
||||
#endif /*STACK_ALLOC_H*/
|
||||
#endif /*cc6_STACK_ALLOC_H*/
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef VQ_H
|
||||
#define VQ_H
|
||||
#ifndef cc6_VQ_H
|
||||
#define cc6_VQ_H
|
||||
|
||||
#include "cc6_entenc.h"
|
||||
#include "cc6_entdec.h"
|
||||
|
@ -50,7 +50,7 @@
|
|||
* @param p Pitch vector (it is assumed that p+x is a unit vector)
|
||||
* @param enc Entropy encoder state
|
||||
*/
|
||||
void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, ec_enc *enc);
|
||||
void cc6_alg_quant(cc6_celt_norm_t *X, cc6_celt_mask_t *W, int N, int K, cc6_celt_norm_t *P, cc6_ec_enc *enc);
|
||||
|
||||
/** Algebraic pulse decoder
|
||||
* @param x Decoded normalised spectrum (returned)
|
||||
|
@ -59,9 +59,9 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, ec_
|
|||
* @param p Pitch vector (automatically added to x)
|
||||
* @param dec Entropy decoder state
|
||||
*/
|
||||
void alg_unquant(celt_norm_t *X, int N, int K, celt_norm_t *P, ec_dec *dec);
|
||||
void cc6_alg_unquant(cc6_celt_norm_t *X, int N, int K, cc6_celt_norm_t *P, cc6_ec_dec *dec);
|
||||
|
||||
celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int stride);
|
||||
cc6_celt_word16_t cc6_renormalise_vector(cc6_celt_norm_t *X, cc6_celt_word16_t value, int N, int stride);
|
||||
|
||||
/** Intra-frame predictor that matches a section of the current frame (at lower
|
||||
* frequencies) to encode the current band.
|
||||
|
@ -74,6 +74,6 @@ celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int
|
|||
* @param B Stride (number of channels multiplied by the number of MDCTs per frame)
|
||||
* @param N0 Number of valid offsets
|
||||
*/
|
||||
void intra_fold(const CELTMode *m, celt_norm_t * __restrict x, int N, int *pulses, celt_norm_t *Y, celt_norm_t * __restrict P, int N0, int B);
|
||||
void cc6_intra_fold(const cc6_CELTMode *m, cc6_celt_norm_t * __restrict x, int N, int *pulses, cc6_celt_norm_t *Y, cc6_celt_norm_t * __restrict P, int N0, int B);
|
||||
|
||||
#endif /* VQ_H */
|
||||
#endif /* cc6_VQ_H */
|
||||
|
|
|
@ -96,7 +96,7 @@ bool CNetBuf::Get ( CVector<uint8_t>& vecbyData )
|
|||
// in case we have a buffer underrun, invalidate the next 15 blocks
|
||||
// to avoid the unmusical noise resulting from a very short drop
|
||||
// out (note that if you want to change this value, also change
|
||||
// the value in celt_decode_lost in celt.c)
|
||||
// the value in cc6_celt_decode_lost in cc6_celt.c)
|
||||
iNumInvalidElements = 10;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -52,29 +52,29 @@ CClient::CClient ( const quint16 iPortNumber ) :
|
|||
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL )
|
||||
{
|
||||
// init audio encoder/decoder (mono)
|
||||
CeltModeMono = celt_mode_create (
|
||||
CeltModeMono = cc6_celt_mode_create (
|
||||
SYSTEM_SAMPLE_RATE_HZ, 1, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
|
||||
|
||||
CeltEncoderMono = celt_encoder_create ( CeltModeMono );
|
||||
CeltDecoderMono = celt_decoder_create ( CeltModeMono );
|
||||
CeltEncoderMono = cc6_celt_encoder_create ( CeltModeMono );
|
||||
CeltDecoderMono = cc6_celt_decoder_create ( CeltModeMono );
|
||||
|
||||
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
|
||||
// set encoder low complexity
|
||||
celt_encoder_ctl ( CeltEncoderMono,
|
||||
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) );
|
||||
cc6_celt_encoder_ctl ( CeltEncoderMono,
|
||||
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
|
||||
#endif
|
||||
|
||||
// init audio encoder/decoder (stereo)
|
||||
CeltModeStereo = celt_mode_create (
|
||||
CeltModeStereo = cc6_celt_mode_create (
|
||||
SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
|
||||
|
||||
CeltEncoderStereo = celt_encoder_create ( CeltModeStereo );
|
||||
CeltDecoderStereo = celt_decoder_create ( CeltModeStereo );
|
||||
CeltEncoderStereo = cc6_celt_encoder_create ( CeltModeStereo );
|
||||
CeltDecoderStereo = cc6_celt_decoder_create ( CeltModeStereo );
|
||||
|
||||
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
|
||||
// set encoder low complexity
|
||||
celt_encoder_ctl ( CeltEncoderStereo,
|
||||
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) );
|
||||
cc6_celt_encoder_ctl ( CeltEncoderStereo,
|
||||
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -861,20 +861,20 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
|||
if ( bUseStereo )
|
||||
{
|
||||
// encode current audio frame with CELT encoder
|
||||
celt_encode ( CeltEncoderStereo,
|
||||
&vecsNetwork[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
cc6_celt_encode ( CeltEncoderStereo,
|
||||
&vecsNetwork[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
}
|
||||
else
|
||||
{
|
||||
// encode current audio frame with CELT encoder
|
||||
celt_encode ( CeltEncoderMono,
|
||||
&vecsNetwork[i * SYSTEM_FRAME_SIZE_SAMPLES],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
cc6_celt_encode ( CeltEncoderMono,
|
||||
&vecsNetwork[i * SYSTEM_FRAME_SIZE_SAMPLES],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
}
|
||||
|
||||
// send coded audio through the network
|
||||
|
@ -904,17 +904,17 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
|||
{
|
||||
if ( bUseStereo )
|
||||
{
|
||||
celt_decode ( CeltDecoderStereo,
|
||||
&vecbyNetwData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
cc6_celt_decode ( CeltDecoderStereo,
|
||||
&vecbyNetwData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
}
|
||||
else
|
||||
{
|
||||
celt_decode ( CeltDecoderMono,
|
||||
&vecbyNetwData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
cc6_celt_decode ( CeltDecoderMono,
|
||||
&vecbyNetwData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -922,17 +922,17 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
|
|||
// lost packet
|
||||
if ( bUseStereo )
|
||||
{
|
||||
celt_decode ( CeltDecoderStereo,
|
||||
NULL,
|
||||
0,
|
||||
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
cc6_celt_decode ( CeltDecoderStereo,
|
||||
NULL,
|
||||
0,
|
||||
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
}
|
||||
else
|
||||
{
|
||||
celt_decode ( CeltDecoderMono,
|
||||
NULL,
|
||||
0,
|
||||
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
cc6_celt_decode ( CeltDecoderMono,
|
||||
NULL,
|
||||
0,
|
||||
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
src/client.h
12
src/client.h
|
@ -265,12 +265,12 @@ protected:
|
|||
CProtocol ConnLessProtocol;
|
||||
|
||||
// audio encoder/decoder
|
||||
CELTMode* CeltModeMono;
|
||||
CELTEncoder* CeltEncoderMono;
|
||||
CELTDecoder* CeltDecoderMono;
|
||||
CELTMode* CeltModeStereo;
|
||||
CELTEncoder* CeltEncoderStereo;
|
||||
CELTDecoder* CeltDecoderStereo;
|
||||
cc6_CELTMode* CeltModeMono;
|
||||
cc6_CELTEncoder* CeltEncoderMono;
|
||||
cc6_CELTDecoder* CeltDecoderMono;
|
||||
cc6_CELTMode* CeltModeStereo;
|
||||
cc6_CELTEncoder* CeltEncoderStereo;
|
||||
cc6_CELTDecoder* CeltDecoderStereo;
|
||||
int iCeltNumCodedBytes;
|
||||
bool bCeltDoHighQuality;
|
||||
bool bUseStereo;
|
||||
|
|
|
@ -194,29 +194,29 @@ CServer::CServer ( const int iNewNumChan,
|
|||
for ( i = 0; i < iNumChannels; i++ )
|
||||
{
|
||||
// init audio endocder/decoder (mono)
|
||||
CeltModeMono[i] = celt_mode_create (
|
||||
CeltModeMono[i] = cc6_celt_mode_create (
|
||||
SYSTEM_SAMPLE_RATE_HZ, 1, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
|
||||
|
||||
CeltEncoderMono[i] = celt_encoder_create ( CeltModeMono[i] );
|
||||
CeltDecoderMono[i] = celt_decoder_create ( CeltModeMono[i] );
|
||||
CeltEncoderMono[i] = cc6_celt_encoder_create ( CeltModeMono[i] );
|
||||
CeltDecoderMono[i] = cc6_celt_decoder_create ( CeltModeMono[i] );
|
||||
|
||||
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
|
||||
// set encoder low complexity
|
||||
celt_encoder_ctl ( CeltEncoderMono[i],
|
||||
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) );
|
||||
cc6_celt_encoder_ctl ( CeltEncoderMono[i],
|
||||
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
|
||||
#endif
|
||||
|
||||
// init audio endocder/decoder (stereo)
|
||||
CeltModeStereo[i] = celt_mode_create (
|
||||
CeltModeStereo[i] = cc6_celt_mode_create (
|
||||
SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
|
||||
|
||||
CeltEncoderStereo[i] = celt_encoder_create ( CeltModeStereo[i] );
|
||||
CeltDecoderStereo[i] = celt_decoder_create ( CeltModeStereo[i] );
|
||||
CeltEncoderStereo[i] = cc6_celt_encoder_create ( CeltModeStereo[i] );
|
||||
CeltDecoderStereo[i] = cc6_celt_decoder_create ( CeltModeStereo[i] );
|
||||
|
||||
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
|
||||
// set encoder low complexity
|
||||
celt_encoder_ctl ( CeltEncoderStereo[i],
|
||||
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) );
|
||||
cc6_celt_encoder_ctl ( CeltEncoderStereo[i],
|
||||
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -584,18 +584,18 @@ void CServer::OnTimer()
|
|||
if ( iCurNumAudChan == 1 )
|
||||
{
|
||||
// mono
|
||||
celt_decode ( CeltDecoderMono[iCurChanID],
|
||||
&vecbyData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecvecsData[i][0] );
|
||||
cc6_celt_decode ( CeltDecoderMono[iCurChanID],
|
||||
&vecbyData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecvecsData[i][0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// stereo
|
||||
celt_decode ( CeltDecoderStereo[iCurChanID],
|
||||
&vecbyData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecvecsData[i][0] );
|
||||
cc6_celt_decode ( CeltDecoderStereo[iCurChanID],
|
||||
&vecbyData[0],
|
||||
iCeltNumCodedBytes,
|
||||
&vecvecsData[i][0] );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -604,18 +604,18 @@ void CServer::OnTimer()
|
|||
if ( iCurNumAudChan == 1 )
|
||||
{
|
||||
// mono
|
||||
celt_decode ( CeltDecoderMono[iCurChanID],
|
||||
NULL,
|
||||
0,
|
||||
&vecvecsData[i][0] );
|
||||
cc6_celt_decode ( CeltDecoderMono[iCurChanID],
|
||||
NULL,
|
||||
0,
|
||||
&vecvecsData[i][0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// stereo
|
||||
celt_decode ( CeltDecoderStereo[iCurChanID],
|
||||
NULL,
|
||||
0,
|
||||
&vecvecsData[i][0] );
|
||||
cc6_celt_decode ( CeltDecoderStereo[iCurChanID],
|
||||
NULL,
|
||||
0,
|
||||
&vecvecsData[i][0] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,20 +669,20 @@ void CServer::OnTimer()
|
|||
if ( vecChannels[iCurChanID].GetNumAudioChannels() == 1 )
|
||||
{
|
||||
// mono
|
||||
celt_encode ( CeltEncoderMono[iCurChanID],
|
||||
&vecsSendData[0],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
cc6_celt_encode ( CeltEncoderMono[iCurChanID],
|
||||
&vecsSendData[0],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
}
|
||||
else
|
||||
{
|
||||
// stereo
|
||||
celt_encode ( CeltEncoderStereo[iCurChanID],
|
||||
&vecsSendData[0],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
cc6_celt_encode ( CeltEncoderStereo[iCurChanID],
|
||||
&vecsSendData[0],
|
||||
NULL,
|
||||
&vecCeltData[0],
|
||||
iCeltNumCodedBytes );
|
||||
}
|
||||
|
||||
// send separate mix to current clients
|
||||
|
|
12
src/server.h
12
src/server.h
|
@ -207,12 +207,12 @@ protected:
|
|||
QMutex Mutex;
|
||||
|
||||
// audio encoder/decoder
|
||||
CELTMode* CeltModeMono[MAX_NUM_CHANNELS];
|
||||
CELTEncoder* CeltEncoderMono[MAX_NUM_CHANNELS];
|
||||
CELTDecoder* CeltDecoderMono[MAX_NUM_CHANNELS];
|
||||
CELTMode* CeltModeStereo[MAX_NUM_CHANNELS];
|
||||
CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS];
|
||||
CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS];
|
||||
cc6_CELTMode* CeltModeMono[MAX_NUM_CHANNELS];
|
||||
cc6_CELTEncoder* CeltEncoderMono[MAX_NUM_CHANNELS];
|
||||
cc6_CELTDecoder* CeltDecoderMono[MAX_NUM_CHANNELS];
|
||||
cc6_CELTMode* CeltModeStereo[MAX_NUM_CHANNELS];
|
||||
cc6_CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS];
|
||||
cc6_CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS];
|
||||
|
||||
CVector<QString> vstrChatColors;
|
||||
|
||||
|
|
Loading…
Reference in a new issue