mirror of
https://github.com/xiph/opus.git
synced 2025-05-28 06:09:15 +00:00
Correct many whitespace errors under libcelt/ and remove
non-ascii characters from the source.
This commit is contained in:
parent
6518a836ab
commit
71d39ad841
47 changed files with 300 additions and 301 deletions
|
@ -32,7 +32,7 @@ noinst_HEADERS = _kiss_fft_guts.h arch.h bands.h fixed_c5x.h fixed_c6x.h \
|
|||
noinst_PROGRAMS = testcelt dump_modes
|
||||
testcelt_SOURCES = testcelt.c
|
||||
testcelt_LDADD = libcelt@LIBCELT_SUFFIX@.la
|
||||
INCLUDES =
|
||||
INCLUDES =
|
||||
#libcelt@LIBCELT_SUFFIX@_la_LIBADD =
|
||||
|
||||
dump_modes_SOURCES = dump_modes.c
|
||||
|
|
|
@ -50,7 +50,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|||
#else /* DOUBLE_PRECISION */
|
||||
|
||||
# define FRACBITS 15
|
||||
# define SAMPPROD opus_int32
|
||||
# define SAMPPROD opus_int32
|
||||
#define SAMP_MAX 32767
|
||||
#define TRIG_UPSCALE 1
|
||||
#define EXT32(a) EXTEND32(a)
|
||||
|
@ -186,7 +186,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|||
(x)->r = KISS_FFT_COS(phase);\
|
||||
(x)->i = KISS_FFT_SIN(phase);\
|
||||
}while(0)
|
||||
|
||||
|
||||
#define kf_cexp2(x,phase) \
|
||||
do{ \
|
||||
(x)->r = TRIG_UPSCALE*celt_cos_norm((phase));\
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -247,7 +247,7 @@ typedef float celt_mask;
|
|||
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
|
||||
|
||||
/* 2 on TI C5x DSP */
|
||||
#define BYTES_PER_CHAR 2
|
||||
#define BYTES_PER_CHAR 2
|
||||
#define BITS_PER_CHAR 16
|
||||
#define LOG2_BITS_PER_CHAR 4
|
||||
|
||||
|
@ -259,12 +259,12 @@ typedef float celt_mask;
|
|||
|
||||
#endif /* !CONFIG_TI_C54X */
|
||||
|
||||
#ifndef GLOBAL_STACK_SIZE
|
||||
#ifndef GLOBAL_STACK_SIZE
|
||||
#ifdef FIXED_POINT
|
||||
#define GLOBAL_STACK_SIZE 100000
|
||||
#else
|
||||
#define GLOBAL_STACK_SIZE 100000
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* ARCH_H */
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008-2009 Gregory Maxwell
|
||||
Copyright (c) 2008-2009 Gregory Maxwell
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -89,12 +89,12 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank
|
|||
int j;
|
||||
opus_val32 maxval=0;
|
||||
opus_val32 sum = 0;
|
||||
|
||||
|
||||
j=M*eBands[i]; do {
|
||||
maxval = MAX32(maxval, X[j+c*N]);
|
||||
maxval = MAX32(maxval, -X[j+c*N]);
|
||||
} while (++j<M*eBands[i+1]);
|
||||
|
||||
|
||||
if (maxval > 0)
|
||||
{
|
||||
int shift = celt_ilog2(maxval)-10;
|
||||
|
@ -406,7 +406,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average,
|
|||
const opus_int16 * restrict eBands = m->eBands;
|
||||
int decision;
|
||||
int hf_sum=0;
|
||||
|
||||
|
||||
N0 = M*m->shortMdctSize;
|
||||
|
||||
if (M*(eBands[end]-eBands[end-1]) <= 8)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008-2009 Gregory Maxwell
|
||||
Copyright (c) 2008-2009 Gregory Maxwell
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -36,8 +36,8 @@
|
|||
#include "entdec.h"
|
||||
#include "rate.h"
|
||||
|
||||
/** Compute the amplitude (sqrt energy) in each of the bands
|
||||
* @param m Mode data
|
||||
/** Compute the amplitude (sqrt energy) in each of the bands
|
||||
* @param m Mode data
|
||||
* @param X Spectrum
|
||||
* @param bands Square root of the energy for each band (returned)
|
||||
*/
|
||||
|
@ -45,16 +45,16 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band
|
|||
|
||||
/*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_val16 *tonality, celt_ener *bank);*/
|
||||
|
||||
/** Normalise each band of X such that the energy in each band is
|
||||
/** Normalise each band of X such that the energy in each band is
|
||||
equal to 1
|
||||
* @param m Mode data
|
||||
* @param m Mode data
|
||||
* @param X Spectrum (returned normalised)
|
||||
* @param bands Square root of the energy for each band
|
||||
*/
|
||||
void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bands, int end, int _C, int M);
|
||||
|
||||
/** Denormalise each band of X to restore full amplitude
|
||||
* @param m Mode data
|
||||
* @param m Mode data
|
||||
* @param X Spectrum (returned de-normalised)
|
||||
* @param bands Square root of the energy for each band
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, floa
|
|||
void haar1(celt_norm *X, int N0, int stride);
|
||||
|
||||
/** Quantisation/encoding of the residual spectrum
|
||||
* @param m Mode data
|
||||
* @param m Mode data
|
||||
* @param X Residual (normalised)
|
||||
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
|
||||
* @param enc Entropy encoder
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -81,7 +81,7 @@ static int d2i(double d)
|
|||
int gen_twiddle16(short *w, int n, double scale)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
|
||||
for (j = 1, k = 0; j < n >> 2; j = j << 2)
|
||||
{
|
||||
for (i = 0; i < n >> 2; i += j << 1)
|
||||
|
@ -90,21 +90,21 @@ int gen_twiddle16(short *w, int n, double scale)
|
|||
w[k + 10] = d2s(scale * sin(6.0 * PI * (i + j) / n));
|
||||
w[k + 9] = d2s(scale * cos(6.0 * PI * (i ) / n));
|
||||
w[k + 8] = d2s(scale * sin(6.0 * PI * (i ) / n));
|
||||
|
||||
|
||||
w[k + 7] = d2s(scale * cos(4.0 * PI * (i + j) / n));
|
||||
w[k + 6] = d2s(scale * sin(4.0 * PI * (i + j) / n));
|
||||
w[k + 5] = d2s(scale * cos(4.0 * PI * (i ) / n));
|
||||
w[k + 4] = d2s(scale * sin(4.0 * PI * (i ) / n));
|
||||
|
||||
|
||||
w[k + 3] = d2s(scale * cos(2.0 * PI * (i + j) / n));
|
||||
w[k + 2] = d2s(scale * sin(2.0 * PI * (i + j) / n));
|
||||
w[k + 1] = d2s(scale * cos(2.0 * PI * (i ) / n));
|
||||
w[k + 0] = d2s(scale * sin(2.0 * PI * (i ) / n));
|
||||
|
||||
|
||||
k += 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
|
@ -129,24 +129,24 @@ int gen_twiddle16(short *w, int n, double scale)
|
|||
int gen_twiddle32(int *w, int n, double scale)
|
||||
{
|
||||
int i, j, k, s=0, t;
|
||||
|
||||
|
||||
for (j = 1, k = 0; j < n >> 2; j = j << 2, s++)
|
||||
{
|
||||
for (i = t=0; i < n >> 2; i += j, t++)
|
||||
{
|
||||
w[k + 5] = d2i(scale * cos(6.0 * PI * i / n));
|
||||
w[k + 4] = d2i(scale * sin(6.0 * PI * i / n));
|
||||
|
||||
|
||||
w[k + 3] = d2i(scale * cos(4.0 * PI * i / n));
|
||||
w[k + 2] = d2i(scale * sin(4.0 * PI * i / n));
|
||||
|
||||
|
||||
w[k + 1] = d2i(scale * cos(2.0 * PI * i / n));
|
||||
w[k + 0] = d2i(scale * sin(2.0 * PI * i / n));
|
||||
|
||||
|
||||
k += 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ c64_fft_t *c64_fft16_alloc(int length, int x, int y)
|
|||
}
|
||||
|
||||
|
||||
c64_fft_t *c64_fft32_alloc(int length, int x, int y)
|
||||
c64_fft_t *c64_fft32_alloc(int length, int x, int y)
|
||||
{
|
||||
c64_fft_t *state;
|
||||
int i, c;
|
||||
|
@ -228,7 +228,7 @@ c64_fft_t *c64_fft32_alloc(int length, int x, int y)
|
|||
}
|
||||
|
||||
|
||||
void c64_fft16_free(c64_fft_t *state)
|
||||
void c64_fft16_free(c64_fft_t *state)
|
||||
{
|
||||
c64_fft32_free(state);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ void c64_fft16_inplace(c64_fft_t * restrict state, opus_int16 *X)
|
|||
X[2*i+0] = cout[2*i+0];
|
||||
X[2*i+1] = cout[2*i+1];
|
||||
}
|
||||
|
||||
|
||||
RESTORE_STACK;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ void c64_ifft16(c64_fft_t * restrict state, const opus_int16 *X, opus_int16 *Y)
|
|||
SAVE_STACK;
|
||||
|
||||
ALLOC(cin, state->nfft*2, opus_int16);
|
||||
if ((opus_int32)Y & 7)
|
||||
if ((opus_int32)Y & 7)
|
||||
ALLOC(cout, state->nfft*2, opus_int16);
|
||||
else
|
||||
cout = Y;
|
||||
|
@ -311,7 +311,7 @@ void c64_ifft16(c64_fft_t * restrict state, const opus_int16 *X, opus_int16 *Y)
|
|||
Y[2*i+0] = cout[2*i+0];
|
||||
Y[2*i+1] = cout[2*i+1];
|
||||
}
|
||||
|
||||
|
||||
RESTORE_STACK;
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ void c64_ifft32(c64_fft_t * restrict state, const opus_int32 *X, opus_int32 *Y)
|
|||
for (i = 0; i < state->nfft; i++) {
|
||||
// No need to scale for this one but still need to save the input
|
||||
// because the fft is going to change it!
|
||||
cin[2*i+0] = X[2*i+0];
|
||||
cin[2*i+0] = X[2*i+0];
|
||||
cin[2*i+1] = X[2*i+1];
|
||||
}
|
||||
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2010 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -119,7 +119,7 @@ static int resampling_factor(opus_int32 rate)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/** Encoder state
|
||||
/** Encoder state
|
||||
@brief Encoder state
|
||||
*/
|
||||
struct CELTEncoder {
|
||||
|
@ -127,7 +127,7 @@ struct CELTEncoder {
|
|||
int overlap;
|
||||
int channels;
|
||||
int stream_channels;
|
||||
|
||||
|
||||
int force_intra;
|
||||
int clip;
|
||||
int disable_pf;
|
||||
|
@ -249,7 +249,7 @@ CELTEncoder *celt_encoder_init_custom(CELTEncoder *st, const CELTMode *mode, int
|
|||
}
|
||||
|
||||
CELT_MEMSET((char*)st, 0, celt_encoder_get_size_custom(mode, channels));
|
||||
|
||||
|
||||
st->mode = mode;
|
||||
st->overlap = mode->overlap;
|
||||
st->stream_channels = st->channels = channels;
|
||||
|
@ -390,7 +390,7 @@ static int transient_analysis(const opus_val32 * restrict in, int len, int C,
|
|||
return is_transient;
|
||||
}
|
||||
|
||||
/** Apply window and compute the MDCT for all sub-frames and
|
||||
/** Apply window and compute the MDCT for all sub-frames and
|
||||
all channels in a frame */
|
||||
static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * restrict in, celt_sig * restrict out, int _C, int LM)
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * rest
|
|||
}
|
||||
}
|
||||
|
||||
/** Compute the IMDCT and apply window for all sub-frames and
|
||||
/** Compute the IMDCT and apply window for all sub-frames and
|
||||
all channels in a frame */
|
||||
static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig *X,
|
||||
celt_sig * restrict out_mem[],
|
||||
|
@ -445,7 +445,7 @@ static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig *X
|
|||
int N2 = N;
|
||||
int B = 1;
|
||||
SAVE_STACK;
|
||||
|
||||
|
||||
ALLOC(x, N+overlap, opus_val32);
|
||||
ALLOC(tmp, N, opus_val32);
|
||||
|
||||
|
@ -1509,7 +1509,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
|
|||
#ifdef MEASURE_NORM_MSE
|
||||
float X0[3000];
|
||||
float bandE0[60];
|
||||
c=0; do
|
||||
c=0; do
|
||||
for (i=0;i<N;i++)
|
||||
X0[i+c*N] = X[i+c*N];
|
||||
while (++c<C);
|
||||
|
@ -1654,7 +1654,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
|
|||
/* If there's any room left (can only happen for very high rates),
|
||||
it's already filled with zeros */
|
||||
ec_enc_done(enc);
|
||||
|
||||
|
||||
if (st->signalling)
|
||||
nbCompressedBytes++;
|
||||
|
||||
|
@ -1737,7 +1737,7 @@ int celt_encode_float(CELTEncoder * restrict st, const float * pcm, int frame_si
|
|||
int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
||||
va_start(ap, request);
|
||||
switch (request)
|
||||
{
|
||||
|
@ -1864,7 +1864,7 @@ bad_request:
|
|||
/**********************************************************************/
|
||||
#define DECODE_BUFFER_SIZE 2048
|
||||
|
||||
/** Decoder state
|
||||
/** Decoder state
|
||||
@brief Decoder state
|
||||
*/
|
||||
struct CELTDecoder {
|
||||
|
@ -1892,7 +1892,7 @@ struct CELTDecoder {
|
|||
int postfilter_tapset_old;
|
||||
|
||||
celt_sig preemph_memD[2];
|
||||
|
||||
|
||||
celt_sig _decode_mem[1]; /* Size = channels*(DECODE_BUFFER_SIZE+mode->overlap) */
|
||||
/* opus_val16 lpc[], Size = channels*LPC_ORDER */
|
||||
/* opus_val16 oldEBands[], Size = 2*mode->nbEBands */
|
||||
|
@ -2008,7 +2008,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc
|
|||
opus_val16 *oldBandE, *oldLogE2, *backgroundLogE;
|
||||
int plc=1;
|
||||
SAVE_STACK;
|
||||
|
||||
|
||||
c=0; do {
|
||||
decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+st->overlap);
|
||||
out_mem[c] = decode_mem[c]+DECODE_BUFFER_SIZE-MAX_PERIOD;
|
||||
|
@ -2024,7 +2024,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc
|
|||
out_syn[1] = out_mem[1]+MAX_PERIOD-N;
|
||||
|
||||
len = N+st->mode->overlap;
|
||||
|
||||
|
||||
if (st->loss_count >= 5)
|
||||
{
|
||||
VARDECL(celt_sig, freq);
|
||||
|
@ -2236,7 +2236,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc
|
|||
}
|
||||
|
||||
deemphasis(out_syn, pcm, N, C, st->downsample, st->mode->preemph, st->preemph_memD);
|
||||
|
||||
|
||||
st->loss_count++;
|
||||
|
||||
RESTORE_STACK;
|
||||
|
@ -2354,7 +2354,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
|
|||
for (i=0;i<M*st->mode->eBands[st->start];i++)
|
||||
X[c*N+i] = 0;
|
||||
while (++c<C);
|
||||
c=0; do
|
||||
c=0; do
|
||||
for (i=M*st->mode->eBands[effEnd];i<N;i++)
|
||||
X[c*N+i] = 0;
|
||||
while (++c<C);
|
||||
|
@ -2491,7 +2491,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
|
|||
codedBands = compute_allocation(st->mode, st->start, st->end, offsets, cap,
|
||||
alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses,
|
||||
fine_quant, fine_priority, C, LM, dec, 0, 0);
|
||||
|
||||
|
||||
unquant_fine_energy(st->mode, st->start, st->end, oldBandE, fine_quant, dec, C);
|
||||
|
||||
/* Decode fixed codebook */
|
||||
|
@ -2635,13 +2635,13 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
|
|||
|
||||
C = CHANNELS(st->channels);
|
||||
N = frame_size;
|
||||
|
||||
|
||||
ALLOC(out, C*N, opus_int16);
|
||||
ret=celt_decode_with_ec(st, data, len, out, frame_size, dec);
|
||||
if (ret>0)
|
||||
for (j=0;j<C*ret;j++)
|
||||
pcm[j]=out[j]*(1.f/32768.f);
|
||||
|
||||
|
||||
RESTORE_STACK;
|
||||
return ret;
|
||||
}
|
||||
|
@ -2666,7 +2666,7 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in
|
|||
if (ret>0)
|
||||
for (j=0;j<C*ret;j++)
|
||||
pcm[j] = FLOAT2INT16 (out[j]);
|
||||
|
||||
|
||||
RESTORE_STACK;
|
||||
return ret;
|
||||
}
|
||||
|
@ -2782,7 +2782,6 @@ const char *celt_strerror(int error)
|
|||
};
|
||||
if (error > 0 || error < -7)
|
||||
return "unknown error";
|
||||
else
|
||||
else
|
||||
return error_strings[-error];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/**
|
||||
@file celt.h
|
||||
|
@ -11,14 +11,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -124,7 +124,7 @@ extern "C" {
|
|||
|
||||
|
||||
|
||||
/** Contains the state of an encoder. One encoder state is needed
|
||||
/** Contains the state of an encoder. One encoder state is needed
|
||||
for each stream. It is initialised once at the beginning of the
|
||||
stream. Do *not* re-initialise the state for every frame.
|
||||
@brief Encoder state
|
||||
|
@ -138,7 +138,7 @@ typedef struct CELTDecoder CELTDecoder;
|
|||
|
||||
/** The mode contains all the information necessary to create an
|
||||
encoder. Both the encoder and decoder need to be initialised
|
||||
with exactly the same mode, otherwise the quality will be very
|
||||
with exactly the same mode, otherwise the quality will be very
|
||||
bad */
|
||||
typedef struct CELTMode CELTMode;
|
||||
|
||||
|
@ -148,18 +148,18 @@ typedef struct CELTMode CELTMode;
|
|||
|
||||
/* Mode calls */
|
||||
|
||||
/** Creates a new mode struct. This will be passed to an encoder or
|
||||
decoder. The mode MUST NOT BE DESTROYED until the encoders and
|
||||
/** Creates a new mode struct. This will be passed to an encoder or
|
||||
decoder. The mode MUST NOT BE DESTROYED until the encoders and
|
||||
decoders that use it are destroyed as well.
|
||||
@param Fs Sampling rate (32000 to 96000 Hz)
|
||||
@param frame_size Number of samples (per channel) to encode in each
|
||||
@param frame_size Number of samples (per channel) to encode in each
|
||||
packet (even values; 64 - 512)
|
||||
@param error Returned error code (if NULL, no error will be returned)
|
||||
@return A newly created mode
|
||||
*/
|
||||
CELT_EXPORT CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error);
|
||||
|
||||
/** Destroys a mode struct. Only call this after all encoders and
|
||||
/** Destroys a mode struct. Only call this after all encoders and
|
||||
decoders using this mode are destroyed as well.
|
||||
@param mode Mode to be destroyed
|
||||
*/
|
||||
|
@ -171,7 +171,7 @@ CELT_EXPORT int celt_encoder_get_size(int channels);
|
|||
|
||||
CELT_EXPORT int celt_encoder_get_size_custom(const CELTMode *mode, int channels);
|
||||
|
||||
/** Creates a new encoder state. Each stream needs its own encoder
|
||||
/** Creates a new encoder state. Each stream needs its own encoder
|
||||
state (can't be shared across simultaneous streams).
|
||||
@param channels Number of channels
|
||||
@param error Returns an error code
|
||||
|
@ -182,7 +182,7 @@ CELT_EXPORT CELTEncoder *celt_encoder_create(int sampling_rate, int channels, in
|
|||
/** Creates a new encoder state. Each stream needs its own encoder
|
||||
state (can't be shared across simultaneous streams).
|
||||
@param mode Contains all the information about the characteristics of
|
||||
* the stream (must be the same characteristics as used for the
|
||||
* the stream (must be the same characteristics as used for the
|
||||
* decoder)
|
||||
@param channels Number of channels
|
||||
@param error Returns an error code
|
||||
|
@ -201,8 +201,8 @@ CELT_EXPORT void celt_encoder_destroy(CELTEncoder *st);
|
|||
|
||||
/** Encodes a frame of audio.
|
||||
@param st Encoder state
|
||||
@param pcm PCM audio in float format, with a normal range of ±1.0.
|
||||
* Samples with a range beyond ±1.0 are supported but will
|
||||
@param pcm PCM audio in float format, with a normal range of +/-1.0.
|
||||
* Samples with a range beyond +/-1.0 are supported but will
|
||||
* be clipped by decoders using the integer API and should
|
||||
* only be used if it is known that the far end supports
|
||||
* extended dynmaic range. There must be exactly
|
||||
|
@ -235,7 +235,7 @@ CELT_EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, int frame_s
|
|||
*/
|
||||
CELT_EXPORT int celt_encode(CELTEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes);
|
||||
|
||||
/** Query and set encoder parameters
|
||||
/** Query and set encoder parameters
|
||||
@param st Encoder state
|
||||
@param request Parameter to change or query
|
||||
@param value Pointer to a 32-bit int value
|
||||
|
@ -284,7 +284,7 @@ CELT_EXPORT void celt_decoder_destroy(CELTDecoder *st);
|
|||
@param len Number of bytes to read from "data". This MUST be exactly the number
|
||||
of bytes returned by the encoder. Using a larger value WILL NOT WORK.
|
||||
@param pcm One frame (frame_size samples per channel) of decoded PCM will be
|
||||
returned here in float format.
|
||||
returned here in float format.
|
||||
@return Error code.
|
||||
*/
|
||||
CELT_EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size);
|
||||
|
@ -295,7 +295,7 @@ CELT_EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, in
|
|||
@param len Number of bytes to read from "data". This MUST be exactly the number
|
||||
of bytes returned by the encoder. Using a larger value WILL NOT WORK.
|
||||
@param pcm One frame (frame_size samples per channel) of decoded PCM will be
|
||||
returned here in 16-bit PCM format (native endian).
|
||||
returned here in 16-bit PCM format (native endian).
|
||||
@return Error code.
|
||||
*/
|
||||
CELT_EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size);
|
||||
|
|
|
@ -503,7 +503,7 @@ static void cwrsi5(int _k,opus_uint32 _i,int *_y){
|
|||
}
|
||||
else if(p>_i)kr=_k-1;
|
||||
else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_i-=p;
|
||||
yj-=_k;
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -80,7 +80,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
|
|||
fprintf(file, "#endif\n");
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
||||
|
||||
fprintf(file, "#ifndef DEF_WINDOW%d\n", mode->overlap);
|
||||
fprintf(file, "#define DEF_WINDOW%d\n", mode->overlap);
|
||||
fprintf (file, "static const opus_val16 window%d[%d] = {\n", mode->overlap, mode->overlap);
|
||||
|
@ -89,7 +89,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
|
|||
fprintf (file, "};\n");
|
||||
fprintf(file, "#endif\n");
|
||||
fprintf(file, "\n");
|
||||
|
||||
|
||||
if (!standard)
|
||||
{
|
||||
fprintf(file, "#ifndef DEF_ALLOC_VECTORS%d_%d\n", mode->Fs, mdctSize);
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -60,7 +60,7 @@ static inline long IMUL32(long i, long j)
|
|||
#undef MULT16_16_Q15
|
||||
#define MULT16_16_Q15(a,b) (_smpy(a,b))
|
||||
|
||||
#undef MULT16_16SU
|
||||
#undef MULT16_16SU
|
||||
#define MULT16_16SU(a,b) _lmpysu(a,b)
|
||||
|
||||
#undef MULT_16_16
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -31,7 +31,7 @@
|
|||
#ifndef FIXED_C6X_H
|
||||
#define FIXED_C6X_H
|
||||
|
||||
#undef MULT16_16SU
|
||||
#undef MULT16_16SU
|
||||
#define MULT16_16SU(a,b) _mpysu(a,b)
|
||||
|
||||
#undef MULT_16_16
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -113,7 +113,7 @@ static inline int _EXTEND32(int x, char *file, int line)
|
|||
}
|
||||
|
||||
#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
|
||||
static inline short _SHR16(int a, int shift, char *file, int line)
|
||||
static inline short _SHR16(int a, int shift, char *file, int line)
|
||||
{
|
||||
int res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
|
||||
|
@ -127,7 +127,7 @@ static inline short _SHR16(int a, int shift, char *file, int line)
|
|||
return res;
|
||||
}
|
||||
#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
|
||||
static inline short _SHL16(int a, int shift, char *file, int line)
|
||||
static inline short _SHL16(int a, int shift, char *file, int line)
|
||||
{
|
||||
int res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
|
||||
|
@ -141,7 +141,7 @@ static inline short _SHL16(int a, int shift, char *file, int line)
|
|||
return res;
|
||||
}
|
||||
|
||||
static inline int SHR32(long long a, int shift)
|
||||
static inline int SHR32(long long a, int shift)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
|
||||
|
@ -156,7 +156,7 @@ static inline int SHR32(long long a, int shift)
|
|||
celt_mips+=2;
|
||||
return res;
|
||||
}
|
||||
static inline int SHL32(long long a, int shift)
|
||||
static inline int SHL32(long long a, int shift)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
|
||||
|
@ -187,7 +187,7 @@ static inline int SHL32(long long a, int shift)
|
|||
//#define SHL(a,shift) ((a) << (shift))
|
||||
|
||||
#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
|
||||
static inline short _ADD16(int a, int b, char *file, int line)
|
||||
static inline short _ADD16(int a, int b, char *file, int line)
|
||||
{
|
||||
int res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -204,7 +204,7 @@ static inline short _ADD16(int a, int b, char *file, int line)
|
|||
}
|
||||
|
||||
#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
|
||||
static inline short _SUB16(int a, int b, char *file, int line)
|
||||
static inline short _SUB16(int a, int b, char *file, int line)
|
||||
{
|
||||
int res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -219,7 +219,7 @@ static inline short _SUB16(int a, int b, char *file, int line)
|
|||
}
|
||||
|
||||
#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
|
||||
static inline int _ADD32(long long a, long long b, char *file, int line)
|
||||
static inline int _ADD32(long long a, long long b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_INT(b))
|
||||
|
@ -236,7 +236,7 @@ static inline int _ADD32(long long a, long long b, char *file, int line)
|
|||
}
|
||||
|
||||
#define SUB32(a, b) _SUB32(a, b, __FILE__, __LINE__)
|
||||
static inline int _SUB32(long long a, long long b, char *file, int line)
|
||||
static inline int _SUB32(long long a, long long b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_INT(b))
|
||||
|
@ -252,7 +252,7 @@ static inline int _SUB32(long long a, long long b, char *file, int line)
|
|||
|
||||
#undef UADD32
|
||||
#define UADD32(a, b) _UADD32(a, b, __FILE__, __LINE__)
|
||||
static inline unsigned int _UADD32(unsigned long long a, unsigned long long b, char *file, int line)
|
||||
static inline unsigned int _UADD32(unsigned long long a, unsigned long long b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
|
||||
|
@ -270,7 +270,7 @@ static inline unsigned int _UADD32(unsigned long long a, unsigned long long b, c
|
|||
|
||||
#undef USUB32
|
||||
#define USUB32(a, b) _USUB32(a, b, __FILE__, __LINE__)
|
||||
static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, char *file, int line)
|
||||
static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
|
||||
|
@ -289,7 +289,7 @@ static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, c
|
|||
|
||||
|
||||
/* result fits in 16 bits */
|
||||
static inline short MULT16_16_16(int a, int b)
|
||||
static inline short MULT16_16_16(int a, int b)
|
||||
{
|
||||
int res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -304,7 +304,7 @@ static inline short MULT16_16_16(int a, int b)
|
|||
}
|
||||
|
||||
#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
|
||||
static inline int _MULT16_16(int a, int b, char *file, int line)
|
||||
static inline int _MULT16_16(int a, int b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -333,7 +333,7 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
|
|||
fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
|
||||
}
|
||||
if (ABS32(b)>=((opus_val32)(1)<<(15+Q)))
|
||||
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
|
||||
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
|
||||
res = (((long long)a)*(long long)b) >> Q;
|
||||
if (!VERIFY_INT(res))
|
||||
fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
|
||||
|
@ -352,7 +352,7 @@ static inline int MULT16_32_PX(int a, long long b, int Q)
|
|||
fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
|
||||
}
|
||||
if (ABS32(b)>=((opus_val32)(1)<<(15+Q)))
|
||||
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
|
||||
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
|
||||
res = ((((long long)a)*(long long)b) + (((opus_val32)(1)<<Q)>>1))>> Q;
|
||||
if (!VERIFY_INT(res))
|
||||
fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
|
||||
|
@ -383,7 +383,7 @@ static inline int SATURATE(int a, int b)
|
|||
return a;
|
||||
}
|
||||
|
||||
static inline int MULT16_16_Q11_32(int a, int b)
|
||||
static inline int MULT16_16_Q11_32(int a, int b)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -397,7 +397,7 @@ static inline int MULT16_16_Q11_32(int a, int b)
|
|||
celt_mips+=3;
|
||||
return res;
|
||||
}
|
||||
static inline short MULT16_16_Q13(int a, int b)
|
||||
static inline short MULT16_16_Q13(int a, int b)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -411,7 +411,7 @@ static inline short MULT16_16_Q13(int a, int b)
|
|||
celt_mips+=3;
|
||||
return res;
|
||||
}
|
||||
static inline short MULT16_16_Q14(int a, int b)
|
||||
static inline short MULT16_16_Q14(int a, int b)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -427,7 +427,7 @@ static inline short MULT16_16_Q14(int a, int b)
|
|||
}
|
||||
|
||||
#define MULT16_16_Q15(a, b) _MULT16_16_Q15(a, b, __FILE__, __LINE__)
|
||||
static inline short _MULT16_16_Q15(int a, int b, char *file, int line)
|
||||
static inline short _MULT16_16_Q15(int a, int b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -444,7 +444,7 @@ static inline short _MULT16_16_Q15(int a, int b, char *file, int line)
|
|||
return res;
|
||||
}
|
||||
|
||||
static inline short MULT16_16_P13(int a, int b)
|
||||
static inline short MULT16_16_P13(int a, int b)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -461,7 +461,7 @@ static inline short MULT16_16_P13(int a, int b)
|
|||
celt_mips+=4;
|
||||
return res;
|
||||
}
|
||||
static inline short MULT16_16_P14(int a, int b)
|
||||
static inline short MULT16_16_P14(int a, int b)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -478,7 +478,7 @@ static inline short MULT16_16_P14(int a, int b)
|
|||
celt_mips+=4;
|
||||
return res;
|
||||
}
|
||||
static inline short MULT16_16_P15(int a, int b)
|
||||
static inline short MULT16_16_P15(int a, int b)
|
||||
{
|
||||
long long res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
|
||||
|
@ -498,7 +498,7 @@ static inline short MULT16_16_P15(int a, int b)
|
|||
|
||||
#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
|
||||
|
||||
static inline int _DIV32_16(long long a, long long b, char *file, int line)
|
||||
static inline int _DIV32_16(long long a, long long b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (b==0)
|
||||
|
@ -524,7 +524,7 @@ static inline int _DIV32_16(long long a, long long b, char *file, int line)
|
|||
}
|
||||
|
||||
#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
|
||||
static inline int _DIV32(long long a, long long b, char *file, int line)
|
||||
static inline int _DIV32(long long a, long long b, char *file, int line)
|
||||
{
|
||||
long long res;
|
||||
if (b==0)
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -29,20 +29,20 @@
|
|||
#ifndef FLOAT_CAST_H
|
||||
#define FLOAT_CAST_H
|
||||
|
||||
/*============================================================================
|
||||
/*============================================================================
|
||||
** On Intel Pentium processors (especially PIII and probably P4), converting
|
||||
** from float to int is very slow. To meet the C specs, the code produced by
|
||||
** most C compilers targeting Pentium needs to change the FPU rounding mode
|
||||
** before the float to int conversion is performed.
|
||||
** from float to int is very slow. To meet the C specs, the code produced by
|
||||
** most C compilers targeting Pentium needs to change the FPU rounding mode
|
||||
** before the float to int conversion is performed.
|
||||
**
|
||||
** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It
|
||||
** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It
|
||||
** is this flushing of the pipeline which is so slow.
|
||||
**
|
||||
** Fortunately the ISO C99 specifications define the functions lrint, lrintf,
|
||||
** llrint and llrintf which fix this problem as a side effect.
|
||||
** llrint and llrintf which fix this problem as a side effect.
|
||||
**
|
||||
** On Unix-like systems, the configure process should have detected the
|
||||
** presence of these functions. If they weren't found we have to replace them
|
||||
** On Unix-like systems, the configure process should have detected the
|
||||
** presence of these functions. If they weren't found we have to replace them
|
||||
** here with a standard C cast.
|
||||
*/
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
|||
|
||||
/* These defines enable functionality introduced with the 1999 ISO C
|
||||
** standard. They must be defined before the inclusion of math.h to
|
||||
** engage them. If optimisation is enabled, these functions will be
|
||||
** engage them. If optimisation is enabled, these functions will be
|
||||
** inlined. With optimisation switched off, you have to link in the
|
||||
** maths library using -lm.
|
||||
*/
|
||||
|
@ -98,11 +98,11 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
/* Win32 doesn't seem to have these functions.
|
||||
/* Win32 doesn't seem to have these functions.
|
||||
** Therefore implement inline versions of these functions here.
|
||||
*/
|
||||
|
||||
__inline long int
|
||||
__inline long int
|
||||
float2int (float flt)
|
||||
{ int intgr;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ static void kf_bfly4(
|
|||
C_MUL4(scratch[0],Fout[m] , *tw1 );
|
||||
C_MUL4(scratch[1],Fout[m2] , *tw2 );
|
||||
C_MUL4(scratch[2],Fout[m3] , *tw3 );
|
||||
|
||||
|
||||
Fout->r = PSHR(Fout->r, 2);
|
||||
Fout->i = PSHR(Fout->i, 2);
|
||||
C_SUB( scratch[5] , *Fout, scratch[1] );
|
||||
|
@ -133,7 +133,7 @@ static void kf_bfly4(
|
|||
tw2 += fstride*2;
|
||||
tw3 += fstride*3;
|
||||
C_ADDTO( *Fout , scratch[3] );
|
||||
|
||||
|
||||
Fout[m].r = scratch[5].r + scratch[4].i;
|
||||
Fout[m].i = scratch[5].i - scratch[4].r;
|
||||
Fout[m3].r = scratch[5].r - scratch[4].i;
|
||||
|
@ -168,7 +168,7 @@ static void ki_bfly4(
|
|||
C_MULC(scratch[0],Fout[m] , *tw1 );
|
||||
C_MULC(scratch[1],Fout[m2] , *tw2 );
|
||||
C_MULC(scratch[2],Fout[m3] , *tw3 );
|
||||
|
||||
|
||||
C_SUB( scratch[5] , *Fout, scratch[1] );
|
||||
C_ADDTO(*Fout, scratch[1]);
|
||||
C_ADD( scratch[3] , scratch[0] , scratch[2] );
|
||||
|
@ -178,7 +178,7 @@ static void ki_bfly4(
|
|||
tw2 += fstride*2;
|
||||
tw3 += fstride*3;
|
||||
C_ADDTO( *Fout , scratch[3] );
|
||||
|
||||
|
||||
Fout[m].r = scratch[5].r - scratch[4].i;
|
||||
Fout[m].i = scratch[5].i + scratch[4].r;
|
||||
Fout[m3].r = scratch[5].r + scratch[4].i;
|
||||
|
@ -446,7 +446,7 @@ static void kf_work(
|
|||
const int p=*factors++; /* the radix */
|
||||
const int m=*factors++; /* stage's fft length/p */
|
||||
/*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/
|
||||
if (m!=1)
|
||||
if (m!=1)
|
||||
kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, m);
|
||||
|
||||
/* Compensate for longer twiddles table (when sharing) */
|
||||
|
@ -459,7 +459,7 @@ static void kf_work(
|
|||
case 3: kf_bfly3(Fout,fstride,st,m, N, m2); break;
|
||||
case 5: kf_bfly5(Fout,fstride,st,m, N, m2); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -477,7 +477,7 @@ static void ki_work(
|
|||
const int p=*factors++; /* the radix */
|
||||
const int m=*factors++; /* stage's fft length/p */
|
||||
/*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/
|
||||
if (m!=1)
|
||||
if (m!=1)
|
||||
ki_work( Fout , f, fstride*p, in_stride, factors,st, N*p, m);
|
||||
|
||||
/* Compensate for longer twiddles table (when sharing) */
|
||||
|
@ -490,7 +490,7 @@ static void ki_work(
|
|||
case 3: ki_bfly3(Fout,fstride,st,m, N, m2); break;
|
||||
case 5: ki_bfly5(Fout,fstride,st,m, N, m2); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -531,10 +531,10 @@ void compute_bitrev_table(
|
|||
|
||||
|
||||
/* facbuf is populated by p1,m1,p2,m2, ...
|
||||
where
|
||||
where
|
||||
p[i] * m[i] = m[i-1]
|
||||
m0 = n */
|
||||
static
|
||||
static
|
||||
int kf_factor(int n,opus_int16 * facbuf)
|
||||
{
|
||||
int p=4;
|
||||
|
|
|
@ -115,9 +115,9 @@ typedef struct kiss_fft_state{
|
|||
|
||||
//typedef struct kiss_fft_state* kiss_fft_cfg;
|
||||
|
||||
/**
|
||||
/**
|
||||
* kiss_fft_alloc
|
||||
*
|
||||
*
|
||||
* Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
|
||||
*
|
||||
* typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
|
||||
|
@ -127,14 +127,14 @@ typedef struct kiss_fft_state{
|
|||
*
|
||||
* If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
|
||||
* The returned value should be free()d when done to avoid memory leaks.
|
||||
*
|
||||
*
|
||||
* The state can be placed in a user supplied buffer 'mem':
|
||||
* If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
|
||||
* then the function places the cfg in mem and the size used in *lenmem
|
||||
* and returns mem.
|
||||
*
|
||||
*
|
||||
* If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
|
||||
* then the function returns NULL and places the minimum cfg
|
||||
* then the function returns NULL and places the minimum cfg
|
||||
* buffer size in *lenmem.
|
||||
* */
|
||||
|
||||
|
@ -159,7 +159,7 @@ void kiss_fft_free(const kiss_fft_state *cfg);
|
|||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -29,14 +29,14 @@
|
|||
/* This is a simple MDCT implementation that uses a N/4 complex FFT
|
||||
to do most of the work. It should be relatively straightforward to
|
||||
plug in pretty much and FFT here.
|
||||
|
||||
This replaces the Vorbis FFT (and uses the exact same API), which
|
||||
was a bit too messy and that was ending up duplicating code
|
||||
|
||||
This replaces the Vorbis FFT (and uses the exact same API), which
|
||||
was a bit too messy and that was ending up duplicating code
|
||||
(might as well use the same FFT everywhere).
|
||||
|
||||
|
||||
The algorithm is similar to (and inspired from) Fabrice Bellard's
|
||||
MDCT implementation in FFMPEG, but has differences in signs, ordering
|
||||
and scaling in many places.
|
||||
and scaling in many places.
|
||||
*/
|
||||
|
||||
#ifndef SKIP_CONFIG_H
|
||||
|
@ -227,7 +227,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
|
|||
#else
|
||||
sine = (kiss_twiddle_scalar)2*M_PI*(.125f)/N;
|
||||
#endif
|
||||
|
||||
|
||||
/* Pre-rotate */
|
||||
{
|
||||
/* Temp pointers to make it really clear to the compiler what we're doing */
|
||||
|
@ -235,7 +235,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
|
|||
const kiss_fft_scalar * restrict xp2 = in+N2-1;
|
||||
kiss_fft_scalar * restrict yp = f2;
|
||||
const kiss_twiddle_scalar *t = &l->trig[0];
|
||||
for(i=0;i<N4;i++)
|
||||
for(i=0;i<N4;i++)
|
||||
{
|
||||
kiss_fft_scalar yr, yi;
|
||||
yr = -S_MUL(*xp2, t[i<<shift]) + S_MUL(*xp1,t[(N4-i)<<shift]);
|
||||
|
@ -250,7 +250,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
|
|||
|
||||
/* Inverse N/4 complex FFT. This one should *not* downscale even in fixed-point */
|
||||
kiss_ifft(l->kfft[shift], (kiss_fft_cpx *)f2, (kiss_fft_cpx *)f);
|
||||
|
||||
|
||||
/* Post-rotate */
|
||||
{
|
||||
kiss_fft_scalar * restrict fp = f;
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -29,14 +29,14 @@
|
|||
/* This is a simple MDCT implementation that uses a N/4 complex FFT
|
||||
to do most of the work. It should be relatively straightforward to
|
||||
plug in pretty much and FFT here.
|
||||
|
||||
This replaces the Vorbis FFT (and uses the exact same API), which
|
||||
was a bit too messy and that was ending up duplicating code
|
||||
|
||||
This replaces the Vorbis FFT (and uses the exact same API), which
|
||||
was a bit too messy and that was ending up duplicating code
|
||||
(might as well use the same FFT everywhere).
|
||||
|
||||
|
||||
The algorithm is similar to (and inspired from) Fabrice Bellard's
|
||||
MDCT implementation in FFMPEG, but has differences in signs, ordering
|
||||
and scaling in many places.
|
||||
and scaling in many places.
|
||||
*/
|
||||
|
||||
#ifndef MDCT_H
|
||||
|
@ -58,7 +58,7 @@ void clt_mdct_clear(mdct_lookup *l);
|
|||
/** Compute a forward MDCT and scale by 4/N */
|
||||
void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const opus_val16 *window, int overlap, int shift);
|
||||
|
||||
/** Compute a backward MDCT (no scaling) and performs weighted overlap-add
|
||||
/** Compute a backward MDCT (no scaling) and performs weighted overlap-add
|
||||
(scales implicitly by 1/2) */
|
||||
void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const opus_val16 * restrict window, int overlap, int shift);
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -115,10 +115,10 @@ static opus_int16 *compute_ebands(opus_int32 Fs, int frame_size, int res, int *n
|
|||
high = nBark-lin;
|
||||
*nbEBands = low+high;
|
||||
eBands = celt_alloc(sizeof(opus_int16)*(*nbEBands+2));
|
||||
|
||||
|
||||
if (eBands==NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* Linear spacing (min_width) */
|
||||
for (i=0;i<low;i++)
|
||||
eBands[i] = i;
|
||||
|
@ -234,7 +234,7 @@ CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error)
|
|||
#if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA)
|
||||
if (global_stack==NULL)
|
||||
goto failure;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CUSTOM_MODES_ONLY
|
||||
|
@ -261,7 +261,7 @@ CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error)
|
|||
#else
|
||||
|
||||
/* The good thing here is that permutation of the arguments will automatically be invalid */
|
||||
|
||||
|
||||
if (Fs < 8000 || Fs > 96000)
|
||||
{
|
||||
if (error)
|
||||
|
@ -350,14 +350,14 @@ CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error)
|
|||
mode->effEBands = mode->nbEBands;
|
||||
while (mode->eBands[mode->effEBands] > mode->shortMdctSize)
|
||||
mode->effEBands--;
|
||||
|
||||
|
||||
/* Overlap must be divisible by 4 */
|
||||
mode->overlap = ((mode->shortMdctSize>>2)<<2);
|
||||
|
||||
compute_allocation_table(mode);
|
||||
if (mode->allocVectors==NULL)
|
||||
goto failure;
|
||||
|
||||
|
||||
window = (opus_val16*)celt_alloc(mode->overlap*sizeof(opus_val16));
|
||||
if (window==NULL)
|
||||
goto failure;
|
||||
|
@ -415,7 +415,7 @@ void celt_mode_destroy(CELTMode *mode)
|
|||
#endif /* CUSTOM_MODES_ONLY */
|
||||
celt_free((opus_int16*)mode->eBands);
|
||||
celt_free((opus_int16*)mode->allocVectors);
|
||||
|
||||
|
||||
celt_free((opus_val16*)mode->window);
|
||||
celt_free((opus_int16*)mode->logN);
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -65,7 +65,7 @@ typedef struct {
|
|||
} PulseCache;
|
||||
|
||||
/** Mode definition (opaque)
|
||||
@brief Mode definition
|
||||
@brief Mode definition
|
||||
*/
|
||||
struct CELTMode {
|
||||
opus_int32 Fs;
|
||||
|
@ -75,10 +75,10 @@ struct CELTMode {
|
|||
int effEBands;
|
||||
opus_val16 preemph[4];
|
||||
const opus_int16 *eBands; /**< Definition for each "pseudo-critical band" */
|
||||
|
||||
|
||||
int nbAllocVectors; /**< Number of lines in the matrix below */
|
||||
const unsigned char *allocVectors; /**< Number of bits in each band for several rates */
|
||||
|
||||
|
||||
/* Stuff that could go in the {en,de}coder, but we save space this way */
|
||||
mdct_lookup mdct;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
typedef uint16_t opus_uint16;
|
||||
typedef int32_t opus_int32;
|
||||
typedef uint32_t opus_uint32;
|
||||
#elif defined(_WIN32)
|
||||
#elif defined(_WIN32)
|
||||
|
||||
# if defined(__CYGWIN__)
|
||||
# include <_G_config.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 2007 Jean-Marc Valin
|
||||
|
||||
|
||||
File: os_support.h
|
||||
This is the (tiny) OS abstraction layer. Aside from math.h, this is the
|
||||
only place where system headers are allowed.
|
||||
|
@ -39,12 +39,12 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/** CELT wrapper for calloc(). To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free
|
||||
/** CELT wrapper for calloc(). To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free
|
||||
NOTE: celt_alloc needs to CLEAR THE MEMORY */
|
||||
#ifndef OVERRIDE_CELT_ALLOC
|
||||
static inline void *celt_alloc (int size)
|
||||
{
|
||||
/* WARNING: this is not equivalent to malloc(). If you want to use malloc()
|
||||
/* WARNING: this is not equivalent to malloc(). If you want to use malloc()
|
||||
or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
|
||||
you will experience strange bugs */
|
||||
return calloc(size,1);
|
||||
|
@ -81,7 +81,7 @@ static inline void celt_free_scratch (void *ptr)
|
|||
#define CELT_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
|
||||
#endif
|
||||
|
||||
/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term
|
||||
/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term
|
||||
provides compile-time type checking */
|
||||
#ifndef OVERRIDE_CELT_MOVE
|
||||
#define CELT_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -226,7 +226,7 @@ void pitch_search(const opus_val16 * restrict x_lp, opus_val16 * restrict y,
|
|||
offset = 1;
|
||||
else if ((a-c) > MULT16_32_Q15(QCONST16(.7f,15),b-c))
|
||||
offset = -1;
|
||||
else
|
||||
else
|
||||
offset = 0;
|
||||
} else {
|
||||
offset = 0;
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -42,7 +42,7 @@ const opus_val32 *ac, /* in: [0...p] autocorrelation values */
|
|||
int p
|
||||
)
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
opus_val32 r;
|
||||
opus_val32 error = ac[0];
|
||||
#ifdef FIXED_POINT
|
||||
|
@ -144,7 +144,7 @@ void _celt_autocorr(
|
|||
opus_val32 *ac, /* out: [0...lag-1] ac values */
|
||||
const opus_val16 *window,
|
||||
int overlap,
|
||||
int lag,
|
||||
int lag,
|
||||
int n
|
||||
)
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ void _celt_autocorr(
|
|||
#endif
|
||||
while (lag>=0)
|
||||
{
|
||||
for (i = lag, d = 0; i < n; i++)
|
||||
for (i = lag, d = 0; i < n; i++)
|
||||
d += xx[i] * xx[i-lag];
|
||||
ac[lag] = d;
|
||||
/*printf ("%f ", ac[lag]);*/
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -245,7 +245,7 @@ static int quant_coarse_energy_impl(const CELTMode *m, int start, int end,
|
|||
error[i+c*m->nbEBands] = PSHR32(f,7) - SHL16(qi,DB_SHIFT);
|
||||
badness += abs(qi0-qi);
|
||||
q = SHL32(EXTEND32(qi),DB_SHIFT);
|
||||
|
||||
|
||||
tmp = PSHR32(MULT16_16(coef,oldE),8) + prev[c] + SHL32(q,7);
|
||||
#ifdef FIXED_POINT
|
||||
tmp = MAX32(-QCONST32(28.f, DB_SHIFT+7), tmp);
|
||||
|
@ -493,7 +493,7 @@ void unquant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldE
|
|||
{
|
||||
if (fine_quant[i] <= 0)
|
||||
continue;
|
||||
c=0;
|
||||
c=0;
|
||||
do {
|
||||
int q2;
|
||||
opus_val16 offset;
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -537,7 +537,7 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets
|
|||
VARDECL(int, thresh);
|
||||
VARDECL(int, trim_offset);
|
||||
SAVE_STACK;
|
||||
|
||||
|
||||
total = IMAX(total, 0);
|
||||
len = m->nbEBands;
|
||||
skip_start = start;
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -92,7 +92,7 @@ static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses)
|
|||
opus_int16 **compute_alloc_cache(CELTMode *m, int M);
|
||||
|
||||
/** Compute the pulse allocation, i.e. how many pulses will go in each
|
||||
* band.
|
||||
* band.
|
||||
@param m mode
|
||||
@param offsets Requested increase or decrease in the number of bits for
|
||||
each band
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -127,14 +127,14 @@ extern char *global_stack_top;
|
|||
#define RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack))
|
||||
#define ALLOC_STACK char *_saved_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)); _saved_stack = global_stack;
|
||||
|
||||
#else
|
||||
#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 char *_saved_stack; (global_stack = (global_stack==0) ? celt_alloc_scratch(GLOBAL_STACK_SIZE) : global_stack); _saved_stack = global_stack;
|
||||
|
||||
#endif /*ENABLE_VALGRIND*/
|
||||
#endif /*ENABLE_VALGRIND*/
|
||||
|
||||
#include "os_support.h"
|
||||
#define VARDECL(type, var) type *var
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|||
"<input> <output>\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
rate = atoi(argv[1]);
|
||||
channels = atoi(argv[2]);
|
||||
frame_size = atoi(argv[3]);
|
||||
|
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
|
|||
fprintf (stderr, "Could not open output file %s\n", argv[argc-1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
enc = celt_encoder_create_custom(mode, channels, &err);
|
||||
if (err != 0)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
|
|||
complexity=atoi(argv[5]);
|
||||
celt_encoder_ctl(enc,CELT_SET_COMPLEXITY(complexity));
|
||||
}
|
||||
|
||||
|
||||
in = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16));
|
||||
out = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16));
|
||||
|
||||
|
@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
|||
skip = 0;
|
||||
}
|
||||
PRINT_MIPS(stderr);
|
||||
|
||||
|
||||
celt_encoder_destroy(enc);
|
||||
celt_decoder_destroy(dec);
|
||||
fclose(fin);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CELT_C
|
||||
#define CELT_C
|
||||
#include "../libcelt/stack_alloc.h"
|
||||
#include "../libcelt/entenc.c"
|
||||
#include "../libcelt/entdec.c"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <stdio.h>
|
||||
#include "kiss_fft.h"
|
||||
|
||||
#define CELT_C
|
||||
#define CELT_C
|
||||
#include "../libcelt/stack_alloc.h"
|
||||
#include "../libcelt/kiss_fft.c"
|
||||
#include "../libcelt/mathops.c"
|
||||
|
@ -22,7 +22,7 @@
|
|||
#define M_PI 3.141592653
|
||||
#endif
|
||||
|
||||
#ifdef FIXED_DEBUG
|
||||
#ifdef FIXED_DEBUG
|
||||
long long celt_mips=0;
|
||||
#endif
|
||||
int ret = 0;
|
||||
|
@ -31,7 +31,7 @@ void check(kiss_fft_cpx * in,kiss_fft_cpx * out,int nfft,int isinverse)
|
|||
{
|
||||
int bin,k;
|
||||
double errpow=0,sigpow=0, snr;
|
||||
|
||||
|
||||
for (bin=0;bin<nfft;++bin) {
|
||||
double ansr = 0;
|
||||
double ansi = 0;
|
||||
|
@ -88,7 +88,7 @@ void test1d(int nfft,int isinverse)
|
|||
in[k].i *= 32768;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (isinverse)
|
||||
{
|
||||
for (k=0;k<nfft;++k) {
|
||||
|
@ -96,9 +96,9 @@ void test1d(int nfft,int isinverse)
|
|||
in[k].i /= nfft;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/
|
||||
|
||||
|
||||
if (isinverse)
|
||||
kiss_ifft(cfg,in,out);
|
||||
else
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <time.h>
|
||||
#include "entcode.h"
|
||||
#include "entenc.h"
|
||||
#include "entdec.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "laplace.h"
|
||||
#define CELT_C
|
||||
#define CELT_C
|
||||
#include "../libcelt/stack_alloc.h"
|
||||
|
||||
#include "../libcelt/entenc.c"
|
||||
|
@ -33,7 +33,7 @@ int main(void)
|
|||
ALLOC_STACK;
|
||||
ptr = malloc(DATA_SIZE);
|
||||
ec_enc_init(&enc,ptr,DATA_SIZE);
|
||||
|
||||
|
||||
val[0] = 3; decay[0] = 6000;
|
||||
val[1] = 0; decay[1] = 5800;
|
||||
val[2] = -1; decay[2] = 5600;
|
||||
|
@ -60,6 +60,6 @@ int main(void)
|
|||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define WORD "%f"
|
||||
#endif
|
||||
|
||||
#ifdef FIXED_DEBUG
|
||||
#ifdef FIXED_DEBUG
|
||||
long long celt_mips=0;
|
||||
#endif
|
||||
int ret = 0;
|
||||
|
@ -67,7 +67,7 @@ void testlog2(void)
|
|||
if (error>0.0009)
|
||||
{
|
||||
fprintf (stderr, "celt_log2 failed: fabs((1.442695040888963387*log(x))-celt_log2(x))>0.001 (x = %f, error = %f)\n", x,error);
|
||||
ret = 1;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void testexp2(void)
|
|||
if (error>0.0002)
|
||||
{
|
||||
fprintf (stderr, "celt_exp2 failed: fabs(x-(1.442695040888963387*log(celt_exp2(x))))>0.0005 (x = %f, error = %f)\n", x,error);
|
||||
ret = 1;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void testexp2log2(void)
|
|||
if (error>0.001)
|
||||
{
|
||||
fprintf (stderr, "celt_log2/celt_exp2 failed: fabs(x-(celt_log2(celt_exp2(x))))>0.001 (x = %f, error = %f)\n", x,error);
|
||||
ret = 1;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include "mdct.h"
|
||||
#define CELT_C
|
||||
#define CELT_C
|
||||
#include "../libcelt/stack_alloc.h"
|
||||
|
||||
#include "../libcelt/kiss_fft.c"
|
||||
|
@ -22,7 +22,7 @@
|
|||
#define M_PI 3.141592653
|
||||
#endif
|
||||
|
||||
#ifdef FIXED_DEBUG
|
||||
#ifdef FIXED_DEBUG
|
||||
long long celt_mips=0;
|
||||
#endif
|
||||
int ret = 0;
|
||||
|
@ -38,7 +38,7 @@ void check(kiss_fft_scalar * in,kiss_fft_scalar * out,int nfft,int isinverse)
|
|||
for (k=0;k<nfft;++k) {
|
||||
double phase = 2*M_PI*(k+.5+.25*nfft)*(bin+.5)/nfft;
|
||||
double re = cos(phase);
|
||||
|
||||
|
||||
re /= nfft/4;
|
||||
|
||||
ansr += in[k] * re;
|
||||
|
@ -110,16 +110,16 @@ void test1d(int nfft,int isinverse)
|
|||
in[k] *= 32768;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (isinverse)
|
||||
{
|
||||
for (k=0;k<nfft;++k) {
|
||||
in[k] /= nfft;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/
|
||||
|
||||
|
||||
if (isinverse)
|
||||
{
|
||||
for (k=0;k<nfft;++k)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CELT_C
|
||||
#define CELT_C
|
||||
#include "../libcelt/stack_alloc.h"
|
||||
#include "../libcelt/kiss_fft.c"
|
||||
#include "../libcelt/kiss_fftr.c"
|
||||
|
@ -18,7 +18,7 @@ long long celt_mips=0;
|
|||
int ret=0;
|
||||
|
||||
static
|
||||
kiss_fft_scalar rand_scalar(void)
|
||||
kiss_fft_scalar rand_scalar(void)
|
||||
{
|
||||
return (rand()%32767)-16384;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ double snr_compare( kiss_fft_cpx * vec1,kiss_fft_scalar * vec2, int n)
|
|||
|
||||
vec1[0].i = vec1[n].r;
|
||||
for (k=0;k<n;++k) {
|
||||
sigpow += (double)vec1[k].r * (double)vec1[k].r +
|
||||
sigpow += (double)vec1[k].r * (double)vec1[k].r +
|
||||
(double)vec1[k].i * (double)vec1[k].i;
|
||||
err = (double)vec1[k].r - (double)vec2[2*k];
|
||||
/*printf ("%f %f\n", (double)vec1[k].r, (double)vec2[2*k]);*/
|
||||
|
@ -107,7 +107,7 @@ int main(void)
|
|||
kiss_fftr_state = kiss_fftr_alloc(NFFT,0,0);
|
||||
kiss_fft(kiss_fft_state,cin,cout);
|
||||
kiss_fftr(kiss_fftr_state,rin,sout);
|
||||
|
||||
|
||||
printf( "nfft=%d, inverse=%d, snr=%g\n",
|
||||
NFFT,0, snr_compare(cout,sout,(NFFT/2)) );
|
||||
|
||||
|
@ -120,13 +120,13 @@ int main(void)
|
|||
cin[i].i = rand_scalar();
|
||||
}
|
||||
|
||||
// conjugate symmetry of real signal
|
||||
// conjugate symmetry of real signal
|
||||
for (i=1;i< NFFT/2;++i) {
|
||||
cin[NFFT-i].r = cin[i].r;
|
||||
cin[NFFT-i].i = - cin[i].i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
#ifdef DOUBLE_PRECISION
|
||||
for (i=0;i< NFFT;++i) {
|
||||
|
@ -139,7 +139,7 @@ int main(void)
|
|||
cin[i].i /= NFFT;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
fin[0] = cin[0].r;
|
||||
fin[1] = cin[NFFT/2].r;
|
||||
for (i=1;i< NFFT/2;++i)
|
||||
|
@ -147,13 +147,13 @@ int main(void)
|
|||
fin[2*i] = cin[i].r;
|
||||
fin[2*i+1] = cin[i].i;
|
||||
}
|
||||
|
||||
|
||||
kiss_ifft(kiss_fft_state,cin,cout);
|
||||
kiss_fftri(kiss_fftr_state,fin,rout);
|
||||
/*
|
||||
printf(" results from inverse kiss_fft : (%f,%f), (%f,%f), (%f,%f), (%f,%f), (%f,%f) ...\n "
|
||||
, (float)cout[0].r , (float)cout[0].i , (float)cout[1].r , (float)cout[1].i , (float)cout[2].r , (float)cout[2].i , (float)cout[3].r , (float)cout[3].i , (float)cout[4].r , (float)cout[4].i
|
||||
);
|
||||
);
|
||||
|
||||
printf(" results from inverse kiss_fftr: %f,%f,%f,%f,%f ... \n"
|
||||
,(float)rout[0] ,(float)rout[1] ,(float)rout[2] ,(float)rout[3] ,(float)rout[4]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* (C) 2009 Gregory Maxwell
|
||||
|
||||
This test runs pink noise through the encoder and decoder many times
|
||||
This test runs pink noise through the encoder and decoder many times
|
||||
while feeding the output back into the input. It checks that after
|
||||
a number of cycles the energy has not increased or decreased by too
|
||||
large an amount.
|
||||
|
@ -8,14 +8,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -70,7 +70,7 @@ int async_tandem(int rate, int frame_size, int channels, int bitrate_min,
|
|||
if (bmin >= bmax)
|
||||
bmax = bmin + 8;
|
||||
|
||||
increment += (bmax - bmin) / 128;
|
||||
increment += (bmax - bmin) / 128;
|
||||
|
||||
printf ("Testing asynchronous tandeming (%dHz, %dch, %d samples, %d - %d bytes).\n",
|
||||
rate, channels, frame_size, bmin, bmax);
|
||||
|
|
14
libcelt/vq.c
14
libcelt/vq.c
|
@ -5,14 +5,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -190,7 +190,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
|||
ALLOC(y, N, celt_norm);
|
||||
ALLOC(iy, N, int);
|
||||
ALLOC(signx, N, opus_val16);
|
||||
|
||||
|
||||
exp_rotation(X, N, 1, B, K, spread);
|
||||
|
||||
/* Get rid of the sign */
|
||||
|
@ -278,7 +278,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
|||
rshift = 1+celt_ilog2(K-pulsesLeft+i+1);
|
||||
#endif
|
||||
best_id = 0;
|
||||
/* The squared magnitude term gets added anyway, so we might as well
|
||||
/* The squared magnitude term gets added anyway, so we might as well
|
||||
add it outside the loop */
|
||||
yy = ADD32(yy, 1);
|
||||
j=0;
|
||||
|
@ -302,7 +302,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
|||
best_id = j;
|
||||
}
|
||||
} while (++j<N);
|
||||
|
||||
|
||||
/* Updating the sums of the new pulse(s) */
|
||||
xy = ADD32(xy, EXTEND32(X[best_id]));
|
||||
/* We're multiplying y[j] by two so we don't have to do it here */
|
||||
|
@ -322,7 +322,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
|||
iy[j] = -iy[j];
|
||||
} while (++j<N);
|
||||
encode_pulses(iy, N, K, enc);
|
||||
|
||||
|
||||
if (resynth)
|
||||
{
|
||||
normalise_residual(iy, X, N, yy, gain);
|
||||
|
|
12
libcelt/vq.h
12
libcelt/vq.h
|
@ -9,14 +9,14 @@
|
|||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -37,9 +37,9 @@
|
|||
#include "entdec.h"
|
||||
#include "modes.h"
|
||||
|
||||
/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of
|
||||
* the pitch and a combination of pulses such that its norm is still equal
|
||||
* to 1. This is the function that will typically require the most CPU.
|
||||
/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of
|
||||
* the pitch and a combination of pulses such that its norm is still equal
|
||||
* to 1. This is the function that will typically require the most CPU.
|
||||
* @param x Residual signal to quantise/encode (returns quantised version)
|
||||
* @param W Perceptual weight to use when optimising (currently unused)
|
||||
* @param N Number of samples to encode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue