Various minor cleanups (removing dead arguments, macros) to libcelt/. Reinstate -Wunused-parameter.
This commit is contained in:
parent
b6c3f06b53
commit
40f956eed0
17 changed files with 65 additions and 42 deletions
|
@ -161,7 +161,7 @@ AC_SUBST(SYMBOL_VISIBILITY)
|
|||
fi
|
||||
|
||||
if test $ac_cv_c_compiler_gnu = yes ; then
|
||||
CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-unused-parameter"
|
||||
CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow"
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS([lrintf])
|
||||
|
|
|
@ -87,7 +87,6 @@ typedef opus_int32 opus_val32;
|
|||
typedef opus_val32 celt_sig;
|
||||
typedef opus_val16 celt_norm;
|
||||
typedef opus_val32 celt_ener;
|
||||
typedef opus_val32 celt_mask;
|
||||
|
||||
#define Q15ONE 32767
|
||||
|
||||
|
@ -132,8 +131,6 @@ typedef float opus_val32;
|
|||
typedef float celt_sig;
|
||||
typedef float celt_norm;
|
||||
typedef float celt_ener;
|
||||
typedef float celt_pgain;
|
||||
typedef float celt_mask;
|
||||
|
||||
#define Q15ONE 1.0f
|
||||
|
||||
|
|
|
@ -1059,9 +1059,15 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
|
|||
|
||||
/* Finally do the actual quantization */
|
||||
if (encode)
|
||||
cm = alg_quant(X, N, K, spread, B, ec, gain);
|
||||
else
|
||||
{
|
||||
cm = alg_quant(X, N, K, spread, B, ec
|
||||
#ifdef RESYNTH
|
||||
, gain
|
||||
#endif
|
||||
);
|
||||
} else {
|
||||
cm = alg_unquant(X, N, K, spread, B, ec, gain);
|
||||
}
|
||||
} else {
|
||||
/* If there's no pulse, fill the band anyway */
|
||||
int j;
|
||||
|
|
|
@ -86,8 +86,6 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
|
|||
int time_domain, int fold, int dual_stereo, int intensity, int *tf_res,
|
||||
opus_int32 total_bits, opus_int32 balance, ec_ctx *ec, int M, int codedBands, opus_uint32 *seed);
|
||||
|
||||
void stereo_decision(const CELTMode *m, celt_norm * restrict X, int *stereo_mode, int len, int M);
|
||||
|
||||
void anti_collapse(const CELTMode *m, celt_norm *_X, unsigned char *collapse_masks, int LM, int C, int CC, int size,
|
||||
int start, int end, opus_val16 *logE, opus_val16 *prev1logE,
|
||||
opus_val16 *prev2logE, int *pulses, opus_uint32 seed);
|
||||
|
|
|
@ -539,7 +539,7 @@ static inline opus_uint32 icwrs4(const int *_y,int *_k){
|
|||
of size _n with associated sign bits.
|
||||
_y: The vector of pulses, whose sum of absolute values must be _k.
|
||||
_nc: Returns V(_n,_k).*/
|
||||
opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y,
|
||||
static inline opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y,
|
||||
opus_uint32 *_u){
|
||||
opus_uint32 i;
|
||||
int j;
|
||||
|
|
|
@ -68,7 +68,7 @@ void ec_laplace_encode(ec_enc *enc, int *value, unsigned fs, int decay)
|
|||
fs = (fs*(opus_int32)decay)>>15;
|
||||
}
|
||||
/* Everything beyond that has probability LAPLACE_MINP. */
|
||||
if (fs <= 0)
|
||||
if (!fs)
|
||||
{
|
||||
int di;
|
||||
int ndi_max;
|
||||
|
|
|
@ -49,9 +49,7 @@ unsigned isqrt32(opus_uint32 _val);
|
|||
#define celt_sqrt(x) ((float)sqrt(x))
|
||||
#define celt_rsqrt(x) (1.f/celt_sqrt(x))
|
||||
#define celt_rsqrt_norm(x) (celt_rsqrt(x))
|
||||
#define celt_exp exp
|
||||
#define celt_cos_norm(x) ((float)cos((.5f*PI)*(x)))
|
||||
#define celt_atan atan
|
||||
#define celt_rcp(x) (1.f/(x))
|
||||
#define celt_div(a,b) ((a)/(b))
|
||||
#define frac_div32(a,b) ((float)(a)/(b))
|
||||
|
|
|
@ -58,10 +58,12 @@
|
|||
int clt_mdct_init(mdct_lookup *l,int N, int maxshift)
|
||||
{
|
||||
int i;
|
||||
int N4, N2;
|
||||
int N4;
|
||||
kiss_twiddle_scalar *trig;
|
||||
#if defined(FIXED_POINT)
|
||||
int N2=N>>1;
|
||||
#endif
|
||||
l->n = N;
|
||||
N2 = N>>1;
|
||||
N4 = N>>2;
|
||||
l->maxshift = maxshift;
|
||||
for (i=0;i<=maxshift;i++)
|
||||
|
|
|
@ -399,17 +399,19 @@ failure:
|
|||
|
||||
void opus_custom_mode_destroy(CELTMode *mode)
|
||||
{
|
||||
#ifdef CUSTOM_MODES
|
||||
int i;
|
||||
if (mode == NULL)
|
||||
return;
|
||||
#ifdef CUSTOM_MODES
|
||||
#ifndef CUSTOM_MODES_ONLY
|
||||
for (i=0;i<TOTAL_MODES;i++)
|
||||
{
|
||||
if (mode == static_mode_list[i])
|
||||
{
|
||||
return;
|
||||
}
|
||||
int i;
|
||||
for (i=0;i<TOTAL_MODES;i++)
|
||||
{
|
||||
if (mode == static_mode_list[i])
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CUSTOM_MODES_ONLY */
|
||||
opus_free((opus_int16*)mode->eBands);
|
||||
|
|
|
@ -41,8 +41,12 @@
|
|||
#include "stack_alloc.h"
|
||||
#include "mathops.h"
|
||||
|
||||
static void find_best_pitch(opus_val32 *xcorr, opus_val32 maxcorr, opus_val16 *y,
|
||||
int yshift, int len, int max_pitch, int *best_pitch)
|
||||
static void find_best_pitch(opus_val32 *xcorr, opus_val16 *y, int len,
|
||||
int max_pitch, int *best_pitch
|
||||
#ifdef FIXED_POINT
|
||||
, int yshift, opus_val32 maxcorr
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int i, j;
|
||||
opus_val32 Syy=1;
|
||||
|
@ -154,9 +158,11 @@ void pitch_search(const opus_val16 * restrict x_lp, opus_val16 * restrict y,
|
|||
VARDECL(opus_val16, x_lp4);
|
||||
VARDECL(opus_val16, y_lp4);
|
||||
VARDECL(opus_val32, xcorr);
|
||||
#ifdef FIXED_POINT
|
||||
opus_val32 maxcorr=1;
|
||||
int offset;
|
||||
int shift=0;
|
||||
#endif
|
||||
int offset;
|
||||
|
||||
SAVE_STACK;
|
||||
|
||||
|
@ -195,12 +201,20 @@ void pitch_search(const opus_val16 * restrict x_lp, opus_val16 * restrict y,
|
|||
for (j=0;j<len>>2;j++)
|
||||
sum = MAC16_16(sum, x_lp4[j],y_lp4[i+j]);
|
||||
xcorr[i] = MAX32(-1, sum);
|
||||
#ifdef FIXED_POINT
|
||||
maxcorr = MAX32(maxcorr, sum);
|
||||
#endif
|
||||
}
|
||||
find_best_pitch(xcorr, maxcorr, y_lp4, 0, len>>2, max_pitch>>2, best_pitch);
|
||||
find_best_pitch(xcorr, y_lp4, len>>2, max_pitch>>2, best_pitch
|
||||
#ifdef FIXED_POINT
|
||||
, 0, maxcorr
|
||||
#endif
|
||||
);
|
||||
|
||||
/* Finer search with 2x decimation */
|
||||
#ifdef FIXED_POINT
|
||||
maxcorr=1;
|
||||
#endif
|
||||
for (i=0;i<max_pitch>>1;i++)
|
||||
{
|
||||
opus_val32 sum=0;
|
||||
|
@ -210,9 +224,15 @@ void pitch_search(const opus_val16 * restrict x_lp, opus_val16 * restrict y,
|
|||
for (j=0;j<len>>1;j++)
|
||||
sum += SHR32(MULT16_16(x_lp[j],y[i+j]), shift);
|
||||
xcorr[i] = MAX32(-1, sum);
|
||||
#ifdef FIXED_POINT
|
||||
maxcorr = MAX32(maxcorr, sum);
|
||||
#endif
|
||||
}
|
||||
find_best_pitch(xcorr, maxcorr, y, shift, len>>1, max_pitch>>1, best_pitch);
|
||||
find_best_pitch(xcorr, y, len>>1, max_pitch>>1, best_pitch
|
||||
#ifdef FIXED_POINT
|
||||
, shift, maxcorr
|
||||
#endif
|
||||
);
|
||||
|
||||
/* Refine by pseudo-interpolation */
|
||||
if (best_pitch[0]>0 && best_pitch[0]<(max_pitch>>1)-1)
|
||||
|
|
|
@ -305,6 +305,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
|
|||
|
||||
if (!intra)
|
||||
{
|
||||
unsigned char *intra_buf;
|
||||
ec_enc enc_intra_state;
|
||||
opus_int32 tell_intra;
|
||||
opus_uint32 nstart_bytes;
|
||||
|
@ -318,11 +319,10 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
|
|||
|
||||
nstart_bytes = ec_range_bytes(&enc_start_state);
|
||||
nintra_bytes = ec_range_bytes(&enc_intra_state);
|
||||
intra_buf = ec_get_buffer(&enc_intra_state) + nstart_bytes;
|
||||
ALLOC(intra_bits, nintra_bytes-nstart_bytes, unsigned char);
|
||||
/* Copy bits from intra bit-stream */
|
||||
OPUS_COPY(intra_bits,
|
||||
ec_get_buffer(&enc_intra_state) + nstart_bytes,
|
||||
nintra_bytes - nstart_bytes);
|
||||
OPUS_COPY(intra_bits, intra_buf, nintra_bytes - nstart_bytes);
|
||||
|
||||
*enc = enc_start_state;
|
||||
|
||||
|
@ -333,8 +333,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
|
|||
{
|
||||
*enc = enc_intra_state;
|
||||
/* Copy intra bits to bit-stream */
|
||||
OPUS_COPY(ec_get_buffer(&enc_intra_state) + nstart_bytes,
|
||||
intra_bits, nintra_bytes - nstart_bytes);
|
||||
OPUS_COPY(intra_buf, intra_bits, nintra_bytes - nstart_bytes);
|
||||
OPUS_COPY(oldEBands, oldEBands_intra, C*m->nbEBands);
|
||||
OPUS_COPY(error, error_intra, C*m->nbEBands);
|
||||
intra = 1;
|
||||
|
|
|
@ -41,9 +41,6 @@ void amp2Log2(const CELTMode *m, int effEnd, int end,
|
|||
void log2Amp(const CELTMode *m, int start, int end,
|
||||
celt_ener *eBands, opus_val16 *oldEBands, int _C);
|
||||
|
||||
unsigned char *quant_prob_alloc(const CELTMode *m);
|
||||
void quant_prob_free(const opus_int16 *freq);
|
||||
|
||||
void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
|
||||
const opus_val16 *eBands, opus_val16 *oldEBands, opus_uint32 budget,
|
||||
opus_val16 *error, ec_enc *enc, int _C, int LM,
|
||||
|
|
|
@ -86,9 +86,6 @@ static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses)
|
|||
return pulses == 0 ? 0 : cache[pulses]+1;
|
||||
}
|
||||
|
||||
/** Computes a cache of the pulses->bits mapping in each band */
|
||||
opus_int16 **compute_alloc_cache(CELTMode *m, int M);
|
||||
|
||||
/** Compute the pulse allocation, i.e. how many pulses will go in each
|
||||
* band.
|
||||
@param m mode
|
||||
|
|
|
@ -53,7 +53,7 @@ static const int pkmax[NDIMS]={
|
|||
|
||||
#endif
|
||||
|
||||
int main(int _argc,char **_argv){
|
||||
int main(void){
|
||||
int t;
|
||||
int n;
|
||||
ALLOC_STACK;
|
||||
|
|
|
@ -69,7 +69,7 @@ void check_inv(kiss_fft_scalar * in,kiss_fft_scalar * out,int nfft,int isinver
|
|||
double phase = 2*M_PI*(bin+.5+.25*nfft)*(k+.5)/nfft;
|
||||
double re = cos(phase);
|
||||
|
||||
//re *= 2;
|
||||
/*re *= 2;*/
|
||||
|
||||
ansr += in[k] * re;
|
||||
}
|
||||
|
|
|
@ -166,8 +166,11 @@ static unsigned extract_collapse_mask(int *iy, int N, int B)
|
|||
return collapse_mask;
|
||||
}
|
||||
|
||||
unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
||||
ec_enc *enc, opus_val16 gain)
|
||||
unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
|
||||
#ifdef RESYNTH
|
||||
, opus_val16 gain
|
||||
#endif
|
||||
)
|
||||
{
|
||||
VARDECL(celt_norm, y);
|
||||
VARDECL(int, iy);
|
||||
|
|
|
@ -49,7 +49,11 @@
|
|||
* @ret A mask indicating which blocks in the band received pulses
|
||||
*/
|
||||
unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
||||
ec_enc *enc, opus_val16 gain);
|
||||
ec_enc *enc
|
||||
#ifdef RESYNTH
|
||||
, opus_val16 gain
|
||||
#endif
|
||||
);
|
||||
|
||||
/** Algebraic pulse decoder
|
||||
* @param x Decoded normalised spectrum (returned)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue