added a "cc6_" prior to all file names, functions and global variables

This commit is contained in:
Volker Fischer 2013-02-15 20:09:10 +00:00
parent fdbcc7ac3c
commit b518f0cd96
12 changed files with 291 additions and 291 deletions

View file

@ -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); cc6_compute_band_energies(st->mode, freq, bandE);
for (i=0;i<st->mode->nbEBands*C;i++) 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 */ /* Don't use intra energy when we're operating at low bit-rate */
intra_ener = st->force_intra || (st->delayedIntra && nbCompressedBytes > st->mode->nbEBands); intra_ener = st->force_intra || (st->delayedIntra && nbCompressedBytes > st->mode->nbEBands);

View file

@ -35,19 +35,19 @@
*/ */
#ifndef _PITCH_H #ifndef cc6__PITCH_H
#define _PITCH_H #define cc6__PITCH_H
#include "cc6_kiss_fftr.h" #include "cc6_kiss_fftr.h"
#include "cc6_psy.h" #include "cc6_psy.h"
#include "cc6_modes.h" #include "cc6_modes.h"
kiss_fftr_cfg pitch_state_alloc(int max_lag); cc6_kiss_fftr_cfg cc6_pitch_state_alloc(int max_lag);
void pitch_state_free(kiss_fftr_cfg st); void cc6_pitch_state_free(cc6_kiss_fftr_cfg st);
/** Find the optimal delay for the pitch prediction. Computation is /** Find the optimal delay for the pitch prediction. Computation is
done in the frequency domain, both to save time and to make it done in the frequency domain, both to save time and to make it
easier to apply psychoacoustic weighting */ 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 #endif

View file

@ -28,29 +28,29 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef PSY_H #ifndef cc6_PSY_H
#define PSY_H #define cc6_PSY_H
#include "cc6_arch.h" #include "cc6_arch.h"
#include "cc6_celt.h" #include "cc6_celt.h"
struct PsyDecay { struct cc6_PsyDecay {
/*celt_word16_t *decayL;*/ /*cc6_celt_word16_t *decayL;*/
const celt_word16_t * __restrict decayR; const cc6_celt_word16_t * __restrict decayR;
}; };
/** Pre-compute the decay of the psycho-acoustic spreading function */ /** 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 */ /** 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 */ /** 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 */ /** 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 */

View file

@ -29,8 +29,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef QUANT_BANDS #ifndef cc6_QUANT_BANDS
#define QUANT_BANDS #define cc6_QUANT_BANDS
#include "cc6_arch.h" #include "cc6_arch.h"
#include "cc6_modes.h" #include "cc6_modes.h"
@ -38,33 +38,33 @@
#include "cc6_entdec.h" #include "cc6_entdec.h"
#include "cc6_mathops.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); int *cc6_quant_prob_alloc(const cc6_CELTMode *m);
void quant_prob_free(int *freq); 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 */

View file

