commit 541bfcd3ab81d09803fc465938efa59c864c1e66
parent 8780e76c2661ee6f715941ed7146a138c60abd7c
Author: Updatebot <updatebot@mozilla.com>
Date: Tue, 11 Nov 2025 11:36:58 +0000
Bug 1999077 - Update opus to 7f097e0fbf31f0e1b679f863646b3746646ab2a0 r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D271878
Diffstat:
66 files changed, 8640 insertions(+), 2267 deletions(-)
diff --git a/media/libopus/arm2gnu.py b/media/libopus/arm2gnu.py
@@ -1,9 +0,0 @@
-import sys
-import subprocess
-
-import buildconfig
-
-def generate(output, script, assembly_input):
- with open(assembly_input, "rb") as fd:
- content = subprocess.check_output([buildconfig.substs["PERL"], script], input=fd.read())
- output.write(content)
diff --git a/media/libopus/celt/_kiss_fft_guts.h b/media/libopus/celt/_kiss_fft_guts.h
@@ -102,7 +102,7 @@
#if defined(OPUS_ARM_INLINE_EDSP)
#include "arm/kiss_fft_armv5e.h"
#endif
-#if defined(__mips_dsp) && __mips == 32
+#if defined(__mips)
#include "mips/kiss_fft_mipsr1.h"
#endif
diff --git a/media/libopus/celt/arch.h b/media/libopus/celt/arch.h
@@ -142,7 +142,7 @@ typedef opus_int32 opus_val32;
typedef opus_int64 opus_val64;
typedef opus_val32 celt_sig;
-typedef opus_val16 celt_norm;
+typedef opus_val32 celt_norm;
typedef opus_val32 celt_ener;
typedef opus_val32 celt_glog;
@@ -152,7 +152,7 @@ typedef opus_val32 opus_res;
#define SIG2RES(a) PSHR32(a, SIG_SHIFT-RES_SHIFT)
#define RES2INT16(a) SAT16(PSHR32(a, RES_SHIFT))
#define RES2INT24(a) (a)
-#define RES2FLOAT(a) ((1.f/32768.f/256.)*(a))
+#define RES2FLOAT(a) ((1.f/32768.f/256.f)*(a))
#define INT16TORES(a) SHL32(EXTEND32(a), RES_SHIFT)
#define INT24TORES(a) (a)
#define ADD_RES(a, b) ADD32(a, b)
@@ -181,6 +181,7 @@ typedef opus_val16 opus_res;
#define INT16TOSIG(a) SHL32(EXTEND32(a), SIG_SHIFT)
#define INT24TOSIG(a) SHL32(a, SIG_SHIFT-8)
+#define NORM_SHIFT 24
#ifdef ENABLE_QEXT
typedef opus_val32 celt_coef;
#define COEF_ONE Q31ONE
@@ -214,7 +215,7 @@ typedef opus_val16 celt_coef;
so the limit should be about 2^31*sqrt(.5). */
#define SIG_SAT (536870911)
-#define NORM_SCALING 16384
+#define NORM_SCALING (1<<NORM_SHIFT)
#define DB_SHIFT 24
@@ -374,7 +375,7 @@ static OPUS_INLINE int celt_isnan(float x)
#define RES2INT24(a) float2int(32768.f*256.f*(a))
#define RES2FLOAT(a) (a)
#define INT16TORES(a) ((a)*(1/CELT_SIG_SCALE))
-#define INT24TORES(a) ((1.f/32768.f/256.)*(a))
+#define INT24TORES(a) ((1.f/32768.f/256.f)*(a))
#define ADD_RES(a, b) ADD32(a, b)
#define FLOAT2RES(a) (a)
#define RES2SIG(a) (CELT_SIG_SCALE*(a))
diff --git a/media/libopus/celt/bands.c b/media/libopus/celt/bands.c
@@ -108,36 +108,17 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band
maxval = celt_maxabs32(&X[c*N+(eBands[i]<<LM)], (eBands[i+1]-eBands[i])<<LM);
if (maxval > 0)
{
- int shift, shift2;
- shift = celt_ilog2(maxval) - 14;
- shift2 = (((m->logN[i]>>BITRES)+LM+1)>>1);
- j=eBands[i]<<LM;
- if (shift>0)
- {
- do {
- sum = ADD32(sum, SHR32(MULT16_16(EXTRACT16(SHR32(X[j+c*N],shift)),
- EXTRACT16(SHR32(X[j+c*N],shift))), 2*shift2));
- } while (++j<eBands[i+1]<<LM);
- } else {
- do {
- sum = ADD32(sum, SHR32(MULT16_16(EXTRACT16(SHL32(X[j+c*N],-shift)),
- EXTRACT16(SHL32(X[j+c*N],-shift))), 2*shift2));
- } while (++j<eBands[i+1]<<LM);
- }
- shift+=shift2;
- while (sum < 1<<28) {
- sum <<=2;
- shift -= 1;
- }
- /* We're adding one here to ensure the normalized band isn't larger than unity norm */
- bandE[i+c*m->nbEBands] = EPSILON+VSHR32(celt_sqrt(sum),-shift);
+ int shift = IMAX(0, 30 - celt_ilog2(maxval+(maxval>>14)+1) - ((((m->logN[i]+7)>>BITRES)+LM+1)>>1));
+ j=eBands[i]<<LM; do {
+ opus_val32 x = SHL32(X[j+c*N],shift);
+ sum = ADD32(sum, MULT32_32_Q31(x, x));
+ } while (++j<eBands[i+1]<<LM);
+ bandE[i+c*m->nbEBands] = MAX32(maxval, PSHR32(celt_sqrt32(SHR32(sum,1)), shift));
} else {
bandE[i+c*m->nbEBands] = EPSILON;
}
- /*printf ("%f ", bandE[i+c*m->nbEBands]);*/
}
} while (++c<C);
- /*printf ("\n");*/
}
/* Normalise each band such that the energy is one. */
@@ -148,21 +129,19 @@ void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel
N = M*m->shortMdctSize;
c=0; do {
i=0; do {
- opus_val16 g;
int j,shift;
opus_val32 E;
- shift = celt_zlog2(bandE[i+c*m->nbEBands])-14;
- E = VSHR32(bandE[i+c*m->nbEBands], shift-2);
- g = EXTRACT16(celt_rcp(E));
- if (shift > 0) {
- j=M*eBands[i]; do {
- X[j+c*N] = PSHR32(MULT16_32_Q15(g, freq[j+c*N]),shift);
- } while (++j<M*eBands[i+1]);
- } else {
- j=M*eBands[i]; do {
- X[j+c*N] = SHL32(MULT16_32_Q15(g, freq[j+c*N]),-shift);
- } while (++j<M*eBands[i+1]);
- }
+ opus_val32 g;
+ E = bandE[i+c*m->nbEBands];
+ /* For very low energies, we need this to make sure not to prevent energy rounding from
+ blowing up the normalized signal. */
+ if (E < 10) E += EPSILON;
+ shift = 30-celt_zlog2(E);
+ E = SHL32(E, shift);
+ g = celt_rcp_norm32(E);
+ j=M*eBands[i]; do {
+ X[j+c*N] = PSHR32(MULT32_32_Q31(g, SHL32(freq[j+c*N], shift)), 30-NORM_SHIFT);
+ } while (++j<M*eBands[i+1]);
} while (++i<end);
} while (++c<C);
}
@@ -226,8 +205,13 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
}
f = freq;
x = X+M*eBands[start];
- for (i=0;i<M*eBands[start];i++)
- *f++ = 0;
+ if (start != 0)
+ {
+ for (i=0;i<M*eBands[start];i++)
+ *f++ = 0;
+ } else {
+ f += M*eBands[start];
+ }
for (i=start;i<end;i++)
{
int j, band_end;
@@ -243,37 +227,29 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
g = celt_exp2_db(MIN32(32.f, lg));
#else
/* Handle the integer part of the log energy */
- shift = 15-(lg>>DB_SHIFT);
- if (shift>31)
+ shift = 17-(lg>>DB_SHIFT);
+ if (shift>=31)
{
shift=0;
g=0;
} else {
/* Handle the fractional part. */
- g = celt_exp2_db_frac((lg&((1<<DB_SHIFT)-1)));
+ g = SHL32(celt_exp2_db_frac((lg&((1<<DB_SHIFT)-1))), 2);
}
/* Handle extreme gains with negative shift. */
if (shift<0)
{
- /* For shift <= -2 and g > 16384 we'd be likely to overflow, so we're
+ /* To avoid overflow, we're
capping the gain here, which is equivalent to a cap of 18 on lg.
This shouldn't trigger unless the bitstream is already corrupted. */
- if (shift <= -2)
- {
- g = 16384*32768;
- shift = -2;
- }
- do {
- *f++ = SHL32(MULT16_32_Q15(*x, g), -shift);
- x++;
- } while (++j<band_end);
- } else
+ g = 2147483647;
+ shift = 0;
+ }
#endif
- /* Be careful of the fixed-point "else" just above when changing this code */
- do {
- *f++ = SHR32(MULT16_32_Q15(*x, g), shift);
- x++;
- } while (++j<band_end);
+ do {
+ *f++ = PSHR32(MULT32_32_Q31(SHL32(*x, 30-NORM_SHIFT), g), shift);
+ x++;
+ } while (++j<band_end);
}
celt_assert(start <= end);
OPUS_CLEAR(&freq[bound], N-bound);
@@ -321,7 +297,7 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
celt_glog prev1;
celt_glog prev2;
opus_val32 Ediff;
- opus_val16 r;
+ celt_norm r;
int renormalize=0;
prev1 = prev1logE[c*m->nbEBands+i];
prev2 = prev2logE[c*m->nbEBands+i];
@@ -344,7 +320,7 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
if (LM==3)
r = MULT16_16_Q14(23170, MIN32(23169, r));
r = SHR16(MIN16(thresh, r),1);
- r = SHR32(MULT16_16_Q15(sqrt_1, r),shift);
+ r = VSHR32(MULT16_16_Q15(sqrt_1, r),shift+14-NORM_SHIFT);
#else
/* r needs to be multiplied by 2 or 2*sqrt(2) depending on LM because
short blocks don't have the same energy as long */
@@ -413,14 +389,15 @@ static void intensity_stereo(const CELTMode *m, celt_norm * OPUS_RESTRICT X, con
left = VSHR32(bandE[i],shift);
right = VSHR32(bandE[i+m->nbEBands],shift);
norm = EPSILON + celt_sqrt(EPSILON+MULT16_16(left,left)+MULT16_16(right,right));
- a1 = DIV32_16(SHL32(EXTEND32(left),14),norm);
- a2 = DIV32_16(SHL32(EXTEND32(right),14),norm);
+#ifdef FIXED_POINT
+ left = MIN32(left, norm-1);
+ right = MIN32(right, norm-1);
+#endif
+ a1 = DIV32_16(SHL32(EXTEND32(left),15),norm);
+ a2 = DIV32_16(SHL32(EXTEND32(right),15),norm);
for (j=0;j<N;j++)
{
- celt_norm r, l;
- l = X[j];
- r = Y[j];
- X[j] = EXTRACT16(SHR32(MAC16_16(MULT16_16(a1, l), a2, r), 14));
+ X[j] = ADD32(MULT16_32_Q15(a1, X[j]), MULT16_32_Q15(a2, Y[j]));
/* Side is not encoded, no need to calculate */
}
}
@@ -431,10 +408,10 @@ static void stereo_split(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
for (j=0;j<N;j++)
{
opus_val32 r, l;
- l = MULT16_16(QCONST16(.70710678f, 15), X[j]);
- r = MULT16_16(QCONST16(.70710678f, 15), Y[j]);
- X[j] = EXTRACT16(SHR32(ADD32(l, r), 15));
- Y[j] = EXTRACT16(SHR32(SUB32(r, l), 15));
+ l = MULT32_32_Q31(QCONST32(.70710678f,31), X[j]);
+ r = MULT32_32_Q31(QCONST32(.70710678f,31), Y[j]);
+ X[j] = ADD32(l, r);
+ Y[j] = SUB32(r, l);
}
}
@@ -449,7 +426,8 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
opus_val32 t, lgain, rgain;
/* Compute the norm of X+Y and X-Y as |X|^2 + |Y|^2 +/- sum(xy) */
- dual_inner_prod(Y, X, Y, N, &xp, &side, arch);
+ xp = celt_inner_prod_norm_shift(Y, X, N, arch);
+ side = celt_inner_prod_norm_shift(Y, Y, N, arch);
/* Compensating for the mid normalization */
xp = MULT32_32_Q31(mid, xp);
/* mid and side are in Q15, not Q14 like X and Y */
@@ -465,10 +443,10 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
kl = celt_ilog2(El)>>1;
kr = celt_ilog2(Er)>>1;
#endif
- t = VSHR32(El, (kl-7)<<1);
- lgain = celt_rsqrt_norm(t);
- t = VSHR32(Er, (kr-7)<<1);
- rgain = celt_rsqrt_norm(t);
+ t = VSHR32(El, (kl<<1)-29);
+ lgain = celt_rsqrt_norm32(t);
+ t = VSHR32(Er, (kr<<1)-29);
+ rgain = celt_rsqrt_norm32(t);
#ifdef FIXED_POINT
if (kl < 7)
@@ -483,8 +461,8 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
/* Apply mid scaling (side is already scaled) */
l = MULT32_32_Q31(mid, X[j]);
r = Y[j];
- X[j] = EXTRACT16(PSHR32(MULT16_16(lgain, SUB16(l,r)), kl+1));
- Y[j] = EXTRACT16(PSHR32(MULT16_16(rgain, ADD16(l,r)), kr+1));
+ X[j] = VSHR32(MULT32_32_Q31(lgain, SUB32(l,r)), kl-15);
+ Y[j] = VSHR32(MULT32_32_Q31(rgain, ADD32(l,r)), kr-15);
}
}
@@ -519,7 +497,7 @@ int spreading_decision(const CELTMode *m, const celt_norm *X, int *average,
{
opus_val32 x2N; /* Q13 */
- x2N = MULT16_16(MULT16_16_Q15(x[j], x[j]), N);
+ x2N = MULT16_16(MULT16_16_Q15(SHR32(x[j], NORM_SHIFT-14), SHR32(x[j], NORM_SHIFT-14)), N);
if (x2N < QCONST16(0.25f,13))
tcount[0]++;
if (x2N < QCONST16(0.0625f,13))
@@ -650,10 +628,10 @@ void haar1(celt_norm *X, int N0, int stride)
for (j=0;j<N0;j++)
{
opus_val32 tmp1, tmp2;
- tmp1 = MULT16_16(QCONST16(.70710678f,15), X[stride*2*j+i]);
- tmp2 = MULT16_16(QCONST16(.70710678f,15), X[stride*(2*j+1)+i]);
- X[stride*2*j+i] = EXTRACT16(PSHR32(ADD32(tmp1, tmp2), 15));
- X[stride*(2*j+1)+i] = EXTRACT16(PSHR32(SUB32(tmp1, tmp2), 15));
+ tmp1 = MULT32_32_Q31(QCONST32(.70710678f,31), X[stride*2*j+i]);
+ tmp2 = MULT32_32_Q31(QCONST32(.70710678f,31), X[stride*(2*j+1)+i]);
+ X[stride*2*j+i] = ADD32(tmp1, tmp2);
+ X[stride*(2*j+1)+i] = SUB32(tmp1, tmp2);
}
}
@@ -699,6 +677,12 @@ struct band_ctx {
int theta_round;
int disable_inv;
int avoid_split_noise;
+#ifdef ENABLE_QEXT
+ ec_ctx *ext_ec;
+ int extra_bits;
+ opus_int32 ext_total_bits;
+ int extra_bands;
+#endif
};
struct split_ctx {
@@ -707,16 +691,20 @@ struct split_ctx {
int iside;
int delta;
int itheta;
+#ifdef ENABLE_QEXT
+ int itheta_q30;
+#endif
int qalloc;
};
static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
celt_norm *X, celt_norm *Y, int N, int *b, int B, int B0,
int LM,
- int stereo, int *fill)
+ int stereo, int *fill ARG_QEXT(int *ext_b))
{
int qn;
int itheta=0;
+ int itheta_q30=0;
int delta;
int imid, iside;
int qalloc;
@@ -750,7 +738,8 @@ static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
side and mid. With just that parameter, we can re-scale both
mid and side because we know that 1) they have unit norm and
2) they are orthogonal. */
- itheta = stereo_itheta(X, Y, stereo, N, ctx->arch);
+ itheta_q30 = stereo_itheta(X, Y, stereo, N, ctx->arch);
+ itheta = itheta_q30>>16;
}
tell = ec_tell_frac(ec);
if (qn!=1)
@@ -850,6 +839,30 @@ static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
}
celt_assert(itheta>=0);
itheta = celt_udiv((opus_int32)itheta*16384, qn);
+#ifdef ENABLE_QEXT
+ *ext_b = IMIN(*ext_b, ctx->ext_total_bits - (opus_int32)ec_tell_frac(ctx->ext_ec));
+ if (*ext_b >= 2*N<<BITRES && ctx->ext_total_bits-ec_tell_frac(ctx->ext_ec)-1 > 2<<BITRES) {
+ int extra_bits;
+ int ext_tell = ec_tell_frac(ctx->ext_ec);
+ extra_bits = IMIN(12, IMAX(2, celt_sudiv(*ext_b, (2*N-1)<<BITRES)));
+ if (encode) {
+ itheta_q30 = itheta_q30 - (itheta<<16);
+ itheta_q30 = (itheta_q30*(opus_int64)qn*((1<<extra_bits)-1)+(1<<29))>>30;
+ itheta_q30 += (1<<(extra_bits-1))-1;
+ itheta_q30 = IMAX(0, IMIN((1<<extra_bits)-2, itheta_q30));
+ ec_enc_uint(ctx->ext_ec, itheta_q30, (1<<extra_bits)-1);
+ } else {
+ itheta_q30 = ec_dec_uint(ctx->ext_ec, (1<<extra_bits)-1);
+ }
+ itheta_q30 -= (1<<(extra_bits-1))-1;
+ itheta_q30 = (itheta<<16) + itheta_q30*(opus_int64)(1<<30)/(qn*((1<<extra_bits)-1));
+ /* Hard bounds on itheta (can only trigger on corrupted bitstreams). */
+ itheta_q30 = IMAX(0, IMIN(itheta_q30, 1073741824));
+ *ext_b -= ec_tell_frac(ctx->ext_ec) - ext_tell;
+ } else {
+ itheta_q30 = (opus_int32)itheta<<16;
+ }
+#endif
if (encode && stereo)
{
if (itheta==0)
@@ -883,6 +896,7 @@ static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
if (ctx->disable_inv)
inv = 0;
itheta = 0;
+ itheta_q30 = 0;
}
qalloc = ec_tell_frac(ec) - tell;
*b -= qalloc;
@@ -912,6 +926,9 @@ static void compute_theta(struct band_ctx *ctx, struct split_ctx *sctx,
sctx->iside = iside;
sctx->delta = delta;
sctx->itheta = itheta;
+#ifdef ENABLE_QEXT
+ sctx->itheta_q30 = itheta_q30;
+#endif
sctx->qalloc = qalloc;
}
static unsigned quant_band_n1(struct band_ctx *ctx, celt_norm *X, celt_norm *Y,
@@ -945,7 +962,7 @@ static unsigned quant_band_n1(struct band_ctx *ctx, celt_norm *X, celt_norm *Y,
x = Y;
} while (++c<1+stereo);
if (lowband_out)
- lowband_out[0] = SHR16(X[0],4);
+ lowband_out[0] = SHR32(X[0],4);
return 1;
}
@@ -956,7 +973,8 @@ static unsigned quant_band_n1(struct band_ctx *ctx, celt_norm *X, celt_norm *Y,
static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
int N, int b, int B, celt_norm *lowband,
int LM,
- opus_val32 gain, int fill)
+ opus_val32 gain, int fill
+ ARG_QEXT(int ext_b))
{
const unsigned char *cache;
int q;
@@ -996,18 +1014,32 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
fill = (fill&1)|(fill<<1);
B = (B+1)>>1;
- compute_theta(ctx, &sctx, X, Y, N, &b, B, B0, LM, 0, &fill);
+ compute_theta(ctx, &sctx, X, Y, N, &b, B, B0, LM, 0, &fill ARG_QEXT(&ext_b));
imid = sctx.imid;
iside = sctx.iside;
delta = sctx.delta;
itheta = sctx.itheta;
qalloc = sctx.qalloc;
#ifdef FIXED_POINT
+# ifdef ENABLE_QEXT
+ (void)imid;
+ (void)iside;
+ mid = celt_cos_norm32(sctx.itheta_q30);
+ side = celt_cos_norm32((1<<30)-sctx.itheta_q30);
+# else
mid = SHL32(EXTEND32(imid), 16);
side = SHL32(EXTEND32(iside), 16);
+# endif
#else
+# ifdef ENABLE_QEXT
+ (void)imid;
+ (void)iside;
+ mid = celt_cos_norm2(sctx.itheta_q30*(1.f/(1<<30)));
+ side = celt_cos_norm2(1.f-sctx.itheta_q30*(1.f/(1<<30)));
+# else
mid = (1.f/32768)*imid;
side = (1.f/32768)*iside;
+# endif
#endif
/* Give more bits to low-energy MDCTs than they would otherwise deserve */
@@ -1031,22 +1063,33 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
if (mbits >= sbits)
{
cm = quant_partition(ctx, X, N, mbits, B, lowband, LM,
- MULT32_32_Q31(gain,mid), fill);
+ MULT32_32_Q31(gain,mid), fill ARG_QEXT(ext_b/2));
rebalance = mbits - (rebalance-ctx->remaining_bits);
if (rebalance > 3<<BITRES && itheta!=0)
sbits += rebalance - (3<<BITRES);
cm |= quant_partition(ctx, Y, N, sbits, B, next_lowband2, LM,
- MULT32_32_Q31(gain,side), fill>>B)<<(B0>>1);
+ MULT32_32_Q31(gain,side), fill>>B ARG_QEXT(ext_b/2))<<(B0>>1);
} else {
cm = quant_partition(ctx, Y, N, sbits, B, next_lowband2, LM,
- MULT32_32_Q31(gain,side), fill>>B)<<(B0>>1);
+ MULT32_32_Q31(gain,side), fill>>B ARG_QEXT(ext_b/2))<<(B0>>1);
rebalance = sbits - (rebalance-ctx->remaining_bits);
if (rebalance > 3<<BITRES && itheta!=16384)
mbits += rebalance - (3<<BITRES);
cm |= quant_partition(ctx, X, N, mbits, B, lowband, LM,
- MULT32_32_Q31(gain,mid), fill);
+ MULT32_32_Q31(gain,mid), fill ARG_QEXT(ext_b/2));
}
} else {
+#ifdef ENABLE_QEXT
+ int extra_bits;
+ int ext_remaining_bits;
+ extra_bits = ext_b/(N-1)>>BITRES;
+ ext_remaining_bits = ctx->ext_total_bits-(opus_int32)ec_tell_frac(ctx->ext_ec);
+ if (ext_remaining_bits < ((extra_bits+1)*(N-1)+N)<<BITRES) {
+ extra_bits = (ext_remaining_bits-(N<<BITRES))/(N-1)>>BITRES;
+ extra_bits = IMAX(extra_bits-1, 0);
+ }
+ extra_bits = IMIN(12, extra_bits);
+#endif
/* This is the basic no-split case */
q = bits2pulses(m, i, LM, b);
curr_bits = pulses2bits(m, i, LM, q);
@@ -1068,10 +1111,26 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
/* Finally do the actual quantization */
if (encode)
{
- cm = alg_quant(X, N, K, spread, B, ec, gain, ctx->resynth, ctx->arch);
+ cm = alg_quant(X, N, K, spread, B, ec, gain, ctx->resynth
+ ARG_QEXT(ctx->ext_ec) ARG_QEXT(extra_bits),
+ ctx->arch);
} else {
- cm = alg_unquant(X, N, K, spread, B, ec, gain);
+ cm = alg_unquant(X, N, K, spread, B, ec, gain
+ ARG_QEXT(ctx->ext_ec) ARG_QEXT(extra_bits));
}
+#ifdef ENABLE_QEXT
+ } else if (ext_b > 2*N<<BITRES)
+ {
+ extra_bits = ext_b/(N-1)>>BITRES;
+ ext_remaining_bits = ctx->ext_total_bits-ec_tell_frac(ctx->ext_ec);
+ if (ext_remaining_bits < ((extra_bits+1)*(N-1)+N)<<BITRES) {
+ extra_bits = (ext_remaining_bits-(N<<BITRES))/(N-1)>>BITRES;
+ extra_bits = IMAX(extra_bits-1, 0);
+ }
+ extra_bits = IMIN(14, extra_bits);
+ if (encode) cm = cubic_quant(X, N, extra_bits, B, ctx->ext_ec, gain, ctx->resynth);
+ else cm = cubic_unquant(X, N, extra_bits, B, ctx->ext_ec, gain);
+#endif
} else {
/* If there's no pulse, fill the band anyway */
int j;
@@ -1092,7 +1151,7 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
for (j=0;j<N;j++)
{
ctx->seed = celt_lcg_rand(ctx->seed);
- X[j] = (celt_norm)((opus_int32)ctx->seed>>20);
+ X[j] = SHL32((celt_norm)((opus_int32)ctx->seed>>20), NORM_SHIFT-14);
}
cm = cm_mask;
} else {
@@ -1102,7 +1161,7 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
opus_val16 tmp;
ctx->seed = celt_lcg_rand(ctx->seed);
/* About 48 dB below the "normal" folding level */
- tmp = QCONST16(1.0f/256, 10);
+ tmp = QCONST16(1.0f/256, NORM_SHIFT-4);
tmp = (ctx->seed)&0x8000 ? tmp : -tmp;
X[j] = lowband[j]+tmp;
}
@@ -1117,12 +1176,80 @@ static unsigned quant_partition(struct band_ctx *ctx, celt_norm *X,
return cm;
}
+#ifdef ENABLE_QEXT
+static unsigned cubic_quant_partition(struct band_ctx *ctx, celt_norm *X, int N, int b, int B, ec_ctx *ec, int LM, opus_val32 gain, int resynth, int encode)
+{
+ celt_assert(LM>=0);
+ ctx->remaining_bits = ctx->ec->storage*8*8 - ec_tell_frac(ctx->ec);
+ b = IMIN(b, ctx->remaining_bits);
+ /* As long as we have at least two bits of depth, split all the way to LM=0 (not -1 like PVQ). */
+ if (LM==0 || b<=2*N<<BITRES) {
+ int res, ret;
+ b = IMIN(b + ((N-1)<<BITRES)/2, ctx->remaining_bits);
+ /* Resolution left after taking into account coding the cube face. */
+ res = (b-(1<<BITRES)-ctx->m->logN[ctx->i]-(LM<<BITRES)-1)/(N-1)>>BITRES;
+ res = IMIN(14, IMAX(0, res));
+ if (encode) ret = cubic_quant(X, N, res, B, ec, gain, resynth);
+ else ret = cubic_unquant(X, N, res, B, ec, gain);
+ ctx->remaining_bits = ctx->ec->storage*8*8 - ec_tell_frac(ctx->ec);
+ return ret;
+ } else {
+ celt_norm *Y;
+ opus_int32 itheta_q30;
+ opus_val32 g1, g2;
+ opus_int32 theta_res;
+ opus_int32 qtheta;
+ int delta;
+ int b1, b2;
+ int cm;
+ int N0;
+ N0 = N;
+ N >>= 1;
+ Y = X+N;
+ LM -= 1;
+ B = (B+1)>>1;
+ theta_res = IMIN(16, (b>>BITRES)/(N0-1) + 1);
+ if (encode) {
+ itheta_q30 = stereo_itheta(X, Y, 0, N, ctx->arch);
+ qtheta = (itheta_q30+(1<<(29-theta_res)))>>(30-theta_res);
+ ec_enc_uint(ec, qtheta, (1<<theta_res)+1);
+ } else {
+ qtheta = ec_dec_uint(ec, (1<<theta_res)+1);
+ }
+ itheta_q30 = qtheta<<(30-theta_res);
+ b -= theta_res<<BITRES;
+ delta = (N0-1) * 23 * ((itheta_q30>>16)-8192) >> (17-BITRES);
+
+#ifdef FIXED_POINT
+ g1 = celt_cos_norm32(itheta_q30);
+ g2 = celt_cos_norm32((1<<30)-itheta_q30);
+#else
+ g1 = celt_cos_norm2(itheta_q30*(1.f/(1<<30)));
+ g2 = celt_cos_norm2(1.f-itheta_q30*(1.f/(1<<30)));
+#endif
+ if (itheta_q30 == 0) {
+ b1=b;
+ b2=0;
+ } else if (itheta_q30==1073741824) {
+ b1=0;
+ b2=b;
+ } else {
+ b1 = IMIN(b, IMAX(0, (b-delta)/2));
+ b2 = b-b1;
+ }
+ cm = cubic_quant_partition(ctx, X, N, b1, B, ec, LM, MULT32_32_Q31(gain, g1), resynth, encode);
+ cm |= cubic_quant_partition(ctx, Y, N, b2, B, ec, LM, MULT32_32_Q31(gain, g2), resynth, encode);
+ return cm;
+ }
+}
+#endif
/* This function is responsible for encoding and decoding a band for the mono case. */
static unsigned quant_band(struct band_ctx *ctx, celt_norm *X,
int N, int b, int B, celt_norm *lowband,
int LM, celt_norm *lowband_out,
- opus_val32 gain, celt_norm *lowband_scratch, int fill)
+ opus_val32 gain, celt_norm *lowband_scratch, int fill
+ ARG_QEXT(int ext_b))
{
int N0=N;
int N_B=N;
@@ -1198,7 +1325,14 @@ static unsigned quant_band(struct band_ctx *ctx, celt_norm *X,
deinterleave_hadamard(lowband, N_B>>recombine, B0<<recombine, longBlocks);
}
- cm = quant_partition(ctx, X, N, b, B, lowband, LM, gain, fill);
+#ifdef ENABLE_QEXT
+ if (ctx->extra_bands && b > (3*N<<BITRES)+(ctx->m->logN[ctx->i]+8+8*LM)) {
+ cm = cubic_quant_partition(ctx, X, N, b, B, ctx->ec, LM, gain, ctx->resynth, encode);
+ } else
+#endif
+ {
+ cm = quant_partition(ctx, X, N, b, B, lowband, LM, gain, fill ARG_QEXT(ext_b));
+ }
/* This code is used by the decoder and by the resynthesis-enabled encoder */
if (ctx->resynth)
@@ -1236,7 +1370,7 @@ static unsigned quant_band(struct band_ctx *ctx, celt_norm *X,
opus_val16 n;
n = celt_sqrt(SHL32(EXTEND32(N0),22));
for (j=0;j<N0;j++)
- lowband_out[j] = MULT16_16_Q15(n,X[j]);
+ lowband_out[j] = MULT16_32_Q15(n,X[j]);
}
cm &= (1<<B)-1;
}
@@ -1253,7 +1387,8 @@ static unsigned quant_band(struct band_ctx *ctx, celt_norm *X,
static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm *Y,
int N, int b, int B, celt_norm *lowband,
int LM, celt_norm *lowband_out,
- celt_norm *lowband_scratch, int fill)
+ celt_norm *lowband_scratch, int fill
+ ARG_QEXT(int ext_b) ARG_QEXT(const int *cap))
{
int imid=0, iside=0;
int inv = 0;
@@ -1284,7 +1419,7 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
else OPUS_COPY(X, Y, N);
}
}
- compute_theta(ctx, &sctx, X, Y, N, &b, B, B, LM, 1, &fill);
+ compute_theta(ctx, &sctx, X, Y, N, &b, B, B, LM, 1, &fill ARG_QEXT(&ext_b));
inv = sctx.inv;
imid = sctx.imid;
iside = sctx.iside;
@@ -1292,11 +1427,25 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
itheta = sctx.itheta;
qalloc = sctx.qalloc;
#ifdef FIXED_POINT
+# ifdef ENABLE_QEXT
+ (void)imid;
+ (void)iside;
+ mid = celt_cos_norm32(sctx.itheta_q30);
+ side = celt_cos_norm32((1<<30)-sctx.itheta_q30);
+# else
mid = SHL32(EXTEND32(imid), 16);
side = SHL32(EXTEND32(iside), 16);
+# endif
#else
+# ifdef ENABLE_QEXT
+ (void)imid;
+ (void)iside;
+ mid = celt_cos_norm2(sctx.itheta_q30*(1.f/(1<<30)));
+ side = celt_cos_norm2(1.f-sctx.itheta_q30*(1.f/(1<<30)));
+# else
mid = (1.f/32768)*imid;
side = (1.f/32768)*iside;
+# endif
#endif
/* This is a special case for N=2 that only works for stereo and takes
@@ -1323,7 +1472,8 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
if (encode)
{
/* Here we only need to encode a sign for the side. */
- sign = x2[0]*y2[1] - x2[1]*y2[0] < 0;
+ /* FIXME: Need to increase fixed-point precision? */
+ sign = MULT32_32_Q31(x2[0],y2[1]) - MULT32_32_Q31(x2[1],y2[0]) < 0;
ec_enc_bits(ec, sign, 1);
} else {
sign = ec_dec_bits(ec, 1);
@@ -1333,7 +1483,7 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
/* We use orig_fill here because we want to fold the side, but if
itheta==16384, we'll have cleared the low bits of fill. */
cm = quant_band(ctx, x2, N, mbits, B, lowband, LM, lowband_out, Q31ONE,
- lowband_scratch, orig_fill);
+ lowband_scratch, orig_fill ARG_QEXT(ext_b));
/* We don't split N=2 bands, so cm is either 1 or 0 (for a fold-collapse),
and there's no need to worry about mixing with the other channel. */
y2[0] = -sign*x2[1];
@@ -1346,11 +1496,11 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
Y[0] = MULT32_32_Q31(side, Y[0]);
Y[1] = MULT32_32_Q31(side, Y[1]);
tmp = X[0];
- X[0] = SUB16(tmp,Y[0]);
- Y[0] = ADD16(tmp,Y[0]);
+ X[0] = SUB32(tmp,Y[0]);
+ Y[0] = ADD32(tmp,Y[0]);
tmp = X[1];
- X[1] = SUB16(tmp,Y[1]);
- Y[1] = ADD16(tmp,Y[1]);
+ X[1] = SUB32(tmp,Y[1]);
+ Y[1] = ADD32(tmp,Y[1]);
}
} else {
/* "Normal" split code */
@@ -1363,28 +1513,45 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
rebalance = ctx->remaining_bits;
if (mbits >= sbits)
{
+#ifdef ENABLE_QEXT
+ int qext_extra = 0;
+ /* Reallocate any mid bits that cannot be used to extra mid bits. */
+ if (cap != NULL && ext_b != 0) qext_extra = IMAX(0, IMIN(ext_b/2, mbits - cap[ctx->i]/2));
+#endif
/* In stereo mode, we do not apply a scaling to the mid because we need the normalized
mid for folding later. */
cm = quant_band(ctx, X, N, mbits, B, lowband, LM, lowband_out, Q31ONE,
- lowband_scratch, fill);
+ lowband_scratch, fill ARG_QEXT(ext_b/2+qext_extra));
rebalance = mbits - (rebalance-ctx->remaining_bits);
if (rebalance > 3<<BITRES && itheta!=0)
sbits += rebalance - (3<<BITRES);
-
+#ifdef ENABLE_QEXT
+ /* Guard against overflowing the EC with the angle if the cubic quant used too many bits for the mid. */
+ if (ctx->extra_bands) sbits = IMIN(sbits, ctx->remaining_bits);
+#endif
/* For a stereo split, the high bits of fill are always zero, so no
folding will be done to the side. */
- cm |= quant_band(ctx, Y, N, sbits, B, NULL, LM, NULL, side, NULL, fill>>B);
+ cm |= quant_band(ctx, Y, N, sbits, B, NULL, LM, NULL, side, NULL, fill>>B ARG_QEXT(ext_b/2-qext_extra));
} else {
+#ifdef ENABLE_QEXT
+ int qext_extra = 0;
+ /* Reallocate any side bits that cannot be used to extra side bits. */
+ if (cap != NULL && ext_b != 0) qext_extra = IMAX(0, IMIN(ext_b/2, sbits - cap[ctx->i]/2));
+#endif
/* For a stereo split, the high bits of fill are always zero, so no
folding will be done to the side. */
- cm = quant_band(ctx, Y, N, sbits, B, NULL, LM, NULL, side, NULL, fill>>B);
+ cm = quant_band(ctx, Y, N, sbits, B, NULL, LM, NULL, side, NULL, fill>>B ARG_QEXT(ext_b/2+qext_extra));
rebalance = sbits - (rebalance-ctx->remaining_bits);
if (rebalance > 3<<BITRES && itheta!=16384)
mbits += rebalance - (3<<BITRES);
+#ifdef ENABLE_QEXT
+ /* Guard against overflowing the EC with the angle if the cubic quant used too many bits for the side. */
+ if (ctx->extra_bands) mbits = IMIN(mbits, ctx->remaining_bits);
+#endif
/* In stereo mode, we do not apply a scaling to the mid because we need the normalized
mid for folding later. */
cm |= quant_band(ctx, X, N, mbits, B, lowband, LM, lowband_out, Q31ONE,
- lowband_scratch, fill);
+ lowband_scratch, fill ARG_QEXT(ext_b/2-qext_extra));
}
}
@@ -1424,7 +1591,9 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
const celt_ener *bandE, int *pulses, int shortBlocks, int spread,
int dual_stereo, int intensity, int *tf_res, opus_int32 total_bits,
opus_int32 balance, ec_ctx *ec, int LM, int codedBands,
- opus_uint32 *seed, int complexity, int arch, int disable_inv)
+ opus_uint32 *seed, int complexity, int arch, int disable_inv
+ ARG_QEXT(ec_ctx *ext_ec) ARG_QEXT(int *extra_pulses)
+ ARG_QEXT(opus_int32 ext_total_bits) ARG_QEXT(const int *cap))
{
int i;
opus_int32 remaining_bits;
@@ -1452,6 +1621,11 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
int resynth = !encode || theta_rdo;
#endif
struct band_ctx ctx;
+#ifdef ENABLE_QEXT
+ int ext_b;
+ opus_int32 ext_balance=0;
+ opus_int32 ext_tell=0;
+#endif
SAVE_STACK;
M = 1<<LM;
@@ -1493,6 +1667,12 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
ctx.disable_inv = disable_inv;
ctx.resynth = resynth;
ctx.theta_round = 0;
+#ifdef ENABLE_QEXT
+ ctx.ext_ec = ext_ec;
+ ctx.ext_total_bits = ext_total_bits;
+ ctx.extra_bands = end == NB_QEXT_BANDS || end == 2;
+ if (ctx.extra_bands) theta_rdo = 0;
+#endif
/* Avoid injecting noise in the first band on transients. */
ctx.avoid_split_noise = B > 1;
for (i=start;i<end;i++)
@@ -1525,6 +1705,22 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
balance -= tell;
remaining_bits = total_bits-tell-1;
ctx.remaining_bits = remaining_bits;
+#ifdef ENABLE_QEXT
+ if (i != start) {
+ ext_balance += extra_pulses[i-1] + ext_tell;
+ }
+ ext_tell = ec_tell_frac(ext_ec);
+ ctx.extra_bits = extra_pulses[i];
+ if (i != start)
+ ext_balance -= ext_tell;
+ if (i <= codedBands-1)
+ {
+ opus_int32 ext_curr_balance = celt_sudiv(ext_balance, IMIN(3, codedBands-i));
+ ext_b = IMAX(0, IMIN(16383, IMIN(ext_total_bits-ext_tell,extra_pulses[i]+ext_curr_balance)));
+ } else {
+ ext_b = 0;
+ }
+#endif
if (i <= codedBands-1)
{
curr_balance = celt_sudiv(balance, IMIN(3, codedBands-i));
@@ -1597,10 +1793,10 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
{
x_cm = quant_band(&ctx, X, N, b/2, B,
effective_lowband != -1 ? norm+effective_lowband : NULL, LM,
- last?NULL:norm+M*eBands[i]-norm_offset, Q31ONE, lowband_scratch, x_cm);
+ last?NULL:norm+M*eBands[i]-norm_offset, Q31ONE, lowband_scratch, x_cm ARG_QEXT(ext_b/2));
y_cm = quant_band(&ctx, Y, N, b/2, B,
effective_lowband != -1 ? norm2+effective_lowband : NULL, LM,
- last?NULL:norm2+M*eBands[i]-norm_offset, Q31ONE, lowband_scratch, y_cm);
+ last?NULL:norm2+M*eBands[i]-norm_offset, Q31ONE, lowband_scratch, y_cm ARG_QEXT(ext_b/2));
} else {
if (Y!=NULL)
{
@@ -1613,11 +1809,20 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
int nstart_bytes, nend_bytes, save_bytes;
unsigned char *bytes_buf;
unsigned char bytes_save[1275];
+#ifdef ENABLE_QEXT
+ ec_ctx ext_ec_save, ext_ec_save2;
+ unsigned char *ext_bytes_buf;
+ int ext_nstart_bytes, ext_nend_bytes, ext_save_bytes;
+ unsigned char ext_bytes_save[QEXT_PACKET_SIZE_CAP];
+#endif
opus_val16 w[2];
compute_channel_weights(bandE[i], bandE[i+m->nbEBands], w);
/* Make a copy. */
cm = x_cm|y_cm;
ec_save = *ec;
+#ifdef ENABLE_QEXT
+ ext_ec_save = *ext_ec;
+#endif
ctx_save = ctx;
OPUS_COPY(X_save, X, N);
OPUS_COPY(Y_save, Y, N);
@@ -1625,12 +1830,15 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
ctx.theta_round = -1;
x_cm = quant_band_stereo(&ctx, X, Y, N, b, B,
effective_lowband != -1 ? norm+effective_lowband : NULL, LM,
- last?NULL:norm+M*eBands[i]-norm_offset, lowband_scratch, cm);
- dist0 = MULT16_32_Q15(w[0], celt_inner_prod(X_save, X, N, arch)) + MULT16_32_Q15(w[1], celt_inner_prod(Y_save, Y, N, arch));
+ last?NULL:norm+M*eBands[i]-norm_offset, lowband_scratch, cm ARG_QEXT(ext_b) ARG_QEXT(cap));
+ dist0 = MULT16_32_Q15(w[0], celt_inner_prod_norm_shift(X_save, X, N, arch)) + MULT16_32_Q15(w[1], celt_inner_prod_norm_shift(Y_save, Y, N, arch));
/* Save first result. */
cm2 = x_cm;
ec_save2 = *ec;
+#ifdef ENABLE_QEXT
+ ext_ec_save2 = *ext_ec;
+#endif
ctx_save2 = ctx;
OPUS_COPY(X_save2, X, N);
OPUS_COPY(Y_save2, Y, N);
@@ -1641,9 +1849,18 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
bytes_buf = ec_save.buf+nstart_bytes;
save_bytes = nend_bytes-nstart_bytes;
OPUS_COPY(bytes_save, bytes_buf, save_bytes);
-
+#ifdef ENABLE_QEXT
+ ext_nstart_bytes = ext_ec_save.offs;
+ ext_nend_bytes = ext_ec_save.storage;
+ ext_bytes_buf = ext_ec_save.buf!=NULL ? ext_ec_save.buf+ext_nstart_bytes : NULL;
+ ext_save_bytes = ext_nend_bytes-ext_nstart_bytes;
+ if (ext_save_bytes) OPUS_COPY(ext_bytes_save, ext_bytes_buf, ext_save_bytes);
+#endif
/* Restore */
*ec = ec_save;
+#ifdef ENABLE_QEXT
+ *ext_ec = ext_ec_save;
+#endif
ctx = ctx_save;
OPUS_COPY(X, X_save, N);
OPUS_COPY(Y, Y_save, N);
@@ -1655,28 +1872,34 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
ctx.theta_round = 1;
x_cm = quant_band_stereo(&ctx, X, Y, N, b, B,
effective_lowband != -1 ? norm+effective_lowband : NULL, LM,
- last?NULL:norm+M*eBands[i]-norm_offset, lowband_scratch, cm);
- dist1 = MULT16_32_Q15(w[0], celt_inner_prod(X_save, X, N, arch)) + MULT16_32_Q15(w[1], celt_inner_prod(Y_save, Y, N, arch));
+ last?NULL:norm+M*eBands[i]-norm_offset, lowband_scratch, cm ARG_QEXT(ext_b) ARG_QEXT(cap));
+ dist1 = MULT16_32_Q15(w[0], celt_inner_prod_norm_shift(X_save, X, N, arch)) + MULT16_32_Q15(w[1], celt_inner_prod_norm_shift(Y_save, Y, N, arch));
if (dist0 >= dist1) {
x_cm = cm2;
*ec = ec_save2;
+#ifdef ENABLE_QEXT
+ *ext_ec = ext_ec_save2;
+#endif
ctx = ctx_save2;
OPUS_COPY(X, X_save2, N);
OPUS_COPY(Y, Y_save2, N);
if (!last)
OPUS_COPY(norm+M*eBands[i]-norm_offset, norm_save2, N);
OPUS_COPY(bytes_buf, bytes_save, save_bytes);
+#ifdef ENABLE_QEXT
+ if (ext_save_bytes) OPUS_COPY(ext_bytes_buf, ext_bytes_save, ext_save_bytes);
+#endif
}
} else {
ctx.theta_round = 0;
x_cm = quant_band_stereo(&ctx, X, Y, N, b, B,
effective_lowband != -1 ? norm+effective_lowband : NULL, LM,
- last?NULL:norm+M*eBands[i]-norm_offset, lowband_scratch, x_cm|y_cm);
+ last?NULL:norm+M*eBands[i]-norm_offset, lowband_scratch, x_cm|y_cm ARG_QEXT(ext_b) ARG_QEXT(cap));
}
} else {
x_cm = quant_band(&ctx, X, N, b, B,
effective_lowband != -1 ? norm+effective_lowband : NULL, LM,
- last?NULL:norm+M*eBands[i]-norm_offset, Q31ONE, lowband_scratch, x_cm|y_cm);
+ last?NULL:norm+M*eBands[i]-norm_offset, Q31ONE, lowband_scratch, x_cm|y_cm ARG_QEXT(ext_b));
}
y_cm = x_cm;
}
diff --git a/media/libopus/celt/bands.h b/media/libopus/celt/bands.h
@@ -108,7 +108,9 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
const celt_ener *bandE, int *pulses, int shortBlocks, int spread,
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,
- int complexity, int arch, int disable_inv);
+ int complexity, int arch, int disable_inv
+ ARG_QEXT(ec_ctx *ext_ec) ARG_QEXT(int *extra_pulses)
+ ARG_QEXT(opus_int32 total_ext_bits) ARG_QEXT(const int *cap));
void anti_collapse(const CELTMode *m, celt_norm *X_,
unsigned char *collapse_masks, int LM, int C, int size, int start,
diff --git a/media/libopus/celt/celt.c b/media/libopus/celt/celt.c
@@ -54,7 +54,7 @@
#define PACKAGE_VERSION "unknown"
#endif
-#if defined(FIXED_POINT) && defined(__mips_dsp) && __mips == 32
+#if defined(FIXED_POINT) && defined(__mips)
#include "mips/celt_mipsr1.h"
#endif
@@ -64,6 +64,9 @@ int resampling_factor(opus_int32 rate)
int ret;
switch (rate)
{
+#ifdef ENABLE_QEXT
+ case 96000:
+#endif
case 48000:
ret = 1;
break;
@@ -204,7 +207,35 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
{QCONST16(0.3066406250f, 15), QCONST16(0.2170410156f, 15), QCONST16(0.1296386719f, 15)},
{QCONST16(0.4638671875f, 15), QCONST16(0.2680664062f, 15), QCONST16(0.f, 15)},
{QCONST16(0.7998046875f, 15), QCONST16(0.1000976562f, 15), QCONST16(0.f, 15)}};
-
+#ifdef ENABLE_QEXT
+ if (overlap==240) {
+ opus_val32 mem_buf[COMBFILTER_MAXPERIOD+960];
+ opus_val32 buf[COMBFILTER_MAXPERIOD+960];
+ celt_coef new_window[120];
+ int s;
+ int N2;
+ int overlap2;
+ N2 = N/2;
+ overlap2=overlap/2;
+ /* At 96 kHz, we double the period and the spacing between taps, which is equivalent
+ to creating a mirror image of the filter around 24 kHz. It also means we can process
+ the even and odd samples completely independently. */
+ for (s=0;s<2;s++) {
+ opus_val32 *yptr;
+ for (i=0;i<overlap2;i++) new_window[i] = window[2*i+s];
+ for (i=0;i<COMBFILTER_MAXPERIOD+N2;i++) mem_buf[i] = x[2*i+s-2*COMBFILTER_MAXPERIOD];
+ if (x==y) {
+ yptr = mem_buf+COMBFILTER_MAXPERIOD;
+ } else {
+ for (i=0;i<N2;i++) buf[i] = y[2*i+s];
+ yptr = buf;
+ }
+ comb_filter(yptr, mem_buf+COMBFILTER_MAXPERIOD, T0, T1, N2, g0, g1, tapset0, tapset1, new_window, overlap2, arch);
+ for (i=0;i<N2;i++) y[2*i+s] = yptr[i];
+ }
+ return;
+ }
+#endif
if (g0==0 && g1==0)
{
/* OPT: Happens to work without the OPUS_MOVE(), but only because the current encoder already copies x to y */
diff --git a/media/libopus/celt/celt.h b/media/libopus/celt/celt.h
@@ -43,6 +43,13 @@
#include "arch.h"
#include "kiss_fft.h"
+#ifdef ENABLE_QEXT
+#define ARG_QEXT(arg) , arg
+#else
+#define ARG_QEXT(arg)
+#endif
+
+
#ifdef ENABLE_DEEP_PLC
#include "lpcnet.h"
#endif
@@ -55,6 +62,8 @@ extern "C" {
#define CELTDecoder OpusCustomDecoder
#define CELTMode OpusCustomMode
+#define QEXT_EXTENSION_ID 124
+
#define LEAK_BANDS 19
typedef struct {
@@ -161,6 +170,7 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
#ifdef ENABLE_DEEP_PLC
,LPCNetPLCState *lpcnet
#endif
+ ARG_QEXT(const unsigned char *qext_payload) ARG_QEXT(int qext_payload_len)
);
int celt_decode_with_ec(OpusCustomDecoder * OPUS_RESTRICT st, const unsigned char *data,
@@ -170,7 +180,7 @@ int celt_decode_with_ec(OpusCustomDecoder * OPUS_RESTRICT st, const unsigned cha
#define celt_decoder_ctl opus_custom_decoder_ctl
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
#define OPUS_CUSTOM_NOSTATIC
#else
#define OPUS_CUSTOM_NOSTATIC static OPUS_INLINE
@@ -182,7 +192,7 @@ static const unsigned char spread_icdf[4] = {25, 23, 2, 0};
static const unsigned char tapset_icdf[3]={2,1,0};
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
static const unsigned char toOpusTable[20] = {
0xE0, 0xE8, 0xF0, 0xF8,
0xC0, 0xC8, 0xD0, 0xD8,
@@ -245,7 +255,15 @@ void init_caps(const CELTMode *m,int *cap,int LM,int C);
void deemphasis(celt_sig *in[], opus_res *pcm, int N, int C, int downsample, const opus_val16 *coef, celt_sig *mem, int accum);
void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
celt_glog *oldBandE, int start, int effEnd, int C, int CC, int isTransient,
- int LM, int downsample, int silence, int arch);
+ int LM, int downsample, int silence, int arch ARG_QEXT(const CELTMode *qext_mode) ARG_QEXT(const celt_glog *qext_bandLogE) ARG_QEXT(int qext_end));
+#endif
+
+#ifdef ENABLE_QEXT
+#define QEXT_SCALE(x) ((qext_scale)*(x))
+#define QEXT_SCALE2(x, qext_scale) ((qext_scale)*(x))
+#else
+#define QEXT_SCALE(x) (x)
+#define QEXT_SCALE2(x, qext_scale) (x)
#endif
#ifdef __cplusplus
diff --git a/media/libopus/celt/celt_decoder.c b/media/libopus/celt/celt_decoder.c
@@ -69,7 +69,7 @@
/* DECODER */
/* */
/**********************************************************************/
-#define DECODE_BUFFER_SIZE 2048
+#define DECODE_BUFFER_SIZE DEC_PITCH_BUF_SIZE
#define PLC_UPDATE_FRAMES 4
#define PLC_UPDATE_SAMPLES (PLC_UPDATE_FRAMES*FRAME_SIZE)
@@ -89,6 +89,9 @@ struct OpusCustomDecoder {
int disable_inv;
int complexity;
int arch;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+#endif
/* Everything beyond this point gets cleared on a reset */
#define DECODER_RESET_START rng
@@ -127,7 +130,7 @@ struct OpusCustomDecoder {
up writing all over memory. */
void validate_celt_decoder(CELTDecoder *st)
{
-#ifndef CUSTOM_MODES
+#if !defined(CUSTOM_MODES) && !defined(ENABLE_OPUS_CUSTOM_API) && !defined(ENABLE_QEXT)
celt_assert(st->mode == opus_custom_mode_create(48000, 960, NULL));
celt_assert(st->overlap == 120);
celt_assert(st->end <= 21);
@@ -147,8 +150,10 @@ void validate_celt_decoder(CELTDecoder *st)
celt_assert(st->arch >= 0);
celt_assert(st->arch <= OPUS_ARCHMASK);
#endif
+#ifndef ENABLE_QEXT
celt_assert(st->last_pitch_index <= PLC_PITCH_LAG_MAX);
celt_assert(st->last_pitch_index >= PLC_PITCH_LAG_MIN || st->last_pitch_index == 0);
+#endif
celt_assert(st->postfilter_period < MAX_PERIOD);
celt_assert(st->postfilter_period >= COMBFILTER_MINPERIOD || st->postfilter_period == 0);
celt_assert(st->postfilter_period_old < MAX_PERIOD);
@@ -162,20 +167,34 @@ void validate_celt_decoder(CELTDecoder *st)
int celt_decoder_get_size(int channels)
{
+#ifdef ENABLE_QEXT
+ const CELTMode *mode = opus_custom_mode_create(96000, 960, NULL);
+#else
const CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
+#endif
return opus_custom_decoder_get_size(mode, channels);
}
OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_get_size(const CELTMode *mode, int channels)
{
- int size = sizeof(struct CELTDecoder)
- + (channels*(DECODE_BUFFER_SIZE+mode->overlap)-1)*sizeof(celt_sig)
+ int size;
+ int extra=0;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+ extra = 2*NB_QEXT_BANDS*sizeof(celt_glog);
+ if (mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)) {
+ qext_scale = 2;
+ } else qext_scale = 1;
+#endif
+ size = sizeof(struct CELTDecoder)
+ + (channels*(QEXT_SCALE(DECODE_BUFFER_SIZE)+mode->overlap)-1)*sizeof(celt_sig)
+ channels*CELT_LPC_ORDER*sizeof(opus_val16)
- + 4*2*mode->nbEBands*sizeof(celt_glog);
+ + 4*2*mode->nbEBands*sizeof(celt_glog)
+ + extra;
return size;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int *error)
{
int ret;
@@ -195,6 +214,11 @@ CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int
int celt_decoder_init(CELTDecoder *st, opus_int32 sampling_rate, int channels)
{
int ret;
+#ifdef ENABLE_QEXT
+ if (sampling_rate == 96000) {
+ return opus_custom_decoder_init(st, opus_custom_mode_create(96000, 960, NULL), channels);
+ }
+#endif
ret = opus_custom_decoder_init(st, opus_custom_mode_create(48000, 960, NULL), channels);
if (ret != OPUS_OK)
return ret;
@@ -230,19 +254,24 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_init(CELTDecoder *st, const CELTMod
#endif
st->arch = opus_select_arch();
+#ifdef ENABLE_QEXT
+ if (st->mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)) st->qext_scale = 2;
+ else st->qext_scale = 1;
+#endif
+
opus_custom_decoder_ctl(st, OPUS_RESET_STATE);
return OPUS_OK;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
void opus_custom_decoder_destroy(CELTDecoder *st)
{
opus_free(st);
}
#endif /* CUSTOM_MODES */
-#ifndef CUSTOM_MODES
+#if !defined(CUSTOM_MODES) && !defined(ENABLE_OPUS_CUSTOM_API) && !defined(ENABLE_QEXT)
/* Special case for stereo with no downsampling and no accumulation. This is
quite common and we can make it faster by processing both channels in the
same loop, reducing overhead due to the dependency loop in the IIR filter. */
@@ -285,7 +314,7 @@ void deemphasis(celt_sig *in[], opus_res *pcm, int N, int C, int downsample, con
opus_val16 coef0;
VARDECL(celt_sig, scratch);
SAVE_STACK;
-#ifndef CUSTOM_MODES
+#if !defined(CUSTOM_MODES) && !defined(ENABLE_OPUS_CUSTOM_API) && !defined(ENABLE_QEXT)
/* Short version for common case. */
if (downsample == 1 && C == 2 && !accum)
{
@@ -303,7 +332,7 @@ void deemphasis(celt_sig *in[], opus_res *pcm, int N, int C, int downsample, con
celt_sig m = mem[c];
x =in[c];
y = pcm+c;
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API) || defined(ENABLE_QEXT)
if (coef[1] != 0)
{
opus_val16 coef1 = coef[1];
@@ -374,7 +403,7 @@ static
void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
celt_glog *oldBandE, int start, int effEnd, int C, int CC,
int isTransient, int LM, int downsample,
- int silence, int arch)
+ int silence, int arch ARG_QEXT(const CELTMode *qext_mode) ARG_QEXT(const celt_glog *qext_bandLogE) ARG_QEXT(int qext_end))
{
int c, i;
int M;
@@ -392,6 +421,9 @@ void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
N = mode->shortMdctSize<<LM;
ALLOC(freq, N, celt_sig); /**< Interleaved signal MDCTs */
M = 1<<LM;
+#ifdef ENABLE_QEXT
+ if (mode->Fs != 96000) qext_end=2;
+#endif
if (isTransient)
{
@@ -410,6 +442,11 @@ void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
celt_sig *freq2;
denormalise_bands(mode, X, freq, oldBandE, start, effEnd, M,
downsample, silence);
+#ifdef ENABLE_QEXT
+ if (qext_mode)
+ denormalise_bands(qext_mode, X, freq, qext_bandLogE, 0, qext_end, M,
+ downsample, silence);
+#endif
/* Store a temporary copy in the output buffer because the IMDCT destroys its input. */
freq2 = out_syn[1]+overlap/2;
OPUS_COPY(freq2, freq, N);
@@ -427,6 +464,15 @@ void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
/* Use the output buffer as temp array before downmixing. */
denormalise_bands(mode, X+N, freq2, oldBandE+nbEBands, start, effEnd, M,
downsample, silence);
+#ifdef ENABLE_QEXT
+ if (qext_mode)
+ {
+ denormalise_bands(qext_mode, X, freq, qext_bandLogE, 0, qext_end, M,
+ downsample, silence);
+ denormalise_bands(qext_mode, X+N, freq2, qext_bandLogE+NB_QEXT_BANDS, 0, qext_end, M,
+ downsample, silence);
+ }
+#endif
for (i=0;i<N;i++)
freq[i] = ADD32(HALF32(freq[i]), HALF32(freq2[i]));
for (b=0;b<B;b++)
@@ -436,6 +482,11 @@ void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
c=0; do {
denormalise_bands(mode, X+c*N, freq, oldBandE+c*nbEBands, start, effEnd, M,
downsample, silence);
+#ifdef ENABLE_QEXT
+ if (qext_mode)
+ denormalise_bands(qext_mode, X+c*N, freq, qext_bandLogE+c*NB_QEXT_BANDS, 0, qext_end, M,
+ downsample, silence);
+#endif
for (b=0;b<B;b++)
clt_mdct_backward(&mode->mdct, &freq[b], out_syn[c]+NB*b, mode->window, overlap, shift, B, arch);
} while (++c<CC);
@@ -488,20 +539,26 @@ static void tf_decode(int start, int end, int isTransient, int *tf_res, int LM,
}
}
-static int celt_plc_pitch_search(celt_sig *decode_mem[2], int C, int arch)
+static int celt_plc_pitch_search(CELTDecoder *st, celt_sig *decode_mem[2], int C, int arch)
{
int pitch_index;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+#endif
VARDECL( opus_val16, lp_pitch_buf );
SAVE_STACK;
+#ifdef ENABLE_QEXT
+ qext_scale = st->qext_scale;
+#endif
ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 );
pitch_downsample(decode_mem, lp_pitch_buf,
- DECODE_BUFFER_SIZE, C, arch);
+ DECODE_BUFFER_SIZE>>1, C, QEXT_SCALE(2), arch);
pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf,
DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX,
PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index, arch);
pitch_index = PLC_PITCH_LAG_MAX-pitch_index;
RESTORE_STACK;
- return pitch_index;
+ return QEXT_SCALE(pitch_index);
}
static void prefilter_and_fold(CELTDecoder * OPUS_RESTRICT st, int N)
@@ -512,20 +569,29 @@ static void prefilter_and_fold(CELTDecoder * OPUS_RESTRICT st, int N)
int overlap;
celt_sig *decode_mem[2];
const OpusCustomMode *mode;
+ int decode_buffer_size;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+#endif
VARDECL(opus_val32, etmp);
+ SAVE_STACK
+#ifdef ENABLE_QEXT
+ qext_scale = st->qext_scale;
+#endif
+ decode_buffer_size = QEXT_SCALE(DECODE_BUFFER_SIZE);
mode = st->mode;
overlap = st->overlap;
CC = st->channels;
ALLOC(etmp, overlap, opus_val32);
c=0; do {
- decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap);
+ decode_mem[c] = st->_decode_mem + c*(decode_buffer_size+overlap);
} while (++c<CC);
c=0; do {
/* Apply the pre-filter to the MDCT overlap for the next frame because
the post-filter will be re-applied in the decoder after the MDCT
overlap. */
- comb_filter(etmp, decode_mem[c]+DECODE_BUFFER_SIZE-N,
+ comb_filter(etmp, decode_mem[c]+decode_buffer_size-N,
st->postfilter_period_old, st->postfilter_period, overlap,
-st->postfilter_gain_old, -st->postfilter_gain,
st->postfilter_tapset_old, st->postfilter_tapset, NULL, 0, st->arch);
@@ -534,11 +600,12 @@ static void prefilter_and_fold(CELTDecoder * OPUS_RESTRICT st, int N)
MDCT of the next frame. */
for (i=0;i<overlap/2;i++)
{
- decode_mem[c][DECODE_BUFFER_SIZE-N+i] =
+ decode_mem[c][decode_buffer_size-N+i] =
MULT16_32_Q15(COEF2VAL16(mode->window[i]), etmp[overlap-1-i])
+ MULT16_32_Q15 (COEF2VAL16(mode->window[overlap-i-1]), etmp[i]);
}
} while (++c<CC);
+ RESTORE_STACK;
}
#ifdef ENABLE_DEEP_PLC
@@ -613,18 +680,27 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
int loss_duration;
int noise_based;
const opus_int16 *eBands;
+ int decode_buffer_size;
+ int max_period;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+#endif
SAVE_STACK;
-
+#ifdef ENABLE_QEXT
+ qext_scale = st->qext_scale;
+#endif
+ decode_buffer_size = QEXT_SCALE(DECODE_BUFFER_SIZE);
+ max_period = QEXT_SCALE(MAX_PERIOD);
mode = st->mode;
nbEBands = mode->nbEBands;
overlap = mode->overlap;
eBands = mode->eBands;
c=0; do {
- decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap);
- out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZE-N;
+ decode_mem[c] = st->_decode_mem + c*(decode_buffer_size+overlap);
+ out_syn[c] = decode_mem[c]+decode_buffer_size-N;
} while (++c<C);
- lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*C);
+ lpc = (opus_val16*)(st->_decode_mem+(decode_buffer_size+overlap)*C);
oldBandE = (celt_glog*)(lpc+C*CELT_LPC_ORDER);
oldLogE = oldBandE + 2*nbEBands;
oldLogE2 = oldLogE + 2*nbEBands;
@@ -651,7 +727,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */
c=0; do {
OPUS_MOVE(decode_mem[c], decode_mem[c]+N,
- DECODE_BUFFER_SIZE-N+overlap);
+ decode_buffer_size-N+overlap);
} while (++c<C);
if (st->prefilter_and_fold) {
@@ -678,14 +754,32 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
for (j=0;j<blen;j++)
{
seed = celt_lcg_rand(seed);
- X[boffs+j] = (celt_norm)((opus_int32)seed>>20);
+ X[boffs+j] = SHL32((celt_norm)((opus_int32)seed>>20), NORM_SHIFT-14);
}
renormalise_vector(X+boffs, blen, Q31ONE, st->arch);
}
}
st->rng = seed;
- celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsample, 0, st->arch);
+ celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsample, 0, st->arch ARG_QEXT(NULL) ARG_QEXT(NULL) ARG_QEXT(0));
+
+ /* Run the postfilter with the last parameters. */
+ c=0; do {
+ st->postfilter_period=IMAX(st->postfilter_period, COMBFILTER_MINPERIOD);
+ st->postfilter_period_old=IMAX(st->postfilter_period_old, COMBFILTER_MINPERIOD);
+ comb_filter(out_syn[c], out_syn[c], st->postfilter_period_old, st->postfilter_period, mode->shortMdctSize,
+ st->postfilter_gain_old, st->postfilter_gain, st->postfilter_tapset_old, st->postfilter_tapset,
+ mode->window, overlap, st->arch);
+ if (LM!=0)
+ comb_filter(out_syn[c]+mode->shortMdctSize, out_syn[c]+mode->shortMdctSize, st->postfilter_period, st->postfilter_period, N-mode->shortMdctSize,
+ st->postfilter_gain, st->postfilter_gain, st->postfilter_tapset, st->postfilter_tapset,
+ mode->window, overlap, st->arch);
+
+ } while (++c<C);
+ st->postfilter_period_old = st->postfilter_period;
+ st->postfilter_gain_old = st->postfilter_gain;
+ st->postfilter_tapset_old = st->postfilter_tapset;
+
st->prefilter_and_fold = 0;
/* Skip regular PLC until we get two consecutive packets. */
st->skip_plc = 1;
@@ -704,7 +798,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
#ifdef ENABLE_DEEP_PLC
if (lpcnet != NULL && lpcnet->loaded) update_plc_state(lpcnet, decode_mem, &st->plc_preemphasis_mem, C);
#endif
- st->last_pitch_index = pitch_index = celt_plc_pitch_search(decode_mem, C, st->arch);
+ st->last_pitch_index = pitch_index = celt_plc_pitch_search(st, decode_mem, C, st->arch);
} else {
pitch_index = st->last_pitch_index;
fade = QCONST16(.8f,15);
@@ -712,9 +806,9 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
/* We want the excitation for 2 pitch periods in order to look for a
decaying signal, but we can't get more than MAX_PERIOD. */
- exc_length = IMIN(2*pitch_index, MAX_PERIOD);
+ exc_length = IMIN(2*pitch_index, max_period);
- ALLOC(_exc, MAX_PERIOD+CELT_LPC_ORDER, opus_val16);
+ ALLOC(_exc, max_period+CELT_LPC_ORDER, opus_val16);
ALLOC(fir_tmp, exc_length, opus_val16);
exc = _exc+CELT_LPC_ORDER;
window = mode->window;
@@ -728,8 +822,8 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
int j;
buf = decode_mem[c];
- for (i=0;i<MAX_PERIOD+CELT_LPC_ORDER;i++)
- exc[i-CELT_LPC_ORDER] = SROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-CELT_LPC_ORDER+i], SIG_SHIFT);
+ for (i=0;i<max_period+CELT_LPC_ORDER;i++)
+ exc[i-CELT_LPC_ORDER] = SROUND16(buf[decode_buffer_size-max_period-CELT_LPC_ORDER+i], SIG_SHIFT);
if (loss_duration == 0)
{
@@ -737,7 +831,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
/* Compute LPC coefficients for the last MAX_PERIOD samples before
the first loss so we can work in the excitation-filter domain. */
_celt_autocorr(exc, ac, window, overlap,
- CELT_LPC_ORDER, MAX_PERIOD, st->arch);
+ CELT_LPC_ORDER, max_period, st->arch);
/* Add a noise floor of -40 dB. */
#ifdef FIXED_POINT
ac[0] += SHR32(ac[0],13);
@@ -778,9 +872,9 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
{
/* Compute the excitation for exc_length samples before the loss. We need the copy
because celt_fir() cannot filter in-place. */
- celt_fir(exc+MAX_PERIOD-exc_length, lpc+c*CELT_LPC_ORDER,
+ celt_fir(exc+max_period-exc_length, lpc+c*CELT_LPC_ORDER,
fir_tmp, exc_length, CELT_LPC_ORDER, st->arch);
- OPUS_COPY(exc+MAX_PERIOD-exc_length, fir_tmp, exc_length);
+ OPUS_COPY(exc+max_period-exc_length, fir_tmp, exc_length);
}
/* Check if the waveform is decaying, and if so how fast.
@@ -790,15 +884,18 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
opus_val32 E1=1, E2=1;
int decay_length;
#ifdef FIXED_POINT
- int shift = IMAX(0,2*celt_zlog2(celt_maxabs16(&exc[MAX_PERIOD-exc_length], exc_length))-20);
+ int shift = IMAX(0,2*celt_zlog2(celt_maxabs16(&exc[max_period-exc_length], exc_length))-20);
+#ifdef ENABLE_QEXT
+ if (st->qext_scale==2) shift++;
+#endif
#endif
decay_length = exc_length>>1;
for (i=0;i<decay_length;i++)
{
opus_val16 e;
- e = exc[MAX_PERIOD-decay_length+i];
+ e = exc[max_period-decay_length+i];
E1 += SHR32(MULT16_16(e, e), shift);
- e = exc[MAX_PERIOD-2*decay_length+i];
+ e = exc[max_period-2*decay_length+i];
E2 += SHR32(MULT16_16(e, e), shift);
}
E1 = MIN32(E1, E2);
@@ -808,12 +905,12 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
/* Move the decoder memory one frame to the left to give us room to
add the data for the new frame. We ignore the overlap that extends
past the end of the buffer, because we aren't going to use it. */
- OPUS_MOVE(buf, buf+N, DECODE_BUFFER_SIZE-N);
+ OPUS_MOVE(buf, buf+N, decode_buffer_size-N);
/* Extrapolate from the end of the excitation with a period of
"pitch_index", scaling down each period by an additional factor of
"decay". */
- extrapolation_offset = MAX_PERIOD-pitch_index;
+ extrapolation_offset = max_period-pitch_index;
/* We need to extrapolate enough samples to cover a complete MDCT
window (including overlap/2 samples on both sides). */
extrapolation_len = N+overlap;
@@ -826,30 +923,30 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
j -= pitch_index;
attenuation = MULT16_16_Q15(attenuation, decay);
}
- buf[DECODE_BUFFER_SIZE-N+i] =
+ buf[decode_buffer_size-N+i] =
SHL32(EXTEND32(MULT16_16_Q15(attenuation,
exc[extrapolation_offset+j])), SIG_SHIFT);
/* Compute the energy of the previously decoded signal whose
excitation we're copying. */
tmp = SROUND16(
- buf[DECODE_BUFFER_SIZE-MAX_PERIOD-N+extrapolation_offset+j],
+ buf[decode_buffer_size-max_period-N+extrapolation_offset+j],
SIG_SHIFT);
- S1 += SHR32(MULT16_16(tmp, tmp), 10);
+ S1 += SHR32(MULT16_16(tmp, tmp), 11);
}
{
opus_val16 lpc_mem[CELT_LPC_ORDER];
/* Copy the last decoded samples (prior to the overlap region) to
synthesis filter memory so we can have a continuous signal. */
for (i=0;i<CELT_LPC_ORDER;i++)
- lpc_mem[i] = SROUND16(buf[DECODE_BUFFER_SIZE-N-1-i], SIG_SHIFT);
+ lpc_mem[i] = SROUND16(buf[decode_buffer_size-N-1-i], SIG_SHIFT);
/* Apply the synthesis filter to convert the excitation back into
the signal domain. */
- celt_iir(buf+DECODE_BUFFER_SIZE-N, lpc+c*CELT_LPC_ORDER,
- buf+DECODE_BUFFER_SIZE-N, extrapolation_len, CELT_LPC_ORDER,
+ celt_iir(buf+decode_buffer_size-N, lpc+c*CELT_LPC_ORDER,
+ buf+decode_buffer_size-N, extrapolation_len, CELT_LPC_ORDER,
lpc_mem, st->arch);
#ifdef FIXED_POINT
for (i=0; i < extrapolation_len; i++)
- buf[DECODE_BUFFER_SIZE-N+i] = SATURATE(buf[DECODE_BUFFER_SIZE-N+i], SIG_SAT);
+ buf[decode_buffer_size-N+i] = SATURATE(buf[decode_buffer_size-N+i], SIG_SAT);
#endif
}
@@ -860,8 +957,8 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
opus_val32 S2=0;
for (i=0;i<extrapolation_len;i++)
{
- opus_val16 tmp = SROUND16(buf[DECODE_BUFFER_SIZE-N+i], SIG_SHIFT);
- S2 += SHR32(MULT16_16(tmp, tmp), 10);
+ opus_val16 tmp = SROUND16(buf[decode_buffer_size-N+i], SIG_SHIFT);
+ S2 += SHR32(MULT16_16(tmp, tmp), 11);
}
/* This checks for an "explosion" in the synthesis. */
#ifdef FIXED_POINT
@@ -873,7 +970,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
#endif
{
for (i=0;i<extrapolation_len;i++)
- buf[DECODE_BUFFER_SIZE-N+i] = 0;
+ buf[decode_buffer_size-N+i] = 0;
} else if (S1 < S2)
{
opus_val16 ratio = celt_sqrt(frac_div32(SHR32(S1,1)+1,S2+1));
@@ -881,13 +978,13 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
{
opus_val16 tmp_g = Q15ONE
- MULT16_16_Q15(COEF2VAL16(window[i]), Q15ONE-ratio);
- buf[DECODE_BUFFER_SIZE-N+i] =
- MULT16_32_Q15(tmp_g, buf[DECODE_BUFFER_SIZE-N+i]);
+ buf[decode_buffer_size-N+i] =
+ MULT16_32_Q15(tmp_g, buf[decode_buffer_size-N+i]);
}
for (i=overlap;i<extrapolation_len;i++)
{
- buf[DECODE_BUFFER_SIZE-N+i] =
- MULT16_32_Q15(ratio, buf[DECODE_BUFFER_SIZE-N+i]);
+ buf[decode_buffer_size-N+i] =
+ MULT16_32_Q15(ratio, buf[decode_buffer_size-N+i]);
}
}
}
@@ -895,7 +992,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
} while (++c<C);
#ifdef ENABLE_DEEP_PLC
- if (lpcnet != NULL && lpcnet->loaded && (st->complexity >= 5 || lpcnet->fec_fill_pos > 0)) {
+ if (lpcnet != NULL && st->mode->Fs != 96000 && lpcnet->loaded && (st->complexity >= 5 || lpcnet->fec_fill_pos > 0)) {
float overlap_mem;
int samples_needed16k;
celt_sig *buf;
@@ -903,7 +1000,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
buf = decode_mem[0];
ALLOC(buf_copy, C*overlap, float);
c=0; do {
- OPUS_COPY(buf_copy+c*overlap, &decode_mem[c][DECODE_BUFFER_SIZE-N], overlap);
+ OPUS_COPY(buf_copy+c*overlap, &decode_mem[c][decode_buffer_size-N], overlap);
} while (++c<C);
/* Need enough samples from the PLC to cover the frame size, resampling delay,
@@ -921,31 +1018,31 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
int j;
float sum;
for (sum=0, j=0;j<17;j++) sum += 3*st->plc_pcm[i+j]*sinc_filter[3*j];
- buf[DECODE_BUFFER_SIZE-N+3*i] = sum;
+ buf[decode_buffer_size-N+3*i] = sum;
for (sum=0, j=0;j<16;j++) sum += 3*st->plc_pcm[i+j+1]*sinc_filter[3*j+2];
- buf[DECODE_BUFFER_SIZE-N+3*i+1] = sum;
+ buf[decode_buffer_size-N+3*i+1] = sum;
for (sum=0, j=0;j<16;j++) sum += 3*st->plc_pcm[i+j+1]*sinc_filter[3*j+1];
- buf[DECODE_BUFFER_SIZE-N+3*i+2] = sum;
+ buf[decode_buffer_size-N+3*i+2] = sum;
}
OPUS_MOVE(st->plc_pcm, &st->plc_pcm[N/3], st->plc_fill-N/3);
st->plc_fill -= N/3;
for (i=0;i<N;i++) {
- float tmp = buf[DECODE_BUFFER_SIZE-N+i];
- buf[DECODE_BUFFER_SIZE-N+i] -= PREEMPHASIS*st->plc_preemphasis_mem;
+ float tmp = buf[decode_buffer_size-N+i];
+ buf[decode_buffer_size-N+i] -= PREEMPHASIS*st->plc_preemphasis_mem;
st->plc_preemphasis_mem = tmp;
}
overlap_mem = st->plc_preemphasis_mem;
for (i=0;i<overlap;i++) {
- float tmp = buf[DECODE_BUFFER_SIZE+i];
- buf[DECODE_BUFFER_SIZE+i] -= PREEMPHASIS*overlap_mem;
+ float tmp = buf[decode_buffer_size+i];
+ buf[decode_buffer_size+i] -= PREEMPHASIS*overlap_mem;
overlap_mem = tmp;
}
/* For now, we just do mono PLC. */
- if (C==2) OPUS_COPY(decode_mem[1], decode_mem[0], DECODE_BUFFER_SIZE+overlap);
+ if (C==2) OPUS_COPY(decode_mem[1], decode_mem[0], decode_buffer_size+overlap);
c=0; do {
/* Cross-fade with 48-kHz non-neural PLC for the first 2.5 ms to avoid a discontinuity. */
if (loss_duration == 0) {
- for (i=0;i<overlap;i++) decode_mem[c][DECODE_BUFFER_SIZE-N+i] = (1-window[i])*buf_copy[c*overlap+i] + (window[i])*decode_mem[c][DECODE_BUFFER_SIZE-N+i];
+ for (i=0;i<overlap;i++) decode_mem[c][decode_buffer_size-N+i] = (1-window[i])*buf_copy[c*overlap+i] + (window[i])*decode_mem[c][decode_buffer_size-N+i];
}
} while (++c<C);
}
@@ -959,11 +1056,20 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM
RESTORE_STACK;
}
+#ifdef ENABLE_QEXT
+static void decode_qext_stereo_params(ec_dec *ec, int qext_end, int *qext_intensity, int *qext_dual_stereo) {
+ *qext_intensity = ec_dec_uint(ec, qext_end+1);
+ if (*qext_intensity != 0) *qext_dual_stereo = ec_dec_bit_logp(ec, 1);
+ else *qext_dual_stereo = 0;
+}
+#endif
+
int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data,
int len, opus_res * OPUS_RESTRICT pcm, int frame_size, ec_dec *dec, int accum
#ifdef ENABLE_DEEP_PLC
,LPCNetPLCState *lpcnet
#endif
+ ARG_QEXT(const unsigned char *qext_payload) ARG_QEXT(int qext_payload_len)
)
{
int c, i, N;
@@ -1011,7 +1117,28 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
int overlap;
const opus_int16 *eBands;
celt_glog max_background_increase;
+ int decode_buffer_size;
+#ifdef ENABLE_QEXT
+ opus_int32 qext_bits;
+ ec_dec ext_dec;
+ int qext_bytes=0;
+ int qext_end=0;
+ int qext_intensity=0;
+ int qext_dual_stereo=0;
+ VARDECL(int, extra_quant);
+ VARDECL(int, extra_pulses);
+ const CELTMode *qext_mode = NULL;
+ CELTMode qext_mode_struct;
+ celt_glog *qext_oldBandE=NULL;
+ int qext_scale;
+#else
+# define qext_bytes 0
+#endif
ALLOC_STACK;
+#ifdef ENABLE_QEXT
+ qext_scale = st->qext_scale;
+#endif
+ decode_buffer_size = QEXT_SCALE(DECODE_BUFFER_SIZE);
VALIDATE_CELT_DECODER(st);
mode = st->mode;
@@ -1022,18 +1149,28 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
end = st->end;
frame_size *= st->downsample;
- lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC);
+ lpc = (opus_val16*)(st->_decode_mem+(decode_buffer_size+overlap)*CC);
oldBandE = (celt_glog*)(lpc+CC*CELT_LPC_ORDER);
oldLogE = oldBandE + 2*nbEBands;
oldLogE2 = oldLogE + 2*nbEBands;
backgroundLogE = oldLogE2 + 2*nbEBands;
-#ifdef CUSTOM_MODES
+#ifdef ENABLE_QEXT
+ if (qext_payload) {
+ ec_dec_init(&ext_dec, (unsigned char*)qext_payload, qext_payload_len);
+ qext_bytes = qext_payload_len;
+ } else {
+ ec_dec_init(&ext_dec, NULL, 0);
+ }
+#endif
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
if (st->signalling && data!=NULL)
{
int data0=data[0];
/* Convert "standard mode" to Opus header */
+# ifndef ENABLE_QEXT
if (mode->Fs==48000 && mode->shortMdctSize==120)
+# endif
{
data0 = fromOpus(data0);
if (data0<0)
@@ -1064,6 +1201,12 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
} while (p==255);
padding--;
if (len <= 0 || padding<0) return OPUS_INVALID_PACKET;
+#ifdef ENABLE_QEXT
+ qext_bytes = padding;
+ if (data[len] != QEXT_EXTENSION_ID<<1)
+ qext_bytes=0;
+ ec_dec_init(&ext_dec, (unsigned char*)data+len+1, qext_bytes);
+#endif
}
} else
{
@@ -1093,8 +1236,8 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
N = M*mode->shortMdctSize;
c=0; do {
- decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap);
- out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZE-N;
+ decode_mem[c] = st->_decode_mem + c*(decode_buffer_size+overlap);
+ out_syn[c] = decode_mem[c]+decode_buffer_size-N;
} while (++c<CC);
effEnd = end;
@@ -1279,30 +1422,74 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses,
fine_quant, fine_priority, C, LM, dec, 0, 0, 0);
- unquant_fine_energy(mode, start, end, oldBandE, fine_quant, dec, C);
+ unquant_fine_energy(mode, start, end, oldBandE, NULL, fine_quant, dec, C);
+
+ ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */
+
+#ifdef ENABLE_QEXT
+ if (qext_bytes && end == nbEBands &&
+ ((mode->Fs == 48000 && (mode->shortMdctSize==120 || mode->shortMdctSize==90))
+ || (mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)))) {
+ int qext_intra_ener;
+ qext_oldBandE = backgroundLogE + 2*nbEBands;
+ compute_qext_mode(&qext_mode_struct, mode);
+ qext_mode = &qext_mode_struct;
+ qext_end = ec_dec_bit_logp(&ext_dec, 1) ? NB_QEXT_BANDS : 2;
+ if (C==2) decode_qext_stereo_params(&ext_dec, qext_end, &qext_intensity, &qext_dual_stereo);
+ qext_intra_ener = ec_tell(&ext_dec)+3<=qext_bytes*8 ? ec_dec_bit_logp(&ext_dec, 3) : 0;
+ unquant_coarse_energy(qext_mode, 0, qext_end, qext_oldBandE,
+ qext_intra_ener, &ext_dec, C, LM);
+ }
+ ALLOC(extra_quant, nbEBands+NB_QEXT_BANDS, int);
+ ALLOC(extra_pulses, nbEBands+NB_QEXT_BANDS, int);
+ qext_bits = ((opus_int32)qext_bytes*8<<BITRES) - (opus_int32)ec_tell_frac(dec) - 1;
+ clt_compute_extra_allocation(mode, qext_mode, start, end, qext_end, NULL, NULL,
+ qext_bits, extra_pulses, extra_quant, C, LM, &ext_dec, 0, 0, 0);
+ if (qext_bytes > 0) {
+ unquant_fine_energy(mode, start, end, oldBandE, fine_quant, extra_quant, &ext_dec, C);
+ }
+#endif
c=0; do {
- OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap);
+ OPUS_MOVE(decode_mem[c], decode_mem[c]+N, decode_buffer_size-N+overlap);
} while (++c<CC);
/* Decode fixed codebook */
ALLOC(collapse_masks, C*nbEBands, unsigned char);
- ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */
-
quant_all_bands(0, mode, start, end, X, C==2 ? X+N : NULL, collapse_masks,
NULL, pulses, shortBlocks, spread_decision, dual_stereo, intensity, tf_res,
len*(8<<BITRES)-anti_collapse_rsv, balance, dec, LM, codedBands, &st->rng, 0,
- st->arch, st->disable_inv);
+ st->arch, st->disable_inv
+ ARG_QEXT(&ext_dec) ARG_QEXT(extra_pulses)
+ ARG_QEXT(qext_bytes*(8<<BITRES)) ARG_QEXT(cap));
+
+#ifdef ENABLE_QEXT
+ if (qext_mode) {
+ VARDECL(int, zeros);
+ VARDECL(unsigned char, qext_collapse_masks);
+ ec_dec dummy_dec;
+ int ext_balance;
+ ALLOC(zeros, nbEBands, int);
+ ALLOC(qext_collapse_masks, C*NB_QEXT_BANDS, unsigned char);
+ ec_dec_init(&dummy_dec, NULL, 0);
+ OPUS_CLEAR(zeros, end);
+ ext_balance = qext_bytes*(8<<BITRES) - ec_tell_frac(&ext_dec);
+ for (i=0;i<qext_end;i++) ext_balance -= extra_pulses[nbEBands+i] + C*(extra_quant[nbEBands+1]<<BITRES);
+ unquant_fine_energy(qext_mode, 0, qext_end, qext_oldBandE, NULL, &extra_quant[nbEBands], &ext_dec, C);
+ quant_all_bands(0, qext_mode, 0, qext_end, X, C==2 ? X+N : NULL, qext_collapse_masks,
+ NULL, &extra_pulses[nbEBands], shortBlocks, spread_decision, qext_dual_stereo, qext_intensity, zeros,
+ qext_bytes*(8<<BITRES), ext_balance, &ext_dec, LM, qext_end, &st->rng, 0,
+ st->arch, st->disable_inv, &dummy_dec, zeros, 0, NULL);
+ }
+#endif
if (anti_collapse_rsv > 0)
{
anti_collapse_on = ec_dec_bits(dec, 1);
}
-
- unquant_energy_finalise(mode, start, end, oldBandE,
+ unquant_energy_finalise(mode, start, end, (qext_bytes > 0) ? NULL : oldBandE,
fine_quant, fine_priority, len*8-ec_tell(dec), dec, C);
-
if (anti_collapse_on)
anti_collapse(mode, X, collapse_masks, LM, C, N,
start, end, oldBandE, oldLogE, oldLogE2, pulses, st->rng, 0, st->arch);
@@ -1316,7 +1503,7 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
prefilter_and_fold(st, N);
}
celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd,
- C, CC, isTransient, LM, st->downsample, silence, st->arch);
+ C, CC, isTransient, LM, st->downsample, silence, st->arch ARG_QEXT(qext_mode) ARG_QEXT(qext_oldBandE) ARG_QEXT(qext_end));
c=0; do {
st->postfilter_period=IMAX(st->postfilter_period, COMBFILTER_MINPERIOD);
@@ -1375,6 +1562,9 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
}
} while (++c<2);
st->rng = dec->rng;
+#ifdef ENABLE_QEXT
+ if (qext_bytes) st->rng = st->rng ^ ext_dec.rng;
+#endif
deemphasis(out_syn, pcm, N, CC, st->downsample, mode->preemph, st->preemph_memD, accum);
st->loss_duration = 0;
@@ -1382,6 +1572,10 @@ int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char
RESTORE_STACK;
if (ec_tell(dec) > 8*len)
return OPUS_INTERNAL_ERROR;
+#ifdef ENABLE_QEXT
+ if (qext_bytes != 0 && ec_tell(&ext_dec) > 8*qext_bytes)
+ return OPUS_INTERNAL_ERROR;
+#endif
if(ec_get_error(dec))
st->error = 1;
return frame_size/st->downsample;
@@ -1394,10 +1588,11 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
#ifdef ENABLE_DEEP_PLC
, NULL
#endif
+ ARG_QEXT(NULL) ARG_QEXT(0)
);
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
#if defined(FIXED_POINT) && !defined(ENABLE_RES24)
int opus_custom_decode(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, opus_int16 * OPUS_RESTRICT pcm, int frame_size)
@@ -1566,7 +1761,12 @@ int opus_custom_decoder_ctl(CELTDecoder * OPUS_RESTRICT st, int request, ...)
int i;
opus_val16 *lpc;
celt_glog *oldBandE, *oldLogE, *oldLogE2;
- lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+st->overlap)*st->channels);
+ int decode_buffer_size;
+#ifdef ENABLE_QEXT
+ int qext_scale = st->qext_scale;
+#endif
+ decode_buffer_size = QEXT_SCALE(DECODE_BUFFER_SIZE);
+ lpc = (opus_val16*)(st->_decode_mem+(decode_buffer_size+st->overlap)*st->channels);
oldBandE = (celt_glog*)(lpc+st->channels*CELT_LPC_ORDER);
oldLogE = oldBandE + 2*st->mode->nbEBands;
oldLogE2 = oldLogE + 2*st->mode->nbEBands;
diff --git a/media/libopus/celt/celt_encoder.c b/media/libopus/celt/celt_encoder.c
@@ -81,6 +81,10 @@ struct OpusCustomEncoder {
int lfe;
int disable_inv;
int arch;
+#ifdef ENABLE_QEXT
+ int enable_qext;
+ int qext_scale;
+#endif
/* Everything beyond this point gets cleared on a reset */
#define ENCODER_RESET_START rng
@@ -120,8 +124,13 @@ struct OpusCustomEncoder {
celt_glog spec_avg;
#ifdef RESYNTH
+#ifdef ENABLE_QEXT
+ /* +MAX_PERIOD/2 to make space for overlap */
+ celt_sig syn_mem[2][2*DEC_PITCH_BUF_SIZE+MAX_PERIOD];
+#else
/* +MAX_PERIOD/2 to make space for overlap */
- celt_sig syn_mem[2][2*MAX_PERIOD+MAX_PERIOD/2];
+ celt_sig syn_mem[2][DEC_PITCH_BUF_SIZE+MAX_PERIOD/2];
+#endif
#endif
celt_sig in_mem[1]; /* Size = channels*mode->overlap */
@@ -134,23 +143,37 @@ struct OpusCustomEncoder {
int celt_encoder_get_size(int channels)
{
+#ifdef ENABLE_QEXT
+ CELTMode *mode = opus_custom_mode_create(96000, 1920, NULL);
+#else
CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
+#endif
return opus_custom_encoder_get_size(mode, channels);
}
OPUS_CUSTOM_NOSTATIC int opus_custom_encoder_get_size(const CELTMode *mode, int channels)
{
- int size = sizeof(struct CELTEncoder)
+ int extra=0;
+ int size;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+ extra = channels*NB_QEXT_BANDS*sizeof(celt_glog);
+ if (mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)) {
+ qext_scale = 2;
+ } else qext_scale = 1;
+#endif
+ size = sizeof(struct CELTEncoder)
+ (channels*mode->overlap-1)*sizeof(celt_sig) /* celt_sig in_mem[channels*mode->overlap]; */
- + channels*COMBFILTER_MAXPERIOD*sizeof(celt_sig) /* celt_sig prefilter_mem[channels*COMBFILTER_MAXPERIOD]; */
- + 4*channels*mode->nbEBands*sizeof(celt_glog); /* celt_glog oldBandE[channels*mode->nbEBands]; */
+ + channels*QEXT_SCALE(COMBFILTER_MAXPERIOD)*sizeof(celt_sig) /* celt_sig prefilter_mem[channels*COMBFILTER_MAXPERIOD]; */
+ + 4*channels*mode->nbEBands*sizeof(celt_glog) /* celt_glog oldBandE[channels*mode->nbEBands]; */
/* celt_glog oldLogE[channels*mode->nbEBands]; */
/* celt_glog oldLogE2[channels*mode->nbEBands]; */
/* celt_glog energyError[channels*mode->nbEBands]; */
+ + extra;
return size;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
CELTEncoder *opus_custom_encoder_create(const CELTMode *mode, int channels, int *error)
{
int ret;
@@ -197,12 +220,17 @@ static int opus_custom_encoder_init_arch(CELTEncoder *st, const CELTMode *mode,
st->complexity = 5;
st->lsb_depth=24;
+#ifdef ENABLE_QEXT
+ if (st->mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)) st->qext_scale = 2;
+ else st->qext_scale = 1;
+#endif
+
opus_custom_encoder_ctl(st, OPUS_RESET_STATE);
return OPUS_OK;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
int opus_custom_encoder_init(CELTEncoder *st, const CELTMode *mode, int channels)
{
return opus_custom_encoder_init_arch(st, mode, channels, opus_select_arch());
@@ -213,6 +241,13 @@ int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels,
int arch)
{
int ret;
+#ifdef ENABLE_QEXT
+ if (sampling_rate==96000) {
+ st->upsample = 1;
+ return opus_custom_encoder_init_arch(st,
+ opus_custom_mode_create(96000, 1920, NULL), channels, arch);
+ }
+#endif
ret = opus_custom_encoder_init_arch(st,
opus_custom_mode_create(48000, 960, NULL), channels, arch);
if (ret != OPUS_OK)
@@ -221,7 +256,7 @@ int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels,
return OPUS_OK;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
void opus_custom_encoder_destroy(CELTEncoder *st)
{
opus_free(st);
@@ -410,7 +445,10 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int
/* Prevent the transient detector from confusing the partial cycle of a
very low frequency tone with a transient. */
if (toneishness > QCONST32(.98f, 29) && tone_freq < QCONST16(0.026f, 13))
+ {
is_transient = 0;
+ mask_metric = 0;
+ }
/* For low bitrates, define "weak transients" that need to be
handled differently to avoid partial collapse. */
if (allow_weak_transients && is_transient && mask_metric<600) {
@@ -560,17 +598,28 @@ void celt_preemphasis(const opus_res * OPUS_RESTRICT pcmp, celt_sig * OPUS_RESTR
#else
(void)clip; /* Avoids a warning about clip being unused. */
#endif
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API) || defined(ENABLE_QEXT)
if (coef[1] != 0)
{
opus_val16 coef1 = coef[1];
+#if defined(FIXED_POINT) && defined(ENABLE_QEXT)
+ /* If we need the extra precision, we use the fact that coef[3] is exact to do a Newton-Raphson
+ iteration and get us more precision on coef[2]. */
+ opus_val32 coef2_q30 = SHL32(coef[2], 18) + PSHR32(MULT16_16(QCONST32(1.f, 25) - MULT16_16(coef[3], coef[2]), coef[2]), 7);
+ celt_assert(SIG_SHIFT == 12);
+#else
opus_val16 coef2 = coef[2];
+#endif
for (i=0;i<N;i++)
{
celt_sig x, tmp;
x = inp[i];
/* Apply pre-emphasis */
+#if defined(FIXED_POINT) && defined(ENABLE_QEXT)
+ tmp = SHL32(MULT32_32_Q31(coef2_q30, x), 1);
+#else
tmp = SHL32(MULT16_32_Q15(coef2, x), 15-SIG_SHIFT);
+#endif
inp[i] = tmp + m;
m = MULT16_32_Q15(coef1, inp[i]) - MULT16_32_Q15(coef0, tmp);
}
@@ -597,7 +646,7 @@ static opus_val32 l1_metric(const celt_norm *tmp, int N, int LM, opus_val16 bias
opus_val32 L1;
L1 = 0;
for (i=0;i<N;i++)
- L1 += EXTEND32(ABS16(tmp[i]));
+ L1 += EXTEND32(ABS16(SHR32(tmp[i], NORM_SHIFT-14)));
/* When in doubt, prefer good freq resolution */
L1 = MAC16_32_Q15(L1, LM*bias, L1);
return L1;
@@ -833,7 +882,7 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
for (i=0;i<8;i++)
{
opus_val32 partial;
- partial = celt_inner_prod(&X[m->eBands[i]<<LM], &X[N0+(m->eBands[i]<<LM)],
+ partial = celt_inner_prod_norm_shift(&X[m->eBands[i]<<LM], &X[N0+(m->eBands[i]<<LM)],
(m->eBands[i+1]-m->eBands[i])<<LM, arch);
sum = ADD16(sum, EXTRACT16(SHR32(partial, 18)));
}
@@ -843,7 +892,7 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
for (i=8;i<intensity;i++)
{
opus_val32 partial;
- partial = celt_inner_prod(&X[m->eBands[i]<<LM], &X[N0+(m->eBands[i]<<LM)],
+ partial = celt_inner_prod_norm_shift(&X[m->eBands[i]<<LM], &X[N0+(m->eBands[i]<<LM)],
(m->eBands[i+1]-m->eBands[i])<<LM, arch);
minXC = MIN16(minXC, ABS16(EXTRACT16(SHR32(partial, 18))));
}
@@ -913,8 +962,8 @@ static int stereo_analysis(const CELTMode *m, const celt_norm *X,
{
opus_val32 L, R, M, S;
/* We cast to 32-bit first because of the -32768 case */
- L = EXTEND32(X[j]);
- R = EXTEND32(X[N0+j]);
+ L = SHR32(X[j], NORM_SHIFT-14);
+ R = SHR32(X[N0+j], NORM_SHIFT-14);
M = ADD32(L, R);
S = SUB32(L, R);
sumLR = ADD32(sumLR, ADD32(ABS32(L), ABS32(R)));
@@ -994,7 +1043,8 @@ static celt_glog dynalloc_analysis(const celt_glog *bandLogE, const celt_glog *b
int nbEBands, int start, int end, int C, int *offsets, int lsb_depth, const opus_int16 *logN,
int isTransient, int vbr, int constrained_vbr, const opus_int16 *eBands, int LM,
int effectiveBytes, opus_int32 *tot_boost_, int lfe, celt_glog *surround_dynalloc,
- AnalysisInfo *analysis, int *importance, int *spread_weight, opus_val16 tone_freq, opus_val32 toneishness)
+ AnalysisInfo *analysis, int *importance, int *spread_weight, opus_val16 tone_freq, opus_val32 toneishness
+ ARG_QEXT(int qext_scale))
{
int i, c;
opus_int32 tot_boost=0;
@@ -1148,9 +1198,9 @@ static celt_glog dynalloc_analysis(const celt_glog *bandLogE, const celt_glog *b
/* Compensate for Opus' under-allocation on tones. */
if (toneishness > QCONST32(.98f, 29)) {
#ifdef FIXED_POINT
- int freq_bin = PSHR32(MULT16_16(tone_freq, QCONST16(120/M_PI, 9)), 13+9);
+ int freq_bin = PSHR32(QEXT_SCALE((opus_val32)tone_freq)*QCONST16(120/M_PI, 9), 13+9);
#else
- int freq_bin = (int)floor(.5 + tone_freq*120/M_PI);
+ int freq_bin = (int)floor(.5 + QEXT_SCALE(tone_freq)*120/M_PI);
#endif
for (i=start;i<end;i++) {
if (freq_bin >= eBands[i] && freq_bin <= eBands[i+1]) follower[i] += GCONST(2.f);
@@ -1158,6 +1208,10 @@ static celt_glog dynalloc_analysis(const celt_glog *bandLogE, const celt_glog *b
if (freq_bin >= eBands[i]-2 && freq_bin <= eBands[i+1]+2) follower[i] += GCONST(1.f);
if (freq_bin >= eBands[i]-3 && freq_bin <= eBands[i+1]+3) follower[i] += GCONST(.5f);
}
+ if (freq_bin >= eBands[end]) {
+ follower[end-1] += GCONST(2.f);
+ follower[end-2] += GCONST(1.f);
+ }
}
#ifdef DISABLE_FLOAT_API
(void)analysis;
@@ -1306,7 +1360,7 @@ static opus_val16 tone_detect(const celt_sig *in, int CC, int N, opus_val32 *ton
opus_val16 freq;
VARDECL(opus_val16, x);
ALLOC(x, N, opus_val16);
- /* Shift by SIG_SHIFT+1 (+2 for stereo) to account for HF gain of the preemphasis filter. */
+ /* Shift by SIG_SHIFT+2 (+3 for stereo) to account for HF gain of the preemphasis filter. */
if (CC==2) {
for (i=0;i<N;i++) x[i] = PSHR32(ADD32(in[i], in[i+N]), SIG_SHIFT+3);
} else {
@@ -1326,7 +1380,7 @@ static opus_val16 tone_detect(const celt_sig *in, int CC, int N, opus_val32 *ton
/* Squared radius of the poles. */
*toneishness = -lpc[1];
#ifdef FIXED_POINT
- freq = acos_approx(lpc[0]>>1)/delay;
+ freq = (acos_approx(lpc[0]>>1)+delay/2)/delay;
#else
freq = acos(.5f*lpc[0])/delay;
#endif
@@ -1339,7 +1393,8 @@ static opus_val16 tone_detect(const celt_sig *in, int CC, int N, opus_val32 *ton
}
static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem, int CC, int N,
- int prefilter_tapset, int *pitch, opus_val16 *gain, int *qgain, int enabled, opus_val16 tf_estimate, int nbAvailableBytes, AnalysisInfo *analysis, opus_val16 tone_freq, opus_val32 toneishness)
+ int prefilter_tapset, int *pitch, opus_val16 *gain, int *qgain, int enabled, int complexity, opus_val16 tf_estimate,
+ int nbAvailableBytes, AnalysisInfo *analysis, opus_val16 tone_freq, opus_val32 toneishness ARG_QEXT(int qext_scale))
{
int c;
VARDECL(celt_sig, _pre);
@@ -1351,61 +1406,69 @@ static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem,
int pf_on;
int qg;
int overlap;
+ int min_period, max_period;
opus_val32 before[2]={0}, after[2]={0};
int cancel_pitch=0;
SAVE_STACK;
+ max_period = QEXT_SCALE(COMBFILTER_MAXPERIOD);
+ min_period = QEXT_SCALE(COMBFILTER_MINPERIOD);
mode = st->mode;
overlap = mode->overlap;
- ALLOC(_pre, CC*(N+COMBFILTER_MAXPERIOD), celt_sig);
+ ALLOC(_pre, CC*(N+max_period), celt_sig);
pre[0] = _pre;
- pre[1] = _pre + (N+COMBFILTER_MAXPERIOD);
+ pre[1] = _pre + (N+max_period);
c=0; do {
- OPUS_COPY(pre[c], prefilter_mem+c*COMBFILTER_MAXPERIOD, COMBFILTER_MAXPERIOD);
- OPUS_COPY(pre[c]+COMBFILTER_MAXPERIOD, in+c*(N+overlap)+overlap, N);
+ OPUS_COPY(pre[c], prefilter_mem+c*max_period, max_period);
+ OPUS_COPY(pre[c]+max_period, in+c*(N+overlap)+overlap, N);
} while (++c<CC);
- if (enabled)
- {
+ /* If we detect that the signal is dominated by a single tone, don't rely on the standard pitch
+ estimator, as it can become unreliable. */
+ if (enabled && toneishness > QCONST32(.99f, 29)) {
+ int multiple=1;
+ /* Using aliased version of the postfilter above 24 kHz.
+ First value is purposely slightly above pi to avoid triggering for Fs=48kHz. */
+ if (QEXT_SCALE(tone_freq) >= QCONST16(3.1416f, 13)) tone_freq = QCONST16(3.141593f, 13) - tone_freq;
+ /* If the pitch is too high for our post-filter, apply pitch doubling until
+ we can get something that fits (not ideal, but better than nothing). */
+ while (QEXT_SCALE(tone_freq) >= multiple*QCONST16(0.39f, 13)) multiple++;
+ if (QEXT_SCALE(tone_freq) > QCONST16(0.006148f, 13)) {
+#ifdef FIXED_POINT
+ pitch_index = IMIN((51472*multiple+QEXT_SCALE(tone_freq)/2)/QEXT_SCALE(tone_freq), COMBFILTER_MAXPERIOD-2);
+#else
+ pitch_index = IMIN((int)floor(.5+2.f*M_PI*multiple/QEXT_SCALE(tone_freq)), COMBFILTER_MAXPERIOD-2);
+#endif
+ } else {
+ /* If the pitch is too low, using a very high pitch will actually give us an improvement
+ due to the DC component of the filter that will be close to our tone. Again, not ideal,
+ but if we only have a single tone, it's better than nothing. */
+ pitch_index = COMBFILTER_MINPERIOD;
+ }
+ gain1 = QCONST16(.75f, 15);
+ } else if (enabled && complexity >= 5) {
VARDECL(opus_val16, pitch_buf);
- ALLOC(pitch_buf, (COMBFILTER_MAXPERIOD+N)>>1, opus_val16);
+ ALLOC(pitch_buf, (max_period+N)>>1, opus_val16);
- pitch_downsample(pre, pitch_buf, COMBFILTER_MAXPERIOD+N, CC, st->arch);
+ pitch_downsample(pre, pitch_buf, (max_period+N)>>1, CC, 2, st->arch);
/* Don't search for the fir last 1.5 octave of the range because
there's too many false-positives due to short-term correlation */
- pitch_search(pitch_buf+(COMBFILTER_MAXPERIOD>>1), pitch_buf, N,
- COMBFILTER_MAXPERIOD-3*COMBFILTER_MINPERIOD, &pitch_index,
+ pitch_search(pitch_buf+(max_period>>1), pitch_buf, N,
+ max_period-3*min_period, &pitch_index,
st->arch);
- pitch_index = COMBFILTER_MAXPERIOD-pitch_index;
+ pitch_index = max_period-pitch_index;
- gain1 = remove_doubling(pitch_buf, COMBFILTER_MAXPERIOD, COMBFILTER_MINPERIOD,
+ gain1 = remove_doubling(pitch_buf, max_period, min_period,
N, &pitch_index, st->prefilter_period, st->prefilter_gain, st->arch);
- if (pitch_index > COMBFILTER_MAXPERIOD-2)
- pitch_index = COMBFILTER_MAXPERIOD-2;
- gain1 = MULT16_16_Q15(QCONST16(.7f,15),gain1);
- /* If we detect that the signal is dominated by a single tone, don't rely on the standard pitch
- estimator, as it can become unreliable. */
- if (toneishness > QCONST32(.99f, 29)) {
- /* If the pitch is too high for our post-filter, apply pitch doubling until
- we can get something that fits (not ideal, but better than nothing). */
- while (tone_freq >= QCONST16(0.39f, 13)) tone_freq/=2;
- if (tone_freq > QCONST16(0.006148f, 13)) {
-#ifdef FIXED_POINT
- pitch_index = IMIN(51472/tone_freq, COMBFILTER_MAXPERIOD-2);
-#else
- pitch_index = IMIN((int)floor(.5+2.f*M_PI/tone_freq), COMBFILTER_MAXPERIOD-2);
+ if (pitch_index > max_period-QEXT_SCALE(2))
+ pitch_index = max_period-QEXT_SCALE(2);
+#ifdef ENABLE_QEXT
+ pitch_index /= qext_scale;
#endif
- } else {
- /* If the pitch is too low, using a very high pitch will actually give us an improvement
- due to the DC component of the filter that will be close to our tone. Again, not ideal,
- but if we only have a single tone, it's better than nothing. */
- pitch_index = COMBFILTER_MINPERIOD;
- }
- gain1 = QCONST16(.75f, 15);
- }
+ gain1 = MULT16_16_Q15(QCONST16(.7f,15),gain1);
/*printf("%d %d %f %f\n", pitch_change, pitch_index, gain1, st->analysis.tonality);*/
if (st->loss_rate>2)
gain1 = HALF32(gain1);
@@ -1474,11 +1537,11 @@ static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem,
OPUS_COPY(in+c*(N+overlap), st->in_mem+c*(overlap), overlap);
for (i=0;i<N;i++) before[c] += ABS32(SHR32(in[c*(N+overlap)+overlap+i], 12));
if (offset)
- comb_filter(in+c*(N+overlap)+overlap, pre[c]+COMBFILTER_MAXPERIOD,
+ comb_filter(in+c*(N+overlap)+overlap, pre[c]+max_period,
st->prefilter_period, st->prefilter_period, offset, -st->prefilter_gain, -st->prefilter_gain,
st->prefilter_tapset, st->prefilter_tapset, NULL, 0, st->arch);
- comb_filter(in+c*(N+overlap)+overlap+offset, pre[c]+COMBFILTER_MAXPERIOD+offset,
+ comb_filter(in+c*(N+overlap)+overlap+offset, pre[c]+max_period+offset,
st->prefilter_period, pitch_index, N-offset, -st->prefilter_gain, -gain1,
st->prefilter_tapset, prefilter_tapset, mode->window, overlap, st->arch);
for (i=0;i<N;i++) after[c] += ABS32(SHR32(in[c*(N+overlap)+overlap+i], 12));
@@ -1500,8 +1563,8 @@ static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem,
if (cancel_pitch) {
c=0; do {
int offset = mode->shortMdctSize-overlap;
- OPUS_COPY(in+c*(N+overlap)+overlap, pre[c]+COMBFILTER_MAXPERIOD, N);
- comb_filter(in+c*(N+overlap)+overlap+offset, pre[c]+COMBFILTER_MAXPERIOD+offset,
+ OPUS_COPY(in+c*(N+overlap)+overlap, pre[c]+max_period, N);
+ comb_filter(in+c*(N+overlap)+overlap+offset, pre[c]+max_period+offset,
st->prefilter_period, pitch_index, overlap, -st->prefilter_gain, -0,
st->prefilter_tapset, prefilter_tapset, mode->window, overlap, st->arch);
} while (++c<CC);
@@ -1513,12 +1576,12 @@ static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem,
c=0; do {
OPUS_COPY(st->in_mem+c*(overlap), in+c*(N+overlap)+N, overlap);
- if (N>COMBFILTER_MAXPERIOD)
+ if (N>max_period)
{
- OPUS_COPY(prefilter_mem+c*COMBFILTER_MAXPERIOD, pre[c]+N, COMBFILTER_MAXPERIOD);
+ OPUS_COPY(prefilter_mem+c*max_period, pre[c]+N, max_period);
} else {
- OPUS_MOVE(prefilter_mem+c*COMBFILTER_MAXPERIOD, prefilter_mem+c*COMBFILTER_MAXPERIOD+N, COMBFILTER_MAXPERIOD-N);
- OPUS_COPY(prefilter_mem+c*COMBFILTER_MAXPERIOD+COMBFILTER_MAXPERIOD-N, pre[c]+COMBFILTER_MAXPERIOD, N);
+ OPUS_MOVE(prefilter_mem+c*max_period, prefilter_mem+c*max_period+N, max_period-N);
+ OPUS_COPY(prefilter_mem+c*max_period+max_period-N, pre[c]+max_period, N);
}
} while (++c<CC);
@@ -1534,7 +1597,7 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
int constrained_vbr, opus_val16 stereo_saving, int tot_boost,
opus_val16 tf_estimate, int pitch_change, celt_glog maxDepth,
int lfe, int has_surround_mask, celt_glog surround_masking,
- celt_glog temporal_vbr)
+ celt_glog temporal_vbr ARG_QEXT(int enable_qext))
{
/* The target rate in 8th bits per frame */
opus_int32 target;
@@ -1611,6 +1674,9 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
opus_int32 floor_depth;
int bins;
bins = eBands[nbEBands-2]<<LM;
+#ifdef ENABLE_QEXT
+ if (enable_qext) bins = mode->shortMdctSize<<LM;
+#endif
/*floor_depth = SHR32(MULT16_16((C*bins<<BITRES),celt_log2(SHL32(MAX16(1,sample_max),13))), DB_SHIFT);*/
floor_depth = (opus_int32)SHR32(MULT16_32_Q15((C*bins<<BITRES),maxDepth), DB_SHIFT-15);
floor_depth = IMAX(floor_depth, target>>2);
@@ -1640,6 +1706,13 @@ static int compute_vbr(const CELTMode *mode, AnalysisInfo *analysis, opus_int32
return target;
}
+#ifdef ENABLE_QEXT
+static void encode_qext_stereo_params(ec_enc *ec, int qext_end, int qext_intensity, int qext_dual_stereo) {
+ ec_enc_uint(ec, qext_intensity, qext_end+1);
+ if (qext_intensity != 0) ec_enc_bit_logp(ec, qext_dual_stereo, 1);
+}
+#endif
+
int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc)
{
int i, c, N;
@@ -1670,6 +1743,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
int LM, M;
int tf_select;
int nbFilledBytes, nbAvailableBytes;
+ opus_int32 min_allowed;
int start;
int end;
int effEnd;
@@ -1714,6 +1788,27 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
opus_val16 tone_freq=-1;
opus_val32 toneishness=0;
VARDECL(celt_glog, surround_dynalloc);
+ int qext_bytes=0;
+ int packet_size_cap = 1275;
+#ifdef ENABLE_QEXT
+ int qext_scale;
+ int qext_end=0;
+ int qext_intensity=0;
+ int qext_dual_stereo=0;
+ int padding_len_bytes=0;
+ unsigned char *ext_payload;
+ opus_int32 qext_bits;
+ ec_enc ext_enc;
+ VARDECL(int, extra_quant);
+ VARDECL(int, extra_pulses);
+ VARDECL(celt_glog, error_bak);
+ const CELTMode *qext_mode = NULL;
+ CELTMode qext_mode_struct;
+ celt_ener qext_bandE[2*NB_QEXT_BANDS];
+ celt_glog qext_bandLogE[2*NB_QEXT_BANDS];
+ celt_glog *qext_oldBandE=NULL;
+ celt_glog qext_error[2*NB_QEXT_BANDS];
+#endif
ALLOC_STACK;
mode = st->mode;
@@ -1742,8 +1837,13 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
M=1<<LM;
N = M*mode->shortMdctSize;
+#ifdef ENABLE_QEXT
+ qext_scale = st->qext_scale;
+ if (st->enable_qext) packet_size_cap = QEXT_PACKET_SIZE_CAP;
+#endif
+
prefilter_mem = st->in_mem+CC*(overlap);
- oldBandE = (celt_glog*)(st->in_mem+CC*(overlap+COMBFILTER_MAXPERIOD));
+ oldBandE = (celt_glog*)(st->in_mem+CC*(overlap+QEXT_SCALE(COMBFILTER_MAXPERIOD)));
oldLogE = oldBandE + CC*nbEBands;
oldLogE2 = oldLogE + CC*nbEBands;
energyError = oldLogE2 + CC*nbEBands;
@@ -1758,7 +1858,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
nbFilledBytes=(tell+4)>>3;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
if (st->signalling && enc==NULL)
{
int tmp = (mode->effEBands-end)>>1;
@@ -1767,7 +1867,9 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
compressed[0] |= LM<<3;
compressed[0] |= (C==2)<<2;
/* Convert "standard mode" to Opus header */
+# ifndef ENABLE_QEXT
if (mode->Fs==48000 && mode->shortMdctSize==120)
+# endif
{
int c0 = toOpus(compressed[0]);
if (c0<0)
@@ -1784,14 +1886,14 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
celt_assert(st->signalling==0);
#endif
- /* Can't produce more than 1275 output bytes */
- nbCompressedBytes = IMIN(nbCompressedBytes,1275);
+ /* Can't produce more than 1275 output bytes for the main payload, plus any QEXT extra data. */
+ nbCompressedBytes = IMIN(nbCompressedBytes,packet_size_cap);
if (st->vbr && st->bitrate!=OPUS_BITRATE_MAX)
{
- opus_int32 den=mode->Fs>>BITRES;
- vbr_rate=(st->bitrate*frame_size+(den>>1))/den;
-#ifdef CUSTOM_MODES
+ opus_int32 den=mode->Fs>>(BITRES+2);
+ vbr_rate=((st->bitrate*(frame_size>>2))+(den>>1))/den;
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
if (st->signalling)
vbr_rate -= 8<<BITRES;
#endif
@@ -1882,6 +1984,14 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
nbAvailableBytes=2;
ec_enc_shrink(enc, nbCompressedBytes);
}
+#ifdef ENABLE_QEXT
+ else if (st->enable_qext) {
+ nbCompressedBytes = IMIN(nbCompressedBytes, 1275);
+ nbAvailableBytes = nbCompressedBytes - nbFilledBytes;
+ total_bits = nbCompressedBytes*8;
+ ec_enc_shrink(enc, nbCompressedBytes);
+ }
+#endif
/* Pretend we've filled all the remaining bits with zeros
(that's what the initialiser did anyway) */
tell = nbCompressedBytes*8;
@@ -1894,7 +2004,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
#endif
celt_preemphasis(pcm+c, in+c*(N+overlap)+overlap, N, CC, st->upsample,
mode->preemph, st->preemph_memE+c, need_clip);
- OPUS_COPY(in+c*(N+overlap), &prefilter_mem[(1+c)*COMBFILTER_MAXPERIOD-overlap], overlap);
+ OPUS_COPY(in+c*(N+overlap), &prefilter_mem[(1+c)*QEXT_SCALE(COMBFILTER_MAXPERIOD)-overlap], overlap);
} while (++c<CC);
@@ -1910,15 +2020,15 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
isTransient = transient_analysis(in, N+overlap, CC,
&tf_estimate, &tf_chan, allow_weak_transients, &weak_transient, tone_freq, toneishness);
}
+ toneishness = MIN32(toneishness, QCONST32(1.f, 29)-SHL32(tf_estimate, 15));
/* Find pitch period and gain */
{
int enabled;
int qg;
- enabled = ((st->lfe&&nbAvailableBytes>3) || nbAvailableBytes>12*C) && !hybrid && !silence && tell+16<=total_bits && !st->disable_pf
- && st->complexity >= 5;
+ enabled = ((st->lfe&&nbAvailableBytes>3) || nbAvailableBytes>12*C) && !hybrid && !silence && tell+16<=total_bits && !st->disable_pf;
prefilter_tapset = st->tapset_decision;
- pf_on = run_prefilter(st, in, prefilter_mem, CC, N, prefilter_tapset, &pitch_index, &gain1, &qg, enabled, tf_estimate, nbAvailableBytes, &st->analysis, tone_freq, toneishness);
+ pf_on = run_prefilter(st, in, prefilter_mem, CC, N, prefilter_tapset, &pitch_index, &gain1, &qg, enabled, st->complexity, tf_estimate, nbAvailableBytes, &st->analysis, tone_freq, toneishness ARG_QEXT(qext_scale));
if ((gain1 > QCONST16(.4f,15) || st->prefilter_gain > QCONST16(.4f,15)) && (!st->analysis.valid || st->analysis.tonality > .3)
&& (pitch_index > 1.26*st->prefilter_period || pitch_index < .79*st->prefilter_period))
pitch_change = 1;
@@ -2127,7 +2237,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
maxDepth = dynalloc_analysis(bandLogE, bandLogE2, oldBandE, nbEBands, start, end, C, offsets,
st->lsb_depth, mode->logN, isTransient, st->vbr, st->constrained_vbr,
- eBands, LM, effectiveBytes, &tot_boost, st->lfe, surround_dynalloc, &st->analysis, importance, spread_weight, tone_freq, toneishness);
+ eBands, LM, effectiveBytes, &tot_boost, st->lfe, surround_dynalloc, &st->analysis, importance, spread_weight, tone_freq, toneishness ARG_QEXT(qext_scale));
ALLOC(tf_res, nbEBands, int);
/* Disable variable tf resolution for hybrid and at very low bitrate */
@@ -2301,6 +2411,16 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
tell = ec_tell_frac(enc);
}
+ /* In VBR mode the frame size must not be reduced so much that it would
+ result in the encoder running out of bits.
+ The margin of 2 bytes ensures that none of the bust-prevention logic
+ in the decoder will have triggered so far. */
+ min_allowed = ((tell+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3)) + 2;
+ /* Take into account the 37 bits we need to have left in the packet to
+ signal a redundant frame in hybrid mode. Creating a shorter packet would
+ create an entropy coder desync. */
+ if (hybrid)
+ min_allowed = IMAX(min_allowed, (tell0_frac+(37<<BITRES)+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3));
/* Variable bitrate */
if (vbr_rate>0)
{
@@ -2308,12 +2428,11 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
opus_int32 delta;
/* The target rate in 8th bits per frame */
opus_int32 target, base_target;
- opus_int32 min_allowed;
int lm_diff = mode->maxLM - LM;
/* Don't attempt to use more than 510 kb/s, even for frames smaller than 20 ms.
The CELT allocator will just not be able to use more than that anyway. */
- nbCompressedBytes = IMIN(nbCompressedBytes,1275>>(3-LM));
+ nbCompressedBytes = IMIN(nbCompressedBytes,packet_size_cap>>(3-LM));
if (!hybrid)
{
base_target = vbr_rate - ((40*C+20)<<BITRES);
@@ -2330,7 +2449,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
st->lastCodedBands, C, st->intensity, st->constrained_vbr,
st->stereo_saving, tot_boost, tf_estimate, pitch_change, maxDepth,
st->lfe, st->energy_mask!=NULL, surround_masking,
- temporal_vbr);
+ temporal_vbr ARG_QEXT(st->enable_qext));
} else {
target = base_target;
/* Tonal frames (offset<100) need more bits than noisy (offset>100) ones. */
@@ -2347,16 +2466,6 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
/* The current offset is removed from the target and the space used
so far is added*/
target=target+tell;
- /* In VBR mode the frame size must not be reduced so much that it would
- result in the encoder running out of bits.
- The margin of 2 bytes ensures that none of the bust-prevention logic
- in the decoder will have triggered so far. */
- min_allowed = ((tell+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3)) + 2;
- /* Take into account the 37 bits we need to have left in the packet to
- signal a redundant frame in hybrid mode. Creating a shorter packet would
- create an entropy coder desync. */
- if (hybrid)
- min_allowed = IMAX(min_allowed, (tell0_frac+(37<<BITRES)+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3));
nbAvailableBytes = (target+(1<<(BITRES+2)))>>(BITRES+3);
nbAvailableBytes = IMAX(min_allowed,nbAvailableBytes);
@@ -2412,6 +2521,68 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
/* This moves the raw bits to take into account the new compressed size */
ec_enc_shrink(enc, nbCompressedBytes);
}
+#ifdef ENABLE_QEXT
+ if (st->enable_qext) {
+ int new_compressedBytes;
+ /* Don't give any bits for the first 80 kb/s per channel. Then 80% of the excess. */
+ opus_int32 offset = C*80000*frame_size/mode->Fs/8;
+ qext_bytes = IMAX(nbCompressedBytes-1275, IMAX(0, (nbCompressedBytes-offset)*4/5));
+ if (qext_bytes > 20) {
+ opus_int32 target;
+ opus_val16 scale;
+ target = ((nbCompressedBytes-qext_bytes/3)*8<<BITRES);
+ if (!vbr_rate) {
+ opus_val16 tf_estimate2;
+ target -= ((40*C+20)<<BITRES);
+ tf_estimate2 = MIN32(QCONST16(1.f, 14), 2*EXTEND32(tf_estimate));
+ target = compute_vbr(mode, &st->analysis, target, LM, equiv_rate,
+ st->lastCodedBands, C, st->intensity, st->constrained_vbr,
+ st->stereo_saving, tot_boost, tf_estimate2, pitch_change, maxDepth,
+ st->lfe, st->energy_mask!=NULL, surround_masking,
+ temporal_vbr ARG_QEXT(st->enable_qext));
+ target += tell;
+ }
+ scale = PSHR32(toneishness,14);
+ scale = Q15ONE - MULT16_16_Q15(scale, scale);
+ qext_bytes += MULT16_32_Q15(scale, (nbCompressedBytes-(target/(8<<BITRES))) - qext_bytes);
+ qext_bytes = IMAX(nbCompressedBytes-1275, IMAX(21, qext_bytes));
+ }
+ padding_len_bytes = (qext_bytes+253)/254;
+ qext_bytes = IMIN(qext_bytes, nbCompressedBytes-min_allowed-padding_len_bytes-1);
+ padding_len_bytes = (qext_bytes+253)/254;
+ if (qext_bytes > 20) {
+ new_compressedBytes = nbCompressedBytes-qext_bytes-padding_len_bytes-1;
+ ec_enc_shrink(enc, new_compressedBytes);
+ if (compressed == NULL) {
+ compressed = enc->buf;
+ }
+ compressed[-1] |= 0x03; /* Code 3 packet */
+ enc->buf += 1+padding_len_bytes;
+ OPUS_MOVE(compressed+1+padding_len_bytes, compressed, new_compressedBytes);
+ compressed[0] = 0x41; /* Set padding */
+ for (i=0;i<padding_len_bytes-1;i++) compressed[i+1] = 255;
+ compressed[padding_len_bytes] = qext_bytes%254 == 0 ? 254 : qext_bytes%254;
+ ext_payload = compressed+padding_len_bytes+1+new_compressedBytes;
+ ext_payload[0] = QEXT_EXTENSION_ID<<1;
+ ext_payload += 1;
+ qext_bytes -= 1;
+ OPUS_CLEAR(ext_payload, qext_bytes);
+ ec_enc_init(&ext_enc, ext_payload, qext_bytes);
+ nbCompressedBytes = new_compressedBytes;
+ if (end == nbEBands && (mode->Fs == 48000 || mode->Fs == 96000) && (mode->shortMdctSize==120*qext_scale || mode->shortMdctSize==90*qext_scale)) {
+ compute_qext_mode(&qext_mode_struct, mode);
+ qext_mode = &qext_mode_struct;
+ qext_end = (qext_scale == 2) ? NB_QEXT_BANDS : 2;
+ ec_enc_bit_logp(&ext_enc, qext_end == NB_QEXT_BANDS, 1);
+ }
+ } else {
+ ec_enc_init(&ext_enc, NULL, 0);
+ qext_bytes = 0;
+ }
+ } else {
+ ec_enc_init(&ext_enc, NULL, 0);
+ }
+#endif
/* Bit allocation */
ALLOC(fine_quant, nbEBands, int);
@@ -2450,14 +2621,68 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
else
st->lastCodedBands = codedBands;
- quant_fine_energy(mode, start, end, oldBandE, error, fine_quant, enc, C);
+ quant_fine_energy(mode, start, end, oldBandE, error, NULL, fine_quant, enc, C);
+ OPUS_CLEAR(energyError, nbEBands*CC);
+#ifdef ENABLE_QEXT
+ if (qext_mode)
+ {
+ /* Don't bias for intra. */
+ opus_val32 qext_delayedIntra=0;
+ qext_oldBandE = energyError + CC*nbEBands;
+ compute_band_energies(qext_mode, freq, qext_bandE, qext_end, C, LM, st->arch);
+ normalise_bands(qext_mode, freq, X, qext_bandE, qext_end, C, M);
+ amp2Log2(qext_mode, qext_end, qext_end, qext_bandE, qext_bandLogE, C);
+ if (C==2) {
+ qext_intensity = qext_end;
+ qext_dual_stereo = dual_stereo;
+ encode_qext_stereo_params(&ext_enc, qext_end, qext_intensity, qext_dual_stereo);
+ }
+ quant_coarse_energy(qext_mode, 0, qext_end, qext_end, qext_bandLogE,
+ qext_oldBandE, qext_bytes*8, qext_error, &ext_enc,
+ C, LM, qext_bytes, st->force_intra,
+ &qext_delayedIntra, st->complexity >= 4, st->loss_rate, st->lfe);
+ }
+ ALLOC(extra_quant, nbEBands+NB_QEXT_BANDS, int);
+ ALLOC(extra_pulses, nbEBands+NB_QEXT_BANDS, int);
+ ALLOC(error_bak, C*nbEBands, celt_glog);
+
+ qext_bits = ((opus_int32)qext_bytes*8<<BITRES) - (opus_int32)ec_tell_frac(enc) - 1;
+ clt_compute_extra_allocation(mode, qext_mode, start, end, qext_end, bandLogE, qext_bandLogE,
+ qext_bits, extra_pulses, extra_quant, C, LM, &ext_enc, 1, tone_freq, toneishness);
+ OPUS_COPY(error_bak, error, C*nbEBands);
+ if (qext_bytes > 0) {
+ quant_fine_energy(mode, start, end, oldBandE, error, fine_quant, extra_quant, &ext_enc, C);
+ }
+#endif
/* Residual quantisation */
ALLOC(collapse_masks, C*nbEBands, unsigned char);
quant_all_bands(1, mode, start, end, X, C==2 ? X+N : NULL, collapse_masks,
bandE, pulses, shortBlocks, st->spread_decision,
dual_stereo, st->intensity, tf_res, nbCompressedBytes*(8<<BITRES)-anti_collapse_rsv,
- balance, enc, LM, codedBands, &st->rng, st->complexity, st->arch, st->disable_inv);
+ balance, enc, LM, codedBands, &st->rng, st->complexity, st->arch, st->disable_inv
+ ARG_QEXT(&ext_enc) ARG_QEXT(extra_pulses)
+ ARG_QEXT(qext_bytes*(8<<BITRES)) ARG_QEXT(cap));
+
+#ifdef ENABLE_QEXT
+ if (qext_mode) {
+ VARDECL(int, zeros);
+ VARDECL(unsigned char, qext_collapse_masks);
+ ec_enc dummy_enc;
+ int ext_balance;
+ ALLOC(zeros, nbEBands, int);
+ ALLOC(qext_collapse_masks, C*NB_QEXT_BANDS, unsigned char);
+ ec_enc_init(&dummy_enc, NULL, 0);
+ OPUS_CLEAR(zeros, end);
+ ext_balance = qext_bytes*(8<<BITRES) - ec_tell_frac(&ext_enc);
+ for (i=0;i<qext_end;i++) ext_balance -= extra_pulses[nbEBands+i] + C*(extra_quant[nbEBands+1]<<BITRES);
+ quant_fine_energy(qext_mode, 0, qext_end, qext_oldBandE, qext_error, NULL, &extra_quant[nbEBands], &ext_enc, C);
+ quant_all_bands(1, qext_mode, 0, qext_end, X, C==2 ? X+N : NULL, qext_collapse_masks,
+ qext_bandE, &extra_pulses[nbEBands], shortBlocks, st->spread_decision,
+ qext_dual_stereo, qext_intensity, zeros, qext_bytes*(8<<BITRES),
+ ext_balance, &ext_enc, LM, qext_end, &st->rng, st->complexity, st->arch, st->disable_inv, &dummy_enc, zeros, 0, NULL);
+ }
+#endif
if (anti_collapse_rsv > 0)
{
@@ -2467,8 +2692,8 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
#endif
ec_enc_bits(enc, anti_collapse_on, 1);
}
- quant_energy_finalise(mode, start, end, oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_tell(enc), enc, C);
- OPUS_CLEAR(energyError, nbEBands*CC);
+ if (qext_bytes == 0)
+ quant_energy_finalise(mode, start, end, oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_tell(enc), enc, C);
c=0;
do {
for (i=start;i<end;i++)
@@ -2476,7 +2701,10 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
energyError[i+c*nbEBands] = MAXG(-GCONST(0.5f), MING(GCONST(0.5f), error[i+c*nbEBands]));
}
} while (++c < C);
-
+#ifdef ENABLE_QEXT
+ if (qext_bytes > 0)
+ quant_energy_finalise(mode, start, end, NULL, error_bak, fine_quant, fine_priority, nbCompressedBytes*8-ec_tell(enc), enc, C);
+#endif
if (silence)
{
for (i=0;i<C*nbEBands;i++)
@@ -2495,15 +2723,15 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
}
c=0; do {
- OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, 2*MAX_PERIOD-N+overlap/2);
+ OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, QEXT_SCALE(DEC_PITCH_BUF_SIZE)-N+overlap/2);
} while (++c<CC);
c=0; do {
- out_mem[c] = st->syn_mem[c]+2*MAX_PERIOD-N;
+ out_mem[c] = st->syn_mem[c]+QEXT_SCALE(DEC_PITCH_BUF_SIZE)-N;
} while (++c<CC);
celt_synthesis(mode, X, out_mem, oldBandE, start, effEnd,
- C, CC, isTransient, LM, st->upsample, silence, st->arch);
+ C, CC, isTransient, LM, st->upsample, silence, st->arch ARG_QEXT(qext_mode) ARG_QEXT(qext_oldBandE) ARG_QEXT(qext_end));
c=0; do {
st->prefilter_period=IMAX(st->prefilter_period, COMBFILTER_MINPERIOD);
@@ -2573,8 +2801,15 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
/* If there's any room left (can only happen for very high rates),
it's already filled with zeros */
ec_enc_done(enc);
-
-#ifdef CUSTOM_MODES
+#ifdef ENABLE_QEXT
+ ec_enc_done(&ext_enc);
+ if (qext_bytes > 0)
+ nbCompressedBytes += padding_len_bytes+2+qext_bytes;
+ if (qext_bytes) st->rng = st->rng ^ ext_enc.rng;
+ if (ec_get_error(&ext_enc))
+ return OPUS_INTERNAL_ERROR;
+#endif
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
if (st->signalling)
nbCompressedBytes++;
#endif
@@ -2587,7 +2822,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_res * pcm, in
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
#if defined(FIXED_POINT) && !defined(ENABLE_RES24)
int opus_custom_encode(CELTEncoder * OPUS_RESTRICT st, const opus_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes)
@@ -2758,7 +2993,7 @@ int opus_custom_encoder_ctl(CELTEncoder * OPUS_RESTRICT st, int request, ...)
opus_int32 value = va_arg(ap, opus_int32);
if (value<=500 && value!=OPUS_BITRATE_MAX)
goto bad_arg;
- value = IMIN(value, 260000*st->channels);
+ value = IMIN(value, 750000*st->channels);
st->bitrate = value;
}
break;
@@ -2804,11 +3039,33 @@ int opus_custom_encoder_ctl(CELTEncoder * OPUS_RESTRICT st, int request, ...)
*value = st->disable_inv;
}
break;
+#ifdef ENABLE_QEXT
+ case OPUS_SET_QEXT_REQUEST:
+ {
+ opus_int32 value = va_arg(ap, opus_int32);
+ if(value<0 || value>1)
+ {
+ goto bad_arg;
+ }
+ st->enable_qext = value;
+ }
+ break;
+ case OPUS_GET_QEXT_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (!value)
+ {
+ goto bad_arg;
+ }
+ *value = st->enable_qext;
+ }
+ break;
+#endif
case OPUS_RESET_STATE:
{
int i;
celt_glog *oldBandE, *oldLogE, *oldLogE2;
- oldBandE = (celt_glog*)(st->in_mem+st->channels*(st->mode->overlap+COMBFILTER_MAXPERIOD));
+ oldBandE = (celt_glog*)(st->in_mem+st->channels*(st->mode->overlap+QEXT_SCALE2(COMBFILTER_MAXPERIOD, st->qext_scale)));
oldLogE = oldBandE + st->channels*st->mode->nbEBands;
oldLogE2 = oldLogE + st->channels*st->mode->nbEBands;
OPUS_CLEAR((char*)&st->ENCODER_RESET_START,
@@ -2824,7 +3081,7 @@ int opus_custom_encoder_ctl(CELTEncoder * OPUS_RESTRICT st, int request, ...)
st->tapset_decision = 0;
}
break;
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
case CELT_SET_INPUT_CLIPPING_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
diff --git a/media/libopus/celt/celt_lpc.c b/media/libopus/celt/celt_lpc.c
@@ -59,8 +59,15 @@ int p
for (i = 0; i < p; i++) {
/* Sum up this iteration's reflection coefficient */
opus_val32 rr = 0;
+#if defined (FIXED_POINT) && OPUS_FAST_INT64
+ opus_int64 acc = 0;
+ for (j = 0; j < i; j++)
+ acc += (opus_int64)(lpc[j]) * (opus_int64)(ac[i - j]);
+ rr = (opus_val32)SHR(acc, 31);
+#else
for (j = 0; j < i; j++)
rr += MULT32_32_Q31(lpc[j],ac[i - j]);
+#endif
rr += SHR32(ac[i + 1],6);
r = -frac_div32(SHL32(rr,6), error);
/* Update LPC coefficients and total error */
@@ -312,15 +319,18 @@ int _celt_autocorr(
#ifdef FIXED_POINT
{
opus_val32 ac0;
+ int ac0_shift = celt_ilog2(n + (n>>4));
ac0 = 1+(n<<7);
- if (n&1) ac0 += SHR32(MULT16_16(xptr[0],xptr[0]),9);
+ if (n&1) ac0 += SHR32(MULT16_16(xptr[0],xptr[0]),ac0_shift);
for(i=(n&1);i<n;i+=2)
{
- ac0 += SHR32(MULT16_16(xptr[i],xptr[i]),9);
- ac0 += SHR32(MULT16_16(xptr[i+1],xptr[i+1]),9);
+ ac0 += SHR32(MULT16_16(xptr[i],xptr[i]),ac0_shift);
+ ac0 += SHR32(MULT16_16(xptr[i+1],xptr[i+1]),ac0_shift);
}
+ /* Consider the effect of rounding-to-nearest when scaling the signal. */
+ ac0 += SHR32(ac0,7);
- shift = celt_ilog2(ac0)-30+10;
+ shift = celt_ilog2(ac0)-30+ac0_shift+1;
shift = (shift)/2;
if (shift>0)
{
diff --git a/media/libopus/celt/celt_lpc.h b/media/libopus/celt/celt_lpc.h
@@ -25,8 +25,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PLC_H
-#define PLC_H
+#ifndef CELT_LPC_H
+#define CELT_LPC_H
#include "arch.h"
#include "cpu_support.h"
@@ -63,4 +63,4 @@ void celt_iir(const opus_val32 *x,
int _celt_autocorr(const opus_val16 *x, opus_val32 *ac,
const celt_coef *window, int overlap, int lag, int n, int arch);
-#endif /* PLC_H */
+#endif /* CELT_LPC_H */
diff --git a/media/libopus/celt/cwrs.c b/media/libopus/celt/cwrs.c
@@ -36,7 +36,11 @@
#include "mathops.h"
#include "arch.h"
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_QEXT)
+#define CWRS_EXTRA_ROWS
+#endif
+
+#if defined(CUSTOM_MODES)
/*Guaranteed to return a conservatively large estimate of the binary logarithm
with frac bits of fractional precision.
@@ -207,7 +211,7 @@ int log2_frac(opus_uint32 val, int frac)
Otherwise, we can limit things to the set of N which can be achieved by
splitting a band from a standard Opus mode: 176, 144, 96, 88, 72, 64, 48,
44, 36, 32, 24, 22, 18, 16, 8, 4, 2).*/
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
static const opus_uint32 CELT_PVQ_U_DATA[1488]={
#else
static const opus_uint32 CELT_PVQ_U_DATA[1272]={
@@ -220,7 +224,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...208:*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
@@ -233,7 +237,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...208:*/
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1,
@@ -250,7 +254,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293,
295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323,
325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...208:*/
353, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 381,
383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405, 407, 409, 411,
@@ -272,7 +276,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
43513, 44105, 44701, 45301, 45905, 46513, 47125, 47741, 48361, 48985, 49613,
50245, 50881, 51521, 52165, 52813, 53465, 54121, 54781, 55445, 56113, 56785,
57461, 58141, 58825, 59513, 60205, 60901, 61601,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...208:*/
62305, 63013, 63725, 64441, 65161, 65885, 66613, 67345, 68081, 68821, 69565,
70313, 71065, 71821, 72581, 73345, 74113, 74885, 75661, 76441, 77225, 78013,
@@ -299,7 +303,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
5309433, 5410559, 5512961, 5616647, 5721625, 5827903, 5935489, 6044391,
6154617, 6266175, 6379073, 6493319, 6608921, 6725887, 6844225, 6963943,
7085049, 7207551,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...208:*/
7331457, 7456775, 7583513, 7711679, 7841281, 7972327, 8104825, 8238783,
8374209, 8511111, 8649497, 8789375, 8930753, 9073639, 9218041, 9363967,
@@ -331,7 +335,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
420810249, 431530241, 442453761, 453583369, 464921641, 476471169, 488234561,
500214441, 512413449, 524834241, 537479489, 550351881, 563454121, 576788929,
590359041, 604167209, 618216201, 632508801,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...208:*/
647047809, 661836041, 676876329, 692171521, 707724481, 723538089, 739615241,
755958849, 772571841, 789457161, 806617769, 824056641, 841776769, 859781161,
@@ -353,7 +357,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
1020274013, 1083597703, 1150027593, 1219676595, 1292660325, 1369097135,
1449108145, 1532817275, 1620351277, 1711839767, 1807415257, 1907213187,
2011371957, 2120032959,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...109:*/
2233340609U, 2351442379U, 2474488829U, 2602633639U, 2736033641U, 2874848851U,
3019242501U, 3169381071U, 3325434321U, 3487575323U, 3655980493U, 3830829623U,
@@ -367,7 +371,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
292164445, 340600625, 395555537, 457713341, 527810725, 606639529, 695049433,
793950709, 904317037, 1027188385, 1163673953, 1314955181, 1482288821,
1667010073, 1870535785, 2094367717,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...60:*/
2340095869U, 2609401873U, 2904062449U, 3225952925U, 3577050821U, 3959439497U,
#endif
@@ -377,7 +381,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
104692735, 139703809, 184327311, 240673265, 311207743, 398796225, 506750351,
638878193, 799538175, 993696769, 1226990095, 1505789553, 1837271615,
2229491905U,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...40:*/
2691463695U, 3233240945U, 3866006015U,
#endif
@@ -385,7 +389,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
265729, 598417, 1256465, 2485825, 4673345, 8405905, 14546705, 24331777,
39490049, 62390545, 96220561, 145198913, 214828609, 312193553, 446304145,
628496897, 872893441, 1196924561, 1621925137, 2173806145U,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...29:*/
2883810113U,
#endif
@@ -396,7 +400,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
/*N=11, K=11...19:*/
8097453, 18474633, 39753273, 81270333, 158819253, 298199265, 540279585,
948062325, 1616336765,
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
/*...20:*/
2684641785U,
#endif
@@ -409,7 +413,7 @@ static const opus_uint32 CELT_PVQ_U_DATA[1272]={
1409933619
};
-#if defined(CUSTOM_MODES)
+#if defined(CWRS_EXTRA_ROWS)
static const opus_uint32 *const CELT_PVQ_U_ROW[15]={
CELT_PVQ_U_DATA+ 0,CELT_PVQ_U_DATA+ 208,CELT_PVQ_U_DATA+ 415,
CELT_PVQ_U_DATA+ 621,CELT_PVQ_U_DATA+ 826,CELT_PVQ_U_DATA+1030,
@@ -666,7 +670,7 @@ static OPUS_INLINE opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_
return i;
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES)
void get_required_bits(opus_int16 *_bits,int _n,int _maxk,int _frac){
int k;
/*_maxk==0 => there's nothing to do.*/
diff --git a/media/libopus/celt/entenc.c b/media/libopus/celt/entenc.c
@@ -285,7 +285,7 @@ void ec_enc_done(ec_enc *_this){
}
/*Clear any excess space and add any remaining extra bits to the last byte.*/
if(!_this->error){
- OPUS_CLEAR(_this->buf+_this->offs,
+ if (_this->buf) OPUS_CLEAR(_this->buf+_this->offs,
_this->storage-_this->offs-_this->end_offs);
if(used>0){
/*If there's no range coder data at all, give up.*/
diff --git a/media/libopus/celt/fixed_generic.h b/media/libopus/celt/fixed_generic.h
@@ -95,7 +95,7 @@
/** Compile-time conversion of float constant to log gain value */
#define GCONST2(x,bits) ((celt_glog)(.5+(x)*(((celt_glog)1)<<(bits))))
-/** Compile-time conversion of float constant to DB_SHFIT log gain value */
+/** Compile-time conversion of float constant to DB_SHIFT log gain value */
#define GCONST(x) GCONST2((x),DB_SHIFT)
/** Negate a 16-bit value */
@@ -200,7 +200,7 @@
/** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */
#define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b)))
-#if defined(__mips_dsp) && __mips == 32
+#if defined(__mips)
#include "mips/fixed_generic_mipsr1.h"
#endif
diff --git a/media/libopus/celt/kiss_fft.c b/media/libopus/celt/kiss_fft.c
@@ -535,6 +535,7 @@ void opus_fft_free(const kiss_fft_state *cfg, int arch)
#endif /* CUSTOM_MODES */
#ifdef FIXED_POINT
+#ifndef OVERRIDE_fft_downshift
static void fft_downshift(kiss_fft_cpx *x, int N, int *total, int step) {
int shift;
shift = IMIN(step, *total);
@@ -553,6 +554,7 @@ static void fft_downshift(kiss_fft_cpx *x, int N, int *total, int step) {
}
}
}
+#endif /* OVERRIDE_fft_downshift */
#else
#define fft_downshift(x, N, total, step)
#endif
diff --git a/media/libopus/celt/mathops.c b/media/libopus/celt/mathops.c
@@ -122,6 +122,20 @@ opus_val16 celt_rsqrt_norm(opus_val32 x)
SUB16(MULT16_16_Q15(y, 12288), 16384))));
}
+/** Reciprocal sqrt approximation in the range [0.25,1) (Q31 in, Q29 out) */
+opus_val32 celt_rsqrt_norm32(opus_val32 x)
+{
+ opus_int32 tmp;
+ /* Use the first-order Newton-Raphson method to refine the root estimate.
+ * r = r * (1.5 - 0.5*x*r*r) */
+ opus_int32 r_q29 = SHL32(celt_rsqrt_norm(SHR32(x, 31-16)), 15);
+ /* Split evaluation in steps to avoid exploding macro expansion. */
+ tmp = MULT32_32_Q31(r_q29, r_q29);
+ tmp = MULT32_32_Q31(1073741824 /* Q31 */, tmp);
+ tmp = MULT32_32_Q31(x, tmp);
+ return SHL32(MULT32_32_Q31(r_q29, SUB32(201326592 /* Q27 */, tmp)), 4);
+}
+
/** Sqrt approximation (QX input, QX/2 output) */
opus_val32 celt_sqrt(opus_val32 x)
{
@@ -145,6 +159,23 @@ opus_val32 celt_sqrt(opus_val32 x)
return rt;
}
+/* Perform fixed-point arithmetic to approximate the square root. When the input
+ * is in Qx format, the output will be in Q(x/2 + 16) format. */
+opus_val32 celt_sqrt32(opus_val32 x)
+{
+ int k;
+ opus_int32 x_frac;
+ if (x==0)
+ return 0;
+ else if (x>=1073741824)
+ return 2147483647; /* 2^31 -1 */
+ k = (celt_ilog2(x)>>1);
+ x_frac = VSHR32(x, 2*(k-14)-1);
+ x_frac = MULT32_32_Q31(celt_rsqrt_norm32(x_frac), x_frac);
+ if (k < 12) return PSHR32(x_frac, 12-k);
+ else return SHL32(x_frac, k-12);
+}
+
#define L1 32767
#define L2 -7651
#define L3 8277
@@ -187,29 +218,82 @@ opus_val16 celt_cos_norm(opus_val32 x)
}
}
-/** Reciprocal approximation (Q15 input, Q16 output) */
-opus_val32 celt_rcp(opus_val32 x)
+/* Calculates the cosine of (PI*0.5*x) where the input x ranges from -1 to 1 and
+ * is in Q30 format. The output will also be in Q31 format. */
+opus_val32 celt_cos_norm32(opus_val32 x)
+{
+ static const opus_val32 COS_NORM_COEFF_A0 = 134217720; /* Q27 */
+ static const opus_val32 COS_NORM_COEFF_A1 = -662336704; /* Q29 */
+ static const opus_val32 COS_NORM_COEFF_A2 = 544710848; /* Q31 */
+ static const opus_val32 COS_NORM_COEFF_A3 = -178761936; /* Q33 */
+ static const opus_val32 COS_NORM_COEFF_A4 = 29487206; /* Q35 */
+ opus_int32 x_sq_q29, tmp;
+ /* The expected x is in the range of [-1.0f, 1.0f] */
+ celt_sig_assert((x >= -1073741824) && (x <= 1073741824));
+ /* Make cos(+/- pi/2) exactly zero. */
+ if (ABS32(x) == 1<<30) return 0;
+ x_sq_q29 = MULT32_32_Q31(x, x);
+ /* Split evaluation in steps to avoid exploding macro expansion. */
+ tmp = ADD32(COS_NORM_COEFF_A3, MULT32_32_Q31(x_sq_q29, COS_NORM_COEFF_A4));
+ tmp = ADD32(COS_NORM_COEFF_A2, MULT32_32_Q31(x_sq_q29, tmp));
+ tmp = ADD32(COS_NORM_COEFF_A1, MULT32_32_Q31(x_sq_q29, tmp));
+ return SHL32(ADD32(COS_NORM_COEFF_A0, MULT32_32_Q31(x_sq_q29, tmp)), 4);
+}
+
+/* Computes a 16 bit approximate reciprocal (1/x) for a normalized Q15 input,
+ * resulting in a Q15 output. */
+opus_val16 celt_rcp_norm16(opus_val16 x)
{
- int i;
- opus_val16 n;
opus_val16 r;
- celt_sig_assert(x>0);
- i = celt_ilog2(x);
- /* n is Q15 with range [0,1). */
- n = VSHR32(x,i-15)-32768;
/* Start with a linear approximation:
r = 1.8823529411764706-0.9411764705882353*n.
The coefficients and the result are Q14 in the range [15420,30840].*/
- r = ADD16(30840, MULT16_16_Q15(-15420, n));
+ r = ADD16(30840, MULT16_16_Q15(-15420, x));
/* Perform two Newton iterations:
- r -= r*((r*n)-1.Q15)
+ r -= r*((r*n)+(r-1.Q15))
= r*((r*n)+(r-1.Q15)). */
r = SUB16(r, MULT16_16_Q15(r,
- ADD16(MULT16_16_Q15(r, n), ADD16(r, -32768))));
+ ADD16(MULT16_16_Q15(r, x), ADD16(r, -32768))));
/* We subtract an extra 1 in the second iteration to avoid overflow; it also
neatly compensates for truncation error in the rest of the process. */
- r = SUB16(r, ADD16(1, MULT16_16_Q15(r,
- ADD16(MULT16_16_Q15(r, n), ADD16(r, -32768)))));
+ return SUB16(r, ADD16(1, MULT16_16_Q15(r,
+ ADD16(MULT16_16_Q15(r, x), ADD16(r, -32768)))));
+}
+
+/* Computes a 32 bit approximated reciprocal (1/x) for a normalized Q31 input,
+ * resulting in a Q30 output. The expected input range is [0.5f, 1.0f) in Q31
+ * and the expected output range is [1.0f, 2.0f) in Q30. */
+opus_val32 celt_rcp_norm32(opus_val32 x)
+{
+ opus_val32 r_q30;
+ celt_sig_assert(x >= 1073741824);
+ r_q30 = SHL32(EXTEND32(celt_rcp_norm16(SHR32(x, 15)-32768)), 16);
+ /* Solving f(y) = a - 1/y using the Newton Method
+ * Note: f(y)' = 1/y^2
+ * r = r - f(r)/f(r)' = r - (x * r*r - r)
+ * = r - r*(r*x - 1)
+ * where
+ * - r means 1/y's approximation.
+ * - x means a, the input of function.
+ * Please note that:
+ * - It adds 1 to avoid overflow
+ * - -1.0f in Q30 is -1073741824. */
+ return SUB32(r_q30, ADD32(SHL32(
+ MULT32_32_Q31(ADD32(MULT32_32_Q31(r_q30, x), -1073741824),
+ r_q30), 1), 1));
+}
+
+/** Reciprocal approximation (Q15 input, Q16 output) */
+opus_val32 celt_rcp(opus_val32 x)
+{
+ int i;
+ opus_val16 r;
+ celt_sig_assert(x>0);
+ i = celt_ilog2(x);
+
+ /* Compute the reciprocal of a Q15 number in the range [0, 1). */
+ r = celt_rcp_norm16(VSHR32(x,i-15)-32768);
+
/* r is now the Q15 solution to 2/(n+1), with a maximum relative error
of 7.05346E-5, a (relative) RMSE of 2.14418E-5, and a peak absolute
error of 1.24665/32768. */
diff --git a/media/libopus/celt/mathops.h b/media/libopus/celt/mathops.h
@@ -39,11 +39,12 @@
#include "entcode.h"
#include "os_support.h"
+
#if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
#include "arm/mathops_arm.h"
#endif
-#define PI 3.141592653f
+#define PI 3.1415926535897931
/* Multiplies two 16-bit fractional values. Bit-exactness of this macro is important */
#define FRAC_MUL16(a,b) ((16384+((opus_int32)(opus_int16)(a)*(opus_int16)(b)))>>15)
@@ -135,12 +136,97 @@ static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len)
#endif
#endif
+#ifndef FIXED_POINT
+/* Calculates the arctangent of x using a Remez approximation of order 15,
+ * incorporating only odd-powered terms. */
+static OPUS_INLINE float celt_atan_norm(float x)
+{
+ #define ATAN2_2_OVER_PI 0.636619772367581f
+ float x_sq = x * x;
+
+ /* Polynomial coefficients approximated in the [0, 1] range.
+ * Lolremez command: lolremez --degree 6 --range "0:1"
+ * "(atan(sqrt(x))-sqrt(x))/(x*sqrt(x))" "1/(sqrt(x)*x)"
+ * Please note that ATAN2_COEFF_A01 is fixed to 1.0f. */
+ #define ATAN2_COEFF_A03 -3.3331659436225891113281250000e-01f
+ #define ATAN2_COEFF_A05 1.99627041816711425781250000000e-01f
+ #define ATAN2_COEFF_A07 -1.3976582884788513183593750000e-01f
+ #define ATAN2_COEFF_A09 9.79423448443412780761718750000e-02f
+ #define ATAN2_COEFF_A11 -5.7773590087890625000000000000e-02f
+ #define ATAN2_COEFF_A13 2.30401363223791122436523437500e-02f
+ #define ATAN2_COEFF_A15 -4.3554059229791164398193359375e-03f
+ return ATAN2_2_OVER_PI * (x + x * x_sq * (ATAN2_COEFF_A03
+ + x_sq * (ATAN2_COEFF_A05
+ + x_sq * (ATAN2_COEFF_A07
+ + x_sq * (ATAN2_COEFF_A09
+ + x_sq * (ATAN2_COEFF_A11
+ + x_sq * (ATAN2_COEFF_A13
+ + x_sq * (ATAN2_COEFF_A15))))))));
+}
+
+/* Calculates the arctangent of y/x, returning an approximate value in radians.
+ * Please refer to the linked wiki page (https://en.wikipedia.org/wiki/Atan2)
+ * to learn how atan2 results are computed. */
+static OPUS_INLINE float celt_atan2p_norm(float y, float x)
+{
+ celt_sig_assert(x>=0 && y>=0);
+
+ /* For very small values, we don't care about the answer. */
+ if ((x*x + y*y) < 1e-18f)
+ {
+ return 0;
+ }
+
+ if (y < x)
+ {
+ return celt_atan_norm(y / x);
+ } else {
+ return 1.f - celt_atan_norm(x / y);
+ }
+}
+#endif
+
+#if !defined(FIXED_POINT) || defined(ENABLE_QEXT)
+/* Computes estimated cosine values for (PI/2 * x) using only terms with even
+ * exponents. */
+static OPUS_INLINE float celt_cos_norm2(float x)
+{
+ float x_norm_sq;
+ int output_sign;
+ /* Restrict x to [-1, 3]. */
+ x -= 4*floor(.25*(x+1));
+ /* Negative sign for [1, 3]. */
+ output_sign = 1 - 2*(x>1);
+ /* Restrict to [-1, 1]. */
+ x -= 2*(x>1);
+
+ /* The cosine function, cos(x), has a Taylor series representation consisting
+ * exclusively of even-powered polynomial terms. */
+ x_norm_sq = x * x;
+
+ /* Polynomial coefficients approximated in the [0, 1] range using only terms
+ * with even exponents.
+ * Lolremez command: lolremez --degree 4 --range 0:1 "cos(sqrt(x)*pi*0.5)" */
+ #define COS_COEFF_A0 9.999999403953552246093750000000e-01f
+ #define COS_COEFF_A2 -1.233698248863220214843750000000000f
+ #define COS_COEFF_A4 2.536507546901702880859375000000e-01f
+ #define COS_COEFF_A6 -2.08106283098459243774414062500e-02f
+ #define COS_COEFF_A8 8.581906440667808055877685546875e-04f
+ return output_sign * (COS_COEFF_A0 + x_norm_sq * (COS_COEFF_A2 +
+ x_norm_sq * (COS_COEFF_A4 +
+ x_norm_sq * (COS_COEFF_A6 +
+ x_norm_sq * (COS_COEFF_A8)))));
+}
+
+#endif
#ifndef FIXED_POINT
#define celt_sqrt(x) ((float)sqrt(x))
+#define celt_sqrt32(x) ((float)sqrt(x))
#define celt_rsqrt(x) (1.f/celt_sqrt(x))
#define celt_rsqrt_norm(x) (celt_rsqrt(x))
+#define celt_rsqrt_norm32(x) (celt_rsqrt(x))
#define celt_cos_norm(x) ((float)cos((.5f*PI)*(x)))
#define celt_rcp(x) (1.f/(x))
#define celt_div(a,b) ((a)/(b))
@@ -264,6 +350,10 @@ static OPUS_INLINE float celt_exp2(float x)
#define celt_exp2_db celt_exp2
#define celt_log2_db celt_log2
+#define celt_sin(x) celt_cos_norm2((0.5f*PI) * (x) - 1.0f)
+#define celt_log(x) (celt_log2(x) * 0.6931471805599453f)
+#define celt_exp(x) (celt_exp2((x) * 1.4426950408889634f))
+
#endif
#ifdef FIXED_POINT
@@ -288,10 +378,16 @@ static OPUS_INLINE opus_int16 celt_zlog2(opus_val32 x)
opus_val16 celt_rsqrt_norm(opus_val32 x);
+opus_val32 celt_rsqrt_norm32(opus_val32 x);
+
opus_val32 celt_sqrt(opus_val32 x);
+opus_val32 celt_sqrt32(opus_val32 x);
+
opus_val16 celt_cos_norm(opus_val32 x);
+opus_val32 celt_cos_norm32(opus_val32 x);
+
/** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */
static OPUS_INLINE opus_val16 celt_log2(opus_val32 x)
{
@@ -438,12 +534,75 @@ static OPUS_INLINE opus_val32 celt_exp2_db(opus_val32 x)
opus_val32 celt_rcp(opus_val32 x);
+opus_val32 celt_rcp_norm32(opus_val32 x);
#define celt_div(a,b) MULT32_32_Q31((opus_val32)(a),celt_rcp(b))
opus_val32 frac_div32_q29(opus_val32 a, opus_val32 b);
opus_val32 frac_div32(opus_val32 a, opus_val32 b);
+/* Computes atan(x) multiplied by 2/PI. The input value (x) should be within the
+ * range of -1 to 1 and represented in Q30 format. The function will return the
+ * result in Q30 format. */
+static OPUS_INLINE opus_val32 celt_atan_norm(opus_val32 x)
+{
+ /* Approximation constants. */
+ static const opus_int32 ATAN_2_OVER_PI = 1367130551; /* Q31 */
+ static const opus_int32 ATAN_COEFF_A03 = -715791936; /* Q31 */
+ static const opus_int32 ATAN_COEFF_A05 = 857391616; /* Q32 */
+ static const opus_int32 ATAN_COEFF_A07 = -1200579328; /* Q33 */
+ static const opus_int32 ATAN_COEFF_A09 = 1682636672; /* Q34 */
+ static const opus_int32 ATAN_COEFF_A11 = -1985085440; /* Q35 */
+ static const opus_int32 ATAN_COEFF_A13 = 1583306112; /* Q36 */
+ static const opus_int32 ATAN_COEFF_A15 = -598602432; /* Q37 */
+ opus_int32 x_sq_q30;
+ opus_int32 x_q31;
+ opus_int32 tmp;
+ /* The expected x is in the range of [-1.0f, 1.0f] */
+ celt_sig_assert((x <= 1073741824) && (x >= -1073741824));
+
+ /* If x = 1.0f, returns 0.5f */
+ if (x == 1073741824)
+ {
+ return 536870912; /* 0.5f (Q30) */
+ }
+ /* If x = 1.0f, returns 0.5f */
+ if (x == -1073741824)
+ {
+ return -536870912; /* -0.5f (Q30) */
+ }
+ x_q31 = SHL32(x, 1);
+ x_sq_q30 = MULT32_32_Q31(x_q31, x);
+ /* Split evaluation in steps to avoid exploding macro expansion. */
+ tmp = MULT32_32_Q31(x_sq_q30, ATAN_COEFF_A15);
+ tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A13, tmp));
+ tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A11, tmp));
+ tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A09, tmp));
+ tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A07, tmp));
+ tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A05, tmp));
+ tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A03, tmp));
+ tmp = ADD32(x, MULT32_32_Q31(x_q31, tmp));
+ return MULT32_32_Q31(ATAN_2_OVER_PI, tmp);
+}
+
+/* Calculates the arctangent of y/x, multiplies the result by 2/pi, and returns
+ * the value in Q30 format. Both input values (x and y) must be within the range
+ * of 0 to 1 and represented in Q30 format. Inputs must be zero or greater, and
+ * at least one input must be non-zero. */
+static OPUS_INLINE opus_val32 celt_atan2p_norm(opus_val32 y, opus_val32 x)
+{
+ celt_sig_assert(x>=0 && y>=0);
+ if (y==0 && x==0) {
+ return 0;
+ } else if (y < x) {
+ return celt_atan_norm(SHR32(frac_div32(y, x), 1));
+ } else {
+ celt_sig_assert(y > 0);
+ return 1073741824 /* 1.0f Q30 */ -
+ celt_atan_norm(SHR32(frac_div32(x, y), 1));
+ }
+}
+
#define M1 32767
#define M2 -21
#define M3 -11943
@@ -464,7 +623,9 @@ static OPUS_INLINE opus_val16 celt_atan01(opus_val16 x)
/* atan2() approximation valid for positive input values */
static OPUS_INLINE opus_val16 celt_atan2p(opus_val16 y, opus_val16 x)
{
- if (y < x)
+ if (x==0 && y==0) {
+ return 0;
+ } else if (y < x)
{
opus_val32 arg;
arg = celt_div(SHL32(EXTEND32(y),15),x);
diff --git a/media/libopus/celt/mdct.c b/media/libopus/celt/mdct.c
@@ -53,7 +53,7 @@
#include "mathops.h"
#include "stack_alloc.h"
-#if defined(FIXED_POINT) && defined(__mips_dsp) && __mips == 32
+#if defined(FIXED_POINT) && defined(__mips) && __mips == 32
#include "mips/mdct_mipsr1.h"
#endif
diff --git a/media/libopus/celt/mips/celt_mipsr1.h b/media/libopus/celt/mips/celt_mipsr1.h
@@ -36,6 +36,16 @@
#define CELT_C
+#if defined (__mips_dsp) && __mips == 32
+
+#define OVERRIDE_COMB_FILTER_CONST
+#define OVERRIDE_comb_filter
+#elif defined(__mips_isa_rev) && __mips_isa_rev < 6
+
+#define OVERRIDE_COMB_FILTER_CONST
+#define OVERRIDE_comb_filter
+#endif
+
#include "os_support.h"
#include "mdct.h"
#include <math.h>
@@ -53,8 +63,43 @@
#include "celt_lpc.h"
#include "vq.h"
-#define OVERRIDE_COMB_FILTER_CONST
-#define OVERRIDE_comb_filter
+#if defined (__mips_dsp) && __mips == 32
+
+#define MIPS_MULT __builtin_mips_mult
+#define MIPS_MADD __builtin_mips_madd
+#define MIPS_EXTR __builtin_mips_extr_w
+
+#elif defined(__mips_isa_rev) && __mips_isa_rev < 6
+
+static inline long long MIPS_MULT(int a, int b) {
+ long long acc;
+
+ asm volatile (
+ "mult %[a], %[b] \n"
+ : [acc] "=x"(acc)
+ : [a] "r"(a), [b] "r"(b)
+ :
+ );
+ return acc;
+}
+
+static inline long long MIPS_MADD(long long acc, int a, int b) {
+ asm volatile (
+ "madd %[a], %[b] \n"
+ : [acc] "+x"(acc)
+ : [a] "r"(a), [b] "r"(b)
+ :
+ );
+ return acc;
+}
+
+static inline opus_val32 MIPS_EXTR(long long acc, int shift) {
+ return (opus_val32)(acc >> shift);
+}
+
+#endif
+
+#if defined (OVERRIDE_comb_filter)
void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
opus_val16 g0, opus_val16 g1, int tapset0, int tapset1,
const opus_val16 *window, int overlap, int arch)
@@ -101,13 +146,13 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
f = MULT16_16_Q15(window[i],window[i]);
x0= x[i-T1+2];
- acc = __builtin_mips_mult((int)MULT16_16_Q15((Q15ONE-f),g00), (int)x[i-T0]);
- acc = __builtin_mips_madd(acc, (int)MULT16_16_Q15((Q15ONE-f),g01), (int)ADD32(x[i-T0-1],x[i-T0+1]));
- acc = __builtin_mips_madd(acc, (int)MULT16_16_Q15((Q15ONE-f),g02), (int)ADD32(x[i-T0-2],x[i-T0+2]));
- acc = __builtin_mips_madd(acc, (int)MULT16_16_Q15(f,g10), (int)x2);
- acc = __builtin_mips_madd(acc, (int)MULT16_16_Q15(f,g11), (int)ADD32(x3,x1));
- acc = __builtin_mips_madd(acc, (int)MULT16_16_Q15(f,g12), (int)ADD32(x4,x0));
- res = __builtin_mips_extr_w(acc, 15);
+ acc = MIPS_MULT((int)MULT16_16_Q15((Q15ONE-f),g00), (int)x[i-T0]);
+ acc = MIPS_MADD(acc, (int)MULT16_16_Q15((Q15ONE-f),g01), (int)ADD32(x[i-T0-1],x[i-T0+1]));
+ acc = MIPS_MADD(acc, (int)MULT16_16_Q15((Q15ONE-f),g02), (int)ADD32(x[i-T0-2],x[i-T0+2]));
+ acc = MIPS_MADD(acc, (int)MULT16_16_Q15(f,g10), (int)x2);
+ acc = MIPS_MADD(acc, (int)MULT16_16_Q15(f,g11), (int)ADD32(x3,x1));
+ acc = MIPS_MADD(acc, (int)MULT16_16_Q15(f,g12), (int)ADD32(x4,x0));
+ res = MIPS_EXTR(acc, 15);
y[i] = x[i] + res;
@@ -136,10 +181,10 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
long long acc;
x0=x[i-T1+2];
- acc = __builtin_mips_mult((int)g10, (int)x2);
- acc = __builtin_mips_madd(acc, (int)g11, (int)ADD32(x3,x1));
- acc = __builtin_mips_madd(acc, (int)g12, (int)ADD32(x4,x0));
- res = __builtin_mips_extr_w(acc, 15);
+ acc = MIPS_MULT((int)g10, (int)x2);
+ acc = MIPS_MADD(acc, (int)g11, (int)ADD32(x3,x1));
+ acc = MIPS_MADD(acc, (int)g12, (int)ADD32(x4,x0));
+ res = MIPS_EXTR(acc, 15);
y[i] = x[i] + res;
x4=x3;
@@ -148,5 +193,6 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N,
x1=x0;
}
}
+#endif /* OVERRIDE_comb_filter */
#endif /* CELT_MIPSR1_H__ */
diff --git a/media/libopus/celt/mips/fixed_generic_mipsr1.h b/media/libopus/celt/mips/fixed_generic_mipsr1.h
@@ -33,34 +33,10 @@
#ifndef CELT_FIXED_GENERIC_MIPSR1_H
#define CELT_FIXED_GENERIC_MIPSR1_H
-#undef MULT16_32_Q15_ADD
-static inline int MULT16_32_Q15_ADD(int a, int b, int c, int d) {
- long long acc = __builtin_mips_mult(a, b);
- acc = __builtin_mips_madd(acc, c, d);
- return __builtin_mips_extr_w(acc, 15);
-}
-
-#undef MULT16_32_Q15_SUB
-static inline int MULT16_32_Q15_SUB(int a, int b, int c, int d) {
- long long acc = __builtin_mips_mult(a, b);
- acc = __builtin_mips_msub(acc, c, d);
- return __builtin_mips_extr_w(acc, 15);
-}
-
-#undef MULT16_16_Q15_ADD
-static inline int MULT16_16_Q15_ADD(int a, int b, int c, int d) {
- long long acc = __builtin_mips_mult(a, b);
- acc = __builtin_mips_madd(acc, c, d);
- return __builtin_mips_extr_w(acc, 15);
-}
-
-#undef MULT16_16_Q15_SUB
-static inline int MULT16_16_Q15_SUB(int a, int b, int c, int d) {
- long long acc = __builtin_mips_mult(a, b);
- acc = __builtin_mips_msub(acc, c, d);
- return __builtin_mips_extr_w(acc, 15);
-}
+#if defined (__mips_dsp) && __mips == 32
+typedef short v2i16 __attribute__((vector_size(4)));
+typedef char v2i8 __attribute__((vector_size(4)));
#undef MULT16_32_Q16
static inline int MULT16_32_Q16(int a, int b)
@@ -103,4 +79,80 @@ static inline int MULT16_16_P15(int a, int b)
return __builtin_mips_shra_r_w(r, 15);
}
+#define OVERRIDE_CELT_MAXABS16
+static OPUS_INLINE opus_val32 celt_maxabs16(const opus_val16 *x, int len)
+{
+ int i;
+ v2i16 v2max = (v2i16){ 0, 0 };
+ v2i16 x01, x23;
+ const v2i16 *x2;
+ opus_val16 maxlo, maxhi;
+ int loops;
+
+ if ((long)x & 2 && len > 0) {
+ v2max = (v2i16){ 0, ABS16(*x) };
+ x++;
+ len--;
+ }
+ x2 = __builtin_assume_aligned(x, 4);
+ loops = len / 4;
+
+ for (i = 0; i < loops; i++)
+ {
+ x01 = *x2++;
+ x23 = *x2++;
+ x01 = __builtin_mips_absq_s_ph(x01);
+ x23 = __builtin_mips_absq_s_ph(x23);
+ __builtin_mips_cmp_lt_ph(v2max, x01);
+ v2max = __builtin_mips_pick_ph(x01, v2max);
+ __builtin_mips_cmp_lt_ph(v2max, x23);
+ v2max = __builtin_mips_pick_ph(x23, v2max);
+ }
+
+ switch (len & 3) {
+ case 3:
+ x01 = __builtin_mips_absq_s_ph(*x2);
+ __builtin_mips_cmp_lt_ph(v2max, x01);
+ v2max = __builtin_mips_pick_ph(x01, v2max);
+ maxlo = EXTRACT16((opus_val32)v2max);
+ maxhi = EXTRACT16((opus_val32)v2max >> 16);
+ maxlo = MAX16(MAX16(maxlo, maxhi), ABS16(x[len - 1]));
+ break;
+ case 2:
+ x01 = __builtin_mips_absq_s_ph(*x2);
+ __builtin_mips_cmp_lt_ph(v2max, x01);
+ v2max = __builtin_mips_pick_ph(x01, v2max);
+ maxlo = EXTRACT16((opus_val32)v2max);
+ maxhi = EXTRACT16((opus_val32)v2max >> 16);
+ maxlo = MAX16(maxlo, maxhi);
+ break;
+ case 1:
+ maxlo = EXTRACT16((opus_val32)v2max);
+ maxhi = EXTRACT16((opus_val32)v2max >> 16);
+ return MAX16(MAX16(maxlo, maxhi), ABS16(x[len - 1]));
+ break;
+ case 0:
+ maxlo = EXTRACT16((opus_val32)v2max);
+ maxhi = EXTRACT16((opus_val32)v2max >> 16);
+ maxlo = MAX16(maxlo, maxhi);
+ break;
+ default:
+ __builtin_unreachable();
+ }
+ /* C version might return 0x8000, this one can't
+ * because abs is saturated here. Since result
+ * used only for determine dynamic range
+ * in ilog2-like context it's worth to add 1
+ * for proper magnitude whether saturated
+ */
+ return (opus_val32)maxlo + 1;
+}
+
+#elif __mips == 32
+
+#undef MULT16_32_Q16
+#define MULT16_32_Q16(a,b) ((opus_val32)SHR((opus_int64)(SHL32((a), 16))*(b),32))
+
+#endif
+
#endif /* CELT_FIXED_GENERIC_MIPSR1_H */
diff --git a/media/libopus/celt/mips/kiss_fft_mipsr1.h b/media/libopus/celt/mips/kiss_fft_mipsr1.h
@@ -32,17 +32,14 @@
#ifdef FIXED_POINT
-#define S_MUL_ADD(a, b, c, d) (S_MUL(a,b)+S_MUL(c,d))
-#define S_MUL_SUB(a, b, c, d) (S_MUL(a,b)-S_MUL(c,d))
+#if __mips == 32 && defined (__mips_dsp)
-#undef S_MUL_ADD
static inline int S_MUL_ADD(int a, int b, int c, int d) {
long long acc = __builtin_mips_mult(a, b);
acc = __builtin_mips_madd(acc, c, d);
return __builtin_mips_extr_w(acc, 15);
}
-#undef S_MUL_SUB
static inline int S_MUL_SUB(int a, int b, int c, int d) {
long long acc = __builtin_mips_mult(a, b);
acc = __builtin_mips_msub(acc, c, d);
@@ -76,9 +73,66 @@ static inline kiss_fft_cpx C_MULC_fun(kiss_fft_cpx a, kiss_twiddle_cpx b) {
return m;
}
-#endif /* FIXED_POINT */
+#define OVERRIDE_kf_bfly5
+
+#elif __mips == 32 && defined(__mips_isa_rev) && __mips_isa_rev < 6
+
+static inline int S_MUL_ADD(int a, int b, int c, int d) {
+ long long acc;
+
+ asm volatile (
+ "mult %[a], %[b] \n"
+ "madd %[c], %[d] \n"
+ : [acc] "=x"(acc)
+ : [a] "r"(a), [b] "r"(b), [c] "r"(c), [d] "r"(d)
+ :
+ );
+ return (int)(acc >> 15);
+}
+
+static inline int S_MUL_SUB(int a, int b, int c, int d) {
+ long long acc;
+
+ asm volatile (
+ "mult %[a], %[b] \n"
+ "msub %[c], %[d] \n"
+ : [acc] "=x"(acc)
+ : [a] "r"(a), [b] "r"(b), [c] "r"(c), [d] "r"(d)
+ :
+ );
+ return (int)(acc >> 15);
+}
+
+#undef C_MUL
+# define C_MUL(m,a,b) (m=C_MUL_fun(a,b))
+static inline kiss_fft_cpx C_MUL_fun(kiss_fft_cpx a, kiss_twiddle_cpx b) {
+ kiss_fft_cpx m;
+
+ m.r = S_MUL_SUB(a.r, b.r, a.i, b.i);
+ m.i = S_MUL_ADD(a.r, b.i, a.i, b.r);
+
+ return m;
+}
+
+#undef C_MULC
+# define C_MULC(m,a,b) (m=C_MULC_fun(a,b))
+static inline kiss_fft_cpx C_MULC_fun(kiss_fft_cpx a, kiss_twiddle_cpx b) {
+ kiss_fft_cpx m;
+
+ m.r = S_MUL_ADD(a.r, b.r, a.i, b.i);
+ m.i = S_MUL_SUB(a.i, b.r, a.r, b.i);
+
+ return m;
+}
#define OVERRIDE_kf_bfly5
+
+#endif
+
+#endif /* FIXED_POINT */
+
+#if defined(OVERRIDE_kf_bfly5)
+
static void kf_bfly5(
kiss_fft_cpx * Fout,
const size_t fstride,
@@ -157,5 +211,61 @@ static void kf_bfly5(
}
}
+#endif /* defined(OVERRIDE_kf_bfly5) */
+
+#define OVERRIDE_fft_downshift
+/* Just unroll tight loop, should be ok for any mips */
+static void fft_downshift(kiss_fft_cpx *x, int N, int *total, int step) {
+ int shift;
+ shift = IMIN(step, *total);
+ *total -= shift;
+ if (shift == 1) {
+ int i;
+ for (i = 0; i < N - 1; i += 2) {
+ x[i].r = SHR32(x[i].r, 1);
+ x[i].i = SHR32(x[i].i, 1);
+ x[i+1].r = SHR32(x[i+1].r, 1);
+ x[i+1].i = SHR32(x[i+1].i, 1);
+ }
+ if (N & 1) {
+ x[i].r = SHR32(x[i].r, 1);
+ x[i].i = SHR32(x[i].i, 1);
+ }
+ } else if (shift > 0) {
+ int i;
+ for (i = 0; i < N - 3; i += 4) {
+ x[i].r = PSHR32(x[i].r, shift);
+ x[i].i = PSHR32(x[i].i, shift);
+ x[i+1].r = PSHR32(x[i+1].r, shift);
+ x[i+1].i = PSHR32(x[i+1].i, shift);
+ x[i+2].r = PSHR32(x[i+2].r, shift);
+ x[i+2].i = PSHR32(x[i+2].i, shift);
+ x[i+3].r = PSHR32(x[i+3].r, shift);
+ x[i+3].i = PSHR32(x[i+3].i, shift);
+ }
+ switch (N & 3) {
+ case 3:
+ x[i].r = PSHR32(x[i].r, shift);
+ x[i].i = PSHR32(x[i].i, shift);
+ x[i+1].r = PSHR32(x[i+1].r, shift);
+ x[i+1].i = PSHR32(x[i+1].i, shift);
+ x[i+2].r = PSHR32(x[i+2].r, shift);
+ x[i+2].i = PSHR32(x[i+2].i, shift);
+ break;
+ case 2:
+ x[i].r = PSHR32(x[i].r, shift);
+ x[i].i = PSHR32(x[i].i, shift);
+ x[i+1].r = PSHR32(x[i+1].r, shift);
+ x[i+1].i = PSHR32(x[i+1].i, shift);
+ break;
+ case 1:
+ x[i].r = PSHR32(x[i].r, shift);
+ x[i].i = PSHR32(x[i].i, shift);
+ break;
+ case 0:
+ break;
+ }
+ }
+}
#endif /* KISS_FFT_MIPSR1_H */
diff --git a/media/libopus/celt/mips/mdct_mipsr1.h b/media/libopus/celt/mips/mdct_mipsr1.h
@@ -55,6 +55,7 @@
#include "mathops.h"
#include "stack_alloc.h"
+#if defined (__mips_dsp)
static inline int S_MUL_ADD_PSR(int a, int b, int c, int d, int shift) {
long long acc = __builtin_mips_mult(a, b);
acc = __builtin_mips_madd(acc, c, d);
@@ -67,8 +68,45 @@ static inline int S_MUL_SUB_PSR(int a, int b, int c, int d, int shift) {
return __builtin_mips_extr_w(acc, 15+shift);
}
-/* Forward MDCT trashes the input array */
#define OVERRIDE_clt_mdct_forward
+#define OVERRIDE_clt_mdct_backward
+
+#elif defined(__mips_isa_rev) && __mips_isa_rev < 6
+
+static inline int S_MUL_ADD_PSR(int a, int b, int c, int d, int shift) {
+ long long acc;
+
+ asm volatile (
+ "mult %[a], %[b] \n"
+ "madd %[c], %[d] \n"
+ : [acc] "=x"(acc)
+ : [a] "r"(a), [b] "r"(b), [c] "r"(c), [d] "r"(d)
+ :
+ );
+ return (int)(acc >> (15 + shift));
+}
+
+static inline int S_MUL_SUB_PSR(int a, int b, int c, int d, int shift) {
+ long long acc;
+
+ asm volatile (
+ "mult %[a], %[b] \n"
+ "msub %[c], %[d] \n"
+ : [acc] "=x"(acc)
+ : [a] "r"(a), [b] "r"(b), [c] "r"(c), [d] "r"(d)
+ :
+ );
+ return (int)(acc >> (15 + shift));
+}
+
+#define OVERRIDE_clt_mdct_forward
+#define OVERRIDE_clt_mdct_backward
+
+#endif
+
+#if defined (OVERRIDE_clt_mdct_forward)
+
+/* Forward MDCT trashes the input array */
void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * OPUS_RESTRICT out,
const celt_coef *window, int overlap, int shift, int stride, int arch)
{
@@ -213,7 +251,10 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar
RESTORE_STACK;
}
-#define OVERRIDE_clt_mdct_backward
+#endif /* OVERRIDE_clt_mdct_forward */
+
+#if defined(OVERRIDE_clt_mdct_backward)
+
void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * OPUS_RESTRICT out,
const celt_coef * OPUS_RESTRICT window, int overlap, int shift, int stride, int arch)
{
@@ -336,4 +377,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
}
}
}
+
+#endif /* OVERRIDE_clt_mdct_backward */
+
#endif /* MDCT_MIPSR1_H__ */
diff --git a/media/libopus/celt/mips/pitch_mipsr1.h b/media/libopus/celt/mips/pitch_mipsr1.h
@@ -34,28 +34,223 @@
#ifndef PITCH_MIPSR1_H
#define PITCH_MIPSR1_H
+#include "fixed_generic_mipsr1.h"
+
+#if defined (__mips_dsp) && __mips == 32
+
+#define accumulator_t opus_int64
+#define MIPS_MAC(acc,a,b) \
+ __builtin_mips_madd((acc), (int)(a), (int)(b))
+
+#define MIPS_MAC16x16_2X(acc,a2x,b2x) \
+ __builtin_mips_dpaq_s_w_ph((acc), (a2x), (b2x))
+
+#define OVERRIDE_CELT_INNER_PROD
#define OVERRIDE_DUAL_INNER_PROD
+#define OVERRIDE_XCORR_KERNEL
+
+#else /* any other MIPS */
+
+/* using madd is slower due to single accumulator */
+#define accumulator_t opus_int32
+#define MIPS_MAC MAC16_16
+
+#define OVERRIDE_CELT_INNER_PROD
+#define OVERRIDE_DUAL_INNER_PROD
+#define OVERRIDE_XCORR_KERNEL
+
+#endif /* any other MIPS */
+
+
+#if defined(OVERRIDE_CELT_INNER_PROD)
+
+static OPUS_INLINE opus_val32 celt_inner_prod(const opus_val16 *x,
+ const opus_val16 *y, int N, int arch)
+{
+ int j;
+ accumulator_t acc = 0;
+
+#if defined (MIPS_MAC16x16_2X)
+ const v2i16 *x2x;
+ const v2i16 *y2x;
+ int loops;
+
+ /* misaligned */
+ if (((long)x | (long)y) & 3)
+ goto fallback;
+
+ x2x = __builtin_assume_aligned(x, 4);
+ y2x = __builtin_assume_aligned(y, 4);
+ loops = N / 8;
+ for (j = 0; j < loops; j++)
+ {
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[1], y2x[1]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[2], y2x[2]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[3], y2x[3]);
+ x2x += 4; y2x += 4;
+ }
+
+ switch (N & 7) {
+ case 7:
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[1], y2x[1]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[2], y2x[2]);
+ acc = MIPS_MAC(acc, x[N-1], y[N-1]);
+ break;
+ case 6:
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[1], y2x[1]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[2], y2x[2]);
+ break;
+ case 5:
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[1], y2x[1]);
+ acc = MIPS_MAC(acc, x[N-1], y[N-1]);
+ break;
+ case 4:
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ acc = MIPS_MAC16x16_2X(acc, x2x[1], y2x[1]);
+ break;
+ case 3:
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ acc = MIPS_MAC(acc, x[N-1], y[N-1]);
+ break;
+ case 2:
+ acc = MIPS_MAC16x16_2X(acc, x2x[0], y2x[0]);
+ break;
+ case 1:
+ acc = MIPS_MAC(acc, x[N-1], y[N-1]);
+ break;
+ case 0:
+ break;
+ }
+ return __builtin_mips_extr_w(acc, 1);
+
+fallback:
+#endif
+ for (j = 0; j < N - 3; j += 4)
+ {
+ acc = MIPS_MAC(acc, x[j], y[j]);
+ acc = MIPS_MAC(acc, x[j+1], y[j+1]);
+ acc = MIPS_MAC(acc, x[j+2], y[j+2]);
+ acc = MIPS_MAC(acc, x[j+3], y[j+3]);
+ }
+
+ switch (N & 3) {
+ case 3:
+ acc = MIPS_MAC(acc, x[j], y[j]);
+ acc = MIPS_MAC(acc, x[j+1], y[j+1]);
+ acc = MIPS_MAC(acc, x[j+2], y[j+2]);
+ break;
+ case 2:
+ acc = MIPS_MAC(acc, x[j], y[j]);
+ acc = MIPS_MAC(acc, x[j+1], y[j+1]);
+ break;
+ case 1:
+ acc = MIPS_MAC(acc, x[j], y[j]);
+ break;
+ case 0:
+ break;
+ }
+
+ (void)arch;
+
+ return (opus_val32)acc;
+}
+#endif /* OVERRIDE_CELT_INNER_PROD */
+
+#if defined(OVERRIDE_DUAL_INNER_PROD)
static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02,
int N, opus_val32 *xy1, opus_val32 *xy2, int arch)
{
int j;
- long long acc1 = 0;
- long long acc2 = 0;
+ accumulator_t acc1 = 0;
+ accumulator_t acc2 = 0;
- (void)arch;
+#if defined (MIPS_MAC16x16_2X)
+ const v2i16 *x2x;
+ const v2i16 *y01_2x;
+ const v2i16 *y02_2x;
+
+ /* misaligned */
+ if (((long)x | (long)y01 | (long)y02) & 3)
+ goto fallback;
+ x2x = __builtin_assume_aligned(x, 4);
+ y01_2x = __builtin_assume_aligned(y01, 4);
+ y02_2x = __builtin_assume_aligned(y02, 4);
+ N /= 2;
+
+ for (j = 0; j < N - 3; j += 4)
+ {
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j], y01_2x[j]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j], y02_2x[j]);
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j+1], y01_2x[j+1]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j+1], y02_2x[j+1]);
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j+2], y01_2x[j+2]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j+2], y02_2x[j+2]);
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j+3], y01_2x[j+3]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j+3], y02_2x[j+3]);
+ }
+
+ switch (N & 3) {
+ case 3:
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j], y01_2x[j]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j], y02_2x[j]);
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j+1], y01_2x[j+1]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j+1], y02_2x[j+1]);
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j+2], y01_2x[j+2]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j+2], y02_2x[j+2]);
+ break;
+ case 2:
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j], y01_2x[j]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j], y02_2x[j]);
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j+1], y01_2x[j+1]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j+1], y02_2x[j+1]);
+ break;
+ case 1:
+ acc1 = MIPS_MAC16x16_2X(acc1, x2x[j], y01_2x[j]);
+ acc2 = MIPS_MAC16x16_2X(acc2, x2x[j], y02_2x[j]);
+ break;
+ case 0:
+ break;
+ }
+
+ *xy1 = __builtin_mips_extr_w(acc1, 1);
+ *xy2 = __builtin_mips_extr_w(acc2, 1);
+ return;
+
+fallback:
+#endif
/* Compute the norm of X+Y and X-Y as |X|^2 + |Y|^2 +/- sum(xy) */
- for (j=0;j<N;j+=2)
+ for (j = 0; j < N - 3; j += 4)
{
- acc1 = __builtin_mips_madd(acc1, (int)x[j], (int)y01[j]);
- acc2 = __builtin_mips_madd(acc2, (int)x[j], (int)y02[j]);
- acc1 = __builtin_mips_madd(acc1, (int)x[j+1], (int)y01[j+1]);
- acc2 = __builtin_mips_madd(acc2, (int)x[j+1], (int)y02[j+1]);
+ acc1 = MIPS_MAC(acc1, x[j], y01[j]);
+ acc2 = MIPS_MAC(acc2, x[j], y02[j]);
+ acc1 = MIPS_MAC(acc1, x[j+1], y01[j+1]);
+ acc2 = MIPS_MAC(acc2, x[j+1], y02[j+1]);
+ acc1 = MIPS_MAC(acc1, x[j+2], y01[j+2]);
+ acc2 = MIPS_MAC(acc2, x[j+2], y02[j+2]);
+ acc1 = MIPS_MAC(acc1, x[j+3], y01[j+3]);
+ acc2 = MIPS_MAC(acc2, x[j+3], y02[j+3]);
+ }
+
+ if (j < N) {
+ acc1 = MIPS_MAC(acc1, x[j], y01[j]);
+ acc2 = MIPS_MAC(acc2, x[j], y02[j]);
+ acc1 = MIPS_MAC(acc1, x[j+1], y01[j+1]);
+ acc2 = MIPS_MAC(acc2, x[j+1], y02[j+1]);
}
+ (void)arch;
+
*xy1 = (opus_val32)acc1;
*xy2 = (opus_val32)acc2;
}
+#endif /* OVERRIDE_DUAL_INNER_PROD */
+
+#if defined(OVERRIDE_XCORR_KERNEL)
static inline void xcorr_kernel_mips(const opus_val16 * x,
const opus_val16 * y, opus_val32 sum[4], int len)
@@ -63,13 +258,12 @@ static inline void xcorr_kernel_mips(const opus_val16 * x,
int j;
opus_val16 y_0, y_1, y_2, y_3;
- opus_int64 sum_0, sum_1, sum_2, sum_3;
- sum_0 = (opus_int64)sum[0];
- sum_1 = (opus_int64)sum[1];
- sum_2 = (opus_int64)sum[2];
- sum_3 = (opus_int64)sum[3];
+ accumulator_t sum_0, sum_1, sum_2, sum_3;
+ sum_0 = (accumulator_t)sum[0];
+ sum_1 = (accumulator_t)sum[1];
+ sum_2 = (accumulator_t)sum[2];
+ sum_3 = (accumulator_t)sum[3];
- y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
y_0=*y++;
y_1=*y++;
y_2=*y++;
@@ -79,69 +273,73 @@ static inline void xcorr_kernel_mips(const opus_val16 * x,
tmp = *x++;
y_3=*y++;
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_0);
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_1);
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_2);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_3);
+ sum_0 = MIPS_MAC(sum_0, tmp, y_0);
+ sum_1 = MIPS_MAC(sum_1, tmp, y_1);
+ sum_2 = MIPS_MAC(sum_2, tmp, y_2);
+ sum_3 = MIPS_MAC(sum_3, tmp, y_3);
tmp=*x++;
y_0=*y++;
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_1 );
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_2 );
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_3);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_0);
+ sum_0 = MIPS_MAC(sum_0, tmp, y_1);
+ sum_1 = MIPS_MAC(sum_1, tmp, y_2);
+ sum_2 = MIPS_MAC(sum_2, tmp, y_3);
+ sum_3 = MIPS_MAC(sum_3, tmp, y_0);
tmp=*x++;
y_1=*y++;
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_2 );
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_3 );
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_0);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_1);
+ sum_0 = MIPS_MAC(sum_0, tmp, y_2);
+ sum_1 = MIPS_MAC(sum_1, tmp, y_3);
+ sum_2 = MIPS_MAC(sum_2, tmp, y_0);
+ sum_3 = MIPS_MAC(sum_3, tmp, y_1);
tmp=*x++;
y_2=*y++;
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_3 );
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_0 );
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_1);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_2);
-
- }
- if (j++<len)
- {
- opus_val16 tmp = *x++;
- y_3=*y++;
-
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_0 );
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_1 );
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_2);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_3);
+ sum_0 = MIPS_MAC(sum_0, tmp, y_3);
+ sum_1 = MIPS_MAC(sum_1, tmp, y_0);
+ sum_2 = MIPS_MAC(sum_2, tmp, y_1);
+ sum_3 = MIPS_MAC(sum_3, tmp, y_2);
}
- if (j++<len)
- {
- opus_val16 tmp=*x++;
- y_0=*y++;
-
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_1 );
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_2 );
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_3);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_0);
- }
+ switch (len & 3) {
+ case 3:
+ sum_0 = MIPS_MAC(sum_0, x[2], y_2);
+ sum_1 = MIPS_MAC(sum_1, x[2], y[0]);
+ sum_2 = MIPS_MAC(sum_2, x[2], y[1]);
+ sum_3 = MIPS_MAC(sum_3, x[2], y[2]);
- if (j<len)
- {
- opus_val16 tmp=*x++;
- y_1=*y++;
+ sum_0 = MIPS_MAC(sum_0, x[1], y_1);
+ sum_1 = MIPS_MAC(sum_1, x[1], y_2);
+ sum_2 = MIPS_MAC(sum_2, x[1], y[0]);
+ sum_3 = MIPS_MAC(sum_3, x[1], y[1]);
- sum_0 = __builtin_mips_madd( sum_0, tmp, y_2 );
- sum_1 = __builtin_mips_madd( sum_1, tmp, y_3 );
- sum_2 = __builtin_mips_madd( sum_2, tmp, y_0);
- sum_3 = __builtin_mips_madd( sum_3, tmp, y_1);
+ sum_0 = MIPS_MAC(sum_0, x[0], y_0);
+ sum_1 = MIPS_MAC(sum_1, x[0], y_1);
+ sum_2 = MIPS_MAC(sum_2, x[0], y_2);
+ sum_3 = MIPS_MAC(sum_3, x[0], y[0]);
+ break;
+ case 2:
+ sum_0 = MIPS_MAC(sum_0, x[1], y_1);
+ sum_1 = MIPS_MAC(sum_1, x[1], y_2);
+ sum_2 = MIPS_MAC(sum_2, x[1], y[0]);
+ sum_3 = MIPS_MAC(sum_3, x[1], y[1]);
+ sum_0 = MIPS_MAC(sum_0, x[0], y_0);
+ sum_1 = MIPS_MAC(sum_1, x[0], y_1);
+ sum_2 = MIPS_MAC(sum_2, x[0], y_2);
+ sum_3 = MIPS_MAC(sum_3, x[0], y[0]);
+ break;
+ case 1:
+ sum_0 = MIPS_MAC(sum_0, x[0], y_0);
+ sum_1 = MIPS_MAC(sum_1, x[0], y_1);
+ sum_2 = MIPS_MAC(sum_2, x[0], y_2);
+ sum_3 = MIPS_MAC(sum_3, x[0], y[0]);
+ break;
+ case 0:
+ break;
}
sum[0] = (opus_val32)sum_0;
@@ -150,8 +348,12 @@ static inline void xcorr_kernel_mips(const opus_val16 * x,
sum[3] = (opus_val32)sum_3;
}
-#define OVERRIDE_XCORR_KERNEL
#define xcorr_kernel(x, y, sum, len, arch) \
((void)(arch), xcorr_kernel_mips(x, y, sum, len))
+#undef accumulator_t
+#undef MIPS_MAC
+
+#endif /* OVERRIDE_XCORR_KERNEL */
+
#endif /* PITCH_MIPSR1_H */
diff --git a/media/libopus/celt/mips/vq_mipsr1.h b/media/libopus/celt/mips/vq_mipsr1.h
@@ -1,114 +0,0 @@
-/* Copyright (c) 2007-2008 CSIRO
- Copyright (c) 2007-2009 Xiph.Org Foundation
- Written by Jean-Marc Valin */
-/*
- 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
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VQ_MIPSR1_H__
-#define VQ_MIPSR1_H__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "mathops.h"
-#include "arch.h"
-
-#define OVERRIDE_vq_exp_rotation1
-static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s)
-{
- int i;
- opus_val16 ms;
- celt_norm *Xptr;
- Xptr = X;
- ms = NEG16(s);
- for (i=0;i<len-stride;i++)
- {
- celt_norm x1, x2;
- x1 = Xptr[0];
- x2 = Xptr[stride];
- Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2), s, x1), 15));
- *Xptr++ = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
- }
- Xptr = &X[len-2*stride-1];
- for (i=len-2*stride-1;i>=0;i--)
- {
- celt_norm x1, x2;
- x1 = Xptr[0];
- x2 = Xptr[stride];
- Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2), s, x1), 15));
- *Xptr-- = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
- }
-}
-
-#define OVERRIDE_renormalise_vector
-void renormalise_vector(celt_norm *X, int N, opus_val32 gain, int arch)
-{
- int i;
-#ifdef FIXED_POINT
- int k;
-#endif
- long long acc = EPSILON;
- opus_val32 E;
- opus_val16 g;
- opus_val32 t;
- celt_norm *xptr = X;
- int X0, X1;
-
- (void)arch;
-
- /*if(N %4)
- printf("error");*/
- for (i=0;i<N-2;i+=2)
- {
- X0 = (int)*xptr++;
- X1 = (int)*xptr++;
- acc = __builtin_mips_madd(acc, X0, X0);
- acc = __builtin_mips_madd(acc, X1, X1);
- }
-
- for (;i<N;i++)
- {
- X0 = (int)*xptr++;
- acc = __builtin_mips_madd(acc, X0, X0);
- }
-
- E = (opus_val32)acc;
-#ifdef FIXED_POINT
- k = celt_ilog2(E)>>1;
-#endif
- t = VSHR32(E, 2*(k-7));
- g = MULT32_32_Q31(celt_rsqrt_norm(t),gain);
-
- xptr = X;
- for (i=0;i<N;i++)
- {
- *xptr = EXTRACT16(PSHR32(MULT16_16(g, *xptr), k+1));
- xptr++;
- }
- /*return celt_sqrt(E);*/
-}
-
-#endif /* VQ_MIPSR1_H__ */
diff --git a/media/libopus/celt/modes.c b/media/libopus/celt/modes.c
@@ -71,7 +71,7 @@ static const unsigned char band_allocation[] = {
#endif /* CUSTOM_MODES_ONLY */
#ifndef M_PI
-#define M_PI 3.141592653
+#define M_PI 3.1415926535897931
#endif
#ifdef CUSTOM_MODES
@@ -272,7 +272,11 @@ CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error)
*error = OPUS_BAD_ARG;
return NULL;
}
+#ifdef ENABLE_QEXT
+ if (frame_size < 40 || frame_size > 2048 || frame_size%2!=0)
+#else
if (frame_size < 40 || frame_size > 1024 || frame_size%2!=0)
+#endif
{
if (error)
*error = OPUS_BAD_ARG;
@@ -316,6 +320,15 @@ CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error)
/* Pre/de-emphasis depends on sampling rate. The "standard" pre-emphasis
is defined as A(z) = 1 - 0.85*z^-1 at 48 kHz. Other rates should
approximate that. */
+#ifdef ENABLE_QEXT
+ if(Fs == 96000) /* 96 kHz */
+ {
+ mode->preemph[0] = QCONST16(0.9230041504f, 15);
+ mode->preemph[1] = QCONST16(0.2200012207f, 15);
+ mode->preemph[2] = QCONST16(1.5128347184f, SIG_SHIFT); /* exact 1/preemph[3] */
+ mode->preemph[3] = QCONST16(0.6610107422f, 13);
+ } else
+#endif
if(Fs < 12000) /* 8 kHz */
{
mode->preemph[0] = QCONST16(0.3500061035f, 15);
@@ -397,6 +410,15 @@ CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error)
mode->logN = logN;
compute_pulse_cache(mode, mode->maxLM);
+#ifdef ENABLE_QEXT
+ OPUS_CLEAR(&mode->qext_cache, 1);
+ if ( (mode->Fs == 48000 && (mode->shortMdctSize==120 || mode->shortMdctSize==90)) || (mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)) ) {
+ CELTMode dummy;
+ compute_qext_mode(&dummy, mode);
+ compute_pulse_cache(&dummy, dummy.maxLM);
+ OPUS_COPY(&mode->qext_cache, &dummy.cache, 1);
+ }
+#endif
if (clt_mdct_init(&mode->mdct, 2*mode->shortMdctSize*mode->nbShortMdcts,
mode->maxLM, arch) == 0)
@@ -415,7 +437,7 @@ failure:
#endif /* !CUSTOM_MODES */
}
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
void opus_custom_mode_destroy(CELTMode *mode)
{
int arch = opus_select_arch();
@@ -434,6 +456,12 @@ void opus_custom_mode_destroy(CELTMode *mode)
}
}
#endif /* CUSTOM_MODES_ONLY */
+#ifdef CUSTOM_MODES
+#ifdef ENABLE_QEXT
+ if (mode->qext_cache.index) opus_free((opus_int16*)mode->qext_cache.index);
+ if (mode->qext_cache.bits) opus_free((unsigned char*)mode->qext_cache.bits);
+ if (mode->qext_cache.caps) opus_free((unsigned char*)mode->qext_cache.caps);
+#endif
opus_free((opus_int16*)mode->eBands);
opus_free((unsigned char*)mode->allocVectors);
@@ -446,5 +474,46 @@ void opus_custom_mode_destroy(CELTMode *mode)
clt_mdct_clear(&mode->mdct, arch);
opus_free((CELTMode *)mode);
+#else
+ celt_assert(0);
+#endif
+}
+#endif
+
+#ifdef ENABLE_QEXT
+
+static const opus_int16 qext_eBands_180[] = {
+/* 20k 22k 24k 26k 28k 30k 32k 34k 36k 38k 40k 42k 44k 47k 48k */
+ 74, 82, 90, 98, 106, 114, 122, 130, 138, 146, 154, 162, 168, 174, 180
+};
+
+static const opus_int16 qext_logN_180[] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 21, 21, 21};
+
+/* Extra bands. */
+static const opus_int16 qext_eBands_240[] = {
+/* 20k 22k 24k 26k 28k 30k 32k 34k 36k 38k 40k 42k 44k 47k 48k */
+ 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240
+};
+
+static const opus_int16 qext_logN_240[] = {27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27};
+
+void compute_qext_mode(CELTMode *qext, const CELTMode *m)
+{
+ OPUS_COPY(qext, m, 1);
+ if (m->shortMdctSize*48000 == 120*m->Fs) {
+ qext->eBands = qext_eBands_240;
+ qext->logN = qext_logN_240;
+ } else if (m->shortMdctSize*48000 == 90*m->Fs) {
+ qext->eBands = qext_eBands_180;
+ qext->logN = qext_logN_180;
+ } else {
+ celt_assert(0);
+ }
+ qext->nbEBands = qext->effEBands = NB_QEXT_BANDS;
+ while (qext->eBands[qext->effEBands] > qext->shortMdctSize)
+ qext->effEBands--;
+ qext->nbAllocVectors = 0;
+ qext->allocVectors = NULL;
+ OPUS_COPY(&qext->cache, &m->qext_cache, 1);
}
#endif
diff --git a/media/libopus/celt/modes.h b/media/libopus/celt/modes.h
@@ -39,6 +39,8 @@
#define MAX_PERIOD 1024
+#define DEC_PITCH_BUF_SIZE 2048
+
typedef struct {
int size;
const opus_int16 *index;
@@ -69,7 +71,15 @@ struct OpusCustomMode {
const celt_coef *window;
mdct_lookup mdct;
PulseCache cache;
+#ifdef ENABLE_QEXT
+ PulseCache qext_cache;
+#endif
};
+#ifdef ENABLE_QEXT
+#define QEXT_PACKET_SIZE_CAP 3825
+#define NB_QEXT_BANDS 14
+void compute_qext_mode(CELTMode *qext, const CELTMode *m);
+#endif
#endif
diff --git a/media/libopus/celt/pitch.c b/media/libopus/celt/pitch.c
@@ -138,7 +138,7 @@ static void celt_fir5(opus_val16 *x,
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
- int len, int C, int arch)
+ int len, int C, int factor, int arch)
{
int i;
opus_val32 ac[5];
@@ -146,12 +146,17 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
opus_val16 lpc[4];
opus_val16 lpc2[5];
opus_val16 c1 = QCONST16(.8f,15);
+ int offset;
#ifdef FIXED_POINT
int shift;
- opus_val32 maxabs = celt_maxabs32(x[0], len);
+ opus_val32 maxabs;
+#endif
+ offset = factor/2;
+#ifdef FIXED_POINT
+ maxabs = celt_maxabs32(x[0], len*factor);
if (C==2)
{
- opus_val32 maxabs_1 = celt_maxabs32(x[1], len);
+ opus_val32 maxabs_1 = celt_maxabs32(x[1], len*factor);
maxabs = MAX32(maxabs, maxabs_1);
}
if (maxabs<1)
@@ -161,28 +166,28 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
shift=0;
if (C==2)
shift++;
- for (i=1;i<len>>1;i++)
- x_lp[i] = SHR32(x[0][(2*i-1)], shift+2) + SHR32(x[0][(2*i+1)], shift+2) + SHR32(x[0][2*i], shift+1);
- x_lp[0] = SHR32(x[0][1], shift+2) + SHR32(x[0][0], shift+1);
+ for (i=1;i<len;i++)
+ x_lp[i] = SHR32(x[0][(factor*i-offset)], shift+2) + SHR32(x[0][(factor*i+offset)], shift+2) + SHR32(x[0][factor*i], shift+1);
+ x_lp[0] = SHR32(x[0][offset], shift+2) + SHR32(x[0][0], shift+1);
if (C==2)
{
- for (i=1;i<len>>1;i++)
- x_lp[i] += SHR32(x[1][(2*i-1)], shift+2) + SHR32(x[1][(2*i+1)], shift+2) + SHR32(x[1][2*i], shift+1);
- x_lp[0] += SHR32(x[1][1], shift+2) + SHR32(x[1][0], shift+1);
+ for (i=1;i<len;i++)
+ x_lp[i] += SHR32(x[1][(factor*i-offset)], shift+2) + SHR32(x[1][(factor*i+offset)], shift+2) + SHR32(x[1][factor*i], shift+1);
+ x_lp[0] += SHR32(x[1][offset], shift+2) + SHR32(x[1][0], shift+1);
}
#else
- for (i=1;i<len>>1;i++)
- x_lp[i] = .25f*x[0][(2*i-1)] + .25f*x[0][(2*i+1)] + .5f*x[0][2*i];
- x_lp[0] = .25f*x[0][1] + .5f*x[0][0];
+ for (i=1;i<len;i++)
+ x_lp[i] = .25f*x[0][(factor*i-offset)] + .25f*x[0][(factor*i+offset)] + .5f*x[0][factor*i];
+ x_lp[0] = .25f*x[0][offset] + .5f*x[0][0];
if (C==2)
{
- for (i=1;i<len>>1;i++)
- x_lp[i] += .25f*x[1][(2*i-1)] + .25f*x[1][(2*i+1)] + .5f*x[1][2*i];
- x_lp[0] += .25f*x[1][1] + .5f*x[1][0];
+ for (i=1;i<len;i++)
+ x_lp[i] += .25f*x[1][(factor*i-offset)] + .25f*x[1][(factor*i+offset)] + .5f*x[1][factor*i];
+ x_lp[0] += .25f*x[1][offset] + .5f*x[1][0];
}
#endif
_celt_autocorr(x_lp, ac, NULL, 0,
- 4, len>>1, arch);
+ 4, len, arch);
/* Noise floor -40 dB */
#ifdef FIXED_POINT
@@ -213,7 +218,7 @@ void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x
lpc2[2] = lpc[2] + MULT16_16_Q15(c1,lpc[1]);
lpc2[3] = lpc[3] + MULT16_16_Q15(c1,lpc[2]);
lpc2[4] = MULT16_16_Q15(c1,lpc[3]);
- celt_fir5(x_lp, lpc2, len>>1);
+ celt_fir5(x_lp, lpc2, len);
}
/* Pure C implementation. */
@@ -334,7 +339,7 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
#ifdef FIXED_POINT
xmax = celt_maxabs16(x_lp4, len>>2);
ymax = celt_maxabs16(y_lp4, lag>>2);
- shift = celt_ilog2(MAX32(1, MAX32(xmax, ymax)))-11;
+ shift = celt_ilog2(MAX32(1, MAX32(xmax, ymax))) - 14 + celt_ilog2(len)/2;
if (shift>0)
{
for (j=0;j<len>>2;j++)
diff --git a/media/libopus/celt/pitch.h b/media/libopus/celt/pitch.h
@@ -42,7 +42,7 @@
#include "x86/pitch_sse.h"
#endif
-#if defined(FIXED_POINT) && defined(__mips_dsp) && __mips == 32
+#if defined(FIXED_POINT) && defined(__mips)
#include "mips/pitch_mipsr1.h"
#endif
@@ -51,7 +51,7 @@
#endif
void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
- int len, int C, int arch);
+ int len, int C, int factor, int arch);
void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTRICT y,
int len, int max_pitch, int *pitch, int arch);
diff --git a/media/libopus/celt/quant_bands.c b/media/libopus/celt/quant_bands.c
@@ -357,35 +357,39 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
RESTORE_STACK;
}
-void quant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, celt_glog *error, int *fine_quant, ec_enc *enc, int C)
+void quant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, celt_glog *error, int *prev_quant, int *extra_quant, ec_enc *enc, int C)
{
int i, c;
-
/* Encode finer resolution */
for (i=start;i<end;i++)
{
- opus_int16 frac = 1<<fine_quant[i];
- if (fine_quant[i] <= 0)
+ opus_int16 extra, prev;
+ extra = 1<<extra_quant[i];
+ if (extra_quant[i] <= 0)
continue;
+ if (ec_tell(enc)+C*extra_quant[i] > (opus_int32)enc->storage*8) continue;
+ prev = (prev_quant!=NULL) ? prev_quant[i] : 0;
c=0;
do {
int q2;
celt_glog offset;
#ifdef FIXED_POINT
/* Has to be without rounding */
- q2 = (error[i+c*m->nbEBands]+GCONST(.5f))>>(DB_SHIFT-fine_quant[i]);
+ q2 = VSHR32(ADD32(error[i+c*m->nbEBands], SHR32(GCONST(.5f), prev)), DB_SHIFT-extra_quant[i]-prev);
#else
- q2 = (int)floor((error[i+c*m->nbEBands]+.5f)*frac);
+ q2 = (int)floor((error[i+c*m->nbEBands]*(1<<prev)+.5f)*extra);
#endif
- if (q2 > frac-1)
- q2 = frac-1;
+ if (q2 > extra-1)
+ q2 = extra-1;
if (q2<0)
q2 = 0;
- ec_enc_bits(enc, q2, fine_quant[i]);
+ ec_enc_bits(enc, q2, extra_quant[i]);
#ifdef FIXED_POINT
- offset = SUB32(VSHR32(2*q2+1, fine_quant[i]-DB_SHIFT+1), GCONST(.5f));
+ offset = SUB32(VSHR32(2*q2+1, extra_quant[i]-DB_SHIFT+1), GCONST(.5f));
+ offset = SHR32(offset, prev);
#else
- offset = (q2+.5f)*(1<<(14-fine_quant[i]))*(1.f/16384) - .5f;
+ offset = (q2+.5f)*(1<<(14-extra_quant[i]))*(1.f/16384) - .5f;
+ offset *= (1<<(14-prev))*(1.f/16384);
#endif
oldEBands[i+c*m->nbEBands] += offset;
error[i+c*m->nbEBands] -= offset;
@@ -416,7 +420,7 @@ void quant_energy_finalise(const CELTMode *m, int start, int end, celt_glog *old
#else
offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384);
#endif
- oldEBands[i+c*m->nbEBands] += offset;
+ if (oldEBands != NULL) oldEBands[i+c*m->nbEBands] += offset;
error[i+c*m->nbEBands] -= offset;
bits_left--;
} while (++c < C);
@@ -489,23 +493,29 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_glog *old
}
}
-void unquant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, int *fine_quant, ec_dec *dec, int C)
+void unquant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, int *prev_quant, int *extra_quant, ec_dec *dec, int C)
{
int i, c;
/* Decode finer resolution */
for (i=start;i<end;i++)
{
- if (fine_quant[i] <= 0)
+ opus_int16 extra, prev;
+ extra = extra_quant[i];
+ if (extra_quant[i] <= 0)
continue;
+ if (ec_tell(dec)+C*extra_quant[i] > (opus_int32)dec->storage*8) continue;
+ prev = (prev_quant!=NULL) ? prev_quant[i] : 0;
c=0;
do {
int q2;
celt_glog offset;
- q2 = ec_dec_bits(dec, fine_quant[i]);
+ q2 = ec_dec_bits(dec, extra);
#ifdef FIXED_POINT
- offset = SUB32(VSHR32(2*q2+1, fine_quant[i]-DB_SHIFT+1), GCONST(.5f));
+ offset = SUB32(VSHR32(2*q2+1, extra-DB_SHIFT+1), GCONST(.5f));
+ offset = SHR32(offset, prev);
#else
- offset = (q2+.5f)*(1<<(14-fine_quant[i]))*(1.f/16384) - .5f;
+ offset = (q2+.5f)*(1<<(14-extra))*(1.f/16384) - .5f;
+ offset *= (1<<(14-prev))*(1.f/16384);
#endif
oldEBands[i+c*m->nbEBands] += offset;
} while (++c < C);
@@ -533,7 +543,7 @@ void unquant_energy_finalise(const CELTMode *m, int start, int end, celt_glog *o
#else
offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384);
#endif
- oldEBands[i+c*m->nbEBands] += offset;
+ if (oldEBands != NULL) oldEBands[i+c*m->nbEBands] += offset;
bits_left--;
} while (++c < C);
}
diff --git a/media/libopus/celt/quant_bands.h b/media/libopus/celt/quant_bands.h
@@ -53,13 +53,13 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
int nbAvailableBytes, int force_intra, opus_val32 *delayedIntra,
int two_pass, int loss_rate, int lfe);
-void quant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, celt_glog *error, int *fine_quant, ec_enc *enc, int C);
+void quant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, celt_glog *error, int *fine_quant, int *extra_quant, ec_enc *enc, int C);
void quant_energy_finalise(const CELTMode *m, int start, int end, celt_glog *oldEBands, celt_glog *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int C);
void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, int intra, ec_dec *dec, int C, int LM);
-void unquant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, int *fine_quant, ec_dec *dec, int C);
+void unquant_fine_energy(const CELTMode *m, int start, int end, celt_glog *oldEBands, int *fine_quant, int *extra_quant, ec_dec *dec, int C);
void unquant_energy_finalise(const CELTMode *m, int start, int end, celt_glog *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int C);
diff --git a/media/libopus/celt/rate.c b/media/libopus/celt/rate.c
@@ -38,6 +38,7 @@
#include "entcode.h"
#include "rate.h"
+#include "quant_bands.h"
static const unsigned char LOG2_FRAC_TABLE[24]={
0,
@@ -47,7 +48,7 @@ static const unsigned char LOG2_FRAC_TABLE[24]={
32,33,34,34,35,36,36,37,37
};
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES)
/*Determines if V(N,K) fits in a 32-bit unsigned integer.
N and K are themselves limited to 15 bits.*/
@@ -323,7 +324,7 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end,
In the first case, we'd be coding a bit to signal we're going to waste
all the other bits.
In the second case, we'd be coding a bit to redistribute all the bits
- we just signaled should be cocentrated in this band. */
+ we just signaled should be concentrated in this band. */
if (j<=skip_start)
{
/* Give the bit we reserved to end skipping back. */
@@ -643,3 +644,231 @@ int clt_compute_allocation(const CELTMode *m, int start, int end, const int *off
RESTORE_STACK;
return codedBands;
}
+#ifdef ENABLE_QEXT
+
+static const unsigned char last_zero[3] = {64, 50, 0};
+static const unsigned char last_cap[3] = {110, 60, 0};
+static const unsigned char last_other[4] = {120, 112, 70, 0};
+
+static void ec_enc_depth(ec_enc *enc, opus_int32 depth, opus_int32 cap, opus_int32 *last) {
+ int sym = 3;
+ if (depth==*last) sym = 2;
+ if (depth==cap) sym = 1;
+ if (depth==0) sym = 0;
+ if (*last == 0) {
+ ec_enc_icdf(enc, IMIN(sym, 2), last_zero, 7);
+ } else if (*last == cap) {
+ ec_enc_icdf(enc, IMIN(sym, 2), last_cap, 7);
+ } else {
+ ec_enc_icdf(enc, sym, last_other, 7);
+ }
+ /* We accept some redundancy if depth==last (for last different from 0 and cap). */
+ if (sym == 3) ec_enc_uint(enc, depth-1, cap);
+ *last = depth;
+}
+
+static int ec_dec_depth(ec_dec *dec, opus_int32 cap, opus_int32 *last) {
+ int depth, sym;
+ if (*last == 0) {
+ sym = ec_dec_icdf(dec, last_zero, 7);
+ if (sym==2) sym=3;
+ } else if (*last == cap) {
+ sym = ec_dec_icdf(dec, last_cap, 7);
+ if (sym==2) sym=3;
+ } else {
+ sym = ec_dec_icdf(dec, last_other, 7);
+ }
+ if (sym==0) depth=0;
+ else if (sym==1) depth=cap;
+ else if (sym==2) depth=*last;
+ else depth = 1 + ec_dec_uint(dec, cap);
+ *last = depth;
+ return depth;
+}
+
+#define MSWAP16(a,b) do {opus_val16 tmp = a;a=b;b=tmp;} while(0)
+static opus_val16 median_of_5_val16(const opus_val16 *x)
+{
+ opus_val16 t0, t1, t2, t3, t4;
+ t2 = x[2];
+ if (x[0] > x[1])
+ {
+ t0 = x[1];
+ t1 = x[0];
+ } else {
+ t0 = x[0];
+ t1 = x[1];
+ }
+ if (x[3] > x[4])
+ {
+ t3 = x[4];
+ t4 = x[3];
+ } else {
+ t3 = x[3];
+ t4 = x[4];
+ }
+ if (t0 > t3)
+ {
+ MSWAP16(t0, t3);
+ MSWAP16(t1, t4);
+ }
+ if (t2 > t1)
+ {
+ if (t1 < t3)
+ return MIN16(t2, t3);
+ else
+ return MIN16(t4, t1);
+ } else {
+ if (t2 < t3)
+ return MIN16(t1, t3);
+ else
+ return MIN16(t2, t4);
+ }
+}
+
+void clt_compute_extra_allocation(const CELTMode *m, const CELTMode *qext_mode, int start, int end, int qext_end, const celt_glog *bandLogE, const celt_glog *qext_bandLogE,
+ opus_int32 total, int *extra_pulses, int *extra_equant, int C, int LM, ec_ctx *ec, int encode, opus_val16 tone_freq, opus_val32 toneishness)
+{
+ int i;
+ opus_int32 last=0;
+ opus_val32 sum;
+ opus_val32 fill;
+ int iter;
+ int tot_bands;
+ int tot_samples;
+ VARDECL(int, depth);
+ VARDECL(opus_int32, cap);
+#ifdef FUZZING
+ float depth_std;
+#endif
+ SAVE_STACK;
+#ifdef FUZZING
+ depth_std = -10.f*log(1e-8+(float)rand()/RAND_MAX);
+ depth_std = FMAX(0, FMIN(48, depth_std));
+#endif
+ if (qext_mode != NULL) {
+ celt_assert(end==m->nbEBands);
+ tot_bands = end + qext_end;
+ tot_samples = qext_mode->eBands[qext_end]*C<<LM;
+ } else {
+ tot_bands = end;
+ tot_samples = (m->eBands[end]-m->eBands[start])*C<<LM;
+ }
+ ALLOC(cap, tot_bands, opus_int32);
+ for (i=start;i<end;i++) cap[i] = 12;
+ if (qext_mode != NULL) {
+ for (i=0;i<qext_end;i++) cap[end+i] = 14;
+ }
+ if (total <= 0) {
+ for (i=start;i<m->nbEBands+qext_end;i++) {
+ extra_pulses[i] = extra_equant[i] = 0;
+ }
+ return;
+ }
+ ALLOC(depth, tot_bands, int);
+ if (encode) {
+ VARDECL(opus_val16, flatE);
+ VARDECL(int, Ncoef);
+ VARDECL(opus_val16, min);
+ VARDECL(opus_val16, follower);
+
+ ALLOC(flatE, tot_bands, opus_val16);
+ ALLOC(min, tot_bands, opus_val16);
+ ALLOC(Ncoef, tot_bands, int);
+ for (i=start;i<end;i++) {
+ Ncoef[i] = (m->eBands[i+1]-m->eBands[i])*C<<LM;
+ }
+ /* Remove the effect of band width, eMeans and pre-emphasis to compute the real (flat) spectrum. */
+ for (i=start;i<end;i++) {
+ flatE[i] = PSHR32(bandLogE[i] - GCONST(0.0625f)*m->logN[i] + SHL32(eMeans[i],DB_SHIFT-4) - GCONST(.0062f)*(i+5)*(i+5), DB_SHIFT-10);
+ min[i] = 0;
+ }
+ if (C==2) {
+ for (i=start;i<end;i++) {
+ flatE[i] = MAXG(flatE[i], PSHR32(bandLogE[m->nbEBands+i] - GCONST(0.0625f)*m->logN[i] + SHL32(eMeans[i],DB_SHIFT-4) - GCONST(.0062f)*(i+5)*(i+5), DB_SHIFT-10));
+ }
+ }
+ flatE[end-1] += QCONST16(2.f, 10);
+ if (qext_mode != NULL) {
+ opus_val16 min_depth = 0;
+ /* If we have enough bits, give at least 1 bit of depth to all higher bands. */
+ if (total >= 3*C*(qext_mode->eBands[qext_end]-qext_mode->eBands[start])<<LM<<BITRES && (toneishness < QCONST32(.98f, 29) || tone_freq > 1.33f))
+ min_depth = QCONST16(1.f, 10);
+ for (i=0;i<qext_end;i++) {
+ Ncoef[end+i] = (qext_mode->eBands[i+1]-qext_mode->eBands[i])*C<<LM;
+ min[end+i] = min_depth;
+ }
+ for (i=0;i<qext_end;i++) {
+ flatE[end+i] = PSHR32(qext_bandLogE[i] - GCONST(0.0625f)*qext_mode->logN[i] + SHL32(eMeans[i],DB_SHIFT-4) - GCONST(.0062f)*(end+i+5)*(end+i+5), DB_SHIFT-10);
+ }
+ if (C==2) {
+ for (i=0;i<qext_end;i++) {
+ flatE[end+i] = MAXG(flatE[end+i], PSHR32(qext_bandLogE[NB_QEXT_BANDS+i] - GCONST(0.0625f)*qext_mode->logN[i] + SHL32(eMeans[i],DB_SHIFT-4) - GCONST(.0062f)*(end+i+5)*(end+i+5), DB_SHIFT-10));
+ }
+ }
+ }
+ ALLOC(follower, tot_bands, opus_val16);
+ for (i=start+2;i<tot_bands-2;i++) {
+ follower[i] = median_of_5_val16(&flatE[i-2]);
+ }
+ follower[start] = follower[start+1] = follower[start+2];
+ follower[tot_bands-1] = follower[tot_bands-2] = follower[tot_bands-3];
+ for (i=start+1;i<tot_bands;i++) {
+ follower[i] = MAX16(follower[i], follower[i-1]-QCONST16(1.f, 10));
+ }
+ for (i=tot_bands-2;i>=start;i--) {
+ follower[i] = MAX16(follower[i], follower[i+1]-QCONST16(1.f, 10));
+ }
+ for (i=start;i<tot_bands;i++) flatE[i] -= MULT16_16_Q15(Q15ONE-PSHR32(toneishness, 14), follower[i]);
+ if (qext_mode != NULL) {
+ for (i=0;i<qext_end;i++) flatE[end+i] = flatE[end+i] + QCONST16(3.f, 10) + QCONST16(.2f, 10)*i;
+ }
+ /* Approximate fill level assuming all bands contribute fully. */
+ sum = 0;
+ for (i=start;i<tot_bands;i++) {
+ sum += MULT16_16(Ncoef[i], flatE[i]);
+ }
+ total >>= BITRES;
+ fill = (SHL32(total, 10) + sum)/tot_samples;
+ /* Iteratively refine the fill level considering the depth min and cap. */
+ for (iter=0;iter<10;iter++) {
+ sum = 0;
+ for (i=start;i<tot_bands;i++)
+ sum += Ncoef[i] * MIN32(SHL32(cap[i], 10), MAX32(min[i], flatE[i]-fill));
+ fill -= (SHL32(total, 10) - sum)/tot_samples;
+ }
+ for (i=start;i<tot_bands;i++) {
+#ifdef FIXED_POINT
+ depth[i] = PSHR32(MIN32(SHL32(cap[i], 10), MAX32(min[i], flatE[i]-fill)), 10-2);
+#else
+ depth[i] = (int)floor(.5+4*MIN32(SHL32(cap[i], 10), MAX32(min[i], flatE[i]-fill)));
+#endif
+#ifdef FUZZING
+ depth[i] = (int)-depth_std*log(1e-8+(float)rand()/RAND_MAX);
+ depth[i] = IMAX(0, IMIN(cap[i]<<2, depth[i]));
+#endif
+ if (ec_tell_frac(ec) + 80 < ec->storage*8<<BITRES)
+ ec_enc_depth(ec, depth[i], 4*cap[i], &last);
+ else
+ depth[i] = 0;
+ }
+ } else {
+ for (i=start;i<tot_bands;i++) {
+ if (ec_tell_frac(ec) + 80 < ec->storage*8<<BITRES)
+ depth[i] = ec_dec_depth(ec, 4*cap[i], &last);
+ else
+ depth[i] = 0;
+ }
+ }
+ for (i=start;i<end;i++) {
+ extra_equant[i] = (depth[i]+3)>>2;
+ extra_pulses[i] = ((((m->eBands[i+1]-m->eBands[i])<<LM)-1)*C * depth[i] * (1<<BITRES) + 2)>>2;
+ }
+ if (qext_mode) {
+ for (i=0;i<qext_end;i++) {
+ extra_equant[end+i] = (depth[end+i]+3)>>2;
+ extra_pulses[end+i] = ((((qext_mode->eBands[i+1]-qext_mode->eBands[i])<<LM)-1)*C * depth[end+i] * (1<<BITRES) + 2)>>2;
+ }
+ }
+}
+#endif
diff --git a/media/libopus/celt/rate.h b/media/libopus/celt/rate.h
@@ -98,4 +98,7 @@ static OPUS_INLINE int pulses2bits(const CELTMode *m, int band, int LM, int puls
int clt_compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo,
opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth);
+void clt_compute_extra_allocation(const CELTMode *m, const CELTMode *qext_mode, int start, int end, int qext_end, const celt_glog *bandLogE, const celt_glog *qext_bandLogE,
+ opus_int32 total, int *extra_pulses, int *extra_equant, int C, int LM, ec_ctx *ec, int encode, opus_val16 tone_freq, opus_val32 toneishness);
+
#endif
diff --git a/media/libopus/celt/static_modes_fixed.h b/media/libopus/celt/static_modes_fixed.h
@@ -1,5 +1,5 @@
/* The contents of this file was automatically generated by dump_modes.c
- with arguments: 48000 960
+ with arguments: 48000 960 96000 1920
It contains static definitions for some pre-defined modes. */
#include "modes.h"
#include "rate.h"
@@ -16,27 +16,27 @@ static const celt_coef window120[120] = {
144497, 1300330, 3611201, 7075520, 11690888,
17454086, 24361057, 32406886, 41585775, 51891010,
63314937, 75848919, 89483305, 104207389, 120009370,
-136876310, 154794092, 173747378, 193719571, 214692768,
-236647730, 259563841, 283419076, 308189974, 333851610,
+136876310, 154794092, 173747379, 193719571, 214692768,
+236647730, 259563841, 283419077, 308189974, 333851611,
360377579, 387739975, 415909390, 444854905, 474544098,
504943052, 536016380, 567727246, 600037405, 632907246,
-666295841, 700161014, 734459402, 769146541, 804176949,
-839504226, 875081151, 910859801, 946791664, 982827766,
-1018918806, 1055015289, 1091067669, 1127026498, 1162842572,
-1198467087, 1233851789, 1268949131, 1303712427, 1338096005,
-1372055357, 1405547287, 1438530057, 1470963523, 1502809271,
-1534030739, 1564593342, 1594464576, 1623614127, 1652013955,
-1679638381, 1706464157, 1732470523, 1757639262, 1781954728,
-1805403878, 1827976281, 1849664119, 1870462176, 1890367815,
-1909380945, 1927503971, 1944741740, 1961101474, 1976592691,
-1991227121, 2005018606, 2017983003, 2030138066, 2041503334,
-2052100005, 2061950805, 2071079860, 2079512552, 2087275383,
-2094395834, 2100902217, 2106823531, 2112189320, 2117029526,
-2121374346, 2125254091, 2128699048, 2131739342, 2134404803,
-2136724837, 2138728300, 2140443379, 2141897477, 2143117096,
-2144127739, 2144953806, 2145618501, 2146143740, 2146550076,
-2146856617, 2147080957, 2147239112, 2147345466, 2147412715,
-2147451824, 2147471990, 2147480610, 2147483253, 2147483642,
+666295842, 700161014, 734459402, 769146541, 804176950,
+839504226, 875081152, 910859802, 946791664, 982827767,
+1018918807, 1055015290, 1091067670, 1127026498, 1162842573,
+1198467087, 1233851789, 1268949131, 1303712428, 1338096006,
+1372055358, 1405547288, 1438530058, 1470963524, 1502809271,
+1534030739, 1564593342, 1594464577, 1623614128, 1652013956,
+1679638382, 1706464158, 1732470524, 1757639263, 1781954729,
+1805403879, 1827976282, 1849664120, 1870462177, 1890367816,
+1909380946, 1927503971, 1944741741, 1961101475, 1976592692,
+1991227121, 2005018607, 2017983004, 2030138067, 2041503335,
+2052100006, 2061950806, 2071079861, 2079512553, 2087275384,
+2094395835, 2100902218, 2106823532, 2112189321, 2117029527,
+2121374347, 2125254092, 2128699049, 2131739343, 2134404804,
+2136724838, 2138728301, 2140443380, 2141897478, 2143117097,
+2144127740, 2144953807, 2145618502, 2146143741, 2146550077,
+2146856618, 2147080958, 2147239113, 2147345467, 2147412716,
+2147451825, 2147471991, 2147480611, 2147483254, 2147483643,
#else
2, 20, 55, 108, 178,
266, 372, 494, 635, 792,
@@ -126,250 +126,278 @@ static const unsigned char cache_caps50[168] = {
140, 66, 40, };
#endif
+#ifdef ENABLE_QEXT
+# ifndef DEF_QEXT_PULSE_CACHE50
+# define DEF_QEXT_PULSE_CACHE50
+static const opus_int16 qext_cache_index50[70] = {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41,
+41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 61, 61,
+61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 72, 72, 72,
+72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 80, 80, 80, 80,
+80, 80, 80, 80, 80, 80, 80, 80, 80, 80, };
+static const unsigned char qext_cache_bits50[86] = {
+40, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125,
+128, 131, 136, 141, 146, 150, 153, 157, 160, 163, 168, 173, 178, 182, 185,
+189, 192, 195, 200, 205, 210, 214, 217, 221, 224, 227, 19, 34, 61, 83,
+101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216, 222, 234, 245,
+254, 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253, 7, 50, 93,
+131, 165, 197, 227, 255, 5, 58, 109, 155, 197, 237, };
+static const unsigned char qext_cache_caps50[112] = {
+159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 171,
+171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 167, 167, 167,
+167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 166, 166, 166, 166, 166,
+166, 166, 166, 166, 166, 166, 166, 166, 166, 163, 163, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 165, 165, 165, 165, 165, 165, 165,
+165, 165, 165, 165, 165, 165, 165, };
+# endif
+#endif
+
#ifndef FFT_TWIDDLES48000_960
#define FFT_TWIDDLES48000_960
static const kiss_twiddle_cpx fft_twiddles48000_960[480] = {
#ifdef ENABLE_QEXT
-{2147483647, 0}, {2147299667, -28109692},
-{2146747758, -56214568}, {2145828015, -84309812},
-{2144540595, -112390610}, {2142885720, -140452150},
-{2140863672, -168489625}, {2138474798, -196498230},
-{2135719507, -224473166}, {2132598272, -252409639},
-{2129111627, -280302863}, {2125260169, -308148059},
-{2121044560, -335940456}, {2116465520, -363675290},
-{2111523835, -391347811}, {2106220351, -418953276},
-{2100555977, -446486956}, {2094531684, -473944133},
-{2088148503, -501320101}, {2081407529, -528610171},
-{2074309916, -555809667}, {2066856881, -582913927},
-{2059049701, -609918308}, {2050889713, -636818183},
-{2042378316, -663608942}, {2033516968, -690285995},
-{2024307187, -716844771}, {2014750552, -743280720},
-{2004848699, -769589311}, {1994603326, -795766037},
-{1984016188, -821806413}, {1973089099, -847705976},
-{1961823931, -873460290}, {1950222615, -899064940},
-{1938287138, -924515540}, {1926019546, -949807729},
-{1913421940, -974937174}, {1900496479, -999899568},
-{1887245378, -1024690635}, {1873670907, -1049306126},
-{1859775393, -1073741823}, {1845561215, -1097993541},
-{1831030810, -1122057123}, {1816186667, -1145928447},
-{1801031330, -1169603421}, {1785567395, -1193077990},
-{1769797513, -1216348131}, {1753724385, -1239409858},
-{1737350766, -1262259217}, {1720679460, -1284892295},
-{1703713325, -1307305214}, {1686455267, -1329494132},
-{1668908244, -1351455249}, {1651075262, -1373184800},
-{1632959376, -1394679063}, {1614563692, -1415934356},
-{1595891360, -1436947035}, {1576945581, -1457713501},
-{1557729600, -1478230195}, {1538246710, -1498493602},
-{1518500249, -1518500249}, {1498493602, -1538246710},
+{2147483647, 0}, {2147299668, -28109692},
+{2146747759, -56214568}, {2145828016, -84309812},
+{2144540596, -112390610}, {2142885721, -140452151},
+{2140863673, -168489625}, {2138474799, -196498230},
+{2135719508, -224473166}, {2132598273, -252409639},
+{2129111628, -280302863}, {2125260170, -308148059},
+{2121044561, -335940456}, {2116465521, -363675290},
+{2111523836, -391347811}, {2106220352, -418953276},
+{2100555978, -446486956}, {2094531684, -473944133},
+{2088148504, -501320102}, {2081407530, -528610172},
+{2074309917, -555809667}, {2066856882, -582913927},
+{2059049702, -609918309}, {2050889714, -636818183},
+{2042378317, -663608942}, {2033516969, -690285996},
+{2024307188, -716844772}, {2014750553, -743280720},
+{2004848700, -769589312}, {1994603327, -795766038},
+{1984016189, -821806413}, {1973089100, -847705977},
+{1961823932, -873460290}, {1950222616, -899064940},
+{1938287139, -924515541}, {1926019547, -949807730},
+{1913421941, -974937175}, {1900496480, -999899569},
+{1887245379, -1024690635}, {1873670908, -1049306126},
+{1859775393, -1073741824}, {1845561216, -1097993542},
+{1831030811, -1122057124}, {1816186668, -1145928447},
+{1801031331, -1169603422}, {1785567396, -1193077991},
+{1769797514, -1216348132}, {1753724386, -1239409858},
+{1737350766, -1262259218}, {1720679461, -1284892296},
+{1703713325, -1307305214}, {1686455268, -1329494133},
+{1668908244, -1351455249}, {1651075262, -1373184801},
+{1632959377, -1394679064}, {1614563692, -1415934356},
+{1595891361, -1436947036}, {1576945581, -1457713501},
+{1557729600, -1478230195}, {1538246711, -1498493602},
+{1518500250, -1518500250}, {1498493602, -1538246711},
{1478230195, -1557729600}, {1457713501, -1576945581},
-{1436947035, -1595891360}, {1415934356, -1614563692},
-{1394679063, -1632959376}, {1373184800, -1651075262},
-{1351455249, -1668908244}, {1329494132, -1686455267},
-{1307305214, -1703713325}, {1284892295, -1720679460},
-{1262259217, -1737350766}, {1239409858, -1753724385},
-{1216348131, -1769797513}, {1193077990, -1785567395},
-{1169603421, -1801031330}, {1145928447, -1816186667},
-{1122057123, -1831030810}, {1097993541, -1845561215},
-{1073741824, -1859775393}, {1049306126, -1873670907},
-{1024690635, -1887245378}, {999899568, -1900496479},
-{974937174, -1913421940}, {949807729, -1926019546},
-{924515540, -1938287138}, {899064940, -1950222615},
-{873460290, -1961823931}, {847705976, -1973089099},
-{821806413, -1984016188}, {795766037, -1994603326},
-{769589311, -2004848699}, {743280720, -2014750552},
-{716844771, -2024307187}, {690285995, -2033516968},
-{663608942, -2042378316}, {636818183, -2050889713},
-{609918308, -2059049701}, {582913927, -2066856881},
-{555809667, -2074309916}, {528610171, -2081407529},
-{501320101, -2088148503}, {473944133, -2094531684},
-{446486956, -2100555977}, {418953276, -2106220351},
-{391347811, -2111523835}, {363675290, -2116465520},
-{335940456, -2121044560}, {308148059, -2125260169},
-{280302863, -2129111627}, {252409639, -2132598272},
-{224473166, -2135719507}, {196498230, -2138474798},
-{168489625, -2140863672}, {140452150, -2142885720},
-{112390610, -2144540595}, {84309812, -2145828015},
-{56214568, -2146747758}, {28109692, -2147299667},
-{0, -2147483647}, {-28109692, -2147299667},
-{-56214568, -2146747758}, {-84309812, -2145828015},
-{-112390610, -2144540595}, {-140452150, -2142885720},
-{-168489625, -2140863672}, {-196498230, -2138474798},
-{-224473166, -2135719507}, {-252409639, -2132598272},
-{-280302863, -2129111627}, {-308148059, -2125260169},
-{-335940456, -2121044560}, {-363675290, -2116465520},
-{-391347811, -2111523835}, {-418953276, -2106220351},
-{-446486956, -2100555977}, {-473944133, -2094531684},
-{-501320101, -2088148503}, {-528610171, -2081407529},
-{-555809667, -2074309916}, {-582913927, -2066856881},
-{-609918308, -2059049701}, {-636818183, -2050889713},
-{-663608942, -2042378316}, {-690285995, -2033516968},
-{-716844771, -2024307187}, {-743280720, -2014750552},
-{-769589311, -2004848699}, {-795766037, -1994603326},
-{-821806413, -1984016188}, {-847705976, -1973089099},
-{-873460290, -1961823931}, {-899064940, -1950222615},
-{-924515540, -1938287138}, {-949807729, -1926019546},
-{-974937174, -1913421940}, {-999899568, -1900496479},
-{-1024690635, -1887245378}, {-1049306126, -1873670907},
-{-1073741823, -1859775393}, {-1097993541, -1845561215},
-{-1122057123, -1831030810}, {-1145928447, -1816186667},
-{-1169603421, -1801031330}, {-1193077990, -1785567395},
-{-1216348131, -1769797513}, {-1239409858, -1753724385},
-{-1262259217, -1737350766}, {-1284892295, -1720679460},
-{-1307305214, -1703713325}, {-1329494132, -1686455267},
-{-1351455249, -1668908244}, {-1373184800, -1651075262},
-{-1394679063, -1632959376}, {-1415934356, -1614563692},
-{-1436947035, -1595891360}, {-1457713501, -1576945581},
-{-1478230195, -1557729600}, {-1498493602, -1538246710},
-{-1518500249, -1518500249}, {-1538246710, -1498493602},
+{1436947036, -1595891361}, {1415934356, -1614563692},
+{1394679064, -1632959377}, {1373184801, -1651075262},
+{1351455249, -1668908244}, {1329494133, -1686455268},
+{1307305214, -1703713325}, {1284892296, -1720679461},
+{1262259218, -1737350766}, {1239409858, -1753724386},
+{1216348132, -1769797514}, {1193077991, -1785567396},
+{1169603422, -1801031331}, {1145928447, -1816186668},
+{1122057124, -1831030811}, {1097993542, -1845561216},
+{1073741824, -1859775393}, {1049306126, -1873670908},
+{1024690635, -1887245379}, {999899569, -1900496480},
+{974937175, -1913421941}, {949807730, -1926019547},
+{924515541, -1938287139}, {899064940, -1950222616},
+{873460290, -1961823932}, {847705977, -1973089100},
+{821806413, -1984016189}, {795766038, -1994603327},
+{769589312, -2004848700}, {743280720, -2014750553},
+{716844772, -2024307188}, {690285996, -2033516969},
+{663608942, -2042378317}, {636818183, -2050889714},
+{609918309, -2059049702}, {582913927, -2066856882},
+{555809667, -2074309917}, {528610172, -2081407530},
+{501320102, -2088148504}, {473944133, -2094531684},
+{446486956, -2100555978}, {418953276, -2106220352},
+{391347811, -2111523836}, {363675290, -2116465521},
+{335940456, -2121044561}, {308148059, -2125260170},
+{280302863, -2129111628}, {252409639, -2132598273},
+{224473166, -2135719508}, {196498230, -2138474799},
+{168489625, -2140863673}, {140452151, -2142885721},
+{112390610, -2144540596}, {84309812, -2145828016},
+{56214568, -2146747759}, {28109692, -2147299668},
+{0, -2147483648}, {-28109692, -2147299668},
+{-56214568, -2146747759}, {-84309812, -2145828016},
+{-112390610, -2144540596}, {-140452151, -2142885721},
+{-168489625, -2140863673}, {-196498230, -2138474799},
+{-224473166, -2135719508}, {-252409639, -2132598273},
+{-280302863, -2129111628}, {-308148059, -2125260170},
+{-335940456, -2121044561}, {-363675290, -2116465521},
+{-391347811, -2111523836}, {-418953276, -2106220352},
+{-446486956, -2100555978}, {-473944133, -2094531684},
+{-501320102, -2088148504}, {-528610172, -2081407530},
+{-555809667, -2074309917}, {-582913927, -2066856882},
+{-609918309, -2059049702}, {-636818183, -2050889714},
+{-663608942, -2042378317}, {-690285996, -2033516969},
+{-716844772, -2024307188}, {-743280720, -2014750553},
+{-769589312, -2004848700}, {-795766038, -1994603327},
+{-821806413, -1984016189}, {-847705977, -1973089100},
+{-873460290, -1961823932}, {-899064940, -1950222616},
+{-924515541, -1938287139}, {-949807730, -1926019547},
+{-974937175, -1913421941}, {-999899569, -1900496480},
+{-1024690635, -1887245379}, {-1049306126, -1873670908},
+{-1073741824, -1859775393}, {-1097993542, -1845561216},
+{-1122057124, -1831030811}, {-1145928447, -1816186668},
+{-1169603422, -1801031331}, {-1193077991, -1785567396},
+{-1216348132, -1769797514}, {-1239409858, -1753724386},
+{-1262259218, -1737350766}, {-1284892296, -1720679461},
+{-1307305214, -1703713325}, {-1329494133, -1686455268},
+{-1351455249, -1668908244}, {-1373184801, -1651075262},
+{-1394679064, -1632959377}, {-1415934356, -1614563692},
+{-1436947036, -1595891361}, {-1457713501, -1576945581},
+{-1478230195, -1557729600}, {-1498493602, -1538246711},
+{-1518500250, -1518500250}, {-1538246711, -1498493602},
{-1557729600, -1478230195}, {-1576945581, -1457713501},
-{-1595891360, -1436947035}, {-1614563692, -1415934356},
-{-1632959376, -1394679063}, {-1651075262, -1373184800},
-{-1668908244, -1351455249}, {-1686455267, -1329494132},
-{-1703713325, -1307305214}, {-1720679460, -1284892295},
-{-1737350766, -1262259217}, {-1753724385, -1239409858},
-{-1769797513, -1216348131}, {-1785567395, -1193077990},
-{-1801031330, -1169603421}, {-1816186667, -1145928447},
-{-1831030810, -1122057123}, {-1845561215, -1097993541},
-{-1859775393, -1073741824}, {-1873670907, -1049306126},
-{-1887245378, -1024690635}, {-1900496479, -999899568},
-{-1913421940, -974937174}, {-1926019546, -949807729},
-{-1938287138, -924515540}, {-1950222615, -899064940},
-{-1961823931, -873460290}, {-1973089099, -847705976},
-{-1984016188, -821806413}, {-1994603326, -795766037},
-{-2004848699, -769589311}, {-2014750552, -743280720},
-{-2024307187, -716844771}, {-2033516968, -690285995},
-{-2042378316, -663608942}, {-2050889713, -636818183},
-{-2059049701, -609918308}, {-2066856881, -582913927},
-{-2074309916, -555809667}, {-2081407529, -528610171},
-{-2088148503, -501320101}, {-2094531684, -473944133},
-{-2100555977, -446486956}, {-2106220351, -418953276},
-{-2111523835, -391347811}, {-2116465520, -363675290},
-{-2121044560, -335940456}, {-2125260169, -308148059},
-{-2129111627, -280302863}, {-2132598272, -252409639},
-{-2135719507, -224473166}, {-2138474798, -196498230},
-{-2140863672, -168489625}, {-2142885720, -140452150},
-{-2144540595, -112390610}, {-2145828015, -84309812},
-{-2146747758, -56214568}, {-2147299667, -28109692},
-{-2147483647, 0}, {-2147299667, 28109692},
-{-2146747758, 56214568}, {-2145828015, 84309812},
-{-2144540595, 112390610}, {-2142885720, 140452150},
-{-2140863672, 168489625}, {-2138474798, 196498230},
-{-2135719507, 224473166}, {-2132598272, 252409639},
-{-2129111627, 280302863}, {-2125260169, 308148059},
-{-2121044560, 335940456}, {-2116465520, 363675290},
-{-2111523835, 391347811}, {-2106220351, 418953276},
-{-2100555977, 446486956}, {-2094531684, 473944133},
-{-2088148503, 501320101}, {-2081407529, 528610171},
-{-2074309916, 555809667}, {-2066856881, 582913927},
-{-2059049701, 609918308}, {-2050889713, 636818183},
-{-2042378316, 663608942}, {-2033516968, 690285995},
-{-2024307187, 716844771}, {-2014750552, 743280720},
-{-2004848699, 769589311}, {-1994603326, 795766037},
-{-1984016188, 821806413}, {-1973089099, 847705976},
-{-1961823931, 873460290}, {-1950222615, 899064940},
-{-1938287138, 924515540}, {-1926019546, 949807729},
-{-1913421940, 974937174}, {-1900496479, 999899568},
-{-1887245378, 1024690635}, {-1873670907, 1049306126},
-{-1859775393, 1073741823}, {-1845561215, 1097993541},
-{-1831030810, 1122057123}, {-1816186667, 1145928447},
-{-1801031330, 1169603421}, {-1785567395, 1193077990},
-{-1769797513, 1216348131}, {-1753724385, 1239409858},
-{-1737350766, 1262259217}, {-1720679460, 1284892295},
-{-1703713325, 1307305214}, {-1686455267, 1329494132},
-{-1668908244, 1351455249}, {-1651075262, 1373184800},
-{-1632959376, 1394679063}, {-1614563692, 1415934356},
-{-1595891360, 1436947035}, {-1576945581, 1457713501},
-{-1557729600, 1478230195}, {-1538246710, 1498493602},
-{-1518500249, 1518500249}, {-1498493602, 1538246710},
+{-1595891361, -1436947036}, {-1614563692, -1415934356},
+{-1632959377, -1394679064}, {-1651075262, -1373184801},
+{-1668908244, -1351455249}, {-1686455268, -1329494133},
+{-1703713325, -1307305214}, {-1720679461, -1284892296},
+{-1737350766, -1262259218}, {-1753724386, -1239409858},
+{-1769797514, -1216348132}, {-1785567396, -1193077991},
+{-1801031331, -1169603422}, {-1816186668, -1145928447},
+{-1831030811, -1122057124}, {-1845561216, -1097993542},
+{-1859775393, -1073741824}, {-1873670908, -1049306126},
+{-1887245379, -1024690635}, {-1900496480, -999899569},
+{-1913421941, -974937175}, {-1926019547, -949807730},
+{-1938287139, -924515541}, {-1950222616, -899064940},
+{-1961823932, -873460290}, {-1973089100, -847705977},
+{-1984016189, -821806413}, {-1994603327, -795766038},
+{-2004848700, -769589312}, {-2014750553, -743280720},
+{-2024307188, -716844772}, {-2033516969, -690285996},
+{-2042378317, -663608942}, {-2050889714, -636818183},
+{-2059049702, -609918309}, {-2066856882, -582913927},
+{-2074309917, -555809667}, {-2081407530, -528610172},
+{-2088148504, -501320102}, {-2094531684, -473944133},
+{-2100555978, -446486956}, {-2106220352, -418953276},
+{-2111523836, -391347811}, {-2116465521, -363675290},
+{-2121044561, -335940456}, {-2125260170, -308148059},
+{-2129111628, -280302863}, {-2132598273, -252409639},
+{-2135719508, -224473166}, {-2138474799, -196498230},
+{-2140863673, -168489625}, {-2142885721, -140452151},
+{-2144540596, -112390610}, {-2145828016, -84309812},
+{-2146747759, -56214568}, {-2147299668, -28109692},
+{-2147483648, 0}, {-2147299668, 28109692},
+{-2146747759, 56214568}, {-2145828016, 84309812},
+{-2144540596, 112390610}, {-2142885721, 140452151},
+{-2140863673, 168489625}, {-2138474799, 196498230},
+{-2135719508, 224473166}, {-2132598273, 252409639},
+{-2129111628, 280302863}, {-2125260170, 308148059},
+{-2121044561, 335940456}, {-2116465521, 363675290},
+{-2111523836, 391347811}, {-2106220352, 418953276},
+{-2100555978, 446486956}, {-2094531684, 473944133},
+{-2088148504, 501320102}, {-2081407530, 528610172},
+{-2074309917, 555809667}, {-2066856882, 582913927},
+{-2059049702, 609918309}, {-2050889714, 636818183},
+{-2042378317, 663608942}, {-2033516969, 690285996},
+{-2024307188, 716844772}, {-2014750553, 743280720},
+{-2004848700, 769589312}, {-1994603327, 795766038},
+{-1984016189, 821806413}, {-1973089100, 847705977},
+{-1961823932, 873460290}, {-1950222616, 899064940},
+{-1938287139, 924515541}, {-1926019547, 949807730},
+{-1913421941, 974937175}, {-1900496480, 999899569},
+{-1887245379, 1024690635}, {-1873670908, 1049306126},
+{-1859775393, 1073741824}, {-1845561216, 1097993542},
+{-1831030811, 1122057124}, {-1816186668, 1145928447},
+{-1801031331, 1169603422}, {-1785567396, 1193077991},
+{-1769797514, 1216348132}, {-1753724386, 1239409858},
+{-1737350766, 1262259218}, {-1720679461, 1284892296},
+{-1703713325, 1307305214}, {-1686455268, 1329494133},
+{-1668908244, 1351455249}, {-1651075262, 1373184801},
+{-1632959377, 1394679064}, {-1614563692, 1415934356},
+{-1595891361, 1436947036}, {-1576945581, 1457713501},
+{-1557729600, 1478230195}, {-1538246711, 1498493602},
+{-1518500250, 1518500250}, {-1498493602, 1538246711},
{-1478230195, 1557729600}, {-1457713501, 1576945581},
-{-1436947035, 1595891360}, {-1415934356, 1614563692},
-{-1394679063, 1632959376}, {-1373184800, 1651075262},
-{-1351455249, 1668908244}, {-1329494132, 1686455267},
-{-1307305214, 1703713325}, {-1284892295, 1720679460},
-{-1262259217, 1737350766}, {-1239409858, 1753724385},
-{-1216348131, 1769797513}, {-1193077990, 1785567395},
-{-1169603421, 1801031330}, {-1145928447, 1816186667},
-{-1122057123, 1831030810}, {-1097993541, 1845561215},
-{-1073741824, 1859775393}, {-1049306126, 1873670907},
-{-1024690635, 1887245378}, {-999899568, 1900496479},
-{-974937174, 1913421940}, {-949807729, 1926019546},
-{-924515540, 1938287138}, {-899064940, 1950222615},
-{-873460290, 1961823931}, {-847705976, 1973089099},
-{-821806413, 1984016188}, {-795766037, 1994603326},
-{-769589311, 2004848699}, {-743280720, 2014750552},
-{-716844771, 2024307187}, {-690285995, 2033516968},
-{-663608942, 2042378316}, {-636818183, 2050889713},
-{-609918308, 2059049701}, {-582913927, 2066856881},
-{-555809667, 2074309916}, {-528610171, 2081407529},
-{-501320101, 2088148503}, {-473944133, 2094531684},
-{-446486956, 2100555977}, {-418953276, 2106220351},
-{-391347811, 2111523835}, {-363675290, 2116465520},
-{-335940456, 2121044560}, {-308148059, 2125260169},
-{-280302863, 2129111627}, {-252409639, 2132598272},
-{-224473166, 2135719507}, {-196498230, 2138474798},
-{-168489625, 2140863672}, {-140452150, 2142885720},
-{-112390610, 2144540595}, {-84309812, 2145828015},
-{-56214568, 2146747758}, {-28109692, 2147299667},
-{0, 2147483647}, {28109692, 2147299667},
-{56214568, 2146747758}, {84309812, 2145828015},
-{112390610, 2144540595}, {140452150, 2142885720},
-{168489625, 2140863672}, {196498230, 2138474798},
-{224473166, 2135719507}, {252409639, 2132598272},
-{280302863, 2129111627}, {308148059, 2125260169},
-{335940456, 2121044560}, {363675290, 2116465520},
-{391347811, 2111523835}, {418953276, 2106220351},
-{446486956, 2100555977}, {473944133, 2094531684},
-{501320101, 2088148503}, {528610171, 2081407529},
-{555809667, 2074309916}, {582913927, 2066856881},
-{609918308, 2059049701}, {636818183, 2050889713},
-{663608942, 2042378316}, {690285995, 2033516968},
-{716844771, 2024307187}, {743280720, 2014750552},
-{769589311, 2004848699}, {795766037, 1994603326},
-{821806413, 1984016188}, {847705976, 1973089099},
-{873460290, 1961823931}, {899064940, 1950222615},
-{924515540, 1938287138}, {949807729, 1926019546},
-{974937174, 1913421940}, {999899568, 1900496479},
-{1024690635, 1887245378}, {1049306126, 1873670907},
-{1073741823, 1859775393}, {1097993541, 1845561215},
-{1122057123, 1831030810}, {1145928447, 1816186667},
-{1169603421, 1801031330}, {1193077990, 1785567395},
-{1216348131, 1769797513}, {1239409858, 1753724385},
-{1262259217, 1737350766}, {1284892295, 1720679460},
-{1307305214, 1703713325}, {1329494132, 1686455267},
-{1351455249, 1668908244}, {1373184800, 1651075262},
-{1394679063, 1632959376}, {1415934356, 1614563692},
-{1436947035, 1595891360}, {1457713501, 1576945581},
-{1478230195, 1557729600}, {1498493602, 1538246710},
-{1518500249, 1518500249}, {1538246710, 1498493602},
+{-1436947036, 1595891361}, {-1415934356, 1614563692},
+{-1394679064, 1632959377}, {-1373184801, 1651075262},
+{-1351455249, 1668908244}, {-1329494133, 1686455268},
+{-1307305214, 1703713325}, {-1284892296, 1720679461},
+{-1262259218, 1737350766}, {-1239409858, 1753724386},
+{-1216348132, 1769797514}, {-1193077991, 1785567396},
+{-1169603422, 1801031331}, {-1145928447, 1816186668},
+{-1122057124, 1831030811}, {-1097993542, 1845561216},
+{-1073741824, 1859775393}, {-1049306126, 1873670908},
+{-1024690635, 1887245379}, {-999899569, 1900496480},
+{-974937175, 1913421941}, {-949807730, 1926019547},
+{-924515541, 1938287139}, {-899064940, 1950222616},
+{-873460290, 1961823932}, {-847705977, 1973089100},
+{-821806413, 1984016189}, {-795766038, 1994603327},
+{-769589312, 2004848700}, {-743280720, 2014750553},
+{-716844772, 2024307188}, {-690285996, 2033516969},
+{-663608942, 2042378317}, {-636818183, 2050889714},
+{-609918309, 2059049702}, {-582913927, 2066856882},
+{-555809667, 2074309917}, {-528610172, 2081407530},
+{-501320102, 2088148504}, {-473944133, 2094531684},
+{-446486956, 2100555978}, {-418953276, 2106220352},
+{-391347811, 2111523836}, {-363675290, 2116465521},
+{-335940456, 2121044561}, {-308148059, 2125260170},
+{-280302863, 2129111628}, {-252409639, 2132598273},
+{-224473166, 2135719508}, {-196498230, 2138474799},
+{-168489625, 2140863673}, {-140452151, 2142885721},
+{-112390610, 2144540596}, {-84309812, 2145828016},
+{-56214568, 2146747759}, {-28109692, 2147299668},
+{0, 2147483647}, {28109692, 2147299668},
+{56214568, 2146747759}, {84309812, 2145828016},
+{112390610, 2144540596}, {140452151, 2142885721},
+{168489625, 2140863673}, {196498230, 2138474799},
+{224473166, 2135719508}, {252409639, 2132598273},
+{280302863, 2129111628}, {308148059, 2125260170},
+{335940456, 2121044561}, {363675290, 2116465521},
+{391347811, 2111523836}, {418953276, 2106220352},
+{446486956, 2100555978}, {473944133, 2094531684},
+{501320102, 2088148504}, {528610172, 2081407530},
+{555809667, 2074309917}, {582913927, 2066856882},
+{609918309, 2059049702}, {636818183, 2050889714},
+{663608942, 2042378317}, {690285996, 2033516969},
+{716844772, 2024307188}, {743280720, 2014750553},
+{769589312, 2004848700}, {795766038, 1994603327},
+{821806413, 1984016189}, {847705977, 1973089100},
+{873460290, 1961823932}, {899064940, 1950222616},
+{924515541, 1938287139}, {949807730, 1926019547},
+{974937175, 1913421941}, {999899569, 1900496480},
+{1024690635, 1887245379}, {1049306126, 1873670908},
+{1073741824, 1859775393}, {1097993542, 1845561216},
+{1122057124, 1831030811}, {1145928447, 1816186668},
+{1169603422, 1801031331}, {1193077991, 1785567396},
+{1216348132, 1769797514}, {1239409858, 1753724386},
+{1262259218, 1737350766}, {1284892296, 1720679461},
+{1307305214, 1703713325}, {1329494133, 1686455268},
+{1351455249, 1668908244}, {1373184801, 1651075262},
+{1394679064, 1632959377}, {1415934356, 1614563692},
+{1436947036, 1595891361}, {1457713501, 1576945581},
+{1478230195, 1557729600}, {1498493602, 1538246711},
+{1518500250, 1518500250}, {1538246711, 1498493602},
{1557729600, 1478230195}, {1576945581, 1457713501},
-{1595891360, 1436947035}, {1614563692, 1415934356},
-{1632959376, 1394679063}, {1651075262, 1373184800},
-{1668908244, 1351455249}, {1686455267, 1329494132},
-{1703713325, 1307305214}, {1720679460, 1284892295},
-{1737350766, 1262259217}, {1753724385, 1239409858},
-{1769797513, 1216348131}, {1785567395, 1193077990},
-{1801031330, 1169603421}, {1816186667, 1145928447},
-{1831030810, 1122057123}, {1845561215, 1097993541},
-{1859775393, 1073741824}, {1873670907, 1049306126},
-{1887245378, 1024690635}, {1900496479, 999899568},
-{1913421940, 974937174}, {1926019546, 949807729},
-{1938287138, 924515540}, {1950222615, 899064940},
-{1961823931, 873460290}, {1973089099, 847705976},
-{1984016188, 821806413}, {1994603326, 795766037},
-{2004848699, 769589311}, {2014750552, 743280720},
-{2024307187, 716844771}, {2033516968, 690285995},
-{2042378316, 663608942}, {2050889713, 636818183},
-{2059049701, 609918308}, {2066856881, 582913927},
-{2074309916, 555809667}, {2081407529, 528610171},
-{2088148503, 501320101}, {2094531684, 473944133},
-{2100555977, 446486956}, {2106220351, 418953276},
-{2111523835, 391347811}, {2116465520, 363675290},
-{2121044560, 335940456}, {2125260169, 308148059},
-{2129111627, 280302863}, {2132598272, 252409639},
-{2135719507, 224473166}, {2138474798, 196498230},
-{2140863672, 168489625}, {2142885720, 140452150},
-{2144540595, 112390610}, {2145828015, 84309812},
-{2146747758, 56214568}, {2147299667, 28109692},
+{1595891361, 1436947036}, {1614563692, 1415934356},
+{1632959377, 1394679064}, {1651075262, 1373184801},
+{1668908244, 1351455249}, {1686455268, 1329494133},
+{1703713325, 1307305214}, {1720679461, 1284892296},
+{1737350766, 1262259218}, {1753724386, 1239409858},
+{1769797514, 1216348132}, {1785567396, 1193077991},
+{1801031331, 1169603422}, {1816186668, 1145928447},
+{1831030811, 1122057124}, {1845561216, 1097993542},
+{1859775393, 1073741824}, {1873670908, 1049306126},
+{1887245379, 1024690635}, {1900496480, 999899569},
+{1913421941, 974937175}, {1926019547, 949807730},
+{1938287139, 924515541}, {1950222616, 899064940},
+{1961823932, 873460290}, {1973089100, 847705977},
+{1984016189, 821806413}, {1994603327, 795766038},
+{2004848700, 769589312}, {2014750553, 743280720},
+{2024307188, 716844772}, {2033516969, 690285996},
+{2042378317, 663608942}, {2050889714, 636818183},
+{2059049702, 609918309}, {2066856882, 582913927},
+{2074309917, 555809667}, {2081407530, 528610172},
+{2088148504, 501320102}, {2094531684, 473944133},
+{2100555978, 446486956}, {2106220352, 418953276},
+{2111523836, 391347811}, {2116465521, 363675290},
+{2121044561, 335940456}, {2125260170, 308148059},
+{2129111628, 280302863}, {2132598273, 252409639},
+{2135719508, 224473166}, {2138474799, 196498230},
+{2140863673, 168489625}, {2142885721, 140452151},
+{2144540596, 112390610}, {2145828016, 84309812},
+{2146747759, 56214568}, {2147299668, 28109692},
#else
{32767, 0}, {32765, -429},
{32757, -858}, {32743, -1286},
@@ -1532,10 +1560,2887 @@ logN400, /* logN */
window120, /* window */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
+#ifdef ENABLE_QEXT
+{86, qext_cache_index50, qext_cache_bits50, qext_cache_caps50}, /* qext_cache */
+#endif
};
-/* List of all the available modes */
-#define TOTAL_MODES 1
-static const CELTMode * const static_mode_list[TOTAL_MODES] = {
-&mode48000_960_120,
+#ifdef ENABLE_QEXT
+#ifndef DEF_WINDOW240
+#define DEF_WINDOW240
+static const celt_coef window240[240] = {
+#ifdef ENABLE_QEXT
+36124, 325113, 903042, 1769811, 2925272,
+4369225, 6101422, 8121563, 10429297, 13024223,
+15905885, 19073777, 22527339, 26265958, 30288963,
+34595631, 39185180, 44056771, 49209509, 54642435,
+60354533, 66344724, 72611866, 79154752, 85972112,
+93062609, 100424835, 108057317, 115958510, 124126796,
+132560487, 141257817, 150216948, 159435962, 168912864,
+178645581, 188631957, 198869754, 209356654, 220090250,
+231068053, 242287487, 253745886, 265440499, 277368483,
+289526906, 301912744, 314522883, 327354113, 340403136,
+353666556, 367140886, 380822544, 394707853, 408793044,
+423074251, 437547515, 452208783, 467053909, 482078654,
+497278684, 512649576, 528186815, 543885797, 559741828,
+575750127, 591905825, 608203972, 624639532, 641207388,
+657902345, 674719130, 691652394, 708696716, 725846605,
+743096501, 760440782, 777873759, 795389689, 812982769,
+830647145, 848376914, 866166126, 884008788, 901898872,
+919830310, 937797006, 955792839, 973811661, 991847308,
+1009893601, 1027944353, 1045993369, 1064034454, 1082061416,
+1100068075, 1118048258, 1135995815, 1153904614, 1171768555,
+1189581567, 1207337616, 1225030710, 1242654904, 1260204305,
+1277673075, 1295055437, 1312345681, 1329538165, 1346627326,
+1363607677, 1380473817, 1397220435, 1413842311, 1430334323,
+1446691453, 1462908786, 1478981520, 1494904965, 1510674550,
+1526285825, 1541734465, 1557016274, 1572127189, 1587063280,
+1601820758, 1616395971, 1630785416, 1644985731, 1658993707,
+1672806283, 1686420553, 1699833765, 1713043324, 1726046792,
+1738841892, 1751426506, 1763798678, 1775956615, 1787898686,
+1799623424, 1811129525, 1822415848, 1833481417, 1844325418,
+1854947198, 1865346267, 1875522297, 1885475119, 1895204720,
+1904711247, 1913995001, 1923056438, 1931896164, 1940514936,
+1948913657, 1957093375, 1965055281, 1972800706, 1980331118,
+1987648116, 1994753433, 2001648928, 2008336584, 2014818504,
+2021096911, 2027174137, 2033052626, 2038734929, 2044223696,
+2049521676, 2054631712, 2059556735, 2064299763, 2068863893,
+2073252301, 2077468232, 2081515002, 2085395988, 2089114627,
+2092674410, 2096078878, 2099331616, 2102436251, 2105396446,
+2108215896, 2110898322, 2113447469, 2115867100, 2118160991,
+2120332927, 2122386699, 2124326098, 2126154912, 2127876920,
+2129495889, 2131015570, 2132439692, 2133771963, 2135016059,
+2136175624, 2137254268, 2138255559, 2139183022, 2140040133,
+2140830320, 2141556955, 2142223351, 2142832762, 2143388377,
+2143893317, 2144350634, 2144763305, 2145134231, 2145466235,
+2145762059, 2146024357, 2146255701, 2146458570, 2146635355,
+2146788350, 2146919756, 2147031676, 2147126111, 2147204964,
+2147270033, 2147323012, 2147365487, 2147398940, 2147424741,
+2147444152, 2147458322, 2147468290, 2147474980, 2147479203,
+2147481655, 2147482918, 2147483458, 2147483623, 2147483647,
+#else
+1, 5, 14, 27, 45,
+67, 93, 124, 159, 199,
+243, 291, 344, 401, 462,
+528, 598, 672, 751, 834,
+921, 1012, 1108, 1208, 1312,
+1420, 1532, 1649, 1769, 1894,
+2023, 2155, 2292, 2433, 2577,
+2726, 2878, 3035, 3195, 3358,
+3526, 3697, 3872, 4050, 4232,
+4418, 4607, 4799, 4995, 5194,
+5397, 5602, 5811, 6023, 6238,
+6456, 6676, 6900, 7127, 7356,
+7588, 7822, 8059, 8299, 8541,
+8785, 9032, 9280, 9531, 9784,
+10039, 10295, 10554, 10814, 11076,
+11339, 11603, 11869, 12137, 12405,
+12675, 12945, 13217, 13489, 13762,
+14035, 14310, 14584, 14859, 15134,
+15410, 15685, 15961, 16236, 16511,
+16786, 17060, 17334, 17607, 17880,
+18152, 18423, 18692, 18961, 19229,
+19496, 19761, 20025, 20287, 20548,
+20807, 21064, 21320, 21574, 21825,
+22075, 22322, 22567, 22810, 23051,
+23289, 23525, 23758, 23989, 24217,
+24442, 24664, 24884, 25100, 25314,
+25525, 25733, 25937, 26139, 26337,
+26533, 26725, 26913, 27099, 27281,
+27460, 27636, 27808, 27977, 28142,
+28304, 28463, 28618, 28770, 28919,
+29064, 29205, 29344, 29478, 29610,
+29738, 29863, 29984, 30103, 30217,
+30329, 30438, 30543, 30645, 30744,
+30839, 30932, 31022, 31109, 31192,
+31273, 31351, 31426, 31499, 31568,
+31635, 31700, 31761, 31821, 31877,
+31932, 31984, 32033, 32081, 32126,
+32169, 32210, 32249, 32286, 32321,
+32354, 32385, 32415, 32443, 32469,
+32494, 32517, 32538, 32559, 32578,
+32595, 32612, 32627, 32641, 32654,
+32666, 32678, 32688, 32697, 32706,
+32713, 32720, 32726, 32732, 32737,
+32742, 32746, 32749, 32752, 32755,
+32757, 32759, 32761, 32763, 32764,
+32765, 32766, 32766, 32767, 32767,
+32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32767, 32767,
+#endif
+};
+#endif
+
+#ifndef DEF_LOGN400
+#define DEF_LOGN400
+static const opus_int16 logN400[21] = {
+0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 34, 36, };
+#endif
+
+#ifndef DEF_PULSE_CACHE50
+#define DEF_PULSE_CACHE50
+static const opus_int16 cache_index50[105] = {
+-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 41, 41, 41,
+82, 82, 123, 164, 200, 222, 0, 0, 0, 0, 0, 0, 0, 0, 41,
+41, 41, 41, 123, 123, 123, 164, 164, 240, 266, 283, 295, 41, 41, 41,
+41, 41, 41, 41, 41, 123, 123, 123, 123, 240, 240, 240, 266, 266, 305,
+318, 328, 336, 123, 123, 123, 123, 123, 123, 123, 123, 240, 240, 240, 240,
+305, 305, 305, 318, 318, 343, 351, 358, 364, 240, 240, 240, 240, 240, 240,
+240, 240, 305, 305, 305, 305, 343, 343, 343, 351, 351, 370, 376, 382, 387,
+};
+static const unsigned char cache_bits50[392] = {
+40, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 40, 15, 23, 28,
+31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47, 47, 49, 50,
+51, 52, 53, 54, 55, 55, 57, 58, 59, 60, 61, 62, 63, 63, 65,
+66, 67, 68, 69, 70, 71, 71, 40, 20, 33, 41, 48, 53, 57, 61,
+64, 66, 69, 71, 73, 75, 76, 78, 80, 82, 85, 87, 89, 91, 92,
+94, 96, 98, 101, 103, 105, 107, 108, 110, 112, 114, 117, 119, 121, 123,
+124, 126, 128, 40, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94,
+97, 100, 102, 105, 107, 111, 115, 118, 121, 124, 126, 129, 131, 135, 139,
+142, 145, 148, 150, 153, 155, 159, 163, 166, 169, 172, 174, 177, 179, 35,
+28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149,
+153, 159, 165, 171, 176, 180, 185, 189, 192, 199, 205, 211, 216, 220, 225,
+229, 232, 239, 245, 251, 21, 33, 58, 79, 97, 112, 125, 137, 148, 157,
+166, 174, 182, 189, 195, 201, 207, 217, 227, 235, 243, 251, 17, 35, 63,
+86, 106, 123, 139, 152, 165, 177, 187, 197, 206, 214, 222, 230, 237, 250,
+25, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180,
+185, 190, 200, 208, 215, 222, 229, 235, 240, 245, 255, 16, 36, 65, 89,
+110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242, 250, 11, 41,
+74, 103, 128, 151, 172, 191, 209, 225, 241, 255, 9, 43, 79, 110, 138,
+163, 186, 207, 227, 246, 12, 39, 71, 99, 123, 144, 164, 182, 198, 214,
+228, 241, 253, 9, 44, 81, 113, 142, 168, 192, 214, 235, 255, 7, 49,
+90, 127, 160, 191, 220, 247, 6, 51, 95, 134, 170, 203, 234, 7, 47,
+87, 123, 155, 184, 212, 237, 6, 52, 97, 137, 174, 208, 240, 5, 57,
+106, 151, 192, 231, 5, 59, 111, 158, 202, 243, 5, 55, 103, 147, 187,
+224, 5, 60, 113, 161, 206, 248, 4, 65, 122, 175, 224, 4, 67, 127,
+182, 234, };
+static const unsigned char cache_caps50[168] = {
+224, 224, 224, 224, 224, 224, 224, 224, 160, 160, 160, 160, 185, 185, 185,
+178, 178, 168, 134, 61, 37, 224, 224, 224, 224, 224, 224, 224, 224, 240,
+240, 240, 240, 207, 207, 207, 198, 198, 183, 144, 66, 40, 160, 160, 160,
+160, 160, 160, 160, 160, 185, 185, 185, 185, 193, 193, 193, 183, 183, 172,
+138, 64, 38, 240, 240, 240, 240, 240, 240, 240, 240, 207, 207, 207, 207,
+204, 204, 204, 193, 193, 180, 143, 66, 40, 185, 185, 185, 185, 185, 185,
+185, 185, 193, 193, 193, 193, 193, 193, 193, 183, 183, 172, 138, 65, 39,
+207, 207, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 201, 201, 201,
+188, 188, 176, 141, 66, 40, 193, 193, 193, 193, 193, 193, 193, 193, 193,
+193, 193, 193, 194, 194, 194, 184, 184, 173, 139, 65, 39, 204, 204, 204,
+204, 204, 204, 204, 204, 201, 201, 201, 201, 198, 198, 198, 187, 187, 175,
+140, 66, 40, };
+#endif
+
+#ifdef ENABLE_QEXT
+# ifndef DEF_QEXT_PULSE_CACHE50
+# define DEF_QEXT_PULSE_CACHE50
+static const opus_int16 qext_cache_index50[70] = {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41,
+41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 61, 61,
+61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 72, 72, 72,
+72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 80, 80, 80, 80,
+80, 80, 80, 80, 80, 80, 80, 80, 80, 80, };
+static const unsigned char qext_cache_bits50[86] = {
+40, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125,
+128, 131, 136, 141, 146, 150, 153, 157, 160, 163, 168, 173, 178, 182, 185,
+189, 192, 195, 200, 205, 210, 214, 217, 221, 224, 227, 19, 34, 61, 83,
+101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216, 222, 234, 245,
+254, 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253, 7, 50, 93,
+131, 165, 197, 227, 255, 5, 58, 109, 155, 197, 237, };
+static const unsigned char qext_cache_caps50[112] = {
+159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 171,
+171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 167, 167, 167,
+167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 166, 166, 166, 166, 166,
+166, 166, 166, 166, 166, 166, 166, 166, 166, 163, 163, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 165, 165, 165, 165, 165, 165, 165,
+165, 165, 165, 165, 165, 165, 165, };
+# endif
+#endif
+
+#ifndef FFT_TWIDDLES96000_1920
+#define FFT_TWIDDLES96000_1920
+static const kiss_twiddle_cpx fft_twiddles96000_1920[960] = {
+#ifdef ENABLE_QEXT
+{2147483647, 0}, {2147437652, -14055147},
+{2147299668, -28109692}, {2147069700, -42163034},
+{2146747759, -56214568}, {2146333858, -70263695},
+{2145828016, -84309812}, {2145230253, -98352318},
+{2144540596, -112390610}, {2143759074, -126424088},
+{2142885721, -140452151}, {2141920573, -154474196},
+{2140863673, -168489625}, {2139715065, -182497836},
+{2138474799, -196498230}, {2137142927, -210490206},
+{2135719508, -224473166}, {2134204601, -238446509},
+{2132598273, -252409639}, {2130900591, -266361956},
+{2129111628, -280302863}, {2127231461, -294231763},
+{2125260170, -308148059}, {2123197841, -322051155},
+{2121044561, -335940456}, {2118800422, -349815365},
+{2116465521, -363675290}, {2114039958, -377519637},
+{2111523836, -391347811}, {2108917263, -405159222},
+{2106220352, -418953276}, {2103433217, -432729385},
+{2100555978, -446486956}, {2097588758, -460225402},
+{2094531684, -473944133}, {2091384888, -487642562},
+{2088148504, -501320102}, {2084822670, -514976167},
+{2081407530, -528610172}, {2077903229, -542221533},
+{2074309917, -555809667}, {2070627749, -569373992},
+{2066856882, -582913927}, {2062997478, -596428893},
+{2059049702, -609918309}, {2055013723, -623381598},
+{2050889714, -636818183}, {2046677852, -650227490},
+{2042378317, -663608942}, {2037991293, -676961968},
+{2033516969, -690285996}, {2028955535, -703580453},
+{2024307188, -716844772}, {2019572126, -730078383},
+{2014750553, -743280720}, {2009842674, -756451218},
+{2004848700, -769589312}, {1999768845, -782694439},
+{1994603327, -795766038}, {1989352366, -808803549},
+{1984016189, -821806413}, {1978595022, -834774075},
+{1973089100, -847705977}, {1967498656, -860601566},
+{1961823932, -873460290}, {1956065170, -886281598},
+{1950222616, -899064940}, {1944296521, -911809770},
+{1938287139, -924515541}, {1932194727, -937181708},
+{1926019547, -949807730}, {1919761862, -962393065},
+{1913421941, -974937175}, {1907000055, -987439521},
+{1900496480, -999899569}, {1893911494, -1012316784},
+{1887245379, -1024690635}, {1880498421, -1037020592},
+{1873670908, -1049306126}, {1866763134, -1061546712},
+{1859775393, -1073741824}, {1852707986, -1085890941},
+{1845561216, -1097993542}, {1838335387, -1110049108},
+{1831030811, -1122057124}, {1823647799, -1134017074},
+{1816186668, -1145928447}, {1808647737, -1157790732},
+{1801031331, -1169603422}, {1793337774, -1181366009},
+{1785567396, -1193077991}, {1777720531, -1204738865},
+{1769797514, -1216348132}, {1761798685, -1227905295},
+{1753724386, -1239409858}, {1745574963, -1250861329},
+{1737350766, -1262259218}, {1729052147, -1273603035},
+{1720679461, -1284892296}, {1712233066, -1296126516},
+{1703713325, -1307305214}, {1695120603, -1318427912},
+{1686455268, -1329494133}, {1677717690, -1340503402},
+{1668908244, -1351455249}, {1660027308, -1362349204},
+{1651075262, -1373184801}, {1642052490, -1383961574},
+{1632959377, -1394679064}, {1623796314, -1405336810},
+{1614563692, -1415934356}, {1605261909, -1426471249},
+{1595891361, -1436947036}, {1586452450, -1447361268},
+{1576945581, -1457713501}, {1567371161, -1468003290},
+{1557729600, -1478230195}, {1548021312, -1488393778},
+{1538246711, -1498493602}, {1528406216, -1508529236},
+{1518500250, -1518500250}, {1508529236, -1528406216},
+{1498493602, -1538246711}, {1488393778, -1548021312},
+{1478230195, -1557729600}, {1468003290, -1567371161},
+{1457713501, -1576945581}, {1447361268, -1586452450},
+{1436947036, -1595891361}, {1426471249, -1605261909},
+{1415934356, -1614563692}, {1405336810, -1623796314},
+{1394679064, -1632959377}, {1383961574, -1642052490},
+{1373184801, -1651075262}, {1362349204, -1660027308},
+{1351455249, -1668908244}, {1340503402, -1677717690},
+{1329494133, -1686455268}, {1318427912, -1695120603},
+{1307305214, -1703713325}, {1296126516, -1712233066},
+{1284892296, -1720679461}, {1273603035, -1729052147},
+{1262259218, -1737350766}, {1250861329, -1745574963},
+{1239409858, -1753724386}, {1227905295, -1761798685},
+{1216348132, -1769797514}, {1204738865, -1777720531},
+{1193077991, -1785567396}, {1181366009, -1793337774},
+{1169603422, -1801031331}, {1157790732, -1808647737},
+{1145928447, -1816186668}, {1134017074, -1823647799},
+{1122057124, -1831030811}, {1110049108, -1838335387},
+{1097993542, -1845561216}, {1085890941, -1852707986},
+{1073741824, -1859775393}, {1061546712, -1866763134},
+{1049306126, -1873670908}, {1037020592, -1880498421},
+{1024690635, -1887245379}, {1012316784, -1893911494},
+{999899569, -1900496480}, {987439521, -1907000055},
+{974937175, -1913421941}, {962393065, -1919761862},
+{949807730, -1926019547}, {937181708, -1932194727},
+{924515541, -1938287139}, {911809770, -1944296521},
+{899064940, -1950222616}, {886281598, -1956065170},
+{873460290, -1961823932}, {860601566, -1967498656},
+{847705977, -1973089100}, {834774075, -1978595022},
+{821806413, -1984016189}, {808803549, -1989352366},
+{795766038, -1994603327}, {782694439, -1999768845},
+{769589312, -2004848700}, {756451218, -2009842674},
+{743280720, -2014750553}, {730078383, -2019572126},
+{716844772, -2024307188}, {703580453, -2028955535},
+{690285996, -2033516969}, {676961968, -2037991293},
+{663608942, -2042378317}, {650227490, -2046677852},
+{636818183, -2050889714}, {623381598, -2055013723},
+{609918309, -2059049702}, {596428893, -2062997478},
+{582913927, -2066856882}, {569373992, -2070627749},
+{555809667, -2074309917}, {542221533, -2077903229},
+{528610172, -2081407530}, {514976167, -2084822670},
+{501320102, -2088148504}, {487642562, -2091384888},
+{473944133, -2094531684}, {460225402, -2097588758},
+{446486956, -2100555978}, {432729385, -2103433217},
+{418953276, -2106220352}, {405159222, -2108917263},
+{391347811, -2111523836}, {377519637, -2114039958},
+{363675290, -2116465521}, {349815365, -2118800422},
+{335940456, -2121044561}, {322051155, -2123197841},
+{308148059, -2125260170}, {294231763, -2127231461},
+{280302863, -2129111628}, {266361956, -2130900591},
+{252409639, -2132598273}, {238446509, -2134204601},
+{224473166, -2135719508}, {210490206, -2137142927},
+{196498230, -2138474799}, {182497836, -2139715065},
+{168489625, -2140863673}, {154474196, -2141920573},
+{140452151, -2142885721}, {126424088, -2143759074},
+{112390610, -2144540596}, {98352318, -2145230253},
+{84309812, -2145828016}, {70263695, -2146333858},
+{56214568, -2146747759}, {42163034, -2147069700},
+{28109692, -2147299668}, {14055147, -2147437652},
+{0, -2147483648}, {-14055147, -2147437652},
+{-28109692, -2147299668}, {-42163034, -2147069700},
+{-56214568, -2146747759}, {-70263695, -2146333858},
+{-84309812, -2145828016}, {-98352318, -2145230253},
+{-112390610, -2144540596}, {-126424088, -2143759074},
+{-140452151, -2142885721}, {-154474196, -2141920573},
+{-168489625, -2140863673}, {-182497836, -2139715065},
+{-196498230, -2138474799}, {-210490206, -2137142927},
+{-224473166, -2135719508}, {-238446509, -2134204601},
+{-252409639, -2132598273}, {-266361956, -2130900591},
+{-280302863, -2129111628}, {-294231763, -2127231461},
+{-308148059, -2125260170}, {-322051155, -2123197841},
+{-335940456, -2121044561}, {-349815365, -2118800422},
+{-363675290, -2116465521}, {-377519637, -2114039958},
+{-391347811, -2111523836}, {-405159222, -2108917263},
+{-418953276, -2106220352}, {-432729385, -2103433217},
+{-446486956, -2100555978}, {-460225402, -2097588758},
+{-473944133, -2094531684}, {-487642562, -2091384888},
+{-501320102, -2088148504}, {-514976167, -2084822670},
+{-528610172, -2081407530}, {-542221533, -2077903229},
+{-555809667, -2074309917}, {-569373992, -2070627749},
+{-582913927, -2066856882}, {-596428893, -2062997478},
+{-609918309, -2059049702}, {-623381598, -2055013723},
+{-636818183, -2050889714}, {-650227490, -2046677852},
+{-663608942, -2042378317}, {-676961968, -2037991293},
+{-690285996, -2033516969}, {-703580453, -2028955535},
+{-716844772, -2024307188}, {-730078383, -2019572126},
+{-743280720, -2014750553}, {-756451218, -2009842674},
+{-769589312, -2004848700}, {-782694439, -1999768845},
+{-795766038, -1994603327}, {-808803549, -1989352366},
+{-821806413, -1984016189}, {-834774075, -1978595022},
+{-847705977, -1973089100}, {-860601566, -1967498656},
+{-873460290, -1961823932}, {-886281598, -1956065170},
+{-899064940, -1950222616}, {-911809770, -1944296521},
+{-924515541, -1938287139}, {-937181708, -1932194727},
+{-949807730, -1926019547}, {-962393065, -1919761862},
+{-974937175, -1913421941}, {-987439521, -1907000055},
+{-999899569, -1900496480}, {-1012316784, -1893911494},
+{-1024690635, -1887245379}, {-1037020592, -1880498421},
+{-1049306126, -1873670908}, {-1061546712, -1866763134},
+{-1073741824, -1859775393}, {-1085890941, -1852707986},
+{-1097993542, -1845561216}, {-1110049108, -1838335387},
+{-1122057124, -1831030811}, {-1134017074, -1823647799},
+{-1145928447, -1816186668}, {-1157790732, -1808647737},
+{-1169603422, -1801031331}, {-1181366009, -1793337774},
+{-1193077991, -1785567396}, {-1204738865, -1777720531},
+{-1216348132, -1769797514}, {-1227905295, -1761798685},
+{-1239409858, -1753724386}, {-1250861329, -1745574963},
+{-1262259218, -1737350766}, {-1273603035, -1729052147},
+{-1284892296, -1720679461}, {-1296126516, -1712233066},
+{-1307305214, -1703713325}, {-1318427912, -1695120603},
+{-1329494133, -1686455268}, {-1340503402, -1677717690},
+{-1351455249, -1668908244}, {-1362349204, -1660027308},
+{-1373184801, -1651075262}, {-1383961574, -1642052490},
+{-1394679064, -1632959377}, {-1405336810, -1623796314},
+{-1415934356, -1614563692}, {-1426471249, -1605261909},
+{-1436947036, -1595891361}, {-1447361268, -1586452450},
+{-1457713501, -1576945581}, {-1468003290, -1567371161},
+{-1478230195, -1557729600}, {-1488393778, -1548021312},
+{-1498493602, -1538246711}, {-1508529236, -1528406216},
+{-1518500250, -1518500250}, {-1528406216, -1508529236},
+{-1538246711, -1498493602}, {-1548021312, -1488393778},
+{-1557729600, -1478230195}, {-1567371161, -1468003290},
+{-1576945581, -1457713501}, {-1586452450, -1447361268},
+{-1595891361, -1436947036}, {-1605261909, -1426471249},
+{-1614563692, -1415934356}, {-1623796314, -1405336810},
+{-1632959377, -1394679064}, {-1642052490, -1383961574},
+{-1651075262, -1373184801}, {-1660027308, -1362349204},
+{-1668908244, -1351455249}, {-1677717690, -1340503402},
+{-1686455268, -1329494133}, {-1695120603, -1318427912},
+{-1703713325, -1307305214}, {-1712233066, -1296126516},
+{-1720679461, -1284892296}, {-1729052147, -1273603035},
+{-1737350766, -1262259218}, {-1745574963, -1250861329},
+{-1753724386, -1239409858}, {-1761798685, -1227905295},
+{-1769797514, -1216348132}, {-1777720531, -1204738865},
+{-1785567396, -1193077991}, {-1793337774, -1181366009},
+{-1801031331, -1169603422}, {-1808647737, -1157790732},
+{-1816186668, -1145928447}, {-1823647799, -1134017074},
+{-1831030811, -1122057124}, {-1838335387, -1110049108},
+{-1845561216, -1097993542}, {-1852707986, -1085890941},
+{-1859775393, -1073741824}, {-1866763134, -1061546712},
+{-1873670908, -1049306126}, {-1880498421, -1037020592},
+{-1887245379, -1024690635}, {-1893911494, -1012316784},
+{-1900496480, -999899569}, {-1907000055, -987439521},
+{-1913421941, -974937175}, {-1919761862, -962393065},
+{-1926019547, -949807730}, {-1932194727, -937181708},
+{-1938287139, -924515541}, {-1944296521, -911809770},
+{-1950222616, -899064940}, {-1956065170, -886281598},
+{-1961823932, -873460290}, {-1967498656, -860601566},
+{-1973089100, -847705977}, {-1978595022, -834774075},
+{-1984016189, -821806413}, {-1989352366, -808803549},
+{-1994603327, -795766038}, {-1999768845, -782694439},
+{-2004848700, -769589312}, {-2009842674, -756451218},
+{-2014750553, -743280720}, {-2019572126, -730078383},
+{-2024307188, -716844772}, {-2028955535, -703580453},
+{-2033516969, -690285996}, {-2037991293, -676961968},
+{-2042378317, -663608942}, {-2046677852, -650227490},
+{-2050889714, -636818183}, {-2055013723, -623381598},
+{-2059049702, -609918309}, {-2062997478, -596428893},
+{-2066856882, -582913927}, {-2070627749, -569373992},
+{-2074309917, -555809667}, {-2077903229, -542221533},
+{-2081407530, -528610172}, {-2084822670, -514976167},
+{-2088148504, -501320102}, {-2091384888, -487642562},
+{-2094531684, -473944133}, {-2097588758, -460225402},
+{-2100555978, -446486956}, {-2103433217, -432729385},
+{-2106220352, -418953276}, {-2108917263, -405159222},
+{-2111523836, -391347811}, {-2114039958, -377519637},
+{-2116465521, -363675290}, {-2118800422, -349815365},
+{-2121044561, -335940456}, {-2123197841, -322051155},
+{-2125260170, -308148059}, {-2127231461, -294231763},
+{-2129111628, -280302863}, {-2130900591, -266361956},
+{-2132598273, -252409639}, {-2134204601, -238446509},
+{-2135719508, -224473166}, {-2137142927, -210490206},
+{-2138474799, -196498230}, {-2139715065, -182497836},
+{-2140863673, -168489625}, {-2141920573, -154474196},
+{-2142885721, -140452151}, {-2143759074, -126424088},
+{-2144540596, -112390610}, {-2145230253, -98352318},
+{-2145828016, -84309812}, {-2146333858, -70263695},
+{-2146747759, -56214568}, {-2147069700, -42163034},
+{-2147299668, -28109692}, {-2147437652, -14055147},
+{-2147483648, 0}, {-2147437652, 14055147},
+{-2147299668, 28109692}, {-2147069700, 42163034},
+{-2146747759, 56214568}, {-2146333858, 70263695},
+{-2145828016, 84309812}, {-2145230253, 98352318},
+{-2144540596, 112390610}, {-2143759074, 126424088},
+{-2142885721, 140452151}, {-2141920573, 154474196},
+{-2140863673, 168489625}, {-2139715065, 182497836},
+{-2138474799, 196498230}, {-2137142927, 210490206},
+{-2135719508, 224473166}, {-2134204601, 238446509},
+{-2132598273, 252409639}, {-2130900591, 266361956},
+{-2129111628, 280302863}, {-2127231461, 294231763},
+{-2125260170, 308148059}, {-2123197841, 322051155},
+{-2121044561, 335940456}, {-2118800422, 349815365},
+{-2116465521, 363675290}, {-2114039958, 377519637},
+{-2111523836, 391347811}, {-2108917263, 405159222},
+{-2106220352, 418953276}, {-2103433217, 432729385},
+{-2100555978, 446486956}, {-2097588758, 460225402},
+{-2094531684, 473944133}, {-2091384888, 487642562},
+{-2088148504, 501320102}, {-2084822670, 514976167},
+{-2081407530, 528610172}, {-2077903229, 542221533},
+{-2074309917, 555809667}, {-2070627749, 569373992},
+{-2066856882, 582913927}, {-2062997478, 596428893},
+{-2059049702, 609918309}, {-2055013723, 623381598},
+{-2050889714, 636818183}, {-2046677852, 650227490},
+{-2042378317, 663608942}, {-2037991293, 676961968},
+{-2033516969, 690285996}, {-2028955535, 703580453},
+{-2024307188, 716844772}, {-2019572126, 730078383},
+{-2014750553, 743280720}, {-2009842674, 756451218},
+{-2004848700, 769589312}, {-1999768845, 782694439},
+{-1994603327, 795766038}, {-1989352366, 808803549},
+{-1984016189, 821806413}, {-1978595022, 834774075},
+{-1973089100, 847705977}, {-1967498656, 860601566},
+{-1961823932, 873460290}, {-1956065170, 886281598},
+{-1950222616, 899064940}, {-1944296521, 911809770},
+{-1938287139, 924515541}, {-1932194727, 937181708},
+{-1926019547, 949807730}, {-1919761862, 962393065},
+{-1913421941, 974937175}, {-1907000055, 987439521},
+{-1900496480, 999899569}, {-1893911494, 1012316784},
+{-1887245379, 1024690635}, {-1880498421, 1037020592},
+{-1873670908, 1049306126}, {-1866763134, 1061546712},
+{-1859775393, 1073741824}, {-1852707986, 1085890941},
+{-1845561216, 1097993542}, {-1838335387, 1110049108},
+{-1831030811, 1122057124}, {-1823647799, 1134017074},
+{-1816186668, 1145928447}, {-1808647737, 1157790732},
+{-1801031331, 1169603422}, {-1793337774, 1181366009},
+{-1785567396, 1193077991}, {-1777720531, 1204738865},
+{-1769797514, 1216348132}, {-1761798685, 1227905295},
+{-1753724386, 1239409858}, {-1745574963, 1250861329},
+{-1737350766, 1262259218}, {-1729052147, 1273603035},
+{-1720679461, 1284892296}, {-1712233066, 1296126516},
+{-1703713325, 1307305214}, {-1695120603, 1318427912},
+{-1686455268, 1329494133}, {-1677717690, 1340503402},
+{-1668908244, 1351455249}, {-1660027308, 1362349204},
+{-1651075262, 1373184801}, {-1642052490, 1383961574},
+{-1632959377, 1394679064}, {-1623796314, 1405336810},
+{-1614563692, 1415934356}, {-1605261909, 1426471249},
+{-1595891361, 1436947036}, {-1586452450, 1447361268},
+{-1576945581, 1457713501}, {-1567371161, 1468003290},
+{-1557729600, 1478230195}, {-1548021312, 1488393778},
+{-1538246711, 1498493602}, {-1528406216, 1508529236},
+{-1518500250, 1518500250}, {-1508529236, 1528406216},
+{-1498493602, 1538246711}, {-1488393778, 1548021312},
+{-1478230195, 1557729600}, {-1468003290, 1567371161},
+{-1457713501, 1576945581}, {-1447361268, 1586452450},
+{-1436947036, 1595891361}, {-1426471249, 1605261909},
+{-1415934356, 1614563692}, {-1405336810, 1623796314},
+{-1394679064, 1632959377}, {-1383961574, 1642052490},
+{-1373184801, 1651075262}, {-1362349204, 1660027308},
+{-1351455249, 1668908244}, {-1340503402, 1677717690},
+{-1329494133, 1686455268}, {-1318427912, 1695120603},
+{-1307305214, 1703713325}, {-1296126516, 1712233066},
+{-1284892296, 1720679461}, {-1273603035, 1729052147},
+{-1262259218, 1737350766}, {-1250861329, 1745574963},
+{-1239409858, 1753724386}, {-1227905295, 1761798685},
+{-1216348132, 1769797514}, {-1204738865, 1777720531},
+{-1193077991, 1785567396}, {-1181366009, 1793337774},
+{-1169603422, 1801031331}, {-1157790732, 1808647737},
+{-1145928447, 1816186668}, {-1134017074, 1823647799},
+{-1122057124, 1831030811}, {-1110049108, 1838335387},
+{-1097993542, 1845561216}, {-1085890941, 1852707986},
+{-1073741824, 1859775393}, {-1061546712, 1866763134},
+{-1049306126, 1873670908}, {-1037020592, 1880498421},
+{-1024690635, 1887245379}, {-1012316784, 1893911494},
+{-999899569, 1900496480}, {-987439521, 1907000055},
+{-974937175, 1913421941}, {-962393065, 1919761862},
+{-949807730, 1926019547}, {-937181708, 1932194727},
+{-924515541, 1938287139}, {-911809770, 1944296521},
+{-899064940, 1950222616}, {-886281598, 1956065170},
+{-873460290, 1961823932}, {-860601566, 1967498656},
+{-847705977, 1973089100}, {-834774075, 1978595022},
+{-821806413, 1984016189}, {-808803549, 1989352366},
+{-795766038, 1994603327}, {-782694439, 1999768845},
+{-769589312, 2004848700}, {-756451218, 2009842674},
+{-743280720, 2014750553}, {-730078383, 2019572126},
+{-716844772, 2024307188}, {-703580453, 2028955535},
+{-690285996, 2033516969}, {-676961968, 2037991293},
+{-663608942, 2042378317}, {-650227490, 2046677852},
+{-636818183, 2050889714}, {-623381598, 2055013723},
+{-609918309, 2059049702}, {-596428893, 2062997478},
+{-582913927, 2066856882}, {-569373992, 2070627749},
+{-555809667, 2074309917}, {-542221533, 2077903229},
+{-528610172, 2081407530}, {-514976167, 2084822670},
+{-501320102, 2088148504}, {-487642562, 2091384888},
+{-473944133, 2094531684}, {-460225402, 2097588758},
+{-446486956, 2100555978}, {-432729385, 2103433217},
+{-418953276, 2106220352}, {-405159222, 2108917263},
+{-391347811, 2111523836}, {-377519637, 2114039958},
+{-363675290, 2116465521}, {-349815365, 2118800422},
+{-335940456, 2121044561}, {-322051155, 2123197841},
+{-308148059, 2125260170}, {-294231763, 2127231461},
+{-280302863, 2129111628}, {-266361956, 2130900591},
+{-252409639, 2132598273}, {-238446509, 2134204601},
+{-224473166, 2135719508}, {-210490206, 2137142927},
+{-196498230, 2138474799}, {-182497836, 2139715065},
+{-168489625, 2140863673}, {-154474196, 2141920573},
+{-140452151, 2142885721}, {-126424088, 2143759074},
+{-112390610, 2144540596}, {-98352318, 2145230253},
+{-84309812, 2145828016}, {-70263695, 2146333858},
+{-56214568, 2146747759}, {-42163034, 2147069700},
+{-28109692, 2147299668}, {-14055147, 2147437652},
+{0, 2147483647}, {14055147, 2147437652},
+{28109692, 2147299668}, {42163034, 2147069700},
+{56214568, 2146747759}, {70263695, 2146333858},
+{84309812, 2145828016}, {98352318, 2145230253},
+{112390610, 2144540596}, {126424088, 2143759074},
+{140452151, 2142885721}, {154474196, 2141920573},
+{168489625, 2140863673}, {182497836, 2139715065},
+{196498230, 2138474799}, {210490206, 2137142927},
+{224473166, 2135719508}, {238446509, 2134204601},
+{252409639, 2132598273}, {266361956, 2130900591},
+{280302863, 2129111628}, {294231763, 2127231461},
+{308148059, 2125260170}, {322051155, 2123197841},
+{335940456, 2121044561}, {349815365, 2118800422},
+{363675290, 2116465521}, {377519637, 2114039958},
+{391347811, 2111523836}, {405159222, 2108917263},
+{418953276, 2106220352}, {432729385, 2103433217},
+{446486956, 2100555978}, {460225402, 2097588758},
+{473944133, 2094531684}, {487642562, 2091384888},
+{501320102, 2088148504}, {514976167, 2084822670},
+{528610172, 2081407530}, {542221533, 2077903229},
+{555809667, 2074309917}, {569373992, 2070627749},
+{582913927, 2066856882}, {596428893, 2062997478},
+{609918309, 2059049702}, {623381598, 2055013723},
+{636818183, 2050889714}, {650227490, 2046677852},
+{663608942, 2042378317}, {676961968, 2037991293},
+{690285996, 2033516969}, {703580453, 2028955535},
+{716844772, 2024307188}, {730078383, 2019572126},
+{743280720, 2014750553}, {756451218, 2009842674},
+{769589312, 2004848700}, {782694439, 1999768845},
+{795766038, 1994603327}, {808803549, 1989352366},
+{821806413, 1984016189}, {834774075, 1978595022},
+{847705977, 1973089100}, {860601566, 1967498656},
+{873460290, 1961823932}, {886281598, 1956065170},
+{899064940, 1950222616}, {911809770, 1944296521},
+{924515541, 1938287139}, {937181708, 1932194727},
+{949807730, 1926019547}, {962393065, 1919761862},
+{974937175, 1913421941}, {987439521, 1907000055},
+{999899569, 1900496480}, {1012316784, 1893911494},
+{1024690635, 1887245379}, {1037020592, 1880498421},
+{1049306126, 1873670908}, {1061546712, 1866763134},
+{1073741824, 1859775393}, {1085890941, 1852707986},
+{1097993542, 1845561216}, {1110049108, 1838335387},
+{1122057124, 1831030811}, {1134017074, 1823647799},
+{1145928447, 1816186668}, {1157790732, 1808647737},
+{1169603422, 1801031331}, {1181366009, 1793337774},
+{1193077991, 1785567396}, {1204738865, 1777720531},
+{1216348132, 1769797514}, {1227905295, 1761798685},
+{1239409858, 1753724386}, {1250861329, 1745574963},
+{1262259218, 1737350766}, {1273603035, 1729052147},
+{1284892296, 1720679461}, {1296126516, 1712233066},
+{1307305214, 1703713325}, {1318427912, 1695120603},
+{1329494133, 1686455268}, {1340503402, 1677717690},
+{1351455249, 1668908244}, {1362349204, 1660027308},
+{1373184801, 1651075262}, {1383961574, 1642052490},
+{1394679064, 1632959377}, {1405336810, 1623796314},
+{1415934356, 1614563692}, {1426471249, 1605261909},
+{1436947036, 1595891361}, {1447361268, 1586452450},
+{1457713501, 1576945581}, {1468003290, 1567371161},
+{1478230195, 1557729600}, {1488393778, 1548021312},
+{1498493602, 1538246711}, {1508529236, 1528406216},
+{1518500250, 1518500250}, {1528406216, 1508529236},
+{1538246711, 1498493602}, {1548021312, 1488393778},
+{1557729600, 1478230195}, {1567371161, 1468003290},
+{1576945581, 1457713501}, {1586452450, 1447361268},
+{1595891361, 1436947036}, {1605261909, 1426471249},
+{1614563692, 1415934356}, {1623796314, 1405336810},
+{1632959377, 1394679064}, {1642052490, 1383961574},
+{1651075262, 1373184801}, {1660027308, 1362349204},
+{1668908244, 1351455249}, {1677717690, 1340503402},
+{1686455268, 1329494133}, {1695120603, 1318427912},
+{1703713325, 1307305214}, {1712233066, 1296126516},
+{1720679461, 1284892296}, {1729052147, 1273603035},
+{1737350766, 1262259218}, {1745574963, 1250861329},
+{1753724386, 1239409858}, {1761798685, 1227905295},
+{1769797514, 1216348132}, {1777720531, 1204738865},
+{1785567396, 1193077991}, {1793337774, 1181366009},
+{1801031331, 1169603422}, {1808647737, 1157790732},
+{1816186668, 1145928447}, {1823647799, 1134017074},
+{1831030811, 1122057124}, {1838335387, 1110049108},
+{1845561216, 1097993542}, {1852707986, 1085890941},
+{1859775393, 1073741824}, {1866763134, 1061546712},
+{1873670908, 1049306126}, {1880498421, 1037020592},
+{1887245379, 1024690635}, {1893911494, 1012316784},
+{1900496480, 999899569}, {1907000055, 987439521},
+{1913421941, 974937175}, {1919761862, 962393065},
+{1926019547, 949807730}, {1932194727, 937181708},
+{1938287139, 924515541}, {1944296521, 911809770},
+{1950222616, 899064940}, {1956065170, 886281598},
+{1961823932, 873460290}, {1967498656, 860601566},
+{1973089100, 847705977}, {1978595022, 834774075},
+{1984016189, 821806413}, {1989352366, 808803549},
+{1994603327, 795766038}, {1999768845, 782694439},
+{2004848700, 769589312}, {2009842674, 756451218},
+{2014750553, 743280720}, {2019572126, 730078383},
+{2024307188, 716844772}, {2028955535, 703580453},
+{2033516969, 690285996}, {2037991293, 676961968},
+{2042378317, 663608942}, {2046677852, 650227490},
+{2050889714, 636818183}, {2055013723, 623381598},
+{2059049702, 609918309}, {2062997478, 596428893},
+{2066856882, 582913927}, {2070627749, 569373992},
+{2074309917, 555809667}, {2077903229, 542221533},
+{2081407530, 528610172}, {2084822670, 514976167},
+{2088148504, 501320102}, {2091384888, 487642562},
+{2094531684, 473944133}, {2097588758, 460225402},
+{2100555978, 446486956}, {2103433217, 432729385},
+{2106220352, 418953276}, {2108917263, 405159222},
+{2111523836, 391347811}, {2114039958, 377519637},
+{2116465521, 363675290}, {2118800422, 349815365},
+{2121044561, 335940456}, {2123197841, 322051155},
+{2125260170, 308148059}, {2127231461, 294231763},
+{2129111628, 280302863}, {2130900591, 266361956},
+{2132598273, 252409639}, {2134204601, 238446509},
+{2135719508, 224473166}, {2137142927, 210490206},
+{2138474799, 196498230}, {2139715065, 182497836},
+{2140863673, 168489625}, {2141920573, 154474196},
+{2142885721, 140452151}, {2143759074, 126424088},
+{2144540596, 112390610}, {2145230253, 98352318},
+{2145828016, 84309812}, {2146333858, 70263695},
+{2146747759, 56214568}, {2147069700, 42163034},
+{2147299668, 28109692}, {2147437652, 14055147},
+#else
+{32767, 0}, {32767, -214},
+{32765, -429}, {32762, -643},
+{32757, -858}, {32750, -1072},
+{32743, -1286}, {32734, -1501},
+{32723, -1715}, {32711, -1929},
+{32698, -2143}, {32683, -2357},
+{32667, -2571}, {32649, -2785},
+{32631, -2998}, {32610, -3212},
+{32588, -3425}, {32565, -3638},
+{32541, -3851}, {32515, -4064},
+{32488, -4277}, {32459, -4490},
+{32429, -4702}, {32397, -4914},
+{32365, -5126}, {32330, -5338},
+{32295, -5549}, {32258, -5760},
+{32219, -5971}, {32180, -6182},
+{32138, -6393}, {32096, -6603},
+{32052, -6813}, {32007, -7022},
+{31960, -7232}, {31912, -7441},
+{31863, -7650}, {31812, -7858},
+{31760, -8066}, {31706, -8274},
+{31651, -8481}, {31595, -8688},
+{31538, -8895}, {31479, -9101},
+{31419, -9307}, {31357, -9512},
+{31294, -9717}, {31230, -9922},
+{31164, -10126}, {31097, -10330},
+{31029, -10533}, {30959, -10736},
+{30888, -10938}, {30816, -11140},
+{30743, -11342}, {30668, -11543},
+{30592, -11743}, {30514, -11943},
+{30435, -12142}, {30355, -12341},
+{30274, -12540}, {30191, -12738},
+{30107, -12935}, {30022, -13132},
+{29935, -13328}, {29847, -13524},
+{29758, -13719}, {29668, -13913},
+{29576, -14107}, {29483, -14300},
+{29389, -14493}, {29293, -14685},
+{29197, -14876}, {29099, -15067},
+{28999, -15257}, {28899, -15447},
+{28797, -15636}, {28694, -15824},
+{28590, -16011}, {28485, -16198},
+{28378, -16384}, {28270, -16569},
+{28161, -16754}, {28051, -16938},
+{27939, -17121}, {27827, -17304},
+{27713, -17485}, {27598, -17666},
+{27482, -17847}, {27364, -18026},
+{27246, -18205}, {27126, -18383},
+{27005, -18560}, {26883, -18736},
+{26760, -18912}, {26635, -19087},
+{26510, -19261}, {26383, -19434},
+{26255, -19606}, {26127, -19777},
+{25997, -19948}, {25865, -20118},
+{25733, -20286}, {25600, -20454},
+{25466, -20622}, {25330, -20788},
+{25193, -20953}, {25056, -21118},
+{24917, -21281}, {24777, -21444},
+{24636, -21605}, {24494, -21766},
+{24351, -21926}, {24207, -22085},
+{24062, -22243}, {23916, -22400},
+{23769, -22556}, {23621, -22711},
+{23472, -22865}, {23322, -23018},
+{23170, -23170}, {23018, -23322},
+{22865, -23472}, {22711, -23621},
+{22556, -23769}, {22400, -23916},
+{22243, -24062}, {22085, -24207},
+{21926, -24351}, {21766, -24494},
+{21605, -24636}, {21444, -24777},
+{21281, -24917}, {21118, -25056},
+{20953, -25193}, {20788, -25330},
+{20622, -25466}, {20454, -25600},
+{20286, -25733}, {20118, -25865},
+{19948, -25997}, {19777, -26127},
+{19606, -26255}, {19434, -26383},
+{19261, -26510}, {19087, -26635},
+{18912, -26760}, {18736, -26883},
+{18560, -27005}, {18383, -27126},
+{18205, -27246}, {18026, -27364},
+{17847, -27482}, {17666, -27598},
+{17485, -27713}, {17304, -27827},
+{17121, -27939}, {16938, -28051},
+{16754, -28161}, {16569, -28270},
+{16384, -28378}, {16198, -28485},
+{16011, -28590}, {15824, -28694},
+{15636, -28797}, {15447, -28899},
+{15257, -28999}, {15067, -29099},
+{14876, -29197}, {14685, -29293},
+{14493, -29389}, {14300, -29483},
+{14107, -29576}, {13913, -29668},
+{13719, -29758}, {13524, -29847},
+{13328, -29935}, {13132, -30022},
+{12935, -30107}, {12738, -30191},
+{12540, -30274}, {12341, -30355},
+{12142, -30435}, {11943, -30514},
+{11743, -30592}, {11543, -30668},
+{11342, -30743}, {11140, -30816},
+{10938, -30888}, {10736, -30959},
+{10533, -31029}, {10330, -31097},
+{10126, -31164}, {9922, -31230},
+{9717, -31294}, {9512, -31357},
+{9307, -31419}, {9101, -31479},
+{8895, -31538}, {8688, -31595},
+{8481, -31651}, {8274, -31706},
+{8066, -31760}, {7858, -31812},
+{7650, -31863}, {7441, -31912},
+{7232, -31960}, {7022, -32007},
+{6813, -32052}, {6603, -32096},
+{6393, -32138}, {6182, -32180},
+{5971, -32219}, {5760, -32258},
+{5549, -32295}, {5338, -32330},
+{5126, -32365}, {4914, -32397},
+{4702, -32429}, {4490, -32459},
+{4277, -32488}, {4064, -32515},
+{3851, -32541}, {3638, -32565},
+{3425, -32588}, {3212, -32610},
+{2998, -32631}, {2785, -32649},
+{2571, -32667}, {2357, -32683},
+{2143, -32698}, {1929, -32711},
+{1715, -32723}, {1501, -32734},
+{1286, -32743}, {1072, -32750},
+{858, -32757}, {643, -32762},
+{429, -32765}, {214, -32767},
+{0, -32767}, {-214, -32767},
+{-429, -32765}, {-643, -32762},
+{-858, -32757}, {-1072, -32750},
+{-1286, -32743}, {-1501, -32734},
+{-1715, -32723}, {-1929, -32711},
+{-2143, -32698}, {-2357, -32683},
+{-2571, -32667}, {-2785, -32649},
+{-2998, -32631}, {-3212, -32610},
+{-3425, -32588}, {-3638, -32565},
+{-3851, -32541}, {-4064, -32515},
+{-4277, -32488}, {-4490, -32459},
+{-4702, -32429}, {-4914, -32397},
+{-5126, -32365}, {-5338, -32330},
+{-5549, -32295}, {-5760, -32258},
+{-5971, -32219}, {-6182, -32180},
+{-6393, -32138}, {-6603, -32096},
+{-6813, -32052}, {-7022, -32007},
+{-7232, -31960}, {-7441, -31912},
+{-7650, -31863}, {-7858, -31812},
+{-8066, -31760}, {-8274, -31706},
+{-8481, -31651}, {-8688, -31595},
+{-8895, -31538}, {-9101, -31479},
+{-9307, -31419}, {-9512, -31357},
+{-9717, -31294}, {-9922, -31230},
+{-10126, -31164}, {-10330, -31097},
+{-10533, -31029}, {-10736, -30959},
+{-10938, -30888}, {-11140, -30816},
+{-11342, -30743}, {-11543, -30668},
+{-11743, -30592}, {-11943, -30514},
+{-12142, -30435}, {-12341, -30355},
+{-12540, -30274}, {-12738, -30191},
+{-12935, -30107}, {-13132, -30022},
+{-13328, -29935}, {-13524, -29847},
+{-13719, -29758}, {-13913, -29668},
+{-14107, -29576}, {-14300, -29483},
+{-14493, -29389}, {-14685, -29293},
+{-14876, -29197}, {-15067, -29099},
+{-15257, -28999}, {-15447, -28899},
+{-15636, -28797}, {-15824, -28694},
+{-16011, -28590}, {-16198, -28485},
+{-16384, -28378}, {-16569, -28270},
+{-16754, -28161}, {-16938, -28051},
+{-17121, -27939}, {-17304, -27827},
+{-17485, -27713}, {-17666, -27598},
+{-17847, -27482}, {-18026, -27364},
+{-18205, -27246}, {-18383, -27126},
+{-18560, -27005}, {-18736, -26883},
+{-18912, -26760}, {-19087, -26635},
+{-19261, -26510}, {-19434, -26383},
+{-19606, -26255}, {-19777, -26127},
+{-19948, -25997}, {-20118, -25865},
+{-20286, -25733}, {-20454, -25600},
+{-20622, -25466}, {-20788, -25330},
+{-20953, -25193}, {-21118, -25056},
+{-21281, -24917}, {-21444, -24777},
+{-21605, -24636}, {-21766, -24494},
+{-21926, -24351}, {-22085, -24207},
+{-22243, -24062}, {-22400, -23916},
+{-22556, -23769}, {-22711, -23621},
+{-22865, -23472}, {-23018, -23322},
+{-23170, -23170}, {-23322, -23018},
+{-23472, -22865}, {-23621, -22711},
+{-23769, -22556}, {-23916, -22400},
+{-24062, -22243}, {-24207, -22085},
+{-24351, -21926}, {-24494, -21766},
+{-24636, -21605}, {-24777, -21444},
+{-24917, -21281}, {-25056, -21118},
+{-25193, -20953}, {-25330, -20788},
+{-25466, -20622}, {-25600, -20454},
+{-25733, -20286}, {-25865, -20118},
+{-25997, -19948}, {-26127, -19777},
+{-26255, -19606}, {-26383, -19434},
+{-26510, -19261}, {-26635, -19087},
+{-26760, -18912}, {-26883, -18736},
+{-27005, -18560}, {-27126, -18383},
+{-27246, -18205}, {-27364, -18026},
+{-27482, -17847}, {-27598, -17666},
+{-27713, -17485}, {-27827, -17304},
+{-27939, -17121}, {-28051, -16938},
+{-28161, -16754}, {-28270, -16569},
+{-28378, -16384}, {-28485, -16198},
+{-28590, -16011}, {-28694, -15824},
+{-28797, -15636}, {-28899, -15447},
+{-28999, -15257}, {-29099, -15067},
+{-29197, -14876}, {-29293, -14685},
+{-29389, -14493}, {-29483, -14300},
+{-29576, -14107}, {-29668, -13913},
+{-29758, -13719}, {-29847, -13524},
+{-29935, -13328}, {-30022, -13132},
+{-30107, -12935}, {-30191, -12738},
+{-30274, -12540}, {-30355, -12341},
+{-30435, -12142}, {-30514, -11943},
+{-30592, -11743}, {-30668, -11543},
+{-30743, -11342}, {-30816, -11140},
+{-30888, -10938}, {-30959, -10736},
+{-31029, -10533}, {-31097, -10330},
+{-31164, -10126}, {-31230, -9922},
+{-31294, -9717}, {-31357, -9512},
+{-31419, -9307}, {-31479, -9101},
+{-31538, -8895}, {-31595, -8688},
+{-31651, -8481}, {-31706, -8274},
+{-31760, -8066}, {-31812, -7858},
+{-31863, -7650}, {-31912, -7441},
+{-31960, -7232}, {-32007, -7022},
+{-32052, -6813}, {-32096, -6603},
+{-32138, -6393}, {-32180, -6182},
+{-32219, -5971}, {-32258, -5760},
+{-32295, -5549}, {-32330, -5338},
+{-32365, -5126}, {-32397, -4914},
+{-32429, -4702}, {-32459, -4490},
+{-32488, -4277}, {-32515, -4064},
+{-32541, -3851}, {-32565, -3638},
+{-32588, -3425}, {-32610, -3212},
+{-32631, -2998}, {-32649, -2785},
+{-32667, -2571}, {-32683, -2357},
+{-32698, -2143}, {-32711, -1929},
+{-32723, -1715}, {-32734, -1501},
+{-32743, -1286}, {-32750, -1072},
+{-32757, -858}, {-32762, -643},
+{-32765, -429}, {-32767, -214},
+{-32767, 0}, {-32767, 214},
+{-32765, 429}, {-32762, 643},
+{-32757, 858}, {-32750, 1072},
+{-32743, 1286}, {-32734, 1501},
+{-32723, 1715}, {-32711, 1929},
+{-32698, 2143}, {-32683, 2357},
+{-32667, 2571}, {-32649, 2785},
+{-32631, 2998}, {-32610, 3212},
+{-32588, 3425}, {-32565, 3638},
+{-32541, 3851}, {-32515, 4064},
+{-32488, 4277}, {-32459, 4490},
+{-32429, 4702}, {-32397, 4914},
+{-32365, 5126}, {-32330, 5338},
+{-32295, 5549}, {-32258, 5760},
+{-32219, 5971}, {-32180, 6182},
+{-32138, 6393}, {-32096, 6603},
+{-32052, 6813}, {-32007, 7022},
+{-31960, 7232}, {-31912, 7441},
+{-31863, 7650}, {-31812, 7858},
+{-31760, 8066}, {-31706, 8274},
+{-31651, 8481}, {-31595, 8688},
+{-31538, 8895}, {-31479, 9101},
+{-31419, 9307}, {-31357, 9512},
+{-31294, 9717}, {-31230, 9922},
+{-31164, 10126}, {-31097, 10330},
+{-31029, 10533}, {-30959, 10736},
+{-30888, 10938}, {-30816, 11140},
+{-30743, 11342}, {-30668, 11543},
+{-30592, 11743}, {-30514, 11943},
+{-30435, 12142}, {-30355, 12341},
+{-30274, 12540}, {-30191, 12738},
+{-30107, 12935}, {-30022, 13132},
+{-29935, 13328}, {-29847, 13524},
+{-29758, 13719}, {-29668, 13913},
+{-29576, 14107}, {-29483, 14300},
+{-29389, 14493}, {-29293, 14685},
+{-29197, 14876}, {-29099, 15067},
+{-28999, 15257}, {-28899, 15447},
+{-28797, 15636}, {-28694, 15824},
+{-28590, 16011}, {-28485, 16198},
+{-28378, 16384}, {-28270, 16569},
+{-28161, 16754}, {-28051, 16938},
+{-27939, 17121}, {-27827, 17304},
+{-27713, 17485}, {-27598, 17666},
+{-27482, 17847}, {-27364, 18026},
+{-27246, 18205}, {-27126, 18383},
+{-27005, 18560}, {-26883, 18736},
+{-26760, 18912}, {-26635, 19087},
+{-26510, 19261}, {-26383, 19434},
+{-26255, 19606}, {-26127, 19777},
+{-25997, 19948}, {-25865, 20118},
+{-25733, 20286}, {-25600, 20454},
+{-25466, 20622}, {-25330, 20788},
+{-25193, 20953}, {-25056, 21118},
+{-24917, 21281}, {-24777, 21444},
+{-24636, 21605}, {-24494, 21766},
+{-24351, 21926}, {-24207, 22085},
+{-24062, 22243}, {-23916, 22400},
+{-23769, 22556}, {-23621, 22711},
+{-23472, 22865}, {-23322, 23018},
+{-23170, 23170}, {-23018, 23322},
+{-22865, 23472}, {-22711, 23621},
+{-22556, 23769}, {-22400, 23916},
+{-22243, 24062}, {-22085, 24207},
+{-21926, 24351}, {-21766, 24494},
+{-21605, 24636}, {-21444, 24777},
+{-21281, 24917}, {-21118, 25056},
+{-20953, 25193}, {-20788, 25330},
+{-20622, 25466}, {-20454, 25600},
+{-20286, 25733}, {-20118, 25865},
+{-19948, 25997}, {-19777, 26127},
+{-19606, 26255}, {-19434, 26383},
+{-19261, 26510}, {-19087, 26635},
+{-18912, 26760}, {-18736, 26883},
+{-18560, 27005}, {-18383, 27126},
+{-18205, 27246}, {-18026, 27364},
+{-17847, 27482}, {-17666, 27598},
+{-17485, 27713}, {-17304, 27827},
+{-17121, 27939}, {-16938, 28051},
+{-16754, 28161}, {-16569, 28270},
+{-16384, 28378}, {-16198, 28485},
+{-16011, 28590}, {-15824, 28694},
+{-15636, 28797}, {-15447, 28899},
+{-15257, 28999}, {-15067, 29099},
+{-14876, 29197}, {-14685, 29293},
+{-14493, 29389}, {-14300, 29483},
+{-14107, 29576}, {-13913, 29668},
+{-13719, 29758}, {-13524, 29847},
+{-13328, 29935}, {-13132, 30022},
+{-12935, 30107}, {-12738, 30191},
+{-12540, 30274}, {-12341, 30355},
+{-12142, 30435}, {-11943, 30514},
+{-11743, 30592}, {-11543, 30668},
+{-11342, 30743}, {-11140, 30816},
+{-10938, 30888}, {-10736, 30959},
+{-10533, 31029}, {-10330, 31097},
+{-10126, 31164}, {-9922, 31230},
+{-9717, 31294}, {-9512, 31357},
+{-9307, 31419}, {-9101, 31479},
+{-8895, 31538}, {-8688, 31595},
+{-8481, 31651}, {-8274, 31706},
+{-8066, 31760}, {-7858, 31812},
+{-7650, 31863}, {-7441, 31912},
+{-7232, 31960}, {-7022, 32007},
+{-6813, 32052}, {-6603, 32096},
+{-6393, 32138}, {-6182, 32180},
+{-5971, 32219}, {-5760, 32258},
+{-5549, 32295}, {-5338, 32330},
+{-5126, 32365}, {-4914, 32397},
+{-4702, 32429}, {-4490, 32459},
+{-4277, 32488}, {-4064, 32515},
+{-3851, 32541}, {-3638, 32565},
+{-3425, 32588}, {-3212, 32610},
+{-2998, 32631}, {-2785, 32649},
+{-2571, 32667}, {-2357, 32683},
+{-2143, 32698}, {-1929, 32711},
+{-1715, 32723}, {-1501, 32734},
+{-1286, 32743}, {-1072, 32750},
+{-858, 32757}, {-643, 32762},
+{-429, 32765}, {-214, 32767},
+{0, 32767}, {214, 32767},
+{429, 32765}, {643, 32762},
+{858, 32757}, {1072, 32750},
+{1286, 32743}, {1501, 32734},
+{1715, 32723}, {1929, 32711},
+{2143, 32698}, {2357, 32683},
+{2571, 32667}, {2785, 32649},
+{2998, 32631}, {3212, 32610},
+{3425, 32588}, {3638, 32565},
+{3851, 32541}, {4064, 32515},
+{4277, 32488}, {4490, 32459},
+{4702, 32429}, {4914, 32397},
+{5126, 32365}, {5338, 32330},
+{5549, 32295}, {5760, 32258},
+{5971, 32219}, {6182, 32180},
+{6393, 32138}, {6603, 32096},
+{6813, 32052}, {7022, 32007},
+{7232, 31960}, {7441, 31912},
+{7650, 31863}, {7858, 31812},
+{8066, 31760}, {8274, 31706},
+{8481, 31651}, {8688, 31595},
+{8895, 31538}, {9101, 31479},
+{9307, 31419}, {9512, 31357},
+{9717, 31294}, {9922, 31230},
+{10126, 31164}, {10330, 31097},
+{10533, 31029}, {10736, 30959},
+{10938, 30888}, {11140, 30816},
+{11342, 30743}, {11543, 30668},
+{11743, 30592}, {11943, 30514},
+{12142, 30435}, {12341, 30355},
+{12540, 30274}, {12738, 30191},
+{12935, 30107}, {13132, 30022},
+{13328, 29935}, {13524, 29847},
+{13719, 29758}, {13913, 29668},
+{14107, 29576}, {14300, 29483},
+{14493, 29389}, {14685, 29293},
+{14876, 29197}, {15067, 29099},
+{15257, 28999}, {15447, 28899},
+{15636, 28797}, {15824, 28694},
+{16011, 28590}, {16198, 28485},
+{16384, 28378}, {16569, 28270},
+{16754, 28161}, {16938, 28051},
+{17121, 27939}, {17304, 27827},
+{17485, 27713}, {17666, 27598},
+{17847, 27482}, {18026, 27364},
+{18205, 27246}, {18383, 27126},
+{18560, 27005}, {18736, 26883},
+{18912, 26760}, {19087, 26635},
+{19261, 26510}, {19434, 26383},
+{19606, 26255}, {19777, 26127},
+{19948, 25997}, {20118, 25865},
+{20286, 25733}, {20454, 25600},
+{20622, 25466}, {20788, 25330},
+{20953, 25193}, {21118, 25056},
+{21281, 24917}, {21444, 24777},
+{21605, 24636}, {21766, 24494},
+{21926, 24351}, {22085, 24207},
+{22243, 24062}, {22400, 23916},
+{22556, 23769}, {22711, 23621},
+{22865, 23472}, {23018, 23322},
+{23170, 23170}, {23322, 23018},
+{23472, 22865}, {23621, 22711},
+{23769, 22556}, {23916, 22400},
+{24062, 22243}, {24207, 22085},
+{24351, 21926}, {24494, 21766},
+{24636, 21605}, {24777, 21444},
+{24917, 21281}, {25056, 21118},
+{25193, 20953}, {25330, 20788},
+{25466, 20622}, {25600, 20454},
+{25733, 20286}, {25865, 20118},
+{25997, 19948}, {26127, 19777},
+{26255, 19606}, {26383, 19434},
+{26510, 19261}, {26635, 19087},
+{26760, 18912}, {26883, 18736},
+{27005, 18560}, {27126, 18383},
+{27246, 18205}, {27364, 18026},
+{27482, 17847}, {27598, 17666},
+{27713, 17485}, {27827, 17304},
+{27939, 17121}, {28051, 16938},
+{28161, 16754}, {28270, 16569},
+{28378, 16384}, {28485, 16198},
+{28590, 16011}, {28694, 15824},
+{28797, 15636}, {28899, 15447},
+{28999, 15257}, {29099, 15067},
+{29197, 14876}, {29293, 14685},
+{29389, 14493}, {29483, 14300},
+{29576, 14107}, {29668, 13913},
+{29758, 13719}, {29847, 13524},
+{29935, 13328}, {30022, 13132},
+{30107, 12935}, {30191, 12738},
+{30274, 12540}, {30355, 12341},
+{30435, 12142}, {30514, 11943},
+{30592, 11743}, {30668, 11543},
+{30743, 11342}, {30816, 11140},
+{30888, 10938}, {30959, 10736},
+{31029, 10533}, {31097, 10330},
+{31164, 10126}, {31230, 9922},
+{31294, 9717}, {31357, 9512},
+{31419, 9307}, {31479, 9101},
+{31538, 8895}, {31595, 8688},
+{31651, 8481}, {31706, 8274},
+{31760, 8066}, {31812, 7858},
+{31863, 7650}, {31912, 7441},
+{31960, 7232}, {32007, 7022},
+{32052, 6813}, {32096, 6603},
+{32138, 6393}, {32180, 6182},
+{32219, 5971}, {32258, 5760},
+{32295, 5549}, {32330, 5338},
+{32365, 5126}, {32397, 4914},
+{32429, 4702}, {32459, 4490},
+{32488, 4277}, {32515, 4064},
+{32541, 3851}, {32565, 3638},
+{32588, 3425}, {32610, 3212},
+{32631, 2998}, {32649, 2785},
+{32667, 2571}, {32683, 2357},
+{32698, 2143}, {32711, 1929},
+{32723, 1715}, {32734, 1501},
+{32743, 1286}, {32750, 1072},
+{32757, 858}, {32762, 643},
+{32765, 429}, {32767, 214},
+#endif
+};
+#ifndef FFT_BITREV960
+#define FFT_BITREV960
+static const opus_int16 fft_bitrev960[960] = {
+0, 192, 384, 576, 768, 64, 256, 448, 640, 832, 128, 320, 512, 704, 896,
+16, 208, 400, 592, 784, 80, 272, 464, 656, 848, 144, 336, 528, 720, 912,
+32, 224, 416, 608, 800, 96, 288, 480, 672, 864, 160, 352, 544, 736, 928,
+48, 240, 432, 624, 816, 112, 304, 496, 688, 880, 176, 368, 560, 752, 944,
+4, 196, 388, 580, 772, 68, 260, 452, 644, 836, 132, 324, 516, 708, 900,
+20, 212, 404, 596, 788, 84, 276, 468, 660, 852, 148, 340, 532, 724, 916,
+36, 228, 420, 612, 804, 100, 292, 484, 676, 868, 164, 356, 548, 740, 932,
+52, 244, 436, 628, 820, 116, 308, 500, 692, 884, 180, 372, 564, 756, 948,
+8, 200, 392, 584, 776, 72, 264, 456, 648, 840, 136, 328, 520, 712, 904,
+24, 216, 408, 600, 792, 88, 280, 472, 664, 856, 152, 344, 536, 728, 920,
+40, 232, 424, 616, 808, 104, 296, 488, 680, 872, 168, 360, 552, 744, 936,
+56, 248, 440, 632, 824, 120, 312, 504, 696, 888, 184, 376, 568, 760, 952,
+12, 204, 396, 588, 780, 76, 268, 460, 652, 844, 140, 332, 524, 716, 908,
+28, 220, 412, 604, 796, 92, 284, 476, 668, 860, 156, 348, 540, 732, 924,
+44, 236, 428, 620, 812, 108, 300, 492, 684, 876, 172, 364, 556, 748, 940,
+60, 252, 444, 636, 828, 124, 316, 508, 700, 892, 188, 380, 572, 764, 956,
+1, 193, 385, 577, 769, 65, 257, 449, 641, 833, 129, 321, 513, 705, 897,
+17, 209, 401, 593, 785, 81, 273, 465, 657, 849, 145, 337, 529, 721, 913,
+33, 225, 417, 609, 801, 97, 289, 481, 673, 865, 161, 353, 545, 737, 929,
+49, 241, 433, 625, 817, 113, 305, 497, 689, 881, 177, 369, 561, 753, 945,
+5, 197, 389, 581, 773, 69, 261, 453, 645, 837, 133, 325, 517, 709, 901,
+21, 213, 405, 597, 789, 85, 277, 469, 661, 853, 149, 341, 533, 725, 917,
+37, 229, 421, 613, 805, 101, 293, 485, 677, 869, 165, 357, 549, 741, 933,
+53, 245, 437, 629, 821, 117, 309, 501, 693, 885, 181, 373, 565, 757, 949,
+9, 201, 393, 585, 777, 73, 265, 457, 649, 841, 137, 329, 521, 713, 905,
+25, 217, 409, 601, 793, 89, 281, 473, 665, 857, 153, 345, 537, 729, 921,
+41, 233, 425, 617, 809, 105, 297, 489, 681, 873, 169, 361, 553, 745, 937,
+57, 249, 441, 633, 825, 121, 313, 505, 697, 889, 185, 377, 569, 761, 953,
+13, 205, 397, 589, 781, 77, 269, 461, 653, 845, 141, 333, 525, 717, 909,
+29, 221, 413, 605, 797, 93, 285, 477, 669, 861, 157, 349, 541, 733, 925,
+45, 237, 429, 621, 813, 109, 301, 493, 685, 877, 173, 365, 557, 749, 941,
+61, 253, 445, 637, 829, 125, 317, 509, 701, 893, 189, 381, 573, 765, 957,
+2, 194, 386, 578, 770, 66, 258, 450, 642, 834, 130, 322, 514, 706, 898,
+18, 210, 402, 594, 786, 82, 274, 466, 658, 850, 146, 338, 530, 722, 914,
+34, 226, 418, 610, 802, 98, 290, 482, 674, 866, 162, 354, 546, 738, 930,
+50, 242, 434, 626, 818, 114, 306, 498, 690, 882, 178, 370, 562, 754, 946,
+6, 198, 390, 582, 774, 70, 262, 454, 646, 838, 134, 326, 518, 710, 902,
+22, 214, 406, 598, 790, 86, 278, 470, 662, 854, 150, 342, 534, 726, 918,
+38, 230, 422, 614, 806, 102, 294, 486, 678, 870, 166, 358, 550, 742, 934,
+54, 246, 438, 630, 822, 118, 310, 502, 694, 886, 182, 374, 566, 758, 950,
+10, 202, 394, 586, 778, 74, 266, 458, 650, 842, 138, 330, 522, 714, 906,
+26, 218, 410, 602, 794, 90, 282, 474, 666, 858, 154, 346, 538, 730, 922,
+42, 234, 426, 618, 810, 106, 298, 490, 682, 874, 170, 362, 554, 746, 938,
+58, 250, 442, 634, 826, 122, 314, 506, 698, 890, 186, 378, 570, 762, 954,
+14, 206, 398, 590, 782, 78, 270, 462, 654, 846, 142, 334, 526, 718, 910,
+30, 222, 414, 606, 798, 94, 286, 478, 670, 862, 158, 350, 542, 734, 926,
+46, 238, 430, 622, 814, 110, 302, 494, 686, 878, 174, 366, 558, 750, 942,
+62, 254, 446, 638, 830, 126, 318, 510, 702, 894, 190, 382, 574, 766, 958,
+3, 195, 387, 579, 771, 67, 259, 451, 643, 835, 131, 323, 515, 707, 899,
+19, 211, 403, 595, 787, 83, 275, 467, 659, 851, 147, 339, 531, 723, 915,
+35, 227, 419, 611, 803, 99, 291, 483, 675, 867, 163, 355, 547, 739, 931,
+51, 243, 435, 627, 819, 115, 307, 499, 691, 883, 179, 371, 563, 755, 947,
+7, 199, 391, 583, 775, 71, 263, 455, 647, 839, 135, 327, 519, 711, 903,
+23, 215, 407, 599, 791, 87, 279, 471, 663, 855, 151, 343, 535, 727, 919,
+39, 231, 423, 615, 807, 103, 295, 487, 679, 871, 167, 359, 551, 743, 935,
+55, 247, 439, 631, 823, 119, 311, 503, 695, 887, 183, 375, 567, 759, 951,
+11, 203, 395, 587, 779, 75, 267, 459, 651, 843, 139, 331, 523, 715, 907,
+27, 219, 411, 603, 795, 91, 283, 475, 667, 859, 155, 347, 539, 731, 923,
+43, 235, 427, 619, 811, 107, 299, 491, 683, 875, 171, 363, 555, 747, 939,
+59, 251, 443, 635, 827, 123, 315, 507, 699, 891, 187, 379, 571, 763, 955,
+15, 207, 399, 591, 783, 79, 271, 463, 655, 847, 143, 335, 527, 719, 911,
+31, 223, 415, 607, 799, 95, 287, 479, 671, 863, 159, 351, 543, 735, 927,
+47, 239, 431, 623, 815, 111, 303, 495, 687, 879, 175, 367, 559, 751, 943,
+63, 255, 447, 639, 831, 127, 319, 511, 703, 895, 191, 383, 575, 767, 959,
+};
+#endif
+
+#ifndef FFT_BITREV480
+#define FFT_BITREV480
+static const opus_int16 fft_bitrev480[480] = {
+0, 96, 192, 288, 384, 32, 128, 224, 320, 416, 64, 160, 256, 352, 448,
+8, 104, 200, 296, 392, 40, 136, 232, 328, 424, 72, 168, 264, 360, 456,
+16, 112, 208, 304, 400, 48, 144, 240, 336, 432, 80, 176, 272, 368, 464,
+24, 120, 216, 312, 408, 56, 152, 248, 344, 440, 88, 184, 280, 376, 472,
+4, 100, 196, 292, 388, 36, 132, 228, 324, 420, 68, 164, 260, 356, 452,
+12, 108, 204, 300, 396, 44, 140, 236, 332, 428, 76, 172, 268, 364, 460,
+20, 116, 212, 308, 404, 52, 148, 244, 340, 436, 84, 180, 276, 372, 468,
+28, 124, 220, 316, 412, 60, 156, 252, 348, 444, 92, 188, 284, 380, 476,
+1, 97, 193, 289, 385, 33, 129, 225, 321, 417, 65, 161, 257, 353, 449,
+9, 105, 201, 297, 393, 41, 137, 233, 329, 425, 73, 169, 265, 361, 457,
+17, 113, 209, 305, 401, 49, 145, 241, 337, 433, 81, 177, 273, 369, 465,
+25, 121, 217, 313, 409, 57, 153, 249, 345, 441, 89, 185, 281, 377, 473,
+5, 101, 197, 293, 389, 37, 133, 229, 325, 421, 69, 165, 261, 357, 453,
+13, 109, 205, 301, 397, 45, 141, 237, 333, 429, 77, 173, 269, 365, 461,
+21, 117, 213, 309, 405, 53, 149, 245, 341, 437, 85, 181, 277, 373, 469,
+29, 125, 221, 317, 413, 61, 157, 253, 349, 445, 93, 189, 285, 381, 477,
+2, 98, 194, 290, 386, 34, 130, 226, 322, 418, 66, 162, 258, 354, 450,
+10, 106, 202, 298, 394, 42, 138, 234, 330, 426, 74, 170, 266, 362, 458,
+18, 114, 210, 306, 402, 50, 146, 242, 338, 434, 82, 178, 274, 370, 466,
+26, 122, 218, 314, 410, 58, 154, 250, 346, 442, 90, 186, 282, 378, 474,
+6, 102, 198, 294, 390, 38, 134, 230, 326, 422, 70, 166, 262, 358, 454,
+14, 110, 206, 302, 398, 46, 142, 238, 334, 430, 78, 174, 270, 366, 462,
+22, 118, 214, 310, 406, 54, 150, 246, 342, 438, 86, 182, 278, 374, 470,
+30, 126, 222, 318, 414, 62, 158, 254, 350, 446, 94, 190, 286, 382, 478,
+3, 99, 195, 291, 387, 35, 131, 227, 323, 419, 67, 163, 259, 355, 451,
+11, 107, 203, 299, 395, 43, 139, 235, 331, 427, 75, 171, 267, 363, 459,
+19, 115, 211, 307, 403, 51, 147, 243, 339, 435, 83, 179, 275, 371, 467,
+27, 123, 219, 315, 411, 59, 155, 251, 347, 443, 91, 187, 283, 379, 475,
+7, 103, 199, 295, 391, 39, 135, 231, 327, 423, 71, 167, 263, 359, 455,
+15, 111, 207, 303, 399, 47, 143, 239, 335, 431, 79, 175, 271, 367, 463,
+23, 119, 215, 311, 407, 55, 151, 247, 343, 439, 87, 183, 279, 375, 471,
+31, 127, 223, 319, 415, 63, 159, 255, 351, 447, 95, 191, 287, 383, 479,
+};
+#endif
+
+#ifndef FFT_BITREV240
+#define FFT_BITREV240
+static const opus_int16 fft_bitrev240[240] = {
+0, 48, 96, 144, 192, 16, 64, 112, 160, 208, 32, 80, 128, 176, 224,
+4, 52, 100, 148, 196, 20, 68, 116, 164, 212, 36, 84, 132, 180, 228,
+8, 56, 104, 152, 200, 24, 72, 120, 168, 216, 40, 88, 136, 184, 232,
+12, 60, 108, 156, 204, 28, 76, 124, 172, 220, 44, 92, 140, 188, 236,
+1, 49, 97, 145, 193, 17, 65, 113, 161, 209, 33, 81, 129, 177, 225,
+5, 53, 101, 149, 197, 21, 69, 117, 165, 213, 37, 85, 133, 181, 229,
+9, 57, 105, 153, 201, 25, 73, 121, 169, 217, 41, 89, 137, 185, 233,
+13, 61, 109, 157, 205, 29, 77, 125, 173, 221, 45, 93, 141, 189, 237,
+2, 50, 98, 146, 194, 18, 66, 114, 162, 210, 34, 82, 130, 178, 226,
+6, 54, 102, 150, 198, 22, 70, 118, 166, 214, 38, 86, 134, 182, 230,
+10, 58, 106, 154, 202, 26, 74, 122, 170, 218, 42, 90, 138, 186, 234,
+14, 62, 110, 158, 206, 30, 78, 126, 174, 222, 46, 94, 142, 190, 238,
+3, 51, 99, 147, 195, 19, 67, 115, 163, 211, 35, 83, 131, 179, 227,
+7, 55, 103, 151, 199, 23, 71, 119, 167, 215, 39, 87, 135, 183, 231,
+11, 59, 107, 155, 203, 27, 75, 123, 171, 219, 43, 91, 139, 187, 235,
+15, 63, 111, 159, 207, 31, 79, 127, 175, 223, 47, 95, 143, 191, 239,
+};
+#endif
+
+#ifndef FFT_BITREV120
+#define FFT_BITREV120
+static const opus_int16 fft_bitrev120[120] = {
+0, 24, 48, 72, 96, 8, 32, 56, 80, 104, 16, 40, 64, 88, 112,
+4, 28, 52, 76, 100, 12, 36, 60, 84, 108, 20, 44, 68, 92, 116,
+1, 25, 49, 73, 97, 9, 33, 57, 81, 105, 17, 41, 65, 89, 113,
+5, 29, 53, 77, 101, 13, 37, 61, 85, 109, 21, 45, 69, 93, 117,
+2, 26, 50, 74, 98, 10, 34, 58, 82, 106, 18, 42, 66, 90, 114,
+6, 30, 54, 78, 102, 14, 38, 62, 86, 110, 22, 46, 70, 94, 118,
+3, 27, 51, 75, 99, 11, 35, 59, 83, 107, 19, 43, 67, 91, 115,
+7, 31, 55, 79, 103, 15, 39, 63, 87, 111, 23, 47, 71, 95, 119,
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_0
+#define FFT_STATE96000_1920_0
+static const kiss_fft_state fft_state96000_1920_0 = {
+960, /* nfft */
+#ifdef ENABLE_QEXT
+572662306, /* scale */
+#else
+17476, /* scale */
+#endif
+9, /* scale_shift */
+-1, /* shift */
+{5, 192, 3, 64, 4, 16, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev960, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_960,
+#else
+NULL,
+#endif
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_1
+#define FFT_STATE96000_1920_1
+static const kiss_fft_state fft_state96000_1920_1 = {
+480, /* nfft */
+#ifdef ENABLE_QEXT
+572662306, /* scale */
+#else
+17476, /* scale */
+#endif
+8, /* scale_shift */
+1, /* shift */
+{5, 96, 3, 32, 4, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev480, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_480,
+#else
+NULL,
+#endif
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_2
+#define FFT_STATE96000_1920_2
+static const kiss_fft_state fft_state96000_1920_2 = {
+240, /* nfft */
+#ifdef ENABLE_QEXT
+572662306, /* scale */
+#else
+17476, /* scale */
+#endif
+7, /* scale_shift */
+2, /* shift */
+{5, 48, 3, 16, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev240, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_240,
+#else
+NULL,
+#endif
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_3
+#define FFT_STATE96000_1920_3
+static const kiss_fft_state fft_state96000_1920_3 = {
+120, /* nfft */
+#ifdef ENABLE_QEXT
+572662306, /* scale */
+#else
+17476, /* scale */
+#endif
+6, /* scale_shift */
+3, /* shift */
+{5, 24, 3, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev120, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_120,
+#else
+NULL,
+#endif
};
+#endif
+
+#endif
+
+#ifndef MDCT_TWIDDLES1920
+#define MDCT_TWIDDLES1920
+static const celt_coef mdct_twiddles1920[3600] = {
+#ifdef ENABLE_QEXT
+2147483603, 2147480010, 2147470667, 2147455575, 2147434733,
+2147408142, 2147375802, 2147337712, 2147293874, 2147244286,
+2147188950, 2147127865, 2147061032, 2146988450, 2146910120,
+2146826042, 2146736216, 2146640643, 2146539323, 2146432256,
+2146319442, 2146200882, 2146076576, 2145946524, 2145810727,
+2145669185, 2145521898, 2145368867, 2145210092, 2145045574,
+2144875313, 2144699310, 2144517564, 2144330077, 2144136849,
+2143937880, 2143733172, 2143522724, 2143306537, 2143084612,
+2142856949, 2142623549, 2142384413, 2142139541, 2141888933,
+2141632592, 2141370516, 2141102708, 2140829167, 2140549894,
+2140264890, 2139974157, 2139677694, 2139375502, 2139067583,
+2138753936, 2138434564, 2138109466, 2137778644, 2137442099,
+2137099831, 2136751841, 2136398131, 2136038701, 2135673552,
+2135302685, 2134926101, 2134543801, 2134155787, 2133762059,
+2133362618, 2132957466, 2132546603, 2132130030, 2131707749,
+2131279761, 2130846067, 2130406668, 2129961565, 2129510759,
+2129054253, 2128592046, 2128124140, 2127650537, 2127171237,
+2126686242, 2126195553, 2125699172, 2125197100, 2124689338,
+2124175888, 2123656750, 2123131927, 2122601420, 2122065230,
+2121523358, 2120975806, 2120422576, 2119863669, 2119299086,
+2118728830, 2118152901, 2117571301, 2116984031, 2116391094,
+2115792491, 2115188222, 2114578291, 2113962699, 2113341447,
+2112714537, 2112081970, 2111443749, 2110799875, 2110150349,
+2109495174, 2108834352, 2108167883, 2107495770, 2106818015,
+2106134619, 2105445584, 2104750913, 2104050606, 2103344666,
+2102633095, 2101915895, 2101193067, 2100464614, 2099730537,
+2098990838, 2098245520, 2097494584, 2096738032, 2095975867,
+2095208091, 2094434705, 2093655711, 2092871112, 2092080910,
+2091285107, 2090483704, 2089676705, 2088864111, 2088045925,
+2087222148, 2086392783, 2085557833, 2084717298, 2083871182,
+2083019487, 2082162216, 2081299369, 2080430950, 2079556962,
+2078677406, 2077792284, 2076901600, 2076005355, 2075103552,
+2074196194, 2073283282, 2072364819, 2071440808, 2070511251,
+2069576151, 2068635510, 2067689330, 2066737615, 2065780367,
+2064817587, 2063849280, 2062875447, 2061896091, 2060911215,
+2059920821, 2058924912, 2057923491, 2056916560, 2055904122,
+2054886179, 2053862736, 2052833793, 2051799354, 2050759422,
+2049714000, 2048663090, 2047606695, 2046544818, 2045477461,
+2044404629, 2043326323, 2042242546, 2041153301, 2040058592,
+2038958421, 2037852791, 2036741705, 2035625166, 2034503177,
+2033375742, 2032242862, 2031104541, 2029960782, 2028811589,
+2027656964, 2026496910, 2025331431, 2024160529, 2022984208,
+2021802471, 2020615320, 2019422760, 2018224794, 2017021424,
+2015812654, 2014598487, 2013378926, 2012153975, 2010923636,
+2009687914, 2008446811, 2007200332, 2005948478, 2004691253,
+2003428662, 2002160707, 2000887391, 1999608718, 1998324692,
+1997035316, 1995740593, 1994440527, 1993135121, 1991824379,
+1990508304, 1989186900, 1987860170, 1986528118, 1985190748,
+1983848063, 1982500066, 1981146762, 1979788153, 1978424244,
+1977055038, 1975680539, 1974300751, 1972915676, 1971525320,
+1970129685, 1968728776, 1967322596, 1965911148, 1964494438,
+1963072467, 1961645241, 1960212764, 1958775038, 1957332067,
+1955883857, 1954430410, 1952971730, 1951507822, 1950038689,
+1948564335, 1947084764, 1945599980, 1944109987, 1942614790,
+1941114391, 1939608795, 1938098007, 1936582029, 1935060867,
+1933534524, 1932003004, 1930466312, 1928924452, 1927377427,
+1925825242, 1924267900, 1922705408, 1921137767, 1919564983,
+1917987059, 1916404001, 1914815812, 1913222496, 1911624058,
+1910020502, 1908411833, 1906798054, 1905179170, 1903555185,
+1901926103, 1900291930, 1898652669, 1897008325, 1895358902,
+1893704404, 1892044837, 1890380204, 1888710510, 1887035759,
+1885355956, 1883671105, 1881981211, 1880286279, 1878586312,
+1876881316, 1875171295, 1873456254, 1871736196, 1870011128,
+1868281053, 1866545976, 1864805901, 1863060834, 1861310779,
+1859555741, 1857795724, 1856030734, 1854260774, 1852485850,
+1850705966, 1848921127, 1847131338, 1845336604, 1843536929,
+1841732318, 1839922777, 1838108310, 1836288921, 1834464616,
+1832635400, 1830801277, 1828962253, 1827118332, 1825269519,
+1823415819, 1821557238, 1819693779, 1817825449, 1815952252,
+1814074193, 1812191278, 1810303510, 1808410896, 1806513440,
+1804611147, 1802704023, 1800792073, 1798875302, 1796953714,
+1795027315, 1793096111, 1791160105, 1789219305, 1787273714,
+1785323338, 1783368182, 1781408251, 1779443552, 1777474088,
+1775499865, 1773520888, 1771537164, 1769548696, 1767555491,
+1765557554, 1763554889, 1761547504, 1759535401, 1757518588,
+1755497070, 1753470852, 1751439939, 1749404337, 1747364051,
+1745319087, 1743269451, 1741215147, 1739156181, 1737092559,
+1735024287, 1732951369, 1730873811, 1728791620, 1726704800,
+1724613357, 1722517297, 1720416625, 1718311347, 1716201468,
+1714086995, 1711967933, 1709844287, 1707716063, 1705583268,
+1703445906, 1701303983, 1699157505, 1697006479, 1694850909,
+1692690801, 1690526161, 1688356996, 1686183310, 1684005110,
+1681822401, 1679635189, 1677443481, 1675247281, 1673046596,
+1670841433, 1668631795, 1666417691, 1664199124, 1661976103,
+1659748631, 1657516716, 1655280364, 1653039579, 1650794369,
+1648544739, 1646290696, 1644032245, 1641769393, 1639502145,
+1637230507, 1634954486, 1632674088, 1630389319, 1628100184,
+1625806691, 1623508845, 1621206653, 1618900119, 1616589252,
+1614274057, 1611954539, 1609630706, 1607302564, 1604970118,
+1602633375, 1600292342, 1597947024, 1595597428, 1593243560,
+1590885426, 1588523033, 1586156387, 1583785495, 1581410362,
+1579030995, 1576647401, 1574259586, 1571867556, 1569471317,
+1567070877, 1564666241, 1562257416, 1559844408, 1557427224,
+1555005871, 1552580354, 1550150681, 1547716857, 1545278889,
+1542836785, 1540390550, 1537940190, 1535485713, 1533027126,
+1530564434, 1528097644, 1525626762, 1523151797, 1520672753,
+1518189638, 1515702459, 1513211221, 1510715932, 1508216599,
+1505713227, 1503205824, 1500694397, 1498178952, 1495659496,
+1493136035, 1490608577, 1488077129, 1485541696, 1483002286,
+1480458905, 1477911561, 1475360260, 1472805009, 1470245815,
+1467682684, 1465115624, 1462544642, 1459969744, 1457390937,
+1454808228, 1452221624, 1449631133, 1447036760, 1444438513,
+1441836399, 1439230424, 1436620597, 1434006923, 1431389409,
+1428768064, 1426142893, 1423513904, 1420881104, 1418244500,
+1415604099, 1412959907, 1410311933, 1407660183, 1405004664,
+1402345384, 1399682349, 1397015567, 1394345044, 1391670789,
+1388992807, 1386311107, 1383625695, 1380936579, 1378243766,
+1375547262, 1372847076, 1370143215, 1367435685, 1364724494,
+1362009649, 1359291158, 1356569027, 1353843265, 1351113878,
+1348380873, 1345644259, 1342904042, 1340160229, 1337412829,
+1334661848, 1331907293, 1329149173, 1326387494, 1323622264,
+1320853490, 1318081180, 1315305341, 1312525981, 1309743106,
+1306956725, 1304166845, 1301373473, 1298576617, 1295776285,
+1292972483, 1290165219, 1287354501, 1284540337, 1281722734,
+1278901699, 1276077240, 1273249364, 1270418080, 1267583394,
+1264745315, 1261903850, 1259059006, 1256210791, 1253359213,
+1250504279, 1247645998, 1244784376, 1241919421, 1239051142,
+1236179545, 1233304638, 1230426430, 1227544927, 1224660138,
+1221772070, 1218880731, 1215986128, 1213088271, 1210187165,
+1207282819, 1204375241, 1201464439, 1198550419, 1195633191,
+1192712762, 1189789140, 1186862332, 1183932347, 1180999192,
+1178062875, 1175123404, 1172180786, 1169235031, 1166286145,
+1163334137, 1160379014, 1157420784, 1154459456, 1151495036,
+1148527534, 1145556957, 1142583313, 1139606610, 1136626856,
+1133644058, 1130658226, 1127669367, 1124677488, 1121682598,
+1118684705, 1115683818, 1112679943, 1109673089, 1106663264,
+1103650476, 1100634734, 1097616045, 1094594417, 1091569858,
+1088542378, 1085511982, 1082478681, 1079442481, 1076403392,
+1073361420, 1070316575, 1067268864, 1064218296, 1061164879,
+1058108621, 1055049529, 1051987613, 1048922881, 1045855340,
+1042784999, 1039711867, 1036635950, 1033557259, 1030475800,
+1027391582, 1024304614, 1021214903, 1018122458, 1015027288,
+1011929400, 1008828802, 1005725504, 1002619513, 999510838,
+996399486, 993285468, 990168789, 987049460, 983927488,
+980802882, 977675650, 974545800, 971413342, 968278282,
+965140630, 962000395, 958857583, 955712205, 952564267,
+949413780, 946260750, 943105188, 939947100, 936786495,
+933623383, 930457771, 927289668, 924119082, 920946022,
+917770497, 914592514, 911412082, 908229211, 905043908,
+901856182, 898666041, 895473494, 892278550, 889081217,
+885881504, 882679419, 879474970, 876268167, 873059018,
+869847532, 866633717, 863417581, 860199134, 856978384,
+853755339, 850530009, 847302402, 844072526, 840840390,
+837606003, 834369373, 831130510, 827889422, 824646117,
+821400604, 818152892, 814902989, 811650905, 808396648,
+805140227, 801881649, 798620925, 795358063, 792093072,
+788825960, 785556735, 782285408, 779011986, 775736479,
+772458895, 769179242, 765897531, 762613768, 759327964,
+756040127, 752750266, 749458390, 746164507, 742868626,
+739570757, 736270907, 732969086, 729665303, 726359567,
+723051885, 719742268, 716430724, 713117261, 709801890,
+706484618, 703165455, 699844409, 696521489, 693196705,
+689870064, 686541577, 683211252, 679879097, 676545122,
+673209336, 669871748, 666532366, 663191199, 659848257,
+656503549, 653157082, 649808867, 646458913, 643107227,
+639753820, 636398700, 633041876, 629683357, 626323153,
+622961271, 619597722, 616232514, 612865656, 609497157,
+606127026, 602755273, 599381905, 596006934, 592630366,
+589252212, 585872480, 582491179, 579108320, 575723909,
+572337957, 568950473, 565561466, 562170945, 558778918,
+555385395, 551990386, 548593898, 545195942, 541796526,
+538395660, 534993352, 531589612, 528184449, 524777871,
+521369889, 517960510, 514549745, 511137603, 507724092,
+504309221, 500893000, 497475439, 494056545, 490636329,
+487214799, 483791965, 480367835, 476942419, 473515727,
+470087766, 466658548, 463228079, 459796371, 456363431,
+452929270, 449493896, 446057319, 442619547, 439180590,
+435740458, 432299159, 428856702, 425413098, 421968354,
+418522481, 415075487, 411627382, 408178175, 404727875,
+401276491, 397824033, 394370510, 390915931, 387460306,
+384003643, 380545952, 377087242, 373627523, 370166803,
+366705093, 363242400, 359778735, 356314107, 352848525,
+349381998, 345914536, 342446148, 338976842, 335506630,
+332035519, 328563519, 325090639, 321616889, 318142278,
+314666815, 311190510, 307713372, 304235410, 300756633,
+297277051, 293796673, 290315508, 286833567, 283350857,
+279867389, 276383171, 272898214, 269412525, 265926116,
+262438995, 258951170, 255462653, 251973452, 248483576,
+244993035, 241501838, 238009994, 234517513, 231024404,
+227530677, 224036341, 220541404, 217045878, 213549770,
+210053090, 206555848, 203058053, 199559715, 196060842,
+192561444, 189061531, 185561111, 182060195, 178558791,
+175056909, 171554559, 168051749, 164548489, 161044789,
+157540658, 154036105, 150531139, 147025770, 143520008,
+140013862, 136507340, 133000453, 129493210, 125985621,
+122477694, 118969439, 115460866, 111951983, 108442801,
+104933329, 101423575, 97913550, 94403263, 90892723,
+87381940, 83870923, 80359681, 76848224, 73336562,
+69824703, 66312657, 62800433, 59288042, 55775491,
+52262792, 48749952, 45236982, 41723891, 38210688,
+34697383, 31183985, 27670503, 24156947, 20643327,
+17129651, 13615930, 10102172, 6588387, 3074584,
+-439226, -3953036, -7466835, -10980614, -14494364,
+-18008075, -21521738, -25035343, -28548881, -32062342,
+-35575718, -39088999, -42602174, -46115236, -49628175,
+-53140980, -56653643, -60166155, -63678505, -67190685,
+-70702685, -74214496, -77726108, -81237512, -84748698,
+-88259658, -91770381, -95280859, -98791081, -102301039,
+-105810723, -109320124, -112829232, -116338038, -119846533,
+-123354707, -126862550, -130370054, -133877209, -137384005,
+-140890434, -144396485, -147902150, -151407418, -154912282,
+-158416730, -161920755, -165424346, -168927494, -172430190,
+-175932424, -179434187, -182935470, -186436263, -189936557,
+-193436342, -196935610, -200434350, -203932553, -207430211,
+-210927313, -214423851, -217919814, -221415194, -224909981,
+-228404166, -231897740, -235390693, -238883015, -242374698,
+-245865732, -249356108, -252845816, -256334847, -259823192,
+-263310841, -266797785, -270284015, -273769522, -277254295,
+-280738326, -284221606, -287704124, -291185873, -294666841,
+-298147021, -301626403, -305104977, -308582734, -312059665,
+-315535760, -319011011, -322485408, -325958941, -329431602,
+-332903380, -336374268, -339844254, -343313331, -346781489,
+-350248718, -353715010, -357180354, -360644742, -364108165,
+-367570613, -371032077, -374492547, -377952015, -381410471,
+-384867905, -388324310, -391779674, -395233990, -398687248,
+-402139438, -405590552, -409040579, -412489512, -415937340,
+-419384055, -422829646, -426274106, -429717424, -433159592,
+-436600601, -440040440, -443479101, -446916575, -450352853,
+-453787924, -457221781, -460654414, -464085813, -467515970,
+-470944875, -474372519, -477798893, -481223988, -484647795,
+-488070304, -491491506, -494911393, -498329954, -501747182,
+-505163066, -508577597, -511990767, -515402566, -518812985,
+-522222016, -525629648, -529035873, -532440681, -535844064,
+-539246012, -542646517, -546045568, -549443158, -552839277,
+-556233916, -559627065, -563018716, -566408860, -569797488,
+-573184589, -576570157, -579954180, -583336651, -586717560,
+-590096899, -593474657, -596850827, -600225398, -603598363,
+-606969711, -610339435, -613707524, -617073971, -620438765,
+-623801898, -627163361, -630523145, -633881241, -637237640,
+-640592333, -643945310, -647296564, -650646085, -653993863,
+-657339891, -660684159, -664026658, -667367379, -670706313,
+-674043452, -677378786, -680712307, -684044005, -687373872,
+-690701898, -694028075, -697352394, -700674846, -703995422,
+-707314114, -710630911, -713945806, -717258790, -720569853,
+-723878987, -727186183, -730491433, -733794726, -737096055,
+-740395410, -743692783, -746988165, -750281547, -753572921,
+-756862277, -760149606, -763434901, -766718151, -769999349,
+-773278485, -776555551, -779830538, -783103437, -786374239,
+-789642936, -792909519, -796173979, -799436307, -802696495,
+-805954534, -809210416, -812464130, -815715670, -818965026,
+-822212189, -825457150, -828699902, -831940435, -835178741,
+-838414810, -841648635, -844880207, -848109516, -851336555,
+-854561315, -857783787, -861003962, -864221832, -867437388,
+-870650622, -873861525, -877070088, -880276304, -883480162,
+-886681655, -889880774, -893077511, -896271856, -899463802,
+-902653340, -905840461, -909025157, -912207419, -915387239,
+-918564609, -921739519, -924911961, -928081927, -931249408,
+-934414396, -937576882, -940736858, -943894315, -947049246,
+-950201640, -953351491, -956498790, -959643527, -962785695,
+-965925286, -969062291, -972196701, -975328508, -978457704,
+-981584280, -984708228, -987829540, -990948208, -994064222,
+-997177575, -1000288258, -1003396263, -1006501581, -1009604205,
+-1012704126, -1015801336, -1018895826, -1021987588, -1025076613,
+-1028162895, -1031246424, -1034327191, -1037405190, -1040480411,
+-1043552847, -1046622488, -1049689328, -1052753357, -1055814567,
+-1058872951, -1061928500, -1064981206, -1068031060, -1071078055,
+-1074122183, -1077163435, -1080201802, -1083237278, -1086269854,
+-1089299521, -1092326272, -1095350099, -1098370993, -1101388946,
+-1104403951, -1107415998, -1110425081, -1113431191, -1116434320,
+-1119434460, -1122431603, -1125425740, -1128416865, -1131404968,
+-1134390043, -1137372080, -1140351072, -1143327011, -1146299889,
+-1149269698, -1152236431, -1155200078, -1158160632, -1161118086,
+-1164072431, -1167023660, -1169971764, -1172916735, -1175858567,
+-1178797250, -1181732777, -1184665141, -1187594332, -1190520344,
+-1193443169, -1196362799, -1199279225, -1202192441, -1205102438,
+-1208009209, -1210912745, -1213813040, -1216710085, -1219603872,
+-1222494394, -1225381643, -1228265611, -1231146291, -1234023675,
+-1236897754, -1239768523, -1242635972, -1245500094, -1248360882,
+-1251218327, -1254072422, -1256923160, -1259770533, -1262614533,
+-1265455153, -1268292384, -1271126220, -1273956653, -1276783675,
+-1279607279, -1282427457, -1285244201, -1288057504, -1290867359,
+-1293673758, -1296476693, -1299276157, -1302072143, -1304864643,
+-1307653649, -1310439154, -1313221151, -1315999631, -1318774589,
+-1321546016, -1324313904, -1327078247, -1329839037, -1332596266,
+-1335349928, -1338100015, -1340846519, -1343589433, -1346328751,
+-1349064463, -1351796564, -1354525046, -1357249901, -1359971122,
+-1362688702, -1365402634, -1368112911, -1370819524, -1373522468,
+-1376221734, -1378917315, -1381609205, -1384297396, -1386981880,
+-1389662652, -1392339702, -1395013025, -1397682613, -1400348459,
+-1403010556, -1405668897, -1408323474, -1410974281, -1413621310,
+-1416264555, -1418904007, -1421539661, -1424171509, -1426799544,
+-1429423759, -1432044147, -1434660701, -1437273414, -1439882279,
+-1442487289, -1445088437, -1447685717, -1450279120, -1452868640,
+-1455454271, -1458036005, -1460613835, -1463187755, -1465757757,
+-1468323835, -1470885982, -1473444191, -1475998456, -1478548768,
+-1481095122, -1483637511, -1486175927, -1488710365, -1491240816,
+-1493767276, -1496289736, -1498808190, -1501322631, -1503833053,
+-1506339448, -1508841811, -1511340134, -1513834411, -1516324634,
+-1518810798, -1521292896, -1523770921, -1526244866, -1528714725,
+-1531180491, -1533642158, -1536099718, -1538553166, -1541002495,
+-1543447698, -1545888769, -1548325701, -1550758488, -1553187123,
+-1555611600, -1558031911, -1560448052, -1562860014, -1565267793,
+-1567671380, -1570070771, -1572465958, -1574856935, -1577243696,
+-1579626234, -1582004542, -1584378616, -1586748447, -1589114030,
+-1591475359, -1593832427, -1596185227, -1598533754, -1600878002,
+-1603217963, -1605553632, -1607885003, -1610212069, -1612534823,
+-1614853261, -1617167375, -1619477159, -1621782608, -1624083714,
+-1626380473, -1628672877, -1630960921, -1633244598, -1635523902,
+-1637798828, -1640069368, -1642335518, -1644597271, -1646854620,
+-1649107561, -1651356086, -1653600190, -1655839867, -1658075111,
+-1660305916, -1662532275, -1664754184, -1666971635, -1669184624,
+-1671393143, -1673597188, -1675796752, -1677991829, -1680182414,
+-1682368500, -1684550083, -1686727155, -1688899711, -1691067746,
+-1693231253, -1695390227, -1697544662, -1699694551, -1701839891,
+-1703980674, -1706116895, -1708248548, -1710375628, -1712498128,
+-1714616044, -1716729369, -1718838098, -1720942225, -1723041744,
+-1725136651, -1727226938, -1729312602, -1731393635, -1733470033,
+-1735541790, -1737608901, -1739671359, -1741729160, -1743782298,
+-1745830767, -1747874561, -1749913677, -1751948107, -1753977847,
+-1756002891, -1758023233, -1760038869, -1762049792, -1764055998,
+-1766057481, -1768054236, -1770046258, -1772033540, -1774016078,
+-1775993866, -1777966900, -1779935173, -1781898681, -1783857419,
+-1785811380, -1787760560, -1789704954, -1791644556, -1793579362,
+-1795509366, -1797434562, -1799354946, -1801270513, -1803181257,
+-1805087174, -1806988258, -1808884503, -1810775906, -1812662462,
+-1814544164, -1816421007, -1818292988, -1820160101, -1822022340,
+-1823879702, -1825732180, -1827579771, -1829422468, -1831260267,
+-1833093164, -1834921153, -1836744229, -1838562388, -1840375624,
+-1842183933, -1843987310, -1845785751, -1847579249, -1849367801,
+-1851151401, -1852930046, -1854703729, -1856472447, -1858236195,
+-1859994968, -1861748761, -1863497569, -1865241388, -1866980214,
+-1868714041, -1870442864, -1872166681, -1873885484, -1875599271,
+-1877308036, -1879011776, -1880710484, -1882404157, -1884092791,
+-1885776380, -1887454920, -1889128407, -1890796837, -1892460204,
+-1894118504, -1895771734, -1897419887, -1899062961, -1900700951,
+-1902333851, -1903961659, -1905584369, -1907201977, -1908814479,
+-1910421871, -1912024148, -1913621306, -1915213340, -1916800247,
+-1918382022, -1919958661, -1921530159, -1923096514, -1924657719,
+-1926213771, -1927764667, -1929310401, -1930850970, -1932386369,
+-1933916595, -1935441643, -1936961510, -1938476190, -1939985681,
+-1941489978, -1942989077, -1944482974, -1945971664, -1947455145,
+-1948933412, -1950406461, -1951874289, -1953336890, -1954794262,
+-1956246401, -1957693301, -1959134961, -1960571375, -1962002540,
+-1963428453, -1964849109, -1966264504, -1967674635, -1969079498,
+-1970479089, -1971873404, -1973262440, -1974646194, -1976024660,
+-1977397836, -1978765718, -1980128302, -1981485585, -1982837563,
+-1984184232, -1985525589, -1986861630, -1988192351, -1989517750,
+-1990837822, -1992152564, -1993461973, -1994766044, -1996064775,
+-1997358161, -1998646200, -1999928888, -2001206222, -2002478198,
+-2003744813, -2005006063, -2006261945, -2007512455, -2008757591,
+-2009997349, -2011231726, -2012460718, -2013684322, -2014902534,
+-2016115352, -2017322773, -2018524792, -2019721407, -2020912615,
+-2022098413, -2023278796, -2024453763, -2025623309, -2026787432,
+-2027946129, -2029099397, -2030247232, -2031389631, -2032526592,
+-2033658111, -2034784185, -2035904812, -2037019988, -2038129710,
+-2039233976, -2040332782, -2041426125, -2042514003, -2043596412,
+-2044673350, -2045744814, -2046810801, -2047871308, -2048926332,
+-2049975870, -2051019920, -2052058479, -2053091544, -2054119112,
+-2055141181, -2056157747, -2057168809, -2058174363, -2059174406,
+-2060168936, -2061157951, -2062141448, -2063119423, -2064091875,
+-2065058800, -2066020197, -2066976063, -2067926394, -2068871190,
+-2069810446, -2070744160, -2071672331, -2072594955, -2073512030,
+-2074423554, -2075329524, -2076229937, -2077124792, -2078014086,
+-2078897817, -2079775981, -2080648577, -2081515603, -2082377056,
+-2083232934, -2084083234, -2084927955, -2085767094, -2086600648,
+-2087428616, -2088250996, -2089067784, -2089878979, -2090684580,
+-2091484582, -2092278986, -2093067787, -2093850985, -2094628577,
+-2095400561, -2096166935, -2096927697, -2097682844, -2098432376,
+-2099176290, -2099914583, -2100647254, -2101374302, -2102095723,
+-2102811516, -2103521679, -2104226211, -2104925109, -2105618372,
+-2106305997, -2106987983, -2107664327, -2108335029, -2109000087,
+-2109659498, -2110313260, -2110961373, -2111603834, -2112240642,
+-2112871795, -2113497290, -2114117128, -2114731305, -2115339820,
+-2115942673, -2116539860, -2117131380, -2117717232, -2118297415,
+-2118871926, -2119440764, -2120003928, -2120561416, -2121113227,
+-2121659358, -2122199810, -2122734579, -2123263666, -2123787068,
+-2124304784, -2124816812, -2125323152, -2125823801, -2126318759,
+-2126808025, -2127291596, -2127769472, -2128241651, -2128708132,
+-2129168914, -2129623995, -2130073375, -2130517052, -2130955025,
+-2131387293, -2131813854, -2132234708, -2132649854, -2133059289,
+-2133463014, -2133861027, -2134253326, -2134639912, -2135020783,
+-2135395937, -2135765375, -2136129094, -2136487095, -2136839375,
+-2137185934, -2137526772, -2137861886, -2138191277, -2138514944,
+-2138832885, -2139145099, -2139451587, -2139752346, -2140047377,
+-2140336678, -2140620249, -2140898089, -2141170197, -2141436573,
+-2141697215, -2141952123, -2142201296, -2142444735, -2142682437,
+-2142914403, -2143140631, -2143361122, -2143575874, -2143784887,
+-2143988161, -2144185694, -2144377487, -2144563539, -2144743849,
+-2144918417, -2145087242, -2145250325, -2145407663, -2145559258,
+-2145705109, -2145845215, -2145979576, -2146108191, -2146231061,
+-2146348185, -2146459562, -2146565192, -2146665076, -2146759212,
+-2146847600, -2146930241, -2147007134, -2147078279, -2147143675,
+-2147203323, -2147257222, -2147305372, -2147347773, -2147384426,
+-2147415329, -2147440482, -2147459887, -2147473542, -2147481447,
+2147483468, 2147469095, 2147431723, 2147371355, 2147287990,
+2147181629, 2147052273, 2146899924, 2146724584, 2146526254,
+2146304937, 2146060634, 2145793349, 2145503083, 2145189842,
+2144853627, 2144494442, 2144112292, 2143707180, 2143279110,
+2142828088, 2142354118, 2141857204, 2141337354, 2140794571,
+2140228862, 2139640233, 2139028690, 2138394240, 2137736889,
+2137056645, 2136353515, 2135627506, 2134878626, 2134106884,
+2133312286, 2132494843, 2131654563, 2130791454, 2129905526,
+2128996788, 2128065251, 2127110924, 2126133817, 2125133941,
+2124111307, 2123065925, 2121997806, 2120906963, 2119793407,
+2118657149, 2117498202, 2116316578, 2115112291, 2113885352,
+2112635775, 2111363574, 2110068761, 2108751352, 2107411359,
+2106048798, 2104663683, 2103256028, 2101825849, 2100373162,
+2098897981, 2097400322, 2095880202, 2094337637, 2092772643,
+2091185237, 2089575437, 2087943258, 2086288720, 2084611839,
+2082912633, 2081191122, 2079447322, 2077681253, 2075892934,
+2074082383, 2072249621, 2070394667, 2068517540, 2066618262,
+2064696851, 2062753329, 2060787717, 2058800036, 2056790306,
+2054758550, 2052704789, 2050629045, 2048531340, 2046411698,
+2044270140, 2042106689, 2039921369, 2037714204, 2035485216,
+2033234429, 2030961869, 2028667558, 2026351522, 2024013785,
+2021654373, 2019273310, 2016870623, 2014446336, 2012000477,
+2009533071, 2007044144, 2004533723, 2002001835, 1999448508,
+1996873768, 1994277643, 1991660161, 1989021350, 1986361238,
+1983679853, 1980977226, 1978253383, 1975508355, 1972742171,
+1969954860, 1967146453, 1964316979, 1961466469, 1958594953,
+1955702462, 1952789027, 1949854680, 1946899451, 1943923372,
+1940926475, 1937908793, 1934870357, 1931811201, 1928731356,
+1925630856, 1922509734, 1919368023, 1916205758, 1913022972,
+1909819698, 1906595972, 1903351828, 1900087301, 1896802425,
+1893497236, 1890171769, 1886826060, 1883460144, 1880074058,
+1876667838, 1873241521, 1869795142, 1866328740, 1862842350,
+1859336011, 1855809760, 1852263635, 1848697674, 1845111914,
+1841506395, 1837881155, 1834236233, 1830571667, 1826887497,
+1823183763, 1819460504, 1815717761, 1811955572, 1808173978,
+1804373021, 1800552740, 1796713177, 1792854372, 1788976368,
+1785079205, 1781162925, 1777227570, 1773273182, 1769299805,
+1765307479, 1761296249, 1757266156, 1753217244, 1749149557,
+1745063138, 1740958031, 1736834279, 1732691928, 1728531020,
+1724351602, 1720153717, 1715937410, 1711702727, 1707449714,
+1703178415, 1698888876, 1694581143, 1690255263, 1685911282,
+1681549245, 1677169201, 1672771196, 1668355276, 1663921490,
+1659469885, 1655000508, 1650513407, 1646008631, 1641486227,
+1636946244, 1632388731, 1627813736, 1623221309, 1618611498,
+1613984353, 1609339924, 1604678260, 1599999411, 1595303428,
+1590590360, 1585860258, 1581113173, 1576349155, 1571568256,
+1566770527, 1561956018, 1557124783, 1552276872, 1547412337,
+1542531231, 1537633606, 1532719513, 1527789007, 1522842139,
+1517878963, 1512899531, 1507903898, 1502892116, 1497864239,
+1492820322, 1487760417, 1482684580, 1477592864, 1472485325,
+1467362016, 1462222994, 1457068312, 1451898025, 1446712191,
+1441510863, 1436294098, 1431061951, 1425814478, 1420551737,
+1415273782, 1409980671, 1404672460, 1399349206, 1394010966,
+1388657798, 1383289758, 1377906904, 1372509294, 1367096986,
+1361670037, 1356228505, 1350772450, 1345301929, 1339817000,
+1334317724, 1328804158, 1323276361, 1317734393, 1312178313,
+1306608181, 1301024057, 1295425999, 1289814068, 1284188325,
+1278548828, 1272895640, 1267228820, 1261548429, 1255854528,
+1250147177, 1244426439, 1238692373, 1232945043, 1227184508,
+1221410831, 1215624074, 1209824299, 1204011567, 1198185941,
+1192347484, 1186496258, 1180632325, 1174755748, 1168866591,
+1162964917, 1157050787, 1151124267, 1145185419, 1139234307,
+1133270995, 1127295547, 1121308026, 1115308496, 1109297023,
+1103273670, 1097238502, 1091191583, 1085132978, 1079062753,
+1072980972, 1066887699, 1060783002, 1054666944, 1048539592,
+1042401010, 1036251266, 1030090423, 1023918550, 1017735711,
+1011541973, 1005337402, 999122065, 992896028, 986659358,
+980412122, 974154386, 967886217, 961607684, 955318852,
+949019790, 942710564, 936391243, 930061894, 923722585,
+917373383, 911014357, 904645574, 898267104, 891879014,
+885481373, 879074249, 872657710, 866231826, 859796666,
+853352298, 846898791, 840436214, 833964638, 827484130,
+820994760, 814496598, 807989714, 801474176, 794950056,
+788417422, 781876345, 775326894, 768769141, 762203154,
+755629005, 749046764, 742456501, 735858287, 729252193,
+722638289, 716016646, 709387335, 702750427, 696105993,
+689454104, 682794832, 676128248, 669454423, 662773428,
+656085336, 649390218, 642688145, 635979190, 629263424,
+622540918, 615811746, 609075979, 602333690, 595584950,
+588829831, 582068407, 575300749, 568526931, 561747023,
+554961100, 548169234, 541371497, 534567963, 527758704,
+520943793, 514123303, 507297307, 500465878, 493629090,
+486787016, 479939728, 473087301, 466229807, 459367320,
+452499914, 445627662, 438750638, 431868915, 424982567,
+418091668, 411196291, 404296511, 397392401, 390484035,
+383571488, 376654833, 369734144, 362809495, 355880961,
+348948616, 342012534, 335072790, 328129457, 321182610,
+314232323, 307278671, 300321729, 293361570, 286398270,
+279431902, 272462542, 265490265, 258515144, 251537254,
+244556671, 237573469, 230587722, 223599506, 216608896,
+209615966, 202620791, 195623446, 188624006, 181622546,
+174619141, 167613866, 160606796, 153598006, 146587571,
+139575567, 132562067, 125547148, 118530885, 111513352,
+104494625, 97474778, 90453888, 83432030, 76409277,
+69385707, 62361393, 55336412, 48310838, 41284746,
+34258213, 27231312, 20204120, 13176712, 6149162,
+-878453, -7906059, -14933580, -21960942, -28988068,
+-36014884, -43041314, -50067283, -57092716, -64117537,
+-71141672, -78165045, -85187581, -92209205, -99229841,
+-106249414, -113267850, -120285073, -127301007, -134315578,
+-141328711, -148340330, -155350361, -162358728, -169365356,
+-176370170, -183373096, -190374058, -197372981, -204369791,
+-211364411, -218356769, -225346788, -232334393, -239319511,
+-246302065, -253281982, -260259186, -267233603, -274205159,
+-281173778, -288139385, -295101907, -302061269, -309017396,
+-315970213, -322919647, -329865622, -336808065, -343746901,
+-350682056, -357613455, -364541025, -371464690, -378384377,
+-385300013, -392211522, -399118830, -406021865, -412920551,
+-419814815, -426704583, -433589782, -440470337, -447346176,
+-454217223, -461083406, -467944652, -474800886, -481652035,
+-488498026, -495338786, -502174241, -509004318, -515828944,
+-522648046, -529461551, -536269386, -543071478, -549867754,
+-556658141, -563442567, -570220959, -576993244, -583759350,
+-590519205, -597272736, -604019870, -610760536, -617494660,
+-624222173, -630943000, -637657070, -644364312, -651064652,
+-657758021, -664444345, -671123554, -677795576, -684460338,
+-691117771, -697767803, -704410362, -711045377, -717672778,
+-724292493, -730904451, -737508582, -744104815, -750693079,
+-757273304, -763845419, -770409354, -776965038, -783512402,
+-790051375, -796581887, -803103868, -809617249, -816121959,
+-822617929, -829105090, -835583372, -842052705, -848513021,
+-854964249, -861406322, -867839170, -874262724, -880676915,
+-887081675, -893476935, -899862626, -906238681, -912605031,
+-918961607, -925308342, -931645168, -937972016, -944288820,
+-950595511, -956892022, -963178285, -969454234, -975719800,
+-981974918, -988219519, -994453537, -1000676905, -1006889557,
+-1013091426, -1019282445, -1025462549, -1031631671, -1037789745,
+-1043936705, -1050072485, -1056197020, -1062310244, -1068412091,
+-1074502497, -1080581395, -1086648722, -1092704411, -1098748398,
+-1104780618, -1110801008, -1116809501, -1122806034, -1128790543,
+-1134762964, -1140723232, -1146671283, -1152607055, -1158530484,
+-1164441505, -1170340057, -1176226074, -1182099496, -1187960258,
+-1193808298, -1199643553, -1205465961, -1211275460, -1217071986,
+-1222855479, -1228625876, -1234383115, -1240127136, -1245857875,
+-1251575272, -1257279266, -1262969796, -1268646800, -1274310217,
+-1279959989, -1285596052, -1291218348, -1296826816, -1302421396,
+-1308002029, -1313568653, -1319121210, -1324659641, -1330183885,
+-1335693885, -1341189580, -1346670912, -1352137822, -1357590252,
+-1363028143, -1368451438, -1373860077, -1379254004, -1384633159,
+-1389997487, -1395346928, -1400681427, -1406000925, -1411305366,
+-1416594694, -1421868850, -1427127780, -1432371426, -1437599733,
+-1442812644, -1448010104, -1453192057, -1458358447, -1463509220,
+-1468644319, -1473763690, -1478867279, -1483955030, -1489026889,
+-1494082802, -1499122714, -1504146572, -1509154322, -1514145910,
+-1519121283, -1524080387, -1529023170, -1533949577, -1538859558,
+-1543753058, -1548630027, -1553490410, -1558334157, -1563161216,
+-1567971534, -1572765060, -1577541744, -1582301533, -1587044377,
+-1591770225, -1596479027, -1601170732, -1605845289, -1610502649,
+-1615142762, -1619765578, -1624371047, -1628959121, -1633529750,
+-1638082885, -1642618478, -1647136479, -1651636841, -1656119516,
+-1660584454, -1665031609, -1669460933, -1673872378, -1678265898,
+-1682641444, -1686998971, -1691338432, -1695659779, -1699962968,
+-1704247951, -1708514683, -1712763118, -1716993211, -1721204917,
+-1725398189, -1729572984, -1733729257, -1737866963, -1741986057,
+-1746086497, -1750168237, -1754231234, -1758275445, -1762300826,
+-1766307335, -1770294927, -1774263561, -1778213194, -1782143784,
+-1786055289, -1789947667, -1793820875, -1797674873, -1801509620,
+-1805325074, -1809121194, -1812897940, -1816655271, -1820393147,
+-1824111529, -1827810376, -1831489648, -1835149306, -1838789312,
+-1842409625, -1846010208, -1849591022, -1853152028, -1856693188,
+-1860214464, -1863715819, -1867197215, -1870658615, -1874099982,
+-1877521279, -1880922469, -1884303515, -1887664383, -1891005035,
+-1894325435, -1897625550, -1900905342, -1904164776, -1907403819,
+-1910622435, -1913820590, -1916998250, -1920155379, -1923291946,
+-1926407915, -1929503255, -1932577931, -1935631910, -1938665161,
+-1941677650, -1944669345, -1947640214, -1950590226, -1953519348,
+-1956427550, -1959314800, -1962181067, -1965026321, -1967850531,
+-1970653667, -1973435699, -1976196596, -1978936331, -1981654873,
+-1984352192, -1987028261, -1989683050, -1992316532, -1994928677,
+-1997519459, -2000088848, -2002636818, -2005163342, -2007668391,
+-2010151941, -2012613963, -2015054432, -2017473321, -2019870604,
+-2022246257, -2024600252, -2026932566, -2029243173, -2031532049,
+-2033799168, -2036044507, -2038268042, -2040469748, -2042649603,
+-2044807583, -2046943664, -2049057824, -2051150040, -2053220291,
+-2055268553, -2057294804, -2059299024, -2061281190, -2063241282,
+-2065179277, -2067095157, -2068988899, -2070860485, -2072709893,
+-2074537104, -2076342098, -2078124857, -2079885360, -2081623590,
+-2083339527, -2085033153, -2086704450, -2088353400, -2089979985,
+-2091584189, -2093165993, -2094725382, -2096262337, -2097776843,
+-2099268884, -2100738443, -2102185505, -2103610054, -2105012075,
+-2106391553, -2107748474, -2109082822, -2110394584, -2111683744,
+-2112950291, -2114194210, -2115415487, -2116614110, -2117790065,
+-2118943341, -2120073924, -2121181804, -2122266967, -2123329402,
+-2124369098, -2125386044, -2126380229, -2127351642, -2128300272,
+-2129226111, -2130129147, -2131009371, -2131866773, -2132701345,
+-2133513078, -2134301962, -2135067990, -2135811153, -2136531442,
+-2137228852, -2137903373, -2138555000, -2139183723, -2139789539,
+-2140372438, -2140932416, -2141469466, -2141983583, -2142474761,
+-2142942995, -2143388280, -2143810610, -2144209982, -2144586392,
+-2144939834, -2145270306, -2145577804, -2145862324, -2146123864,
+-2146362421, -2146577992, -2146770575, -2146940167, -2147086768,
+-2147210375, -2147310987, -2147388603, -2147443222, -2147474844,
+2147482929, 2147425435, 2147275952, 2147034487, 2146701050,
+2146275656, 2145758322, 2145149071, 2144447929, 2143654926,
+2142770096, 2141793477, 2140725111, 2139565043, 2138313323,
+2136970005, 2135535146, 2134008809, 2132391057, 2130681961,
+2128881593, 2126990031, 2125007356, 2122933653, 2120769010,
+2118513521, 2116167282, 2113730393, 2111202959, 2108585087,
+2105876892, 2103078487, 2100189994, 2097211535, 2094143239,
+2090985237, 2087737664, 2084400659, 2080974365, 2077458929,
+2073854502, 2070161238, 2066379295, 2062508835, 2058550025,
+2054503033, 2050368032, 2046145201, 2041834720, 2037436773,
+2032951550, 2028379241, 2023720043, 2018974156, 2014141783,
+2009223131, 2004218410, 1999127836, 1993951625, 1988690000,
+1983343186, 1977911412, 1972394912, 1966793920, 1961108677,
+1955339428, 1949486417, 1943549898, 1937530123, 1931427351,
+1925241843, 1918973864, 1912623682, 1906191570, 1899677803,
+1893082661, 1886406424, 1879649381, 1872811820, 1865894033,
+1858896318, 1851818974, 1844662304, 1837426615, 1830112217,
+1822719423, 1815248550, 1807699917, 1800073849, 1792370671,
+1784590714, 1776734311, 1768801799, 1760793518, 1752709809,
+1744551021, 1736317502, 1728009604, 1719627685, 1711172102,
+1702643219, 1694041400, 1685367013, 1676620432, 1667802029,
+1658912184, 1649951276, 1640919689, 1631817811, 1622646032,
+1613404744, 1604094343, 1594715227, 1585267800, 1575752465,
+1566169630, 1556519705, 1546803104, 1537020244, 1527171542,
+1517257422, 1507278307, 1497234626, 1487126808, 1476955286,
+1466720497, 1456422878, 1446062871, 1435640919, 1425157469,
+1414612971, 1404007875, 1393342636, 1382617710, 1371833558,
+1360990642, 1350089425, 1339130374, 1328113960, 1317040654,
+1305910930, 1294725265, 1283484138, 1272188032, 1260837429,
+1249432816, 1237974681, 1226463516, 1214899813, 1203284068,
+1191616778, 1179898443, 1168129565, 1156310649, 1144442200,
+1132524727, 1120558740, 1108544752, 1096483278, 1084374834,
+1072219940, 1060019115, 1047772882, 1035481766, 1023146293,
+1010766993, 998344394, 985879030, 973371434, 960822142,
+948231691, 935600622, 922929474, 910218791, 897469118,
+884680999, 871854984, 858991622, 846091463, 833155061,
+820182969, 807175743, 794133941, 781058120, 767948841,
+754806666, 741632158, 728425880, 715188400, 701920283,
+688622098, 675294414, 661937804, 648552838, 635140090,
+621700135, 608233549, 594740907, 581222789, 567679774,
+554112440, 540521371, 526907147, 513270353, 499611571,
+485931388, 472230390, 458509162, 444768294, 431008373,
+417229989, 403433732, 389620194, 375789965, 361943639,
+348081809, 334205068, 320314011, 306409232, 292491328,
+278560894, 264618528, 250664827, 236700388, 222725809,
+208741690, 194748629, 180747225, 166738079, 152721790,
+138698959, 124670187, 110636075, 96597223, 82554233,
+68507707, 54458246, 40406452, 26352928, 12298274,
+-1756906, -15812011, -29866438, -43919586, -57970853,
+-72019637, -86065335, -100107347, -114145071, -128177904,
+-142205248, -156226499, -170241059, -184248325, -198247699,
+-212238581, -226220372, -240192472, -254154282, -268105206,
+-282044645, -295972002, -309886680, -323788084, -337675619,
+-351548688, -365406698, -379249055, -393075166, -406884440,
+-420676284, -434450107, -448205320, -461941333, -475657559,
+-489353409, -503028296, -516681636, -530312842, -543921332,
+-557506522, -571067830, -584604676, -598116479, -611602660,
+-625062643, -638495850, -651901706, -665279637, -678629069,
+-691949432, -705240153, -718500664, -731730397, -744928785,
+-758095263, -771229267, -784330234, -797397602, -810430813,
+-823429308, -836392529, -849319923, -862210934, -875065011,
+-887881603, -900660162, -913400139, -926100989, -938762167,
+-951383133, -963963344, -976502263, -988999351, -1001454074,
+-1013865898, -1026234291, -1038558724, -1050838668, -1063073598,
+-1075262990, -1087406320, -1099503070, -1111552721, -1123554757,
+-1135508663, -1147413928, -1159270041, -1171076495, -1182832785,
+-1194538405, -1206192856, -1217795637, -1229346252, -1240844206,
+-1252289006, -1263680162, -1275017186, -1286299593, -1297526899,
+-1308698624, -1319814288, -1330873416, -1341875533, -1352820169,
+-1363706855, -1374535124, -1385304512, -1396014559, -1406664805,
+-1417254794, -1427784073, -1438252190, -1448658697, -1459003149,
+-1469285102, -1479504115, -1489659751, -1499751576, -1509779156,
+-1519742062, -1529639867, -1539472148, -1549238483, -1558938453,
+-1568571644, -1578137643, -1587636039, -1597066426, -1606428400,
+-1615721561, -1624945509, -1634099849, -1643184191, -1652198144,
+-1661141322, -1670013342, -1678813825, -1687542393, -1696198672,
+-1704782292, -1713292884, -1721730085, -1730093532, -1738382868,
+-1746597738, -1754737789, -1762802673, -1770792044, -1778705561,
+-1786542883, -1794303676, -1801987607, -1809594347, -1817123570,
+-1824574954, -1831948179, -1839242929, -1846458892, -1853595759,
+-1860653224, -1867630985, -1874528743, -1881346202, -1888083070,
+-1894739060, -1901313885, -1907807264, -1914218919, -1920548575,
+-1926795962, -1932960811, -1939042858, -1945041843, -1950957509,
+-1956789602, -1962537873, -1968202076, -1973781967, -1979277308,
+-1984687864, -1990013401, -1995253694, -2000408516, -2005477648,
+-2010460871, -2015357973, -2020168744, -2024892978, -2029530472,
+-2034081027, -2038544449, -2042920547, -2047209133, -2051410023,
+-2055523038, -2059548001, -2063484740, -2067333086, -2071092874,
+-2074763944, -2078346137, -2081839301, -2085243286, -2088557947,
+-2091783140, -2094918728, -2097964577, -2100920556, -2103786539,
+-2106562402, -2109248028, -2111843300, -2114348108, -2116762344,
+-2119085905, -2121318692, -2123460608, -2125511562, -2127471467,
+-2129340237, -2131117794, -2132804061, -2134398966, -2135902440,
+-2137314419, -2138634843, -2139863654, -2141000801, -2142046235,
+-2142999911, -2143861787, -2144631828, -2145310000, -2145896274,
+-2146390624, -2146793031, -2147103476, -2147321946, -2147448433,
+2147480773, 2147250799, 2146652904, 2145687192, 2144353827,
+2142653038, 2140585116, 2138150417, 2135349356, 2132182414,
+2128650133, 2124753120, 2120492040, 2115867626, 2110880668,
+2105532022, 2099822604, 2093753392, 2087325426, 2080539807,
+2073397699, 2065900325, 2058048970, 2049844978, 2041289756,
+2032384769, 2023131544, 2013531666, 2003586779, 1993298588,
+1982668856, 1971699403, 1960392110, 1948748914, 1936771810,
+1924462850, 1911824143, 1898857855, 1885566207, 1871951478,
+1858015999, 1843762158, 1829192399, 1814309216, 1799115162,
+1783612838, 1767804901, 1751694060, 1735283075, 1718574758,
+1701571972, 1684277631, 1666694698, 1648826185, 1630675154,
+1612244715, 1593538026, 1574558293, 1555308768, 1535792748,
+1516013578, 1495974647, 1475679389, 1455131280, 1434333842,
+1413290638, 1392005275, 1370481398, 1348722696, 1326732898,
+1304515771, 1282075122, 1259414796, 1236538675, 1213450681,
+1190154767, 1166654927, 1142955186, 1119059606, 1094972281,
+1070697338, 1046238936, 1021601267, 996788551, 971805042,
+946655018, 921342790, 895872694, 870249095, 844476384,
+818558976, 792501312, 766307857, 739983099, 713531549,
+686957739, 660266222, 633461572, 606548381, 579531262,
+552414843, 525203770, 497902707, 470516330, 443049333,
+415506422, 387892316, 360211746, 332469456, 304670200,
+276818739, 248919847, 220978304, 192998897, 164986421,
+136945676, 108881465, 80798598, 52701887, 24596146,
+-3513810, -31623164, -59727099, -87820801, -115899455,
+-143958250, -171992378, -199997036, -227967426, -255898755,
+-283786237, -311625094, -339410555, -367137861, -394802258,
+-422399009, -449923384, -477370666, -504736154, -532015158,
+-559203003, -586295032, -613286603, -640173090, -666949886,
+-693612404, -720156076, -746576352, -772868706, -799028633,
+-825051651, -850933300, -876669146, -902254780, -927685817,
+-952957899, -978066697, -1003007909, -1027777260, -1052370507,
+-1076783436, -1101011863, -1125051638, -1148898640, -1172548785,
+-1195998020, -1219242327, -1242277723, -1265100260, -1287706030,
+-1310091157, -1332251808, -1354184184, -1375884527, -1397349119,
+-1418574283, -1439556382, -1460291820, -1480777044, -1501008545,
+-1520982856, -1540696555, -1560146263, -1579328647, -1598240423,
+-1616878347, -1635239228, -1653319919, -1671117323, -1688628389,
+-1705850117, -1722779556, -1739413807, -1755750017, -1771785389,
+-1787517174, -1802942678, -1818059257, -1832864320, -1847355332,
+-1861529809, -1875385322, -1888919498, -1902130017, -1915014616,
+-1927571087, -1939797279, -1951691096, -1963250501, -1974473513,
+-1985358210, -1995902725, -2006105253, -2015964045, -2025477412,
+-2034643724, -2043461410, -2051928960, -2060044922, -2067807906,
+-2075216581, -2082269679, -2088965991, -2095304370, -2101283728,
+-2106903043, -2112161350, -2117057750, -2121591402, -2125761531,
+-2129567422, -2133008422, -2136083942, -2138793455, -2141136497,
+-2143112666, -2144721624, -2145963095, -2146836866, -2147342788,
+#else
+32767, 32767, 32767, 32767, 32767,
+32767, 32766, 32766, 32765, 32764,
+32764, 32763, 32762, 32760, 32759,
+32758, 32757, 32755, 32754, 32752,
+32750, 32748, 32747, 32745, 32742,
+32740, 32738, 32736, 32733, 32731,
+32728, 32726, 32723, 32720, 32717,
+32714, 32711, 32708, 32704, 32701,
+32697, 32694, 32690, 32686, 32683,
+32679, 32675, 32671, 32666, 32662,
+32658, 32653, 32649, 32644, 32640,
+32635, 32630, 32625, 32620, 32615,
+32610, 32604, 32599, 32593, 32588,
+32582, 32576, 32571, 32565, 32559,
+32553, 32546, 32540, 32534, 32527,
+32521, 32514, 32507, 32501, 32494,
+32487, 32480, 32473, 32465, 32458,
+32451, 32443, 32436, 32428, 32420,
+32412, 32404, 32396, 32388, 32380,
+32372, 32364, 32355, 32347, 32338,
+32329, 32320, 32312, 32303, 32294,
+32284, 32275, 32266, 32257, 32247,
+32237, 32228, 32218, 32208, 32198,
+32188, 32178, 32168, 32158, 32147,
+32137, 32127, 32116, 32105, 32094,
+32084, 32073, 32062, 32051, 32039,
+32028, 32017, 32005, 31994, 31982,
+31970, 31959, 31947, 31935, 31923,
+31910, 31898, 31886, 31874, 31861,
+31848, 31836, 31823, 31810, 31797,
+31784, 31771, 31758, 31745, 31732,
+31718, 31705, 31691, 31677, 31664,
+31650, 31636, 31622, 31608, 31593,
+31579, 31565, 31550, 31536, 31521,
+31507, 31492, 31477, 31462, 31447,
+31432, 31417, 31401, 31386, 31371,
+31355, 31339, 31324, 31308, 31292,
+31276, 31260, 31244, 31228, 31212,
+31195, 31179, 31162, 31146, 31129,
+31112, 31095, 31078, 31061, 31044,
+31027, 31010, 30992, 30975, 30957,
+30940, 30922, 30904, 30886, 30868,
+30850, 30832, 30814, 30796, 30777,
+30759, 30740, 30722, 30703, 30684,
+30665, 30646, 30627, 30608, 30589,
+30570, 30551, 30531, 30512, 30492,
+30472, 30453, 30433, 30413, 30393,
+30373, 30353, 30332, 30312, 30292,
+30271, 30251, 30230, 30209, 30188,
+30167, 30146, 30125, 30104, 30083,
+30062, 30040, 30019, 29997, 29976,
+29954, 29932, 29910, 29889, 29867,
+29844, 29822, 29800, 29778, 29755,
+29733, 29710, 29687, 29665, 29642,
+29619, 29596, 29573, 29550, 29527,
+29503, 29480, 29457, 29433, 29409,
+29386, 29362, 29338, 29314, 29290,
+29266, 29242, 29218, 29193, 29169,
+29145, 29120, 29095, 29071, 29046,
+29021, 28996, 28971, 28946, 28921,
+28896, 28870, 28845, 28819, 28794,
+28768, 28743, 28717, 28691, 28665,
+28639, 28613, 28587, 28560, 28534,
+28508, 28481, 28455, 28428, 28401,
+28375, 28348, 28321, 28294, 28267,
+28240, 28212, 28185, 28158, 28130,
+28103, 28075, 28047, 28020, 27992,
+27964, 27936, 27908, 27880, 27851,
+27823, 27795, 27766, 27738, 27709,
+27681, 27652, 27623, 27594, 27565,
+27536, 27507, 27478, 27449, 27419,
+27390, 27360, 27331, 27301, 27272,
+27242, 27212, 27182, 27152, 27122,
+27092, 27062, 27032, 27001, 26971,
+26940, 26910, 26879, 26848, 26818,
+26787, 26756, 26725, 26694, 26663,
+26631, 26600, 26569, 26537, 26506,
+26474, 26443, 26411, 26379, 26347,
+26316, 26284, 26251, 26219, 26187,
+26155, 26123, 26090, 26058, 26025,
+25993, 25960, 25927, 25894, 25861,
+25828, 25795, 25762, 25729, 25696,
+25663, 25629, 25596, 25562, 25529,
+25495, 25461, 25428, 25394, 25360,
+25326, 25292, 25258, 25223, 25189,
+25155, 25120, 25086, 25051, 25017,
+24982, 24947, 24913, 24878, 24843,
+24808, 24773, 24738, 24702, 24667,
+24632, 24596, 24561, 24525, 24490,
+24454, 24419, 24383, 24347, 24311,
+24275, 24239, 24203, 24167, 24130,
+24094, 24058, 24021, 23985, 23948,
+23912, 23875, 23838, 23801, 23764,
+23728, 23690, 23653, 23616, 23579,
+23542, 23504, 23467, 23430, 23392,
+23355, 23317, 23279, 23241, 23204,
+23166, 23128, 23090, 23052, 23014,
+22975, 22937, 22899, 22860, 22822,
+22783, 22745, 22706, 22668, 22629,
+22590, 22551, 22512, 22473, 22434,
+22395, 22356, 22317, 22277, 22238,
+22199, 22159, 22120, 22080, 22040,
+22001, 21961, 21921, 21881, 21841,
+21801, 21761, 21721, 21681, 21641,
+21600, 21560, 21520, 21479, 21439,
+21398, 21357, 21317, 21276, 21235,
+21194, 21153, 21112, 21071, 21030,
+20989, 20948, 20907, 20865, 20824,
+20783, 20741, 20700, 20658, 20616,
+20575, 20533, 20491, 20449, 20407,
+20365, 20323, 20281, 20239, 20197,
+20155, 20112, 20070, 20028, 19985,
+19943, 19900, 19857, 19815, 19772,
+19729, 19686, 19643, 19601, 19558,
+19514, 19471, 19428, 19385, 19342,
+19298, 19255, 19212, 19168, 19125,
+19081, 19038, 18994, 18950, 18906,
+18863, 18819, 18775, 18731, 18687,
+18643, 18599, 18554, 18510, 18466,
+18422, 18377, 18333, 18288, 18244,
+18199, 18155, 18110, 18065, 18021,
+17976, 17931, 17886, 17841, 17796,
+17751, 17706, 17661, 17616, 17570,
+17525, 17480, 17434, 17389, 17344,
+17298, 17252, 17207, 17161, 17116,
+17070, 17024, 16978, 16932, 16886,
+16840, 16794, 16748, 16702, 16656,
+16610, 16564, 16517, 16471, 16425,
+16378, 16332, 16285, 16239, 16192,
+16145, 16099, 16052, 16005, 15958,
+15912, 15865, 15818, 15771, 15724,
+15677, 15630, 15583, 15535, 15488,
+15441, 15394, 15346, 15299, 15251,
+15204, 15156, 15109, 15061, 15014,
+14966, 14918, 14870, 14823, 14775,
+14727, 14679, 14631, 14583, 14535,
+14487, 14439, 14391, 14342, 14294,
+14246, 14198, 14149, 14101, 14053,
+14004, 13956, 13907, 13858, 13810,
+13761, 13713, 13664, 13615, 13566,
+13517, 13469, 13420, 13371, 13322,
+13273, 13224, 13175, 13126, 13076,
+13027, 12978, 12929, 12880, 12830,
+12781, 12731, 12682, 12633, 12583,
+12534, 12484, 12434, 12385, 12335,
+12285, 12236, 12186, 12136, 12086,
+12037, 11987, 11937, 11887, 11837,
+11787, 11737, 11687, 11637, 11586,
+11536, 11486, 11436, 11386, 11335,
+11285, 11235, 11184, 11134, 11083,
+11033, 10982, 10932, 10881, 10831,
+10780, 10729, 10679, 10628, 10577,
+10527, 10476, 10425, 10374, 10323,
+10272, 10221, 10170, 10119, 10068,
+10017, 9966, 9915, 9864, 9813,
+9762, 9711, 9659, 9608, 9557,
+9506, 9454, 9403, 9352, 9300,
+9249, 9197, 9146, 9094, 9043,
+8991, 8940, 8888, 8836, 8785,
+8733, 8681, 8630, 8578, 8526,
+8475, 8423, 8371, 8319, 8267,
+8215, 8163, 8111, 8059, 8007,
+7955, 7903, 7851, 7799, 7747,
+7695, 7643, 7591, 7539, 7487,
+7434, 7382, 7330, 7278, 7225,
+7173, 7121, 7068, 7016, 6964,
+6911, 6859, 6806, 6754, 6701,
+6649, 6596, 6544, 6491, 6439,
+6386, 6334, 6281, 6228, 6176,
+6123, 6070, 6018, 5965, 5912,
+5859, 5807, 5754, 5701, 5648,
+5595, 5543, 5490, 5437, 5384,
+5331, 5278, 5225, 5172, 5119,
+5066, 5013, 4960, 4907, 4854,
+4801, 4748, 4695, 4642, 4589,
+4536, 4483, 4430, 4377, 4324,
+4270, 4217, 4164, 4111, 4058,
+4005, 3951, 3898, 3845, 3792,
+3738, 3685, 3632, 3578, 3525,
+3472, 3419, 3365, 3312, 3259,
+3205, 3152, 3098, 3045, 2992,
+2938, 2885, 2831, 2778, 2725,
+2671, 2618, 2564, 2511, 2457,
+2404, 2350, 2297, 2243, 2190,
+2136, 2083, 2029, 1976, 1922,
+1869, 1815, 1762, 1708, 1655,
+1601, 1548, 1494, 1440, 1387,
+1333, 1280, 1226, 1173, 1119,
+1065, 1012, 958, 905, 851,
+797, 744, 690, 637, 583,
+529, 476, 422, 369, 315,
+261, 208, 154, 101, 47,
+-7, -60, -114, -168, -221,
+-275, -328, -382, -436, -489,
+-543, -596, -650, -704, -757,
+-811, -864, -918, -972, -1025,
+-1079, -1132, -1186, -1240, -1293,
+-1347, -1400, -1454, -1507, -1561,
+-1615, -1668, -1722, -1775, -1829,
+-1882, -1936, -1989, -2043, -2096,
+-2150, -2203, -2257, -2310, -2364,
+-2417, -2471, -2524, -2578, -2631,
+-2685, -2738, -2791, -2845, -2898,
+-2952, -3005, -3058, -3112, -3165,
+-3218, -3272, -3325, -3379, -3432,
+-3485, -3538, -3592, -3645, -3698,
+-3752, -3805, -3858, -3911, -3965,
+-4018, -4071, -4124, -4177, -4231,
+-4284, -4337, -4390, -4443, -4496,
+-4549, -4602, -4656, -4709, -4762,
+-4815, -4868, -4921, -4974, -5027,
+-5080, -5133, -5186, -5239, -5291,
+-5344, -5397, -5450, -5503, -5556,
+-5609, -5662, -5714, -5767, -5820,
+-5873, -5925, -5978, -6031, -6083,
+-6136, -6189, -6241, -6294, -6347,
+-6399, -6452, -6504, -6557, -6609,
+-6662, -6714, -6767, -6819, -6872,
+-6924, -6977, -7029, -7081, -7134,
+-7186, -7238, -7291, -7343, -7395,
+-7447, -7500, -7552, -7604, -7656,
+-7708, -7760, -7812, -7864, -7916,
+-7968, -8020, -8072, -8124, -8176,
+-8228, -8280, -8332, -8384, -8436,
+-8487, -8539, -8591, -8643, -8694,
+-8746, -8798, -8849, -8901, -8953,
+-9004, -9056, -9107, -9159, -9210,
+-9262, -9313, -9364, -9416, -9467,
+-9518, -9570, -9621, -9672, -9723,
+-9775, -9826, -9877, -9928, -9979,
+-10030, -10081, -10132, -10183, -10234,
+-10285, -10336, -10387, -10438, -10488,
+-10539, -10590, -10641, -10691, -10742,
+-10793, -10843, -10894, -10945, -10995,
+-11046, -11096, -11146, -11197, -11247,
+-11298, -11348, -11398, -11448, -11499,
+-11549, -11599, -11649, -11699, -11749,
+-11799, -11849, -11899, -11949, -11999,
+-12049, -12099, -12149, -12198, -12248,
+-12298, -12348, -12397, -12447, -12496,
+-12546, -12595, -12645, -12694, -12744,
+-12793, -12843, -12892, -12941, -12990,
+-13040, -13089, -13138, -13187, -13236,
+-13285, -13334, -13383, -13432, -13481,
+-13530, -13579, -13627, -13676, -13725,
+-13773, -13822, -13871, -13919, -13968,
+-14016, -14065, -14113, -14161, -14210,
+-14258, -14306, -14355, -14403, -14451,
+-14499, -14547, -14595, -14643, -14691,
+-14739, -14787, -14835, -14882, -14930,
+-14978, -15025, -15073, -15121, -15168,
+-15216, -15263, -15311, -15358, -15405,
+-15453, -15500, -15547, -15594, -15641,
+-15689, -15736, -15783, -15830, -15876,
+-15923, -15970, -16017, -16064, -16110,
+-16157, -16204, -16250, -16297, -16343,
+-16390, -16436, -16483, -16529, -16575,
+-16621, -16668, -16714, -16760, -16806,
+-16852, -16898, -16944, -16990, -17035,
+-17081, -17127, -17173, -17218, -17264,
+-17309, -17355, -17400, -17446, -17491,
+-17536, -17582, -17627, -17672, -17717,
+-17762, -17807, -17852, -17897, -17942,
+-17987, -18032, -18077, -18121, -18166,
+-18210, -18255, -18300, -18344, -18388,
+-18433, -18477, -18521, -18566, -18610,
+-18654, -18698, -18742, -18786, -18830,
+-18874, -18917, -18961, -19005, -19048,
+-19092, -19136, -19179, -19223, -19266,
+-19309, -19353, -19396, -19439, -19482,
+-19525, -19568, -19611, -19654, -19697,
+-19740, -19783, -19825, -19868, -19911,
+-19953, -19996, -20038, -20081, -20123,
+-20165, -20207, -20250, -20292, -20334,
+-20376, -20418, -20460, -20502, -20543,
+-20585, -20627, -20668, -20710, -20752,
+-20793, -20834, -20876, -20917, -20958,
+-20999, -21041, -21082, -21123, -21164,
+-21205, -21245, -21286, -21327, -21368,
+-21408, -21449, -21489, -21530, -21570,
+-21610, -21651, -21691, -21731, -21771,
+-21811, -21851, -21891, -21931, -21971,
+-22011, -22050, -22090, -22130, -22169,
+-22208, -22248, -22287, -22326, -22366,
+-22405, -22444, -22483, -22522, -22561,
+-22600, -22639, -22677, -22716, -22755,
+-22793, -22832, -22870, -22908, -22947,
+-22985, -23023, -23061, -23099, -23137,
+-23175, -23213, -23251, -23289, -23326,
+-23364, -23402, -23439, -23476, -23514,
+-23551, -23588, -23626, -23663, -23700,
+-23737, -23774, -23811, -23847, -23884,
+-23921, -23957, -23994, -24030, -24067,
+-24103, -24139, -24176, -24212, -24248,
+-24284, -24320, -24356, -24392, -24427,
+-24463, -24499, -24534, -24570, -24605,
+-24641, -24676, -24711, -24746, -24782,
+-24817, -24852, -24886, -24921, -24956,
+-24991, -25025, -25060, -25095, -25129,
+-25163, -25198, -25232, -25266, -25300,
+-25334, -25368, -25402, -25436, -25470,
+-25503, -25537, -25571, -25604, -25638,
+-25671, -25704, -25737, -25771, -25804,
+-25837, -25870, -25902, -25935, -25968,
+-26001, -26033, -26066, -26098, -26131,
+-26163, -26195, -26227, -26259, -26292,
+-26323, -26355, -26387, -26419, -26451,
+-26482, -26514, -26545, -26577, -26608,
+-26639, -26670, -26702, -26733, -26764,
+-26794, -26825, -26856, -26887, -26917,
+-26948, -26978, -27009, -27039, -27069,
+-27100, -27130, -27160, -27190, -27220,
+-27249, -27279, -27309, -27338, -27368,
+-27397, -27427, -27456, -27485, -27514,
+-27543, -27572, -27601, -27630, -27659,
+-27688, -27716, -27745, -27773, -27802,
+-27830, -27858, -27887, -27915, -27943,
+-27971, -27999, -28026, -28054, -28082,
+-28109, -28137, -28164, -28192, -28219,
+-28246, -28273, -28301, -28328, -28354,
+-28381, -28408, -28435, -28461, -28488,
+-28514, -28541, -28567, -28593, -28619,
+-28645, -28671, -28697, -28723, -28749,
+-28775, -28800, -28826, -28851, -28877,
+-28902, -28927, -28952, -28977, -29002,
+-29027, -29052, -29077, -29102, -29126,
+-29151, -29175, -29200, -29224, -29248,
+-29272, -29296, -29320, -29344, -29368,
+-29392, -29415, -29439, -29462, -29486,
+-29509, -29532, -29556, -29579, -29602,
+-29625, -29648, -29670, -29693, -29716,
+-29738, -29761, -29783, -29806, -29828,
+-29850, -29872, -29894, -29916, -29938,
+-29960, -29981, -30003, -30024, -30046,
+-30067, -30088, -30110, -30131, -30152,
+-30173, -30194, -30214, -30235, -30256,
+-30276, -30297, -30317, -30337, -30358,
+-30378, -30398, -30418, -30438, -30458,
+-30477, -30497, -30516, -30536, -30555,
+-30575, -30594, -30613, -30632, -30651,
+-30670, -30689, -30708, -30726, -30745,
+-30763, -30782, -30800, -30819, -30837,
+-30855, -30873, -30891, -30909, -30926,
+-30944, -30962, -30979, -30997, -31014,
+-31031, -31048, -31065, -31082, -31099,
+-31116, -31133, -31150, -31166, -31183,
+-31199, -31216, -31232, -31248, -31264,
+-31280, -31296, -31312, -31328, -31343,
+-31359, -31374, -31390, -31405, -31421,
+-31436, -31451, -31466, -31481, -31496,
+-31510, -31525, -31540, -31554, -31568,
+-31583, -31597, -31611, -31625, -31639,
+-31653, -31667, -31681, -31694, -31708,
+-31721, -31735, -31748, -31761, -31775,
+-31788, -31801, -31813, -31826, -31839,
+-31852, -31864, -31877, -31889, -31901,
+-31914, -31926, -31938, -31950, -31961,
+-31973, -31985, -31997, -32008, -32020,
+-32031, -32042, -32053, -32064, -32075,
+-32086, -32097, -32108, -32119, -32129,
+-32140, -32150, -32160, -32171, -32181,
+-32191, -32201, -32211, -32221, -32230,
+-32240, -32249, -32259, -32268, -32278,
+-32287, -32296, -32305, -32314, -32323,
+-32331, -32340, -32349, -32357, -32366,
+-32374, -32382, -32390, -32398, -32406,
+-32414, -32422, -32430, -32437, -32445,
+-32453, -32460, -32467, -32474, -32482,
+-32489, -32495, -32502, -32509, -32516,
+-32522, -32529, -32535, -32542, -32548,
+-32554, -32560, -32566, -32572, -32578,
+-32584, -32589, -32595, -32600, -32606,
+-32611, -32616, -32621, -32626, -32631,
+-32636, -32641, -32645, -32650, -32655,
+-32659, -32663, -32668, -32672, -32676,
+-32680, -32684, -32687, -32691, -32695,
+-32698, -32702, -32705, -32708, -32712,
+-32715, -32718, -32721, -32723, -32726,
+-32729, -32731, -32734, -32736, -32739,
+-32741, -32743, -32745, -32747, -32749,
+-32751, -32752, -32754, -32756, -32757,
+-32758, -32760, -32761, -32762, -32763,
+-32764, -32765, -32765, -32766, -32766,
+-32767, -32767, -32767, -32767, -32767,
+32767, 32767, 32767, 32766, 32765,
+32763, 32761, 32759, 32756, 32753,
+32750, 32746, 32742, 32738, 32733,
+32728, 32722, 32717, 32710, 32704,
+32697, 32690, 32682, 32674, 32666,
+32657, 32648, 32639, 32629, 32619,
+32609, 32598, 32587, 32576, 32564,
+32552, 32539, 32526, 32513, 32500,
+32486, 32472, 32457, 32442, 32427,
+32411, 32395, 32379, 32362, 32345,
+32328, 32310, 32292, 32274, 32255,
+32236, 32217, 32197, 32177, 32157,
+32136, 32115, 32093, 32071, 32049,
+32027, 32004, 31981, 31957, 31933,
+31909, 31884, 31859, 31834, 31809,
+31783, 31756, 31730, 31703, 31676,
+31648, 31620, 31592, 31563, 31534,
+31505, 31475, 31445, 31415, 31384,
+31353, 31322, 31290, 31258, 31226,
+31193, 31160, 31127, 31093, 31059,
+31025, 30990, 30955, 30920, 30884,
+30848, 30812, 30775, 30738, 30701,
+30663, 30625, 30587, 30548, 30509,
+30470, 30430, 30390, 30350, 30309,
+30269, 30227, 30186, 30144, 30102,
+30059, 30016, 29973, 29930, 29886,
+29842, 29797, 29752, 29707, 29662,
+29616, 29570, 29524, 29477, 29430,
+29383, 29335, 29287, 29239, 29190,
+29142, 29092, 29043, 28993, 28943,
+28892, 28842, 28791, 28739, 28688,
+28636, 28583, 28531, 28478, 28425,
+28371, 28317, 28263, 28209, 28154,
+28099, 28044, 27988, 27932, 27876,
+27820, 27763, 27706, 27648, 27591,
+27533, 27474, 27416, 27357, 27298,
+27238, 27178, 27118, 27058, 26997,
+26936, 26875, 26814, 26752, 26690,
+26628, 26565, 26502, 26439, 26375,
+26312, 26247, 26183, 26119, 26054,
+25988, 25923, 25857, 25791, 25725,
+25658, 25592, 25524, 25457, 25389,
+25322, 25253, 25185, 25116, 25047,
+24978, 24908, 24838, 24768, 24698,
+24627, 24557, 24485, 24414, 24342,
+24270, 24198, 24126, 24053, 23980,
+23907, 23834, 23760, 23686, 23612,
+23537, 23462, 23387, 23312, 23237,
+23161, 23085, 23009, 22932, 22856,
+22779, 22701, 22624, 22546, 22468,
+22390, 22312, 22233, 22154, 22075,
+21996, 21916, 21836, 21756, 21676,
+21595, 21515, 21434, 21352, 21271,
+21189, 21107, 21025, 20943, 20860,
+20777, 20694, 20611, 20528, 20444,
+20360, 20276, 20192, 20107, 20022,
+19937, 19852, 19767, 19681, 19595,
+19509, 19423, 19336, 19250, 19163,
+19076, 18988, 18901, 18813, 18725,
+18637, 18549, 18460, 18372, 18283,
+18194, 18104, 18015, 17925, 17835,
+17745, 17655, 17565, 17474, 17383,
+17292, 17201, 17110, 17018, 16927,
+16835, 16743, 16650, 16558, 16465,
+16372, 16279, 16186, 16093, 15999,
+15906, 15812, 15718, 15624, 15529,
+15435, 15340, 15245, 15150, 15055,
+14960, 14864, 14769, 14673, 14577,
+14481, 14385, 14288, 14192, 14095,
+13998, 13901, 13804, 13706, 13609,
+13511, 13414, 13316, 13218, 13119,
+13021, 12923, 12824, 12725, 12626,
+12527, 12428, 12329, 12230, 12130,
+12030, 11930, 11831, 11730, 11630,
+11530, 11430, 11329, 11228, 11128,
+11027, 10926, 10824, 10723, 10622,
+10520, 10419, 10317, 10215, 10113,
+10011, 9909, 9807, 9704, 9602,
+9499, 9397, 9294, 9191, 9088,
+8985, 8882, 8778, 8675, 8572,
+8468, 8364, 8261, 8157, 8053,
+7949, 7845, 7741, 7637, 7532,
+7428, 7323, 7219, 7114, 7009,
+6905, 6800, 6695, 6590, 6485,
+6380, 6274, 6169, 6064, 5958,
+5853, 5747, 5642, 5536, 5430,
+5325, 5219, 5113, 5007, 4901,
+4795, 4689, 4583, 4476, 4370,
+4264, 4157, 4051, 3945, 3838,
+3732, 3625, 3518, 3412, 3305,
+3198, 3092, 2985, 2878, 2771,
+2664, 2558, 2451, 2344, 2237,
+2130, 2023, 1916, 1809, 1702,
+1594, 1487, 1380, 1273, 1166,
+1059, 952, 844, 737, 630,
+523, 416, 308, 201, 94,
+-13, -121, -228, -335, -442,
+-550, -657, -764, -871, -978,
+-1086, -1193, -1300, -1407, -1514,
+-1621, -1728, -1835, -1942, -2049,
+-2157, -2263, -2370, -2477, -2584,
+-2691, -2798, -2905, -3012, -3118,
+-3225, -3332, -3439, -3545, -3652,
+-3758, -3865, -3971, -4078, -4184,
+-4290, -4397, -4503, -4609, -4715,
+-4821, -4927, -5033, -5139, -5245,
+-5351, -5457, -5562, -5668, -5774,
+-5879, -5985, -6090, -6195, -6301,
+-6406, -6511, -6616, -6721, -6826,
+-6931, -7036, -7140, -7245, -7349,
+-7454, -7558, -7663, -7767, -7871,
+-7975, -8079, -8183, -8287, -8390,
+-8494, -8597, -8701, -8804, -8907,
+-9011, -9114, -9217, -9319, -9422,
+-9525, -9627, -9730, -9832, -9934,
+-10037, -10139, -10241, -10342, -10444,
+-10546, -10647, -10748, -10850, -10951,
+-11052, -11153, -11253, -11354, -11455,
+-11555, -11655, -11756, -11856, -11955,
+-12055, -12155, -12254, -12354, -12453,
+-12552, -12651, -12750, -12849, -12947,
+-13046, -13144, -13242, -13340, -13438,
+-13536, -13633, -13731, -13828, -13925,
+-14022, -14119, -14216, -14312, -14409,
+-14505, -14601, -14697, -14793, -14888,
+-14984, -15079, -15174, -15269, -15364,
+-15459, -15553, -15647, -15741, -15835,
+-15929, -16023, -16116, -16210, -16303,
+-16396, -16488, -16581, -16673, -16766,
+-16858, -16949, -17041, -17133, -17224,
+-17315, -17406, -17497, -17587, -17678,
+-17768, -17858, -17948, -18037, -18127,
+-18216, -18305, -18394, -18483, -18571,
+-18659, -18747, -18835, -18923, -19010,
+-19098, -19185, -19271, -19358, -19444,
+-19531, -19617, -19702, -19788, -19873,
+-19959, -20043, -20128, -20213, -20297,
+-20381, -20465, -20549, -20632, -20715,
+-20798, -20881, -20963, -21046, -21128,
+-21210, -21291, -21373, -21454, -21535,
+-21616, -21696, -21776, -21856, -21936,
+-22016, -22095, -22174, -22253, -22331,
+-22410, -22488, -22566, -22643, -22721,
+-22798, -22875, -22951, -23028, -23104,
+-23180, -23256, -23331, -23406, -23481,
+-23556, -23630, -23704, -23778, -23852,
+-23925, -23998, -24071, -24144, -24216,
+-24288, -24360, -24432, -24503, -24574,
+-24645, -24716, -24786, -24856, -24926,
+-24995, -25064, -25133, -25202, -25270,
+-25339, -25406, -25474, -25541, -25608,
+-25675, -25742, -25808, -25874, -25939,
+-26005, -26070, -26135, -26199, -26264,
+-26327, -26391, -26455, -26518, -26581,
+-26643, -26705, -26767, -26829, -26891,
+-26952, -27013, -27073, -27133, -27193,
+-27253, -27312, -27372, -27430, -27489,
+-27547, -27605, -27663, -27720, -27777,
+-27834, -27890, -27946, -28002, -28058,
+-28113, -28168, -28223, -28277, -28331,
+-28385, -28438, -28491, -28544, -28596,
+-28649, -28701, -28752, -28803, -28854,
+-28905, -28955, -29006, -29055, -29105,
+-29154, -29203, -29251, -29299, -29347,
+-29395, -29442, -29489, -29535, -29582,
+-29628, -29673, -29719, -29764, -29808,
+-29853, -29897, -29941, -29984, -30027,
+-30070, -30112, -30154, -30196, -30238,
+-30279, -30320, -30360, -30400, -30440,
+-30480, -30519, -30558, -30596, -30635,
+-30672, -30710, -30747, -30784, -30821,
+-30857, -30893, -30929, -30964, -30999,
+-31033, -31068, -31102, -31135, -31168,
+-31201, -31234, -31266, -31298, -31330,
+-31361, -31392, -31422, -31453, -31483,
+-31512, -31541, -31570, -31599, -31627,
+-31655, -31682, -31710, -31737, -31763,
+-31789, -31815, -31841, -31866, -31891,
+-31915, -31939, -31963, -31986, -32010,
+-32032, -32055, -32077, -32099, -32120,
+-32141, -32162, -32182, -32202, -32222,
+-32241, -32260, -32279, -32297, -32315,
+-32333, -32350, -32367, -32383, -32399,
+-32415, -32431, -32446, -32461, -32475,
+-32489, -32503, -32517, -32530, -32542,
+-32555, -32567, -32579, -32590, -32601,
+-32612, -32622, -32632, -32641, -32651,
+-32659, -32668, -32676, -32684, -32692,
+-32699, -32706, -32712, -32718, -32724,
+-32729, -32734, -32739, -32743, -32747,
+-32751, -32754, -32757, -32760, -32762,
+-32764, -32765, -32767, -32767, -32767,
+32767, 32767, 32765, 32761, 32756,
+32750, 32742, 32732, 32722, 32710,
+32696, 32681, 32665, 32647, 32628,
+32608, 32586, 32562, 32538, 32512,
+32484, 32455, 32425, 32393, 32360,
+32326, 32290, 32253, 32214, 32174,
+32133, 32090, 32046, 32001, 31954,
+31906, 31856, 31805, 31753, 31700,
+31645, 31588, 31530, 31471, 31411,
+31349, 31286, 31222, 31156, 31089,
+31020, 30951, 30880, 30807, 30733,
+30658, 30582, 30504, 30425, 30345,
+30263, 30181, 30096, 30011, 29924,
+29836, 29747, 29656, 29564, 29471,
+29377, 29281, 29184, 29086, 28987,
+28886, 28784, 28681, 28577, 28471,
+28365, 28257, 28147, 28037, 27925,
+27812, 27698, 27583, 27467, 27349,
+27231, 27111, 26990, 26868, 26744,
+26620, 26494, 26367, 26239, 26110,
+25980, 25849, 25717, 25583, 25449,
+25313, 25176, 25038, 24900, 24760,
+24619, 24477, 24333, 24189, 24044,
+23898, 23751, 23602, 23453, 23303,
+23152, 22999, 22846, 22692, 22537,
+22380, 22223, 22065, 21906, 21746,
+21585, 21423, 21261, 21097, 20933,
+20767, 20601, 20434, 20265, 20096,
+19927, 19756, 19584, 19412, 19239,
+19065, 18890, 18714, 18538, 18361,
+18183, 18004, 17824, 17644, 17463,
+17281, 17098, 16915, 16731, 16546,
+16361, 16175, 15988, 15800, 15612,
+15423, 15234, 15043, 14852, 14661,
+14469, 14276, 14083, 13889, 13694,
+13499, 13303, 13107, 12910, 12713,
+12515, 12317, 12118, 11918, 11718,
+11517, 11316, 11115, 10913, 10710,
+10508, 10304, 10100, 9896, 9691,
+9486, 9281, 9075, 8869, 8662,
+8455, 8248, 8040, 7832, 7623,
+7415, 7206, 6996, 6787, 6577,
+6366, 6156, 5945, 5734, 5523,
+5311, 5100, 4888, 4675, 4463,
+4251, 4038, 3825, 3612, 3399,
+3185, 2972, 2758, 2544, 2330,
+2116, 1902, 1688, 1474, 1260,
+1045, 831, 617, 402, 188,
+-27, -241, -456, -670, -885,
+-1099, -1313, -1528, -1742, -1956,
+-2170, -2384, -2598, -2811, -3025,
+-3239, -3452, -3665, -3878, -4091,
+-4304, -4516, -4728, -4941, -5153,
+-5364, -5576, -5787, -5998, -6209,
+-6419, -6629, -6839, -7049, -7258,
+-7467, -7676, -7884, -8092, -8300,
+-8507, -8714, -8920, -9127, -9332,
+-9538, -9743, -9947, -10151, -10355,
+-10558, -10761, -10963, -11165, -11367,
+-11568, -11768, -11968, -12167, -12366,
+-12565, -12762, -12960, -13156, -13352,
+-13548, -13743, -13937, -14131, -14324,
+-14517, -14709, -14900, -15091, -15281,
+-15470, -15659, -15847, -16035, -16221,
+-16407, -16593, -16777, -16961, -17144,
+-17326, -17508, -17689, -17869, -18049,
+-18227, -18405, -18582, -18758, -18934,
+-19108, -19282, -19455, -19627, -19799,
+-19969, -20139, -20308, -20475, -20642,
+-20809, -20974, -21138, -21301, -21464,
+-21626, -21786, -21946, -22105, -22263,
+-22420, -22575, -22730, -22884, -23037,
+-23189, -23340, -23490, -23640, -23788,
+-23935, -24080, -24225, -24369, -24512,
+-24654, -24795, -24934, -25073, -25211,
+-25347, -25482, -25617, -25750, -25882,
+-26013, -26143, -26272, -26399, -26526,
+-26651, -26775, -26898, -27020, -27141,
+-27260, -27379, -27496, -27612, -27727,
+-27841, -27953, -28065, -28175, -28284,
+-28391, -28498, -28603, -28707, -28810,
+-28911, -29012, -29111, -29209, -29305,
+-29401, -29495, -29587, -29679, -29769,
+-29858, -29946, -30032, -30118, -30201,
+-30284, -30365, -30445, -30524, -30601,
+-30677, -30752, -30825, -30897, -30968,
+-31038, -31106, -31172, -31238, -31302,
+-31365, -31426, -31486, -31545, -31602,
+-31658, -31713, -31766, -31818, -31869,
+-31918, -31966, -32012, -32058, -32101,
+-32144, -32185, -32224, -32262, -32299,
+-32335, -32369, -32401, -32433, -32463,
+-32491, -32518, -32544, -32568, -32591,
+-32613, -32633, -32652, -32669, -32685,
+-32700, -32713, -32724, -32735, -32744,
+-32751, -32757, -32762, -32766, -32767,
+32767, 32764, 32755, 32741, 32720,
+32694, 32663, 32626, 32583, 32535,
+32481, 32421, 32356, 32286, 32209,
+32128, 32041, 31948, 31850, 31747,
+31638, 31523, 31403, 31278, 31148,
+31012, 30871, 30724, 30572, 30415,
+30253, 30086, 29913, 29736, 29553,
+29365, 29172, 28974, 28771, 28564,
+28351, 28134, 27911, 27684, 27452,
+27216, 26975, 26729, 26478, 26223,
+25964, 25700, 25432, 25159, 24882,
+24601, 24315, 24026, 23732, 23434,
+23133, 22827, 22517, 22204, 21886,
+21565, 21240, 20912, 20580, 20244,
+19905, 19563, 19217, 18868, 18516,
+18160, 17802, 17440, 17075, 16708,
+16338, 15964, 15588, 15210, 14829,
+14445, 14059, 13670, 13279, 12886,
+12490, 12093, 11693, 11291, 10888,
+10482, 10075, 9666, 9255, 8843,
+8429, 8014, 7597, 7180, 6760,
+6340, 5919, 5496, 5073, 4649,
+4224, 3798, 3372, 2945, 2517,
+2090, 1661, 1233, 804, 375,
+-54, -483, -911, -1340, -1768,
+-2197, -2624, -3052, -3479, -3905,
+-4330, -4755, -5179, -5602, -6024,
+-6445, -6865, -7284, -7702, -8118,
+-8533, -8946, -9358, -9768, -10177,
+-10584, -10989, -11392, -11793, -12192,
+-12589, -12984, -13377, -13767, -14155,
+-14541, -14924, -15305, -15683, -16058,
+-16430, -16800, -17167, -17531, -17892,
+-18249, -18604, -18956, -19304, -19649,
+-19990, -20329, -20663, -20994, -21322,
+-21646, -21966, -22282, -22595, -22904,
+-23208, -23509, -23806, -24099, -24387,
+-24672, -24952, -25228, -25499, -25766,
+-26029, -26288, -26541, -26791, -27035,
+-27275, -27511, -27741, -27967, -28188,
+-28405, -28616, -28823, -29024, -29221,
+-29412, -29599, -29780, -29957, -30128,
+-30294, -30455, -30611, -30761, -30906,
+-31046, -31181, -31310, -31434, -31552,
+-31665, -31773, -31875, -31972, -32063,
+-32149, -32229, -32304, -32373, -32437,
+-32495, -32547, -32594, -32635, -32671,
+-32701, -32726, -32745, -32758, -32766,
+#endif
+};
+#endif
+
+static const CELTMode mode96000_1920_240 = {
+96000, /* Fs */
+240, /* overlap */
+21, /* nbEBands */
+21, /* effEBands */
+{30245, 7209, 6197, 5415, }, /* preemph */
+eband5ms, /* eBands */
+3, /* maxLM */
+8, /* nbShortMdcts */
+240, /* shortMdctSize */
+11, /* nbAllocVectors */
+band_allocation, /* allocVectors */
+logN400, /* logN */
+window240, /* window */
+{3840, 3, {&fft_state96000_1920_0, &fft_state96000_1920_1, &fft_state96000_1920_2, &fft_state96000_1920_3, }, mdct_twiddles1920}, /* mdct */
+{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
+#ifdef ENABLE_QEXT
+{86, qext_cache_index50, qext_cache_bits50, qext_cache_caps50}, /* qext_cache */
+#endif
+};
+#endif /* ENABLE_QEXT */
+
+/* List of all the available modes */
+#ifdef ENABLE_QEXT
+#define TOTAL_MODES 2
+static const CELTMode * const static_mode_list[TOTAL_MODES] = {
+&mode48000_960_120,
+&mode96000_1920_240,
+};
+#else
+#define TOTAL_MODES 1
+static const CELTMode * const static_mode_list[TOTAL_MODES] = {
+&mode48000_960_120,
+};
+#endif
diff --git a/media/libopus/celt/static_modes_float.h b/media/libopus/celt/static_modes_float.h
@@ -1,5 +1,5 @@
/* The contents of this file was automatically generated by dump_modes.c
- with arguments: 48000 960
+ with arguments: 48000 960 96000 1920
It contains static definitions for some pre-defined modes. */
#include "modes.h"
#include "rate.h"
@@ -11,7 +11,7 @@
#ifndef DEF_WINDOW120
#define DEF_WINDOW120
-static const opus_val16 window120[120] = {
+static const celt_coef window120[120] = {
6.7286966e-05f, 0.00060551348f, 0.0016815970f, 0.0032947962f, 0.0054439943f,
0.0081276923f, 0.011344001f, 0.015090633f, 0.019364886f, 0.024163635f,
0.029483315f, 0.035319905f, 0.041668911f, 0.048525347f, 0.055883718f,
@@ -24,7 +24,7 @@ static const opus_val16 window120[120] = {
0.47447104f, 0.49127978f, 0.50806798f, 0.52481261f, 0.54149077f,
0.55807973f, 0.57455701f, 0.59090049f, 0.60708841f, 0.62309951f,
0.63891306f, 0.65450896f, 0.66986776f, 0.68497077f, 0.69980010f,
-0.71433873f, 0.72857055f, 0.74248043f, 0.75605424f, 0.76927895f,
+0.71433873f, 0.72857055f, 0.74248043f, 0.75605425f, 0.76927895f,
0.78214257f, 0.79463430f, 0.80674445f, 0.81846456f, 0.82978733f,
0.84070669f, 0.85121779f, 0.86131698f, 0.87100183f, 0.88027111f,
0.88912479f, 0.89756398f, 0.90559094f, 0.91320904f, 0.92042270f,
@@ -99,6 +99,34 @@ static const unsigned char cache_caps50[168] = {
140, 66, 40, };
#endif
+#ifdef ENABLE_QEXT
+# ifndef DEF_QEXT_PULSE_CACHE50
+# define DEF_QEXT_PULSE_CACHE50
+static const opus_int16 qext_cache_index50[70] = {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41,
+41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 61, 61,
+61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 72, 72, 72,
+72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 80, 80, 80, 80,
+80, 80, 80, 80, 80, 80, 80, 80, 80, 80, };
+static const unsigned char qext_cache_bits50[86] = {
+40, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125,
+128, 131, 136, 141, 146, 150, 153, 157, 160, 163, 168, 173, 178, 182, 185,
+189, 192, 195, 200, 205, 210, 214, 217, 221, 224, 227, 19, 34, 61, 83,
+101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216, 222, 234, 245,
+254, 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253, 7, 50, 93,
+131, 165, 197, 227, 255, 5, 58, 109, 155, 197, 237, };
+static const unsigned char qext_cache_caps50[112] = {
+159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 171,
+171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 167, 167, 167,
+167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 166, 166, 166, 166, 166,
+166, 166, 166, 166, 166, 166, 166, 166, 166, 163, 163, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 165, 165, 165, 165, 165, 165, 165,
+165, 165, 165, 165, 165, 165, 165, };
+# endif
+#endif
+
#ifndef FFT_TWIDDLES48000_960
#define FFT_TWIDDLES48000_960
static const kiss_twiddle_cpx fft_twiddles48000_960[480] = {
@@ -162,7 +190,7 @@ static const kiss_twiddle_cpx fft_twiddles48000_960[480] = {
{0.078459096f, -0.99691733f}, {0.065403129f, -0.99785892f},
{0.052335956f, -0.99862953f}, {0.039259816f, -0.99922904f},
{0.026176948f, -0.99965732f}, {0.013089596f, -0.99991433f},
-{6.1230318e-17f, -1.0000000f}, {-0.013089596f, -0.99991433f},
+{6.1232340e-17f, -1.0000000f}, {-0.013089596f, -0.99991433f},
{-0.026176948f, -0.99965732f}, {-0.039259816f, -0.99922904f},
{-0.052335956f, -0.99862953f}, {-0.065403129f, -0.99785892f},
{-0.078459096f, -0.99691733f}, {-0.091501619f, -0.99580493f},
@@ -222,7 +250,7 @@ static const kiss_twiddle_cpx fft_twiddles48000_960[480] = {
{-0.99691733f, -0.078459096f}, {-0.99785892f, -0.065403129f},
{-0.99862953f, -0.052335956f}, {-0.99922904f, -0.039259816f},
{-0.99965732f, -0.026176948f}, {-0.99991433f, -0.013089596f},
-{-1.0000000f, -1.2246064e-16f}, {-0.99991433f, 0.013089596f},
+{-1.0000000f, -1.2246468e-16f}, {-0.99991433f, 0.013089596f},
{-0.99965732f, 0.026176948f}, {-0.99922904f, 0.039259816f},
{-0.99862953f, 0.052335956f}, {-0.99785892f, 0.065403129f},
{-0.99691733f, 0.078459096f}, {-0.99580493f, 0.091501619f},
@@ -282,7 +310,7 @@ static const kiss_twiddle_cpx fft_twiddles48000_960[480] = {
{-0.078459096f, 0.99691733f}, {-0.065403129f, 0.99785892f},
{-0.052335956f, 0.99862953f}, {-0.039259816f, 0.99922904f},
{-0.026176948f, 0.99965732f}, {-0.013089596f, 0.99991433f},
-{-1.8369095e-16f, 1.0000000f}, {0.013089596f, 0.99991433f},
+{-1.8369702e-16f, 1.0000000f}, {0.013089596f, 0.99991433f},
{0.026176948f, 0.99965732f}, {0.039259816f, 0.99922904f},
{0.052335956f, 0.99862953f}, {0.065403129f, 0.99785892f},
{0.078459096f, 0.99691733f}, {0.091501619f, 0.99580493f},
@@ -431,11 +459,11 @@ static const opus_int16 fft_bitrev60[60] = {
#define FFT_STATE48000_960_0
static const kiss_fft_state fft_state48000_960_0 = {
480, /* nfft */
-0.002083333f, /* scale */
--1, /* shift */
-{5, 96, 3, 32, 4, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, }, /* factors */
-fft_bitrev480, /* bitrev */
-fft_twiddles48000_960, /* bitrev */
+0.0020833334f, /* scale */
+-1, /* shift */
+{5, 96, 3, 32, 4, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev480, /* bitrev */
+fft_twiddles48000_960, /* bitrev */
#ifdef OVERRIDE_FFT
(arch_fft_state *)&cfg_arch_480,
#else
@@ -448,11 +476,11 @@ NULL,
#define FFT_STATE48000_960_1
static const kiss_fft_state fft_state48000_960_1 = {
240, /* nfft */
-0.004166667f, /* scale */
-1, /* shift */
+0.0041666669f, /* scale */
+1, /* shift */
{5, 48, 3, 16, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
-fft_bitrev240, /* bitrev */
-fft_twiddles48000_960, /* bitrev */
+fft_bitrev240, /* bitrev */
+fft_twiddles48000_960, /* bitrev */
#ifdef OVERRIDE_FFT
(arch_fft_state *)&cfg_arch_240,
#else
@@ -465,11 +493,11 @@ NULL,
#define FFT_STATE48000_960_2
static const kiss_fft_state fft_state48000_960_2 = {
120, /* nfft */
-0.008333333f, /* scale */
-2, /* shift */
+0.0083333338f, /* scale */
+2, /* shift */
{5, 24, 3, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
-fft_bitrev120, /* bitrev */
-fft_twiddles48000_960, /* bitrev */
+fft_bitrev120, /* bitrev */
+fft_twiddles48000_960, /* bitrev */
#ifdef OVERRIDE_FFT
(arch_fft_state *)&cfg_arch_120,
#else
@@ -481,12 +509,12 @@ NULL,
#ifndef FFT_STATE48000_960_3
#define FFT_STATE48000_960_3
static const kiss_fft_state fft_state48000_960_3 = {
-60, /* nfft */
-0.016666667f, /* scale */
-3, /* shift */
+60, /* nfft */
+0.016666668f, /* scale */
+3, /* shift */
{5, 12, 3, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
-fft_bitrev60, /* bitrev */
-fft_twiddles48000_960, /* bitrev */
+fft_bitrev60, /* bitrev */
+fft_twiddles48000_960, /* bitrev */
#ifdef OVERRIDE_FFT
(arch_fft_state *)&cfg_arch_60,
#else
@@ -499,390 +527,1990 @@ NULL,
#ifndef MDCT_TWIDDLES960
#define MDCT_TWIDDLES960
-static const opus_val16 mdct_twiddles960[1800] = {
-0.99999994f, 0.99999321f, 0.99997580f, 0.99994773f, 0.99990886f,
-0.99985933f, 0.99979913f, 0.99972820f, 0.99964654f, 0.99955416f,
-0.99945110f, 0.99933738f, 0.99921292f, 0.99907774f, 0.99893188f,
-0.99877530f, 0.99860805f, 0.99843007f, 0.99824142f, 0.99804211f,
-0.99783206f, 0.99761140f, 0.99737996f, 0.99713790f, 0.99688518f,
-0.99662173f, 0.99634761f, 0.99606287f, 0.99576741f, 0.99546129f,
-0.99514455f, 0.99481714f, 0.99447906f, 0.99413031f, 0.99377096f,
-0.99340093f, 0.99302030f, 0.99262899f, 0.99222708f, 0.99181455f,
-0.99139136f, 0.99095762f, 0.99051321f, 0.99005818f, 0.98959261f,
-0.98911643f, 0.98862964f, 0.98813224f, 0.98762429f, 0.98710573f,
-0.98657662f, 0.98603696f, 0.98548669f, 0.98492593f, 0.98435456f,
-0.98377270f, 0.98318028f, 0.98257732f, 0.98196387f, 0.98133987f,
-0.98070538f, 0.98006040f, 0.97940493f, 0.97873890f, 0.97806245f,
-0.97737551f, 0.97667813f, 0.97597027f, 0.97525197f, 0.97452319f,
-0.97378403f, 0.97303438f, 0.97227436f, 0.97150391f, 0.97072303f,
-0.96993178f, 0.96913016f, 0.96831810f, 0.96749574f, 0.96666300f,
-0.96581990f, 0.96496642f, 0.96410263f, 0.96322852f, 0.96234411f,
-0.96144938f, 0.96054435f, 0.95962906f, 0.95870346f, 0.95776761f,
-0.95682150f, 0.95586514f, 0.95489854f, 0.95392174f, 0.95293468f,
-0.95193744f, 0.95093000f, 0.94991243f, 0.94888461f, 0.94784665f,
-0.94679856f, 0.94574034f, 0.94467193f, 0.94359344f, 0.94250488f,
-0.94140619f, 0.94029742f, 0.93917859f, 0.93804967f, 0.93691075f,
-0.93576175f, 0.93460274f, 0.93343377f, 0.93225473f, 0.93106574f,
-0.92986679f, 0.92865789f, 0.92743903f, 0.92621022f, 0.92497152f,
-0.92372292f, 0.92246443f, 0.92119598f, 0.91991776f, 0.91862965f,
-0.91733170f, 0.91602397f, 0.91470635f, 0.91337901f, 0.91204184f,
-0.91069490f, 0.90933824f, 0.90797186f, 0.90659571f, 0.90520984f,
-0.90381432f, 0.90240908f, 0.90099424f, 0.89956969f, 0.89813554f,
-0.89669174f, 0.89523834f, 0.89377540f, 0.89230281f, 0.89082074f,
-0.88932908f, 0.88782793f, 0.88631725f, 0.88479710f, 0.88326746f,
-0.88172835f, 0.88017982f, 0.87862182f, 0.87705445f, 0.87547767f,
-0.87389153f, 0.87229604f, 0.87069118f, 0.86907703f, 0.86745358f,
-0.86582077f, 0.86417878f, 0.86252749f, 0.86086690f, 0.85919720f,
-0.85751826f, 0.85583007f, 0.85413277f, 0.85242635f, 0.85071075f,
-0.84898609f, 0.84725231f, 0.84550947f, 0.84375757f, 0.84199661f,
-0.84022665f, 0.83844769f, 0.83665979f, 0.83486289f, 0.83305705f,
-0.83124226f, 0.82941860f, 0.82758605f, 0.82574469f, 0.82389444f,
-0.82203537f, 0.82016748f, 0.81829083f, 0.81640542f, 0.81451124f,
-0.81260836f, 0.81069672f, 0.80877650f, 0.80684757f, 0.80490994f,
-0.80296379f, 0.80100900f, 0.79904562f, 0.79707366f, 0.79509324f,
-0.79310423f, 0.79110676f, 0.78910083f, 0.78708643f, 0.78506362f,
-0.78303236f, 0.78099275f, 0.77894479f, 0.77688843f, 0.77482378f,
-0.77275085f, 0.77066964f, 0.76858020f, 0.76648247f, 0.76437658f,
-0.76226246f, 0.76014024f, 0.75800985f, 0.75587130f, 0.75372469f,
-0.75157005f, 0.74940729f, 0.74723655f, 0.74505776f, 0.74287105f,
-0.74067634f, 0.73847371f, 0.73626316f, 0.73404479f, 0.73181850f,
-0.72958434f, 0.72734243f, 0.72509271f, 0.72283524f, 0.72057003f,
-0.71829706f, 0.71601641f, 0.71372813f, 0.71143216f, 0.70912862f,
-0.70681745f, 0.70449871f, 0.70217246f, 0.69983864f, 0.69749737f,
-0.69514859f, 0.69279242f, 0.69042879f, 0.68805778f, 0.68567938f,
-0.68329364f, 0.68090063f, 0.67850029f, 0.67609268f, 0.67367786f,
-0.67125577f, 0.66882652f, 0.66639012f, 0.66394657f, 0.66149592f,
-0.65903819f, 0.65657341f, 0.65410155f, 0.65162271f, 0.64913690f,
-0.64664418f, 0.64414448f, 0.64163786f, 0.63912445f, 0.63660413f,
-0.63407701f, 0.63154310f, 0.62900239f, 0.62645501f, 0.62390089f,
-0.62134010f, 0.61877263f, 0.61619854f, 0.61361790f, 0.61103064f,
-0.60843682f, 0.60583651f, 0.60322970f, 0.60061646f, 0.59799677f,
-0.59537065f, 0.59273821f, 0.59009939f, 0.58745426f, 0.58480281f,
-0.58214509f, 0.57948118f, 0.57681108f, 0.57413477f, 0.57145232f,
-0.56876373f, 0.56606907f, 0.56336832f, 0.56066155f, 0.55794877f,
-0.55523002f, 0.55250537f, 0.54977477f, 0.54703826f, 0.54429591f,
-0.54154772f, 0.53879374f, 0.53603399f, 0.53326851f, 0.53049731f,
-0.52772039f, 0.52493787f, 0.52214974f, 0.51935595f, 0.51655668f,
-0.51375180f, 0.51094145f, 0.50812566f, 0.50530440f, 0.50247771f,
-0.49964568f, 0.49680826f, 0.49396557f, 0.49111754f, 0.48826426f,
-0.48540577f, 0.48254207f, 0.47967321f, 0.47679919f, 0.47392011f,
-0.47103590f, 0.46814668f, 0.46525243f, 0.46235323f, 0.45944905f,
-0.45653993f, 0.45362595f, 0.45070711f, 0.44778344f, 0.44485497f,
-0.44192174f, 0.43898380f, 0.43604112f, 0.43309379f, 0.43014181f,
-0.42718524f, 0.42422408f, 0.42125839f, 0.41828820f, 0.41531351f,
-0.41233435f, 0.40935081f, 0.40636289f, 0.40337059f, 0.40037400f,
-0.39737311f, 0.39436796f, 0.39135858f, 0.38834500f, 0.38532731f,
-0.38230544f, 0.37927949f, 0.37624949f, 0.37321547f, 0.37017745f,
-0.36713544f, 0.36408952f, 0.36103970f, 0.35798600f, 0.35492846f,
-0.35186714f, 0.34880206f, 0.34573323f, 0.34266070f, 0.33958447f,
-0.33650464f, 0.33342120f, 0.33033419f, 0.32724363f, 0.32414958f,
-0.32105204f, 0.31795108f, 0.31484672f, 0.31173897f, 0.30862790f,
-0.30551350f, 0.30239585f, 0.29927495f, 0.29615086f, 0.29302359f,
-0.28989318f, 0.28675964f, 0.28362307f, 0.28048345f, 0.27734083f,
-0.27419522f, 0.27104670f, 0.26789525f, 0.26474094f, 0.26158381f,
-0.25842386f, 0.25526115f, 0.25209570f, 0.24892756f, 0.24575676f,
-0.24258332f, 0.23940729f, 0.23622867f, 0.23304754f, 0.22986393f,
-0.22667783f, 0.22348931f, 0.22029841f, 0.21710514f, 0.21390954f,
-0.21071166f, 0.20751151f, 0.20430915f, 0.20110460f, 0.19789790f,
-0.19468907f, 0.19147816f, 0.18826519f, 0.18505022f, 0.18183327f,
-0.17861435f, 0.17539354f, 0.17217083f, 0.16894630f, 0.16571994f,
-0.16249183f, 0.15926196f, 0.15603039f, 0.15279715f, 0.14956227f,
-0.14632578f, 0.14308774f, 0.13984816f, 0.13660708f, 0.13336454f,
-0.13012058f, 0.12687522f, 0.12362850f, 0.12038045f, 0.11713112f,
-0.11388054f, 0.11062872f, 0.10737573f, 0.10412160f, 0.10086634f,
-0.097609997f, 0.094352618f, 0.091094226f, 0.087834857f, 0.084574550f,
-0.081313334f, 0.078051247f, 0.074788325f, 0.071524605f, 0.068260118f,
-0.064994894f, 0.061728980f, 0.058462404f, 0.055195201f, 0.051927410f,
-0.048659060f, 0.045390189f, 0.042120833f, 0.038851023f, 0.035580799f,
-0.032310195f, 0.029039243f, 0.025767982f, 0.022496443f, 0.019224664f,
-0.015952680f, 0.012680525f, 0.0094082337f, 0.0061358409f, 0.0028633832f,
--0.00040910527f, -0.0036815894f, -0.0069540343f, -0.010226404f, -0.013498665f,
--0.016770782f, -0.020042717f, -0.023314439f, -0.026585912f, -0.029857099f,
--0.033127967f, -0.036398482f, -0.039668605f, -0.042938303f, -0.046207540f,
--0.049476285f, -0.052744497f, -0.056012146f, -0.059279196f, -0.062545612f,
--0.065811358f, -0.069076397f, -0.072340697f, -0.075604223f, -0.078866936f,
--0.082128808f, -0.085389800f, -0.088649876f, -0.091909006f, -0.095167145f,
--0.098424271f, -0.10168034f, -0.10493532f, -0.10818918f, -0.11144188f,
--0.11469338f, -0.11794366f, -0.12119267f, -0.12444039f, -0.12768677f,
--0.13093179f, -0.13417540f, -0.13741758f, -0.14065829f, -0.14389749f,
--0.14713514f, -0.15037122f, -0.15360570f, -0.15683852f, -0.16006967f,
--0.16329910f, -0.16652679f, -0.16975269f, -0.17297678f, -0.17619900f,
--0.17941935f, -0.18263777f, -0.18585424f, -0.18906870f, -0.19228116f,
--0.19549155f, -0.19869985f, -0.20190603f, -0.20511003f, -0.20831184f,
--0.21151142f, -0.21470875f, -0.21790376f, -0.22109644f, -0.22428675f,
--0.22747467f, -0.23066014f, -0.23384315f, -0.23702365f, -0.24020162f,
--0.24337701f, -0.24654980f, -0.24971995f, -0.25288740f, -0.25605217f,
--0.25921419f, -0.26237345f, -0.26552987f, -0.26868346f, -0.27183419f,
--0.27498198f, -0.27812684f, -0.28126872f, -0.28440759f, -0.28754342f,
--0.29067615f, -0.29380578f, -0.29693225f, -0.30005556f, -0.30317566f,
--0.30629250f, -0.30940607f, -0.31251630f, -0.31562322f, -0.31872672f,
--0.32182685f, -0.32492352f, -0.32801670f, -0.33110636f, -0.33419248f,
--0.33727503f, -0.34035397f, -0.34342924f, -0.34650084f, -0.34956875f,
--0.35263291f, -0.35569328f, -0.35874987f, -0.36180258f, -0.36485144f,
--0.36789638f, -0.37093741f, -0.37397444f, -0.37700745f, -0.38003644f,
--0.38306138f, -0.38608220f, -0.38909888f, -0.39211139f, -0.39511973f,
--0.39812380f, -0.40112361f, -0.40411916f, -0.40711036f, -0.41009718f,
--0.41307965f, -0.41605768f, -0.41903123f, -0.42200032f, -0.42496487f,
--0.42792490f, -0.43088034f, -0.43383113f, -0.43677729f, -0.43971881f,
--0.44265559f, -0.44558764f, -0.44851488f, -0.45143735f, -0.45435500f,
--0.45726776f, -0.46017563f, -0.46307856f, -0.46597654f, -0.46886954f,
--0.47175750f, -0.47464043f, -0.47751826f, -0.48039100f, -0.48325855f,
--0.48612097f, -0.48897815f, -0.49183011f, -0.49467680f, -0.49751821f,
--0.50035429f, -0.50318497f, -0.50601029f, -0.50883019f, -0.51164466f,
--0.51445359f, -0.51725709f, -0.52005500f, -0.52284735f, -0.52563411f,
--0.52841520f, -0.53119069f, -0.53396046f, -0.53672451f, -0.53948283f,
--0.54223537f, -0.54498214f, -0.54772300f, -0.55045801f, -0.55318713f,
--0.55591035f, -0.55862761f, -0.56133890f, -0.56404412f, -0.56674337f,
--0.56943649f, -0.57212353f, -0.57480448f, -0.57747924f, -0.58014780f,
--0.58281022f, -0.58546633f, -0.58811617f, -0.59075975f, -0.59339696f,
--0.59602785f, -0.59865236f, -0.60127044f, -0.60388207f, -0.60648727f,
--0.60908598f, -0.61167812f, -0.61426371f, -0.61684275f, -0.61941516f,
--0.62198097f, -0.62454009f, -0.62709254f, -0.62963831f, -0.63217729f,
--0.63470948f, -0.63723493f, -0.63975352f, -0.64226526f, -0.64477009f,
--0.64726806f, -0.64975911f, -0.65224314f, -0.65472025f, -0.65719032f,
--0.65965337f, -0.66210932f, -0.66455823f, -0.66700000f, -0.66943461f,
--0.67186207f, -0.67428231f, -0.67669535f, -0.67910111f, -0.68149966f,
--0.68389088f, -0.68627477f, -0.68865126f, -0.69102043f, -0.69338220f,
--0.69573659f, -0.69808346f, -0.70042288f, -0.70275480f, -0.70507920f,
--0.70739603f, -0.70970529f, -0.71200693f, -0.71430099f, -0.71658736f,
--0.71886611f, -0.72113711f, -0.72340041f, -0.72565591f, -0.72790372f,
--0.73014367f, -0.73237586f, -0.73460019f, -0.73681659f, -0.73902518f,
--0.74122584f, -0.74341851f, -0.74560326f, -0.74778003f, -0.74994880f,
--0.75210953f, -0.75426215f, -0.75640678f, -0.75854325f, -0.76067162f,
--0.76279181f, -0.76490390f, -0.76700771f, -0.76910341f, -0.77119076f,
--0.77326995f, -0.77534080f, -0.77740335f, -0.77945763f, -0.78150350f,
--0.78354102f, -0.78557014f, -0.78759086f, -0.78960317f, -0.79160696f,
--0.79360235f, -0.79558921f, -0.79756755f, -0.79953730f, -0.80149853f,
--0.80345118f, -0.80539525f, -0.80733067f, -0.80925739f, -0.81117553f,
--0.81308490f, -0.81498563f, -0.81687760f, -0.81876087f, -0.82063532f,
--0.82250100f, -0.82435787f, -0.82620591f, -0.82804507f, -0.82987541f,
--0.83169687f, -0.83350939f, -0.83531296f, -0.83710766f, -0.83889335f,
--0.84067005f, -0.84243774f, -0.84419644f, -0.84594607f, -0.84768665f,
--0.84941816f, -0.85114056f, -0.85285389f, -0.85455805f, -0.85625303f,
--0.85793889f, -0.85961550f, -0.86128294f, -0.86294121f, -0.86459017f,
--0.86622989f, -0.86786032f, -0.86948150f, -0.87109333f, -0.87269586f,
--0.87428904f, -0.87587279f, -0.87744725f, -0.87901229f, -0.88056785f,
--0.88211405f, -0.88365078f, -0.88517809f, -0.88669586f, -0.88820416f,
--0.88970292f, -0.89119220f, -0.89267188f, -0.89414203f, -0.89560264f,
--0.89705360f, -0.89849502f, -0.89992678f, -0.90134889f, -0.90276134f,
--0.90416414f, -0.90555727f, -0.90694070f, -0.90831441f, -0.90967834f,
--0.91103262f, -0.91237706f, -0.91371179f, -0.91503674f, -0.91635185f,
--0.91765714f, -0.91895264f, -0.92023826f, -0.92151409f, -0.92277998f,
--0.92403603f, -0.92528218f, -0.92651838f, -0.92774469f, -0.92896110f,
--0.93016750f, -0.93136400f, -0.93255049f, -0.93372697f, -0.93489349f,
--0.93604994f, -0.93719643f, -0.93833286f, -0.93945926f, -0.94057560f,
--0.94168180f, -0.94277799f, -0.94386405f, -0.94494003f, -0.94600588f,
--0.94706154f, -0.94810712f, -0.94914252f, -0.95016778f, -0.95118284f,
--0.95218778f, -0.95318246f, -0.95416695f, -0.95514119f, -0.95610523f,
--0.95705903f, -0.95800257f, -0.95893586f, -0.95985889f, -0.96077162f,
--0.96167403f, -0.96256620f, -0.96344805f, -0.96431959f, -0.96518075f,
--0.96603161f, -0.96687216f, -0.96770233f, -0.96852213f, -0.96933156f,
--0.97013056f, -0.97091925f, -0.97169751f, -0.97246534f, -0.97322279f,
--0.97396982f, -0.97470641f, -0.97543252f, -0.97614825f, -0.97685349f,
--0.97754824f, -0.97823256f, -0.97890645f, -0.97956979f, -0.98022264f,
--0.98086500f, -0.98149687f, -0.98211825f, -0.98272908f, -0.98332942f,
--0.98391914f, -0.98449844f, -0.98506713f, -0.98562527f, -0.98617285f,
--0.98670989f, -0.98723638f, -0.98775226f, -0.98825759f, -0.98875231f,
--0.98923647f, -0.98971003f, -0.99017298f, -0.99062532f, -0.99106705f,
--0.99149817f, -0.99191868f, -0.99232858f, -0.99272782f, -0.99311644f,
--0.99349445f, -0.99386179f, -0.99421853f, -0.99456459f, -0.99489999f,
--0.99522477f, -0.99553883f, -0.99584228f, -0.99613506f, -0.99641716f,
--0.99668860f, -0.99694937f, -0.99719942f, -0.99743885f, -0.99766755f,
--0.99788558f, -0.99809295f, -0.99828959f, -0.99847561f, -0.99865085f,
--0.99881548f, -0.99896932f, -0.99911255f, -0.99924499f, -0.99936682f,
--0.99947786f, -0.99957830f, -0.99966794f, -0.99974692f, -0.99981517f,
--0.99987274f, -0.99991959f, -0.99995571f, -0.99998116f, -0.99999589f,
-0.99999964f, 0.99997288f, 0.99990326f, 0.99979085f, 0.99963558f,
-0.99943751f, 0.99919659f, 0.99891287f, 0.99858636f, 0.99821711f,
-0.99780506f, 0.99735034f, 0.99685282f, 0.99631262f, 0.99572974f,
-0.99510419f, 0.99443603f, 0.99372530f, 0.99297196f, 0.99217612f,
-0.99133772f, 0.99045694f, 0.98953366f, 0.98856801f, 0.98756003f,
-0.98650974f, 0.98541719f, 0.98428243f, 0.98310548f, 0.98188645f,
-0.98062533f, 0.97932225f, 0.97797716f, 0.97659022f, 0.97516143f,
-0.97369087f, 0.97217858f, 0.97062469f, 0.96902919f, 0.96739221f,
-0.96571374f, 0.96399397f, 0.96223283f, 0.96043050f, 0.95858705f,
-0.95670253f, 0.95477700f, 0.95281059f, 0.95080340f, 0.94875544f,
-0.94666684f, 0.94453770f, 0.94236809f, 0.94015813f, 0.93790787f,
-0.93561745f, 0.93328691f, 0.93091643f, 0.92850608f, 0.92605597f,
-0.92356616f, 0.92103678f, 0.91846794f, 0.91585976f, 0.91321236f,
-0.91052586f, 0.90780038f, 0.90503591f, 0.90223277f, 0.89939094f,
-0.89651060f, 0.89359182f, 0.89063478f, 0.88763964f, 0.88460642f,
-0.88153529f, 0.87842643f, 0.87527996f, 0.87209594f, 0.86887461f,
-0.86561602f, 0.86232042f, 0.85898781f, 0.85561842f, 0.85221243f,
-0.84876984f, 0.84529096f, 0.84177583f, 0.83822471f, 0.83463764f,
-0.83101481f, 0.82735640f, 0.82366252f, 0.81993335f, 0.81616908f,
-0.81236988f, 0.80853581f, 0.80466717f, 0.80076402f, 0.79682660f,
-0.79285502f, 0.78884947f, 0.78481019f, 0.78073722f, 0.77663082f,
-0.77249116f, 0.76831841f, 0.76411277f, 0.75987434f, 0.75560343f,
-0.75130010f, 0.74696463f, 0.74259710f, 0.73819780f, 0.73376691f,
-0.72930455f, 0.72481096f, 0.72028631f, 0.71573079f, 0.71114463f,
-0.70652801f, 0.70188117f, 0.69720417f, 0.69249737f, 0.68776089f,
-0.68299496f, 0.67819971f, 0.67337549f, 0.66852236f, 0.66364062f,
-0.65873051f, 0.65379208f, 0.64882571f, 0.64383155f, 0.63880974f,
-0.63376063f, 0.62868434f, 0.62358117f, 0.61845124f, 0.61329484f,
-0.60811216f, 0.60290343f, 0.59766883f, 0.59240872f, 0.58712316f,
-0.58181250f, 0.57647687f, 0.57111657f, 0.56573176f, 0.56032276f,
-0.55488980f, 0.54943299f, 0.54395270f, 0.53844911f, 0.53292239f,
-0.52737290f, 0.52180082f, 0.51620632f, 0.51058978f, 0.50495136f,
-0.49929130f, 0.49360985f, 0.48790723f, 0.48218375f, 0.47643960f,
-0.47067502f, 0.46489030f, 0.45908567f, 0.45326138f, 0.44741765f,
-0.44155475f, 0.43567297f, 0.42977250f, 0.42385364f, 0.41791660f,
-0.41196167f, 0.40598908f, 0.39999911f, 0.39399201f, 0.38796803f,
-0.38192743f, 0.37587047f, 0.36979741f, 0.36370850f, 0.35760403f,
-0.35148421f, 0.34534934f, 0.33919969f, 0.33303553f, 0.32685706f,
-0.32066461f, 0.31445843f, 0.30823877f, 0.30200592f, 0.29576012f,
-0.28950164f, 0.28323078f, 0.27694780f, 0.27065292f, 0.26434645f,
-0.25802869f, 0.25169984f, 0.24536023f, 0.23901010f, 0.23264973f,
-0.22627939f, 0.21989937f, 0.21350993f, 0.20711134f, 0.20070387f,
-0.19428782f, 0.18786344f, 0.18143101f, 0.17499080f, 0.16854310f,
-0.16208819f, 0.15562633f, 0.14915779f, 0.14268288f, 0.13620184f,
-0.12971498f, 0.12322257f, 0.11672486f, 0.11022217f, 0.10371475f,
-0.097202882f, 0.090686858f, 0.084166944f, 0.077643424f, 0.071116582f,
-0.064586692f, 0.058054037f, 0.051518895f, 0.044981543f, 0.038442269f,
-0.031901345f, 0.025359053f, 0.018815678f, 0.012271495f, 0.0057267868f,
--0.00081816671f, -0.0073630852f, -0.013907688f, -0.020451695f, -0.026994826f,
--0.033536803f, -0.040077340f, -0.046616159f, -0.053152986f, -0.059687532f,
--0.066219524f, -0.072748676f, -0.079274714f, -0.085797355f, -0.092316322f,
--0.098831341f, -0.10534211f, -0.11184838f, -0.11834986f, -0.12484626f,
--0.13133731f, -0.13782275f, -0.14430228f, -0.15077563f, -0.15724251f,
--0.16370267f, -0.17015581f, -0.17660165f, -0.18303993f, -0.18947038f,
--0.19589271f, -0.20230664f, -0.20871192f, -0.21510825f, -0.22149536f,
--0.22787298f, -0.23424086f, -0.24059868f, -0.24694622f, -0.25328314f,
--0.25960925f, -0.26592422f, -0.27222782f, -0.27851975f, -0.28479972f,
--0.29106751f, -0.29732284f, -0.30356544f, -0.30979502f, -0.31601134f,
--0.32221413f, -0.32840309f, -0.33457801f, -0.34073856f, -0.34688455f,
--0.35301566f, -0.35913166f, -0.36523229f, -0.37131724f, -0.37738630f,
--0.38343921f, -0.38947567f, -0.39549544f, -0.40149832f, -0.40748394f,
--0.41345215f, -0.41940263f, -0.42533514f, -0.43124944f, -0.43714526f,
--0.44302234f, -0.44888046f, -0.45471936f, -0.46053877f, -0.46633846f,
--0.47211814f, -0.47787762f, -0.48361665f, -0.48933494f, -0.49503228f,
--0.50070840f, -0.50636309f, -0.51199609f, -0.51760709f, -0.52319598f,
--0.52876246f, -0.53430629f, -0.53982723f, -0.54532504f, -0.55079949f,
--0.55625033f, -0.56167740f, -0.56708032f, -0.57245898f, -0.57781315f,
--0.58314258f, -0.58844697f, -0.59372622f, -0.59897995f, -0.60420811f,
--0.60941035f, -0.61458647f, -0.61973625f, -0.62485951f, -0.62995601f,
--0.63502556f, -0.64006782f, -0.64508271f, -0.65007001f, -0.65502942f,
--0.65996075f, -0.66486382f, -0.66973841f, -0.67458433f, -0.67940134f,
--0.68418926f, -0.68894786f, -0.69367695f, -0.69837630f, -0.70304573f,
--0.70768511f, -0.71229410f, -0.71687263f, -0.72142041f, -0.72593731f,
--0.73042315f, -0.73487765f, -0.73930067f, -0.74369204f, -0.74805158f,
--0.75237900f, -0.75667429f, -0.76093709f, -0.76516730f, -0.76936477f,
--0.77352923f, -0.77766061f, -0.78175867f, -0.78582323f, -0.78985411f,
--0.79385114f, -0.79781419f, -0.80174309f, -0.80563760f, -0.80949765f,
--0.81332302f, -0.81711352f, -0.82086903f, -0.82458937f, -0.82827437f,
--0.83192390f, -0.83553779f, -0.83911592f, -0.84265804f, -0.84616417f,
--0.84963393f, -0.85306740f, -0.85646427f, -0.85982448f, -0.86314780f,
--0.86643422f, -0.86968350f, -0.87289548f, -0.87607014f, -0.87920725f,
--0.88230664f, -0.88536829f, -0.88839203f, -0.89137769f, -0.89432514f,
--0.89723432f, -0.90010506f, -0.90293723f, -0.90573072f, -0.90848541f,
--0.91120118f, -0.91387796f, -0.91651553f, -0.91911387f, -0.92167282f,
--0.92419231f, -0.92667222f, -0.92911243f, -0.93151283f, -0.93387336f,
--0.93619382f, -0.93847424f, -0.94071442f, -0.94291431f, -0.94507378f,
--0.94719279f, -0.94927126f, -0.95130903f, -0.95330608f, -0.95526224f,
--0.95717752f, -0.95905179f, -0.96088499f, -0.96267700f, -0.96442777f,
--0.96613729f, -0.96780539f, -0.96943200f, -0.97101706f, -0.97256058f,
--0.97406244f, -0.97552258f, -0.97694093f, -0.97831738f, -0.97965199f,
--0.98094457f, -0.98219514f, -0.98340368f, -0.98457009f, -0.98569429f,
--0.98677629f, -0.98781598f, -0.98881340f, -0.98976845f, -0.99068111f,
--0.99155134f, -0.99237907f, -0.99316430f, -0.99390697f, -0.99460709f,
--0.99526459f, -0.99587947f, -0.99645168f, -0.99698120f, -0.99746799f,
--0.99791211f, -0.99831343f, -0.99867201f, -0.99898779f, -0.99926084f,
--0.99949104f, -0.99967843f, -0.99982297f, -0.99992472f, -0.99998361f,
-0.99999869f, 0.99989158f, 0.99961317f, 0.99916345f, 0.99854255f,
-0.99775058f, 0.99678761f, 0.99565387f, 0.99434954f, 0.99287480f,
-0.99122995f, 0.98941529f, 0.98743105f, 0.98527765f, 0.98295540f,
-0.98046476f, 0.97780609f, 0.97497988f, 0.97198665f, 0.96882683f,
-0.96550101f, 0.96200979f, 0.95835376f, 0.95453346f, 0.95054960f,
-0.94640291f, 0.94209403f, 0.93762374f, 0.93299282f, 0.92820197f,
-0.92325211f, 0.91814411f, 0.91287869f, 0.90745693f, 0.90187967f,
-0.89614785f, 0.89026248f, 0.88422459f, 0.87803519f, 0.87169534f,
-0.86520612f, 0.85856867f, 0.85178405f, 0.84485358f, 0.83777827f,
-0.83055943f, 0.82319832f, 0.81569612f, 0.80805415f, 0.80027372f,
-0.79235619f, 0.78430289f, 0.77611518f, 0.76779449f, 0.75934225f,
-0.75075996f, 0.74204898f, 0.73321080f, 0.72424710f, 0.71515924f,
-0.70594883f, 0.69661748f, 0.68716675f, 0.67759830f, 0.66791373f,
-0.65811473f, 0.64820296f, 0.63818014f, 0.62804794f, 0.61780810f,
-0.60746247f, 0.59701276f, 0.58646071f, 0.57580817f, 0.56505698f,
-0.55420899f, 0.54326600f, 0.53222996f, 0.52110273f, 0.50988621f,
-0.49858227f, 0.48719296f, 0.47572014f, 0.46416581f, 0.45253196f,
-0.44082057f, 0.42903364f, 0.41717321f, 0.40524128f, 0.39323992f,
-0.38117120f, 0.36903715f, 0.35683987f, 0.34458145f, 0.33226398f,
-0.31988961f, 0.30746040f, 0.29497850f, 0.28244606f, 0.26986524f,
-0.25723818f, 0.24456702f, 0.23185398f, 0.21910121f, 0.20631088f,
-0.19348522f, 0.18062639f, 0.16773662f, 0.15481812f, 0.14187308f,
-0.12890373f, 0.11591230f, 0.10290100f, 0.089872077f, 0.076827750f,
-0.063770257f, 0.050701842f, 0.037624735f, 0.024541186f, 0.011453429f,
--0.0016362892f, -0.014725727f, -0.027812643f, -0.040894791f, -0.053969935f,
--0.067035832f, -0.080090240f, -0.093130924f, -0.10615565f, -0.11916219f,
--0.13214831f, -0.14511178f, -0.15805040f, -0.17096193f, -0.18384418f,
--0.19669491f, -0.20951195f, -0.22229309f, -0.23503613f, -0.24773891f,
--0.26039925f, -0.27301496f, -0.28558388f, -0.29810387f, -0.31057280f,
--0.32298848f, -0.33534884f, -0.34765175f, -0.35989508f, -0.37207675f,
--0.38419467f, -0.39624676f, -0.40823093f, -0.42014518f, -0.43198743f,
--0.44375566f, -0.45544785f, -0.46706200f, -0.47859612f, -0.49004826f,
--0.50141639f, -0.51269865f, -0.52389306f, -0.53499764f, -0.54601061f,
--0.55693001f, -0.56775403f, -0.57848072f, -0.58910829f, -0.59963489f,
--0.61005878f, -0.62037814f, -0.63059121f, -0.64069623f, -0.65069145f,
--0.66057515f, -0.67034572f, -0.68000144f, -0.68954057f, -0.69896162f,
--0.70826286f, -0.71744281f, -0.72649974f, -0.73543227f, -0.74423873f,
--0.75291771f, -0.76146764f, -0.76988715f, -0.77817470f, -0.78632891f,
--0.79434842f, -0.80223179f, -0.80997771f, -0.81758487f, -0.82505190f,
--0.83237761f, -0.83956063f, -0.84659988f, -0.85349399f, -0.86024189f,
--0.86684239f, -0.87329435f, -0.87959671f, -0.88574833f, -0.89174819f,
--0.89759529f, -0.90328854f, -0.90882701f, -0.91420978f, -0.91943592f,
--0.92450452f, -0.92941469f, -0.93416560f, -0.93875647f, -0.94318646f,
--0.94745487f, -0.95156091f, -0.95550388f, -0.95928317f, -0.96289814f,
--0.96634805f, -0.96963239f, -0.97275060f, -0.97570217f, -0.97848648f,
--0.98110318f, -0.98355180f, -0.98583186f, -0.98794299f, -0.98988485f,
--0.99165714f, -0.99325943f, -0.99469161f, -0.99595332f, -0.99704438f,
--0.99796462f, -0.99871385f, -0.99929196f, -0.99969882f, -0.99993443f,
-0.99999464f, 0.99956632f, 0.99845290f, 0.99665523f, 0.99417448f,
-0.99101239f, 0.98717111f, 0.98265326f, 0.97746199f, 0.97160077f,
-0.96507365f, 0.95788515f, 0.95004016f, 0.94154406f, 0.93240267f,
-0.92262226f, 0.91220951f, 0.90117162f, 0.88951606f, 0.87725091f,
-0.86438453f, 0.85092574f, 0.83688372f, 0.82226819f, 0.80708915f,
-0.79135692f, 0.77508235f, 0.75827658f, 0.74095112f, 0.72311783f,
-0.70478898f, 0.68597710f, 0.66669506f, 0.64695615f, 0.62677377f,
-0.60616189f, 0.58513457f, 0.56370622f, 0.54189157f, 0.51970547f,
-0.49716324f, 0.47428027f, 0.45107225f, 0.42755505f, 0.40374488f,
-0.37965798f, 0.35531086f, 0.33072025f, 0.30590299f, 0.28087607f,
-0.25565663f, 0.23026201f, 0.20470956f, 0.17901683f, 0.15320139f,
-0.12728097f, 0.10127331f, 0.075196236f, 0.049067631f, 0.022905400f,
--0.0032725304f, -0.029448219f, -0.055603724f, -0.081721120f, -0.10778251f,
--0.13377003f, -0.15966587f, -0.18545228f, -0.21111161f, -0.23662624f,
--0.26197869f, -0.28715160f, -0.31212771f, -0.33688989f, -0.36142120f,
--0.38570482f, -0.40972409f, -0.43346253f, -0.45690393f, -0.48003218f,
--0.50283146f, -0.52528608f, -0.54738069f, -0.56910020f, -0.59042966f,
--0.61135447f, -0.63186026f, -0.65193301f, -0.67155898f, -0.69072473f,
--0.70941705f, -0.72762316f, -0.74533063f, -0.76252723f, -0.77920127f,
--0.79534131f, -0.81093621f, -0.82597536f, -0.84044844f, -0.85434550f,
--0.86765707f, -0.88037395f, -0.89248747f, -0.90398932f, -0.91487163f,
--0.92512697f, -0.93474823f, -0.94372886f, -0.95206273f, -0.95974404f,
--0.96676767f, -0.97312868f, -0.97882277f, -0.98384601f, -0.98819500f,
--0.99186671f, -0.99485862f, -0.99716878f, -0.99879545f, -0.99973762f,
+static const celt_coef mdct_twiddles960[1800] = {
+0.99999992f, 0.99999322f, 0.99997582f, 0.99994771f, 0.99990889f,
+0.99985936f, 0.99979913f, 0.99972818f, 0.99964653f, 0.99955418f,
+0.99945112f, 0.99933736f, 0.99921289f, 0.99907773f, 0.99893186f,
+0.99877530f, 0.99860804f, 0.99843009f, 0.99824144f, 0.99804211f,
+0.99783209f, 0.99761138f, 0.99737998f, 0.99713791f, 0.99688516f,
+0.99662173f, 0.99634763f, 0.99606285f, 0.99576741f, 0.99546131f,
+0.99514455f, 0.99481713f, 0.99447905f, 0.99413033f, 0.99377096f,
+0.99340095f, 0.99302029f, 0.99262901f, 0.99222709f, 0.99181455f,
+0.99139139f, 0.99095760f, 0.99051321f, 0.99005821f, 0.98959261f,
+0.98911641f, 0.98862961f, 0.98813223f, 0.98762427f, 0.98710573f,
+0.98657662f, 0.98603694f, 0.98548670f, 0.98492591f, 0.98435457f,
+0.98377269f, 0.98318028f, 0.98257734f, 0.98196387f, 0.98133989f,
+0.98070539f, 0.98006040f, 0.97940491f, 0.97873893f, 0.97806247f,
+0.97737554f, 0.97667813f, 0.97597027f, 0.97525196f, 0.97452320f,
+0.97378401f, 0.97303439f, 0.97227435f, 0.97150389f, 0.97072303f,
+0.96993178f, 0.96913014f, 0.96831812f, 0.96749573f, 0.96666298f,
+0.96581987f, 0.96496643f, 0.96410265f, 0.96322854f, 0.96234412f,
+0.96144939f, 0.96054437f, 0.95962906f, 0.95870347f, 0.95776762f,
+0.95682151f, 0.95586515f, 0.95489856f, 0.95392174f, 0.95293471f,
+0.95193746f, 0.95093003f, 0.94991241f, 0.94888462f, 0.94784667f,
+0.94679856f, 0.94574032f, 0.94467195f, 0.94359346f, 0.94250486f,
+0.94140618f, 0.94029741f, 0.93917857f, 0.93804967f, 0.93691073f,
+0.93576176f, 0.93460276f, 0.93343375f, 0.93225475f, 0.93106577f,
+0.92986681f, 0.92865789f, 0.92743903f, 0.92621024f, 0.92497153f,
+0.92372291f, 0.92246440f, 0.92119602f, 0.91991776f, 0.91862966f,
+0.91733172f, 0.91602395f, 0.91470637f, 0.91337900f, 0.91204185f,
+0.91069493f, 0.90933825f, 0.90797184f, 0.90659570f, 0.90520986f,
+0.90381432f, 0.90240910f, 0.90099422f, 0.89956969f, 0.89813553f,
+0.89669174f, 0.89523836f, 0.89377538f, 0.89230284f, 0.89082074f,
+0.88932910f, 0.88782793f, 0.88631726f, 0.88479710f, 0.88326746f,
+0.88172836f, 0.88017982f, 0.87862185f, 0.87705448f, 0.87547771f,
+0.87389156f, 0.87229606f, 0.87069121f, 0.86907704f, 0.86745357f,
+0.86582080f, 0.86417876f, 0.86252747f, 0.86086694f, 0.85919719f,
+0.85751824f, 0.85583010f, 0.85413281f, 0.85242636f, 0.85071078f,
+0.84898610f, 0.84725232f, 0.84550947f, 0.84375756f, 0.84199662f,
+0.84022666f, 0.83844771f, 0.83665977f, 0.83486287f, 0.83305704f,
+0.83124228f, 0.82941862f, 0.82758608f, 0.82574467f, 0.82389442f,
+0.82203535f, 0.82016748f, 0.81829082f, 0.81640540f, 0.81451123f,
+0.81260835f, 0.81069676f, 0.80877649f, 0.80684755f, 0.80490998f,
+0.80296379f, 0.80100899f, 0.79904562f, 0.79707370f, 0.79509323f,
+0.79310425f, 0.79110678f, 0.78910084f, 0.78708644f, 0.78506362f,
+0.78303239f, 0.78099277f, 0.77894479f, 0.77688847f, 0.77482382f,
+0.77275088f, 0.77066967f, 0.76858020f, 0.76648250f, 0.76437659f,
+0.76226250f, 0.76014024f, 0.75800984f, 0.75587132f, 0.75372471f,
+0.75157003f, 0.74940730f, 0.74723654f, 0.74505779f, 0.74287105f,
+0.74067635f, 0.73847373f, 0.73626320f, 0.73404478f, 0.73181850f,
+0.72958438f, 0.72734245f, 0.72509273f, 0.72283525f, 0.72057002f,
+0.71829708f, 0.71601644f, 0.71372814f, 0.71143220f, 0.70912863f,
+0.70681747f, 0.70449874f, 0.70217247f, 0.69983868f, 0.69749739f,
+0.69514863f, 0.69279243f, 0.69042881f, 0.68805780f, 0.68567941f,
+0.68329369f, 0.68090064f, 0.67850031f, 0.67609270f, 0.67367786f,
+0.67125580f, 0.66882656f, 0.66639015f, 0.66394661f, 0.66149595f,
+0.65903821f, 0.65657341f, 0.65410159f, 0.65162275f, 0.64913694f,
+0.64664418f, 0.64414449f, 0.64163790f, 0.63912444f, 0.63660414f,
+0.63407702f, 0.63154311f, 0.62900244f, 0.62645503f, 0.62390091f,
+0.62134011f, 0.61877265f, 0.61619857f, 0.61361789f, 0.61103064f,
+0.60843685f, 0.60583654f, 0.60322974f, 0.60061648f, 0.59799679f,
+0.59537069f, 0.59273822f, 0.59009940f, 0.58745427f, 0.58480284f,
+0.58214514f, 0.57948122f, 0.57681109f, 0.57413478f, 0.57145232f,
+0.56876374f, 0.56606907f, 0.56336834f, 0.56066158f, 0.55794881f,
+0.55523006f, 0.55250537f, 0.54977477f, 0.54703827f, 0.54429592f,
+0.54154774f, 0.53879376f, 0.53603401f, 0.53326852f, 0.53049731f,
+0.52772043f, 0.52493790f, 0.52214974f, 0.51935599f, 0.51655668f,
+0.51375184f, 0.51094149f, 0.50812568f, 0.50530442f, 0.50247775f,
+0.49964570f, 0.49680830f, 0.49396558f, 0.49111757f, 0.48826430f,
+0.48540580f, 0.48254210f, 0.47967323f, 0.47679923f, 0.47392012f,
+0.47103594f, 0.46814671f, 0.46525247f, 0.46235324f, 0.45944907f,
+0.45653997f, 0.45362599f, 0.45070714f, 0.44778347f, 0.44485501f,
+0.44192178f, 0.43898381f, 0.43604115f, 0.43309382f, 0.43014185f,
+0.42718527f, 0.42422412f, 0.42125842f, 0.41828822f, 0.41531353f,
+0.41233440f, 0.40935085f, 0.40636291f, 0.40337063f, 0.40037402f,
+0.39737313f, 0.39436798f, 0.39135861f, 0.38834505f, 0.38532733f,
+0.38230548f, 0.37927953f, 0.37624953f, 0.37321550f, 0.37017747f,
+0.36713547f, 0.36408955f, 0.36103972f, 0.35798603f, 0.35492850f,
+0.35186718f, 0.34880208f, 0.34573325f, 0.34266072f, 0.33958451f,
+0.33650468f, 0.33342123f, 0.33033422f, 0.32724367f, 0.32414961f,
+0.32105209f, 0.31795112f, 0.31484675f, 0.31173901f, 0.30862793f,
+0.30551354f, 0.30239588f, 0.29927499f, 0.29615089f, 0.29302362f,
+0.28989321f, 0.28675969f, 0.28362310f, 0.28048348f, 0.27734085f,
+0.27419526f, 0.27104672f, 0.26789529f, 0.26474098f, 0.26158384f,
+0.25842390f, 0.25526119f, 0.25209575f, 0.24892761f, 0.24575680f,
+0.24258336f, 0.23940732f, 0.23622872f, 0.23304759f, 0.22986396f,
+0.22667787f, 0.22348935f, 0.22029844f, 0.21710517f, 0.21390958f,
+0.21071169f, 0.20751155f, 0.20430919f, 0.20110463f, 0.19789793f,
+0.19468910f, 0.19147819f, 0.18826523f, 0.18505026f, 0.18183330f,
+0.17861439f, 0.17539357f, 0.17217088f, 0.16894634f, 0.16571999f,
+0.16249186f, 0.15926200f, 0.15603043f, 0.15279719f, 0.14956231f,
+0.14632583f, 0.14308778f, 0.13984820f, 0.13660713f, 0.13336459f,
+0.13012062f, 0.12687526f, 0.12362854f, 0.12038049f, 0.11713116f,
+0.11388057f, 0.11062877f, 0.10737578f, 0.10412163f, 0.10086638f,
+0.097610040f, 0.094352658f, 0.091094266f, 0.087834897f, 0.084574589f,
+0.081313374f, 0.078051289f, 0.074788367f, 0.071524645f, 0.068260157f,
+0.064994938f, 0.061729023f, 0.058462447f, 0.055195244f, 0.051927451f,
+0.048659101f, 0.045390231f, 0.042120874f, 0.038851066f, 0.035580842f,
+0.032310238f, 0.029039287f, 0.025768025f, 0.022496487f, 0.019224708f,
+0.015952723f, 0.012680568f, 0.0094082767f, 0.0061358846f, 0.0028634269f,
+-0.00040906153f, -0.0036815456f, -0.0069539902f, -0.010226360f, -0.013498621f,
+-0.016770737f, -0.020042673f, -0.023314395f, -0.026585867f, -0.029857055f,
+-0.033127923f, -0.036398436f, -0.039668559f, -0.042938257f, -0.046207495f,
+-0.049476239f, -0.052744453f, -0.056012102f, -0.059279151f, -0.062545565f,
+-0.065811309f, -0.069076349f, -0.072340649f, -0.075604174f, -0.078866890f,
+-0.082128761f, -0.085389752f, -0.088649829f, -0.091908956f, -0.095167100f,
+-0.098424224f, -0.10168029f, -0.10493528f, -0.10818913f, -0.11144183f,
+-0.11469334f, -0.11794361f, -0.12119263f, -0.12444034f, -0.12768673f,
+-0.13093174f, -0.13417536f, -0.13741753f, -0.14065824f, -0.14389744f,
+-0.14713510f, -0.15037118f, -0.15360565f, -0.15683848f, -0.16006962f,
+-0.16329906f, -0.16652674f, -0.16975264f, -0.17297673f, -0.17619896f,
+-0.17941930f, -0.18263772f, -0.18585419f, -0.18906866f, -0.19228112f,
+-0.19549151f, -0.19869981f, -0.20190598f, -0.20510998f, -0.20831180f,
+-0.21151138f, -0.21470869f, -0.21790371f, -0.22109639f, -0.22428671f,
+-0.22747462f, -0.23066010f, -0.23384310f, -0.23702361f, -0.24020157f,
+-0.24337696f, -0.24654975f, -0.24971989f, -0.25288736f, -0.25605213f,
+-0.25921415f, -0.26237339f, -0.26552983f, -0.26868342f, -0.27183413f,
+-0.27498193f, -0.27812679f, -0.28126867f, -0.28440754f, -0.28754336f,
+-0.29067610f, -0.29380573f, -0.29693221f, -0.30005551f, -0.30317560f,
+-0.30629245f, -0.30940601f, -0.31251626f, -0.31562316f, -0.31872668f,
+-0.32182679f, -0.32492345f, -0.32801664f, -0.33110631f, -0.33419243f,
+-0.33727497f, -0.34035391f, -0.34342920f, -0.34650081f, -0.34956871f,
+-0.35263286f, -0.35569324f, -0.35874981f, -0.36180254f, -0.36485139f,
+-0.36789634f, -0.37093735f, -0.37397438f, -0.37700741f, -0.38003640f,
+-0.38306132f, -0.38608214f, -0.38909883f, -0.39211135f, -0.39511967f,
+-0.39812375f, -0.40112358f, -0.40411910f, -0.40711031f, -0.41009715f,
+-0.41307959f, -0.41605762f, -0.41903119f, -0.42200027f, -0.42496483f,
+-0.42792484f, -0.43088027f, -0.43383109f, -0.43677726f, -0.43971875f,
+-0.44265553f, -0.44558757f, -0.44851484f, -0.45143731f, -0.45435494f,
+-0.45726770f, -0.46017557f, -0.46307851f, -0.46597650f, -0.46886949f,
+-0.47175746f, -0.47464038f, -0.47751821f, -0.48039093f, -0.48325851f,
+-0.48612091f, -0.48897811f, -0.49183006f, -0.49467676f, -0.49751815f,
+-0.50035422f, -0.50318492f, -0.50601024f, -0.50883014f, -0.51164459f,
+-0.51445356f, -0.51725703f, -0.52005495f, -0.52284730f, -0.52563406f,
+-0.52841518f, -0.53119065f, -0.53396043f, -0.53672449f, -0.53948280f,
+-0.54223533f, -0.54498206f, -0.54772295f, -0.55045797f, -0.55318710f,
+-0.55591031f, -0.55862756f, -0.56133883f, -0.56404409f, -0.56674331f,
+-0.56943646f, -0.57212351f, -0.57480443f, -0.57747920f, -0.58014778f,
+-0.58281015f, -0.58546628f, -0.58811614f, -0.59075970f, -0.59339694f,
+-0.59602782f, -0.59865231f, -0.60127040f, -0.60388204f, -0.60648722f,
+-0.60908591f, -0.61167807f, -0.61426368f, -0.61684271f, -0.61941514f,
+-0.62198093f, -0.62454007f, -0.62709251f, -0.62963824f, -0.63217722f,
+-0.63470944f, -0.63723486f, -0.63975345f, -0.64226519f, -0.64477006f,
+-0.64726802f, -0.64975905f, -0.65224312f, -0.65472020f, -0.65719027f,
+-0.65965331f, -0.66210928f, -0.66455816f, -0.66699992f, -0.66943454f,
+-0.67186199f, -0.67428225f, -0.67669528f, -0.67910107f, -0.68149959f,
+-0.68389080f, -0.68627470f, -0.68865124f, -0.69102041f, -0.69338218f,
+-0.69573652f, -0.69808341f, -0.70042283f, -0.70275474f, -0.70507913f,
+-0.70739597f, -0.70970524f, -0.71200690f, -0.71430093f, -0.71658732f,
+-0.71886604f, -0.72113705f, -0.72340034f, -0.72565589f, -0.72790366f,
+-0.73014364f, -0.73237580f, -0.73460012f, -0.73681657f, -0.73902513f,
+-0.74122577f, -0.74341848f, -0.74560322f, -0.74777998f, -0.74994874f,
+-0.75210946f, -0.75426212f, -0.75640671f, -0.75854320f, -0.76067157f,
+-0.76279178f, -0.76490383f, -0.76700769f, -0.76910334f, -0.77119075f,
+-0.77326989f, -0.77534076f, -0.77740333f, -0.77945757f, -0.78150346f,
+-0.78354098f, -0.78557011f, -0.78759083f, -0.78960312f, -0.79160694f,
+-0.79360229f, -0.79558915f, -0.79756748f, -0.79953727f, -0.80149850f,
+-0.80345114f, -0.80539518f, -0.80733060f, -0.80925737f, -0.81117547f,
+-0.81308489f, -0.81498559f, -0.81687757f, -0.81876081f, -0.82063527f,
+-0.82250095f, -0.82435781f, -0.82620585f, -0.82804505f, -0.82987537f,
+-0.83169681f, -0.83350933f, -0.83531294f, -0.83710760f, -0.83889329f,
+-0.84067000f, -0.84243770f, -0.84419639f, -0.84594603f, -0.84768662f,
+-0.84941812f, -0.85114053f, -0.85285383f, -0.85455799f, -0.85625300f,
+-0.85793884f, -0.85961549f, -0.86128294f, -0.86294116f, -0.86459014f,
+-0.86622986f, -0.86786031f, -0.86948146f, -0.87109330f, -0.87269581f,
+-0.87428898f, -0.87587278f, -0.87744720f, -0.87901223f, -0.88056784f,
+-0.88211402f, -0.88365076f, -0.88517803f, -0.88669582f, -0.88820412f,
+-0.88970290f, -0.89119216f, -0.89267187f, -0.89414203f, -0.89560260f,
+-0.89705359f, -0.89849497f, -0.89992673f, -0.90134885f, -0.90276131f,
+-0.90416411f, -0.90555723f, -0.90694065f, -0.90831436f, -0.90967833f,
+-0.91103257f, -0.91237705f, -0.91371176f, -0.91503669f, -0.91635181f,
+-0.91765712f, -0.91895261f, -0.92023825f, -0.92151404f, -0.92277996f,
+-0.92403600f, -0.92528214f, -0.92651837f, -0.92774468f, -0.92896106f,
+-0.93016748f, -0.93136395f, -0.93255044f, -0.93372694f, -0.93489345f,
+-0.93604994f, -0.93719641f, -0.93833284f, -0.93945922f, -0.94057555f,
+-0.94168180f, -0.94277796f, -0.94386403f, -0.94493999f, -0.94600583f,
+-0.94706154f, -0.94810711f, -0.94914252f, -0.95016777f, -0.95118284f,
+-0.95218773f, -0.95318242f, -0.95416690f, -0.95514117f, -0.95610520f,
+-0.95705900f, -0.95800255f, -0.95893583f, -0.95985885f, -0.96077159f,
+-0.96167404f, -0.96256619f, -0.96344803f, -0.96431956f, -0.96518076f,
+-0.96603162f, -0.96687213f, -0.96770230f, -0.96852209f, -0.96933152f,
+-0.97013057f, -0.97091922f, -0.97169748f, -0.97246533f, -0.97322277f,
+-0.97396979f, -0.97470637f, -0.97543252f, -0.97614822f, -0.97685347f,
+-0.97754825f, -0.97823257f, -0.97890641f, -0.97956977f, -0.98022263f,
+-0.98086500f, -0.98149687f, -0.98211822f, -0.98272906f, -0.98332937f,
+-0.98391915f, -0.98449840f, -0.98506710f, -0.98562525f, -0.98617285f,
+-0.98670988f, -0.98723635f, -0.98775225f, -0.98825757f, -0.98875230f,
+-0.98923645f, -0.98971000f, -0.99017295f, -0.99062530f, -0.99106704f,
+-0.99149817f, -0.99191868f, -0.99232857f, -0.99272783f, -0.99311645f,
+-0.99349445f, -0.99386180f, -0.99421851f, -0.99456457f, -0.99489998f,
+-0.99522474f, -0.99553884f, -0.99584227f, -0.99613505f, -0.99641715f,
+-0.99668858f, -0.99694934f, -0.99719943f, -0.99743883f, -0.99766756f,
+-0.99788559f, -0.99809295f, -0.99828961f, -0.99847558f, -0.99865086f,
+-0.99881544f, -0.99896933f, -0.99911252f, -0.99924501f, -0.99936680f,
+-0.99947789f, -0.99957827f, -0.99966795f, -0.99974692f, -0.99981519f,
+-0.99987275f, -0.99991960f, -0.99995574f, -0.99998118f, -0.99999590f,
+0.99999967f, 0.99997289f, 0.99990328f, 0.99979084f, 0.99963557f,
+0.99943748f, 0.99919658f, 0.99891288f, 0.99858638f, 0.99821711f,
+0.99780508f, 0.99735031f, 0.99685281f, 0.99631261f, 0.99572973f,
+0.99510420f, 0.99443605f, 0.99372529f, 0.99297196f, 0.99217610f,
+0.99133774f, 0.99045692f, 0.98953366f, 0.98856802f, 0.98756003f,
+0.98650973f, 0.98541718f, 0.98428242f, 0.98310549f, 0.98188645f,
+0.98062534f, 0.97932224f, 0.97797718f, 0.97659022f, 0.97516144f,
+0.97369088f, 0.97217861f, 0.97062469f, 0.96902920f, 0.96739220f,
+0.96571376f, 0.96399395f, 0.96223284f, 0.96043052f, 0.95858705f,
+0.95670253f, 0.95477702f, 0.95281061f, 0.95080338f, 0.94875543f,
+0.94666684f, 0.94453769f, 0.94236808f, 0.94015810f, 0.93790786f,
+0.93561743f, 0.93328693f, 0.93091644f, 0.92850608f, 0.92605595f,
+0.92356614f, 0.92103677f, 0.91846795f, 0.91585979f, 0.91321239f,
+0.91052587f, 0.90780035f, 0.90503595f, 0.90223277f, 0.89939095f,
+0.89651059f, 0.89359184f, 0.89063481f, 0.88763962f, 0.88460641f,
+0.88153531f, 0.87842644f, 0.87527995f, 0.87209596f, 0.86887462f,
+0.86561605f, 0.86232041f, 0.85898782f, 0.85561844f, 0.85221241f,
+0.84876987f, 0.84529098f, 0.84177587f, 0.83822471f, 0.83463763f,
+0.83101481f, 0.82735639f, 0.82366252f, 0.81993338f, 0.81616911f,
+0.81236987f, 0.80853584f, 0.80466718f, 0.80076404f, 0.79682660f,
+0.79285503f, 0.78884950f, 0.78481017f, 0.78073723f, 0.77663084f,
+0.77249118f, 0.76831844f, 0.76411277f, 0.75987438f, 0.75560344f,
+0.75130013f, 0.74696464f, 0.74259715f, 0.73819784f, 0.73376692f,
+0.72930457f, 0.72481097f, 0.72028632f, 0.71573083f, 0.71114467f,
+0.70652804f, 0.70188116f, 0.69720420f, 0.69249738f, 0.68776090f,
+0.68299495f, 0.67819975f, 0.67337550f, 0.66852240f, 0.66364066f,
+0.65873050f, 0.65379211f, 0.64882573f, 0.64383154f, 0.63880978f,
+0.63376065f, 0.62868438f, 0.62358117f, 0.61845126f, 0.61329485f,
+0.60811216f, 0.60290343f, 0.59766888f, 0.59240872f, 0.58712318f,
+0.58181249f, 0.57647688f, 0.57111658f, 0.56573181f, 0.56032281f,
+0.55488980f, 0.54943303f, 0.54395272f, 0.53844911f, 0.53292243f,
+0.52737292f, 0.52180083f, 0.51620638f, 0.51058981f, 0.50495138f,
+0.49929132f, 0.49360987f, 0.48790727f, 0.48218377f, 0.47643962f,
+0.47067506f, 0.46489034f, 0.45908570f, 0.45326139f, 0.44741768f,
+0.44155479f, 0.43567299f, 0.42977253f, 0.42385365f, 0.41791662f,
+0.41196169f, 0.40598911f, 0.39999914f, 0.39399204f, 0.38796806f,
+0.38192746f, 0.37587050f, 0.36979743f, 0.36370853f, 0.35760405f,
+0.35148424f, 0.34534939f, 0.33919973f, 0.33303555f, 0.32685710f,
+0.32066465f, 0.31445847f, 0.30823881f, 0.30200595f, 0.29576015f,
+0.28950169f, 0.28323082f, 0.27694782f, 0.27065295f, 0.26434649f,
+0.25802871f, 0.25169988f, 0.24536026f, 0.23901013f, 0.23264977f,
+0.22627944f, 0.21989941f, 0.21350997f, 0.20711138f, 0.20070391f,
+0.19428785f, 0.18786347f, 0.18143104f, 0.17499084f, 0.16854314f,
+0.16208822f, 0.15562636f, 0.14915783f, 0.14268292f, 0.13620189f,
+0.12971502f, 0.12322260f, 0.11672491f, 0.11022221f, 0.10371479f,
+0.097202924f, 0.090686897f, 0.084166986f, 0.077643468f, 0.071116625f,
+0.064586736f, 0.058054080f, 0.051518937f, 0.044981587f, 0.038442310f,
+0.031901387f, 0.025359097f, 0.018815721f, 0.012271538f, 0.0057268303f,
+-0.00081812300f, -0.0073630412f, -0.013907644f, -0.020451651f, -0.026994782f,
+-0.033536757f, -0.040077295f, -0.046616116f, -0.053152941f, -0.059687488f,
+-0.066219479f, -0.072748633f, -0.079274670f, -0.085797312f, -0.092316279f,
+-0.098831291f, -0.10534207f, -0.11184834f, -0.11834981f, -0.12484622f,
+-0.13133727f, -0.13782270f, -0.14430223f, -0.15077558f, -0.15724246f,
+-0.16370261f, -0.17015575f, -0.17660160f, -0.18303989f, -0.18947033f,
+-0.19589266f, -0.20230660f, -0.20871187f, -0.21510820f, -0.22149531f,
+-0.22787294f, -0.23424080f, -0.24059864f, -0.24694616f, -0.25328311f,
+-0.25960920f, -0.26592418f, -0.27222777f, -0.27851969f, -0.28479968f,
+-0.29106748f, -0.29732280f, -0.30356539f, -0.30979497f, -0.31601129f,
+-0.32221406f, -0.32840304f, -0.33457794f, -0.34073852f, -0.34688450f,
+-0.35301562f, -0.35913161f, -0.36523223f, -0.37131719f, -0.37738626f,
+-0.38343915f, -0.38947562f, -0.39549541f, -0.40149825f, -0.40748390f,
+-0.41345209f, -0.41940257f, -0.42533508f, -0.43124938f, -0.43714520f,
+-0.44302229f, -0.44888041f, -0.45471930f, -0.46053871f, -0.46633839f,
+-0.47211810f, -0.47787758f, -0.48361659f, -0.48933489f, -0.49503222f,
+-0.50070835f, -0.50636303f, -0.51199602f, -0.51760707f, -0.52319595f,
+-0.52876243f, -0.53430625f, -0.53982718f, -0.54532499f, -0.55079944f,
+-0.55625029f, -0.56167732f, -0.56708028f, -0.57245896f, -0.57781311f,
+-0.58314251f, -0.58844693f, -0.59372614f, -0.59897992f, -0.60420805f,
+-0.60941029f, -0.61458642f, -0.61973623f, -0.62485949f, -0.62995598f,
+-0.63502549f, -0.64006780f, -0.64508268f, -0.65006994f, -0.65502934f,
+-0.65996069f, -0.66486377f, -0.66973837f, -0.67458427f, -0.67940128f,
+-0.68418919f, -0.68894779f, -0.69367688f, -0.69837625f, -0.70304571f,
+-0.70768504f, -0.71229407f, -0.71687258f, -0.72142039f, -0.72593729f,
+-0.73042309f, -0.73487761f, -0.73930064f, -0.74369201f, -0.74805152f,
+-0.75237898f, -0.75667422f, -0.76093704f, -0.76516727f, -0.76936471f,
+-0.77352921f, -0.77766056f, -0.78175861f, -0.78582316f, -0.78985406f,
+-0.79385112f, -0.79781417f, -0.80174305f, -0.80563758f, -0.80949760f,
+-0.81332295f, -0.81711346f, -0.82086896f, -0.82458930f, -0.82827432f,
+-0.83192386f, -0.83553776f, -0.83911587f, -0.84265803f, -0.84616410f,
+-0.84963392f, -0.85306735f, -0.85646423f, -0.85982442f, -0.86314779f,
+-0.86643418f, -0.86968345f, -0.87289547f, -0.87607009f, -0.87920719f,
+-0.88230663f, -0.88536827f, -0.88839199f, -0.89137765f, -0.89432512f,
+-0.89723429f, -0.90010502f, -0.90293719f, -0.90573069f, -0.90848539f,
+-0.91120117f, -0.91387791f, -0.91651551f, -0.91911385f, -0.92167282f,
+-0.92419231f, -0.92667220f, -0.92911240f, -0.93151280f, -0.93387330f,
+-0.93619380f, -0.93847419f, -0.94071438f, -0.94291427f, -0.94507377f,
+-0.94719279f, -0.94927123f, -0.95130901f, -0.95330604f, -0.95526223f,
+-0.95717750f, -0.95905177f, -0.96088496f, -0.96267699f, -0.96442777f,
+-0.96613725f, -0.96780534f, -0.96943197f, -0.97101707f, -0.97256058f,
+-0.97406243f, -0.97552255f, -0.97694089f, -0.97831737f, -0.97965195f,
+-0.98094456f, -0.98219515f, -0.98340367f, -0.98457006f, -0.98569428f,
+-0.98677627f, -0.98781599f, -0.98881340f, -0.98976845f, -0.99068110f,
+-0.99155132f, -0.99237906f, -0.99316428f, -0.99390697f, -0.99460708f,
+-0.99526458f, -0.99587945f, -0.99645166f, -0.99698119f, -0.99746801f,
+-0.99791210f, -0.99831344f, -0.99867202f, -0.99898782f, -0.99926082f,
+-0.99949102f, -0.99967841f, -0.99982297f, -0.99992470f, -0.99998360f,
+0.99999866f, 0.99989157f, 0.99961315f, 0.99916346f, 0.99854256f,
+0.99775057f, 0.99678762f, 0.99565388f, 0.99434953f, 0.99287481f,
+0.99122996f, 0.98941527f, 0.98743105f, 0.98527764f, 0.98295541f,
+0.98046475f, 0.97780610f, 0.97497990f, 0.97198664f, 0.96882685f,
+0.96550104f, 0.96200980f, 0.95835373f, 0.95453345f, 0.95054962f,
+0.94640291f, 0.94209404f, 0.93762375f, 0.93299280f, 0.92820199f,
+0.92325213f, 0.91814408f, 0.91287871f, 0.90745693f, 0.90187965f,
+0.89614785f, 0.89026249f, 0.88422459f, 0.87803519f, 0.87169533f,
+0.86520612f, 0.85856866f, 0.85178409f, 0.84485357f, 0.83777828f,
+0.83055945f, 0.82319831f, 0.81569611f, 0.80805415f, 0.80027373f,
+0.79235620f, 0.78430289f, 0.77611520f, 0.76779452f, 0.75934229f,
+0.75075995f, 0.74204897f, 0.73321084f, 0.72424708f, 0.71515923f,
+0.70594883f, 0.69661748f, 0.68716676f, 0.67759830f, 0.66791374f,
+0.65811474f, 0.64820297f, 0.63818013f, 0.62804795f, 0.61780815f,
+0.60746249f, 0.59701275f, 0.58646072f, 0.57580819f, 0.56505701f,
+0.55420900f, 0.54326604f, 0.53222998f, 0.52110274f, 0.50988620f,
+0.49858230f, 0.48719297f, 0.47572016f, 0.46416584f, 0.45253199f,
+0.44082059f, 0.42903367f, 0.41717323f, 0.40524131f, 0.39323996f,
+0.38117123f, 0.36903718f, 0.35683990f, 0.34458148f, 0.33226402f,
+0.31988962f, 0.30746042f, 0.29497853f, 0.28244610f, 0.26986527f,
+0.25723821f, 0.24456706f, 0.23185402f, 0.21910124f, 0.20631092f,
+0.19348526f, 0.18062644f, 0.16773667f, 0.15481816f, 0.14187312f,
+0.12890377f, 0.11591234f, 0.10290104f, 0.089872115f, 0.076827789f,
+0.063770300f, 0.050701883f, 0.037624779f, 0.024541229f, 0.011453473f,
+-0.0016362454f, -0.014725683f, -0.027812598f, -0.040894747f, -0.053969889f,
+-0.067035784f, -0.080090192f, -0.093130877f, -0.10615561f, -0.11916214f,
+-0.13214826f, -0.14511174f, -0.15805036f, -0.17096189f, -0.18384413f,
+-0.19669487f, -0.20951190f, -0.22229304f, -0.23503609f, -0.24773886f,
+-0.26039919f, -0.27301490f, -0.28558383f, -0.29810383f, -0.31057274f,
+-0.32298845f, -0.33534881f, -0.34765171f, -0.35989504f, -0.37207670f,
+-0.38419461f, -0.39624670f, -0.40823088f, -0.42014512f, -0.43198737f,
+-0.44375560f, -0.45544780f, -0.46706195f, -0.47859608f, -0.49004821f,
+-0.50141636f, -0.51269860f, -0.52389299f, -0.53499762f, -0.54601058f,
+-0.55692998f, -0.56775395f, -0.57848064f, -0.58910822f, -0.59963485f,
+-0.61005873f, -0.62037809f, -0.63059115f, -0.64069616f, -0.65069139f,
+-0.66057513f, -0.67034568f, -0.68000137f, -0.68954054f, -0.69896157f,
+-0.70826283f, -0.71744274f, -0.72649972f, -0.73543221f, -0.74423869f,
+-0.75291765f, -0.76146760f, -0.76988708f, -0.77817464f, -0.78632887f,
+-0.79434836f, -0.80223175f, -0.80997767f, -0.81758481f, -0.82505187f,
+-0.83237755f, -0.83956061f, -0.84659981f, -0.85349396f, -0.86024186f,
+-0.86684237f, -0.87329434f, -0.87959669f, -0.88574831f, -0.89174817f,
+-0.89759523f, -0.90328850f, -0.90882699f, -0.91420976f, -0.91943588f,
+-0.92450446f, -0.92941463f, -0.93416555f, -0.93875641f, -0.94318642f,
+-0.94745482f, -0.95156087f, -0.95550388f, -0.95928317f, -0.96289809f,
+-0.96634802f, -0.96963238f, -0.97275059f, -0.97570213f, -0.97848649f,
+-0.98110318f, -0.98355177f, -0.98583184f, -0.98794298f, -0.98988485f,
+-0.99165711f, -0.99325945f, -0.99469160f, -0.99595331f, -0.99704438f,
+-0.99796460f, -0.99871383f, -0.99929194f, -0.99969882f, -0.99993441f,
+0.99999465f, 0.99956631f, 0.99845292f, 0.99665524f, 0.99417450f,
+0.99101241f, 0.98717112f, 0.98265328f, 0.97746197f, 0.97160077f,
+0.96507367f, 0.95788516f, 0.95004017f, 0.94154407f, 0.93240267f,
+0.92262226f, 0.91220953f, 0.90117161f, 0.88951608f, 0.87725091f,
+0.86438452f, 0.85092573f, 0.83688375f, 0.82226822f, 0.80708914f,
+0.79135693f, 0.77508236f, 0.75827658f, 0.74095113f, 0.72311786f,
+0.70478900f, 0.68597711f, 0.66669509f, 0.64695615f, 0.62677382f,
+0.60616193f, 0.58513461f, 0.56370626f, 0.54189158f, 0.51970551f,
+0.49716327f, 0.47428029f, 0.45107226f, 0.42755509f, 0.40374490f,
+0.37965800f, 0.35531090f, 0.33072029f, 0.30590302f, 0.28087610f,
+0.25565668f, 0.23026205f, 0.20470960f, 0.17901686f, 0.15320143f,
+0.12728100f, 0.10127334f, 0.075196277f, 0.049067674f, 0.022905443f,
+-0.0032724865f, -0.029448173f, -0.055603678f, -0.081721074f, -0.10778246f,
+-0.13376998f, -0.15966582f, -0.18545224f, -0.21111155f, -0.23662618f,
+-0.26197864f, -0.28715155f, -0.31212766f, -0.33688985f, -0.36142116f,
+-0.38570477f, -0.40972403f, -0.43346249f, -0.45690388f, -0.48003212f,
+-0.50283138f, -0.52528602f, -0.54738066f, -0.56910015f, -0.59042960f,
+-0.61135441f, -0.63186022f, -0.65193299f, -0.67155895f, -0.69072467f,
+-0.70941699f, -0.72762312f, -0.74533057f, -0.76252720f, -0.77920124f,
+-0.79534126f, -0.81093618f, -0.82597533f, -0.84044840f, -0.85434547f,
+-0.86765701f, -0.88037390f, -0.89248743f, -0.90398929f, -0.91487161f,
+-0.92512691f, -0.93474818f, -0.94372882f, -0.95206268f, -0.95974404f,
+-0.96676764f, -0.97312866f, -0.97882275f, -0.98384601f, -0.98819498f,
+-0.99186670f, -0.99485864f, -0.99716875f, -0.99879546f, -0.99973764f,
};
#endif
static const CELTMode mode48000_960_120 = {
-48000, /* Fs */
+48000, /* Fs */
120, /* overlap */
-21, /* nbEBands */
-21, /* effEBands */
+21, /* nbEBands */
+21, /* effEBands */
{0.85000610f, 0.0000000f, 1.0000000f, 1.0000000f, }, /* preemph */
-eband5ms, /* eBands */
-3, /* maxLM */
-8, /* nbShortMdcts */
+eband5ms, /* eBands */
+3, /* maxLM */
+8, /* nbShortMdcts */
120, /* shortMdctSize */
-11, /* nbAllocVectors */
-band_allocation, /* allocVectors */
-logN400, /* logN */
-window120, /* window */
+11, /* nbAllocVectors */
+band_allocation, /* allocVectors */
+logN400, /* logN */
+window120, /* window */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
-{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
+{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
+#ifdef ENABLE_QEXT
+{86, qext_cache_index50, qext_cache_bits50, qext_cache_caps50}, /* qext_cache */
+#endif
+};
+
+#ifdef ENABLE_QEXT
+#ifndef DEF_WINDOW240
+#define DEF_WINDOW240
+static const celt_coef window240[240] = {
+1.6821922e-05f, 0.00015139297f, 0.00042051200f, 0.00082413284f, 0.0013621862f,
+0.0020345793f, 0.0028411964f, 0.0037818978f, 0.0048565203f, 0.0060648765f,
+0.0074067550f, 0.0088819198f, 0.010490110f, 0.012231040f, 0.014104398f,
+0.016109846f, 0.018247021f, 0.020515533f, 0.022914963f, 0.025444867f,
+0.028104770f, 0.030894170f, 0.033812535f, 0.036859304f, 0.040033885f,
+0.043335654f, 0.046763958f, 0.050318110f, 0.053997389f, 0.057801044f,
+0.061728287f, 0.065778297f, 0.069950217f, 0.074243155f, 0.078656182f,
+0.083188331f, 0.087838600f, 0.092605946f, 0.097489289f, 0.10248751f,
+0.10759945f, 0.11282390f, 0.11815964f, 0.12360536f, 0.12915977f,
+0.13482147f, 0.14058908f, 0.14646113f, 0.15243614f, 0.15851256f,
+0.16468882f, 0.17096330f, 0.17733432f, 0.18380017f, 0.19035910f,
+0.19700930f, 0.20374894f, 0.21057612f, 0.21748892f, 0.22448537f,
+0.23156343f, 0.23872106f, 0.24595615f, 0.25326656f, 0.26065010f,
+0.26810455f, 0.27562763f, 0.28321704f, 0.29087045f, 0.29858546f,
+0.30635965f, 0.31419058f, 0.32207574f, 0.33001263f, 0.33799866f,
+0.34603127f, 0.35410783f, 0.36222570f, 0.37038219f, 0.37857460f,
+0.38680022f, 0.39505629f, 0.40334003f, 0.41164867f, 0.41997939f,
+0.42832937f, 0.43669576f, 0.44507572f, 0.45346639f, 0.46186489f,
+0.47026835f, 0.47867389f, 0.48707862f, 0.49547965f, 0.50387411f,
+0.51225912f, 0.52063179f, 0.52898927f, 0.53732871f, 0.54564725f,
+0.55394208f, 0.56221039f, 0.57044938f, 0.57865628f, 0.58682836f,
+0.59496289f, 0.60305718f, 0.61110858f, 0.61911445f, 0.62707221f,
+0.63497931f, 0.64283322f, 0.65063147f, 0.65837163f, 0.66605132f,
+0.67366820f, 0.68121999f, 0.68870444f, 0.69611937f, 0.70346266f,
+0.71073222f, 0.71792606f, 0.72504220f, 0.73207877f, 0.73903393f,
+0.74590592f, 0.75269303f, 0.75939364f, 0.76600617f, 0.77252915f,
+0.77896113f, 0.78530077f, 0.79154678f, 0.79769796f, 0.80375317f,
+0.80971135f, 0.81557152f, 0.82133276f, 0.82699424f, 0.83255520f,
+0.83801496f, 0.84337291f, 0.84862851f, 0.85378132f, 0.85883095f,
+0.86377710f, 0.86861954f, 0.87335813f, 0.87799277f, 0.88252347f,
+0.88695029f, 0.89127338f, 0.89549294f, 0.89960926f, 0.90362268f,
+0.90753364f, 0.91134262f, 0.91505017f, 0.91865692f, 0.92216354f,
+0.92557078f, 0.92887945f, 0.93209042f, 0.93520460f, 0.93822298f,
+0.94114659f, 0.94397652f, 0.94671390f, 0.94935993f, 0.95191584f,
+0.95438290f, 0.95676245f, 0.95905584f, 0.96126449f, 0.96338982f,
+0.96543334f, 0.96739653f, 0.96928096f, 0.97108818f, 0.97281981f,
+0.97447746f, 0.97606279f, 0.97757746f, 0.97902317f, 0.98040162f,
+0.98171453f, 0.98296363f, 0.98415067f, 0.98527740f, 0.98634557f,
+0.98735696f, 0.98831332f, 0.98921643f, 0.99006803f, 0.99086991f,
+0.99162380f, 0.99233145f, 0.99299461f, 0.99361500f, 0.99419433f,
+0.99473429f, 0.99523657f, 0.99570284f, 0.99613472f, 0.99653384f,
+0.99690180f, 0.99724017f, 0.99755048f, 0.99783426f, 0.99809299f,
+0.99832812f, 0.99854108f, 0.99873324f, 0.99890597f, 0.99906057f,
+0.99919832f, 0.99932046f, 0.99942819f, 0.99952266f, 0.99960498f,
+0.99967623f, 0.99973742f, 0.99978953f, 0.99983351f, 0.99987023f,
+0.99990053f, 0.99992520f, 0.99994498f, 0.99996055f, 0.99997257f,
+0.99998161f, 0.99998821f, 0.99999285f, 0.99999596f, 0.99999793f,
+0.99999907f, 0.99999966f, 0.99999991f, 0.99999999f, 1.0000000f,
+};
+#endif
+
+#ifndef DEF_LOGN400
+#define DEF_LOGN400
+static const opus_int16 logN400[21] = {
+0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 34, 36, };
+#endif
+
+#ifndef DEF_PULSE_CACHE50
+#define DEF_PULSE_CACHE50
+static const opus_int16 cache_index50[105] = {
+-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 41, 41, 41,
+82, 82, 123, 164, 200, 222, 0, 0, 0, 0, 0, 0, 0, 0, 41,
+41, 41, 41, 123, 123, 123, 164, 164, 240, 266, 283, 295, 41, 41, 41,
+41, 41, 41, 41, 41, 123, 123, 123, 123, 240, 240, 240, 266, 266, 305,
+318, 328, 336, 123, 123, 123, 123, 123, 123, 123, 123, 240, 240, 240, 240,
+305, 305, 305, 318, 318, 343, 351, 358, 364, 240, 240, 240, 240, 240, 240,
+240, 240, 305, 305, 305, 305, 343, 343, 343, 351, 351, 370, 376, 382, 387,
+};
+static const unsigned char cache_bits50[392] = {
+40, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 40, 15, 23, 28,
+31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47, 47, 49, 50,
+51, 52, 53, 54, 55, 55, 57, 58, 59, 60, 61, 62, 63, 63, 65,
+66, 67, 68, 69, 70, 71, 71, 40, 20, 33, 41, 48, 53, 57, 61,
+64, 66, 69, 71, 73, 75, 76, 78, 80, 82, 85, 87, 89, 91, 92,
+94, 96, 98, 101, 103, 105, 107, 108, 110, 112, 114, 117, 119, 121, 123,
+124, 126, 128, 40, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94,
+97, 100, 102, 105, 107, 111, 115, 118, 121, 124, 126, 129, 131, 135, 139,
+142, 145, 148, 150, 153, 155, 159, 163, 166, 169, 172, 174, 177, 179, 35,
+28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149,
+153, 159, 165, 171, 176, 180, 185, 189, 192, 199, 205, 211, 216, 220, 225,
+229, 232, 239, 245, 251, 21, 33, 58, 79, 97, 112, 125, 137, 148, 157,
+166, 174, 182, 189, 195, 201, 207, 217, 227, 235, 243, 251, 17, 35, 63,
+86, 106, 123, 139, 152, 165, 177, 187, 197, 206, 214, 222, 230, 237, 250,
+25, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180,
+185, 190, 200, 208, 215, 222, 229, 235, 240, 245, 255, 16, 36, 65, 89,
+110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242, 250, 11, 41,
+74, 103, 128, 151, 172, 191, 209, 225, 241, 255, 9, 43, 79, 110, 138,
+163, 186, 207, 227, 246, 12, 39, 71, 99, 123, 144, 164, 182, 198, 214,
+228, 241, 253, 9, 44, 81, 113, 142, 168, 192, 214, 235, 255, 7, 49,
+90, 127, 160, 191, 220, 247, 6, 51, 95, 134, 170, 203, 234, 7, 47,
+87, 123, 155, 184, 212, 237, 6, 52, 97, 137, 174, 208, 240, 5, 57,
+106, 151, 192, 231, 5, 59, 111, 158, 202, 243, 5, 55, 103, 147, 187,
+224, 5, 60, 113, 161, 206, 248, 4, 65, 122, 175, 224, 4, 67, 127,
+182, 234, };
+static const unsigned char cache_caps50[168] = {
+224, 224, 224, 224, 224, 224, 224, 224, 160, 160, 160, 160, 185, 185, 185,
+178, 178, 168, 134, 61, 37, 224, 224, 224, 224, 224, 224, 224, 224, 240,
+240, 240, 240, 207, 207, 207, 198, 198, 183, 144, 66, 40, 160, 160, 160,
+160, 160, 160, 160, 160, 185, 185, 185, 185, 193, 193, 193, 183, 183, 172,
+138, 64, 38, 240, 240, 240, 240, 240, 240, 240, 240, 207, 207, 207, 207,
+204, 204, 204, 193, 193, 180, 143, 66, 40, 185, 185, 185, 185, 185, 185,
+185, 185, 193, 193, 193, 193, 193, 193, 193, 183, 183, 172, 138, 65, 39,
+207, 207, 207, 207, 207, 207, 207, 207, 204, 204, 204, 204, 201, 201, 201,
+188, 188, 176, 141, 66, 40, 193, 193, 193, 193, 193, 193, 193, 193, 193,
+193, 193, 193, 194, 194, 194, 184, 184, 173, 139, 65, 39, 204, 204, 204,
+204, 204, 204, 204, 204, 201, 201, 201, 201, 198, 198, 198, 187, 187, 175,
+140, 66, 40, };
+#endif
+
+#ifdef ENABLE_QEXT
+# ifndef DEF_QEXT_PULSE_CACHE50
+# define DEF_QEXT_PULSE_CACHE50
+static const opus_int16 qext_cache_index50[70] = {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41,
+41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 61, 61,
+61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 72, 72, 72,
+72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 80, 80, 80, 80,
+80, 80, 80, 80, 80, 80, 80, 80, 80, 80, };
+static const unsigned char qext_cache_bits50[86] = {
+40, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125,
+128, 131, 136, 141, 146, 150, 153, 157, 160, 163, 168, 173, 178, 182, 185,
+189, 192, 195, 200, 205, 210, 214, 217, 221, 224, 227, 19, 34, 61, 83,
+101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216, 222, 234, 245,
+254, 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253, 7, 50, 93,
+131, 165, 197, 227, 255, 5, 58, 109, 155, 197, 237, };
+static const unsigned char qext_cache_caps50[112] = {
+159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 171,
+171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 167, 167, 167,
+167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 166, 166, 166, 166, 166,
+166, 166, 166, 166, 166, 166, 166, 166, 166, 163, 163, 163, 163, 163, 163,
+163, 163, 163, 163, 163, 163, 163, 163, 165, 165, 165, 165, 165, 165, 165,
+165, 165, 165, 165, 165, 165, 165, };
+# endif
+#endif
+
+#ifndef FFT_TWIDDLES96000_1920
+#define FFT_TWIDDLES96000_1920
+static const kiss_twiddle_cpx fft_twiddles96000_1920[960] = {
+{1.0000000f, -0.0000000f}, {0.99997858f, -0.0065449380f},
+{0.99991433f, -0.013089596f}, {0.99980724f, -0.019633692f},
+{0.99965732f, -0.026176948f}, {0.99946459f, -0.032719083f},
+{0.99922904f, -0.039259816f}, {0.99895068f, -0.045798867f},
+{0.99862953f, -0.052335956f}, {0.99826561f, -0.058870804f},
+{0.99785892f, -0.065403129f}, {0.99740949f, -0.071932653f},
+{0.99691733f, -0.078459096f}, {0.99638247f, -0.084982177f},
+{0.99580493f, -0.091501619f}, {0.99518473f, -0.098017140f},
+{0.99452190f, -0.10452846f}, {0.99381646f, -0.11103531f},
+{0.99306846f, -0.11753740f}, {0.99227791f, -0.12403445f},
+{0.99144486f, -0.13052619f}, {0.99056934f, -0.13701234f},
+{0.98965139f, -0.14349262f}, {0.98869104f, -0.14996676f},
+{0.98768834f, -0.15643447f}, {0.98664333f, -0.16289547f},
+{0.98555606f, -0.16934950f}, {0.98442657f, -0.17579628f},
+{0.98325491f, -0.18223553f}, {0.98204113f, -0.18866696f},
+{0.98078528f, -0.19509032f}, {0.97948742f, -0.20150532f},
+{0.97814760f, -0.20791169f}, {0.97676588f, -0.21430915f},
+{0.97534232f, -0.22069744f}, {0.97387698f, -0.22707626f},
+{0.97236992f, -0.23344536f}, {0.97082121f, -0.23980446f},
+{0.96923091f, -0.24615329f}, {0.96759909f, -0.25249158f},
+{0.96592583f, -0.25881905f}, {0.96421118f, -0.26513543f},
+{0.96245524f, -0.27144045f}, {0.96065806f, -0.27773385f},
+{0.95881973f, -0.28401534f}, {0.95694034f, -0.29028468f},
+{0.95501994f, -0.29654157f}, {0.95305864f, -0.30278577f},
+{0.95105652f, -0.30901699f}, {0.94901365f, -0.31523498f},
+{0.94693013f, -0.32143947f}, {0.94480605f, -0.32763018f},
+{0.94264149f, -0.33380686f}, {0.94043656f, -0.33996924f},
+{0.93819134f, -0.34611706f}, {0.93590593f, -0.35225005f},
+{0.93358043f, -0.35836795f}, {0.93121493f, -0.36447050f},
+{0.92880955f, -0.37055744f}, {0.92636438f, -0.37662850f},
+{0.92387953f, -0.38268343f}, {0.92135511f, -0.38872197f},
+{0.91879121f, -0.39474386f}, {0.91618796f, -0.40074883f},
+{0.91354546f, -0.40673664f}, {0.91086382f, -0.41270703f},
+{0.90814317f, -0.41865974f}, {0.90538362f, -0.42459451f},
+{0.90258528f, -0.43051110f}, {0.89974828f, -0.43640924f},
+{0.89687274f, -0.44228869f}, {0.89395878f, -0.44814919f},
+{0.89100652f, -0.45399050f}, {0.88801610f, -0.45981236f},
+{0.88498764f, -0.46561452f}, {0.88192126f, -0.47139674f},
+{0.87881711f, -0.47715876f}, {0.87567532f, -0.48290034f},
+{0.87249601f, -0.48862124f}, {0.86927932f, -0.49432121f},
+{0.86602540f, -0.50000000f}, {0.86273439f, -0.50565737f},
+{0.85940641f, -0.51129309f}, {0.85604162f, -0.51690690f},
+{0.85264016f, -0.52249856f}, {0.84920218f, -0.52806785f},
+{0.84572782f, -0.53361452f}, {0.84221723f, -0.53913832f},
+{0.83867057f, -0.54463904f}, {0.83508798f, -0.55011642f},
+{0.83146961f, -0.55557023f}, {0.82781563f, -0.56100025f},
+{0.82412619f, -0.56640624f}, {0.82040144f, -0.57178796f},
+{0.81664156f, -0.57714519f}, {0.81284668f, -0.58247770f},
+{0.80901699f, -0.58778525f}, {0.80515265f, -0.59306763f},
+{0.80125381f, -0.59832460f}, {0.79732065f, -0.60355594f},
+{0.79335334f, -0.60876143f}, {0.78935204f, -0.61394084f},
+{0.78531693f, -0.61909395f}, {0.78124818f, -0.62422054f},
+{0.77714596f, -0.62932039f}, {0.77301045f, -0.63439328f},
+{0.76884183f, -0.63943900f}, {0.76464028f, -0.64445733f},
+{0.76040597f, -0.64944805f}, {0.75613908f, -0.65441095f},
+{0.75183981f, -0.65934582f}, {0.74750833f, -0.66425244f},
+{0.74314483f, -0.66913061f}, {0.73874949f, -0.67398011f},
+{0.73432251f, -0.67880075f}, {0.72986407f, -0.68359230f},
+{0.72537437f, -0.68835458f}, {0.72085360f, -0.69308736f},
+{0.71630194f, -0.69779046f}, {0.71171961f, -0.70246367f},
+{0.70710678f, -0.70710678f}, {0.70246367f, -0.71171961f},
+{0.69779046f, -0.71630194f}, {0.69308736f, -0.72085360f},
+{0.68835458f, -0.72537437f}, {0.68359230f, -0.72986407f},
+{0.67880075f, -0.73432251f}, {0.67398011f, -0.73874949f},
+{0.66913061f, -0.74314483f}, {0.66425244f, -0.74750833f},
+{0.65934582f, -0.75183981f}, {0.65441095f, -0.75613908f},
+{0.64944805f, -0.76040597f}, {0.64445733f, -0.76464028f},
+{0.63943900f, -0.76884183f}, {0.63439328f, -0.77301045f},
+{0.62932039f, -0.77714596f}, {0.62422054f, -0.78124818f},
+{0.61909395f, -0.78531693f}, {0.61394084f, -0.78935204f},
+{0.60876143f, -0.79335334f}, {0.60355594f, -0.79732065f},
+{0.59832460f, -0.80125381f}, {0.59306763f, -0.80515265f},
+{0.58778525f, -0.80901699f}, {0.58247770f, -0.81284668f},
+{0.57714519f, -0.81664156f}, {0.57178796f, -0.82040144f},
+{0.56640624f, -0.82412619f}, {0.56100025f, -0.82781563f},
+{0.55557023f, -0.83146961f}, {0.55011642f, -0.83508798f},
+{0.54463904f, -0.83867057f}, {0.53913832f, -0.84221723f},
+{0.53361452f, -0.84572782f}, {0.52806785f, -0.84920218f},
+{0.52249856f, -0.85264016f}, {0.51690690f, -0.85604162f},
+{0.51129309f, -0.85940641f}, {0.50565737f, -0.86273439f},
+{0.50000000f, -0.86602540f}, {0.49432121f, -0.86927932f},
+{0.48862124f, -0.87249601f}, {0.48290034f, -0.87567532f},
+{0.47715876f, -0.87881711f}, {0.47139674f, -0.88192126f},
+{0.46561452f, -0.88498764f}, {0.45981236f, -0.88801610f},
+{0.45399050f, -0.89100652f}, {0.44814919f, -0.89395878f},
+{0.44228869f, -0.89687274f}, {0.43640924f, -0.89974828f},
+{0.43051110f, -0.90258528f}, {0.42459451f, -0.90538362f},
+{0.41865974f, -0.90814317f}, {0.41270703f, -0.91086382f},
+{0.40673664f, -0.91354546f}, {0.40074883f, -0.91618796f},
+{0.39474386f, -0.91879121f}, {0.38872197f, -0.92135511f},
+{0.38268343f, -0.92387953f}, {0.37662850f, -0.92636438f},
+{0.37055744f, -0.92880955f}, {0.36447050f, -0.93121493f},
+{0.35836795f, -0.93358043f}, {0.35225005f, -0.93590593f},
+{0.34611706f, -0.93819134f}, {0.33996924f, -0.94043656f},
+{0.33380686f, -0.94264149f}, {0.32763018f, -0.94480605f},
+{0.32143947f, -0.94693013f}, {0.31523498f, -0.94901365f},
+{0.30901699f, -0.95105652f}, {0.30278577f, -0.95305864f},
+{0.29654157f, -0.95501994f}, {0.29028468f, -0.95694034f},
+{0.28401534f, -0.95881973f}, {0.27773385f, -0.96065806f},
+{0.27144045f, -0.96245524f}, {0.26513543f, -0.96421118f},
+{0.25881905f, -0.96592583f}, {0.25249158f, -0.96759909f},
+{0.24615329f, -0.96923091f}, {0.23980446f, -0.97082121f},
+{0.23344536f, -0.97236992f}, {0.22707626f, -0.97387698f},
+{0.22069744f, -0.97534232f}, {0.21430915f, -0.97676588f},
+{0.20791169f, -0.97814760f}, {0.20150532f, -0.97948742f},
+{0.19509032f, -0.98078528f}, {0.18866696f, -0.98204113f},
+{0.18223553f, -0.98325491f}, {0.17579628f, -0.98442657f},
+{0.16934950f, -0.98555606f}, {0.16289547f, -0.98664333f},
+{0.15643447f, -0.98768834f}, {0.14996676f, -0.98869104f},
+{0.14349262f, -0.98965139f}, {0.13701234f, -0.99056934f},
+{0.13052619f, -0.99144486f}, {0.12403445f, -0.99227791f},
+{0.11753740f, -0.99306846f}, {0.11103531f, -0.99381646f},
+{0.10452846f, -0.99452190f}, {0.098017140f, -0.99518473f},
+{0.091501619f, -0.99580493f}, {0.084982177f, -0.99638247f},
+{0.078459096f, -0.99691733f}, {0.071932653f, -0.99740949f},
+{0.065403129f, -0.99785892f}, {0.058870804f, -0.99826561f},
+{0.052335956f, -0.99862953f}, {0.045798867f, -0.99895068f},
+{0.039259816f, -0.99922904f}, {0.032719083f, -0.99946459f},
+{0.026176948f, -0.99965732f}, {0.019633692f, -0.99980724f},
+{0.013089596f, -0.99991433f}, {0.0065449380f, -0.99997858f},
+{6.1232340e-17f, -1.0000000f}, {-0.0065449380f, -0.99997858f},
+{-0.013089596f, -0.99991433f}, {-0.019633692f, -0.99980724f},
+{-0.026176948f, -0.99965732f}, {-0.032719083f, -0.99946459f},
+{-0.039259816f, -0.99922904f}, {-0.045798867f, -0.99895068f},
+{-0.052335956f, -0.99862953f}, {-0.058870804f, -0.99826561f},
+{-0.065403129f, -0.99785892f}, {-0.071932653f, -0.99740949f},
+{-0.078459096f, -0.99691733f}, {-0.084982177f, -0.99638247f},
+{-0.091501619f, -0.99580493f}, {-0.098017140f, -0.99518473f},
+{-0.10452846f, -0.99452190f}, {-0.11103531f, -0.99381646f},
+{-0.11753740f, -0.99306846f}, {-0.12403445f, -0.99227791f},
+{-0.13052619f, -0.99144486f}, {-0.13701234f, -0.99056934f},
+{-0.14349262f, -0.98965139f}, {-0.14996676f, -0.98869104f},
+{-0.15643447f, -0.98768834f}, {-0.16289547f, -0.98664333f},
+{-0.16934950f, -0.98555606f}, {-0.17579628f, -0.98442657f},
+{-0.18223553f, -0.98325491f}, {-0.18866696f, -0.98204113f},
+{-0.19509032f, -0.98078528f}, {-0.20150532f, -0.97948742f},
+{-0.20791169f, -0.97814760f}, {-0.21430915f, -0.97676588f},
+{-0.22069744f, -0.97534232f}, {-0.22707626f, -0.97387698f},
+{-0.23344536f, -0.97236992f}, {-0.23980446f, -0.97082121f},
+{-0.24615329f, -0.96923091f}, {-0.25249158f, -0.96759909f},
+{-0.25881905f, -0.96592583f}, {-0.26513543f, -0.96421118f},
+{-0.27144045f, -0.96245524f}, {-0.27773385f, -0.96065806f},
+{-0.28401534f, -0.95881973f}, {-0.29028468f, -0.95694034f},
+{-0.29654157f, -0.95501994f}, {-0.30278577f, -0.95305864f},
+{-0.30901699f, -0.95105652f}, {-0.31523498f, -0.94901365f},
+{-0.32143947f, -0.94693013f}, {-0.32763018f, -0.94480605f},
+{-0.33380686f, -0.94264149f}, {-0.33996924f, -0.94043656f},
+{-0.34611706f, -0.93819134f}, {-0.35225005f, -0.93590593f},
+{-0.35836795f, -0.93358043f}, {-0.36447050f, -0.93121493f},
+{-0.37055744f, -0.92880955f}, {-0.37662850f, -0.92636438f},
+{-0.38268343f, -0.92387953f}, {-0.38872197f, -0.92135511f},
+{-0.39474386f, -0.91879121f}, {-0.40074883f, -0.91618796f},
+{-0.40673664f, -0.91354546f}, {-0.41270703f, -0.91086382f},
+{-0.41865974f, -0.90814317f}, {-0.42459451f, -0.90538362f},
+{-0.43051110f, -0.90258528f}, {-0.43640924f, -0.89974828f},
+{-0.44228869f, -0.89687274f}, {-0.44814919f, -0.89395878f},
+{-0.45399050f, -0.89100652f}, {-0.45981236f, -0.88801610f},
+{-0.46561452f, -0.88498764f}, {-0.47139674f, -0.88192126f},
+{-0.47715876f, -0.87881711f}, {-0.48290034f, -0.87567532f},
+{-0.48862124f, -0.87249601f}, {-0.49432121f, -0.86927932f},
+{-0.50000000f, -0.86602540f}, {-0.50565737f, -0.86273439f},
+{-0.51129309f, -0.85940641f}, {-0.51690690f, -0.85604162f},
+{-0.52249856f, -0.85264016f}, {-0.52806785f, -0.84920218f},
+{-0.53361452f, -0.84572782f}, {-0.53913832f, -0.84221723f},
+{-0.54463904f, -0.83867057f}, {-0.55011642f, -0.83508798f},
+{-0.55557023f, -0.83146961f}, {-0.56100025f, -0.82781563f},
+{-0.56640624f, -0.82412619f}, {-0.57178796f, -0.82040144f},
+{-0.57714519f, -0.81664156f}, {-0.58247770f, -0.81284668f},
+{-0.58778525f, -0.80901699f}, {-0.59306763f, -0.80515265f},
+{-0.59832460f, -0.80125381f}, {-0.60355594f, -0.79732065f},
+{-0.60876143f, -0.79335334f}, {-0.61394084f, -0.78935204f},
+{-0.61909395f, -0.78531693f}, {-0.62422054f, -0.78124818f},
+{-0.62932039f, -0.77714596f}, {-0.63439328f, -0.77301045f},
+{-0.63943900f, -0.76884183f}, {-0.64445733f, -0.76464028f},
+{-0.64944805f, -0.76040597f}, {-0.65441095f, -0.75613908f},
+{-0.65934582f, -0.75183981f}, {-0.66425244f, -0.74750833f},
+{-0.66913061f, -0.74314483f}, {-0.67398011f, -0.73874949f},
+{-0.67880075f, -0.73432251f}, {-0.68359230f, -0.72986407f},
+{-0.68835458f, -0.72537437f}, {-0.69308736f, -0.72085360f},
+{-0.69779046f, -0.71630194f}, {-0.70246367f, -0.71171961f},
+{-0.70710678f, -0.70710678f}, {-0.71171961f, -0.70246367f},
+{-0.71630194f, -0.69779046f}, {-0.72085360f, -0.69308736f},
+{-0.72537437f, -0.68835458f}, {-0.72986407f, -0.68359230f},
+{-0.73432251f, -0.67880075f}, {-0.73874949f, -0.67398011f},
+{-0.74314483f, -0.66913061f}, {-0.74750833f, -0.66425244f},
+{-0.75183981f, -0.65934582f}, {-0.75613908f, -0.65441095f},
+{-0.76040597f, -0.64944805f}, {-0.76464028f, -0.64445733f},
+{-0.76884183f, -0.63943900f}, {-0.77301045f, -0.63439328f},
+{-0.77714596f, -0.62932039f}, {-0.78124818f, -0.62422054f},
+{-0.78531693f, -0.61909395f}, {-0.78935204f, -0.61394084f},
+{-0.79335334f, -0.60876143f}, {-0.79732065f, -0.60355594f},
+{-0.80125381f, -0.59832460f}, {-0.80515265f, -0.59306763f},
+{-0.80901699f, -0.58778525f}, {-0.81284668f, -0.58247770f},
+{-0.81664156f, -0.57714519f}, {-0.82040144f, -0.57178796f},
+{-0.82412619f, -0.56640624f}, {-0.82781563f, -0.56100025f},
+{-0.83146961f, -0.55557023f}, {-0.83508798f, -0.55011642f},
+{-0.83867057f, -0.54463904f}, {-0.84221723f, -0.53913832f},
+{-0.84572782f, -0.53361452f}, {-0.84920218f, -0.52806785f},
+{-0.85264016f, -0.52249856f}, {-0.85604162f, -0.51690690f},
+{-0.85940641f, -0.51129309f}, {-0.86273439f, -0.50565737f},
+{-0.86602540f, -0.50000000f}, {-0.86927932f, -0.49432121f},
+{-0.87249601f, -0.48862124f}, {-0.87567532f, -0.48290034f},
+{-0.87881711f, -0.47715876f}, {-0.88192126f, -0.47139674f},
+{-0.88498764f, -0.46561452f}, {-0.88801610f, -0.45981236f},
+{-0.89100652f, -0.45399050f}, {-0.89395878f, -0.44814919f},
+{-0.89687274f, -0.44228869f}, {-0.89974828f, -0.43640924f},
+{-0.90258528f, -0.43051110f}, {-0.90538362f, -0.42459451f},
+{-0.90814317f, -0.41865974f}, {-0.91086382f, -0.41270703f},
+{-0.91354546f, -0.40673664f}, {-0.91618796f, -0.40074883f},
+{-0.91879121f, -0.39474386f}, {-0.92135511f, -0.38872197f},
+{-0.92387953f, -0.38268343f}, {-0.92636438f, -0.37662850f},
+{-0.92880955f, -0.37055744f}, {-0.93121493f, -0.36447050f},
+{-0.93358043f, -0.35836795f}, {-0.93590593f, -0.35225005f},
+{-0.93819134f, -0.34611706f}, {-0.94043656f, -0.33996924f},
+{-0.94264149f, -0.33380686f}, {-0.94480605f, -0.32763018f},
+{-0.94693013f, -0.32143947f}, {-0.94901365f, -0.31523498f},
+{-0.95105652f, -0.30901699f}, {-0.95305864f, -0.30278577f},
+{-0.95501994f, -0.29654157f}, {-0.95694034f, -0.29028468f},
+{-0.95881973f, -0.28401534f}, {-0.96065806f, -0.27773385f},
+{-0.96245524f, -0.27144045f}, {-0.96421118f, -0.26513543f},
+{-0.96592583f, -0.25881905f}, {-0.96759909f, -0.25249158f},
+{-0.96923091f, -0.24615329f}, {-0.97082121f, -0.23980446f},
+{-0.97236992f, -0.23344536f}, {-0.97387698f, -0.22707626f},
+{-0.97534232f, -0.22069744f}, {-0.97676588f, -0.21430915f},
+{-0.97814760f, -0.20791169f}, {-0.97948742f, -0.20150532f},
+{-0.98078528f, -0.19509032f}, {-0.98204113f, -0.18866696f},
+{-0.98325491f, -0.18223553f}, {-0.98442657f, -0.17579628f},
+{-0.98555606f, -0.16934950f}, {-0.98664333f, -0.16289547f},
+{-0.98768834f, -0.15643447f}, {-0.98869104f, -0.14996676f},
+{-0.98965139f, -0.14349262f}, {-0.99056934f, -0.13701234f},
+{-0.99144486f, -0.13052619f}, {-0.99227791f, -0.12403445f},
+{-0.99306846f, -0.11753740f}, {-0.99381646f, -0.11103531f},
+{-0.99452190f, -0.10452846f}, {-0.99518473f, -0.098017140f},
+{-0.99580493f, -0.091501619f}, {-0.99638247f, -0.084982177f},
+{-0.99691733f, -0.078459096f}, {-0.99740949f, -0.071932653f},
+{-0.99785892f, -0.065403129f}, {-0.99826561f, -0.058870804f},
+{-0.99862953f, -0.052335956f}, {-0.99895068f, -0.045798867f},
+{-0.99922904f, -0.039259816f}, {-0.99946459f, -0.032719083f},
+{-0.99965732f, -0.026176948f}, {-0.99980724f, -0.019633692f},
+{-0.99991433f, -0.013089596f}, {-0.99997858f, -0.0065449380f},
+{-1.0000000f, -1.2246468e-16f}, {-0.99997858f, 0.0065449380f},
+{-0.99991433f, 0.013089596f}, {-0.99980724f, 0.019633692f},
+{-0.99965732f, 0.026176948f}, {-0.99946459f, 0.032719083f},
+{-0.99922904f, 0.039259816f}, {-0.99895068f, 0.045798867f},
+{-0.99862953f, 0.052335956f}, {-0.99826561f, 0.058870804f},
+{-0.99785892f, 0.065403129f}, {-0.99740949f, 0.071932653f},
+{-0.99691733f, 0.078459096f}, {-0.99638247f, 0.084982177f},
+{-0.99580493f, 0.091501619f}, {-0.99518473f, 0.098017140f},
+{-0.99452190f, 0.10452846f}, {-0.99381646f, 0.11103531f},
+{-0.99306846f, 0.11753740f}, {-0.99227791f, 0.12403445f},
+{-0.99144486f, 0.13052619f}, {-0.99056934f, 0.13701234f},
+{-0.98965139f, 0.14349262f}, {-0.98869104f, 0.14996676f},
+{-0.98768834f, 0.15643447f}, {-0.98664333f, 0.16289547f},
+{-0.98555606f, 0.16934950f}, {-0.98442657f, 0.17579628f},
+{-0.98325491f, 0.18223553f}, {-0.98204113f, 0.18866696f},
+{-0.98078528f, 0.19509032f}, {-0.97948742f, 0.20150532f},
+{-0.97814760f, 0.20791169f}, {-0.97676588f, 0.21430915f},
+{-0.97534232f, 0.22069744f}, {-0.97387698f, 0.22707626f},
+{-0.97236992f, 0.23344536f}, {-0.97082121f, 0.23980446f},
+{-0.96923091f, 0.24615329f}, {-0.96759909f, 0.25249158f},
+{-0.96592583f, 0.25881905f}, {-0.96421118f, 0.26513543f},
+{-0.96245524f, 0.27144045f}, {-0.96065806f, 0.27773385f},
+{-0.95881973f, 0.28401534f}, {-0.95694034f, 0.29028468f},
+{-0.95501994f, 0.29654157f}, {-0.95305864f, 0.30278577f},
+{-0.95105652f, 0.30901699f}, {-0.94901365f, 0.31523498f},
+{-0.94693013f, 0.32143947f}, {-0.94480605f, 0.32763018f},
+{-0.94264149f, 0.33380686f}, {-0.94043656f, 0.33996924f},
+{-0.93819134f, 0.34611706f}, {-0.93590593f, 0.35225005f},
+{-0.93358043f, 0.35836795f}, {-0.93121493f, 0.36447050f},
+{-0.92880955f, 0.37055744f}, {-0.92636438f, 0.37662850f},
+{-0.92387953f, 0.38268343f}, {-0.92135511f, 0.38872197f},
+{-0.91879121f, 0.39474386f}, {-0.91618796f, 0.40074883f},
+{-0.91354546f, 0.40673664f}, {-0.91086382f, 0.41270703f},
+{-0.90814317f, 0.41865974f}, {-0.90538362f, 0.42459451f},
+{-0.90258528f, 0.43051110f}, {-0.89974828f, 0.43640924f},
+{-0.89687274f, 0.44228869f}, {-0.89395878f, 0.44814919f},
+{-0.89100652f, 0.45399050f}, {-0.88801610f, 0.45981236f},
+{-0.88498764f, 0.46561452f}, {-0.88192126f, 0.47139674f},
+{-0.87881711f, 0.47715876f}, {-0.87567532f, 0.48290034f},
+{-0.87249601f, 0.48862124f}, {-0.86927932f, 0.49432121f},
+{-0.86602540f, 0.50000000f}, {-0.86273439f, 0.50565737f},
+{-0.85940641f, 0.51129309f}, {-0.85604162f, 0.51690690f},
+{-0.85264016f, 0.52249856f}, {-0.84920218f, 0.52806785f},
+{-0.84572782f, 0.53361452f}, {-0.84221723f, 0.53913832f},
+{-0.83867057f, 0.54463904f}, {-0.83508798f, 0.55011642f},
+{-0.83146961f, 0.55557023f}, {-0.82781563f, 0.56100025f},
+{-0.82412619f, 0.56640624f}, {-0.82040144f, 0.57178796f},
+{-0.81664156f, 0.57714519f}, {-0.81284668f, 0.58247770f},
+{-0.80901699f, 0.58778525f}, {-0.80515265f, 0.59306763f},
+{-0.80125381f, 0.59832460f}, {-0.79732065f, 0.60355594f},
+{-0.79335334f, 0.60876143f}, {-0.78935204f, 0.61394084f},
+{-0.78531693f, 0.61909395f}, {-0.78124818f, 0.62422054f},
+{-0.77714596f, 0.62932039f}, {-0.77301045f, 0.63439328f},
+{-0.76884183f, 0.63943900f}, {-0.76464028f, 0.64445733f},
+{-0.76040597f, 0.64944805f}, {-0.75613908f, 0.65441095f},
+{-0.75183981f, 0.65934582f}, {-0.74750833f, 0.66425244f},
+{-0.74314483f, 0.66913061f}, {-0.73874949f, 0.67398011f},
+{-0.73432251f, 0.67880075f}, {-0.72986407f, 0.68359230f},
+{-0.72537437f, 0.68835458f}, {-0.72085360f, 0.69308736f},
+{-0.71630194f, 0.69779046f}, {-0.71171961f, 0.70246367f},
+{-0.70710678f, 0.70710678f}, {-0.70246367f, 0.71171961f},
+{-0.69779046f, 0.71630194f}, {-0.69308736f, 0.72085360f},
+{-0.68835458f, 0.72537437f}, {-0.68359230f, 0.72986407f},
+{-0.67880075f, 0.73432251f}, {-0.67398011f, 0.73874949f},
+{-0.66913061f, 0.74314483f}, {-0.66425244f, 0.74750833f},
+{-0.65934582f, 0.75183981f}, {-0.65441095f, 0.75613908f},
+{-0.64944805f, 0.76040597f}, {-0.64445733f, 0.76464028f},
+{-0.63943900f, 0.76884183f}, {-0.63439328f, 0.77301045f},
+{-0.62932039f, 0.77714596f}, {-0.62422054f, 0.78124818f},
+{-0.61909395f, 0.78531693f}, {-0.61394084f, 0.78935204f},
+{-0.60876143f, 0.79335334f}, {-0.60355594f, 0.79732065f},
+{-0.59832460f, 0.80125381f}, {-0.59306763f, 0.80515265f},
+{-0.58778525f, 0.80901699f}, {-0.58247770f, 0.81284668f},
+{-0.57714519f, 0.81664156f}, {-0.57178796f, 0.82040144f},
+{-0.56640624f, 0.82412619f}, {-0.56100025f, 0.82781563f},
+{-0.55557023f, 0.83146961f}, {-0.55011642f, 0.83508798f},
+{-0.54463904f, 0.83867057f}, {-0.53913832f, 0.84221723f},
+{-0.53361452f, 0.84572782f}, {-0.52806785f, 0.84920218f},
+{-0.52249856f, 0.85264016f}, {-0.51690690f, 0.85604162f},
+{-0.51129309f, 0.85940641f}, {-0.50565737f, 0.86273439f},
+{-0.50000000f, 0.86602540f}, {-0.49432121f, 0.86927932f},
+{-0.48862124f, 0.87249601f}, {-0.48290034f, 0.87567532f},
+{-0.47715876f, 0.87881711f}, {-0.47139674f, 0.88192126f},
+{-0.46561452f, 0.88498764f}, {-0.45981236f, 0.88801610f},
+{-0.45399050f, 0.89100652f}, {-0.44814919f, 0.89395878f},
+{-0.44228869f, 0.89687274f}, {-0.43640924f, 0.89974828f},
+{-0.43051110f, 0.90258528f}, {-0.42459451f, 0.90538362f},
+{-0.41865974f, 0.90814317f}, {-0.41270703f, 0.91086382f},
+{-0.40673664f, 0.91354546f}, {-0.40074883f, 0.91618796f},
+{-0.39474386f, 0.91879121f}, {-0.38872197f, 0.92135511f},
+{-0.38268343f, 0.92387953f}, {-0.37662850f, 0.92636438f},
+{-0.37055744f, 0.92880955f}, {-0.36447050f, 0.93121493f},
+{-0.35836795f, 0.93358043f}, {-0.35225005f, 0.93590593f},
+{-0.34611706f, 0.93819134f}, {-0.33996924f, 0.94043656f},
+{-0.33380686f, 0.94264149f}, {-0.32763018f, 0.94480605f},
+{-0.32143947f, 0.94693013f}, {-0.31523498f, 0.94901365f},
+{-0.30901699f, 0.95105652f}, {-0.30278577f, 0.95305864f},
+{-0.29654157f, 0.95501994f}, {-0.29028468f, 0.95694034f},
+{-0.28401534f, 0.95881973f}, {-0.27773385f, 0.96065806f},
+{-0.27144045f, 0.96245524f}, {-0.26513543f, 0.96421118f},
+{-0.25881905f, 0.96592583f}, {-0.25249158f, 0.96759909f},
+{-0.24615329f, 0.96923091f}, {-0.23980446f, 0.97082121f},
+{-0.23344536f, 0.97236992f}, {-0.22707626f, 0.97387698f},
+{-0.22069744f, 0.97534232f}, {-0.21430915f, 0.97676588f},
+{-0.20791169f, 0.97814760f}, {-0.20150532f, 0.97948742f},
+{-0.19509032f, 0.98078528f}, {-0.18866696f, 0.98204113f},
+{-0.18223553f, 0.98325491f}, {-0.17579628f, 0.98442657f},
+{-0.16934950f, 0.98555606f}, {-0.16289547f, 0.98664333f},
+{-0.15643447f, 0.98768834f}, {-0.14996676f, 0.98869104f},
+{-0.14349262f, 0.98965139f}, {-0.13701234f, 0.99056934f},
+{-0.13052619f, 0.99144486f}, {-0.12403445f, 0.99227791f},
+{-0.11753740f, 0.99306846f}, {-0.11103531f, 0.99381646f},
+{-0.10452846f, 0.99452190f}, {-0.098017140f, 0.99518473f},
+{-0.091501619f, 0.99580493f}, {-0.084982177f, 0.99638247f},
+{-0.078459096f, 0.99691733f}, {-0.071932653f, 0.99740949f},
+{-0.065403129f, 0.99785892f}, {-0.058870804f, 0.99826561f},
+{-0.052335956f, 0.99862953f}, {-0.045798867f, 0.99895068f},
+{-0.039259816f, 0.99922904f}, {-0.032719083f, 0.99946459f},
+{-0.026176948f, 0.99965732f}, {-0.019633692f, 0.99980724f},
+{-0.013089596f, 0.99991433f}, {-0.0065449380f, 0.99997858f},
+{-1.8369702e-16f, 1.0000000f}, {0.0065449380f, 0.99997858f},
+{0.013089596f, 0.99991433f}, {0.019633692f, 0.99980724f},
+{0.026176948f, 0.99965732f}, {0.032719083f, 0.99946459f},
+{0.039259816f, 0.99922904f}, {0.045798867f, 0.99895068f},
+{0.052335956f, 0.99862953f}, {0.058870804f, 0.99826561f},
+{0.065403129f, 0.99785892f}, {0.071932653f, 0.99740949f},
+{0.078459096f, 0.99691733f}, {0.084982177f, 0.99638247f},
+{0.091501619f, 0.99580493f}, {0.098017140f, 0.99518473f},
+{0.10452846f, 0.99452190f}, {0.11103531f, 0.99381646f},
+{0.11753740f, 0.99306846f}, {0.12403445f, 0.99227791f},
+{0.13052619f, 0.99144486f}, {0.13701234f, 0.99056934f},
+{0.14349262f, 0.98965139f}, {0.14996676f, 0.98869104f},
+{0.15643447f, 0.98768834f}, {0.16289547f, 0.98664333f},
+{0.16934950f, 0.98555606f}, {0.17579628f, 0.98442657f},
+{0.18223553f, 0.98325491f}, {0.18866696f, 0.98204113f},
+{0.19509032f, 0.98078528f}, {0.20150532f, 0.97948742f},
+{0.20791169f, 0.97814760f}, {0.21430915f, 0.97676588f},
+{0.22069744f, 0.97534232f}, {0.22707626f, 0.97387698f},
+{0.23344536f, 0.97236992f}, {0.23980446f, 0.97082121f},
+{0.24615329f, 0.96923091f}, {0.25249158f, 0.96759909f},
+{0.25881905f, 0.96592583f}, {0.26513543f, 0.96421118f},
+{0.27144045f, 0.96245524f}, {0.27773385f, 0.96065806f},
+{0.28401534f, 0.95881973f}, {0.29028468f, 0.95694034f},
+{0.29654157f, 0.95501994f}, {0.30278577f, 0.95305864f},
+{0.30901699f, 0.95105652f}, {0.31523498f, 0.94901365f},
+{0.32143947f, 0.94693013f}, {0.32763018f, 0.94480605f},
+{0.33380686f, 0.94264149f}, {0.33996924f, 0.94043656f},
+{0.34611706f, 0.93819134f}, {0.35225005f, 0.93590593f},
+{0.35836795f, 0.93358043f}, {0.36447050f, 0.93121493f},
+{0.37055744f, 0.92880955f}, {0.37662850f, 0.92636438f},
+{0.38268343f, 0.92387953f}, {0.38872197f, 0.92135511f},
+{0.39474386f, 0.91879121f}, {0.40074883f, 0.91618796f},
+{0.40673664f, 0.91354546f}, {0.41270703f, 0.91086382f},
+{0.41865974f, 0.90814317f}, {0.42459451f, 0.90538362f},
+{0.43051110f, 0.90258528f}, {0.43640924f, 0.89974828f},
+{0.44228869f, 0.89687274f}, {0.44814919f, 0.89395878f},
+{0.45399050f, 0.89100652f}, {0.45981236f, 0.88801610f},
+{0.46561452f, 0.88498764f}, {0.47139674f, 0.88192126f},
+{0.47715876f, 0.87881711f}, {0.48290034f, 0.87567532f},
+{0.48862124f, 0.87249601f}, {0.49432121f, 0.86927932f},
+{0.50000000f, 0.86602540f}, {0.50565737f, 0.86273439f},
+{0.51129309f, 0.85940641f}, {0.51690690f, 0.85604162f},
+{0.52249856f, 0.85264016f}, {0.52806785f, 0.84920218f},
+{0.53361452f, 0.84572782f}, {0.53913832f, 0.84221723f},
+{0.54463904f, 0.83867057f}, {0.55011642f, 0.83508798f},
+{0.55557023f, 0.83146961f}, {0.56100025f, 0.82781563f},
+{0.56640624f, 0.82412619f}, {0.57178796f, 0.82040144f},
+{0.57714519f, 0.81664156f}, {0.58247770f, 0.81284668f},
+{0.58778525f, 0.80901699f}, {0.59306763f, 0.80515265f},
+{0.59832460f, 0.80125381f}, {0.60355594f, 0.79732065f},
+{0.60876143f, 0.79335334f}, {0.61394084f, 0.78935204f},
+{0.61909395f, 0.78531693f}, {0.62422054f, 0.78124818f},
+{0.62932039f, 0.77714596f}, {0.63439328f, 0.77301045f},
+{0.63943900f, 0.76884183f}, {0.64445733f, 0.76464028f},
+{0.64944805f, 0.76040597f}, {0.65441095f, 0.75613908f},
+{0.65934582f, 0.75183981f}, {0.66425244f, 0.74750833f},
+{0.66913061f, 0.74314483f}, {0.67398011f, 0.73874949f},
+{0.67880075f, 0.73432251f}, {0.68359230f, 0.72986407f},
+{0.68835458f, 0.72537437f}, {0.69308736f, 0.72085360f},
+{0.69779046f, 0.71630194f}, {0.70246367f, 0.71171961f},
+{0.70710678f, 0.70710678f}, {0.71171961f, 0.70246367f},
+{0.71630194f, 0.69779046f}, {0.72085360f, 0.69308736f},
+{0.72537437f, 0.68835458f}, {0.72986407f, 0.68359230f},
+{0.73432251f, 0.67880075f}, {0.73874949f, 0.67398011f},
+{0.74314483f, 0.66913061f}, {0.74750833f, 0.66425244f},
+{0.75183981f, 0.65934582f}, {0.75613908f, 0.65441095f},
+{0.76040597f, 0.64944805f}, {0.76464028f, 0.64445733f},
+{0.76884183f, 0.63943900f}, {0.77301045f, 0.63439328f},
+{0.77714596f, 0.62932039f}, {0.78124818f, 0.62422054f},
+{0.78531693f, 0.61909395f}, {0.78935204f, 0.61394084f},
+{0.79335334f, 0.60876143f}, {0.79732065f, 0.60355594f},
+{0.80125381f, 0.59832460f}, {0.80515265f, 0.59306763f},
+{0.80901699f, 0.58778525f}, {0.81284668f, 0.58247770f},
+{0.81664156f, 0.57714519f}, {0.82040144f, 0.57178796f},
+{0.82412619f, 0.56640624f}, {0.82781563f, 0.56100025f},
+{0.83146961f, 0.55557023f}, {0.83508798f, 0.55011642f},
+{0.83867057f, 0.54463904f}, {0.84221723f, 0.53913832f},
+{0.84572782f, 0.53361452f}, {0.84920218f, 0.52806785f},
+{0.85264016f, 0.52249856f}, {0.85604162f, 0.51690690f},
+{0.85940641f, 0.51129309f}, {0.86273439f, 0.50565737f},
+{0.86602540f, 0.50000000f}, {0.86927932f, 0.49432121f},
+{0.87249601f, 0.48862124f}, {0.87567532f, 0.48290034f},
+{0.87881711f, 0.47715876f}, {0.88192126f, 0.47139674f},
+{0.88498764f, 0.46561452f}, {0.88801610f, 0.45981236f},
+{0.89100652f, 0.45399050f}, {0.89395878f, 0.44814919f},
+{0.89687274f, 0.44228869f}, {0.89974828f, 0.43640924f},
+{0.90258528f, 0.43051110f}, {0.90538362f, 0.42459451f},
+{0.90814317f, 0.41865974f}, {0.91086382f, 0.41270703f},
+{0.91354546f, 0.40673664f}, {0.91618796f, 0.40074883f},
+{0.91879121f, 0.39474386f}, {0.92135511f, 0.38872197f},
+{0.92387953f, 0.38268343f}, {0.92636438f, 0.37662850f},
+{0.92880955f, 0.37055744f}, {0.93121493f, 0.36447050f},
+{0.93358043f, 0.35836795f}, {0.93590593f, 0.35225005f},
+{0.93819134f, 0.34611706f}, {0.94043656f, 0.33996924f},
+{0.94264149f, 0.33380686f}, {0.94480605f, 0.32763018f},
+{0.94693013f, 0.32143947f}, {0.94901365f, 0.31523498f},
+{0.95105652f, 0.30901699f}, {0.95305864f, 0.30278577f},
+{0.95501994f, 0.29654157f}, {0.95694034f, 0.29028468f},
+{0.95881973f, 0.28401534f}, {0.96065806f, 0.27773385f},
+{0.96245524f, 0.27144045f}, {0.96421118f, 0.26513543f},
+{0.96592583f, 0.25881905f}, {0.96759909f, 0.25249158f},
+{0.96923091f, 0.24615329f}, {0.97082121f, 0.23980446f},
+{0.97236992f, 0.23344536f}, {0.97387698f, 0.22707626f},
+{0.97534232f, 0.22069744f}, {0.97676588f, 0.21430915f},
+{0.97814760f, 0.20791169f}, {0.97948742f, 0.20150532f},
+{0.98078528f, 0.19509032f}, {0.98204113f, 0.18866696f},
+{0.98325491f, 0.18223553f}, {0.98442657f, 0.17579628f},
+{0.98555606f, 0.16934950f}, {0.98664333f, 0.16289547f},
+{0.98768834f, 0.15643447f}, {0.98869104f, 0.14996676f},
+{0.98965139f, 0.14349262f}, {0.99056934f, 0.13701234f},
+{0.99144486f, 0.13052619f}, {0.99227791f, 0.12403445f},
+{0.99306846f, 0.11753740f}, {0.99381646f, 0.11103531f},
+{0.99452190f, 0.10452846f}, {0.99518473f, 0.098017140f},
+{0.99580493f, 0.091501619f}, {0.99638247f, 0.084982177f},
+{0.99691733f, 0.078459096f}, {0.99740949f, 0.071932653f},
+{0.99785892f, 0.065403129f}, {0.99826561f, 0.058870804f},
+{0.99862953f, 0.052335956f}, {0.99895068f, 0.045798867f},
+{0.99922904f, 0.039259816f}, {0.99946459f, 0.032719083f},
+{0.99965732f, 0.026176948f}, {0.99980724f, 0.019633692f},
+{0.99991433f, 0.013089596f}, {0.99997858f, 0.0065449380f},
+};
+#ifndef FFT_BITREV960
+#define FFT_BITREV960
+static const opus_int16 fft_bitrev960[960] = {
+0, 192, 384, 576, 768, 64, 256, 448, 640, 832, 128, 320, 512, 704, 896,
+16, 208, 400, 592, 784, 80, 272, 464, 656, 848, 144, 336, 528, 720, 912,
+32, 224, 416, 608, 800, 96, 288, 480, 672, 864, 160, 352, 544, 736, 928,
+48, 240, 432, 624, 816, 112, 304, 496, 688, 880, 176, 368, 560, 752, 944,
+4, 196, 388, 580, 772, 68, 260, 452, 644, 836, 132, 324, 516, 708, 900,
+20, 212, 404, 596, 788, 84, 276, 468, 660, 852, 148, 340, 532, 724, 916,
+36, 228, 420, 612, 804, 100, 292, 484, 676, 868, 164, 356, 548, 740, 932,
+52, 244, 436, 628, 820, 116, 308, 500, 692, 884, 180, 372, 564, 756, 948,
+8, 200, 392, 584, 776, 72, 264, 456, 648, 840, 136, 328, 520, 712, 904,
+24, 216, 408, 600, 792, 88, 280, 472, 664, 856, 152, 344, 536, 728, 920,
+40, 232, 424, 616, 808, 104, 296, 488, 680, 872, 168, 360, 552, 744, 936,
+56, 248, 440, 632, 824, 120, 312, 504, 696, 888, 184, 376, 568, 760, 952,
+12, 204, 396, 588, 780, 76, 268, 460, 652, 844, 140, 332, 524, 716, 908,
+28, 220, 412, 604, 796, 92, 284, 476, 668, 860, 156, 348, 540, 732, 924,
+44, 236, 428, 620, 812, 108, 300, 492, 684, 876, 172, 364, 556, 748, 940,
+60, 252, 444, 636, 828, 124, 316, 508, 700, 892, 188, 380, 572, 764, 956,
+1, 193, 385, 577, 769, 65, 257, 449, 641, 833, 129, 321, 513, 705, 897,
+17, 209, 401, 593, 785, 81, 273, 465, 657, 849, 145, 337, 529, 721, 913,
+33, 225, 417, 609, 801, 97, 289, 481, 673, 865, 161, 353, 545, 737, 929,
+49, 241, 433, 625, 817, 113, 305, 497, 689, 881, 177, 369, 561, 753, 945,
+5, 197, 389, 581, 773, 69, 261, 453, 645, 837, 133, 325, 517, 709, 901,
+21, 213, 405, 597, 789, 85, 277, 469, 661, 853, 149, 341, 533, 725, 917,
+37, 229, 421, 613, 805, 101, 293, 485, 677, 869, 165, 357, 549, 741, 933,
+53, 245, 437, 629, 821, 117, 309, 501, 693, 885, 181, 373, 565, 757, 949,
+9, 201, 393, 585, 777, 73, 265, 457, 649, 841, 137, 329, 521, 713, 905,
+25, 217, 409, 601, 793, 89, 281, 473, 665, 857, 153, 345, 537, 729, 921,
+41, 233, 425, 617, 809, 105, 297, 489, 681, 873, 169, 361, 553, 745, 937,
+57, 249, 441, 633, 825, 121, 313, 505, 697, 889, 185, 377, 569, 761, 953,
+13, 205, 397, 589, 781, 77, 269, 461, 653, 845, 141, 333, 525, 717, 909,
+29, 221, 413, 605, 797, 93, 285, 477, 669, 861, 157, 349, 541, 733, 925,
+45, 237, 429, 621, 813, 109, 301, 493, 685, 877, 173, 365, 557, 749, 941,
+61, 253, 445, 637, 829, 125, 317, 509, 701, 893, 189, 381, 573, 765, 957,
+2, 194, 386, 578, 770, 66, 258, 450, 642, 834, 130, 322, 514, 706, 898,
+18, 210, 402, 594, 786, 82, 274, 466, 658, 850, 146, 338, 530, 722, 914,
+34, 226, 418, 610, 802, 98, 290, 482, 674, 866, 162, 354, 546, 738, 930,
+50, 242, 434, 626, 818, 114, 306, 498, 690, 882, 178, 370, 562, 754, 946,
+6, 198, 390, 582, 774, 70, 262, 454, 646, 838, 134, 326, 518, 710, 902,
+22, 214, 406, 598, 790, 86, 278, 470, 662, 854, 150, 342, 534, 726, 918,
+38, 230, 422, 614, 806, 102, 294, 486, 678, 870, 166, 358, 550, 742, 934,
+54, 246, 438, 630, 822, 118, 310, 502, 694, 886, 182, 374, 566, 758, 950,
+10, 202, 394, 586, 778, 74, 266, 458, 650, 842, 138, 330, 522, 714, 906,
+26, 218, 410, 602, 794, 90, 282, 474, 666, 858, 154, 346, 538, 730, 922,
+42, 234, 426, 618, 810, 106, 298, 490, 682, 874, 170, 362, 554, 746, 938,
+58, 250, 442, 634, 826, 122, 314, 506, 698, 890, 186, 378, 570, 762, 954,
+14, 206, 398, 590, 782, 78, 270, 462, 654, 846, 142, 334, 526, 718, 910,
+30, 222, 414, 606, 798, 94, 286, 478, 670, 862, 158, 350, 542, 734, 926,
+46, 238, 430, 622, 814, 110, 302, 494, 686, 878, 174, 366, 558, 750, 942,
+62, 254, 446, 638, 830, 126, 318, 510, 702, 894, 190, 382, 574, 766, 958,
+3, 195, 387, 579, 771, 67, 259, 451, 643, 835, 131, 323, 515, 707, 899,
+19, 211, 403, 595, 787, 83, 275, 467, 659, 851, 147, 339, 531, 723, 915,
+35, 227, 419, 611, 803, 99, 291, 483, 675, 867, 163, 355, 547, 739, 931,
+51, 243, 435, 627, 819, 115, 307, 499, 691, 883, 179, 371, 563, 755, 947,
+7, 199, 391, 583, 775, 71, 263, 455, 647, 839, 135, 327, 519, 711, 903,
+23, 215, 407, 599, 791, 87, 279, 471, 663, 855, 151, 343, 535, 727, 919,
+39, 231, 423, 615, 807, 103, 295, 487, 679, 871, 167, 359, 551, 743, 935,
+55, 247, 439, 631, 823, 119, 311, 503, 695, 887, 183, 375, 567, 759, 951,
+11, 203, 395, 587, 779, 75, 267, 459, 651, 843, 139, 331, 523, 715, 907,
+27, 219, 411, 603, 795, 91, 283, 475, 667, 859, 155, 347, 539, 731, 923,
+43, 235, 427, 619, 811, 107, 299, 491, 683, 875, 171, 363, 555, 747, 939,
+59, 251, 443, 635, 827, 123, 315, 507, 699, 891, 187, 379, 571, 763, 955,
+15, 207, 399, 591, 783, 79, 271, 463, 655, 847, 143, 335, 527, 719, 911,
+31, 223, 415, 607, 799, 95, 287, 479, 671, 863, 159, 351, 543, 735, 927,
+47, 239, 431, 623, 815, 111, 303, 495, 687, 879, 175, 367, 559, 751, 943,
+63, 255, 447, 639, 831, 127, 319, 511, 703, 895, 191, 383, 575, 767, 959,
};
+#endif
+
+#ifndef FFT_BITREV480
+#define FFT_BITREV480
+static const opus_int16 fft_bitrev480[480] = {
+0, 96, 192, 288, 384, 32, 128, 224, 320, 416, 64, 160, 256, 352, 448,
+8, 104, 200, 296, 392, 40, 136, 232, 328, 424, 72, 168, 264, 360, 456,
+16, 112, 208, 304, 400, 48, 144, 240, 336, 432, 80, 176, 272, 368, 464,
+24, 120, 216, 312, 408, 56, 152, 248, 344, 440, 88, 184, 280, 376, 472,
+4, 100, 196, 292, 388, 36, 132, 228, 324, 420, 68, 164, 260, 356, 452,
+12, 108, 204, 300, 396, 44, 140, 236, 332, 428, 76, 172, 268, 364, 460,
+20, 116, 212, 308, 404, 52, 148, 244, 340, 436, 84, 180, 276, 372, 468,
+28, 124, 220, 316, 412, 60, 156, 252, 348, 444, 92, 188, 284, 380, 476,
+1, 97, 193, 289, 385, 33, 129, 225, 321, 417, 65, 161, 257, 353, 449,
+9, 105, 201, 297, 393, 41, 137, 233, 329, 425, 73, 169, 265, 361, 457,
+17, 113, 209, 305, 401, 49, 145, 241, 337, 433, 81, 177, 273, 369, 465,
+25, 121, 217, 313, 409, 57, 153, 249, 345, 441, 89, 185, 281, 377, 473,
+5, 101, 197, 293, 389, 37, 133, 229, 325, 421, 69, 165, 261, 357, 453,
+13, 109, 205, 301, 397, 45, 141, 237, 333, 429, 77, 173, 269, 365, 461,
+21, 117, 213, 309, 405, 53, 149, 245, 341, 437, 85, 181, 277, 373, 469,
+29, 125, 221, 317, 413, 61, 157, 253, 349, 445, 93, 189, 285, 381, 477,
+2, 98, 194, 290, 386, 34, 130, 226, 322, 418, 66, 162, 258, 354, 450,
+10, 106, 202, 298, 394, 42, 138, 234, 330, 426, 74, 170, 266, 362, 458,
+18, 114, 210, 306, 402, 50, 146, 242, 338, 434, 82, 178, 274, 370, 466,
+26, 122, 218, 314, 410, 58, 154, 250, 346, 442, 90, 186, 282, 378, 474,
+6, 102, 198, 294, 390, 38, 134, 230, 326, 422, 70, 166, 262, 358, 454,
+14, 110, 206, 302, 398, 46, 142, 238, 334, 430, 78, 174, 270, 366, 462,
+22, 118, 214, 310, 406, 54, 150, 246, 342, 438, 86, 182, 278, 374, 470,
+30, 126, 222, 318, 414, 62, 158, 254, 350, 446, 94, 190, 286, 382, 478,
+3, 99, 195, 291, 387, 35, 131, 227, 323, 419, 67, 163, 259, 355, 451,
+11, 107, 203, 299, 395, 43, 139, 235, 331, 427, 75, 171, 267, 363, 459,
+19, 115, 211, 307, 403, 51, 147, 243, 339, 435, 83, 179, 275, 371, 467,
+27, 123, 219, 315, 411, 59, 155, 251, 347, 443, 91, 187, 283, 379, 475,
+7, 103, 199, 295, 391, 39, 135, 231, 327, 423, 71, 167, 263, 359, 455,
+15, 111, 207, 303, 399, 47, 143, 239, 335, 431, 79, 175, 271, 367, 463,
+23, 119, 215, 311, 407, 55, 151, 247, 343, 439, 87, 183, 279, 375, 471,
+31, 127, 223, 319, 415, 63, 159, 255, 351, 447, 95, 191, 287, 383, 479,
+};
+#endif
+
+#ifndef FFT_BITREV240
+#define FFT_BITREV240
+static const opus_int16 fft_bitrev240[240] = {
+0, 48, 96, 144, 192, 16, 64, 112, 160, 208, 32, 80, 128, 176, 224,
+4, 52, 100, 148, 196, 20, 68, 116, 164, 212, 36, 84, 132, 180, 228,
+8, 56, 104, 152, 200, 24, 72, 120, 168, 216, 40, 88, 136, 184, 232,
+12, 60, 108, 156, 204, 28, 76, 124, 172, 220, 44, 92, 140, 188, 236,
+1, 49, 97, 145, 193, 17, 65, 113, 161, 209, 33, 81, 129, 177, 225,
+5, 53, 101, 149, 197, 21, 69, 117, 165, 213, 37, 85, 133, 181, 229,
+9, 57, 105, 153, 201, 25, 73, 121, 169, 217, 41, 89, 137, 185, 233,
+13, 61, 109, 157, 205, 29, 77, 125, 173, 221, 45, 93, 141, 189, 237,
+2, 50, 98, 146, 194, 18, 66, 114, 162, 210, 34, 82, 130, 178, 226,
+6, 54, 102, 150, 198, 22, 70, 118, 166, 214, 38, 86, 134, 182, 230,
+10, 58, 106, 154, 202, 26, 74, 122, 170, 218, 42, 90, 138, 186, 234,
+14, 62, 110, 158, 206, 30, 78, 126, 174, 222, 46, 94, 142, 190, 238,
+3, 51, 99, 147, 195, 19, 67, 115, 163, 211, 35, 83, 131, 179, 227,
+7, 55, 103, 151, 199, 23, 71, 119, 167, 215, 39, 87, 135, 183, 231,
+11, 59, 107, 155, 203, 27, 75, 123, 171, 219, 43, 91, 139, 187, 235,
+15, 63, 111, 159, 207, 31, 79, 127, 175, 223, 47, 95, 143, 191, 239,
+};
+#endif
+
+#ifndef FFT_BITREV120
+#define FFT_BITREV120
+static const opus_int16 fft_bitrev120[120] = {
+0, 24, 48, 72, 96, 8, 32, 56, 80, 104, 16, 40, 64, 88, 112,
+4, 28, 52, 76, 100, 12, 36, 60, 84, 108, 20, 44, 68, 92, 116,
+1, 25, 49, 73, 97, 9, 33, 57, 81, 105, 17, 41, 65, 89, 113,
+5, 29, 53, 77, 101, 13, 37, 61, 85, 109, 21, 45, 69, 93, 117,
+2, 26, 50, 74, 98, 10, 34, 58, 82, 106, 18, 42, 66, 90, 114,
+6, 30, 54, 78, 102, 14, 38, 62, 86, 110, 22, 46, 70, 94, 118,
+3, 27, 51, 75, 99, 11, 35, 59, 83, 107, 19, 43, 67, 91, 115,
+7, 31, 55, 79, 103, 15, 39, 63, 87, 111, 23, 47, 71, 95, 119,
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_0
+#define FFT_STATE96000_1920_0
+static const kiss_fft_state fft_state96000_1920_0 = {
+960, /* nfft */
+0.0010416667f, /* scale */
+-1, /* shift */
+{5, 192, 3, 64, 4, 16, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev960, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_960,
+#else
+NULL,
+#endif
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_1
+#define FFT_STATE96000_1920_1
+static const kiss_fft_state fft_state96000_1920_1 = {
+480, /* nfft */
+0.0020833334f, /* scale */
+1, /* shift */
+{5, 96, 3, 32, 4, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev480, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_480,
+#else
+NULL,
+#endif
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_2
+#define FFT_STATE96000_1920_2
+static const kiss_fft_state fft_state96000_1920_2 = {
+240, /* nfft */
+0.0041666669f, /* scale */
+2, /* shift */
+{5, 48, 3, 16, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev240, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_240,
+#else
+NULL,
+#endif
+};
+#endif
+
+#ifndef FFT_STATE96000_1920_3
+#define FFT_STATE96000_1920_3
+static const kiss_fft_state fft_state96000_1920_3 = {
+120, /* nfft */
+0.0083333338f, /* scale */
+3, /* shift */
+{5, 24, 3, 8, 2, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* factors */
+fft_bitrev120, /* bitrev */
+fft_twiddles96000_1920, /* bitrev */
+#ifdef OVERRIDE_FFT
+(arch_fft_state *)&cfg_arch_120,
+#else
+NULL,
+#endif
+};
+#endif
+
+#endif
+
+#ifndef MDCT_TWIDDLES1920
+#define MDCT_TWIDDLES1920
+static const celt_coef mdct_twiddles1920[3600] = {
+0.99999998f, 0.99999831f, 0.99999396f, 0.99998693f, 0.99997722f,
+0.99996484f, 0.99994978f, 0.99993204f, 0.99991163f, 0.99988854f,
+0.99986277f, 0.99983433f, 0.99980320f, 0.99976941f, 0.99973293f,
+0.99969378f, 0.99965195f, 0.99960745f, 0.99956026f, 0.99951041f,
+0.99945787f, 0.99940267f, 0.99934478f, 0.99928422f, 0.99922099f,
+0.99915507f, 0.99908649f, 0.99901523f, 0.99894129f, 0.99886468f,
+0.99878540f, 0.99870344f, 0.99861881f, 0.99853150f, 0.99844153f,
+0.99834887f, 0.99825355f, 0.99815555f, 0.99805488f, 0.99795154f,
+0.99784553f, 0.99773684f, 0.99762548f, 0.99751146f, 0.99739476f,
+0.99727539f, 0.99715335f, 0.99702864f, 0.99690127f, 0.99677122f,
+0.99663850f, 0.99650312f, 0.99636507f, 0.99622435f, 0.99608096f,
+0.99593491f, 0.99578619f, 0.99563481f, 0.99548076f, 0.99532404f,
+0.99516466f, 0.99500261f, 0.99483790f, 0.99467053f, 0.99450050f,
+0.99432780f, 0.99415244f, 0.99397441f, 0.99379373f, 0.99361039f,
+0.99342438f, 0.99323572f, 0.99304440f, 0.99285041f, 0.99265377f,
+0.99245448f, 0.99225252f, 0.99204791f, 0.99184064f, 0.99163072f,
+0.99141814f, 0.99120291f, 0.99098503f, 0.99076449f, 0.99054130f,
+0.99031545f, 0.99008696f, 0.98985581f, 0.98962202f, 0.98938557f,
+0.98914648f, 0.98890474f, 0.98866035f, 0.98841331f, 0.98816363f,
+0.98791130f, 0.98765632f, 0.98739871f, 0.98713845f, 0.98687554f,
+0.98660999f, 0.98634181f, 0.98607098f, 0.98579751f, 0.98552140f,
+0.98524265f, 0.98496127f, 0.98467725f, 0.98439059f, 0.98410130f,
+0.98380937f, 0.98351481f, 0.98321761f, 0.98291779f, 0.98261533f,
+0.98231024f, 0.98200252f, 0.98169217f, 0.98137919f, 0.98106359f,
+0.98074536f, 0.98042450f, 0.98010102f, 0.97977491f, 0.97944619f,
+0.97911483f, 0.97878086f, 0.97844427f, 0.97810506f, 0.97776322f,
+0.97741878f, 0.97707171f, 0.97672203f, 0.97636973f, 0.97601482f,
+0.97565730f, 0.97529716f, 0.97493441f, 0.97456906f, 0.97420109f,
+0.97383051f, 0.97345733f, 0.97308154f, 0.97270315f, 0.97232215f,
+0.97193855f, 0.97155235f, 0.97116355f, 0.97077214f, 0.97037814f,
+0.96998154f, 0.96958234f, 0.96918054f, 0.96877615f, 0.96836917f,
+0.96795960f, 0.96754743f, 0.96713267f, 0.96671533f, 0.96629539f,
+0.96587287f, 0.96544776f, 0.96502007f, 0.96458979f, 0.96415693f,
+0.96372149f, 0.96328347f, 0.96284288f, 0.96239970f, 0.96195394f,
+0.96150562f, 0.96105471f, 0.96060124f, 0.96014519f, 0.95968657f,
+0.95922538f, 0.95876162f, 0.95829530f, 0.95782641f, 0.95735496f,
+0.95688094f, 0.95640437f, 0.95592523f, 0.95544353f, 0.95495927f,
+0.95447246f, 0.95398309f, 0.95349117f, 0.95299669f, 0.95249967f,
+0.95200009f, 0.95149797f, 0.95099329f, 0.95048607f, 0.94997631f,
+0.94946400f, 0.94894915f, 0.94843176f, 0.94791184f, 0.94738937f,
+0.94686437f, 0.94633683f, 0.94580676f, 0.94527415f, 0.94473902f,
+0.94420135f, 0.94366116f, 0.94311844f, 0.94257320f, 0.94202543f,
+0.94147514f, 0.94092233f, 0.94036700f, 0.93980916f, 0.93924879f,
+0.93868592f, 0.93812052f, 0.93755262f, 0.93698221f, 0.93640929f,
+0.93583386f, 0.93525593f, 0.93467549f, 0.93409255f, 0.93350711f,
+0.93291917f, 0.93232873f, 0.93173580f, 0.93114037f, 0.93054245f,
+0.92994204f, 0.92933913f, 0.92873374f, 0.92812587f, 0.92751550f,
+0.92690266f, 0.92628733f, 0.92566953f, 0.92504924f, 0.92442648f,
+0.92380124f, 0.92317353f, 0.92254335f, 0.92191070f, 0.92127558f,
+0.92063799f, 0.91999794f, 0.91935543f, 0.91871045f, 0.91806302f,
+0.91741313f, 0.91676078f, 0.91610597f, 0.91544872f, 0.91478901f,
+0.91412685f, 0.91346225f, 0.91279520f, 0.91212571f, 0.91145377f,
+0.91077939f, 0.91010258f, 0.90942333f, 0.90874164f, 0.90805753f,
+0.90737098f, 0.90668200f, 0.90599059f, 0.90529676f, 0.90460050f,
+0.90390183f, 0.90320073f, 0.90249721f, 0.90179128f, 0.90108293f,
+0.90037218f, 0.89965901f, 0.89894343f, 0.89822544f, 0.89750505f,
+0.89678226f, 0.89605707f, 0.89532948f, 0.89459949f, 0.89386710f,
+0.89313232f, 0.89239515f, 0.89165560f, 0.89091365f, 0.89016932f,
+0.88942261f, 0.88867351f, 0.88792204f, 0.88716818f, 0.88641196f,
+0.88565336f, 0.88489239f, 0.88412905f, 0.88336334f, 0.88259527f,
+0.88182483f, 0.88105203f, 0.88027688f, 0.87949937f, 0.87871950f,
+0.87793728f, 0.87715271f, 0.87636579f, 0.87557653f, 0.87478492f,
+0.87399097f, 0.87319468f, 0.87239605f, 0.87159509f, 0.87079179f,
+0.86998616f, 0.86917820f, 0.86836792f, 0.86755531f, 0.86674037f,
+0.86592312f, 0.86510355f, 0.86428166f, 0.86345746f, 0.86263095f,
+0.86180212f, 0.86097099f, 0.86013756f, 0.85930182f, 0.85846378f,
+0.85762344f, 0.85678081f, 0.85593588f, 0.85508866f, 0.85423915f,
+0.85338736f, 0.85253328f, 0.85167692f, 0.85081827f, 0.84995735f,
+0.84909416f, 0.84822869f, 0.84736095f, 0.84649094f, 0.84561866f,
+0.84474412f, 0.84386732f, 0.84298826f, 0.84210695f, 0.84122337f,
+0.84033755f, 0.83944948f, 0.83855915f, 0.83766659f, 0.83677178f,
+0.83587473f, 0.83497544f, 0.83407392f, 0.83317016f, 0.83226418f,
+0.83135596f, 0.83044552f, 0.82953286f, 0.82861797f, 0.82770087f,
+0.82678155f, 0.82586002f, 0.82493628f, 0.82401032f, 0.82308217f,
+0.82215180f, 0.82121924f, 0.82028448f, 0.81934752f, 0.81840837f,
+0.81746703f, 0.81652349f, 0.81557778f, 0.81462988f, 0.81367979f,
+0.81272753f, 0.81177310f, 0.81081649f, 0.80985771f, 0.80889676f,
+0.80793364f, 0.80696837f, 0.80600093f, 0.80503133f, 0.80405958f,
+0.80308568f, 0.80210962f, 0.80113142f, 0.80015107f, 0.79916858f,
+0.79818396f, 0.79719719f, 0.79620829f, 0.79521726f, 0.79422410f,
+0.79322881f, 0.79223140f, 0.79123187f, 0.79023022f, 0.78922646f,
+0.78822058f, 0.78721259f, 0.78620249f, 0.78519029f, 0.78417599f,
+0.78315958f, 0.78214108f, 0.78112049f, 0.78009781f, 0.77907303f,
+0.77804617f, 0.77701723f, 0.77598621f, 0.77495311f, 0.77391793f,
+0.77288068f, 0.77184137f, 0.77079998f, 0.76975654f, 0.76871103f,
+0.76766347f, 0.76661384f, 0.76556217f, 0.76450845f, 0.76345268f,
+0.76239487f, 0.76133501f, 0.76027312f, 0.75920919f, 0.75814323f,
+0.75707524f, 0.75600522f, 0.75493318f, 0.75385911f, 0.75278303f,
+0.75170494f, 0.75062483f, 0.74954271f, 0.74845858f, 0.74737245f,
+0.74628432f, 0.74519419f, 0.74410207f, 0.74300795f, 0.74191185f,
+0.74081376f, 0.73971368f, 0.73861163f, 0.73750759f, 0.73640158f,
+0.73529361f, 0.73418366f, 0.73307175f, 0.73195787f, 0.73084203f,
+0.72972424f, 0.72860450f, 0.72748280f, 0.72635916f, 0.72523357f,
+0.72410604f, 0.72297657f, 0.72184516f, 0.72071182f, 0.71957656f,
+0.71843936f, 0.71730025f, 0.71615921f, 0.71501625f, 0.71387138f,
+0.71272460f, 0.71157592f, 0.71042532f, 0.70927283f, 0.70811843f,
+0.70696214f, 0.70580396f, 0.70464389f, 0.70348193f, 0.70231808f,
+0.70115236f, 0.69998476f, 0.69881528f, 0.69764394f, 0.69647073f,
+0.69529565f, 0.69411871f, 0.69293991f, 0.69175926f, 0.69057675f,
+0.68939240f, 0.68820620f, 0.68701816f, 0.68582828f, 0.68463656f,
+0.68344301f, 0.68224763f, 0.68105042f, 0.67985139f, 0.67865054f,
+0.67744787f, 0.67624339f, 0.67503710f, 0.67382900f, 0.67261910f,
+0.67140739f, 0.67019389f, 0.66897860f, 0.66776151f, 0.66654264f,
+0.66532198f, 0.66409954f, 0.66287532f, 0.66164932f, 0.66042156f,
+0.65919203f, 0.65796073f, 0.65672767f, 0.65549285f, 0.65425628f,
+0.65301796f, 0.65177788f, 0.65053607f, 0.64929251f, 0.64804721f,
+0.64680018f, 0.64555141f, 0.64430092f, 0.64304871f, 0.64179477f,
+0.64053911f, 0.63928174f, 0.63802265f, 0.63676186f, 0.63549936f,
+0.63423517f, 0.63296927f, 0.63170168f, 0.63043240f, 0.62916143f,
+0.62788877f, 0.62661444f, 0.62533842f, 0.62406074f, 0.62278138f,
+0.62150035f, 0.62021766f, 0.61893331f, 0.61764731f, 0.61635965f,
+0.61507034f, 0.61377938f, 0.61248678f, 0.61119254f, 0.60989666f,
+0.60859915f, 0.60730001f, 0.60599925f, 0.60469686f, 0.60339285f,
+0.60208723f, 0.60078000f, 0.59947115f, 0.59816071f, 0.59684866f,
+0.59553501f, 0.59421977f, 0.59290294f, 0.59158452f, 0.59026452f,
+0.58894293f, 0.58761977f, 0.58629504f, 0.58496873f, 0.58364086f,
+0.58231143f, 0.58098044f, 0.57964789f, 0.57831380f, 0.57697815f,
+0.57564096f, 0.57430223f, 0.57296196f, 0.57162015f, 0.57027682f,
+0.56893195f, 0.56758557f, 0.56623767f, 0.56488825f, 0.56353731f,
+0.56218487f, 0.56083093f, 0.55947548f, 0.55811853f, 0.55676009f,
+0.55540016f, 0.55403874f, 0.55267584f, 0.55131146f, 0.54994560f,
+0.54857827f, 0.54720948f, 0.54583921f, 0.54446749f, 0.54309431f,
+0.54171967f, 0.54034359f, 0.53896605f, 0.53758708f, 0.53620666f,
+0.53482481f, 0.53344153f, 0.53205682f, 0.53067068f, 0.52928312f,
+0.52789415f, 0.52650377f, 0.52511197f, 0.52371877f, 0.52232416f,
+0.52092816f, 0.51953076f, 0.51813197f, 0.51673180f, 0.51533024f,
+0.51392730f, 0.51252299f, 0.51111730f, 0.50971025f, 0.50830183f,
+0.50689204f, 0.50548091f, 0.50406842f, 0.50265458f, 0.50123939f,
+0.49982286f, 0.49840499f, 0.49698579f, 0.49556526f, 0.49414340f,
+0.49272022f, 0.49129572f, 0.48986991f, 0.48844278f, 0.48701434f,
+0.48558461f, 0.48415357f, 0.48272123f, 0.48128760f, 0.47985269f,
+0.47841649f, 0.47697901f, 0.47554025f, 0.47410021f, 0.47265891f,
+0.47121635f, 0.46977252f, 0.46832743f, 0.46688109f, 0.46543350f,
+0.46398467f, 0.46253459f, 0.46108327f, 0.45963072f, 0.45817694f,
+0.45672193f, 0.45526570f, 0.45380825f, 0.45234959f, 0.45088971f,
+0.44942863f, 0.44796634f, 0.44650286f, 0.44503818f, 0.44357230f,
+0.44210524f, 0.44063700f, 0.43916758f, 0.43769698f, 0.43622521f,
+0.43475227f, 0.43327816f, 0.43180290f, 0.43032648f, 0.42884891f,
+0.42737019f, 0.42589033f, 0.42440932f, 0.42292718f, 0.42144391f,
+0.41995951f, 0.41847399f, 0.41698734f, 0.41549958f, 0.41401070f,
+0.41252072f, 0.41102963f, 0.40953745f, 0.40804416f, 0.40654979f,
+0.40505432f, 0.40355777f, 0.40206014f, 0.40056144f, 0.39906166f,
+0.39756081f, 0.39605890f, 0.39455593f, 0.39305190f, 0.39154682f,
+0.39004069f, 0.38853352f, 0.38702530f, 0.38551605f, 0.38400577f,
+0.38249446f, 0.38098213f, 0.37946878f, 0.37795441f, 0.37643902f,
+0.37492263f, 0.37340524f, 0.37188685f, 0.37036746f, 0.36884708f,
+0.36732571f, 0.36580336f, 0.36428003f, 0.36275572f, 0.36123045f,
+0.35970420f, 0.35817700f, 0.35664883f, 0.35511971f, 0.35358964f,
+0.35205862f, 0.35052666f, 0.34899376f, 0.34745992f, 0.34592516f,
+0.34438947f, 0.34285286f, 0.34131533f, 0.33977688f, 0.33823753f,
+0.33669727f, 0.33515611f, 0.33361405f, 0.33207110f, 0.33052726f,
+0.32898254f, 0.32743693f, 0.32589045f, 0.32434309f, 0.32279487f,
+0.32124578f, 0.31969583f, 0.31814503f, 0.31659338f, 0.31504087f,
+0.31348753f, 0.31193334f, 0.31037832f, 0.30882247f, 0.30726579f,
+0.30570829f, 0.30414997f, 0.30259083f, 0.30103089f, 0.29947014f,
+0.29790859f, 0.29634624f, 0.29478309f, 0.29321916f, 0.29165445f,
+0.29008895f, 0.28852267f, 0.28695563f, 0.28538781f, 0.28381923f,
+0.28224989f, 0.28067980f, 0.27910895f, 0.27753736f, 0.27596502f,
+0.27439194f, 0.27281813f, 0.27124359f, 0.26966833f, 0.26809234f,
+0.26651563f, 0.26493821f, 0.26336008f, 0.26178125f, 0.26020171f,
+0.25862148f, 0.25704055f, 0.25545894f, 0.25387664f, 0.25229367f,
+0.25071002f, 0.24912569f, 0.24754070f, 0.24595505f, 0.24436874f,
+0.24278177f, 0.24119416f, 0.23960590f, 0.23801699f, 0.23642745f,
+0.23483728f, 0.23324648f, 0.23165505f, 0.23006301f, 0.22847034f,
+0.22687707f, 0.22528319f, 0.22368870f, 0.22209362f, 0.22049794f,
+0.21890167f, 0.21730482f, 0.21570738f, 0.21410937f, 0.21251078f,
+0.21091163f, 0.20931191f, 0.20771163f, 0.20611079f, 0.20450940f,
+0.20290746f, 0.20130498f, 0.19970196f, 0.19809841f, 0.19649433f,
+0.19488972f, 0.19328459f, 0.19167894f, 0.19007277f, 0.18846610f,
+0.18685893f, 0.18525125f, 0.18364308f, 0.18203442f, 0.18042526f,
+0.17881563f, 0.17720552f, 0.17559493f, 0.17398387f, 0.17237235f,
+0.17076037f, 0.16914792f, 0.16753503f, 0.16592169f, 0.16430790f,
+0.16269367f, 0.16107901f, 0.15946391f, 0.15784839f, 0.15623245f,
+0.15461609f, 0.15299931f, 0.15138213f, 0.14976453f, 0.14814654f,
+0.14652815f, 0.14490937f, 0.14329020f, 0.14167065f, 0.14005072f,
+0.13843041f, 0.13680974f, 0.13518869f, 0.13356729f, 0.13194552f,
+0.13032341f, 0.12870094f, 0.12707813f, 0.12545498f, 0.12383150f,
+0.12220768f, 0.12058354f, 0.11895907f, 0.11733428f, 0.11570918f,
+0.11408377f, 0.11245806f, 0.11083204f, 0.10920573f, 0.10757912f,
+0.10595223f, 0.10432505f, 0.10269759f, 0.10106986f, 0.099441861f,
+0.097813592f, 0.096185062f, 0.094556275f, 0.092927234f, 0.091297944f,
+0.089668410f, 0.088038636f, 0.086408626f, 0.084778385f, 0.083147917f,
+0.081517226f, 0.079886317f, 0.078255194f, 0.076623861f, 0.074992324f,
+0.073360585f, 0.071728651f, 0.070096524f, 0.068464209f, 0.066831712f,
+0.065199035f, 0.063566184f, 0.061933162f, 0.060299975f, 0.058666626f,
+0.057033121f, 0.055399462f, 0.053765655f, 0.052131705f, 0.050497614f,
+0.048863389f, 0.047229033f, 0.045594550f, 0.043959945f, 0.042325222f,
+0.040690387f, 0.039055442f, 0.037420393f, 0.035785243f, 0.034149998f,
+0.032514661f, 0.030879237f, 0.029243731f, 0.027608146f, 0.025972487f,
+0.024336759f, 0.022700965f, 0.021065111f, 0.019429201f, 0.017793238f,
+0.016157228f, 0.014521174f, 0.012885082f, 0.011248955f, 0.0096127982f,
+0.0079766155f, 0.0063404114f, 0.0047041904f, 0.0030679568f, 0.0014317149f,
+-0.00020453077f, -0.0018407759f, -0.0034770161f, -0.0051132470f, -0.0067494642f,
+-0.0083856634f, -0.010021840f, -0.011657990f, -0.013294109f, -0.014930192f,
+-0.016566235f, -0.018202233f, -0.019838183f, -0.021474080f, -0.023109920f,
+-0.024745697f, -0.026381408f, -0.028017049f, -0.029652615f, -0.031288101f,
+-0.032923503f, -0.034558818f, -0.036194040f, -0.037829164f, -0.039464188f,
+-0.041099106f, -0.042733914f, -0.044368607f, -0.046003182f, -0.047637634f,
+-0.049271958f, -0.050906150f, -0.052540206f, -0.054174121f, -0.055807891f,
+-0.057441512f, -0.059074978f, -0.060708287f, -0.062341433f, -0.063974413f,
+-0.065607221f, -0.067239853f, -0.068872305f, -0.070504573f, -0.072136653f,
+-0.073768539f, -0.075400227f, -0.077031714f, -0.078662994f, -0.080294064f,
+-0.081924919f, -0.083555555f, -0.085185966f, -0.086816150f, -0.088446102f,
+-0.090075816f, -0.091705289f, -0.093334517f, -0.094963495f, -0.096592219f,
+-0.098220684f, -0.099848886f, -0.10147682f, -0.10310448f, -0.10473187f,
+-0.10635898f, -0.10798580f, -0.10961233f, -0.11123857f, -0.11286451f,
+-0.11449015f, -0.11611549f, -0.11774051f, -0.11936521f, -0.12098960f,
+-0.12261367f, -0.12423740f, -0.12586080f, -0.12748387f, -0.12910659f,
+-0.13072897f, -0.13235100f, -0.13397267f, -0.13559399f, -0.13721494f,
+-0.13883553f, -0.14045574f, -0.14207558f, -0.14369503f, -0.14531411f,
+-0.14693279f, -0.14855108f, -0.15016897f, -0.15178646f, -0.15340354f,
+-0.15502022f, -0.15663647f, -0.15825231f, -0.15986773f, -0.16148271f,
+-0.16309727f, -0.16471139f, -0.16632506f, -0.16793829f, -0.16955108f,
+-0.17116340f, -0.17277527f, -0.17438668f, -0.17599762f, -0.17760809f,
+-0.17921808f, -0.18082760f, -0.18243663f, -0.18404517f, -0.18565322f,
+-0.18726077f, -0.18886782f, -0.19047436f, -0.19208040f, -0.19368592f,
+-0.19529092f, -0.19689540f, -0.19849935f, -0.20010277f, -0.20170565f,
+-0.20330800f, -0.20490980f, -0.20651105f, -0.20811175f, -0.20971189f,
+-0.21131147f, -0.21291048f, -0.21450893f, -0.21610680f, -0.21770409f,
+-0.21930080f, -0.22089692f, -0.22249245f, -0.22408738f, -0.22568172f,
+-0.22727545f, -0.22886857f, -0.23046108f, -0.23205297f, -0.23364424f,
+-0.23523488f, -0.23682490f, -0.23841428f, -0.24000302f, -0.24159112f,
+-0.24317858f, -0.24476538f, -0.24635153f, -0.24793701f, -0.24952184f,
+-0.25110599f, -0.25268948f, -0.25427228f, -0.25585441f, -0.25743585f,
+-0.25901660f, -0.26059666f, -0.26217602f, -0.26375468f, -0.26533263f,
+-0.26690987f, -0.26848640f, -0.27006221f, -0.27163730f, -0.27321165f,
+-0.27478528f, -0.27635817f, -0.27793032f, -0.27950173f, -0.28107239f,
+-0.28264230f, -0.28421145f, -0.28577984f, -0.28734746f, -0.28891431f,
+-0.29048039f, -0.29204570f, -0.29361022f, -0.29517395f, -0.29673690f,
+-0.29829905f, -0.29986040f, -0.30142095f, -0.30298069f, -0.30453962f,
+-0.30609774f, -0.30765504f, -0.30921151f, -0.31076715f, -0.31232197f,
+-0.31387594f, -0.31542908f, -0.31698137f, -0.31853281f, -0.32008340f,
+-0.32163313f, -0.32318201f, -0.32473001f, -0.32627715f, -0.32782341f,
+-0.32936880f, -0.33091330f, -0.33245692f, -0.33399965f, -0.33554149f,
+-0.33708242f, -0.33862245f, -0.34016158f, -0.34169980f, -0.34323710f,
+-0.34477348f, -0.34630894f, -0.34784347f, -0.34937707f, -0.35090974f,
+-0.35244146f, -0.35397224f, -0.35550208f, -0.35703096f, -0.35855889f,
+-0.36008585f, -0.36161186f, -0.36313689f, -0.36466095f, -0.36618404f,
+-0.36770615f, -0.36922727f, -0.37074740f, -0.37226654f, -0.37378468f,
+-0.37530183f, -0.37681796f, -0.37833309f, -0.37984721f, -0.38136031f,
+-0.38287239f, -0.38438344f, -0.38589346f, -0.38740245f, -0.38891041f,
+-0.39041732f, -0.39192319f, -0.39342800f, -0.39493177f, -0.39643448f,
+-0.39793612f, -0.39943670f, -0.40093621f, -0.40243465f, -0.40393201f,
+-0.40542829f, -0.40692348f, -0.40841759f, -0.40991060f, -0.41140251f,
+-0.41289332f, -0.41438303f, -0.41587162f, -0.41735911f, -0.41884547f,
+-0.42033072f, -0.42181484f, -0.42329782f, -0.42477968f, -0.42626040f,
+-0.42773998f, -0.42921841f, -0.43069569f, -0.43217182f, -0.43364680f,
+-0.43512061f, -0.43659326f, -0.43806474f, -0.43953504f, -0.44100417f,
+-0.44247212f, -0.44393888f, -0.44540446f, -0.44686884f, -0.44833203f,
+-0.44979401f, -0.45125479f, -0.45271437f, -0.45417273f, -0.45562987f,
+-0.45708580f, -0.45854050f, -0.45999398f, -0.46144622f, -0.46289723f,
+-0.46434699f, -0.46579552f, -0.46724280f, -0.46868882f, -0.47013359f,
+-0.47157711f, -0.47301936f, -0.47446034f, -0.47590006f, -0.47733850f,
+-0.47877566f, -0.48021154f, -0.48164613f, -0.48307944f, -0.48451145f,
+-0.48594216f, -0.48737158f, -0.48879968f, -0.49022648f, -0.49165197f,
+-0.49307614f, -0.49449899f, -0.49592052f, -0.49734072f, -0.49875959f,
+-0.50017712f, -0.50159331f, -0.50300816f, -0.50442167f, -0.50583382f,
+-0.50724462f, -0.50865406f, -0.51006214f, -0.51146885f, -0.51287419f,
+-0.51427817f, -0.51568076f, -0.51708197f, -0.51848180f, -0.51988024f,
+-0.52127729f, -0.52267294f, -0.52406720f, -0.52546005f, -0.52685149f,
+-0.52824153f, -0.52963015f, -0.53101735f, -0.53240313f, -0.53378748f,
+-0.53517041f, -0.53655190f, -0.53793196f, -0.53931057f, -0.54068774f,
+-0.54206347f, -0.54343774f, -0.54481056f, -0.54618192f, -0.54755181f,
+-0.54892024f, -0.55028721f, -0.55165269f, -0.55301671f, -0.55437924f,
+-0.55574028f, -0.55709984f, -0.55845791f, -0.55981448f, -0.56116955f,
+-0.56252312f, -0.56387519f, -0.56522574f, -0.56657478f, -0.56792231f,
+-0.56926831f, -0.57061279f, -0.57195575f, -0.57329717f, -0.57463705f,
+-0.57597540f, -0.57731221f, -0.57864747f, -0.57998118f, -0.58131334f,
+-0.58264394f, -0.58397298f, -0.58530046f, -0.58662637f, -0.58795071f,
+-0.58927348f, -0.59059466f, -0.59191427f, -0.59323230f, -0.59454873f,
+-0.59586357f, -0.59717682f, -0.59848847f, -0.59979852f, -0.60110696f,
+-0.60241379f, -0.60371901f, -0.60502261f, -0.60632459f, -0.60762495f,
+-0.60892368f, -0.61022078f, -0.61151625f, -0.61281008f, -0.61410227f,
+-0.61539282f, -0.61668172f, -0.61796896f, -0.61925456f, -0.62053849f,
+-0.62182077f, -0.62310138f, -0.62438032f, -0.62565759f, -0.62693318f,
+-0.62820709f, -0.62947933f, -0.63074988f, -0.63201874f, -0.63328590f,
+-0.63455138f, -0.63581515f, -0.63707722f, -0.63833758f, -0.63959624f,
+-0.64085318f, -0.64210841f, -0.64336192f, -0.64461371f, -0.64586377f,
+-0.64711210f, -0.64835870f, -0.64960356f, -0.65084668f, -0.65208807f,
+-0.65332770f, -0.65456559f, -0.65580172f, -0.65703610f, -0.65826872f,
+-0.65949958f, -0.66072867f, -0.66195599f, -0.66318154f, -0.66440531f,
+-0.66562731f, -0.66684752f, -0.66806595f, -0.66928259f, -0.67049744f,
+-0.67171049f, -0.67292174f, -0.67413119f, -0.67533884f, -0.67654468f,
+-0.67774871f, -0.67895092f, -0.68015132f, -0.68134989f, -0.68254664f,
+-0.68374157f, -0.68493466f, -0.68612592f, -0.68731534f, -0.68850292f,
+-0.68968866f, -0.69087255f, -0.69205460f, -0.69323478f, -0.69441312f,
+-0.69558959f, -0.69676420f, -0.69793695f, -0.69910783f, -0.70027684f,
+-0.70144397f, -0.70260922f, -0.70377259f, -0.70493408f, -0.70609368f,
+-0.70725139f, -0.70840721f, -0.70956113f, -0.71071315f, -0.71186327f,
+-0.71301148f, -0.71415778f, -0.71530217f, -0.71644465f, -0.71758521f,
+-0.71872384f, -0.71986055f, -0.72099534f, -0.72212819f, -0.72325912f,
+-0.72438810f, -0.72551515f, -0.72664025f, -0.72776341f, -0.72888462f,
+-0.73000387f, -0.73112118f, -0.73223652f, -0.73334991f, -0.73446133f,
+-0.73557079f, -0.73667827f, -0.73778379f, -0.73888732f, -0.73998888f,
+-0.74108846f, -0.74218606f, -0.74328167f, -0.74437529f, -0.74546691f,
+-0.74655654f, -0.74764417f, -0.74872980f, -0.74981342f, -0.75089504f,
+-0.75197465f, -0.75305224f, -0.75412782f, -0.75520138f, -0.75627291f,
+-0.75734242f, -0.75840991f, -0.75947536f, -0.76053878f, -0.76160017f,
+-0.76265951f, -0.76371681f, -0.76477207f, -0.76582528f, -0.76687644f,
+-0.76792555f, -0.76897260f, -0.77001759f, -0.77106052f, -0.77210139f,
+-0.77314019f, -0.77417692f, -0.77521158f, -0.77624416f, -0.77727466f,
+-0.77830308f, -0.77932942f, -0.78035367f, -0.78137584f, -0.78239591f,
+-0.78341388f, -0.78442976f, -0.78544354f, -0.78645521f, -0.78746478f,
+-0.78847224f, -0.78947760f, -0.79048083f, -0.79148195f, -0.79248095f,
+-0.79347783f, -0.79447259f, -0.79546522f, -0.79645572f, -0.79744408f,
+-0.79843031f, -0.79941441f, -0.80039636f, -0.80137617f, -0.80235384f,
+-0.80332935f, -0.80430272f, -0.80527393f, -0.80624299f, -0.80720989f,
+-0.80817462f, -0.80913720f, -0.81009760f, -0.81105584f, -0.81201191f,
+-0.81296580f, -0.81391752f, -0.81486706f, -0.81581441f, -0.81675958f,
+-0.81770257f, -0.81864336f, -0.81958197f, -0.82051837f, -0.82145259f,
+-0.82238460f, -0.82331441f, -0.82424202f, -0.82516742f, -0.82609061f,
+-0.82701159f, -0.82793036f, -0.82884690f, -0.82976123f, -0.83067334f,
+-0.83158323f, -0.83249088f, -0.83339631f, -0.83429951f, -0.83520047f,
+-0.83609920f, -0.83699569f, -0.83788994f, -0.83878195f, -0.83967171f,
+-0.84055922f, -0.84144448f, -0.84232749f, -0.84320824f, -0.84408674f,
+-0.84496297f, -0.84583694f, -0.84670865f, -0.84757810f, -0.84844527f,
+-0.84931017f, -0.85017280f, -0.85103315f, -0.85189122f, -0.85274701f,
+-0.85360052f, -0.85445175f, -0.85530068f, -0.85614733f, -0.85699168f,
+-0.85783374f, -0.85867350f, -0.85951097f, -0.86034613f, -0.86117899f,
+-0.86200954f, -0.86283779f, -0.86366373f, -0.86448735f, -0.86530866f,
+-0.86612765f, -0.86694432f, -0.86775868f, -0.86857071f, -0.86938041f,
+-0.87018779f, -0.87099283f, -0.87179555f, -0.87259593f, -0.87339397f,
+-0.87418968f, -0.87498304f, -0.87577407f, -0.87656274f, -0.87734907f,
+-0.87813306f, -0.87891469f, -0.87969397f, -0.88047089f, -0.88124545f,
+-0.88201766f, -0.88278751f, -0.88355499f, -0.88432010f, -0.88508285f,
+-0.88584323f, -0.88660124f, -0.88735687f, -0.88811013f, -0.88886101f,
+-0.88960951f, -0.89035563f, -0.89109936f, -0.89184071f, -0.89257967f,
+-0.89331624f, -0.89405042f, -0.89478221f, -0.89551160f, -0.89623859f,
+-0.89696318f, -0.89768538f, -0.89840516f, -0.89912255f, -0.89983752f,
+-0.90055009f, -0.90126025f, -0.90196799f, -0.90267332f, -0.90337623f,
+-0.90407672f, -0.90477479f, -0.90547044f, -0.90616367f, -0.90685447f,
+-0.90754284f, -0.90822878f, -0.90891229f, -0.90959337f, -0.91027201f,
+-0.91094822f, -0.91162198f, -0.91229331f, -0.91296219f, -0.91362863f,
+-0.91429262f, -0.91495417f, -0.91561326f, -0.91626990f, -0.91692409f,
+-0.91757583f, -0.91822511f, -0.91887193f, -0.91951629f, -0.92015819f,
+-0.92079762f, -0.92143459f, -0.92206909f, -0.92270113f, -0.92333069f,
+-0.92395778f, -0.92458240f, -0.92520454f, -0.92582421f, -0.92644140f,
+-0.92705610f, -0.92766833f, -0.92827807f, -0.92888532f, -0.92949009f,
+-0.93009237f, -0.93069216f, -0.93128946f, -0.93188427f, -0.93247658f,
+-0.93306639f, -0.93365370f, -0.93423852f, -0.93482083f, -0.93540065f,
+-0.93597795f, -0.93655275f, -0.93712505f, -0.93769483f, -0.93826211f,
+-0.93882687f, -0.93938912f, -0.93994885f, -0.94050607f, -0.94106077f,
+-0.94161295f, -0.94216261f, -0.94270975f, -0.94325436f, -0.94379644f,
+-0.94433601f, -0.94487304f, -0.94540754f, -0.94593951f, -0.94646895f,
+-0.94699585f, -0.94752022f, -0.94804206f, -0.94856135f, -0.94907810f,
+-0.94959232f, -0.95010399f, -0.95061312f, -0.95111970f, -0.95162374f,
+-0.95212522f, -0.95262416f, -0.95312055f, -0.95361439f, -0.95410567f,
+-0.95459440f, -0.95508058f, -0.95556419f, -0.95604525f, -0.95652375f,
+-0.95699969f, -0.95747306f, -0.95794388f, -0.95841212f, -0.95887780f,
+-0.95934092f, -0.95980146f, -0.96025944f, -0.96071485f, -0.96116768f,
+-0.96161794f, -0.96206562f, -0.96251073f, -0.96295327f, -0.96339322f,
+-0.96383060f, -0.96426539f, -0.96469760f, -0.96512723f, -0.96555428f,
+-0.96597874f, -0.96640062f, -0.96681991f, -0.96723660f, -0.96765071f,
+-0.96806223f, -0.96847116f, -0.96887749f, -0.96928124f, -0.96968238f,
+-0.97008093f, -0.97047688f, -0.97087024f, -0.97126099f, -0.97164914f,
+-0.97203470f, -0.97241765f, -0.97279799f, -0.97317574f, -0.97355087f,
+-0.97392340f, -0.97429333f, -0.97466064f, -0.97502535f, -0.97538744f,
+-0.97574692f, -0.97610379f, -0.97645805f, -0.97680969f, -0.97715872f,
+-0.97750513f, -0.97784893f, -0.97819010f, -0.97852866f, -0.97886460f,
+-0.97919792f, -0.97952861f, -0.97985669f, -0.98018214f, -0.98050496f,
+-0.98082516f, -0.98114274f, -0.98145768f, -0.98177000f, -0.98207970f,
+-0.98238676f, -0.98269119f, -0.98299299f, -0.98329216f, -0.98358870f,
+-0.98388260f, -0.98417387f, -0.98446250f, -0.98474850f, -0.98503186f,
+-0.98531259f, -0.98559068f, -0.98586612f, -0.98613893f, -0.98640910f,
+-0.98667663f, -0.98694151f, -0.98720376f, -0.98746336f, -0.98772032f,
+-0.98797463f, -0.98822630f, -0.98847532f, -0.98872169f, -0.98896542f,
+-0.98920650f, -0.98944493f, -0.98968071f, -0.98991385f, -0.99014433f,
+-0.99037216f, -0.99059734f, -0.99081987f, -0.99103975f, -0.99125697f,
+-0.99147154f, -0.99168345f, -0.99189271f, -0.99209931f, -0.99230326f,
+-0.99250455f, -0.99270318f, -0.99289916f, -0.99309248f, -0.99328313f,
+-0.99347113f, -0.99365647f, -0.99383915f, -0.99401917f, -0.99419653f,
+-0.99437122f, -0.99454325f, -0.99471262f, -0.99487933f, -0.99504337f,
+-0.99520475f, -0.99536347f, -0.99551952f, -0.99567290f, -0.99582362f,
+-0.99597167f, -0.99611706f, -0.99625978f, -0.99639983f, -0.99653722f,
+-0.99667193f, -0.99680398f, -0.99693336f, -0.99706007f, -0.99718411f,
+-0.99730548f, -0.99742418f, -0.99754021f, -0.99765357f, -0.99776426f,
+-0.99787228f, -0.99797763f, -0.99808030f, -0.99818030f, -0.99827763f,
+-0.99837229f, -0.99846427f, -0.99855358f, -0.99864022f, -0.99872418f,
+-0.99880547f, -0.99888409f, -0.99896003f, -0.99903329f, -0.99910389f,
+-0.99917180f, -0.99923705f, -0.99929961f, -0.99935950f, -0.99941672f,
+-0.99947126f, -0.99952312f, -0.99957231f, -0.99961882f, -0.99966266f,
+-0.99970382f, -0.99974230f, -0.99977811f, -0.99981124f, -0.99984169f,
+-0.99986946f, -0.99989456f, -0.99991698f, -0.99993673f, -0.99995380f,
+-0.99996819f, -0.99997990f, -0.99998894f, -0.99999529f, -0.99999898f,
+0.99999992f, 0.99999322f, 0.99997582f, 0.99994771f, 0.99990889f,
+0.99985936f, 0.99979913f, 0.99972818f, 0.99964653f, 0.99955418f,
+0.99945112f, 0.99933736f, 0.99921289f, 0.99907773f, 0.99893186f,
+0.99877530f, 0.99860804f, 0.99843009f, 0.99824144f, 0.99804211f,
+0.99783209f, 0.99761138f, 0.99737998f, 0.99713791f, 0.99688516f,
+0.99662173f, 0.99634763f, 0.99606285f, 0.99576741f, 0.99546131f,
+0.99514455f, 0.99481713f, 0.99447905f, 0.99413033f, 0.99377096f,
+0.99340095f, 0.99302029f, 0.99262901f, 0.99222709f, 0.99181455f,
+0.99139139f, 0.99095760f, 0.99051321f, 0.99005821f, 0.98959261f,
+0.98911641f, 0.98862961f, 0.98813223f, 0.98762427f, 0.98710573f,
+0.98657662f, 0.98603694f, 0.98548670f, 0.98492591f, 0.98435457f,
+0.98377269f, 0.98318028f, 0.98257734f, 0.98196387f, 0.98133989f,
+0.98070539f, 0.98006040f, 0.97940491f, 0.97873893f, 0.97806247f,
+0.97737554f, 0.97667813f, 0.97597027f, 0.97525196f, 0.97452320f,
+0.97378401f, 0.97303439f, 0.97227435f, 0.97150389f, 0.97072303f,
+0.96993178f, 0.96913014f, 0.96831812f, 0.96749573f, 0.96666298f,
+0.96581987f, 0.96496643f, 0.96410265f, 0.96322854f, 0.96234412f,
+0.96144939f, 0.96054437f, 0.95962906f, 0.95870347f, 0.95776762f,
+0.95682151f, 0.95586515f, 0.95489856f, 0.95392174f, 0.95293471f,
+0.95193746f, 0.95093003f, 0.94991241f, 0.94888462f, 0.94784667f,
+0.94679856f, 0.94574032f, 0.94467195f, 0.94359346f, 0.94250486f,
+0.94140618f, 0.94029741f, 0.93917857f, 0.93804967f, 0.93691073f,
+0.93576176f, 0.93460276f, 0.93343375f, 0.93225475f, 0.93106577f,
+0.92986681f, 0.92865789f, 0.92743903f, 0.92621024f, 0.92497153f,
+0.92372291f, 0.92246440f, 0.92119602f, 0.91991776f, 0.91862966f,
+0.91733172f, 0.91602395f, 0.91470637f, 0.91337900f, 0.91204185f,
+0.91069493f, 0.90933825f, 0.90797184f, 0.90659570f, 0.90520986f,
+0.90381432f, 0.90240910f, 0.90099422f, 0.89956969f, 0.89813553f,
+0.89669174f, 0.89523836f, 0.89377538f, 0.89230284f, 0.89082074f,
+0.88932910f, 0.88782793f, 0.88631726f, 0.88479710f, 0.88326746f,
+0.88172836f, 0.88017982f, 0.87862185f, 0.87705448f, 0.87547771f,
+0.87389156f, 0.87229606f, 0.87069121f, 0.86907704f, 0.86745357f,
+0.86582080f, 0.86417876f, 0.86252747f, 0.86086694f, 0.85919719f,
+0.85751824f, 0.85583010f, 0.85413281f, 0.85242636f, 0.85071078f,
+0.84898610f, 0.84725232f, 0.84550947f, 0.84375756f, 0.84199662f,
+0.84022666f, 0.83844771f, 0.83665977f, 0.83486287f, 0.83305704f,
+0.83124228f, 0.82941862f, 0.82758608f, 0.82574467f, 0.82389442f,
+0.82203535f, 0.82016748f, 0.81829082f, 0.81640540f, 0.81451123f,
+0.81260835f, 0.81069676f, 0.80877649f, 0.80684755f, 0.80490998f,
+0.80296379f, 0.80100899f, 0.79904562f, 0.79707370f, 0.79509323f,
+0.79310425f, 0.79110678f, 0.78910084f, 0.78708644f, 0.78506362f,
+0.78303239f, 0.78099277f, 0.77894479f, 0.77688847f, 0.77482382f,
+0.77275088f, 0.77066967f, 0.76858020f, 0.76648250f, 0.76437659f,
+0.76226250f, 0.76014024f, 0.75800984f, 0.75587132f, 0.75372471f,
+0.75157003f, 0.74940730f, 0.74723654f, 0.74505779f, 0.74287105f,
+0.74067635f, 0.73847373f, 0.73626320f, 0.73404478f, 0.73181850f,
+0.72958438f, 0.72734245f, 0.72509273f, 0.72283525f, 0.72057002f,
+0.71829708f, 0.71601644f, 0.71372814f, 0.71143220f, 0.70912863f,
+0.70681747f, 0.70449874f, 0.70217247f, 0.69983868f, 0.69749739f,
+0.69514863f, 0.69279243f, 0.69042881f, 0.68805780f, 0.68567941f,
+0.68329369f, 0.68090064f, 0.67850031f, 0.67609270f, 0.67367786f,
+0.67125580f, 0.66882656f, 0.66639015f, 0.66394661f, 0.66149595f,
+0.65903821f, 0.65657341f, 0.65410159f, 0.65162275f, 0.64913694f,
+0.64664418f, 0.64414449f, 0.64163790f, 0.63912444f, 0.63660414f,
+0.63407702f, 0.63154311f, 0.62900244f, 0.62645503f, 0.62390091f,
+0.62134011f, 0.61877265f, 0.61619857f, 0.61361789f, 0.61103064f,
+0.60843685f, 0.60583654f, 0.60322974f, 0.60061648f, 0.59799679f,
+0.59537069f, 0.59273822f, 0.59009940f, 0.58745427f, 0.58480284f,
+0.58214514f, 0.57948122f, 0.57681109f, 0.57413478f, 0.57145232f,
+0.56876374f, 0.56606907f, 0.56336834f, 0.56066158f, 0.55794881f,
+0.55523006f, 0.55250537f, 0.54977477f, 0.54703827f, 0.54429592f,
+0.54154774f, 0.53879376f, 0.53603401f, 0.53326852f, 0.53049731f,
+0.52772043f, 0.52493790f, 0.52214974f, 0.51935599f, 0.51655668f,
+0.51375184f, 0.51094149f, 0.50812568f, 0.50530442f, 0.50247775f,
+0.49964570f, 0.49680830f, 0.49396558f, 0.49111757f, 0.48826430f,
+0.48540580f, 0.48254210f, 0.47967323f, 0.47679923f, 0.47392012f,
+0.47103594f, 0.46814671f, 0.46525247f, 0.46235324f, 0.45944907f,
+0.45653997f, 0.45362599f, 0.45070714f, 0.44778347f, 0.44485501f,
+0.44192178f, 0.43898381f, 0.43604115f, 0.43309382f, 0.43014185f,
+0.42718527f, 0.42422412f, 0.42125842f, 0.41828822f, 0.41531353f,
+0.41233440f, 0.40935085f, 0.40636291f, 0.40337063f, 0.40037402f,
+0.39737313f, 0.39436798f, 0.39135861f, 0.38834505f, 0.38532733f,
+0.38230548f, 0.37927953f, 0.37624953f, 0.37321550f, 0.37017747f,
+0.36713547f, 0.36408955f, 0.36103972f, 0.35798603f, 0.35492850f,
+0.35186718f, 0.34880208f, 0.34573325f, 0.34266072f, 0.33958451f,
+0.33650468f, 0.33342123f, 0.33033422f, 0.32724367f, 0.32414961f,
+0.32105209f, 0.31795112f, 0.31484675f, 0.31173901f, 0.30862793f,
+0.30551354f, 0.30239588f, 0.29927499f, 0.29615089f, 0.29302362f,
+0.28989321f, 0.28675969f, 0.28362310f, 0.28048348f, 0.27734085f,
+0.27419526f, 0.27104672f, 0.26789529f, 0.26474098f, 0.26158384f,
+0.25842390f, 0.25526119f, 0.25209575f, 0.24892761f, 0.24575680f,
+0.24258336f, 0.23940732f, 0.23622872f, 0.23304759f, 0.22986396f,
+0.22667787f, 0.22348935f, 0.22029844f, 0.21710517f, 0.21390958f,
+0.21071169f, 0.20751155f, 0.20430919f, 0.20110463f, 0.19789793f,
+0.19468910f, 0.19147819f, 0.18826523f, 0.18505026f, 0.18183330f,
+0.17861439f, 0.17539357f, 0.17217088f, 0.16894634f, 0.16571999f,
+0.16249186f, 0.15926200f, 0.15603043f, 0.15279719f, 0.14956231f,
+0.14632583f, 0.14308778f, 0.13984820f, 0.13660713f, 0.13336459f,
+0.13012062f, 0.12687526f, 0.12362854f, 0.12038049f, 0.11713116f,
+0.11388057f, 0.11062877f, 0.10737578f, 0.10412163f, 0.10086638f,
+0.097610040f, 0.094352658f, 0.091094266f, 0.087834897f, 0.084574589f,
+0.081313374f, 0.078051289f, 0.074788367f, 0.071524645f, 0.068260157f,
+0.064994938f, 0.061729023f, 0.058462447f, 0.055195244f, 0.051927451f,
+0.048659101f, 0.045390231f, 0.042120874f, 0.038851066f, 0.035580842f,
+0.032310238f, 0.029039287f, 0.025768025f, 0.022496487f, 0.019224708f,
+0.015952723f, 0.012680568f, 0.0094082767f, 0.0061358846f, 0.0028634269f,
+-0.00040906153f, -0.0036815456f, -0.0069539902f, -0.010226360f, -0.013498621f,
+-0.016770737f, -0.020042673f, -0.023314395f, -0.026585867f, -0.029857055f,
+-0.033127923f, -0.036398436f, -0.039668559f, -0.042938257f, -0.046207495f,
+-0.049476239f, -0.052744453f, -0.056012102f, -0.059279151f, -0.062545565f,
+-0.065811309f, -0.069076349f, -0.072340649f, -0.075604174f, -0.078866890f,
+-0.082128761f, -0.085389752f, -0.088649829f, -0.091908956f, -0.095167100f,
+-0.098424224f, -0.10168029f, -0.10493528f, -0.10818913f, -0.11144183f,
+-0.11469334f, -0.11794361f, -0.12119263f, -0.12444034f, -0.12768673f,
+-0.13093174f, -0.13417536f, -0.13741753f, -0.14065824f, -0.14389744f,
+-0.14713510f, -0.15037118f, -0.15360565f, -0.15683848f, -0.16006962f,
+-0.16329906f, -0.16652674f, -0.16975264f, -0.17297673f, -0.17619896f,
+-0.17941930f, -0.18263772f, -0.18585419f, -0.18906866f, -0.19228112f,
+-0.19549151f, -0.19869981f, -0.20190598f, -0.20510998f, -0.20831180f,
+-0.21151138f, -0.21470869f, -0.21790371f, -0.22109639f, -0.22428671f,
+-0.22747462f, -0.23066010f, -0.23384310f, -0.23702361f, -0.24020157f,
+-0.24337696f, -0.24654975f, -0.24971989f, -0.25288736f, -0.25605213f,
+-0.25921415f, -0.26237339f, -0.26552983f, -0.26868342f, -0.27183413f,
+-0.27498193f, -0.27812679f, -0.28126867f, -0.28440754f, -0.28754336f,
+-0.29067610f, -0.29380573f, -0.29693221f, -0.30005551f, -0.30317560f,
+-0.30629245f, -0.30940601f, -0.31251626f, -0.31562316f, -0.31872668f,
+-0.32182679f, -0.32492345f, -0.32801664f, -0.33110631f, -0.33419243f,
+-0.33727497f, -0.34035391f, -0.34342920f, -0.34650081f, -0.34956871f,
+-0.35263286f, -0.35569324f, -0.35874981f, -0.36180254f, -0.36485139f,
+-0.36789634f, -0.37093735f, -0.37397438f, -0.37700741f, -0.38003640f,
+-0.38306132f, -0.38608214f, -0.38909883f, -0.39211135f, -0.39511967f,
+-0.39812375f, -0.40112358f, -0.40411910f, -0.40711031f, -0.41009715f,
+-0.41307959f, -0.41605762f, -0.41903119f, -0.42200027f, -0.42496483f,
+-0.42792484f, -0.43088027f, -0.43383109f, -0.43677726f, -0.43971875f,
+-0.44265553f, -0.44558757f, -0.44851484f, -0.45143731f, -0.45435494f,
+-0.45726770f, -0.46017557f, -0.46307851f, -0.46597650f, -0.46886949f,
+-0.47175746f, -0.47464038f, -0.47751821f, -0.48039093f, -0.48325851f,
+-0.48612091f, -0.48897811f, -0.49183006f, -0.49467676f, -0.49751815f,
+-0.50035422f, -0.50318492f, -0.50601024f, -0.50883014f, -0.51164459f,
+-0.51445356f, -0.51725703f, -0.52005495f, -0.52284730f, -0.52563406f,
+-0.52841518f, -0.53119065f, -0.53396043f, -0.53672449f, -0.53948280f,
+-0.54223533f, -0.54498206f, -0.54772295f, -0.55045797f, -0.55318710f,
+-0.55591031f, -0.55862756f, -0.56133883f, -0.56404409f, -0.56674331f,
+-0.56943646f, -0.57212351f, -0.57480443f, -0.57747920f, -0.58014778f,
+-0.58281015f, -0.58546628f, -0.58811614f, -0.59075970f, -0.59339694f,
+-0.59602782f, -0.59865231f, -0.60127040f, -0.60388204f, -0.60648722f,
+-0.60908591f, -0.61167807f, -0.61426368f, -0.61684271f, -0.61941514f,
+-0.62198093f, -0.62454007f, -0.62709251f, -0.62963824f, -0.63217722f,
+-0.63470944f, -0.63723486f, -0.63975345f, -0.64226519f, -0.64477006f,
+-0.64726802f, -0.64975905f, -0.65224312f, -0.65472020f, -0.65719027f,
+-0.65965331f, -0.66210928f, -0.66455816f, -0.66699992f, -0.66943454f,
+-0.67186199f, -0.67428225f, -0.67669528f, -0.67910107f, -0.68149959f,
+-0.68389080f, -0.68627470f, -0.68865124f, -0.69102041f, -0.69338218f,
+-0.69573652f, -0.69808341f, -0.70042283f, -0.70275474f, -0.70507913f,
+-0.70739597f, -0.70970524f, -0.71200690f, -0.71430093f, -0.71658732f,
+-0.71886604f, -0.72113705f, -0.72340034f, -0.72565589f, -0.72790366f,
+-0.73014364f, -0.73237580f, -0.73460012f, -0.73681657f, -0.73902513f,
+-0.74122577f, -0.74341848f, -0.74560322f, -0.74777998f, -0.74994874f,
+-0.75210946f, -0.75426212f, -0.75640671f, -0.75854320f, -0.76067157f,
+-0.76279178f, -0.76490383f, -0.76700769f, -0.76910334f, -0.77119075f,
+-0.77326989f, -0.77534076f, -0.77740333f, -0.77945757f, -0.78150346f,
+-0.78354098f, -0.78557011f, -0.78759083f, -0.78960312f, -0.79160694f,
+-0.79360229f, -0.79558915f, -0.79756748f, -0.79953727f, -0.80149850f,
+-0.80345114f, -0.80539518f, -0.80733060f, -0.80925737f, -0.81117547f,
+-0.81308489f, -0.81498559f, -0.81687757f, -0.81876081f, -0.82063527f,
+-0.82250095f, -0.82435781f, -0.82620585f, -0.82804505f, -0.82987537f,
+-0.83169681f, -0.83350933f, -0.83531294f, -0.83710760f, -0.83889329f,
+-0.84067000f, -0.84243770f, -0.84419639f, -0.84594603f, -0.84768662f,
+-0.84941812f, -0.85114053f, -0.85285383f, -0.85455799f, -0.85625300f,
+-0.85793884f, -0.85961549f, -0.86128294f, -0.86294116f, -0.86459014f,
+-0.86622986f, -0.86786031f, -0.86948146f, -0.87109330f, -0.87269581f,
+-0.87428898f, -0.87587278f, -0.87744720f, -0.87901223f, -0.88056784f,
+-0.88211402f, -0.88365076f, -0.88517803f, -0.88669582f, -0.88820412f,
+-0.88970290f, -0.89119216f, -0.89267187f, -0.89414203f, -0.89560260f,
+-0.89705359f, -0.89849497f, -0.89992673f, -0.90134885f, -0.90276131f,
+-0.90416411f, -0.90555723f, -0.90694065f, -0.90831436f, -0.90967833f,
+-0.91103257f, -0.91237705f, -0.91371176f, -0.91503669f, -0.91635181f,
+-0.91765712f, -0.91895261f, -0.92023825f, -0.92151404f, -0.92277996f,
+-0.92403600f, -0.92528214f, -0.92651837f, -0.92774468f, -0.92896106f,
+-0.93016748f, -0.93136395f, -0.93255044f, -0.93372694f, -0.93489345f,
+-0.93604994f, -0.93719641f, -0.93833284f, -0.93945922f, -0.94057555f,
+-0.94168180f, -0.94277796f, -0.94386403f, -0.94493999f, -0.94600583f,
+-0.94706154f, -0.94810711f, -0.94914252f, -0.95016777f, -0.95118284f,
+-0.95218773f, -0.95318242f, -0.95416690f, -0.95514117f, -0.95610520f,
+-0.95705900f, -0.95800255f, -0.95893583f, -0.95985885f, -0.96077159f,
+-0.96167404f, -0.96256619f, -0.96344803f, -0.96431956f, -0.96518076f,
+-0.96603162f, -0.96687213f, -0.96770230f, -0.96852209f, -0.96933152f,
+-0.97013057f, -0.97091922f, -0.97169748f, -0.97246533f, -0.97322277f,
+-0.97396979f, -0.97470637f, -0.97543252f, -0.97614822f, -0.97685347f,
+-0.97754825f, -0.97823257f, -0.97890641f, -0.97956977f, -0.98022263f,
+-0.98086500f, -0.98149687f, -0.98211822f, -0.98272906f, -0.98332937f,
+-0.98391915f, -0.98449840f, -0.98506710f, -0.98562525f, -0.98617285f,
+-0.98670988f, -0.98723635f, -0.98775225f, -0.98825757f, -0.98875230f,
+-0.98923645f, -0.98971000f, -0.99017295f, -0.99062530f, -0.99106704f,
+-0.99149817f, -0.99191868f, -0.99232857f, -0.99272783f, -0.99311645f,
+-0.99349445f, -0.99386180f, -0.99421851f, -0.99456457f, -0.99489998f,
+-0.99522474f, -0.99553884f, -0.99584227f, -0.99613505f, -0.99641715f,
+-0.99668858f, -0.99694934f, -0.99719943f, -0.99743883f, -0.99766756f,
+-0.99788559f, -0.99809295f, -0.99828961f, -0.99847558f, -0.99865086f,
+-0.99881544f, -0.99896933f, -0.99911252f, -0.99924501f, -0.99936680f,
+-0.99947789f, -0.99957827f, -0.99966795f, -0.99974692f, -0.99981519f,
+-0.99987275f, -0.99991960f, -0.99995574f, -0.99998118f, -0.99999590f,
+0.99999967f, 0.99997289f, 0.99990328f, 0.99979084f, 0.99963557f,
+0.99943748f, 0.99919658f, 0.99891288f, 0.99858638f, 0.99821711f,
+0.99780508f, 0.99735031f, 0.99685281f, 0.99631261f, 0.99572973f,
+0.99510420f, 0.99443605f, 0.99372529f, 0.99297196f, 0.99217610f,
+0.99133774f, 0.99045692f, 0.98953366f, 0.98856802f, 0.98756003f,
+0.98650973f, 0.98541718f, 0.98428242f, 0.98310549f, 0.98188645f,
+0.98062534f, 0.97932224f, 0.97797718f, 0.97659022f, 0.97516144f,
+0.97369088f, 0.97217861f, 0.97062469f, 0.96902920f, 0.96739220f,
+0.96571376f, 0.96399395f, 0.96223284f, 0.96043052f, 0.95858705f,
+0.95670253f, 0.95477702f, 0.95281061f, 0.95080338f, 0.94875543f,
+0.94666684f, 0.94453769f, 0.94236808f, 0.94015810f, 0.93790786f,
+0.93561743f, 0.93328693f, 0.93091644f, 0.92850608f, 0.92605595f,
+0.92356614f, 0.92103677f, 0.91846795f, 0.91585979f, 0.91321239f,
+0.91052587f, 0.90780035f, 0.90503595f, 0.90223277f, 0.89939095f,
+0.89651059f, 0.89359184f, 0.89063481f, 0.88763962f, 0.88460641f,
+0.88153531f, 0.87842644f, 0.87527995f, 0.87209596f, 0.86887462f,
+0.86561605f, 0.86232041f, 0.85898782f, 0.85561844f, 0.85221241f,
+0.84876987f, 0.84529098f, 0.84177587f, 0.83822471f, 0.83463763f,
+0.83101481f, 0.82735639f, 0.82366252f, 0.81993338f, 0.81616911f,
+0.81236987f, 0.80853584f, 0.80466718f, 0.80076404f, 0.79682660f,
+0.79285503f, 0.78884950f, 0.78481017f, 0.78073723f, 0.77663084f,
+0.77249118f, 0.76831844f, 0.76411277f, 0.75987438f, 0.75560344f,
+0.75130013f, 0.74696464f, 0.74259715f, 0.73819784f, 0.73376692f,
+0.72930457f, 0.72481097f, 0.72028632f, 0.71573083f, 0.71114467f,
+0.70652804f, 0.70188116f, 0.69720420f, 0.69249738f, 0.68776090f,
+0.68299495f, 0.67819975f, 0.67337550f, 0.66852240f, 0.66364066f,
+0.65873050f, 0.65379211f, 0.64882573f, 0.64383154f, 0.63880978f,
+0.63376065f, 0.62868438f, 0.62358117f, 0.61845126f, 0.61329485f,
+0.60811216f, 0.60290343f, 0.59766888f, 0.59240872f, 0.58712318f,
+0.58181249f, 0.57647688f, 0.57111658f, 0.56573181f, 0.56032281f,
+0.55488980f, 0.54943303f, 0.54395272f, 0.53844911f, 0.53292243f,
+0.52737292f, 0.52180083f, 0.51620638f, 0.51058981f, 0.50495138f,
+0.49929132f, 0.49360987f, 0.48790727f, 0.48218377f, 0.47643962f,
+0.47067506f, 0.46489034f, 0.45908570f, 0.45326139f, 0.44741768f,
+0.44155479f, 0.43567299f, 0.42977253f, 0.42385365f, 0.41791662f,
+0.41196169f, 0.40598911f, 0.39999914f, 0.39399204f, 0.38796806f,
+0.38192746f, 0.37587050f, 0.36979743f, 0.36370853f, 0.35760405f,
+0.35148424f, 0.34534939f, 0.33919973f, 0.33303555f, 0.32685710f,
+0.32066465f, 0.31445847f, 0.30823881f, 0.30200595f, 0.29576015f,
+0.28950169f, 0.28323082f, 0.27694782f, 0.27065295f, 0.26434649f,
+0.25802871f, 0.25169988f, 0.24536026f, 0.23901013f, 0.23264977f,
+0.22627944f, 0.21989941f, 0.21350997f, 0.20711138f, 0.20070391f,
+0.19428785f, 0.18786347f, 0.18143104f, 0.17499084f, 0.16854314f,
+0.16208822f, 0.15562636f, 0.14915783f, 0.14268292f, 0.13620189f,
+0.12971502f, 0.12322260f, 0.11672491f, 0.11022221f, 0.10371479f,
+0.097202924f, 0.090686897f, 0.084166986f, 0.077643468f, 0.071116625f,
+0.064586736f, 0.058054080f, 0.051518937f, 0.044981587f, 0.038442310f,
+0.031901387f, 0.025359097f, 0.018815721f, 0.012271538f, 0.0057268303f,
+-0.00081812300f, -0.0073630412f, -0.013907644f, -0.020451651f, -0.026994782f,
+-0.033536757f, -0.040077295f, -0.046616116f, -0.053152941f, -0.059687488f,
+-0.066219479f, -0.072748633f, -0.079274670f, -0.085797312f, -0.092316279f,
+-0.098831291f, -0.10534207f, -0.11184834f, -0.11834981f, -0.12484622f,
+-0.13133727f, -0.13782270f, -0.14430223f, -0.15077558f, -0.15724246f,
+-0.16370261f, -0.17015575f, -0.17660160f, -0.18303989f, -0.18947033f,
+-0.19589266f, -0.20230660f, -0.20871187f, -0.21510820f, -0.22149531f,
+-0.22787294f, -0.23424080f, -0.24059864f, -0.24694616f, -0.25328311f,
+-0.25960920f, -0.26592418f, -0.27222777f, -0.27851969f, -0.28479968f,
+-0.29106748f, -0.29732280f, -0.30356539f, -0.30979497f, -0.31601129f,
+-0.32221406f, -0.32840304f, -0.33457794f, -0.34073852f, -0.34688450f,
+-0.35301562f, -0.35913161f, -0.36523223f, -0.37131719f, -0.37738626f,
+-0.38343915f, -0.38947562f, -0.39549541f, -0.40149825f, -0.40748390f,
+-0.41345209f, -0.41940257f, -0.42533508f, -0.43124938f, -0.43714520f,
+-0.44302229f, -0.44888041f, -0.45471930f, -0.46053871f, -0.46633839f,
+-0.47211810f, -0.47787758f, -0.48361659f, -0.48933489f, -0.49503222f,
+-0.50070835f, -0.50636303f, -0.51199602f, -0.51760707f, -0.52319595f,
+-0.52876243f, -0.53430625f, -0.53982718f, -0.54532499f, -0.55079944f,
+-0.55625029f, -0.56167732f, -0.56708028f, -0.57245896f, -0.57781311f,
+-0.58314251f, -0.58844693f, -0.59372614f, -0.59897992f, -0.60420805f,
+-0.60941029f, -0.61458642f, -0.61973623f, -0.62485949f, -0.62995598f,
+-0.63502549f, -0.64006780f, -0.64508268f, -0.65006994f, -0.65502934f,
+-0.65996069f, -0.66486377f, -0.66973837f, -0.67458427f, -0.67940128f,
+-0.68418919f, -0.68894779f, -0.69367688f, -0.69837625f, -0.70304571f,
+-0.70768504f, -0.71229407f, -0.71687258f, -0.72142039f, -0.72593729f,
+-0.73042309f, -0.73487761f, -0.73930064f, -0.74369201f, -0.74805152f,
+-0.75237898f, -0.75667422f, -0.76093704f, -0.76516727f, -0.76936471f,
+-0.77352921f, -0.77766056f, -0.78175861f, -0.78582316f, -0.78985406f,
+-0.79385112f, -0.79781417f, -0.80174305f, -0.80563758f, -0.80949760f,
+-0.81332295f, -0.81711346f, -0.82086896f, -0.82458930f, -0.82827432f,
+-0.83192386f, -0.83553776f, -0.83911587f, -0.84265803f, -0.84616410f,
+-0.84963392f, -0.85306735f, -0.85646423f, -0.85982442f, -0.86314779f,
+-0.86643418f, -0.86968345f, -0.87289547f, -0.87607009f, -0.87920719f,
+-0.88230663f, -0.88536827f, -0.88839199f, -0.89137765f, -0.89432512f,
+-0.89723429f, -0.90010502f, -0.90293719f, -0.90573069f, -0.90848539f,
+-0.91120117f, -0.91387791f, -0.91651551f, -0.91911385f, -0.92167282f,
+-0.92419231f, -0.92667220f, -0.92911240f, -0.93151280f, -0.93387330f,
+-0.93619380f, -0.93847419f, -0.94071438f, -0.94291427f, -0.94507377f,
+-0.94719279f, -0.94927123f, -0.95130901f, -0.95330604f, -0.95526223f,
+-0.95717750f, -0.95905177f, -0.96088496f, -0.96267699f, -0.96442777f,
+-0.96613725f, -0.96780534f, -0.96943197f, -0.97101707f, -0.97256058f,
+-0.97406243f, -0.97552255f, -0.97694089f, -0.97831737f, -0.97965195f,
+-0.98094456f, -0.98219515f, -0.98340367f, -0.98457006f, -0.98569428f,
+-0.98677627f, -0.98781599f, -0.98881340f, -0.98976845f, -0.99068110f,
+-0.99155132f, -0.99237906f, -0.99316428f, -0.99390697f, -0.99460708f,
+-0.99526458f, -0.99587945f, -0.99645166f, -0.99698119f, -0.99746801f,
+-0.99791210f, -0.99831344f, -0.99867202f, -0.99898782f, -0.99926082f,
+-0.99949102f, -0.99967841f, -0.99982297f, -0.99992470f, -0.99998360f,
+0.99999866f, 0.99989157f, 0.99961315f, 0.99916346f, 0.99854256f,
+0.99775057f, 0.99678762f, 0.99565388f, 0.99434953f, 0.99287481f,
+0.99122996f, 0.98941527f, 0.98743105f, 0.98527764f, 0.98295541f,
+0.98046475f, 0.97780610f, 0.97497990f, 0.97198664f, 0.96882685f,
+0.96550104f, 0.96200980f, 0.95835373f, 0.95453345f, 0.95054962f,
+0.94640291f, 0.94209404f, 0.93762375f, 0.93299280f, 0.92820199f,
+0.92325213f, 0.91814408f, 0.91287871f, 0.90745693f, 0.90187965f,
+0.89614785f, 0.89026249f, 0.88422459f, 0.87803519f, 0.87169533f,
+0.86520612f, 0.85856866f, 0.85178409f, 0.84485357f, 0.83777828f,
+0.83055945f, 0.82319831f, 0.81569611f, 0.80805415f, 0.80027373f,
+0.79235620f, 0.78430289f, 0.77611520f, 0.76779452f, 0.75934229f,
+0.75075995f, 0.74204897f, 0.73321084f, 0.72424708f, 0.71515923f,
+0.70594883f, 0.69661748f, 0.68716676f, 0.67759830f, 0.66791374f,
+0.65811474f, 0.64820297f, 0.63818013f, 0.62804795f, 0.61780815f,
+0.60746249f, 0.59701275f, 0.58646072f, 0.57580819f, 0.56505701f,
+0.55420900f, 0.54326604f, 0.53222998f, 0.52110274f, 0.50988620f,
+0.49858230f, 0.48719297f, 0.47572016f, 0.46416584f, 0.45253199f,
+0.44082059f, 0.42903367f, 0.41717323f, 0.40524131f, 0.39323996f,
+0.38117123f, 0.36903718f, 0.35683990f, 0.34458148f, 0.33226402f,
+0.31988962f, 0.30746042f, 0.29497853f, 0.28244610f, 0.26986527f,
+0.25723821f, 0.24456706f, 0.23185402f, 0.21910124f, 0.20631092f,
+0.19348526f, 0.18062644f, 0.16773667f, 0.15481816f, 0.14187312f,
+0.12890377f, 0.11591234f, 0.10290104f, 0.089872115f, 0.076827789f,
+0.063770300f, 0.050701883f, 0.037624779f, 0.024541229f, 0.011453473f,
+-0.0016362454f, -0.014725683f, -0.027812598f, -0.040894747f, -0.053969889f,
+-0.067035784f, -0.080090192f, -0.093130877f, -0.10615561f, -0.11916214f,
+-0.13214826f, -0.14511174f, -0.15805036f, -0.17096189f, -0.18384413f,
+-0.19669487f, -0.20951190f, -0.22229304f, -0.23503609f, -0.24773886f,
+-0.26039919f, -0.27301490f, -0.28558383f, -0.29810383f, -0.31057274f,
+-0.32298845f, -0.33534881f, -0.34765171f, -0.35989504f, -0.37207670f,
+-0.38419461f, -0.39624670f, -0.40823088f, -0.42014512f, -0.43198737f,
+-0.44375560f, -0.45544780f, -0.46706195f, -0.47859608f, -0.49004821f,
+-0.50141636f, -0.51269860f, -0.52389299f, -0.53499762f, -0.54601058f,
+-0.55692998f, -0.56775395f, -0.57848064f, -0.58910822f, -0.59963485f,
+-0.61005873f, -0.62037809f, -0.63059115f, -0.64069616f, -0.65069139f,
+-0.66057513f, -0.67034568f, -0.68000137f, -0.68954054f, -0.69896157f,
+-0.70826283f, -0.71744274f, -0.72649972f, -0.73543221f, -0.74423869f,
+-0.75291765f, -0.76146760f, -0.76988708f, -0.77817464f, -0.78632887f,
+-0.79434836f, -0.80223175f, -0.80997767f, -0.81758481f, -0.82505187f,
+-0.83237755f, -0.83956061f, -0.84659981f, -0.85349396f, -0.86024186f,
+-0.86684237f, -0.87329434f, -0.87959669f, -0.88574831f, -0.89174817f,
+-0.89759523f, -0.90328850f, -0.90882699f, -0.91420976f, -0.91943588f,
+-0.92450446f, -0.92941463f, -0.93416555f, -0.93875641f, -0.94318642f,
+-0.94745482f, -0.95156087f, -0.95550388f, -0.95928317f, -0.96289809f,
+-0.96634802f, -0.96963238f, -0.97275059f, -0.97570213f, -0.97848649f,
+-0.98110318f, -0.98355177f, -0.98583184f, -0.98794298f, -0.98988485f,
+-0.99165711f, -0.99325945f, -0.99469160f, -0.99595331f, -0.99704438f,
+-0.99796460f, -0.99871383f, -0.99929194f, -0.99969882f, -0.99993441f,
+};
+#endif
+
+static const CELTMode mode96000_1920_240 = {
+96000, /* Fs */
+240, /* overlap */
+21, /* nbEBands */
+21, /* effEBands */
+{0.92300415f, 0.22000122f, 1.5128347f, 0.66101074f, }, /* preemph */
+eband5ms, /* eBands */
+3, /* maxLM */
+8, /* nbShortMdcts */
+240, /* shortMdctSize */
+11, /* nbAllocVectors */
+band_allocation, /* allocVectors */
+logN400, /* logN */
+window240, /* window */
+{3840, 3, {&fft_state96000_1920_0, &fft_state96000_1920_1, &fft_state96000_1920_2, &fft_state96000_1920_3, }, mdct_twiddles1920}, /* mdct */
+{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
+#ifdef ENABLE_QEXT
+{86, qext_cache_index50, qext_cache_bits50, qext_cache_caps50}, /* qext_cache */
+#endif
+};
+#endif /* ENABLE_QEXT */
/* List of all the available modes */
+#ifdef ENABLE_QEXT
+#define TOTAL_MODES 2
+static const CELTMode * const static_mode_list[TOTAL_MODES] = {
+&mode48000_960_120,
+&mode96000_1920_240,
+};
+#else
#define TOTAL_MODES 1
static const CELTMode * const static_mode_list[TOTAL_MODES] = {
&mode48000_960_120,
};
+#endif
diff --git a/media/libopus/celt/vq.c b/media/libopus/celt/vq.c
@@ -38,9 +38,37 @@
#include "bands.h"
#include "rate.h"
#include "pitch.h"
+#include "SigProc_FIX.h"
-#if defined(FIXED_POINT) && defined(__mips_dsp) && __mips == 32
-#include "mips/vq_mipsr1.h"
+#if defined(FIXED_POINT)
+void norm_scaleup(celt_norm *X, int N, int shift) {
+ int i;
+ celt_assert(shift >= 0);
+ if (shift <= 0) return;
+ for (i=0;i<N;i++) X[i] = SHL32(X[i], shift);
+}
+
+void norm_scaledown(celt_norm *X, int N, int shift) {
+ int i;
+ celt_assert(shift >= 0);
+ if (shift <= 0) return;
+ for (i=0;i<N;i++) X[i] = PSHR32(X[i], shift);
+}
+
+opus_val32 celt_inner_prod_norm(const celt_norm *x, const celt_norm *y, int len, int arch) {
+ int i;
+ opus_val32 sum = 0;
+ (void)arch;
+ for (i=0;i<len;i++) sum += x[i]*y[i];
+ return sum;
+}
+opus_val32 celt_inner_prod_norm_shift(const celt_norm *x, const celt_norm *y, int len, int arch) {
+ int i;
+ opus_val64 sum = 0;
+ (void)arch;
+ for (i=0;i<len;i++) sum += x[i]*(opus_val64)y[i];
+ return sum>>2*(NORM_SHIFT-14);
+}
#endif
#ifndef OVERRIDE_vq_exp_rotation1
@@ -51,6 +79,7 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_
celt_norm *Xptr;
Xptr = X;
ms = NEG16(s);
+ norm_scaledown(X, len, NORM_SHIFT-14);
for (i=0;i<len-stride;i++)
{
celt_norm x1, x2;
@@ -68,6 +97,7 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_
Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2), s, x1), 15));
*Xptr-- = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
}
+ norm_scaleup(X, len, NORM_SHIFT-14);
}
#endif /* OVERRIDE_vq_exp_rotation1 */
@@ -116,27 +146,37 @@ void exp_rotation(celt_norm *X, int len, int dir, int stride, int K, int spread)
}
}
-/** Takes the pitch vector and the decoded residual vector, computes the gain
- that will give ||p+g*y||=1 and mixes the residual with the pitch. */
+/** Normalizes the decoded integer pvq codeword to unit norm. */
static void normalise_residual(int * OPUS_RESTRICT iy, celt_norm * OPUS_RESTRICT X,
- int N, opus_val32 Ryy, opus_val32 gain)
+ int N, opus_val32 Ryy, opus_val32 gain, int shift)
{
int i;
#ifdef FIXED_POINT
int k;
#endif
opus_val32 t;
- opus_val16 g;
+ opus_val32 g;
#ifdef FIXED_POINT
k = celt_ilog2(Ryy)>>1;
#endif
- t = VSHR32(Ryy, 2*(k-7));
- g = MULT32_32_Q31(celt_rsqrt_norm(t),gain);
-
+ t = VSHR32(Ryy, 2*(k-7)-15);
+ g = MULT32_32_Q31(celt_rsqrt_norm32(t),gain);
i=0;
- do
- X[i] = EXTRACT16(PSHR32(MULT16_16(g, iy[i]), k+1));
+ (void)shift;
+#if defined(FIXED_POINT) && defined(ENABLE_QEXT)
+ if (shift>0) {
+ int tot_shift = NORM_SHIFT+1-k-shift;
+ if (tot_shift >= 0) {
+ do X[i] = MULT32_32_Q31(g, SHL32(iy[i], tot_shift));
+ while (++i < N);
+ } else {
+ do X[i] = MULT32_32_Q31(g, PSHR32(iy[i], -tot_shift));
+ while (++i < N);
+ }
+ } else
+#endif
+ do X[i] = VSHR32(MULT16_32_Q15(iy[i], g), k+15-NORM_SHIFT);
while (++i < N);
}
@@ -176,7 +216,13 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch)
(void)arch;
ALLOC(y, N, celt_norm);
ALLOC(signx, N, int);
-
+#ifdef FIXED_POINT
+ {
+ int shift = (celt_ilog2(1+celt_inner_prod_norm_shift(X, X, N, arch))+1)/2;
+ shift = IMAX(0, shift+(NORM_SHIFT-14)-14);
+ norm_scaledown(X, N, shift);
+ }
+#endif
/* Get rid of the sign */
sum = 0;
j=0; do {
@@ -327,12 +373,187 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch)
return yy;
}
+#ifdef ENABLE_QEXT
+#include "macros.h"
+
+static opus_val32 op_pvq_search_N2(const celt_norm *X, int *iy, int *up_iy, int K, int up, int *refine, int shift) {
+ opus_val32 sum;
+ opus_val32 rcp_sum;
+ int offset;
+ sum = ABS32(X[0]) + ABS32(X[1]);
+ if (sum < EPSILON) {
+ iy[0] = K;
+ up_iy[0] = up*K;
+ iy[1]=up_iy[1]=0;
+ *refine=0;
+#ifdef FIXED_POINT
+ return (opus_val64)K*K*up*up>>2*shift;
+#else
+ (void)shift;
+ return K*(float)K*up*up;
+#endif
+ }
+#ifdef FIXED_POINT
+ int sum_shift;
+ opus_val32 X0;
+ sum_shift = 30-celt_ilog2(sum);
+ rcp_sum = celt_rcp_norm32(SHL32(sum, sum_shift));
+ X0 = MULT32_32_Q31(SHL32(X[0], sum_shift), rcp_sum);
+ iy[0] = PSHR32(MULT32_32_Q31(SHL32(K, 8), X0), 7);
+ up_iy[0] = PSHR32(MULT32_32_Q31(SHL32(up*K, 8), X0), 7);
+#else
+ rcp_sum = 1.f/sum;
+ iy[0] = (int)floor(.5f+K*X[0]*rcp_sum);
+ up_iy[0] = (int)floor(.5f+up*K*X[0]*rcp_sum);
+#endif
+ up_iy[0] = IMAX(up*iy[0] - (up-1)/2, IMIN(up*iy[0] + (up-1)/2, up_iy[0]));
+ offset = up_iy[0] - up*iy[0];
+ iy[1] = K-abs(iy[0]);
+ up_iy[1] = up*K-abs(up_iy[0]);
+ if (X[1] < 0) {
+ iy[1] = -iy[1];
+ up_iy[1] = -up_iy[1];
+ offset = -offset;
+ }
+ *refine = offset;
+#ifdef FIXED_POINT
+ return (up_iy[0]*(opus_val64)up_iy[0] + up_iy[1]*(opus_val64)up_iy[1] + (1<<2*shift>>1))>>2*shift;
+#else
+ return up_iy[0]*(opus_val64)up_iy[0] + up_iy[1]*(opus_val64)up_iy[1];
+#endif
+}
+
+static int op_pvq_refine(const opus_val32 *Xn, int *iy, int *iy0, int K, int up, int margin, int N) {
+ int i;
+ int dir;
+ VARDECL(opus_val32, rounding);
+ int iysum = 0;
+ SAVE_STACK;
+ ALLOC(rounding, N, opus_val32);
+ for (i=0;i<N;i++) {
+ opus_val32 tmp;
+ tmp = MULT32_32_Q31(SHL32(K, 8), Xn[i]);
+#ifdef FIXED_POINT
+ iy[i] = (tmp+64) >> 7;
+#else
+ iy[i] = (int)floor(.5+tmp);
+#endif
+ rounding[i] = tmp - SHL32(iy[i], 7);
+ }
+ if (iy != iy0) {
+ for (i=0;i<N;i++) iy[i] = IMIN(up*iy0[i]+up-1, IMAX(up*iy0[i]-up+1, iy[i]));
+ }
+ for (i=0;i<N;i++) iysum += iy[i];
+ if (abs(iysum - K) > 32) {
+ return 1;
+ }
+ dir = iysum < K ? 1 : -1;
+ while (iysum != K) {
+ opus_val32 roundval=-1000000*dir;
+ int roundpos=0;
+ for (i=0;i<N;i++) {
+ if ((rounding[i]-roundval)*dir > 0 && abs(iy[i]-up*iy0[i]) < (margin-1) && !(dir==-1 && iy[i] == 0)) {
+ roundval = rounding[i];
+ roundpos = i;
+ }
+ }
+ iy[roundpos] += dir;
+ rounding[roundpos] -= SHL32(dir, 15);
+ iysum+=dir;
+ }
+ return 0;
+}
+
+static opus_val32 op_pvq_search_extra(const celt_norm *X, int *iy, int *up_iy, int K, int up, int *refine, int N, int shift) {
+ opus_val32 rcp_sum;
+ opus_val32 sum=0;
+ int i;
+ int failed=0;
+ opus_val64 yy=0;
+ VARDECL(opus_val32, Xn);
+ SAVE_STACK;
+ for (i=0;i<N;i++) sum += ABS32(X[i]);
+ ALLOC(Xn, N, opus_val32);
+ if (sum < EPSILON)
+ failed = 1;
+ else {
+#ifdef FIXED_POINT
+ int sum_shift = 30-celt_ilog2(sum);
+ rcp_sum = celt_rcp_norm32(SHL32(sum, sum_shift));
+ for (i=0;i<N;i++) {
+ Xn[i] = MULT32_32_Q31(SHL32(ABS32(X[i]), sum_shift), rcp_sum);
+ }
+#else
+ rcp_sum = celt_rcp(sum);
+ for (i=0;i<N;i++) {
+ Xn[i] = ABS32(X[i])*rcp_sum;
+ }
+#endif
+ }
+ failed = failed || op_pvq_refine(Xn, iy, iy, K, 1, K+1, N);
+ failed = failed || op_pvq_refine(Xn, up_iy, iy, up*K, up, up, N);
+ if (failed) {
+ iy[0] = K;
+ for (i=1;i<N;i++) iy[i] = 0;
+ up_iy[0] = up*K;
+ for (i=1;i<N;i++) up_iy[i] = 0;
+ }
+ for (i=0;i<N;i++) {
+ yy += up_iy[i]*(opus_val64)up_iy[i];
+ if (X[i] < 0) {
+ iy[i] = -iy[i];
+ up_iy[i] = -up_iy[i];
+ }
+ refine[i] = up_iy[i]-up*iy[i];
+ }
+#ifdef FIXED_POINT
+ return (yy + (1<<2*shift>>1))>>2*shift;
+#else
+ (void)shift;
+ return yy;
+#endif
+}
+#endif
+
+#ifdef ENABLE_QEXT
+/* Take advantage of the fact that "large" refine values are much less likely
+ than smaller ones. */
+static void ec_enc_refine(ec_enc *enc, opus_int32 refine, opus_int32 up, int extra_bits, int use_entropy) {
+ int large;
+ large = abs(refine)>up/2;
+ ec_enc_bit_logp(enc, large, use_entropy ? 3 : 1);
+ if (large) {
+ ec_enc_bits(enc, refine < 0, 1);
+ ec_enc_bits(enc, abs(refine)-up/2-1, extra_bits-1);
+ } else {
+ ec_enc_bits(enc, refine+up/2, extra_bits);
+ }
+}
+
+static int ec_dec_refine(ec_enc *dec, opus_int32 up, int extra_bits, int use_entropy) {
+ int large, refine;
+ large = ec_dec_bit_logp(dec, use_entropy ? 3 : 1);
+ if (large) {
+ int sign = ec_dec_bits(dec, 1);
+ refine = ec_dec_bits(dec, extra_bits-1) + up/2+1;
+ if (sign) refine = -refine;
+ } else {
+ refine = (opus_int32)ec_dec_bits(dec, extra_bits)-up/2;
+ }
+ return refine;
+}
+#endif
+
unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc,
- opus_val32 gain, int resynth, int arch)
+ opus_val32 gain, int resynth
+ ARG_QEXT(ec_enc *ext_enc) ARG_QEXT(int extra_bits), int arch)
{
VARDECL(int, iy);
- opus_val16 yy;
+ opus_val32 yy;
unsigned collapse_mask;
+#ifdef ENABLE_QEXT
+ int yy_shift = 0;
+#endif
SAVE_STACK;
celt_assert2(K>0, "alg_quant() needs at least one pulse");
@@ -343,17 +564,49 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc,
exp_rotation(X, N, 1, B, K, spread);
- yy = op_pvq_search(X, iy, K, N, arch);
-
- encode_pulses(iy, N, K, enc);
+#ifdef ENABLE_QEXT
+ if (N==2 && extra_bits >= 2) {
+ int refine;
+ int up_iy[2];
+ int up;
+ yy_shift = IMAX(0, extra_bits-7);
+ up = (1<<extra_bits)-1;
+ yy = op_pvq_search_N2(X, iy, up_iy, K, up, &refine, yy_shift);
+ collapse_mask = extract_collapse_mask(up_iy, N, B);
+ encode_pulses(iy, N, K, enc);
+ ec_enc_uint(ext_enc, refine+(up-1)/2, up);
+ if (resynth)
+ normalise_residual(up_iy, X, N, yy, gain, yy_shift);
+ } else if (extra_bits >= 2) {
+ int i;
+ VARDECL(int, up_iy);
+ VARDECL(int, refine);
+ int up, use_entropy;
+ ALLOC(up_iy, N, int);
+ ALLOC(refine, N, int);
+ yy_shift = IMAX(0, extra_bits-7);
+ up = (1<<extra_bits)-1;
+ yy = op_pvq_search_extra(X, iy, up_iy, K, up, refine, N, yy_shift);
+ collapse_mask = extract_collapse_mask(up_iy, N, B);
+ encode_pulses(iy, N, K, enc);
+ use_entropy = (ext_enc->storage*8 - ec_tell(ext_enc)) > (unsigned)(N-1)*(extra_bits+3)+1;
+ for (i=0;i<N-1;i++) ec_enc_refine(ext_enc, refine[i], up, extra_bits, use_entropy);
+ if (iy[N-1]==0) ec_enc_bits(ext_enc, up_iy[N-1]<0, 1);
+ if (resynth)
+ normalise_residual(up_iy, X, N, yy, gain, yy_shift);
+ } else
+#endif
+ {
+ yy = op_pvq_search(X, iy, K, N, arch);
+ collapse_mask = extract_collapse_mask(iy, N, B);
+ encode_pulses(iy, N, K, enc);
+ if (resynth)
+ normalise_residual(iy, X, N, yy, gain, 0);
+ }
if (resynth)
- {
- normalise_residual(iy, X, N, yy, gain);
exp_rotation(X, N, -1, B, K, spread);
- }
- collapse_mask = extract_collapse_mask(iy, N, B);
RESTORE_STACK;
return collapse_mask;
}
@@ -361,18 +614,72 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc,
/** Decode pulse vector and combine the result with the pitch vector to produce
the final normalised signal in the current band. */
unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B,
- ec_dec *dec, opus_val32 gain)
+ ec_dec *dec, opus_val32 gain
+ ARG_QEXT(ec_enc *ext_dec) ARG_QEXT(int extra_bits))
{
opus_val32 Ryy;
unsigned collapse_mask;
VARDECL(int, iy);
+ int yy_shift=0;
SAVE_STACK;
celt_assert2(K>0, "alg_unquant() needs at least one pulse");
celt_assert2(N>1, "alg_unquant() needs at least two dimensions");
ALLOC(iy, N, int);
Ryy = decode_pulses(iy, N, K, dec);
- normalise_residual(iy, X, N, Ryy, gain);
+#ifdef ENABLE_QEXT
+ if (N==2 && extra_bits >= 2) {
+ int up;
+ int refine;
+ yy_shift = IMAX(0, extra_bits-7);
+ up = (1<<extra_bits)-1;
+ refine = (opus_int32)ec_dec_uint(ext_dec, up) - (up-1)/2;
+ iy[0] *= up;
+ iy[1] *= up;
+ if (iy[1] == 0) {
+ iy[1] = (iy[0] > 0) ? -refine : refine;
+ iy[0] += (refine*(opus_int64)iy[0] > 0) ? -refine : refine;
+ } else if (iy[1] > 0) {
+ iy[0] += refine;
+ iy[1] -= refine*(iy[0]>0?1:-1);
+ } else {
+ iy[0] -= refine;
+ iy[1] -= refine*(iy[0]>0?1:-1);
+ }
+#ifdef FIXED_POINT
+ Ryy = (iy[0]*(opus_val64)iy[0] + iy[1]*(opus_val64)iy[1] + (1<<2*yy_shift>>1)) >> 2*yy_shift;
+#else
+ Ryy = iy[0]*(opus_val64)iy[0] + iy[1]*(opus_val64)iy[1];
+#endif
+ } else if (extra_bits >= 2) {
+ int i;
+ opus_val64 yy64;
+ VARDECL(int, refine);
+ int up, use_entropy;
+ int sign=0;
+ ALLOC(refine, N, int);
+ yy_shift = IMAX(0, extra_bits-7);
+ up = (1<<extra_bits)-1;
+ use_entropy = (ext_dec->storage*8 - ec_tell(ext_dec)) > (unsigned)(N-1)*(extra_bits+3)+1;
+ for (i=0;i<N-1;i++) refine[i] = ec_dec_refine(ext_dec, up, extra_bits, use_entropy);
+ if (iy[N-1]==0) sign = ec_dec_bits(ext_dec, 1);
+ else sign = iy[N-1] < 0;
+ for (i=0;i<N-1;i++) {
+ iy[i] = iy[i]*up + refine[i];
+ }
+ iy[N-1] = up*K;
+ for (i=0;i<N-1;i++) iy[N-1] -= abs(iy[i]);
+ if (sign) iy[N-1] = -iy[N-1];
+ yy64 = 0;
+ for (i=0;i<N;i++) yy64 += iy[i]*(opus_val64)iy[i];
+#ifdef FIXED_POINT
+ Ryy = (yy64 + (1<<2*yy_shift>>1)) >> 2*yy_shift;
+#else
+ Ryy = yy64;
+#endif
+ }
+#endif
+ normalise_residual(iy, X, N, Ryy, gain, yy_shift);
exp_rotation(X, N, -1, B, K, spread);
collapse_mask = extract_collapse_mask(iy, N, B);
RESTORE_STACK;
@@ -390,7 +697,8 @@ void renormalise_vector(celt_norm *X, int N, opus_val32 gain, int arch)
opus_val16 g;
opus_val32 t;
celt_norm *xptr;
- E = EPSILON + celt_inner_prod(X, X, N, arch);
+ norm_scaledown(X, N, NORM_SHIFT-14);
+ E = EPSILON + celt_inner_prod_norm(X, X, N, arch);
#ifdef FIXED_POINT
k = celt_ilog2(E)>>1;
#endif
@@ -400,43 +708,156 @@ void renormalise_vector(celt_norm *X, int N, opus_val32 gain, int arch)
xptr = X;
for (i=0;i<N;i++)
{
- *xptr = EXTRACT16(PSHR32(MULT16_16(g, *xptr), k+1));
+ *xptr = EXTRACT16(PSHR32(MULT16_16(g, *xptr), k+15-14));
xptr++;
}
+ norm_scaleup(X, N, NORM_SHIFT-14);
/*return celt_sqrt(E);*/
}
#endif /* OVERRIDE_renormalise_vector */
-int stereo_itheta(const celt_norm *X, const celt_norm *Y, int stereo, int N, int arch)
+opus_int32 stereo_itheta(const celt_norm *X, const celt_norm *Y, int stereo, int N, int arch)
{
int i;
int itheta;
- opus_val16 mid, side;
+ opus_val32 mid, side;
opus_val32 Emid, Eside;
- Emid = Eside = EPSILON;
+ Emid = Eside = 0;
if (stereo)
{
for (i=0;i<N;i++)
{
celt_norm m, s;
- m = ADD16(SHR16(X[i],1),SHR16(Y[i],1));
- s = SUB16(SHR16(X[i],1),SHR16(Y[i],1));
+ m = PSHR32(ADD32(X[i], Y[i]), NORM_SHIFT-13);
+ s = PSHR32(SUB32(X[i], Y[i]), NORM_SHIFT-13);
Emid = MAC16_16(Emid, m, m);
Eside = MAC16_16(Eside, s, s);
}
} else {
- Emid += celt_inner_prod(X, X, N, arch);
- Eside += celt_inner_prod(Y, Y, N, arch);
+ Emid += celt_inner_prod_norm_shift(X, X, N, arch);
+ Eside += celt_inner_prod_norm_shift(Y, Y, N, arch);
}
- mid = celt_sqrt(Emid);
- side = celt_sqrt(Eside);
-#ifdef FIXED_POINT
- /* 0.63662 = 2/pi */
- itheta = MULT16_16_Q15(QCONST16(0.63662f,15),celt_atan2p(side, mid));
+ mid = celt_sqrt32(Emid);
+ side = celt_sqrt32(Eside);
+#if defined(FIXED_POINT)
+ itheta = celt_atan2p_norm(side, mid);
#else
- itheta = (int)floor(.5f+16384*0.63662f*fast_atan2f(side,mid));
+ itheta = (int)floor(.5f+65536.f*16384*celt_atan2p_norm(side,mid));
#endif
return itheta;
}
+
+#ifdef ENABLE_QEXT
+
+static void cubic_synthesis(celt_norm *X, int *iy, int N, int K, int face, int sign, opus_val32 gain) {
+ int i;
+ opus_val32 sum=0;
+ opus_val32 mag;
+#ifdef FIXED_POINT
+ int sum_shift;
+ int shift = IMAX(celt_ilog2(K) + celt_ilog2(N)/2 - 13, 0);
+#endif
+ for (i=0;i<N;i++) {
+ X[i] = (1+2*iy[i])-K;
+ }
+ X[face] = sign ? -K : K;
+ for (i=0;i<N;i++) {
+ sum += PSHR32(MULT16_16(X[i],X[i]), 2*shift);
+ }
+#ifdef FIXED_POINT
+ sum_shift = (29-celt_ilog2(sum))>>1;
+ mag = celt_rsqrt_norm32(SHL32(sum, 2*sum_shift+1));
+ for (i=0;i<N;i++) {
+ X[i] = VSHR32(MULT16_32_Q15(X[i],MULT32_32_Q31(mag,gain)), shift-sum_shift+29-NORM_SHIFT);
+ }
+#else
+ mag = 1.f/sqrt(sum);
+ for (i=0;i<N;i++) {
+ X[i] *= mag*gain;
+ }
+#endif
+}
+
+unsigned cubic_quant(celt_norm *X, int N, int res, int B, ec_enc *enc, opus_val32 gain, int resynth) {
+ int i;
+ int face=0;
+ int K;
+ VARDECL(int, iy);
+ celt_norm faceval=-1;
+ opus_val32 norm;
+ int sign;
+ SAVE_STACK;
+ ALLOC(iy, N, int);
+ K = 1<<res;
+ /* Using odd K on transients to avoid adding pre-echo. */
+ if (B!=1) K=IMAX(1, K-1);
+ if (K==1) {
+ if (resynth) OPUS_CLEAR(X, N);
+ RESTORE_STACK;
+ return 0;
+ }
+ for (i=0;i<N;i++) {
+ if (ABS32(X[i]) > faceval) {
+ faceval = ABS32(X[i]);
+ face = i;
+ }
+ }
+ sign = X[face]<0;
+ ec_enc_uint(enc, face, N);
+ ec_enc_bits(enc, sign, 1);
+#ifdef FIXED_POINT
+ if (faceval != 0) {
+ int face_shift = 30-celt_ilog2(faceval);
+ norm = celt_rcp_norm32(SHL32(faceval, face_shift));
+ norm = MULT16_32_Q15(K, norm);
+ for (i=0;i<N;i++) {
+ /* By computing X[i]+faceval inside the shift, the result is guaranteed non-negative. */
+ iy[i] = IMIN(K-1, (MULT32_32_Q31(SHL32(X[i]+faceval, face_shift-1), norm)) >> 15);
+ }
+ } else {
+ OPUS_CLEAR(iy, N);
+ }
+#else
+ norm = .5f*K/(faceval+EPSILON);
+ for (i=0;i<N;i++) {
+ iy[i] = IMIN(K-1, (int)floor((X[i]+faceval)*norm));
+ }
+#endif
+ for (i=0;i<N;i++) {
+ if (i != face) ec_enc_bits(enc, iy[i], res);
+ }
+ if (resynth) {
+ cubic_synthesis(X, iy, N, K, face, sign, gain);
+ }
+ RESTORE_STACK;
+ return (1<<B)-1;
+}
+
+unsigned cubic_unquant(celt_norm *X, int N, int res, int B, ec_dec *dec, opus_val32 gain) {
+ int i;
+ int face;
+ int sign;
+ int K;
+ VARDECL(int, iy);
+ SAVE_STACK;
+ ALLOC(iy, N, int);
+ K = 1<<res;
+ /* Using odd K on transients to avoid adding pre-echo. */
+ if (B!=1) K=IMAX(1, K-1);
+ if (K==1) {
+ OPUS_CLEAR(X, N);
+ return 0;
+ }
+ face = ec_dec_uint(dec, N);
+ sign = ec_dec_bits(dec, 1);
+ for (i=0;i<N;i++) {
+ if (i != face) iy[i] = ec_dec_bits(dec, res);
+ }
+ iy[face]=0;
+ cubic_synthesis(X, iy, N, K, face, sign, gain);
+ RESTORE_STACK;
+ return (1<<B)-1;
+}
+#endif
diff --git a/media/libopus/celt/vq.h b/media/libopus/celt/vq.h
@@ -41,6 +41,20 @@
#include "x86/vq_sse.h"
#endif
+#if defined(FIXED_POINT)
+opus_val32 celt_inner_prod_norm(const celt_norm *x, const celt_norm *y, int len, int arch);
+opus_val32 celt_inner_prod_norm_shift(const celt_norm *x, const celt_norm *y, int len, int arch);
+
+void norm_scaleup(celt_norm *X, int N, int shift);
+void norm_scaledown(celt_norm *X, int N, int shift);
+
+#else
+#define celt_inner_prod_norm celt_inner_prod
+#define celt_inner_prod_norm_shift celt_inner_prod
+#define norm_scaleup(X, N, shift)
+#define norm_scaledown(X, N, shift)
+#endif
+
void exp_rotation(celt_norm *X, int len, int dir, int stride, int K, int spread);
opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch);
@@ -60,7 +74,8 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch);
* @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_val32 gain, int resynth, int arch);
+ opus_val32 gain, int resynth
+ ARG_QEXT(ec_enc *ext_enc) ARG_QEXT(int extra_bits), int arch);
/** Algebraic pulse decoder
* @param X Decoded normalised spectrum (returned)
@@ -70,10 +85,14 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc,
* @ret A mask indicating which blocks in the band received pulses
*/
unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B,
- ec_dec *dec, opus_val32 gain);
+ ec_dec *dec, opus_val32 gain
+ ARG_QEXT(ec_enc *ext_dec) ARG_QEXT(int extra_bits));
void renormalise_vector(celt_norm *X, int N, opus_val32 gain, int arch);
-int stereo_itheta(const celt_norm *X, const celt_norm *Y, int stereo, int N, int arch);
+opus_int32 stereo_itheta(const celt_norm *X, const celt_norm *Y, int stereo, int N, int arch);
+
+unsigned cubic_quant(celt_norm *X, int N, int K, int B, ec_enc *enc, opus_val32 gain, int resynth);
+unsigned cubic_unquant(celt_norm *X, int N, int K, int B, ec_dec *dec, opus_val32 gain);
#endif /* VQ_H */
diff --git a/media/libopus/include/opus.h b/media/libopus/include/opus.h
@@ -167,6 +167,9 @@ typedef struct OpusEncoder OpusEncoder;
* @param[in] channels <tt>int</tt>: Number of channels.
* This must be 1 or 2.
* @returns The size in bytes.
+ * @note Since this function does not take the application as input, it will overestimate
+ * the size required for OPUS_APPLICATION_RESTRICTED_SILK and OPUS_APPLICATION_RESTRICTED_CELT.
+ * That is generally not a problem, except when trying to know the size to use for a copy.
*/
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_encoder_get_size(int channels);
diff --git a/media/libopus/include/opus_custom.h b/media/libopus/include/opus_custom.h
@@ -41,7 +41,7 @@
extern "C" {
#endif
-#ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
# define OPUS_CUSTOM_EXPORT OPUS_EXPORT
# define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT
#else
@@ -141,7 +141,7 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si
int channels
) OPUS_ARG_NONNULL(1);
-# ifdef CUSTOM_MODES
+#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
/** Initializes a previously allocated encoder state
* The memory pointed to by st must be the size returned by opus_custom_encoder_get_size.
* This is intended for applications which use their own allocator instead of malloc.
diff --git a/media/libopus/include/opus_defines.h b/media/libopus/include/opus_defines.h
@@ -175,6 +175,10 @@ extern "C" {
/*#define OPUS_GET_DNN_BLOB_REQUEST 4053 */
#define OPUS_SET_OSCE_BWE_REQUEST 4054
#define OPUS_GET_OSCE_BWE_REQUEST 4055
+#define OPUS_SET_QEXT_REQUEST 4056
+#define OPUS_GET_QEXT_REQUEST 4057
+#define OPUS_SET_IGNORE_EXTENSIONS_REQUEST 4058
+#define OPUS_GET_IGNORE_EXTENSIONS_REQUEST 4059
/** Defines for the presence of extended APIs. */
#define OPUS_HAVE_OPUS_PROJECTION_H
@@ -216,6 +220,10 @@ extern "C" {
/** Only use when lowest-achievable latency is what matters most. Voice-optimized modes cannot be used.
* @hideinitializer */
#define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051
+/** Experts only: forces SILK encoding; don't allocate CELT state at all. Disables OPUS_SET_APPLICATION. */
+#define OPUS_APPLICATION_RESTRICTED_SILK 2052
+/** Experts only: forces CELT encoding; don't allocate SILK state at all. Disables OPUS_SET_APPLICATION. */
+#define OPUS_APPLICATION_RESTRICTED_CELT 2053
#define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is voice */
#define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is music */
@@ -650,6 +658,13 @@ extern "C" {
* @hideinitializer */
#define OPUS_SET_DNN_BLOB(data, len) OPUS_SET_DNN_BLOB_REQUEST, __opus_check_void_ptr(data), __opus_check_int(len)
+/** If set to 1, enables quality extension (QEXT), otherwise disables it (default). Warning: This will *hurt* audio quality unless operating at
+ a very high bitrate.
+ * @hideinitializer */
+#define OPUS_SET_QEXT(x) OPUS_SET_QEXT_REQUEST, __opus_check_int(x)
+/** Gets the encoder's configured quality extension (QEXT).
+ * @hideinitializer */
+#define OPUS_GET_QEXT(x) OPUS_GET_QEXT_REQUEST, __opus_check_int_ptr(x)
/**@}*/
@@ -813,6 +828,13 @@ extern "C" {
* @hideinitializer */
#define OPUS_GET_OSCE_BWE(x) OPUS_GET_OSCE_BWE_REQUEST, __opus_check_int_ptr(x)
+/** If set to 1, enables quality extension (QEXT), otherwise disables it (default). Warning: This will *hurt* audio quality unless operating at
+ a very high bitrate.
+ * @hideinitializer */
+#define OPUS_SET_IGNORE_EXTENSIONS(x) OPUS_SET_IGNORE_EXTENSIONS_REQUEST, __opus_check_int(x)
+/** Gets the encoder's configured quality extension (QEXT).
+ * @hideinitializer */
+#define OPUS_GET_IGNORE_EXTENSIONS(x) OPUS_GET_IGNORE_EXTENSIONS_REQUEST, __opus_check_int_ptr(x)
/**@}*/
diff --git a/media/libopus/moz.build b/media/libopus/moz.build
@@ -21,7 +21,7 @@ FINAL_LIBRARY = "gkcodecs"
NoVisibilityFlags()
DEFINES["OPUS_BUILD"] = True
-DEFINES["OPUS_VERSION"] = "85c3a49d5b069642ac13119645f51f245dbdd023"
+DEFINES["OPUS_VERSION"] = "7f097e0fbf31f0e1b679f863646b3746646ab2a0"
DEFINES["USE_ALLOCA"] = True
DEFINES["ENABLE_HARDENING"] = True
diff --git a/media/libopus/moz.yaml b/media/libopus/moz.yaml
@@ -20,11 +20,11 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
- release: 85c3a49d5b069642ac13119645f51f245dbdd023 (2025-08-27T11:11:06.000-04:00).
+ release: 7f097e0fbf31f0e1b679f863646b3746646ab2a0 (2025-11-07T19:02:42.000-05:00).
# Revision to pull in
# Must be a long or short commit SHA (long preferred)
- revision: 85c3a49d5b069642ac13119645f51f245dbdd023
+ revision: 7f097e0fbf31f0e1b679f863646b3746646ab2a0
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/
diff --git a/media/libopus/silk/API.h b/media/libopus/silk/API.h
@@ -60,7 +60,8 @@ typedef struct {
/* Get size in bytes of the Silk encoder state */
/***********************************************/
opus_int silk_Get_Encoder_Size( /* O Returns error code */
- opus_int *encSizeBytes /* O Number of bytes in SILK encoder state */
+ opus_int *encSizeBytes, /* O Number of bytes in SILK encoder state */
+ opus_int channels /* I Number of channels */
);
/*************************/
@@ -68,6 +69,7 @@ opus_int silk_Get_Encoder_Size( /* O Returns error co
/*************************/
opus_int silk_InitEncoder( /* O Returns error code */
void *encState, /* I/O State */
+ int channels, /* I Number of channels */
int arch, /* I Run-time architecture */
silk_EncControlStruct *encStatus /* O Encoder Status */
);
diff --git a/media/libopus/silk/NSQ.h b/media/libopus/silk/NSQ.h
@@ -98,4 +98,8 @@ static OPUS_INLINE opus_int32 silk_NSQ_noise_shape_feedback_loop_c(const opus_in
#include "arm/NSQ_neon.h"
#endif
+#if defined(__mips)
+#include "mips/NSQ_mips.h"
+#endif
+
#endif /* SILK_NSQ_H */
diff --git a/media/libopus/silk/NSQ_del_dec.c b/media/libopus/silk/NSQ_del_dec.c
@@ -61,9 +61,6 @@ typedef struct {
typedef NSQ_sample_struct NSQ_sample_pair[ 2 ];
-#if defined(FIXED_POINT) && defined(__mips_dsp) && __mips == 32
-#include "mips/NSQ_del_dec_mipsr1.h"
-#endif
static OPUS_INLINE void silk_nsq_del_dec_scale_states(
const silk_encoder_state *psEncC, /* I Encoder State */
silk_nsq_state *NSQ, /* I/O NSQ state */
diff --git a/media/libopus/silk/SigProc_FIX.h b/media/libopus/silk/SigProc_FIX.h
@@ -600,11 +600,13 @@ static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
#define RAND_INCREMENT 907633515
#define silk_RAND(seed) (silk_MLA_ovflw((RAND_INCREMENT), (seed), (RAND_MULTIPLIER)))
-/* Add some multiplication functions that can be easily mapped to ARM. */
+/* Add some multiplication functions that can be easily mapped to ARM/MIPS32. */
/* silk_SMMUL: Signed top word multiply.
ARMv6 2 instruction cycles.
- ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers.(except xM)*/
+ ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers.(except xM)
+ MIPS32 2 instructions mul+mfhi
+ MIPS32r6 1 instruction muh */
/*#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT(silk_SMLAL(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/
/* the following seems faster on x86 */
#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL((a32), (b32)), 32)
diff --git a/media/libopus/silk/check_control_input.c b/media/libopus/silk/check_control_input.c
@@ -46,6 +46,9 @@ opus_int check_control_input(
( encControl->API_sampleRate != 24000 ) &&
( encControl->API_sampleRate != 32000 ) &&
( encControl->API_sampleRate != 44100 ) &&
+#ifdef ENABLE_QEXT
+ ( encControl->API_sampleRate != 96000 ) &&
+#endif
( encControl->API_sampleRate != 48000 ) ) ||
( ( encControl->desiredInternalSampleRate != 8000 ) &&
( encControl->desiredInternalSampleRate != 12000 ) &&
diff --git a/media/libopus/silk/define.h b/media/libopus/silk/define.h
@@ -64,7 +64,11 @@ extern "C"
/* Maximum sampling frequency */
#define MAX_FS_KHZ 16
+#ifdef ENABLE_QEXT
+#define MAX_API_FS_KHZ 96
+#else
#define MAX_API_FS_KHZ 48
+#endif
/* Signal types */
#define TYPE_NO_VOICE_ACTIVITY 0
diff --git a/media/libopus/silk/enc_API.c b/media/libopus/silk/enc_API.c
@@ -58,12 +58,17 @@ static opus_int silk_QueryEncoder( /* O Returns error co
/****************************************/
opus_int silk_Get_Encoder_Size( /* O Returns error code */
- opus_int *encSizeBytes /* O Number of bytes in SILK encoder state */
+ opus_int *encSizeBytes, /* O Number of bytes in SILK encoder state */
+ opus_int channels /* I Number of channels */
)
{
opus_int ret = SILK_NO_ERROR;
*encSizeBytes = sizeof( silk_encoder );
+ /* Skip second encoder state for mono. */
+ if ( channels == 1 ) {
+ *encSizeBytes -= sizeof( silk_encoder_state_Fxx );
+ }
return ret;
}
@@ -73,6 +78,7 @@ opus_int silk_Get_Encoder_Size( /* O Returns error co
/*************************/
opus_int silk_InitEncoder( /* O Returns error code */
void *encState, /* I/O State */
+ int channels, /* I Number of channels */
int arch, /* I Run-time architecture */
silk_EncControlStruct *encStatus /* O Encoder Status */
)
@@ -82,9 +88,9 @@ opus_int silk_InitEncoder( /* O Returns error co
psEnc = (silk_encoder *)encState;
- /* Reset encoder */
- silk_memset( psEnc, 0, sizeof( silk_encoder ) );
- for( n = 0; n < ENCODER_NUM_CHANNELS; n++ ) {
+ /* Reset encoder. Skip second encoder state for mono. */
+ silk_memset( psEnc, 0, sizeof( silk_encoder ) - (channels==1)*sizeof( silk_encoder_state_Fxx ) );
+ for( n = 0; n < channels; n++ ) {
if( ret += silk_init_encoder( &psEnc->state_Fxx[ n ], arch ) ) {
celt_assert( 0 );
}
@@ -162,13 +168,16 @@ opus_int silk_Encode( /* O Returns error co
opus_int transition, curr_block, tot_blocks;
SAVE_STACK;
+ celt_assert( encControl->nChannelsAPI >= encControl->nChannelsInternal && encControl->nChannelsAPI >= psEnc->nChannelsInternal );
if (encControl->reducedDependency)
{
- psEnc->state_Fxx[0].sCmn.first_frame_after_reset = 1;
- psEnc->state_Fxx[1].sCmn.first_frame_after_reset = 1;
+ for( n = 0; n < encControl->nChannelsAPI; n++ ) {
+ psEnc->state_Fxx[ n ].sCmn.first_frame_after_reset = 1;
+ }
+ }
+ for( n = 0; n < encControl->nChannelsAPI; n++ ) {
+ psEnc->state_Fxx[ n ].sCmn.nFramesEncoded = 0;
}
- psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded = psEnc->state_Fxx[ 1 ].sCmn.nFramesEncoded = 0;
-
/* Check values in encoder control structure */
if( ( ret = check_control_input( encControl ) ) != 0 ) {
celt_assert( 0 );
diff --git a/media/libopus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h b/media/libopus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h
@@ -1,336 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, Skype Limited. All rights reserved.
-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.
-- Neither the name of Internet Society, IETF or IETF Trust, nor the
-names of specific contributors, may be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-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 A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-
-/**************************************************************/
-/* Compute noise shaping coefficients and initial gain values */
-/**************************************************************/
-#define OVERRIDE_silk_noise_shape_analysis_FIX
-
-void silk_noise_shape_analysis_FIX(
- silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */
- silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control FIX */
- const opus_int16 *pitch_res, /* I LPC residual from pitch analysis */
- const opus_int16 *x, /* I Input signal [ frame_length + la_shape ] */
- int arch /* I Run-time architecture */
-)
-{
- silk_shape_state_FIX *psShapeSt = &psEnc->sShape;
- opus_int k, i, nSamples, Qnrg, b_Q14, warping_Q16, scale = 0;
- opus_int32 SNR_adj_dB_Q7, HarmBoost_Q16, HarmShapeGain_Q16, Tilt_Q16, tmp32;
- opus_int32 nrg, pre_nrg_Q30, log_energy_Q7, log_energy_prev_Q7, energy_variation_Q7;
- opus_int32 delta_Q16, BWExp1_Q16, BWExp2_Q16, gain_mult_Q16, gain_add_Q16, strength_Q16, b_Q8;
- opus_int32 auto_corr[ MAX_SHAPE_LPC_ORDER + 1 ];
- opus_int32 refl_coef_Q16[ MAX_SHAPE_LPC_ORDER ];
- opus_int32 AR1_Q24[ MAX_SHAPE_LPC_ORDER ];
- opus_int32 AR2_Q24[ MAX_SHAPE_LPC_ORDER ];
- VARDECL( opus_int16, x_windowed );
- const opus_int16 *x_ptr, *pitch_res_ptr;
- SAVE_STACK;
-
- /* Point to start of first LPC analysis block */
- x_ptr = x - psEnc->sCmn.la_shape;
-
- /****************/
- /* GAIN CONTROL */
- /****************/
- SNR_adj_dB_Q7 = psEnc->sCmn.SNR_dB_Q7;
-
- /* Input quality is the average of the quality in the lowest two VAD bands */
- psEncCtrl->input_quality_Q14 = ( opus_int )silk_RSHIFT( (opus_int32)psEnc->sCmn.input_quality_bands_Q15[ 0 ]
- + psEnc->sCmn.input_quality_bands_Q15[ 1 ], 2 );
-
- /* Coding quality level, between 0.0_Q0 and 1.0_Q0, but in Q14 */
- psEncCtrl->coding_quality_Q14 = silk_RSHIFT( silk_sigm_Q15( silk_RSHIFT_ROUND( SNR_adj_dB_Q7 -
- SILK_FIX_CONST( 20.0, 7 ), 4 ) ), 1 );
-
- /* Reduce coding SNR during low speech activity */
- if( psEnc->sCmn.useCBR == 0 ) {
- b_Q8 = SILK_FIX_CONST( 1.0, 8 ) - psEnc->sCmn.speech_activity_Q8;
- b_Q8 = silk_SMULWB( silk_LSHIFT( b_Q8, 8 ), b_Q8 );
- SNR_adj_dB_Q7 = silk_SMLAWB( SNR_adj_dB_Q7,
- silk_SMULBB( SILK_FIX_CONST( -BG_SNR_DECR_dB, 7 ) >> ( 4 + 1 ), b_Q8 ), /* Q11*/
- silk_SMULWB( SILK_FIX_CONST( 1.0, 14 ) + psEncCtrl->input_quality_Q14, psEncCtrl->coding_quality_Q14 ) ); /* Q12*/
- }
-
- if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
- /* Reduce gains for periodic signals */
- SNR_adj_dB_Q7 = silk_SMLAWB( SNR_adj_dB_Q7, SILK_FIX_CONST( HARM_SNR_INCR_dB, 8 ), psEnc->LTPCorr_Q15 );
- } else {
- /* For unvoiced signals and low-quality input, adjust the quality slower than SNR_dB setting */
- SNR_adj_dB_Q7 = silk_SMLAWB( SNR_adj_dB_Q7,
- silk_SMLAWB( SILK_FIX_CONST( 6.0, 9 ), -SILK_FIX_CONST( 0.4, 18 ), psEnc->sCmn.SNR_dB_Q7 ),
- SILK_FIX_CONST( 1.0, 14 ) - psEncCtrl->input_quality_Q14 );
- }
-
- /*************************/
- /* SPARSENESS PROCESSING */
- /*************************/
- /* Set quantizer offset */
- if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
- /* Initially set to 0; may be overruled in process_gains(..) */
- psEnc->sCmn.indices.quantOffsetType = 0;
- psEncCtrl->sparseness_Q8 = 0;
- } else {
- /* Sparseness measure, based on relative fluctuations of energy per 2 milliseconds */
- nSamples = silk_LSHIFT( psEnc->sCmn.fs_kHz, 1 );
- energy_variation_Q7 = 0;
- log_energy_prev_Q7 = 0;
- pitch_res_ptr = pitch_res;
- for( k = 0; k < silk_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr ) / 2; k++ ) {
- silk_sum_sqr_shift( &nrg, &scale, pitch_res_ptr, nSamples );
- nrg += silk_RSHIFT( nSamples, scale ); /* Q(-scale)*/
-
- log_energy_Q7 = silk_lin2log( nrg );
- if( k > 0 ) {
- energy_variation_Q7 += silk_abs( log_energy_Q7 - log_energy_prev_Q7 );
- }
- log_energy_prev_Q7 = log_energy_Q7;
- pitch_res_ptr += nSamples;
- }
-
- psEncCtrl->sparseness_Q8 = silk_RSHIFT( silk_sigm_Q15( silk_SMULWB( energy_variation_Q7 -
- SILK_FIX_CONST( 5.0, 7 ), SILK_FIX_CONST( 0.1, 16 ) ) ), 7 );
-
- /* Set quantization offset depending on sparseness measure */
- if( psEncCtrl->sparseness_Q8 > SILK_FIX_CONST( SPARSENESS_THRESHOLD_QNT_OFFSET, 8 ) ) {
- psEnc->sCmn.indices.quantOffsetType = 0;
- } else {
- psEnc->sCmn.indices.quantOffsetType = 1;
- }
-
- /* Increase coding SNR for sparse signals */
- SNR_adj_dB_Q7 = silk_SMLAWB( SNR_adj_dB_Q7, SILK_FIX_CONST( SPARSE_SNR_INCR_dB, 15 ), psEncCtrl->sparseness_Q8 - SILK_FIX_CONST( 0.5, 8 ) );
- }
-
- /*******************************/
- /* Control bandwidth expansion */
- /*******************************/
- /* More BWE for signals with high prediction gain */
- strength_Q16 = silk_SMULWB( psEncCtrl->predGain_Q16, SILK_FIX_CONST( FIND_PITCH_WHITE_NOISE_FRACTION, 16 ) );
- BWExp1_Q16 = BWExp2_Q16 = silk_DIV32_varQ( SILK_FIX_CONST( BANDWIDTH_EXPANSION, 16 ),
- silk_SMLAWW( SILK_FIX_CONST( 1.0, 16 ), strength_Q16, strength_Q16 ), 16 );
- delta_Q16 = silk_SMULWB( SILK_FIX_CONST( 1.0, 16 ) - silk_SMULBB( 3, psEncCtrl->coding_quality_Q14 ),
- SILK_FIX_CONST( LOW_RATE_BANDWIDTH_EXPANSION_DELTA, 16 ) );
- BWExp1_Q16 = silk_SUB32( BWExp1_Q16, delta_Q16 );
- BWExp2_Q16 = silk_ADD32( BWExp2_Q16, delta_Q16 );
- /* BWExp1 will be applied after BWExp2, so make it relative */
- BWExp1_Q16 = silk_DIV32_16( silk_LSHIFT( BWExp1_Q16, 14 ), silk_RSHIFT( BWExp2_Q16, 2 ) );
-
- if( psEnc->sCmn.warping_Q16 > 0 ) {
- /* Slightly more warping in analysis will move quantization noise up in frequency, where it's better masked */
- warping_Q16 = silk_SMLAWB( psEnc->sCmn.warping_Q16, (opus_int32)psEncCtrl->coding_quality_Q14, SILK_FIX_CONST( 0.01, 18 ) );
- } else {
- warping_Q16 = 0;
- }
-
- /********************************************/
- /* Compute noise shaping AR coefs and gains */
- /********************************************/
- ALLOC( x_windowed, psEnc->sCmn.shapeWinLength, opus_int16 );
- for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
- /* Apply window: sine slope followed by flat part followed by cosine slope */
- opus_int shift, slope_part, flat_part;
- flat_part = psEnc->sCmn.fs_kHz * 3;
- slope_part = silk_RSHIFT( psEnc->sCmn.shapeWinLength - flat_part, 1 );
-
- silk_apply_sine_window( x_windowed, x_ptr, 1, slope_part );
- shift = slope_part;
- silk_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(opus_int16) );
- shift += flat_part;
- silk_apply_sine_window( x_windowed + shift, x_ptr + shift, 2, slope_part );
-
- /* Update pointer: next LPC analysis block */
- x_ptr += psEnc->sCmn.subfr_length;
-
- if( psEnc->sCmn.warping_Q16 > 0 ) {
- /* Calculate warped auto correlation */
- silk_warped_autocorrelation_FIX( auto_corr, &scale, x_windowed, warping_Q16, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder, arch );
- } else {
- /* Calculate regular auto correlation */
- silk_autocorr( auto_corr, &scale, x_windowed, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder + 1, arch );
- }
-
- /* Add white noise, as a fraction of energy */
- auto_corr[0] = silk_ADD32( auto_corr[0], silk_max_32( silk_SMULWB( silk_RSHIFT( auto_corr[ 0 ], 4 ),
- SILK_FIX_CONST( SHAPE_WHITE_NOISE_FRACTION, 20 ) ), 1 ) );
-
- /* Calculate the reflection coefficients using schur */
- nrg = silk_schur64( refl_coef_Q16, auto_corr, psEnc->sCmn.shapingLPCOrder );
- silk_assert( nrg >= 0 );
-
- /* Convert reflection coefficients to prediction coefficients */
- silk_k2a_Q16( AR2_Q24, refl_coef_Q16, psEnc->sCmn.shapingLPCOrder );
-
- Qnrg = -scale; /* range: -12...30*/
- silk_assert( Qnrg >= -12 );
- silk_assert( Qnrg <= 30 );
-
- /* Make sure that Qnrg is an even number */
- if( Qnrg & 1 ) {
- Qnrg -= 1;
- nrg >>= 1;
- }
-
- tmp32 = silk_SQRT_APPROX( nrg );
- Qnrg >>= 1; /* range: -6...15*/
-
- psEncCtrl->Gains_Q16[ k ] = (silk_LSHIFT32( silk_LIMIT( (tmp32), silk_RSHIFT32( silk_int32_MIN, (16 - Qnrg) ), \
- silk_RSHIFT32( silk_int32_MAX, (16 - Qnrg) ) ), (16 - Qnrg) ));
-
- if( psEnc->sCmn.warping_Q16 > 0 ) {
- /* Adjust gain for warping */
- gain_mult_Q16 = warped_gain( AR2_Q24, warping_Q16, psEnc->sCmn.shapingLPCOrder );
- silk_assert( psEncCtrl->Gains_Q16[ k ] >= 0 );
- if ( silk_SMULWW( silk_RSHIFT_ROUND( psEncCtrl->Gains_Q16[ k ], 1 ), gain_mult_Q16 ) >= ( silk_int32_MAX >> 1 ) ) {
- psEncCtrl->Gains_Q16[ k ] = silk_int32_MAX;
- } else {
- psEncCtrl->Gains_Q16[ k ] = silk_SMULWW( psEncCtrl->Gains_Q16[ k ], gain_mult_Q16 );
- }
- }
-
- /* Bandwidth expansion for synthesis filter shaping */
- silk_bwexpander_32( AR2_Q24, psEnc->sCmn.shapingLPCOrder, BWExp2_Q16 );
-
- /* Compute noise shaping filter coefficients */
- silk_memcpy( AR1_Q24, AR2_Q24, psEnc->sCmn.shapingLPCOrder * sizeof( opus_int32 ) );
-
- /* Bandwidth expansion for analysis filter shaping */
- silk_assert( BWExp1_Q16 <= SILK_FIX_CONST( 1.0, 16 ) );
- silk_bwexpander_32( AR1_Q24, psEnc->sCmn.shapingLPCOrder, BWExp1_Q16 );
-
- /* Ratio of prediction gains, in energy domain */
- pre_nrg_Q30 = silk_LPC_inverse_pred_gain_Q24( AR2_Q24, psEnc->sCmn.shapingLPCOrder, arch );
- nrg = silk_LPC_inverse_pred_gain_Q24( AR1_Q24, psEnc->sCmn.shapingLPCOrder, arch );
-
- /*psEncCtrl->GainsPre[ k ] = 1.0f - 0.7f * ( 1.0f - pre_nrg / nrg ) = 0.3f + 0.7f * pre_nrg / nrg;*/
- pre_nrg_Q30 = silk_LSHIFT32( silk_SMULWB( pre_nrg_Q30, SILK_FIX_CONST( 0.7, 15 ) ), 1 );
- psEncCtrl->GainsPre_Q14[ k ] = ( opus_int ) SILK_FIX_CONST( 0.3, 14 ) + silk_DIV32_varQ( pre_nrg_Q30, nrg, 14 );
-
- /* Convert to monic warped prediction coefficients and limit absolute values */
- limit_warped_coefs( AR2_Q24, AR1_Q24, warping_Q16, SILK_FIX_CONST( 3.999, 24 ), psEnc->sCmn.shapingLPCOrder );
-
- /* Convert from Q24 to Q13 and store in int16 */
- for( i = 0; i < psEnc->sCmn.shapingLPCOrder; i++ ) {
- psEncCtrl->AR1_Q13[ k * MAX_SHAPE_LPC_ORDER + i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( AR1_Q24[ i ], 11 ) );
- psEncCtrl->AR2_Q13[ k * MAX_SHAPE_LPC_ORDER + i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( AR2_Q24[ i ], 11 ) );
- }
- }
-
- /*****************/
- /* Gain tweaking */
- /*****************/
- /* Increase gains during low speech activity and put lower limit on gains */
- gain_mult_Q16 = silk_log2lin( -silk_SMLAWB( -SILK_FIX_CONST( 16.0, 7 ), SNR_adj_dB_Q7, SILK_FIX_CONST( 0.16, 16 ) ) );
- gain_add_Q16 = silk_log2lin( silk_SMLAWB( SILK_FIX_CONST( 16.0, 7 ), SILK_FIX_CONST( MIN_QGAIN_DB, 7 ), SILK_FIX_CONST( 0.16, 16 ) ) );
- silk_assert( gain_mult_Q16 > 0 );
- for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
- psEncCtrl->Gains_Q16[ k ] = silk_SMULWW( psEncCtrl->Gains_Q16[ k ], gain_mult_Q16 );
- silk_assert( psEncCtrl->Gains_Q16[ k ] >= 0 );
- psEncCtrl->Gains_Q16[ k ] = silk_ADD_POS_SAT32( psEncCtrl->Gains_Q16[ k ], gain_add_Q16 );
- }
-
- gain_mult_Q16 = SILK_FIX_CONST( 1.0, 16 ) + silk_RSHIFT_ROUND( silk_MLA( SILK_FIX_CONST( INPUT_TILT, 26 ),
- psEncCtrl->coding_quality_Q14, SILK_FIX_CONST( HIGH_RATE_INPUT_TILT, 12 ) ), 10 );
- for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
- psEncCtrl->GainsPre_Q14[ k ] = silk_SMULWB( gain_mult_Q16, psEncCtrl->GainsPre_Q14[ k ] );
- }
-
- /************************************************/
- /* Control low-frequency shaping and noise tilt */
- /************************************************/
- /* Less low frequency shaping for noisy inputs */
- strength_Q16 = silk_MUL( SILK_FIX_CONST( LOW_FREQ_SHAPING, 4 ), silk_SMLAWB( SILK_FIX_CONST( 1.0, 12 ),
- SILK_FIX_CONST( LOW_QUALITY_LOW_FREQ_SHAPING_DECR, 13 ), psEnc->sCmn.input_quality_bands_Q15[ 0 ] - SILK_FIX_CONST( 1.0, 15 ) ) );
- strength_Q16 = silk_RSHIFT( silk_MUL( strength_Q16, psEnc->sCmn.speech_activity_Q8 ), 8 );
- if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
- /* Reduce low frequencies quantization noise for periodic signals, depending on pitch lag */
- /*f = 400; freqz([1, -0.98 + 2e-4 * f], [1, -0.97 + 7e-4 * f], 2^12, Fs); axis([0, 1000, -10, 1])*/
- opus_int fs_kHz_inv = silk_DIV32_16( SILK_FIX_CONST( 0.2, 14 ), psEnc->sCmn.fs_kHz );
- for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
- b_Q14 = fs_kHz_inv + silk_DIV32_16( SILK_FIX_CONST( 3.0, 14 ), psEncCtrl->pitchL[ k ] );
- /* Pack two coefficients in one int32 */
- psEncCtrl->LF_shp_Q14[ k ] = silk_LSHIFT( SILK_FIX_CONST( 1.0, 14 ) - b_Q14 - silk_SMULWB( strength_Q16, b_Q14 ), 16 );
- psEncCtrl->LF_shp_Q14[ k ] |= (opus_uint16)( b_Q14 - SILK_FIX_CONST( 1.0, 14 ) );
- }
- silk_assert( SILK_FIX_CONST( HARM_HP_NOISE_COEF, 24 ) < SILK_FIX_CONST( 0.5, 24 ) ); /* Guarantees that second argument to SMULWB() is within range of an opus_int16*/
- Tilt_Q16 = - SILK_FIX_CONST( HP_NOISE_COEF, 16 ) -
- silk_SMULWB( SILK_FIX_CONST( 1.0, 16 ) - SILK_FIX_CONST( HP_NOISE_COEF, 16 ),
- silk_SMULWB( SILK_FIX_CONST( HARM_HP_NOISE_COEF, 24 ), psEnc->sCmn.speech_activity_Q8 ) );
- } else {
- b_Q14 = silk_DIV32_16( 21299, psEnc->sCmn.fs_kHz ); /* 1.3_Q0 = 21299_Q14*/
- /* Pack two coefficients in one int32 */
- psEncCtrl->LF_shp_Q14[ 0 ] = silk_LSHIFT( SILK_FIX_CONST( 1.0, 14 ) - b_Q14 -
- silk_SMULWB( strength_Q16, silk_SMULWB( SILK_FIX_CONST( 0.6, 16 ), b_Q14 ) ), 16 );
- psEncCtrl->LF_shp_Q14[ 0 ] |= (opus_uint16)( b_Q14 - SILK_FIX_CONST( 1.0, 14 ) );
- for( k = 1; k < psEnc->sCmn.nb_subfr; k++ ) {
- psEncCtrl->LF_shp_Q14[ k ] = psEncCtrl->LF_shp_Q14[ 0 ];
- }
- Tilt_Q16 = -SILK_FIX_CONST( HP_NOISE_COEF, 16 );
- }
-
- /****************************/
- /* HARMONIC SHAPING CONTROL */
- /****************************/
- /* Control boosting of harmonic frequencies */
- HarmBoost_Q16 = silk_SMULWB( silk_SMULWB( SILK_FIX_CONST( 1.0, 17 ) - silk_LSHIFT( psEncCtrl->coding_quality_Q14, 3 ),
- psEnc->LTPCorr_Q15 ), SILK_FIX_CONST( LOW_RATE_HARMONIC_BOOST, 16 ) );
-
- /* More harmonic boost for noisy input signals */
- HarmBoost_Q16 = silk_SMLAWB( HarmBoost_Q16,
- SILK_FIX_CONST( 1.0, 16 ) - silk_LSHIFT( psEncCtrl->input_quality_Q14, 2 ), SILK_FIX_CONST( LOW_INPUT_QUALITY_HARMONIC_BOOST, 16 ) );
-
- if( USE_HARM_SHAPING && psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
- /* More harmonic noise shaping for high bitrates or noisy input */
- HarmShapeGain_Q16 = silk_SMLAWB( SILK_FIX_CONST( HARMONIC_SHAPING, 16 ),
- SILK_FIX_CONST( 1.0, 16 ) - silk_SMULWB( SILK_FIX_CONST( 1.0, 18 ) - silk_LSHIFT( psEncCtrl->coding_quality_Q14, 4 ),
- psEncCtrl->input_quality_Q14 ), SILK_FIX_CONST( HIGH_RATE_OR_LOW_QUALITY_HARMONIC_SHAPING, 16 ) );
-
- /* Less harmonic noise shaping for less periodic signals */
- HarmShapeGain_Q16 = silk_SMULWB( silk_LSHIFT( HarmShapeGain_Q16, 1 ),
- silk_SQRT_APPROX( silk_LSHIFT( psEnc->LTPCorr_Q15, 15 ) ) );
- } else {
- HarmShapeGain_Q16 = 0;
- }
-
- /*************************/
- /* Smooth over subframes */
- /*************************/
- for( k = 0; k < MAX_NB_SUBFR; k++ ) {
- psShapeSt->HarmBoost_smth_Q16 =
- silk_SMLAWB( psShapeSt->HarmBoost_smth_Q16, HarmBoost_Q16 - psShapeSt->HarmBoost_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) );
- psShapeSt->HarmShapeGain_smth_Q16 =
- silk_SMLAWB( psShapeSt->HarmShapeGain_smth_Q16, HarmShapeGain_Q16 - psShapeSt->HarmShapeGain_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) );
- psShapeSt->Tilt_smth_Q16 =
- silk_SMLAWB( psShapeSt->Tilt_smth_Q16, Tilt_Q16 - psShapeSt->Tilt_smth_Q16, SILK_FIX_CONST( SUBFR_SMTH_COEF, 16 ) );
-
- psEncCtrl->HarmBoost_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psShapeSt->HarmBoost_smth_Q16, 2 );
- psEncCtrl->HarmShapeGain_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psShapeSt->HarmShapeGain_smth_Q16, 2 );
- psEncCtrl->Tilt_Q14[ k ] = ( opus_int )silk_RSHIFT_ROUND( psShapeSt->Tilt_smth_Q16, 2 );
- }
- RESTORE_STACK;
-}
diff --git a/media/libopus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h b/media/libopus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h
@@ -34,14 +34,36 @@ POSSIBILITY OF SUCH DAMAGE.
#include "main_FIX.h"
+#if defined (__mips_dsp) && __mips == 32
+
+#define MIPS_MADD __builtin_mips_madd
+#define MIPS_SHILO __builtin_mips_shilo
+
+#define OVERRIDE_silk_warped_autocorrelation_FIX_c
+
+#elif defined (__mips_isa_rev) && __mips == 32
+
+static inline long long MIPS_MADD(long long acc, int a, int b) {
+ return acc + (long long)a * b;
+}
+
+static inline long long MIPS_SHILO(long long acc, int sh) {
+ return (sh >= 0) ? (acc >> sh) : (acc << -sh);
+}
+
+#define OVERRIDE_silk_warped_autocorrelation_FIX_c
+
+#endif
+
+/* Autocorrelations for a warped frequency axis */
+#if defined (OVERRIDE_silk_warped_autocorrelation_FIX_c)
+
#undef QC
#define QC 10
#undef QS
#define QS 14
-/* Autocorrelations for a warped frequency axis */
-#define OVERRIDE_silk_warped_autocorrelation_FIX_c
void silk_warped_autocorrelation_FIX_c(
opus_int32 *corr, /* O Result [order + 1] */
opus_int *scale, /* O Scaling of the correlation vector */
@@ -79,39 +101,39 @@ void silk_warped_autocorrelation_FIX_c(
for( i = 0; i < order; i += 2 ) {
/* Output of allpass section */
tmp2_QS = silk_SMLAWB( state_QS[ i ], state_QS[ i + 1 ] - tmp1_QS, warping_Q16 );
- corr_QC[ i ] = __builtin_mips_madd( corr_QC[ i ], tmp1_QS, start_1);
+ corr_QC[ i ] = MIPS_MADD( corr_QC[ i ], tmp1_QS, start_1);
tmp4_QS = silk_SMLAWB( tmp1_QS, tmp2_QS - tmp3_QS, warping_Q16 );
- corr_QC[ i ] = __builtin_mips_madd( corr_QC[ i ], tmp3_QS, start_2);
+ corr_QC[ i ] = MIPS_MADD( corr_QC[ i ], tmp3_QS, start_2);
tmp6_QS = silk_SMLAWB( tmp3_QS, tmp4_QS - tmp5_QS, warping_Q16 );
- corr_QC[ i ] = __builtin_mips_madd( corr_QC[ i ], tmp5_QS, start_3);
+ corr_QC[ i ] = MIPS_MADD( corr_QC[ i ], tmp5_QS, start_3);
tmp8_QS = silk_SMLAWB( tmp5_QS, tmp6_QS - tmp7_QS, warping_Q16 );
state_QS[ i ] = tmp7_QS;
- corr_QC[ i ] = __builtin_mips_madd( corr_QC[ i ], tmp7_QS, state_QS[0]);
+ corr_QC[ i ] = MIPS_MADD( corr_QC[ i ], tmp7_QS, state_QS[0]);
/* Output of allpass section */
tmp1_QS = silk_SMLAWB( state_QS[ i + 1 ], state_QS[ i + 2 ] - tmp2_QS, warping_Q16 );
- corr_QC[ i+1 ] = __builtin_mips_madd( corr_QC[ i+1 ], tmp2_QS, start_1);
+ corr_QC[ i+1 ] = MIPS_MADD( corr_QC[ i+1 ], tmp2_QS, start_1);
tmp3_QS = silk_SMLAWB( tmp2_QS, tmp1_QS - tmp4_QS, warping_Q16 );
- corr_QC[ i+1 ] = __builtin_mips_madd( corr_QC[ i+1 ], tmp4_QS, start_2);
+ corr_QC[ i+1 ] = MIPS_MADD( corr_QC[ i+1 ], tmp4_QS, start_2);
tmp5_QS = silk_SMLAWB( tmp4_QS, tmp3_QS - tmp6_QS, warping_Q16 );
- corr_QC[ i+1 ] = __builtin_mips_madd( corr_QC[ i+1 ], tmp6_QS, start_3);
+ corr_QC[ i+1 ] = MIPS_MADD( corr_QC[ i+1 ], tmp6_QS, start_3);
tmp7_QS = silk_SMLAWB( tmp6_QS, tmp5_QS - tmp8_QS, warping_Q16 );
state_QS[ i + 1 ] = tmp8_QS;
- corr_QC[ i+1 ] = __builtin_mips_madd( corr_QC[ i+1 ], tmp8_QS, state_QS[ 0 ]);
+ corr_QC[ i+1 ] = MIPS_MADD( corr_QC[ i+1 ], tmp8_QS, state_QS[ 0 ]);
}
state_QS[ order ] = tmp7_QS;
- corr_QC[ order ] = __builtin_mips_madd( corr_QC[ order ], tmp1_QS, start_1);
- corr_QC[ order ] = __builtin_mips_madd( corr_QC[ order ], tmp3_QS, start_2);
- corr_QC[ order ] = __builtin_mips_madd( corr_QC[ order ], tmp5_QS, start_3);
- corr_QC[ order ] = __builtin_mips_madd( corr_QC[ order ], tmp7_QS, state_QS[ 0 ]);
+ corr_QC[ order ] = MIPS_MADD( corr_QC[ order ], tmp1_QS, start_1);
+ corr_QC[ order ] = MIPS_MADD( corr_QC[ order ], tmp3_QS, start_2);
+ corr_QC[ order ] = MIPS_MADD( corr_QC[ order ], tmp5_QS, start_3);
+ corr_QC[ order ] = MIPS_MADD( corr_QC[ order ], tmp7_QS, state_QS[ 0 ]);
}
for(;n< length; n++ ) {
@@ -124,19 +146,19 @@ void silk_warped_autocorrelation_FIX_c(
/* Output of allpass section */
tmp2_QS = silk_SMLAWB( state_QS[ i ], state_QS[ i + 1 ] - tmp1_QS, warping_Q16 );
state_QS[ i ] = tmp1_QS;
- corr_QC[ i ] = __builtin_mips_madd( corr_QC[ i ], tmp1_QS, state_QS[ 0 ]);
+ corr_QC[ i ] = MIPS_MADD( corr_QC[ i ], tmp1_QS, state_QS[ 0 ]);
/* Output of allpass section */
tmp1_QS = silk_SMLAWB( state_QS[ i + 1 ], state_QS[ i + 2 ] - tmp2_QS, warping_Q16 );
state_QS[ i + 1 ] = tmp2_QS;
- corr_QC[ i+1 ] = __builtin_mips_madd( corr_QC[ i+1 ], tmp2_QS, state_QS[ 0 ]);
+ corr_QC[ i+1 ] = MIPS_MADD( corr_QC[ i+1 ], tmp2_QS, state_QS[ 0 ]);
}
state_QS[ order ] = tmp1_QS;
- corr_QC[ order ] = __builtin_mips_madd( corr_QC[ order ], tmp1_QS, state_QS[ 0 ]);
+ corr_QC[ order ] = MIPS_MADD( corr_QC[ order ], tmp1_QS, state_QS[ 0 ]);
}
temp64 = corr_QC[ 0 ];
- temp64 = __builtin_mips_shilo(temp64, val);
+ temp64 = MIPS_SHILO(temp64, val);
lsh = silk_CLZ64( temp64 ) - 35;
lsh = silk_LIMIT( lsh, -12 - QC, 30 - QC );
@@ -145,21 +167,23 @@ void silk_warped_autocorrelation_FIX_c(
if( lsh >= 0 ) {
for( i = 0; i < order + 1; i++ ) {
temp64 = corr_QC[ i ];
- //temp64 = __builtin_mips_shilo(temp64, val);
+ //temp64 = MIPS_SHILO(temp64, val);
temp64 = (val >= 0) ? (temp64 >> val) : (temp64 << -val);
- corr[ i ] = (opus_int32)silk_CHECK_FIT32( __builtin_mips_shilo( temp64, -lsh ) );
+ corr[ i ] = (opus_int32)silk_CHECK_FIT32( MIPS_SHILO( temp64, -lsh ) );
}
} else {
for( i = 0; i < order + 1; i++ ) {
temp64 = corr_QC[ i ];
- //temp64 = __builtin_mips_shilo(temp64, val);
+ //temp64 = MIPS_SHILO(temp64, val);
temp64 = (val >= 0) ? (temp64 >> val) : (temp64 << -val);
- corr[ i ] = (opus_int32)silk_CHECK_FIT32( __builtin_mips_shilo( temp64, -lsh ) );
+ corr[ i ] = (opus_int32)silk_CHECK_FIT32( MIPS_SHILO( temp64, -lsh ) );
}
}
- corr_QC[ 0 ] = __builtin_mips_shilo(corr_QC[ 0 ], val);
+ corr_QC[ 0 ] = MIPS_SHILO(corr_QC[ 0 ], val);
silk_assert( corr_QC[ 0 ] >= 0 ); /* If breaking, decrease QC*/
}
+#endif /* OVERRIDE_silk_warped_autocorrelation_FIX_c */
+
#endif /* __WARPED_AUTOCORRELATION_FIX_MIPSR1_H__ */
diff --git a/media/libopus/silk/fixed/noise_shape_analysis_FIX.c b/media/libopus/silk/fixed/noise_shape_analysis_FIX.c
@@ -128,15 +128,9 @@ static OPUS_INLINE void limit_warped_coefs(
silk_assert( 0 );
}
-/* Disable MIPS DSP version until it's updated. */
-#if 0 && defined(__mips_dsp) && __mips == 32
-#include "mips/noise_shape_analysis_FIX_mipsr1.h"
-#endif
-
/**************************************************************/
/* Compute noise shaping coefficients and initial gain values */
/**************************************************************/
-#ifndef OVERRIDE_silk_noise_shape_analysis_FIX
void silk_noise_shape_analysis_FIX(
silk_encoder_state_FIX *psEnc, /* I/O Encoder state FIX */
silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control FIX */
@@ -404,4 +398,3 @@ void silk_noise_shape_analysis_FIX(
}
RESTORE_STACK;
}
-#endif /* OVERRIDE_silk_noise_shape_analysis_FIX */
diff --git a/media/libopus/silk/fixed/structs_FIX.h b/media/libopus/silk/fixed/structs_FIX.h
@@ -96,7 +96,6 @@ typedef struct {
/* Encoder Super Struct */
/************************/
typedef struct {
- silk_encoder_state_FIX state_Fxx[ ENCODER_NUM_CHANNELS ];
stereo_enc_state sStereo;
opus_int32 nBitsUsedLBRR;
opus_int32 nBitsExceeded;
@@ -106,6 +105,8 @@ typedef struct {
opus_int timeSinceSwitchAllowed_ms;
opus_int allowBandwidthSwitch;
opus_int prev_decode_only_middle;
+ /* This needs to be last so we can skip the second state for mono. */
+ silk_encoder_state_FIX state_Fxx[ ENCODER_NUM_CHANNELS ];
} silk_encoder;
diff --git a/media/libopus/silk/fixed/warped_autocorrelation_FIX.c b/media/libopus/silk/fixed/warped_autocorrelation_FIX.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "main_FIX.h"
-#if defined(__mips_dsp) && __mips == 32
+#if defined(__mips)
#include "mips/warped_autocorrelation_FIX_mipsr1.h"
#endif
diff --git a/media/libopus/silk/float/structs_FLP.h b/media/libopus/silk/float/structs_FLP.h
@@ -93,7 +93,6 @@ typedef struct {
/* Encoder Super Struct */
/************************/
typedef struct {
- silk_encoder_state_FLP state_Fxx[ ENCODER_NUM_CHANNELS ];
stereo_enc_state sStereo;
opus_int32 nBitsUsedLBRR;
opus_int32 nBitsExceeded;
@@ -103,6 +102,8 @@ typedef struct {
opus_int timeSinceSwitchAllowed_ms;
opus_int allowBandwidthSwitch;
opus_int prev_decode_only_middle;
+ /* This needs to be last so we can skip the second state for mono. */
+ silk_encoder_state_FLP state_Fxx[ ENCODER_NUM_CHANNELS ];
} silk_encoder;
#ifdef __cplusplus
diff --git a/media/libopus/silk/macros.h b/media/libopus/silk/macros.h
@@ -104,7 +104,7 @@ POSSIBILITY OF SUCH DAMAGE.
(( (a) & ((b)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a)-(b)) : \
((((a)^0x80000000) & (b) & 0x80000000) ? silk_int32_MAX : (a)-(b)) )
-#if defined(FIXED_POINT) && defined(__mips_dsp) && __mips == 32
+#if defined(FIXED_POINT) && defined(__mips)
#include "mips/macros_mipsr1.h"
#endif
diff --git a/media/libopus/silk/mips/NSQ_del_dec_mipsr1.h b/media/libopus/silk/mips/NSQ_del_dec_mipsr1.h
@@ -1,410 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, Skype Limited. All rights reserved.
-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.
-- Neither the name of Internet Society, IETF or IETF Trust, nor the
-names of specific contributors, may be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-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 A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-#ifndef NSQ_DEL_DEC_MIPSR1_H__
-#define NSQ_DEL_DEC_MIPSR1_H__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "main.h"
-#include "stack_alloc.h"
-
-#define OVERRIDE_silk_noise_shape_quantizer_del_dec
-static inline void silk_noise_shape_quantizer_del_dec(
- silk_nsq_state *NSQ, /* I/O NSQ state */
- NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */
- opus_int signalType, /* I Signal type */
- const opus_int32 x_Q10[], /* I */
- opus_int8 pulses[], /* O */
- opus_int16 xq[], /* O */
- opus_int32 sLTP_Q15[], /* I/O LTP filter state */
- opus_int32 delayedGain_Q10[], /* I/O Gain delay buffer */
- const opus_int16 a_Q12[], /* I Short term prediction coefs */
- const opus_int16 b_Q14[], /* I Long term prediction coefs */
- const opus_int16 AR_shp_Q13[], /* I Noise shaping coefs */
- opus_int lag, /* I Pitch lag */
- opus_int32 HarmShapeFIRPacked_Q14, /* I */
- opus_int Tilt_Q14, /* I Spectral tilt */
- opus_int32 LF_shp_Q14, /* I */
- opus_int32 Gain_Q16, /* I */
- opus_int Lambda_Q10, /* I */
- opus_int offset_Q10, /* I */
- opus_int length, /* I Input length */
- opus_int subfr, /* I Subframe number */
- opus_int shapingLPCOrder, /* I Shaping LPC filter order */
- opus_int predictLPCOrder, /* I Prediction filter order */
- opus_int warping_Q16, /* I */
- opus_int nStatesDelayedDecision, /* I Number of states in decision tree */
- opus_int *smpl_buf_idx, /* I/O Index to newest samples in buffers */
- opus_int decisionDelay, /* I */
- int arch /* I */
-)
-{
- opus_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx;
- opus_int32 Winner_rand_state;
- opus_int32 LTP_pred_Q14, LPC_pred_Q14, n_AR_Q14, n_LTP_Q14;
- opus_int32 n_LF_Q14, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10;
- opus_int32 q1_Q0, q1_Q10, q2_Q10, exc_Q14, LPC_exc_Q14, xq_Q14, Gain_Q10;
- opus_int32 tmp1, tmp2, sLF_AR_shp_Q14;
- opus_int32 *pred_lag_ptr, *shp_lag_ptr, *psLPC_Q14;
- NSQ_sample_struct psSampleState[ MAX_DEL_DEC_STATES ][ 2 ];
- NSQ_del_dec_struct *psDD;
- NSQ_sample_struct *psSS;
- opus_int16 b_Q14_0, b_Q14_1, b_Q14_2, b_Q14_3, b_Q14_4;
- opus_int16 a_Q12_0, a_Q12_1, a_Q12_2, a_Q12_3, a_Q12_4, a_Q12_5, a_Q12_6;
- opus_int16 a_Q12_7, a_Q12_8, a_Q12_9, a_Q12_10, a_Q12_11, a_Q12_12, a_Q12_13;
- opus_int16 a_Q12_14, a_Q12_15;
-
- opus_int32 cur, prev, next;
-
- /*Unused.*/
- (void)arch;
-
- //Initialize b_Q14 variables
- b_Q14_0 = b_Q14[ 0 ];
- b_Q14_1 = b_Q14[ 1 ];
- b_Q14_2 = b_Q14[ 2 ];
- b_Q14_3 = b_Q14[ 3 ];
- b_Q14_4 = b_Q14[ 4 ];
-
- //Initialize a_Q12 variables
- a_Q12_0 = a_Q12[0];
- a_Q12_1 = a_Q12[1];
- a_Q12_2 = a_Q12[2];
- a_Q12_3 = a_Q12[3];
- a_Q12_4 = a_Q12[4];
- a_Q12_5 = a_Q12[5];
- a_Q12_6 = a_Q12[6];
- a_Q12_7 = a_Q12[7];
- a_Q12_8 = a_Q12[8];
- a_Q12_9 = a_Q12[9];
- a_Q12_10 = a_Q12[10];
- a_Q12_11 = a_Q12[11];
- a_Q12_12 = a_Q12[12];
- a_Q12_13 = a_Q12[13];
- a_Q12_14 = a_Q12[14];
- a_Q12_15 = a_Q12[15];
-
- long long temp64;
-
- silk_assert( nStatesDelayedDecision > 0 );
-
- shp_lag_ptr = &NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_FIR_TAPS / 2 ];
- pred_lag_ptr = &sLTP_Q15[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ];
- Gain_Q10 = silk_RSHIFT( Gain_Q16, 6 );
-
- for( i = 0; i < length; i++ ) {
- /* Perform common calculations used in all states */
-
- /* Long-term prediction */
- if( signalType == TYPE_VOICED ) {
- /* Unrolled loop */
- /* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */
- temp64 = __builtin_mips_mult(pred_lag_ptr[ 0 ], b_Q14_0 );
- temp64 = __builtin_mips_madd( temp64, pred_lag_ptr[ -1 ], b_Q14_1 );
- temp64 = __builtin_mips_madd( temp64, pred_lag_ptr[ -2 ], b_Q14_2 );
- temp64 = __builtin_mips_madd( temp64, pred_lag_ptr[ -3 ], b_Q14_3 );
- temp64 = __builtin_mips_madd( temp64, pred_lag_ptr[ -4 ], b_Q14_4 );
- temp64 += 32768;
- LTP_pred_Q14 = __builtin_mips_extr_w(temp64, 16);
- LTP_pred_Q14 = silk_LSHIFT( LTP_pred_Q14, 1 ); /* Q13 -> Q14 */
- pred_lag_ptr++;
- } else {
- LTP_pred_Q14 = 0;
- }
-
- /* Long-term shaping */
- if( lag > 0 ) {
- /* Symmetric, packed FIR coefficients */
- n_LTP_Q14 = silk_SMULWB( silk_ADD32( shp_lag_ptr[ 0 ], shp_lag_ptr[ -2 ] ), HarmShapeFIRPacked_Q14 );
- n_LTP_Q14 = silk_SMLAWT( n_LTP_Q14, shp_lag_ptr[ -1 ], HarmShapeFIRPacked_Q14 );
- n_LTP_Q14 = silk_SUB_LSHIFT32( LTP_pred_Q14, n_LTP_Q14, 2 ); /* Q12 -> Q14 */
- shp_lag_ptr++;
- } else {
- n_LTP_Q14 = 0;
- }
-
- for( k = 0; k < nStatesDelayedDecision; k++ ) {
- /* Delayed decision state */
- psDD = &psDelDec[ k ];
-
- /* Sample state */
- psSS = psSampleState[ k ];
-
- /* Generate dither */
- psDD->Seed = silk_RAND( psDD->Seed );
-
- /* Pointer used in short term prediction and shaping */
- psLPC_Q14 = &psDD->sLPC_Q14[ NSQ_LPC_BUF_LENGTH - 1 + i ];
- /* Short-term prediction */
- silk_assert( predictLPCOrder == 10 || predictLPCOrder == 16 );
- temp64 = __builtin_mips_mult(psLPC_Q14[ 0 ], a_Q12_0 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -1 ], a_Q12_1 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -2 ], a_Q12_2 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -3 ], a_Q12_3 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -4 ], a_Q12_4 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -5 ], a_Q12_5 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -6 ], a_Q12_6 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -7 ], a_Q12_7 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -8 ], a_Q12_8 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -9 ], a_Q12_9 );
- if( predictLPCOrder == 16 ) {
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -10 ], a_Q12_10 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -11 ], a_Q12_11 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -12 ], a_Q12_12 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -13 ], a_Q12_13 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -14 ], a_Q12_14 );
- temp64 = __builtin_mips_madd( temp64, psLPC_Q14[ -15 ], a_Q12_15 );
- }
- temp64 += 32768;
- LPC_pred_Q14 = __builtin_mips_extr_w(temp64, 16);
-
- LPC_pred_Q14 = silk_LSHIFT( LPC_pred_Q14, 4 ); /* Q10 -> Q14 */
-
- /* Noise shape feedback */
- silk_assert( ( shapingLPCOrder & 1 ) == 0 ); /* check that order is even */
- /* Output of lowpass section */
- tmp2 = silk_SMLAWB( psLPC_Q14[ 0 ], psDD->sAR2_Q14[ 0 ], warping_Q16 );
- /* Output of allpass section */
- tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ 0 ], psDD->sAR2_Q14[ 1 ] - tmp2, warping_Q16 );
- psDD->sAR2_Q14[ 0 ] = tmp2;
-
- temp64 = __builtin_mips_mult(tmp2, AR_shp_Q13[ 0 ] );
-
- prev = psDD->sAR2_Q14[ 1 ];
-
- /* Loop over allpass sections */
- for( j = 2; j < shapingLPCOrder; j += 2 ) {
- cur = psDD->sAR2_Q14[ j ];
- next = psDD->sAR2_Q14[ j+1 ];
- /* Output of allpass section */
- tmp2 = silk_SMLAWB( prev, cur - tmp1, warping_Q16 );
- psDD->sAR2_Q14[ j - 1 ] = tmp1;
- temp64 = __builtin_mips_madd( temp64, tmp1, AR_shp_Q13[ j - 1 ] );
- temp64 = __builtin_mips_madd( temp64, tmp2, AR_shp_Q13[ j ] );
- /* Output of allpass section */
- tmp1 = silk_SMLAWB( cur, next - tmp2, warping_Q16 );
- psDD->sAR2_Q14[ j + 0 ] = tmp2;
- prev = next;
- }
- psDD->sAR2_Q14[ shapingLPCOrder - 1 ] = tmp1;
- temp64 = __builtin_mips_madd( temp64, tmp1, AR_shp_Q13[ shapingLPCOrder - 1 ] );
- temp64 += 32768;
- n_AR_Q14 = __builtin_mips_extr_w(temp64, 16);
- n_AR_Q14 = silk_LSHIFT( n_AR_Q14, 1 ); /* Q11 -> Q12 */
- n_AR_Q14 = silk_SMLAWB( n_AR_Q14, psDD->LF_AR_Q14, Tilt_Q14 ); /* Q12 */
- n_AR_Q14 = silk_LSHIFT( n_AR_Q14, 2 ); /* Q12 -> Q14 */
-
- n_LF_Q14 = silk_SMULWB( psDD->Shape_Q14[ *smpl_buf_idx ], LF_shp_Q14 ); /* Q12 */
- n_LF_Q14 = silk_SMLAWT( n_LF_Q14, psDD->LF_AR_Q14, LF_shp_Q14 ); /* Q12 */
- n_LF_Q14 = silk_LSHIFT( n_LF_Q14, 2 ); /* Q12 -> Q14 */
-
- /* Input minus prediction plus noise feedback */
- /* r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP */
- tmp1 = silk_ADD32( n_AR_Q14, n_LF_Q14 ); /* Q14 */
- tmp2 = silk_ADD32( n_LTP_Q14, LPC_pred_Q14 ); /* Q13 */
- tmp1 = silk_SUB32( tmp2, tmp1 ); /* Q13 */
- tmp1 = silk_RSHIFT_ROUND( tmp1, 4 ); /* Q10 */
-
- r_Q10 = silk_SUB32( x_Q10[ i ], tmp1 ); /* residual error Q10 */
-
- /* Flip sign depending on dither */
- if ( psDD->Seed < 0 ) {
- r_Q10 = -r_Q10;
- }
- r_Q10 = silk_LIMIT_32( r_Q10, -(31 << 10), 30 << 10 );
-
- /* Find two quantization level candidates and measure their rate-distortion */
- q1_Q10 = silk_SUB32( r_Q10, offset_Q10 );
- q1_Q0 = silk_RSHIFT( q1_Q10, 10 );
- if( q1_Q0 > 0 ) {
- q1_Q10 = silk_SUB32( silk_LSHIFT( q1_Q0, 10 ), QUANT_LEVEL_ADJUST_Q10 );
- q1_Q10 = silk_ADD32( q1_Q10, offset_Q10 );
- q2_Q10 = silk_ADD32( q1_Q10, 1024 );
- rd1_Q10 = silk_SMULBB( q1_Q10, Lambda_Q10 );
- rd2_Q10 = silk_SMULBB( q2_Q10, Lambda_Q10 );
- } else if( q1_Q0 == 0 ) {
- q1_Q10 = offset_Q10;
- q2_Q10 = silk_ADD32( q1_Q10, 1024 - QUANT_LEVEL_ADJUST_Q10 );
- rd1_Q10 = silk_SMULBB( q1_Q10, Lambda_Q10 );
- rd2_Q10 = silk_SMULBB( q2_Q10, Lambda_Q10 );
- } else if( q1_Q0 == -1 ) {
- q2_Q10 = offset_Q10;
- q1_Q10 = silk_SUB32( q2_Q10, 1024 - QUANT_LEVEL_ADJUST_Q10 );
- rd1_Q10 = silk_SMULBB( -q1_Q10, Lambda_Q10 );
- rd2_Q10 = silk_SMULBB( q2_Q10, Lambda_Q10 );
- } else { /* q1_Q0 < -1 */
- q1_Q10 = silk_ADD32( silk_LSHIFT( q1_Q0, 10 ), QUANT_LEVEL_ADJUST_Q10 );
- q1_Q10 = silk_ADD32( q1_Q10, offset_Q10 );
- q2_Q10 = silk_ADD32( q1_Q10, 1024 );
- rd1_Q10 = silk_SMULBB( -q1_Q10, Lambda_Q10 );
- rd2_Q10 = silk_SMULBB( -q2_Q10, Lambda_Q10 );
- }
- rr_Q10 = silk_SUB32( r_Q10, q1_Q10 );
- rd1_Q10 = silk_RSHIFT( silk_SMLABB( rd1_Q10, rr_Q10, rr_Q10 ), 10 );
- rr_Q10 = silk_SUB32( r_Q10, q2_Q10 );
- rd2_Q10 = silk_RSHIFT( silk_SMLABB( rd2_Q10, rr_Q10, rr_Q10 ), 10 );
-
- if( rd1_Q10 < rd2_Q10 ) {
- psSS[ 0 ].RD_Q10 = silk_ADD32( psDD->RD_Q10, rd1_Q10 );
- psSS[ 1 ].RD_Q10 = silk_ADD32( psDD->RD_Q10, rd2_Q10 );
- psSS[ 0 ].Q_Q10 = q1_Q10;
- psSS[ 1 ].Q_Q10 = q2_Q10;
- } else {
- psSS[ 0 ].RD_Q10 = silk_ADD32( psDD->RD_Q10, rd2_Q10 );
- psSS[ 1 ].RD_Q10 = silk_ADD32( psDD->RD_Q10, rd1_Q10 );
- psSS[ 0 ].Q_Q10 = q2_Q10;
- psSS[ 1 ].Q_Q10 = q1_Q10;
- }
-
- /* Update states for best quantization */
-
- /* Quantized excitation */
- exc_Q14 = silk_LSHIFT32( psSS[ 0 ].Q_Q10, 4 );
- if ( psDD->Seed < 0 ) {
- exc_Q14 = -exc_Q14;
- }
-
- /* Add predictions */
- LPC_exc_Q14 = silk_ADD32( exc_Q14, LTP_pred_Q14 );
- xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 );
-
- /* Update states */
- sLF_AR_shp_Q14 = silk_SUB32( xq_Q14, n_AR_Q14 );
- psSS[ 0 ].sLTP_shp_Q14 = silk_SUB32( sLF_AR_shp_Q14, n_LF_Q14 );
- psSS[ 0 ].LF_AR_Q14 = sLF_AR_shp_Q14;
- psSS[ 0 ].LPC_exc_Q14 = LPC_exc_Q14;
- psSS[ 0 ].xq_Q14 = xq_Q14;
-
- /* Update states for second best quantization */
-
- /* Quantized excitation */
- exc_Q14 = silk_LSHIFT32( psSS[ 1 ].Q_Q10, 4 );
- if ( psDD->Seed < 0 ) {
- exc_Q14 = -exc_Q14;
- }
-
-
- /* Add predictions */
- LPC_exc_Q14 = silk_ADD32( exc_Q14, LTP_pred_Q14 );
- xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 );
-
- /* Update states */
- sLF_AR_shp_Q14 = silk_SUB32( xq_Q14, n_AR_Q14 );
- psSS[ 1 ].sLTP_shp_Q14 = silk_SUB32( sLF_AR_shp_Q14, n_LF_Q14 );
- psSS[ 1 ].LF_AR_Q14 = sLF_AR_shp_Q14;
- psSS[ 1 ].LPC_exc_Q14 = LPC_exc_Q14;
- psSS[ 1 ].xq_Q14 = xq_Q14;
- }
-
- *smpl_buf_idx = ( *smpl_buf_idx - 1 ) % DECISION_DELAY;
- if( *smpl_buf_idx < 0 ) *smpl_buf_idx += DECISION_DELAY;
- last_smple_idx = ( *smpl_buf_idx + decisionDelay ) % DECISION_DELAY;
-
- /* Find winner */
- RDmin_Q10 = psSampleState[ 0 ][ 0 ].RD_Q10;
- Winner_ind = 0;
- for( k = 1; k < nStatesDelayedDecision; k++ ) {
- if( psSampleState[ k ][ 0 ].RD_Q10 < RDmin_Q10 ) {
- RDmin_Q10 = psSampleState[ k ][ 0 ].RD_Q10;
- Winner_ind = k;
- }
- }
-
- /* Increase RD values of expired states */
- Winner_rand_state = psDelDec[ Winner_ind ].RandState[ last_smple_idx ];
- for( k = 0; k < nStatesDelayedDecision; k++ ) {
- if( psDelDec[ k ].RandState[ last_smple_idx ] != Winner_rand_state ) {
- psSampleState[ k ][ 0 ].RD_Q10 = silk_ADD32( psSampleState[ k ][ 0 ].RD_Q10, silk_int32_MAX >> 4 );
- psSampleState[ k ][ 1 ].RD_Q10 = silk_ADD32( psSampleState[ k ][ 1 ].RD_Q10, silk_int32_MAX >> 4 );
- silk_assert( psSampleState[ k ][ 0 ].RD_Q10 >= 0 );
- }
- }
-
- /* Find worst in first set and best in second set */
- RDmax_Q10 = psSampleState[ 0 ][ 0 ].RD_Q10;
- RDmin_Q10 = psSampleState[ 0 ][ 1 ].RD_Q10;
- RDmax_ind = 0;
- RDmin_ind = 0;
- for( k = 1; k < nStatesDelayedDecision; k++ ) {
- /* find worst in first set */
- if( psSampleState[ k ][ 0 ].RD_Q10 > RDmax_Q10 ) {
- RDmax_Q10 = psSampleState[ k ][ 0 ].RD_Q10;
- RDmax_ind = k;
- }
- /* find best in second set */
- if( psSampleState[ k ][ 1 ].RD_Q10 < RDmin_Q10 ) {
- RDmin_Q10 = psSampleState[ k ][ 1 ].RD_Q10;
- RDmin_ind = k;
- }
- }
-
- /* Replace a state if best from second set outperforms worst in first set */
- if( RDmin_Q10 < RDmax_Q10 ) {
- silk_memcpy( ( (opus_int32 *)&psDelDec[ RDmax_ind ] ) + i,
- ( (opus_int32 *)&psDelDec[ RDmin_ind ] ) + i, sizeof( NSQ_del_dec_struct ) - i * sizeof( opus_int32) );
- silk_memcpy( &psSampleState[ RDmax_ind ][ 0 ], &psSampleState[ RDmin_ind ][ 1 ], sizeof( NSQ_sample_struct ) );
- }
-
- /* Write samples from winner to output and long-term filter states */
- psDD = &psDelDec[ Winner_ind ];
- if( subfr > 0 || i >= decisionDelay ) {
- pulses[ i - decisionDelay ] = (opus_int8)silk_RSHIFT_ROUND( psDD->Q_Q10[ last_smple_idx ], 10 );
- xq[ i - decisionDelay ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND(
- silk_SMULWW( psDD->Xq_Q14[ last_smple_idx ], delayedGain_Q10[ last_smple_idx ] ), 8 ) );
- NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx - decisionDelay ] = psDD->Shape_Q14[ last_smple_idx ];
- sLTP_Q15[ NSQ->sLTP_buf_idx - decisionDelay ] = psDD->Pred_Q15[ last_smple_idx ];
- }
- NSQ->sLTP_shp_buf_idx++;
- NSQ->sLTP_buf_idx++;
-
- /* Update states */
- for( k = 0; k < nStatesDelayedDecision; k++ ) {
- psDD = &psDelDec[ k ];
- psSS = &psSampleState[ k ][ 0 ];
- psDD->LF_AR_Q14 = psSS->LF_AR_Q14;
- psDD->sLPC_Q14[ NSQ_LPC_BUF_LENGTH + i ] = psSS->xq_Q14;
- psDD->Xq_Q14[ *smpl_buf_idx ] = psSS->xq_Q14;
- psDD->Q_Q10[ *smpl_buf_idx ] = psSS->Q_Q10;
- psDD->Pred_Q15[ *smpl_buf_idx ] = silk_LSHIFT32( psSS->LPC_exc_Q14, 1 );
- psDD->Shape_Q14[ *smpl_buf_idx ] = psSS->sLTP_shp_Q14;
- psDD->Seed = silk_ADD32_ovflw( psDD->Seed, silk_RSHIFT_ROUND( psSS->Q_Q10, 10 ) );
- psDD->RandState[ *smpl_buf_idx ] = psDD->Seed;
- psDD->RD_Q10 = psSS->RD_Q10;
- }
- delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10;
- }
- /* Update LPC states */
- for( k = 0; k < nStatesDelayedDecision; k++ ) {
- psDD = &psDelDec[ k ];
- silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( opus_int32 ) );
- }
-}
-
-#endif /* NSQ_DEL_DEC_MIPSR1_H__ */
diff --git a/media/libopus/silk/mips/NSQ_mips.h b/media/libopus/silk/mips/NSQ_mips.h
@@ -0,0 +1,137 @@
+/***********************************************************************
+Copyright (c) 2006-2011, Skype Limited. All rights reserved.
+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.
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+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 A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+
+#ifndef NSQ_MIPS_H__
+#define NSQ_MIPS_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "main.h"
+#include "macros.h"
+
+#if defined (__mips_dsp) && __mips == 32
+
+#define MIPS_MULT __builtin_mips_mult
+#define MIPS_MADD __builtin_mips_madd
+#define MIPS_EXTR_R __builtin_mips_extr_r_w
+
+#define OVERRIDE_silk_noise_shape_quantizer_short_prediction
+/* suddenly performance is worse */
+#define dont_OVERRIDE_silk_NSQ_noise_shape_feedback_loop
+
+/* gets worst performance result */
+#elif defined(__mips_isa_rev) && __mips == 32
+
+static inline long long MIPS_MULT(int a, int b) {
+ return (long long)a * b;
+}
+
+static inline long long MIPS_MADD(long long acc, int a, int b) {
+ return acc + (long long)a * b;
+}
+
+static inline opus_val32 MIPS_EXTR_R(long long acc, int shift) {
+ return (opus_val32)((acc + (1 << shift) / 2) >> shift);
+}
+
+#define OVERRIDE_silk_noise_shape_quantizer_short_prediction
+#define OVERRIDE_silk_NSQ_noise_shape_feedback_loop
+
+#endif
+
+#if defined(OVERRIDE_silk_noise_shape_quantizer_short_prediction)
+
+static OPUS_INLINE opus_int32 silk_noise_shape_quantizer_short_prediction_mips(const opus_int32 *buf32, const opus_int16 *coef16, opus_int order)
+{
+ opus_int64 out;
+ silk_assert( order == 10 || order == 16 );
+
+ out = MIPS_MULT( buf32[ 0 ], coef16[ 0 ] );
+ out = MIPS_MADD( out, buf32[ -1 ], coef16[ 1 ] );
+ out = MIPS_MADD( out, buf32[ -2 ], coef16[ 2 ] );
+ out = MIPS_MADD( out, buf32[ -3 ], coef16[ 3 ] );
+ out = MIPS_MADD( out, buf32[ -4 ], coef16[ 4 ] );
+ out = MIPS_MADD( out, buf32[ -5 ], coef16[ 5 ] );
+ out = MIPS_MADD( out, buf32[ -6 ], coef16[ 6 ] );
+ out = MIPS_MADD( out, buf32[ -7 ], coef16[ 7 ] );
+ out = MIPS_MADD( out, buf32[ -8 ], coef16[ 8 ] );
+ out = MIPS_MADD( out, buf32[ -9 ], coef16[ 9 ] );
+
+ if( order == 16 )
+ {
+ out = MIPS_MADD( out, buf32[ -10 ], coef16[ 10 ] );
+ out = MIPS_MADD( out, buf32[ -11 ], coef16[ 11 ] );
+ out = MIPS_MADD( out, buf32[ -12 ], coef16[ 12 ] );
+ out = MIPS_MADD( out, buf32[ -13 ], coef16[ 13 ] );
+ out = MIPS_MADD( out, buf32[ -14 ], coef16[ 14 ] );
+ out = MIPS_MADD( out, buf32[ -15 ], coef16[ 15 ] );
+ }
+ return MIPS_EXTR_R(out, 16);
+}
+
+#undef silk_noise_shape_quantizer_short_prediction
+#define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) ((void)arch,silk_noise_shape_quantizer_short_prediction_mips(in, coef, order))
+
+#endif /* OVERRIDE_silk_noise_shape_quantizer_short_prediction */
+
+
+#if defined(OVERRIDE_silk_NSQ_noise_shape_feedback_loop)
+
+static OPUS_INLINE opus_int32 silk_NSQ_noise_shape_feedback_loop_mips(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order)
+{
+ opus_int32 out;
+ opus_int32 tmp1, tmp2;
+ opus_int j;
+
+ tmp2 = data0[0];
+ tmp1 = data1[0];
+ data1[0] = tmp2;
+
+ out = MIPS_MULT(tmp2, coef[0]);
+
+ for (j = 2; j < order; j += 2) {
+ tmp2 = data1[j - 1];
+ data1[j - 1] = tmp1;
+ out = MIPS_MADD(out, tmp1, coef[j - 1]);
+ tmp1 = data1[j + 0];
+ data1[j + 0] = tmp2;
+ out = MIPS_MADD(out, tmp2, coef[j]);
+ }
+ data1[order - 1] = tmp1;
+ out = MIPS_MADD(out, tmp1, coef[order - 1]);
+ /* silk_SMLAWB: shift right by 16 && Q11 -> Q12: shift left by 1 */
+ return MIPS_EXTR_R( out, (16 - 1) );
+}
+
+#undef silk_NSQ_noise_shape_feedback_loop
+#define silk_NSQ_noise_shape_feedback_loop(data0, data1, coef, order, arch) ((void)arch,silk_NSQ_noise_shape_feedback_loop_mips(data0, data1, coef, order))
+
+#endif /* OVERRIDE_silk_NSQ_noise_shape_feedback_loop */
+
+#endif /* NSQ_DEL_DEC_MIPSR1_H__ */
diff --git a/media/libopus/silk/mips/macros_mipsr1.h b/media/libopus/silk/mips/macros_mipsr1.h
@@ -29,10 +29,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef SILK_MACROS_MIPSR1_H__
#define SILK_MACROS_MIPSR1_H__
-static inline int mips_clz(opus_uint32 x)
-{
- return x ? __builtin_clz(x) : 32;
-}
+
+#if defined (__mips_dsp) && __mips == 32
#undef silk_SMULWB
static inline int silk_SMULWB(int a, int b)
@@ -74,6 +72,34 @@ static inline int silk_SMLAWW(int a, int b, int c)
return res;
}
+#elif defined (__mips_isa_rev) && __mips == 32
+
+#undef silk_SMULWB
+static inline int silk_SMULWB(int a, int b)
+{
+ long long ac = (long long)a * (int)(b << 16);
+
+ return ac >> 32;
+}
+
+/* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */
+#undef silk_SMLAWB
+static inline int silk_SMLAWB(int a, int b, int c)
+{
+ long long ac = (long long)b * (int)(c << 16);
+
+ return a + (ac >> 32);
+}
+
+#endif
+
+#if defined (__mips_isa_rev) /* MIPS32r1+ */
+
+static inline int mips_clz(opus_uint32 x)
+{
+ return x ? __builtin_clz(x) : 32;
+}
+
#define OVERRIDE_silk_CLZ16
static inline opus_int32 silk_CLZ16(opus_int16 in16)
{
@@ -92,4 +118,6 @@ static inline opus_int32 silk_CLZ32(opus_int32 in32)
return re32;
}
+#endif /* __mips_isa_rev */
+
#endif /* SILK_MACROS_MIPSR1_H__ */
diff --git a/media/libopus/silk/resampler.c b/media/libopus/silk/resampler.c
@@ -50,24 +50,25 @@ POSSIBILITY OF SUCH DAMAGE.
#include "resampler_private.h"
/* Tables with delay compensation values to equalize total delay for different modes */
-static const opus_int8 delay_matrix_enc[ 5 ][ 3 ] = {
+static const opus_int8 delay_matrix_enc[ 6 ][ 3 ] = {
/* in \ out 8 12 16 */
/* 8 */ { 6, 0, 3 },
/* 12 */ { 0, 7, 3 },
/* 16 */ { 0, 1, 10 },
/* 24 */ { 0, 2, 6 },
-/* 48 */ { 18, 10, 12 }
+/* 48 */ { 18, 10, 12 },
+/* 96 */ { 0, 0, 44 }
};
-static const opus_int8 delay_matrix_dec[ 3 ][ 5 ] = {
-/* in \ out 8 12 16 24 48 */
-/* 8 */ { 4, 0, 2, 0, 0 },
-/* 12 */ { 0, 9, 4, 7, 4 },
-/* 16 */ { 0, 3, 12, 7, 7 }
+static const opus_int8 delay_matrix_dec[ 3 ][ 6 ] = {
+/* in \ out 8 12 16 24 48 96*/
+/* 8 */ { 4, 0, 2, 0, 0, 0 },
+/* 12 */ { 0, 9, 4, 7, 4, 4 },
+/* 16 */ { 0, 3, 12, 7, 7, 7 }
};
/* Simple way to make [8000, 12000, 16000, 24000, 48000] to [0, 1, 2, 3, 4] */
-#define rateID(R) ( ( ( ((R)>>12) - ((R)>16000) ) >> ((R)>24000) ) - 1 )
+#define rateID(R) IMIN(5, ( ( ( ((R)>>12) - ((R)>16000) ) >> ((R)>24000) ) - 1 ))
#define USE_silk_resampler_copy (0)
#define USE_silk_resampler_private_up2_HQ_wrapper (1)
@@ -89,7 +90,11 @@ opus_int silk_resampler_init(
/* Input checking */
if( forEnc ) {
- if( ( Fs_Hz_in != 8000 && Fs_Hz_in != 12000 && Fs_Hz_in != 16000 && Fs_Hz_in != 24000 && Fs_Hz_in != 48000 ) ||
+ if( ( Fs_Hz_in != 8000 && Fs_Hz_in != 12000 && Fs_Hz_in != 16000 && Fs_Hz_in != 24000 && Fs_Hz_in != 48000
+#ifdef ENABLE_QEXT
+ && Fs_Hz_in != 96000
+#endif
+ ) ||
( Fs_Hz_out != 8000 && Fs_Hz_out != 12000 && Fs_Hz_out != 16000 ) ) {
celt_assert( 0 );
return -1;
@@ -97,7 +102,11 @@ opus_int silk_resampler_init(
S->inputDelay = delay_matrix_enc[ rateID( Fs_Hz_in ) ][ rateID( Fs_Hz_out ) ];
} else {
if( ( Fs_Hz_in != 8000 && Fs_Hz_in != 12000 && Fs_Hz_in != 16000 ) ||
- ( Fs_Hz_out != 8000 && Fs_Hz_out != 12000 && Fs_Hz_out != 16000 && Fs_Hz_out != 24000 && Fs_Hz_out != 48000 ) ) {
+ ( Fs_Hz_out != 8000 && Fs_Hz_out != 12000 && Fs_Hz_out != 16000 && Fs_Hz_out != 24000 && Fs_Hz_out != 48000
+#ifdef ENABLE_QEXT
+ && Fs_Hz_out != 96000
+#endif
+ ) ) {
celt_assert( 0 );
return -1;
}
diff --git a/media/libopus/silk/resampler_structs.h b/media/libopus/silk/resampler_structs.h
@@ -41,7 +41,7 @@ typedef struct _silk_resampler_state_struct{
opus_int32 i32[ SILK_RESAMPLER_MAX_FIR_ORDER ];
opus_int16 i16[ SILK_RESAMPLER_MAX_FIR_ORDER ];
} sFIR;
- opus_int16 delayBuf[ 48 ];
+ opus_int16 delayBuf[ 96 ];
opus_int resampler_function;
opus_int batchSize;
opus_int32 invRatio_Q16;
diff --git a/media/libopus/src/analysis.c b/media/libopus/src/analysis.c
@@ -178,6 +178,7 @@ static opus_val32 downmix_and_resample(downmix_func downmix, const void *_x, opu
subframe = subframe*2/3;
offset = offset*2/3;
}
+ else if (Fs != 24000) celt_assert(0);
ALLOC(tmp, subframe, opus_val32);
downmix(_x, tmp, subframe, offset, c1, c2, C);
diff --git a/media/libopus/src/opus.c b/media/libopus/src/opus.c
@@ -236,6 +236,13 @@ int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
opus_int32 pad = 0;
const unsigned char *data0 = data;
+ /* Make sure we return NULL/0 on error. */
+ if (padding != NULL)
+ {
+ *padding = NULL;
+ *padding_len = 0;
+ }
+
if (size==NULL || len<0)
return OPUS_BAD_ARG;
if (len==0)
diff --git a/media/libopus/src/opus_decoder.c b/media/libopus/src/opus_decoder.c
@@ -70,6 +70,7 @@ struct OpusDecoder {
silk_DecControlStruct DecControl;
int decode_gain;
int complexity;
+ int ignore_extensions;
int arch;
#ifdef ENABLE_DEEP_PLC
LPCNetPLCState lpcnet;
@@ -96,7 +97,11 @@ struct OpusDecoder {
static void validate_opus_decoder(OpusDecoder *st)
{
celt_assert(st->channels == 1 || st->channels == 2);
+#ifdef ENABLE_QEXT
+ celt_assert(st->Fs == 96000 || st->Fs == 48000 || st->Fs == 24000 || st->Fs == 16000 || st->Fs == 12000 || st->Fs == 8000);
+#else
celt_assert(st->Fs == 48000 || st->Fs == 24000 || st->Fs == 16000 || st->Fs == 12000 || st->Fs == 8000);
+#endif
celt_assert(st->DecControl.API_sampleRate == st->Fs);
celt_assert(st->DecControl.internalSampleRate == 0 || st->DecControl.internalSampleRate == 16000 || st->DecControl.internalSampleRate == 12000 || st->DecControl.internalSampleRate == 8000);
celt_assert(st->DecControl.nChannelsAPI == st->channels);
@@ -133,7 +138,11 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels)
CELTDecoder *celt_dec;
int ret, silkDecSizeBytes;
- if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000)
+ if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000
+#ifdef ENABLE_QEXT
+ &&Fs!=96000
+#endif
+ )
|| (channels!=1&&channels!=2))
return OPUS_BAD_ARG;
@@ -178,7 +187,11 @@ OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error)
{
int ret;
OpusDecoder *st;
- if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000)
+ if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000
+#ifdef ENABLE_QEXT
+ &&Fs!=96000
+#endif
+ )
|| (channels!=1&&channels!=2))
{
if (error)
@@ -255,7 +268,7 @@ static int opus_packet_get_mode(const unsigned char *data)
}
static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
- opus_int32 len, opus_res *pcm, int frame_size, int decode_fec)
+ opus_int32 len, opus_res *pcm, int frame_size, int decode_fec ARG_QEXT(opus_extension_data *ext))
{
void *silk_dec;
CELTDecoder *celt_dec;
@@ -331,7 +344,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
if (audiosize > F20)
{
do {
- int ret = opus_decode_frame(st, NULL, 0, pcm, IMIN(audiosize, F20), 0);
+ int ret = opus_decode_frame(st, NULL, 0, pcm, IMIN(audiosize, F20), 0 ARG_QEXT(NULL));
if (ret<0)
{
RESTORE_STACK;
@@ -373,7 +386,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
if (transition && mode == MODE_CELT_ONLY)
{
pcm_transition = pcm_transition_celt;
- opus_decode_frame(st, NULL, 0, pcm_transition, IMIN(F5, audiosize), 0);
+ opus_decode_frame(st, NULL, 0, pcm_transition, IMIN(F5, audiosize), 0 ARG_QEXT(NULL));
}
if (audiosize > frame_size)
{
@@ -526,7 +539,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
if (transition && mode != MODE_CELT_ONLY)
{
pcm_transition = pcm_transition_silk;
- opus_decode_frame(st, NULL, 0, pcm_transition, IMIN(F5, audiosize), 0);
+ opus_decode_frame(st, NULL, 0, pcm_transition, IMIN(F5, audiosize), 0 ARG_QEXT(NULL));
}
@@ -594,7 +607,8 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
#ifdef ENABLE_DEEP_PLC
, &st->lpcnet
#endif
- );
+ ARG_QEXT(ext ? ext->data : NULL) ARG_QEXT(ext ? ext->len : 0));
+ celt_decoder_ctl(celt_dec, OPUS_GET_FINAL_RANGE(&st->rangeFinal));
} else {
unsigned char silence[2] = {0xFF, 0xFF};
if (!celt_accum)
@@ -609,6 +623,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
MUST_SUCCEED(celt_decoder_ctl(celt_dec, CELT_SET_START_BAND(0)));
celt_decode_with_ec(celt_dec, silence, 2, pcm, F2_5, NULL, celt_accum);
}
+ st->rangeFinal = dec.rng;
}
{
@@ -681,7 +696,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
if (len <= 1)
st->rangeFinal = 0;
else
- st->rangeFinal = dec.rng ^ redundant_rng;
+ st->rangeFinal ^= redundant_rng;
st->prev_mode = mode;
st->prev_redundancy = redundancy && !celt_to_silk;
@@ -707,6 +722,9 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
int packet_frame_size, packet_bandwidth, packet_mode, packet_stream_channels;
/* 48 x 2.5 ms = 120 ms */
opus_int16 size[48];
+ const unsigned char *padding;
+ opus_int32 padding_len;
+ OpusExtensionIterator iter;
VALIDATE_OPUS_DECODER(st);
if (decode_fec<0 || decode_fec>1)
return OPUS_BAD_ARG;
@@ -747,7 +765,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
int pcm_count=0;
do {
int ret;
- ret = opus_decode_frame(st, NULL, 0, pcm+pcm_count*st->channels, frame_size-pcm_count, 0);
+ ret = opus_decode_frame(st, NULL, 0, pcm+pcm_count*st->channels, frame_size-pcm_count, 0 ARG_QEXT(NULL));
if (ret<0)
return ret;
pcm_count += ret;
@@ -766,9 +784,14 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
packet_stream_channels = opus_packet_get_nb_channels(data);
count = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL,
- size, &offset, packet_offset, NULL, NULL);
+ size, &offset, packet_offset, &padding, &padding_len);
+ if (st->ignore_extensions) {
+ padding = NULL;
+ padding_len = 0;
+ }
if (count<0)
return count;
+ opus_extension_iterator_init(&iter, padding, padding_len, count);
data += offset;
@@ -797,7 +820,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
st->frame_size = packet_frame_size;
st->stream_channels = packet_stream_channels;
ret = opus_decode_frame(st, data, size[0], pcm+st->channels*(frame_size-packet_frame_size),
- packet_frame_size, 1);
+ packet_frame_size, 1 ARG_QEXT(NULL));
if (ret<0)
return ret;
else {
@@ -821,7 +844,22 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
for (i=0;i<count;i++)
{
int ret;
- ret = opus_decode_frame(st, data, size[i], pcm+nb_samples*st->channels, frame_size-nb_samples, 0);
+#ifdef ENABLE_QEXT
+ opus_extension_data ext;
+ ext.frame = -1;
+ ext.data = NULL;
+ ext.len = 0;
+ ext.id = -1;
+ while (ext.frame < i) {
+ OpusExtensionIterator iter_copy;
+ iter_copy = iter;
+ ret = opus_extension_iterator_find(&iter, &ext, QEXT_EXTENSION_ID);
+ if (ret <= 0) break;
+ if (ext.frame > i) iter = iter_copy;
+ }
+ if (ext.frame != i) ext.data = NULL;
+#endif
+ ret = opus_decode_frame(st, data, size[i], pcm+nb_samples*st->channels, frame_size-nb_samples, 0 ARG_QEXT(&ext));
if (ret<0)
return ret;
celt_assert(ret==packet_frame_size);
@@ -931,7 +969,8 @@ int opus_decode24(OpusDecoder *st, const unsigned char *data,
ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0, NULL, 0);
if (ret > 0)
{
- for (i=0;i<ret*st->channels;i++)
+ nb_samples = ret*st->channels;
+ for (i=0;i<nb_samples;i++)
pcm[i] = RES2INT24(out[i]);
}
RESTORE_STACK;
@@ -1155,6 +1194,26 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
ret = celt_decoder_ctl(celt_dec, OPUS_GET_PHASE_INVERSION_DISABLED(value));
}
break;
+ case OPUS_SET_IGNORE_EXTENSIONS_REQUEST:
+ {
+ opus_int32 value = va_arg(ap, opus_int32);
+ if(value<0 || value>1)
+ {
+ goto bad_arg;
+ }
+ st->ignore_extensions = value;
+ }
+ break;
+ case OPUS_GET_IGNORE_EXTENSIONS_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (!value)
+ {
+ goto bad_arg;
+ }
+ *value = st->ignore_extensions;
+ }
+ break;
#ifdef USE_WEIGHTS_FILE
case OPUS_SET_DNN_BLOB_REQUEST:
{
@@ -1263,6 +1322,8 @@ int opus_packet_has_lbrr(const unsigned char packet[], opus_int32 len)
ret = opus_packet_parse(packet, len, NULL, frames, size, NULL);
if (ret <= 0)
return ret;
+ if (size[0] == 0)
+ return 0;
lbrr = (frames[0][0] >> (7-nb_frames)) & 0x1;
if (packet_stream_channels == 2)
lbrr = lbrr || ((frames[0][0] >> (6-2*nb_frames)) & 0x1);
diff --git a/media/libopus/src/opus_encoder.c b/media/libopus/src/opus_encoder.c
@@ -59,7 +59,11 @@
#include <stdio.h>
#endif
+#ifdef ENABLE_QEXT
+#define MAX_ENCODER_BUFFER 960
+#else
#define MAX_ENCODER_BUFFER 480
+#endif
#ifndef DISABLE_FLOAT_API
#define PSEUDO_SNR_THRESHOLD 316.23f /* 10^(25/10) */
@@ -102,6 +106,9 @@ struct OpusEncoder {
#ifndef DISABLE_FLOAT_API
TonalityAnalysisState analysis;
#endif
+#ifdef ENABLE_QEXT
+ int enable_qext;
+#endif
#define OPUS_ENCODER_RESET_START stream_channels
int stream_channels;
@@ -187,40 +194,49 @@ static const opus_int32 fec_thresholds[] = {
int opus_encoder_get_size(int channels)
{
- int silkEncSizeBytes, celtEncSizeBytes;
int ret;
- if (channels<1 || channels > 2)
- return 0;
- ret = silk_Get_Encoder_Size( &silkEncSizeBytes );
- if (ret)
+ ret = opus_encoder_init(NULL, 48000, channels, OPUS_APPLICATION_AUDIO);
+ if (ret < 0)
return 0;
- silkEncSizeBytes = align(silkEncSizeBytes);
- celtEncSizeBytes = celt_encoder_get_size(channels);
- return align(sizeof(OpusEncoder))+silkEncSizeBytes+celtEncSizeBytes;
+ else
+ return ret;
}
int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int application)
{
- void *silk_enc;
- CELTEncoder *celt_enc;
+ void *silk_enc=NULL;
+ CELTEncoder *celt_enc=NULL;
int err;
- int ret, silkEncSizeBytes;
+ int ret, silkEncSizeBytes, celtEncSizeBytes=0;
+ int tot_size;
- if((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000)||(channels!=1&&channels!=2)||
+ if((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000
+#ifdef ENABLE_QEXT
+ &&Fs!=96000
+#endif
+ )||(channels!=1&&channels!=2)||
(application != OPUS_APPLICATION_VOIP && application != OPUS_APPLICATION_AUDIO
- && application != OPUS_APPLICATION_RESTRICTED_LOWDELAY))
+ && application != OPUS_APPLICATION_RESTRICTED_LOWDELAY
+ && application != OPUS_APPLICATION_RESTRICTED_SILK
+ && application != OPUS_APPLICATION_RESTRICTED_CELT))
return OPUS_BAD_ARG;
- OPUS_CLEAR((char*)st, opus_encoder_get_size(channels));
/* Create SILK encoder */
- ret = silk_Get_Encoder_Size( &silkEncSizeBytes );
+ ret = silk_Get_Encoder_Size( &silkEncSizeBytes, channels );
if (ret)
return OPUS_BAD_ARG;
silkEncSizeBytes = align(silkEncSizeBytes);
+ if (application == OPUS_APPLICATION_RESTRICTED_CELT)
+ silkEncSizeBytes = 0;
+ if (application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celtEncSizeBytes = celt_encoder_get_size(channels);
+ tot_size = align(sizeof(OpusEncoder))+silkEncSizeBytes+celtEncSizeBytes;
+ if (st == NULL) {
+ return tot_size;
+ }
+ OPUS_CLEAR((char*)st, tot_size);
st->silk_enc_offset = align(sizeof(OpusEncoder));
st->celt_enc_offset = st->silk_enc_offset+silkEncSizeBytes;
- silk_enc = (char*)st+st->silk_enc_offset;
- celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
st->stream_channels = st->channels = channels;
@@ -228,7 +244,11 @@ int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int applicat
st->arch = opus_select_arch();
- ret = silk_InitEncoder( silk_enc, st->arch, &st->silk_mode );
+ if (application != OPUS_APPLICATION_RESTRICTED_CELT)
+ {
+ silk_enc = (char*)st+st->silk_enc_offset;
+ ret = silk_InitEncoder( silk_enc, st->channels, st->arch, &st->silk_mode );
+ }
if(ret)return OPUS_INTERNAL_ERROR;
/* default SILK parameters */
@@ -250,11 +270,14 @@ int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int applicat
/* Create CELT encoder */
/* Initialize CELT encoder */
- err = celt_encoder_init(celt_enc, Fs, channels, st->arch);
- if(err!=OPUS_OK)return OPUS_INTERNAL_ERROR;
-
- celt_encoder_ctl(celt_enc, CELT_SET_SIGNALLING(0));
- celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(st->silk_mode.complexity));
+ if (application != OPUS_APPLICATION_RESTRICTED_SILK)
+ {
+ celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
+ err = celt_encoder_init(celt_enc, Fs, channels, st->arch);
+ if(err!=OPUS_OK)return OPUS_INTERNAL_ERROR;
+ celt_encoder_ctl(celt_enc, CELT_SET_SIGNALLING(0));
+ celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(st->silk_mode.complexity));
+ }
#ifdef ENABLE_DRED
/* Initialize DRED Encoder */
@@ -520,7 +543,7 @@ static void stereo_fade(const opus_res *in, opus_res *out, opus_val16 g1, opus_v
int i;
int overlap;
int inc;
- inc = 48000/Fs;
+ inc = IMAX(1, 48000/Fs);
overlap=overlap48/inc;
g1 = Q15ONE-g1;
g2 = Q15ONE-g2;
@@ -554,7 +577,7 @@ static void gain_fade(const opus_res *in, opus_res *out, opus_val16 g1, opus_val
int inc;
int overlap;
int c;
- inc = 48000/Fs;
+ inc = IMAX(1, 48000/Fs);
overlap=overlap48/inc;
if (channels==1)
{
@@ -592,15 +615,29 @@ OpusEncoder *opus_encoder_create(opus_int32 Fs, int channels, int application, i
{
int ret;
OpusEncoder *st;
- if((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000)||(channels!=1&&channels!=2)||
+ int size;
+ if((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000
+#ifdef ENABLE_QEXT
+ &&Fs!=96000
+#endif
+ )||(channels!=1&&channels!=2)||
(application != OPUS_APPLICATION_VOIP && application != OPUS_APPLICATION_AUDIO
- && application != OPUS_APPLICATION_RESTRICTED_LOWDELAY))
+ && application != OPUS_APPLICATION_RESTRICTED_LOWDELAY
+ && application != OPUS_APPLICATION_RESTRICTED_SILK
+ && application != OPUS_APPLICATION_RESTRICTED_CELT))
{
if (error)
*error = OPUS_BAD_ARG;
return NULL;
}
- st = (OpusEncoder *)opus_alloc(opus_encoder_get_size(channels));
+ size = opus_encoder_init(NULL, Fs, channels, application);
+ if (size <= 0)
+ {
+ if (error)
+ *error = OPUS_INTERNAL_ERROR;
+ return NULL;
+ }
+ st = (OpusEncoder *)opus_alloc(size);
if (st == NULL)
{
if (error)
@@ -687,13 +724,16 @@ static opus_int32 compute_dred_bitrate(OpusEncoder *st, opus_int32 bitrate_bps,
static opus_int32 user_bitrate_to_bitrate(OpusEncoder *st, int frame_size, int max_data_bytes)
{
+ opus_int32 max_bitrate, user_bitrate;
if(!frame_size)frame_size=st->Fs/400;
+ max_bitrate = max_data_bytes*8*(6*st->Fs/frame_size)/6;
if (st->user_bitrate_bps==OPUS_AUTO)
- return 60*st->Fs/frame_size + st->Fs*st->channels;
+ user_bitrate = 60*st->Fs/frame_size + st->Fs*st->channels;
else if (st->user_bitrate_bps==OPUS_BITRATE_MAX)
- return max_data_bytes*8*st->Fs/frame_size;
+ user_bitrate = 1500000;
else
- return st->user_bitrate_bps;
+ user_bitrate = st->user_bitrate_bps;
+ return IMIN(user_bitrate, max_bitrate);
}
#ifndef DISABLE_FLOAT_API
@@ -767,7 +807,7 @@ void downmix_int24(const void *_x, opus_val32 *y, int subframe, int offset, int
}
}
-opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs)
+opus_int32 frame_size_select(int application, opus_int32 frame_size, int variable_duration, opus_int32 Fs)
{
int new_size;
if (frame_size<Fs/400)
@@ -789,6 +829,8 @@ opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_
50*new_size!=Fs && 25*new_size!=Fs && 50*new_size!=3*Fs &&
50*new_size!=4*Fs && 50*new_size!=5*Fs && 50*new_size!=6*Fs)
return -1;
+ if (application == OPUS_APPLICATION_RESTRICTED_SILK && new_size < Fs/100)
+ return -1;
return new_size;
}
@@ -1125,8 +1167,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
const void *analysis_pcm, opus_int32 analysis_size, int c1, int c2,
int analysis_channels, downmix_func downmix, int float_api)
{
- void *silk_enc;
- CELTEncoder *celt_enc;
+ void *silk_enc=NULL;
+ CELTEncoder *celt_enc=NULL;
int i;
int ret=0;
int prefill=0;
@@ -1141,7 +1183,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
opus_int32 max_data_bytes; /* Max number of bytes we're allowed to use */
opus_int32 cbr_bytes=-1;
opus_val16 stereo_width;
- const CELTMode *celt_mode;
+ const CELTMode *celt_mode=NULL;
+ int packet_size_cap = 1276;
#ifndef DISABLE_FLOAT_API
AnalysisInfo analysis_info;
int analysis_read_pos_bak=-1;
@@ -1153,8 +1196,12 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
#endif
ALLOC_STACK;
+#ifdef ENABLE_QEXT
+ if (st->enable_qext) packet_size_cap = QEXT_PACKET_SIZE_CAP;
+#endif
+
/* Just avoid insane packet sizes here, but the real bounds are applied later on. */
- max_data_bytes = IMIN(1276*6, out_data_bytes);
+ max_data_bytes = IMIN(packet_size_cap*6, out_data_bytes);
st->rangeFinal = 0;
if (frame_size <= 0 || max_data_bytes <= 0)
@@ -1170,18 +1217,21 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
return OPUS_BUFFER_TOO_SMALL;
}
- silk_enc = (char*)st+st->silk_enc_offset;
- celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
+ if (st->application != OPUS_APPLICATION_RESTRICTED_CELT)
+ silk_enc = (char*)st+st->silk_enc_offset;
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
lsb_depth = IMIN(lsb_depth, st->lsb_depth);
- celt_encoder_ctl(celt_enc, CELT_GET_MODE(&celt_mode));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, CELT_GET_MODE(&celt_mode));
#ifndef DISABLE_FLOAT_API
analysis_info.valid = 0;
#ifdef FIXED_POINT
- if (st->silk_mode.complexity >= 10 && st->Fs>=16000)
+ if (st->silk_mode.complexity >= 10 && st->Fs>=16000 && st->Fs<=48000 && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
#else
- if (st->silk_mode.complexity >= 7 && st->Fs>=16000)
+ if (st->silk_mode.complexity >= 7 && st->Fs>=16000 && st->Fs<=48000 && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
#endif
{
is_silence = is_digital_silence(pcm, frame_size, st->channels, lsb_depth);
@@ -1394,7 +1444,10 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
#endif
/* Mode selection depending on application and signal type */
- if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY)
+ if (st->application == OPUS_APPLICATION_RESTRICTED_SILK)
+ {
+ st->mode = MODE_SILK_ONLY;
+ } else if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY || st->application == OPUS_APPLICATION_RESTRICTED_CELT)
{
st->mode = MODE_CELT_ONLY;
} else if (st->user_forced_mode == OPUS_AUTO)
@@ -1458,8 +1511,11 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
/* Override the chosen mode to make sure we meet the requested frame size */
if (st->mode != MODE_CELT_ONLY && frame_size < st->Fs/100)
+ {
+ celt_assert(st->application != OPUS_APPLICATION_RESTRICTED_SILK);
st->mode = MODE_CELT_ONLY;
- if (st->lfe)
+ }
+ if (st->lfe && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
st->mode = MODE_CELT_ONLY;
if (st->prev_mode > 0 &&
@@ -1500,7 +1556,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
if (st->mode != MODE_CELT_ONLY && st->prev_mode == MODE_CELT_ONLY)
{
silk_EncControlStruct dummy;
- silk_InitEncoder( silk_enc, st->arch, &dummy);
+ silk_InitEncoder( silk_enc, st->channels, st->arch, &dummy);
prefill=1;
}
@@ -1598,7 +1654,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
#endif
st->silk_mode.LBRR_coded = decide_fec(st->silk_mode.useInBandFEC, st->silk_mode.packetLossPercentage,
st->silk_mode.LBRR_coded, st->mode, &st->bandwidth, equiv_rate);
- celt_encoder_ctl(celt_enc, OPUS_SET_LSB_DEPTH(lsb_depth));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, OPUS_SET_LSB_DEPTH(lsb_depth));
/* CELT mode doesn't support mediumband, use wideband instead */
if (st->mode == MODE_CELT_ONLY && st->bandwidth == OPUS_BANDWIDTH_MEDIUMBAND)
@@ -1608,6 +1665,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
curr_bandwidth = st->bandwidth;
+ if (st->application == OPUS_APPLICATION_RESTRICTED_SILK && curr_bandwidth > OPUS_BANDWIDTH_WIDEBAND)
+ st->bandwidth = curr_bandwidth = OPUS_BANDWIDTH_WIDEBAND;
/* Chooses the appropriate mode for speech
*NEVER* switch to/from CELT-only mode here as this will invalidate some assumptions */
if (st->mode == MODE_SILK_ONLY && curr_bandwidth > OPUS_BANDWIDTH_WIDEBAND)
@@ -1659,6 +1718,13 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_si
* 2 frames: Code 2 with different compressed sizes
* >2 frames: Code 3 VBR */
max_header_bytes = nb_frames == 2 ? 3 : (2+(nb_frames-1)*2);
+#ifdef ENABLE_QEXT
+ /* Cover the use of the separators that are the only thing that can get us over
+ once we consider that we need to subtract the extension overhead in each
+ of the individual frames. Also consider that a separator can get our padding
+ from 254 to 255, which costs an extra length byte (at most once). */
+ if (st->enable_qext) max_header_bytes += (nb_frames-1) + 1;
+#endif
if (st->use_vbr || st->user_bitrate_bps==OPUS_BITRATE_MAX)
repacketize_len = out_data_bytes;
@@ -1775,9 +1841,9 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
int redundancy, int celt_to_silk, int prefill,
opus_int32 equiv_rate, int to_celt)
{
- void *silk_enc;
- CELTEncoder *celt_enc;
- const CELTMode *celt_mode;
+ void *silk_enc=NULL;
+ CELTEncoder *celt_enc=NULL;
+ const CELTMode *celt_mode=NULL;
int i;
int ret=0;
int max_data_bytes;
@@ -1803,11 +1869,15 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
max_data_bytes = IMIN(orig_max_data_bytes, 1276);
st->rangeFinal = 0;
- silk_enc = (char*)st+st->silk_enc_offset;
- celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
- celt_encoder_ctl(celt_enc, CELT_GET_MODE(&celt_mode));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_CELT)
+ silk_enc = (char*)st+st->silk_enc_offset;
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ {
+ celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
+ celt_encoder_ctl(celt_enc, CELT_GET_MODE(&celt_mode));
+ }
curr_bandwidth = st->bandwidth;
- if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY)
+ if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY || st->application == OPUS_APPLICATION_RESTRICTED_CELT)
delay_compensation = 0;
else
delay_compensation = st->delay_compensation;
@@ -1852,13 +1922,18 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
if (redundancy_bytes == 0)
redundancy = 0;
}
+ if (st->application == OPUS_APPLICATION_RESTRICTED_SILK)
+ {
+ redundancy = 0;
+ redundancy_bytes = 0;
+ }
/* printf("%d %d %d %d\n", st->bitrate_bps, st->stream_channels, st->mode, curr_bandwidth); */
- bytes_target = IMIN(max_data_bytes-redundancy_bytes, st->bitrate_bps * frame_size / (st->Fs * 8)) - 1;
+ bytes_target = IMIN(max_data_bytes-redundancy_bytes, (st->bitrate_bps/8) * frame_size / st->Fs) - 1;
data += 1;
- ec_enc_init(&enc, data, max_data_bytes-1);
+ ec_enc_init(&enc, data, orig_max_data_bytes-1);
ALLOC(pcm_buf, (total_buffer+frame_size)*st->channels, opus_res);
OPUS_COPY(pcm_buf, &st->delay_buffer[(st->encoder_buffer-total_buffer)*st->channels], total_buffer*st->channels);
@@ -1897,6 +1972,11 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
}
#endif
} else {
+#ifdef ENABLE_QEXT
+ /* FIXME: Avoid glitching when we switch qext on/off dynamically. */
+ if (st->enable_qext) OPUS_COPY(&pcm_buf[total_buffer*st->channels], pcm, frame_size*st->channels);
+ else
+#endif
dc_reject(pcm, 3, &pcm_buf[total_buffer*st->channels], st->hp_mem, frame_size, st->channels, st->Fs);
}
#ifndef FIXED_POINT
@@ -2032,6 +2112,10 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
st->silk_mode.maxInternalSampleRate = 8000;
st->silk_mode.desiredInternalSampleRate = IMIN(8000, st->silk_mode.desiredInternalSampleRate);
}
+#ifdef ENABLE_QEXT
+ /* At 96 kHz, we don't have the input resampler to do 8 or 12 kHz. */
+ if (st->Fs==96000) st->silk_mode.maxInternalSampleRate = st->silk_mode.desiredInternalSampleRate = 16000;
+#endif
}
st->silk_mode.useCBR = !st->use_vbr;
@@ -2086,8 +2170,11 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
rewritten is tmp_prefill[] and even then only the part after the ramp really
gets used (rather than sent to the encoder and discarded) */
prefill_offset = st->channels*(st->encoder_buffer-st->delay_compensation-st->Fs/400);
- gain_fade(st->delay_buffer+prefill_offset, st->delay_buffer+prefill_offset,
- 0, Q15ONE, celt_mode->overlap, st->Fs/400, st->channels, celt_mode->window, st->Fs);
+ if (celt_mode != NULL)
+ {
+ gain_fade(st->delay_buffer+prefill_offset, st->delay_buffer+prefill_offset,
+ 0, Q15ONE, celt_mode->overlap, st->Fs/400, st->channels, celt_mode->window, st->Fs);
+ }
OPUS_CLEAR(st->delay_buffer, prefill_offset);
pcm_silk = st->delay_buffer;
silk_Encode( silk_enc, &st->silk_mode, pcm_silk, st->encoder_buffer, NULL, &zero, prefill, activity );
@@ -2130,14 +2217,18 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
/* FIXME: How do we allocate the redundancy for CBR? */
if (st->silk_mode.opusCanSwitch)
{
- redundancy_bytes = compute_redundancy_bytes(max_data_bytes, st->bitrate_bps, frame_rate, st->stream_channels);
- redundancy = (redundancy_bytes != 0);
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ {
+ redundancy_bytes = compute_redundancy_bytes(max_data_bytes, st->bitrate_bps, frame_rate, st->stream_channels);
+ redundancy = (redundancy_bytes != 0);
+ }
celt_to_silk = 0;
st->silk_bw_switch = 1;
}
}
/* CELT processing */
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
{
int endband=21;
@@ -2159,8 +2250,8 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
}
celt_encoder_ctl(celt_enc, CELT_SET_END_BAND(endband));
celt_encoder_ctl(celt_enc, CELT_SET_CHANNELS(st->stream_channels));
+ celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(OPUS_BITRATE_MAX));
}
- celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(OPUS_BITRATE_MAX));
if (st->mode != MODE_SILK_ONLY)
{
opus_val32 celt_pred=2;
@@ -2187,7 +2278,7 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
}
/* gain_fade() and stereo_fade() need to be after the buffer copying
because we don't want any of this to affect the SILK part */
- if( st->prev_HB_gain < Q15ONE || HB_gain < Q15ONE ) {
+ if( ( st->prev_HB_gain < Q15ONE || HB_gain < Q15ONE ) && celt_mode != NULL ) {
gain_fade(pcm_buf, pcm_buf,
st->prev_HB_gain, HB_gain, celt_mode->overlap, frame_size, st->channels, celt_mode->window, st->Fs);
}
@@ -2214,8 +2305,11 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
g1 *= (1.f/16384);
g2 *= (1.f/16384);
#endif
- stereo_fade(pcm_buf, pcm_buf, g1, g2, celt_mode->overlap,
- frame_size, st->channels, celt_mode->window, st->Fs);
+ if ( celt_mode != NULL )
+ {
+ stereo_fade(pcm_buf, pcm_buf, g1, g2, celt_mode->overlap,
+ frame_size, st->channels, celt_mode->window, st->Fs);
+ }
st->hybrid_stereo_width_Q14 = st->silk_mode.stereoWidth_Q14;
}
}
@@ -2262,6 +2356,12 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
nb_compr_bytes = ret;
} else {
nb_compr_bytes = (max_data_bytes-1)-redundancy_bytes;
+#ifdef ENABLE_QEXT
+ if (st->mode == MODE_CELT_ONLY && st->enable_qext) {
+ celt_assert(redundancy_bytes==0);
+ nb_compr_bytes = orig_max_data_bytes-1;
+ }
+#endif
#ifdef ENABLE_DRED
if (st->dred_duration > 0)
{
@@ -2307,8 +2407,10 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
celt_encoder_ctl(celt_enc, OPUS_RESET_STATE);
}
- celt_encoder_ctl(celt_enc, CELT_SET_START_BAND(start_band));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, CELT_SET_START_BAND(start_band));
+ data[-1] = 0;
if (st->mode != MODE_SILK_ONLY)
{
celt_encoder_ctl(celt_enc, OPUS_SET_VBR(st->use_vbr));
@@ -2351,7 +2453,13 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
/* If false, we already busted the budget and we'll end up with a "PLC frame" */
if (ec_tell(&enc) <= 8*nb_compr_bytes)
{
+#ifdef ENABLE_QEXT
+ if (st->mode == MODE_CELT_ONLY) celt_encoder_ctl(celt_enc, OPUS_SET_QEXT(st->enable_qext));
+#endif
ret = celt_encode_with_ec(celt_enc, pcm_buf, frame_size, NULL, nb_compr_bytes, &enc);
+#ifdef ENABLE_QEXT
+ celt_encoder_ctl(celt_enc, OPUS_SET_QEXT(0));
+#endif
if (ret < 0)
{
RESTORE_STACK;
@@ -2364,6 +2472,9 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
nb_compr_bytes = ret+redundancy_bytes;
}
}
+ celt_encoder_ctl(celt_enc, OPUS_GET_FINAL_RANGE(&st->rangeFinal));
+ } else {
+ st->rangeFinal = enc.rng;
}
/* 5 ms redundant frame for SILK->CELT */
@@ -2403,9 +2514,9 @@ static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_res *pcm,
/* Signalling the mode in the first byte */
data--;
- data[0] = gen_toc(st->mode, st->Fs/frame_size, curr_bandwidth, st->stream_channels);
+ data[0] |= gen_toc(st->mode, st->Fs/frame_size, curr_bandwidth, st->stream_channels);
- st->rangeFinal = enc.rng ^ redundant_rng;
+ st->rangeFinal ^= redundant_rng;
if (to_celt)
st->prev_mode = MODE_CELT_ONLY;
@@ -2520,7 +2631,7 @@ opus_int32 opus_encode(OpusEncoder *st, const opus_int16 *pcm, int analysis_fram
unsigned char *data, opus_int32 max_data_bytes)
{
int frame_size;
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, st->Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, st->Fs);
return opus_encode_native(st, pcm, frame_size, data, max_data_bytes, 16,
pcm, analysis_frame_size, 0, -2, st->channels, downmix_int, 0);
}
@@ -2533,7 +2644,7 @@ opus_int32 opus_encode(OpusEncoder *st, const opus_int16 *pcm, int analysis_fram
VARDECL(opus_res, in);
ALLOC_STACK;
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, st->Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, st->Fs);
if (frame_size <= 0)
{
RESTORE_STACK;
@@ -2555,7 +2666,7 @@ opus_int32 opus_encode24(OpusEncoder *st, const opus_int32 *pcm, int analysis_fr
unsigned char *data, opus_int32 max_data_bytes)
{
int frame_size;
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, st->Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, st->Fs);
return opus_encode_native(st, pcm, frame_size, data, max_data_bytes, MAX_ENCODING_DEPTH,
pcm, analysis_frame_size, 0, -2, st->channels, downmix_int24, 0);
}
@@ -2568,7 +2679,7 @@ opus_int32 opus_encode24(OpusEncoder *st, const opus_int32 *pcm, int analysis_fr
VARDECL(opus_res, in);
ALLOC_STACK;
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, st->Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, st->Fs);
if (frame_size <= 0)
{
RESTORE_STACK;
@@ -2593,7 +2704,7 @@ opus_int32 opus_encode_float(OpusEncoder *st, const float *pcm, int analysis_fra
unsigned char *data, opus_int32 out_data_bytes)
{
int frame_size;
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, st->Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, st->Fs);
return opus_encode_native(st, pcm, frame_size, data, out_data_bytes, MAX_ENCODING_DEPTH,
pcm, analysis_frame_size, 0, -2, st->channels, downmix_float, 1);
}
@@ -2606,7 +2717,7 @@ opus_int32 opus_encode_float(OpusEncoder *st, const float *pcm, int analysis_fra
VARDECL(opus_res, in);
ALLOC_STACK;
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, st->Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, st->Fs);
if (frame_size <= 0)
{
RESTORE_STACK;
@@ -2629,19 +2740,25 @@ opus_int32 opus_encode_float(OpusEncoder *st, const float *pcm, int analysis_fra
int opus_encoder_ctl(OpusEncoder *st, int request, ...)
{
int ret;
- CELTEncoder *celt_enc;
+ CELTEncoder *celt_enc=NULL;
va_list ap;
ret = OPUS_OK;
va_start(ap, request);
- celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset);
switch (request)
{
case OPUS_SET_APPLICATION_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
+ if (st->application == OPUS_APPLICATION_RESTRICTED_SILK || st->application == OPUS_APPLICATION_RESTRICTED_CELT)
+ {
+ ret = OPUS_BAD_ARG;
+ break;
+ }
if ( (value != OPUS_APPLICATION_VOIP && value != OPUS_APPLICATION_AUDIO
&& value != OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|| (!st->first && st->application != value))
@@ -2674,8 +2791,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
goto bad_arg;
else if (value <= 500)
value = 500;
- else if (value > (opus_int32)300000*st->channels)
- value = (opus_int32)300000*st->channels;
+ else if (value > (opus_int32)750000*st->channels)
+ value = (opus_int32)750000*st->channels;
}
st->user_bitrate_bps = value;
}
@@ -2792,7 +2909,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
goto bad_arg;
}
st->silk_mode.complexity = value;
- celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(value));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(value));
}
break;
case OPUS_GET_COMPLEXITY_REQUEST:
@@ -2834,7 +2952,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
goto bad_arg;
}
st->silk_mode.packetLossPercentage = value;
- celt_encoder_ctl(celt_enc, OPUS_SET_PACKET_LOSS_PERC(value));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, OPUS_SET_PACKET_LOSS_PERC(value));
}
break;
case OPUS_GET_PACKET_LOSS_PERC_REQUEST:
@@ -2936,7 +3055,7 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
goto bad_arg;
}
*value = st->Fs/400;
- if (st->application != OPUS_APPLICATION_RESTRICTED_LOWDELAY)
+ if (st->application != OPUS_APPLICATION_RESTRICTED_LOWDELAY && st->application != OPUS_APPLICATION_RESTRICTED_CELT)
*value += st->delay_compensation;
}
break;
@@ -3027,7 +3146,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
{
goto bad_arg;
}
- celt_encoder_ctl(celt_enc, OPUS_SET_PHASE_INVERSION_DISABLED(value));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, OPUS_SET_PHASE_INVERSION_DISABLED(value));
}
break;
case OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST:
@@ -3037,7 +3157,10 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
{
goto bad_arg;
}
- celt_encoder_ctl(celt_enc, OPUS_GET_PHASE_INVERSION_DISABLED(value));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, OPUS_GET_PHASE_INVERSION_DISABLED(value));
+ else
+ *value = 0;
}
break;
#ifdef ENABLE_DRED
@@ -3063,6 +3186,28 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
}
break;
#endif
+#ifdef ENABLE_QEXT
+ case OPUS_SET_QEXT_REQUEST:
+ {
+ opus_int32 value = va_arg(ap, opus_int32);
+ if(value<0 || value>1)
+ {
+ goto bad_arg;
+ }
+ st->enable_qext = value;
+ }
+ break;
+ case OPUS_GET_QEXT_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (!value)
+ {
+ goto bad_arg;
+ }
+ *value = st->enable_qext;
+ }
+ break;
+#endif
case OPUS_RESET_STATE:
{
void *silk_enc;
@@ -3076,8 +3221,10 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
start = (char*)&st->OPUS_ENCODER_RESET_START;
OPUS_CLEAR(start, sizeof(OpusEncoder) - (start - (char*)st));
- celt_encoder_ctl(celt_enc, OPUS_RESET_STATE);
- silk_InitEncoder( silk_enc, st->arch, &dummy );
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ celt_encoder_ctl(celt_enc, OPUS_RESET_STATE);
+ if (st->application != OPUS_APPLICATION_RESTRICTED_CELT)
+ silk_InitEncoder( silk_enc, st->channels, st->arch, &dummy );
#ifdef ENABLE_DRED
/* Initialize DRED Encoder */
dred_encoder_reset( &st->dred_encoder );
@@ -3105,14 +3252,16 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
{
opus_int32 value = va_arg(ap, opus_int32);
st->lfe = value;
- ret = celt_encoder_ctl(celt_enc, OPUS_SET_LFE(value));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ ret = celt_encoder_ctl(celt_enc, OPUS_SET_LFE(value));
}
break;
case OPUS_SET_ENERGY_MASK_REQUEST:
{
celt_glog *value = va_arg(ap, celt_glog*);
st->energy_masking = value;
- ret = celt_encoder_ctl(celt_enc, OPUS_SET_ENERGY_MASK(value));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ ret = celt_encoder_ctl(celt_enc, OPUS_SET_ENERGY_MASK(value));
}
break;
case OPUS_GET_IN_DTX_REQUEST:
@@ -3164,6 +3313,7 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
{
goto bad_arg;
}
+ celt_assert(celt_enc != NULL);
ret = celt_encoder_ctl(celt_enc, CELT_GET_MODE(value));
}
break;
diff --git a/media/libopus/src/opus_multistream_encoder.c b/media/libopus/src/opus_multistream_encoder.c
@@ -61,14 +61,20 @@ static const VorbisLayout vorbis_mappings[8] = {
{5, 3, {0, 6, 1, 2, 3, 4, 5, 7}}, /* 8: 7.1 surround */
};
+#ifdef ENABLE_QEXT
+#define MAX_OVERLAP 240
+#else
+#define MAX_OVERLAP 120
+#endif
+
static opus_val32 *ms_get_preemph_mem(OpusMSEncoder *st)
{
int s;
char *ptr;
int coupled_size, mono_size;
- coupled_size = opus_encoder_get_size(2);
- mono_size = opus_encoder_get_size(1);
+ coupled_size = opus_encoder_init(NULL, st->Fs, 2, st->application);
+ mono_size = opus_encoder_init(NULL, st->Fs, 1, st->application);
ptr = (char*)st + align(sizeof(OpusMSEncoder));
for (s=0;s<st->layout.nb_streams;s++)
{
@@ -78,7 +84,7 @@ static opus_val32 *ms_get_preemph_mem(OpusMSEncoder *st)
ptr += align(mono_size);
}
/* void* cast avoids clang -Wcast-align warning */
- return (opus_val32*)(void*)(ptr+st->layout.nb_channels*120*sizeof(opus_val32));
+ return (opus_val32*)(void*)(ptr+st->layout.nb_channels*MAX_OVERLAP*sizeof(opus_val32));
}
static opus_val32 *ms_get_window_mem(OpusMSEncoder *st)
@@ -87,8 +93,8 @@ static opus_val32 *ms_get_window_mem(OpusMSEncoder *st)
char *ptr;
int coupled_size, mono_size;
- coupled_size = opus_encoder_get_size(2);
- mono_size = opus_encoder_get_size(1);
+ coupled_size = opus_encoder_init(NULL, st->Fs, 2, st->application);
+ mono_size = opus_encoder_init(NULL, st->Fs, 1, st->application);
ptr = (char*)st + align(sizeof(OpusMSEncoder));
for (s=0;s<st->layout.nb_streams;s++)
{
@@ -242,13 +248,14 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, celt_glog *ba
upsample = resampling_factor(rate);
frame_size = len*upsample;
- freq_size = IMIN(960, frame_size);
/* LM = log2(frame_size / 120) */
for (LM=0;LM<celt_mode->maxLM;LM++)
if (celt_mode->shortMdctSize<<LM==frame_size)
break;
+ freq_size = celt_mode->shortMdctSize<<LM;
+
ALLOC(in, frame_size+overlap, opus_val32);
ALLOC(x, len, opus_res);
ALLOC(freq, freq_size, opus_val32);
@@ -284,7 +291,7 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, celt_glog *ba
for (frame=0;frame<nb_frames;frame++)
{
opus_val32 tmpE[21];
- clt_mdct_forward(&celt_mode->mdct, in+960*frame, freq, celt_mode->window,
+ clt_mdct_forward(&celt_mode->mdct, in+freq_size*frame, freq, celt_mode->window,
overlap, celt_mode->maxLM-LM, 1, arch);
if (upsample != 1)
{
@@ -421,7 +428,7 @@ opus_int32 opus_multistream_surround_encoder_get_size(int channels, int mapping_
size = opus_multistream_encoder_get_size(nb_streams, nb_coupled_streams);
if (channels>2)
{
- size += channels*(120*sizeof(opus_val32) + sizeof(opus_val32));
+ size += channels*(MAX_OVERLAP*sizeof(opus_val32) + sizeof(opus_val32));
}
return size;
}
@@ -447,6 +454,23 @@ static int opus_multistream_encoder_init_impl(
(streams+coupled_streams>channels))
return OPUS_BAD_ARG;
+ coupled_size = opus_encoder_init(NULL, Fs, 2, application);
+ if (coupled_size < 0)
+ return coupled_size;
+ mono_size = opus_encoder_init(NULL, Fs, 1, application);
+ if (mono_size < 0)
+ return mono_size;
+ if (st == NULL)
+ {
+ int surround_size=0;
+ if (mapping_type == MAPPING_TYPE_SURROUND) {
+ surround_size = channels*(MAX_OVERLAP*sizeof(opus_val32) + sizeof(opus_val32));
+ }
+
+ return align(sizeof(OpusMSEncoder)) + coupled_streams*align(coupled_size)
+ + (streams-coupled_streams)*align(mono_size) + surround_size;
+ }
+
st->arch = opus_select_arch();
st->layout.nb_channels = channels;
st->layout.nb_streams = streams;
@@ -455,6 +479,7 @@ static int opus_multistream_encoder_init_impl(
st->lfe_stream = -1;
st->bitrate_bps = OPUS_AUTO;
st->application = application;
+ st->Fs = Fs;
st->variable_duration = OPUS_FRAMESIZE_ARG;
for (i=0;i<st->layout.nb_channels;i++)
st->layout.mapping[i] = mapping[i];
@@ -466,9 +491,6 @@ static int opus_multistream_encoder_init_impl(
!validate_ambisonics(st->layout.nb_channels, NULL, NULL))
return OPUS_BAD_ARG;
ptr = (char*)st + align(sizeof(OpusMSEncoder));
- coupled_size = opus_encoder_get_size(2);
- mono_size = opus_encoder_get_size(1);
-
for (i=0;i<st->layout.nb_coupled_streams;i++)
{
ret = opus_encoder_init((OpusEncoder*)ptr, Fs, 2, application);
@@ -480,15 +502,15 @@ static int opus_multistream_encoder_init_impl(
for (;i<st->layout.nb_streams;i++)
{
ret = opus_encoder_init((OpusEncoder*)ptr, Fs, 1, application);
+ if(ret!=OPUS_OK)return ret;
if (i==st->lfe_stream)
opus_encoder_ctl((OpusEncoder*)ptr, OPUS_SET_LFE(1));
- if(ret!=OPUS_OK)return ret;
ptr += align(mono_size);
}
if (mapping_type == MAPPING_TYPE_SURROUND)
{
OPUS_CLEAR(ms_get_preemph_mem(st), channels);
- OPUS_CLEAR(ms_get_window_mem(st), channels*120);
+ OPUS_CLEAR(ms_get_window_mem(st), channels*MAX_OVERLAP);
}
st->mapping_type = mapping_type;
return OPUS_OK;
@@ -521,10 +543,11 @@ int opus_multistream_surround_encoder_init(
)
{
MappingType mapping_type;
+ int lfe_stream;
if ((channels>255) || (channels<1))
return OPUS_BAD_ARG;
- st->lfe_stream = -1;
+ lfe_stream = -1;
if (mapping_family==0)
{
if (channels==1)
@@ -548,7 +571,7 @@ int opus_multistream_surround_encoder_init(
for (i=0;i<channels;i++)
mapping[i] = vorbis_mappings[channels-1].mapping[i];
if (channels>=6)
- st->lfe_stream = *streams-1;
+ lfe_stream = *streams-1;
} else if (mapping_family==255)
{
int i;
@@ -577,6 +600,9 @@ int opus_multistream_surround_encoder_init(
{
mapping_type = MAPPING_TYPE_NONE;
}
+ if (st != NULL) {
+ st->lfe_stream = lfe_stream;
+ }
return opus_multistream_encoder_init_impl(st, Fs, channels, *streams,
*coupled_streams, mapping,
application, mapping_type);
@@ -594,6 +620,7 @@ OpusMSEncoder *opus_multistream_encoder_create(
{
int ret;
OpusMSEncoder *st;
+ opus_int32 size;
if ((channels>255) || (channels<1) || (coupled_streams>streams) ||
(streams<1) || (coupled_streams<0) || (streams>255-coupled_streams) ||
(streams+coupled_streams>channels))
@@ -602,7 +629,14 @@ OpusMSEncoder *opus_multistream_encoder_create(
*error = OPUS_BAD_ARG;
return NULL;
}
- st = (OpusMSEncoder *)opus_alloc(opus_multistream_encoder_get_size(streams, coupled_streams));
+ size = opus_multistream_encoder_init(NULL, Fs, channels, streams, coupled_streams, mapping, application);
+ if (size < 0)
+ {
+ if (error)
+ *error = size;
+ return NULL;
+ }
+ st = (OpusMSEncoder *)opus_alloc(size);
if (st==NULL)
{
if (error)
@@ -640,11 +674,11 @@ OpusMSEncoder *opus_multistream_surround_encoder_create(
*error = OPUS_BAD_ARG;
return NULL;
}
- size = opus_multistream_surround_encoder_get_size(channels, mapping_family);
- if (!size)
+ size = opus_multistream_surround_encoder_init(NULL, Fs, channels, mapping_family, streams, coupled_streams, mapping, application);
+ if (size < 0)
{
if (error)
- *error = OPUS_UNIMPLEMENTED;
+ *error = size;
return NULL;
}
st = (OpusMSEncoder *)opus_alloc(size);
@@ -824,7 +858,7 @@ int opus_multistream_encode_native
unsigned char tmp_data[MS_FRAME_TMP];
OpusRepacketizer rp;
opus_int32 vbr;
- const CELTMode *celt_mode;
+ const CELTMode *celt_mode=NULL;
opus_int32 bitrates[256];
celt_glog bandLogE[42];
opus_val32 *mem = NULL;
@@ -843,9 +877,10 @@ int opus_multistream_encode_native
ptr = (char*)st + align(sizeof(OpusMSEncoder));
opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_SAMPLE_RATE(&Fs));
opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_VBR(&vbr));
- opus_encoder_ctl((OpusEncoder*)ptr, CELT_GET_MODE(&celt_mode));
+ if (st->application != OPUS_APPLICATION_RESTRICTED_SILK)
+ opus_encoder_ctl((OpusEncoder*)ptr, CELT_GET_MODE(&celt_mode));
- frame_size = frame_size_select(analysis_frame_size, st->variable_duration, Fs);
+ frame_size = frame_size_select(st->application, analysis_frame_size, st->variable_duration, Fs);
if (frame_size <= 0)
{
RESTORE_STACK;
@@ -863,13 +898,13 @@ int opus_multistream_encode_native
return OPUS_BUFFER_TOO_SMALL;
}
ALLOC(buf, 2*frame_size, opus_res);
- coupled_size = opus_encoder_get_size(2);
- mono_size = opus_encoder_get_size(1);
+ coupled_size = opus_encoder_init(NULL, st->Fs, 2, st->application);
+ mono_size = opus_encoder_init(NULL, st->Fs, 1, st->application);
ALLOC(bandSMR, 21*st->layout.nb_channels, celt_glog);
- if (st->mapping_type == MAPPING_TYPE_SURROUND)
+ if (st->mapping_type == MAPPING_TYPE_SURROUND && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
{
- surround_analysis(celt_mode, pcm, bandSMR, mem, preemph_mem, frame_size, 120, st->layout.nb_channels, Fs, copy_channel_in, st->arch);
+ surround_analysis(celt_mode, pcm, bandSMR, mem, preemph_mem, frame_size, celt_mode->overlap, st->layout.nb_channels, Fs, copy_channel_in, st->arch);
}
/* Compute bitrate allocation between streams (this could be a lot better) */
@@ -946,7 +981,7 @@ int opus_multistream_encode_native
(*copy_channel_in)(buf+1, 2,
pcm, st->layout.nb_channels, right, frame_size, user_data);
ptr += align(coupled_size);
- if (st->mapping_type == MAPPING_TYPE_SURROUND)
+ if (st->mapping_type == MAPPING_TYPE_SURROUND && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
{
for (i=0;i<21;i++)
{
@@ -962,7 +997,7 @@ int opus_multistream_encode_native
(*copy_channel_in)(buf, 1,
pcm, st->layout.nb_channels, chan, frame_size, user_data);
ptr += align(mono_size);
- if (st->mapping_type == MAPPING_TYPE_SURROUND)
+ if (st->mapping_type == MAPPING_TYPE_SURROUND && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
{
for (i=0;i<21;i++)
bandLogE[i] = bandSMR[21*chan+i];
@@ -970,7 +1005,7 @@ int opus_multistream_encode_native
c1 = chan;
c2 = -1;
}
- if (st->mapping_type == MAPPING_TYPE_SURROUND)
+ if (st->mapping_type == MAPPING_TYPE_SURROUND && st->application != OPUS_APPLICATION_RESTRICTED_SILK)
opus_encoder_ctl(enc, OPUS_SET_ENERGY_MASK(bandLogE));
/* number of bytes left (+Toc) */
curr_max = max_data_bytes - tot_size;
@@ -1113,8 +1148,8 @@ int opus_multistream_encoder_ctl_va_list(OpusMSEncoder *st, int request,
char *ptr;
int ret = OPUS_OK;
- coupled_size = opus_encoder_get_size(2);
- mono_size = opus_encoder_get_size(1);
+ coupled_size = opus_encoder_init(NULL, st->Fs, 2, st->application);
+ mono_size = opus_encoder_init(NULL, st->Fs, 1, st->application);
ptr = (char*)st + align(sizeof(OpusMSEncoder));
switch (request)
{
@@ -1169,6 +1204,7 @@ int opus_multistream_encoder_ctl_va_list(OpusMSEncoder *st, int request,
case OPUS_GET_FORCE_CHANNELS_REQUEST:
case OPUS_GET_PREDICTION_DISABLED_REQUEST:
case OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST:
+ case OPUS_GET_QEXT_REQUEST:
{
OpusEncoder *enc;
/* For int32* GET params, just query the first stream */
@@ -1216,6 +1252,7 @@ int opus_multistream_encoder_ctl_va_list(OpusMSEncoder *st, int request,
case OPUS_SET_FORCE_CHANNELS_REQUEST:
case OPUS_SET_PREDICTION_DISABLED_REQUEST:
case OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST:
+ case OPUS_SET_QEXT_REQUEST:
{
int s;
/* This works for int32 params */
@@ -1280,7 +1317,7 @@ int opus_multistream_encoder_ctl_va_list(OpusMSEncoder *st, int request,
if (st->mapping_type == MAPPING_TYPE_SURROUND)
{
OPUS_CLEAR(ms_get_preemph_mem(st), st->layout.nb_channels);
- OPUS_CLEAR(ms_get_window_mem(st), st->layout.nb_channels*120);
+ OPUS_CLEAR(ms_get_window_mem(st), st->layout.nb_channels*MAX_OVERLAP);
}
for (s=0;s<st->layout.nb_streams;s++)
{
diff --git a/media/libopus/src/opus_private.h b/media/libopus/src/opus_private.h
@@ -101,6 +101,7 @@ struct OpusMSEncoder {
int arch;
int lfe_stream;
int application;
+ opus_int32 Fs;
int variable_duration;
MappingType mapping_type;
opus_int32 bitrate_bps;
@@ -181,7 +182,7 @@ void opus_pcm_soft_clip_impl(float *_x, int N, int C, float *declip_mem, int arc
int encode_size(int size, unsigned char *data);
-opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs);
+opus_int32 frame_size_select(int application, opus_int32 frame_size, int variable_duration, opus_int32 Fs);
opus_int32 opus_encode_native(OpusEncoder *st, const opus_res *pcm, int frame_size,
unsigned char *data, opus_int32 out_data_bytes, int lsb_depth,