@ -29,32 +29,32 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef RATE_H #ifndef cc6_RATE_H
#define RATE_H #define cc6_RATE_H
#define MAX_PULSES 128 #define cc6_MAX_PULSES 128
#define LOG_MAX_PULSES 7 #define cc6_LOG_MAX_PULSES 7
#define BITRES 4 #define cc6_BITRES 4
#define BITROUND 8 #define cc6_BITROUND 8
#define BITOVERFLOW 30000 #define cc6_BITOVERFLOW 30000
#include "cc6_cwrs.h" #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 i;
int lo, hi; int lo, hi;
lo = 0; lo = 0;
hi = MAX_PULSES-1; hi = cc6_MAX_PULSES-1;
#if 0 /* Disabled until we can make that useful */ #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 */ /* Use of more than cc6_MAX_PULSES is disabled until we are able to cwrs that decently */
if (bits > cache[MAX_PULSES-1] && N<=4) if (bits > cache[cc6_MAX_PULSES-1] && N<=4)
{ {
/*int pulses; /*int pulses;
pulses = 127; 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++;*/ pulses++;*/
lo = 127; lo = 127;
switch (N) 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++) for (i=0;i<10;i++)
{ {
int pulses = (lo+hi)>>1; 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; hi = pulses;
else else
lo = pulses; 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++) for (i=0;i<10;i++)
{ {
int pulses = (lo+hi)>>1; 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; hi = pulses;
else else
lo = pulses; 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 /* Instead of using the "bisection condition" we use a fixed number of
iterations because it should be faster */ iterations because it should be faster */
/*while (hi-lo != 1)*/ /*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; int mid = (lo+hi)>>1;
/* OPT: Make sure this is implemented with a conditional move */ /* 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) if (pulses > 127)
{ {
int bits; int bits;
switch (N) switch (N)
{ {
case 3: 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; break;
case 4: 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; break;
} }
/*printf ("%d <- %d\n", bits, pulses);*/ /*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 */ /** 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 /** Compute the pulse allocation, i.e. how many pulses will go in each
* band. * band.
@ -138,7 +138,7 @@ celt_int16_t **compute_alloc_cache(CELTMode *m, int C);
@param pulses Number of pulses per band (returned) @param pulses Number of pulses per band (returned)
@return Total number of bits allocated @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 #endif

View file

@ -1,144 +1,144 @@
/* Copyright (C) 2002 Jean-Marc Valin */ /* Copyright (C) 2002 Jean-Marc Valin */
/** /**
@file stack_alloc.h @file stack_alloc.h
@brief Temporary memory allocation on stack @brief Temporary memory allocation on stack
*/ */
/* /*
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
are met: are met:
- Redistributions of source code must retain the above copyright - Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright - Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its - Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef STACK_ALLOC_H #ifndef cc6_STACK_ALLOC_H
#define STACK_ALLOC_H #define cc6_STACK_ALLOC_H
#ifdef USE_ALLOCA #ifdef USE_ALLOCA
# ifdef WIN32 # ifdef WIN32
# include <malloc.h> # include <malloc.h>
# else # else
# ifdef HAVE_ALLOCA_H # ifdef HAVE_ALLOCA_H
# include <alloca.h> # include <alloca.h>
# else # else
# include <stdlib.h> # include <stdlib.h>
# endif # endif
# endif # endif
#endif #endif
/** /**
* @def ALIGN(stack, size) * @def cc6_ALIGN(stack, size)
* *
* Aligns the stack to a 'size' boundary * Aligns the stack to a 'size' boundary
* *
* @param stack Stack * @param stack Stack
* @param size New size boundary * @param size New size boundary
*/ */
/** /**
* @def PUSH(stack, size, type) * @def cc6_PUSH(stack, size, type)
* *
* Allocates 'size' elements of type 'type' on the stack * Allocates 'size' elements of type 'type' on the stack
* *
* @param stack Stack * @param stack Stack
* @param size Number of elements * @param size Number of elements
* @param type Type of element * @param type Type of element
*/ */
/** /**
* @def VARDECL(var) * @def cc6_VARDECL(var)
* *
* Declare variable on stack * Declare variable on stack
* *
* @param var Variable to declare * @param var Variable to declare
*/ */
/** /**
* @def ALLOC(var, size, type) * @def cc6_ALLOC(var, size, type)
* *
* Allocate 'size' elements of 'type' on stack * Allocate 'size' elements of 'type' on stack
* *
* @param var Name of variable to allocate * @param var Name of variable to allocate
* @param size Number of elements * @param size Number of elements
* @param type Type of element * @param type Type of element
*/ */
#if defined(VAR_ARRAYS) #if defined(VAR_ARRAYS)
#define VARDECL(type, var) #define cc6_VARDECL(type, var)
#define ALLOC(var, size, type) type var[size] #define cc6_ALLOC(var, size, type) type var[size]
#define SAVE_STACK #define cc6_SAVE_STACK
#define RESTORE_STACK #define cc6_RESTORE_STACK
#define ALLOC_STACK #define cc6_ALLOC_STACK
#elif defined(USE_ALLOCA) #elif defined(USE_ALLOCA)
#define VARDECL(type, var) type *var #define cc6_VARDECL(type, var) type *var
#define ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size))) #define cc6_ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size)))
#define SAVE_STACK #define cc6_SAVE_STACK
#define RESTORE_STACK #define cc6_RESTORE_STACK
#define ALLOC_STACK #define cc6_ALLOC_STACK
#else #else
#ifdef CELT_C #ifdef CELT_C
char *global_stack=0; char *cc6_global_stack=0;
#else #else
extern char *global_stack; extern char *cc6_global_stack;
#endif /*CELT_C*/ #endif /*CELT_C*/
#ifdef ENABLE_VALGRIND #ifdef ENABLE_VALGRIND
#include <valgrind/memcheck.h> #include <valgrind/memcheck.h>
#ifdef CELT_C #ifdef CELT_C
char *global_stack_top=0; char *cc6_global_stack_top=0;
#else #else
extern char *global_stack_top; extern char *cc6_global_stack_top;
#endif /*CELT_C*/ #endif /*CELT_C*/
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) #define cc6_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 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 RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack)) #define cc6_RESTORE_STACK ((cc6_global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(cc6_global_stack, cc6_global_stack_top-cc6_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_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 #else
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) #define cc6_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 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 RESTORE_STACK (global_stack = _saved_stack) #define cc6_RESTORE_STACK (cc6_global_stack = _saved_stack)
#define ALLOC_STACK (global_stack = (global_stack==0) ? celt_alloc_scratch(GLOBAL_STACK_SIZE) : global_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*/ #endif /*ENABLE_VALGRIND*/
#include "os_support.h" #include "os_support.h"
#define VARDECL(type, var) type *var #define cc6_VARDECL(type, var) type *var
#define ALLOC(var, size, type) var = PUSH(global_stack, size, type) #define cc6_ALLOC(var, size, type) var = cc6_PUSH(cc6_global_stack, size, type)
#define SAVE_STACK char *_saved_stack = global_stack; #define cc6_SAVE_STACK char *_saved_stack = cc6_global_stack;
#endif /*VAR_ARRAYS*/ #endif /*VAR_ARRAYS*/
#endif /*STACK_ALLOC_H*/ #endif /*cc6_STACK_ALLOC_H*/

View file

@ -33,8 +33,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef VQ_H #ifndef cc6_VQ_H
#define VQ_H #define cc6_VQ_H
#include "cc6_entenc.h" #include "cc6_entenc.h"
#include "cc6_entdec.h" #include "cc6_entdec.h"
@ -50,7 +50,7 @@
* @param p Pitch vector (it is assumed that p+x is a unit vector) * @param p Pitch vector (it is assumed that p+x is a unit vector)
* @param enc Entropy encoder state * @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 /** Algebraic pulse decoder
* @param x Decoded normalised spectrum (returned) * @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 p Pitch vector (automatically added to x)
* @param dec Entropy decoder state * @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 /** Intra-frame predictor that matches a section of the current frame (at lower
* frequencies) to encode the current band. * 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 B Stride (number of channels multiplied by the number of MDCTs per frame)
* @param N0 Number of valid offsets * @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 */

View file

@ -96,7 +96,7 @@ bool CNetBuf::Get ( CVector<uint8_t>& vecbyData )
// in case we have a buffer underrun, invalidate the next 15 blocks // in case we have a buffer underrun, invalidate the next 15 blocks
// to avoid the unmusical noise resulting from a very short drop // to avoid the unmusical noise resulting from a very short drop
// out (note that if you want to change this value, also change // 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; iNumInvalidElements = 10;
return false; return false;

View file

@ -52,29 +52,29 @@ CClient::CClient ( const quint16 iPortNumber ) :
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL ) iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL )
{ {
// init audio encoder/decoder (mono) // init audio encoder/decoder (mono)
CeltModeMono = celt_mode_create ( CeltModeMono = cc6_celt_mode_create (
SYSTEM_SAMPLE_RATE_HZ, 1, SYSTEM_FRAME_SIZE_SAMPLES, NULL ); SYSTEM_SAMPLE_RATE_HZ, 1, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
CeltEncoderMono = celt_encoder_create ( CeltModeMono ); CeltEncoderMono = cc6_celt_encoder_create ( CeltModeMono );
CeltDecoderMono = celt_decoder_create ( CeltModeMono ); CeltDecoderMono = cc6_celt_decoder_create ( CeltModeMono );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC #ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity // set encoder low complexity
celt_encoder_ctl ( CeltEncoderMono, cc6_celt_encoder_ctl ( CeltEncoderMono,
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) ); cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif #endif
// init audio encoder/decoder (stereo) // init audio encoder/decoder (stereo)
CeltModeStereo = celt_mode_create ( CeltModeStereo = cc6_celt_mode_create (
SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL ); SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
CeltEncoderStereo = celt_encoder_create ( CeltModeStereo ); CeltEncoderStereo = cc6_celt_encoder_create ( CeltModeStereo );
CeltDecoderStereo = celt_decoder_create ( CeltModeStereo ); CeltDecoderStereo = cc6_celt_decoder_create ( CeltModeStereo );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC #ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity // set encoder low complexity
celt_encoder_ctl ( CeltEncoderStereo, cc6_celt_encoder_ctl ( CeltEncoderStereo,
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) ); cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif #endif
@ -861,20 +861,20 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
if ( bUseStereo ) if ( bUseStereo )
{ {
// encode current audio frame with CELT encoder // encode current audio frame with CELT encoder
celt_encode ( CeltEncoderStereo, cc6_celt_encode ( CeltEncoderStereo,
&vecsNetwork[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES], &vecsNetwork[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES],
NULL, NULL,
&vecCeltData[0], &vecCeltData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
else else
{ {
// encode current audio frame with CELT encoder // encode current audio frame with CELT encoder
celt_encode ( CeltEncoderMono, cc6_celt_encode ( CeltEncoderMono,
&vecsNetwork[i * SYSTEM_FRAME_SIZE_SAMPLES], &vecsNetwork[i * SYSTEM_FRAME_SIZE_SAMPLES],
NULL, NULL,
&vecCeltData[0], &vecCeltData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
// send coded audio through the network // send coded audio through the network
@ -904,17 +904,17 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
{ {
if ( bUseStereo ) if ( bUseStereo )
{ {
celt_decode ( CeltDecoderStereo, cc6_celt_decode ( CeltDecoderStereo,
&vecbyNetwData[0], &vecbyNetwData[0],
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
else else
{ {
celt_decode ( CeltDecoderMono, cc6_celt_decode ( CeltDecoderMono,
&vecbyNetwData[0], &vecbyNetwData[0],
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
} }
else else
@ -922,17 +922,17 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
// lost packet // lost packet
if ( bUseStereo ) if ( bUseStereo )
{ {
celt_decode ( CeltDecoderStereo, cc6_celt_decode ( CeltDecoderStereo,
NULL, NULL,
0, 0,
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
else else
{ {
celt_decode ( CeltDecoderMono, cc6_celt_decode ( CeltDecoderMono,
NULL, NULL,
0, 0,
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
} }
} }

View file

@ -265,12 +265,12 @@ protected:
CProtocol ConnLessProtocol; CProtocol ConnLessProtocol;
// audio encoder/decoder // audio encoder/decoder
CELTMode* CeltModeMono; cc6_CELTMode* CeltModeMono;
CELTEncoder* CeltEncoderMono; cc6_CELTEncoder* CeltEncoderMono;
CELTDecoder* CeltDecoderMono; cc6_CELTDecoder* CeltDecoderMono;
CELTMode* CeltModeStereo; cc6_CELTMode* CeltModeStereo;
CELTEncoder* CeltEncoderStereo; cc6_CELTEncoder* CeltEncoderStereo;
CELTDecoder* CeltDecoderStereo; cc6_CELTDecoder* CeltDecoderStereo;
int iCeltNumCodedBytes; int iCeltNumCodedBytes;
bool bCeltDoHighQuality; bool bCeltDoHighQuality;
bool bUseStereo; bool bUseStereo;

View file

@ -194,29 +194,29 @@ CServer::CServer ( const int iNewNumChan,
for ( i = 0; i < iNumChannels; i++ ) for ( i = 0; i < iNumChannels; i++ )
{ {
// init audio endocder/decoder (mono) // 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 ); SYSTEM_SAMPLE_RATE_HZ, 1, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
CeltEncoderMono[i] = celt_encoder_create ( CeltModeMono[i] ); CeltEncoderMono[i] = cc6_celt_encoder_create ( CeltModeMono[i] );
CeltDecoderMono[i] = celt_decoder_create ( CeltModeMono[i] ); CeltDecoderMono[i] = cc6_celt_decoder_create ( CeltModeMono[i] );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC #ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity // set encoder low complexity
celt_encoder_ctl ( CeltEncoderMono[i], cc6_celt_encoder_ctl ( CeltEncoderMono[i],
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) ); cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif #endif
// init audio endocder/decoder (stereo) // 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 ); SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
CeltEncoderStereo[i] = celt_encoder_create ( CeltModeStereo[i] ); CeltEncoderStereo[i] = cc6_celt_encoder_create ( CeltModeStereo[i] );
CeltDecoderStereo[i] = celt_decoder_create ( CeltModeStereo[i] ); CeltDecoderStereo[i] = cc6_celt_decoder_create ( CeltModeStereo[i] );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC #ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity // set encoder low complexity
celt_encoder_ctl ( CeltEncoderStereo[i], cc6_celt_encoder_ctl ( CeltEncoderStereo[i],
CELT_SET_COMPLEXITY_REQUEST, celt_int32_t ( 1 ) ); cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif #endif
} }
@ -584,18 +584,18 @@ void CServer::OnTimer()
if ( iCurNumAudChan == 1 ) if ( iCurNumAudChan == 1 )
{ {
// mono // mono
celt_decode ( CeltDecoderMono[iCurChanID], cc6_celt_decode ( CeltDecoderMono[iCurChanID],
&vecbyData[0], &vecbyData[0],
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
else else
{ {
// stereo // stereo
celt_decode ( CeltDecoderStereo[iCurChanID], cc6_celt_decode ( CeltDecoderStereo[iCurChanID],
&vecbyData[0], &vecbyData[0],
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
} }
else else
@ -604,18 +604,18 @@ void CServer::OnTimer()
if ( iCurNumAudChan == 1 ) if ( iCurNumAudChan == 1 )
{ {
// mono // mono
celt_decode ( CeltDecoderMono[iCurChanID], cc6_celt_decode ( CeltDecoderMono[iCurChanID],
NULL, NULL,
0, 0,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
else else
{ {
// stereo // stereo
celt_decode ( CeltDecoderStereo[iCurChanID], cc6_celt_decode ( CeltDecoderStereo[iCurChanID],
NULL, NULL,
0, 0,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
} }
@ -669,20 +669,20 @@ void CServer::OnTimer()
if ( vecChannels[iCurChanID].GetNumAudioChannels() == 1 ) if ( vecChannels[iCurChanID].GetNumAudioChannels() == 1 )
{ {
// mono // mono
celt_encode ( CeltEncoderMono[iCurChanID], cc6_celt_encode ( CeltEncoderMono[iCurChanID],
&vecsSendData[0], &vecsSendData[0],
NULL, NULL,
&vecCeltData[0], &vecCeltData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
else else
{ {
// stereo // stereo
celt_encode ( CeltEncoderStereo[iCurChanID], cc6_celt_encode ( CeltEncoderStereo[iCurChanID],
&vecsSendData[0], &vecsSendData[0],
NULL, NULL,
&vecCeltData[0], &vecCeltData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
// send separate mix to current clients // send separate mix to current clients

View file

@ -207,12 +207,12 @@ protected:
QMutex Mutex; QMutex Mutex;
// audio encoder/decoder // audio encoder/decoder
CELTMode* CeltModeMono[MAX_NUM_CHANNELS]; cc6_CELTMode* CeltModeMono[MAX_NUM_CHANNELS];
CELTEncoder* CeltEncoderMono[MAX_NUM_CHANNELS]; cc6_CELTEncoder* CeltEncoderMono[MAX_NUM_CHANNELS];
CELTDecoder* CeltDecoderMono[MAX_NUM_CHANNELS]; cc6_CELTDecoder* CeltDecoderMono[MAX_NUM_CHANNELS];
CELTMode* CeltModeStereo[MAX_NUM_CHANNELS]; cc6_CELTMode* CeltModeStereo[MAX_NUM_CHANNELS];
CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS]; cc6_CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS];
CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS]; cc6_CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS];
CVector<QString> vstrChatColors; CVector<QString> vstrChatColors;