forked from mirrors/gecko-dev
Backed out 2 changesets (bug 1778921) for causing build bustages. CLOSED TREE
Backed out changeset e587c9bc5b83 (bug 1778921) Backed out changeset 04fa88f59192 (bug 1778921)
This commit is contained in:
parent
5927a9eb19
commit
7f3ff3f4d3
40 changed files with 276 additions and 311 deletions
21
media/libopus/Makefile.in
Normal file
21
media/libopus/Makefile.in
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef GNU_AS
|
||||
ifeq ($(CPU_ARCH),arm)
|
||||
|
||||
celt_pitch_xcorr_arm-gnu.s: celt/arm/armopts-gnu.S
|
||||
|
||||
# armopts needs a specific rule, because arm2gnu.pl will always add the .S
|
||||
# suffix when translating the files that include it.
|
||||
celt/arm/armopts-gnu.S: $(srcdir)/celt/arm/armopts.s $(call mkdir_deps,celt/arm) $(GLOBAL_DEPS)
|
||||
$(PERL) $(srcdir)/celt/arm/arm2gnu.pl < $< > $@
|
||||
# For all others, we can use an implicit rule
|
||||
%-gnu.s: $(srcdir)/celt/arm/%.s $(GLOBAL_DEPS)
|
||||
$(PERL) $(srcdir)/celt/arm/arm2gnu.pl < $< > $@
|
||||
|
||||
endif
|
||||
endif
|
||||
|
|
@ -156,7 +156,7 @@ opus_uint32 opus_cpu_capabilities(void)
|
|||
"your platform. Reconfigure with --disable-rtcd (or send patches)."
|
||||
#endif
|
||||
|
||||
static int opus_select_arch_impl(void)
|
||||
int opus_select_arch(void)
|
||||
{
|
||||
opus_uint32 flags = opus_cpu_capabilities();
|
||||
int arch = 0;
|
||||
|
|
@ -184,11 +184,4 @@ static int opus_select_arch_impl(void)
|
|||
return arch;
|
||||
}
|
||||
|
||||
int opus_select_arch(void) {
|
||||
int arch = opus_select_arch_impl();
|
||||
#ifdef FUZZING
|
||||
arch = rand()%(arch+1);
|
||||
#endif
|
||||
return arch;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -137,27 +137,22 @@ void dual_inner_prod_neon(const opus_val16 *x, const opus_val16 *y01, const opus
|
|||
/* celt_inner_prod_neon_float_c_simulation() simulates the floating-point */
|
||||
/* operations of celt_inner_prod_neon(), and both functions should have bit */
|
||||
/* exact output. */
|
||||
static opus_val32 celt_inner_prod_neon_float_c_simulation(const opus_val16 *x, const opus_val16 *y, float *err, int N)
|
||||
static opus_val32 celt_inner_prod_neon_float_c_simulation(const opus_val16 *x, const opus_val16 *y, int N)
|
||||
{
|
||||
int i;
|
||||
*err = 0;
|
||||
opus_val32 xy, xy0 = 0, xy1 = 0, xy2 = 0, xy3 = 0;
|
||||
for (i = 0; i < N - 3; i += 4) {
|
||||
xy0 = MAC16_16(xy0, x[i + 0], y[i + 0]);
|
||||
xy1 = MAC16_16(xy1, x[i + 1], y[i + 1]);
|
||||
xy2 = MAC16_16(xy2, x[i + 2], y[i + 2]);
|
||||
xy3 = MAC16_16(xy3, x[i + 3], y[i + 3]);
|
||||
*err += ABS32(xy0)+ABS32(xy1)+ABS32(xy2)+ABS32(xy3);
|
||||
}
|
||||
xy0 += xy2;
|
||||
xy1 += xy3;
|
||||
xy = xy0 + xy1;
|
||||
*err += ABS32(xy1)+ABS32(xy0)+ABS32(xy);
|
||||
for (; i < N; i++) {
|
||||
xy = MAC16_16(xy, x[i], y[i]);
|
||||
*err += ABS32(xy);
|
||||
}
|
||||
*err = *err*2e-7 + N*1e-37;
|
||||
return xy;
|
||||
}
|
||||
|
||||
|
|
@ -165,10 +160,32 @@ static opus_val32 celt_inner_prod_neon_float_c_simulation(const opus_val16 *x, c
|
|||
/* operations of dual_inner_prod_neon(), and both functions should have bit */
|
||||
/* exact output. */
|
||||
static void dual_inner_prod_neon_float_c_simulation(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02,
|
||||
int N, opus_val32 *xy1, opus_val32 *xy2, float *err)
|
||||
int N, opus_val32 *xy1, opus_val32 *xy2)
|
||||
{
|
||||
*xy1 = celt_inner_prod_neon_float_c_simulation(x, y01, &err[0], N);
|
||||
*xy2 = celt_inner_prod_neon_float_c_simulation(x, y02, &err[1], N);
|
||||
int i;
|
||||
opus_val32 xy01, xy02, xy01_0 = 0, xy01_1 = 0, xy01_2 = 0, xy01_3 = 0, xy02_0 = 0, xy02_1 = 0, xy02_2 = 0, xy02_3 = 0;
|
||||
for (i = 0; i < N - 3; i += 4) {
|
||||
xy01_0 = MAC16_16(xy01_0, x[i + 0], y01[i + 0]);
|
||||
xy01_1 = MAC16_16(xy01_1, x[i + 1], y01[i + 1]);
|
||||
xy01_2 = MAC16_16(xy01_2, x[i + 2], y01[i + 2]);
|
||||
xy01_3 = MAC16_16(xy01_3, x[i + 3], y01[i + 3]);
|
||||
xy02_0 = MAC16_16(xy02_0, x[i + 0], y02[i + 0]);
|
||||
xy02_1 = MAC16_16(xy02_1, x[i + 1], y02[i + 1]);
|
||||
xy02_2 = MAC16_16(xy02_2, x[i + 2], y02[i + 2]);
|
||||
xy02_3 = MAC16_16(xy02_3, x[i + 3], y02[i + 3]);
|
||||
}
|
||||
xy01_0 += xy01_2;
|
||||
xy02_0 += xy02_2;
|
||||
xy01_1 += xy01_3;
|
||||
xy02_1 += xy02_3;
|
||||
xy01 = xy01_0 + xy01_1;
|
||||
xy02 = xy02_0 + xy02_1;
|
||||
for (; i < N; i++) {
|
||||
xy01 = MAC16_16(xy01, x[i], y01[i]);
|
||||
xy02 = MAC16_16(xy02, x[i], y02[i]);
|
||||
}
|
||||
*xy1 = xy01;
|
||||
*xy2 = xy02;
|
||||
}
|
||||
|
||||
#endif /* OPUS_CHECK_ASM */
|
||||
|
|
@ -208,12 +225,7 @@ opus_val32 celt_inner_prod_neon(const opus_val16 *x, const opus_val16 *y, int N)
|
|||
}
|
||||
|
||||
#ifdef OPUS_CHECK_ASM
|
||||
{
|
||||
float err, res;
|
||||
res = celt_inner_prod_neon_float_c_simulation(x, y, &err, N);
|
||||
/*if (ABS32(res - xy) > err) fprintf(stderr, "%g %g %g\n", res, xy, err);*/
|
||||
celt_assert(ABS32(res - xy) <= err);
|
||||
}
|
||||
celt_assert(ABS32(celt_inner_prod_neon_float_c_simulation(x, y, N) - xy) <= VERY_SMALL);
|
||||
#endif
|
||||
|
||||
return xy;
|
||||
|
|
@ -268,12 +280,9 @@ void dual_inner_prod_neon(const opus_val16 *x, const opus_val16 *y01, const opus
|
|||
#ifdef OPUS_CHECK_ASM
|
||||
{
|
||||
opus_val32 xy1_c, xy2_c;
|
||||
float err[2];
|
||||
dual_inner_prod_neon_float_c_simulation(x, y01, y02, N, &xy1_c, &xy2_c, err);
|
||||
/*if (ABS32(xy1_c - *xy1) > err[0]) fprintf(stderr, "dual1 fail: %g %g %g\n", xy1_c, *xy1, err[0]);
|
||||
if (ABS32(xy2_c - *xy2) > err[1]) fprintf(stderr, "dual2 fail: %g %g %g\n", xy2_c, *xy2, err[1]);*/
|
||||
celt_assert(ABS32(xy1_c - *xy1) <= err[0]);
|
||||
celt_assert(ABS32(xy2_c - *xy2) <= err[1]);
|
||||
dual_inner_prod_neon_float_c_simulation(x, y01, y02, N, &xy1_c, &xy2_c);
|
||||
celt_assert(ABS32(xy1_c - *xy1) <= VERY_SMALL);
|
||||
celt_assert(ABS32(xy2_c - *xy2) <= VERY_SMALL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1380,7 +1380,6 @@ static unsigned quant_band_stereo(struct band_ctx *ctx, celt_norm *X, celt_norm
|
|||
return cm;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_UPDATE_DRAFT
|
||||
static void special_hybrid_folding(const CELTMode *m, celt_norm *norm, celt_norm *norm2, int start, int M, int dual_stereo)
|
||||
{
|
||||
int n1, n2;
|
||||
|
|
@ -1393,7 +1392,6 @@ static void special_hybrid_folding(const CELTMode *m, celt_norm *norm, celt_norm
|
|||
if (dual_stereo)
|
||||
OPUS_COPY(&norm2[n1], &norm2[2*n1 - n2], n2-n1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void quant_all_bands(int encode, const CELTMode *m, int start, int end,
|
||||
celt_norm *X_, celt_norm *Y_, unsigned char *collapse_masks,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ struct OpusCustomDecoder {
|
|||
opus_uint32 rng;
|
||||
int error;
|
||||
int last_pitch_index;
|
||||
int loss_duration;
|
||||
int loss_count;
|
||||
int skip_plc;
|
||||
int postfilter_period;
|
||||
int postfilter_period_old;
|
||||
|
|
@ -512,7 +512,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
|||
int nbEBands;
|
||||
int overlap;
|
||||
int start;
|
||||
int loss_duration;
|
||||
int loss_count;
|
||||
int noise_based;
|
||||
const opus_int16 *eBands;
|
||||
SAVE_STACK;
|
||||
|
|
@ -532,9 +532,9 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
|||
oldLogE2 = oldLogE + 2*nbEBands;
|
||||
backgroundLogE = oldLogE2 + 2*nbEBands;
|
||||
|
||||
loss_duration = st->loss_duration;
|
||||
loss_count = st->loss_count;
|
||||
start = st->start;
|
||||
noise_based = loss_duration >= 40 || start != 0 || st->skip_plc;
|
||||
noise_based = loss_count >= 5 || start != 0 || st->skip_plc;
|
||||
if (noise_based)
|
||||
{
|
||||
/* Noise-based PLC/CNG */
|
||||
|
|
@ -559,7 +559,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
|||
#endif
|
||||
|
||||
/* Energy decay */
|
||||
decay = loss_duration==0 ? QCONST16(1.5f, DB_SHIFT) : QCONST16(.5f, DB_SHIFT);
|
||||
decay = loss_count==0 ? QCONST16(1.5f, DB_SHIFT) : QCONST16(.5f, DB_SHIFT);
|
||||
c=0; do
|
||||
{
|
||||
for (i=start;i<end;i++)
|
||||
|
|
@ -602,7 +602,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
|||
VARDECL(opus_val16, _exc);
|
||||
VARDECL(opus_val16, fir_tmp);
|
||||
|
||||
if (loss_duration == 0)
|
||||
if (loss_count == 0)
|
||||
{
|
||||
st->last_pitch_index = pitch_index = celt_plc_pitch_search(decode_mem, C, st->arch);
|
||||
} else {
|
||||
|
|
@ -632,7 +632,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
|||
for (i=0;i<MAX_PERIOD+LPC_ORDER;i++)
|
||||
exc[i-LPC_ORDER] = ROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-LPC_ORDER+i], SIG_SHIFT);
|
||||
|
||||
if (loss_duration == 0)
|
||||
if (loss_count == 0)
|
||||
{
|
||||
opus_val32 ac[LPC_ORDER+1];
|
||||
/* Compute LPC coefficients for the last MAX_PERIOD samples before
|
||||
|
|
@ -812,8 +812,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
|||
} while (++c<C);
|
||||
}
|
||||
|
||||
/* Saturate to soemthing large to avoid wrap-around. */
|
||||
st->loss_duration = IMIN(10000, loss_duration+(1<<LM));
|
||||
st->loss_count = loss_count+1;
|
||||
|
||||
RESTORE_STACK;
|
||||
}
|
||||
|
|
@ -869,7 +868,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
|||
int nbEBands;
|
||||
int overlap;
|
||||
const opus_int16 *eBands;
|
||||
opus_val16 max_background_increase;
|
||||
ALLOC_STACK;
|
||||
|
||||
VALIDATE_CELT_DECODER(st);
|
||||
|
|
@ -944,7 +942,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
|||
|
||||
/* Check if there are at least two packets received consecutively before
|
||||
* turning on the pitch-based PLC */
|
||||
st->skip_plc = st->loss_duration != 0;
|
||||
st->skip_plc = st->loss_count != 0;
|
||||
|
||||
if (dec == NULL)
|
||||
{
|
||||
|
|
@ -1142,21 +1140,25 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
|||
if (C==1)
|
||||
OPUS_COPY(&oldBandE[nbEBands], oldBandE, nbEBands);
|
||||
|
||||
/* In case start or end were to change */
|
||||
if (!isTransient)
|
||||
{
|
||||
opus_val16 max_background_increase;
|
||||
OPUS_COPY(oldLogE2, oldLogE, 2*nbEBands);
|
||||
OPUS_COPY(oldLogE, oldBandE, 2*nbEBands);
|
||||
/* In normal circumstances, we only allow the noise floor to increase by
|
||||
up to 2.4 dB/second, but when we're in DTX, we allow up to 6 dB
|
||||
increase for each update.*/
|
||||
if (st->loss_count < 10)
|
||||
max_background_increase = M*QCONST16(0.001f,DB_SHIFT);
|
||||
else
|
||||
max_background_increase = QCONST16(1.f,DB_SHIFT);
|
||||
for (i=0;i<2*nbEBands;i++)
|
||||
backgroundLogE[i] = MIN16(backgroundLogE[i] + max_background_increase, oldBandE[i]);
|
||||
} else {
|
||||
for (i=0;i<2*nbEBands;i++)
|
||||
oldLogE[i] = MIN16(oldLogE[i], oldBandE[i]);
|
||||
}
|
||||
/* In normal circumstances, we only allow the noise floor to increase by
|
||||
up to 2.4 dB/second, but when we're in DTX we give the weight of
|
||||
all missing packets to the update packet. */
|
||||
max_background_increase = IMIN(160, st->loss_duration+M)*QCONST16(0.001f,DB_SHIFT);
|
||||
for (i=0;i<2*nbEBands;i++)
|
||||
backgroundLogE[i] = MIN16(backgroundLogE[i] + max_background_increase, oldBandE[i]);
|
||||
/* In case start or end were to change */
|
||||
c=0; do
|
||||
{
|
||||
for (i=0;i<start;i++)
|
||||
|
|
@ -1173,7 +1175,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
|
|||
st->rng = dec->rng;
|
||||
|
||||
deemphasis(out_syn, pcm, N, CC, st->downsample, mode->preemph, st->preemph_memD, accum);
|
||||
st->loss_duration = 0;
|
||||
st->loss_count = 0;
|
||||
RESTORE_STACK;
|
||||
if (ec_tell(dec) > 8*len)
|
||||
return OPUS_INTERNAL_ERROR;
|
||||
|
|
|
|||
|
|
@ -1719,11 +1719,8 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
|
|||
compute_mdcts(mode, 0, in, freq, C, CC, LM, st->upsample, st->arch);
|
||||
compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch);
|
||||
amp2Log2(mode, effEnd, end, bandE, bandLogE2, C);
|
||||
for (c=0;c<C;c++)
|
||||
{
|
||||
for (i=0;i<end;i++)
|
||||
bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT));
|
||||
}
|
||||
for (i=0;i<C*nbEBands;i++)
|
||||
bandLogE2[i] += HALF16(SHL16(LM, DB_SHIFT));
|
||||
}
|
||||
|
||||
compute_mdcts(mode, shortBlocks, in, freq, C, CC, LM, st->upsample, st->arch);
|
||||
|
|
@ -1859,11 +1856,8 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
|
|||
compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch);
|
||||
amp2Log2(mode, effEnd, end, bandE, bandLogE, C);
|
||||
/* Compensate for the scaling of short vs long mdcts */
|
||||
for (c=0;c<C;c++)
|
||||
{
|
||||
for (i=0;i<end;i++)
|
||||
bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT));
|
||||
}
|
||||
for (i=0;i<C*nbEBands;i++)
|
||||
bandLogE2[i] += HALF16(SHL16(LM, DB_SHIFT));
|
||||
tf_estimate = QCONST16(.2f,14);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@
|
|||
*/
|
||||
#define OPUS_ARCHMASK 3
|
||||
|
||||
#elif defined(OPUS_HAVE_RTCD) && \
|
||||
((defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \
|
||||
#elif (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX)))
|
||||
(defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX))
|
||||
|
||||
#include "x86/x86cpu.h"
|
||||
/* We currently support 5 x86 variants:
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static OPUS_INLINE short SHR16_(int a, int shift, char *file, int line)
|
|||
#define SHL16(a, shift) SHL16_(a, shift, __FILE__, __LINE__)
|
||||
static OPUS_INLINE short SHL16_(int a, int shift, char *file, int line)
|
||||
{
|
||||
opus_int32 res;
|
||||
int res;
|
||||
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
|
||||
{
|
||||
fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line);
|
||||
|
|
@ -175,7 +175,7 @@ static OPUS_INLINE short SHL16_(int a, int shift, char *file, int line)
|
|||
celt_assert(0);
|
||||
#endif
|
||||
}
|
||||
res = (opus_int32)((opus_uint32)a<<shift);
|
||||
res = a<<shift;
|
||||
if (!VERIFY_SHORT(res))
|
||||
{
|
||||
fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line);
|
||||
|
|
@ -214,15 +214,15 @@ static OPUS_INLINE int SHL32_(opus_int64 a, int shift, char *file, int line)
|
|||
opus_int64 res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
|
||||
{
|
||||
fprintf (stderr, "SHL32: inputs are not int: %lld %d in %s: line %d\n", (long long)a, shift, file, line);
|
||||
fprintf (stderr, "SHL32: inputs are not int: %lld %d in %s: line %d\n", a, shift, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
}
|
||||
res = (opus_int64)((opus_uint64)a<<shift);
|
||||
res = a<<shift;
|
||||
if (!VERIFY_INT(res))
|
||||
{
|
||||
fprintf (stderr, "SHL32: output is not int: %lld<<%d = %lld in %s: line %d\n", (long long)a, shift, (long long)res, file, line);
|
||||
fprintf (stderr, "SHL32: output is not int: %lld<<%d = %lld in %s: line %d\n", a, shift, res, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -339,7 +339,7 @@ static OPUS_INLINE unsigned int UADD32_(opus_uint64 a, opus_uint64 b, char *file
|
|||
opus_uint64 res;
|
||||
if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
|
||||
{
|
||||
fprintf (stderr, "UADD32: inputs are not uint32: %llu %llu in %s: line %d\n", (unsigned long long)a, (unsigned long long)b, file, line);
|
||||
fprintf (stderr, "UADD32: inputs are not uint32: %llu %llu in %s: line %d\n", a, b, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -347,7 +347,7 @@ static OPUS_INLINE unsigned int UADD32_(opus_uint64 a, opus_uint64 b, char *file
|
|||
res = a+b;
|
||||
if (!VERIFY_UINT(res))
|
||||
{
|
||||
fprintf (stderr, "UADD32: output is not uint32: %llu in %s: line %d\n", (unsigned long long)res, file, line);
|
||||
fprintf (stderr, "UADD32: output is not uint32: %llu in %s: line %d\n", res, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -363,14 +363,14 @@ static OPUS_INLINE unsigned int USUB32_(opus_uint64 a, opus_uint64 b, char *file
|
|||
opus_uint64 res;
|
||||
if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
|
||||
{
|
||||
fprintf (stderr, "USUB32: inputs are not uint32: %llu %llu in %s: line %d\n", (unsigned long long)a, (unsigned long long)b, file, line);
|
||||
fprintf (stderr, "USUB32: inputs are not uint32: %llu %llu in %s: line %d\n", a, b, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
}
|
||||
if (a<b)
|
||||
{
|
||||
fprintf (stderr, "USUB32: inputs underflow: %llu < %llu in %s: line %d\n", (unsigned long long)a, (unsigned long long)b, file, line);
|
||||
fprintf (stderr, "USUB32: inputs underflow: %llu < %llu in %s: line %d\n", a, b, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -378,7 +378,7 @@ static OPUS_INLINE unsigned int USUB32_(opus_uint64 a, opus_uint64 b, char *file
|
|||
res = a-b;
|
||||
if (!VERIFY_UINT(res))
|
||||
{
|
||||
fprintf (stderr, "USUB32: output is not uint32: %llu - %llu = %llu in %s: line %d\n", (unsigned long long)a, (unsigned long long)b, (unsigned long long)res, file, line);
|
||||
fprintf (stderr, "USUB32: output is not uint32: %llu - %llu = %llu in %s: line %d\n", a, b, res, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -416,7 +416,7 @@ static OPUS_INLINE int MULT32_32_32(opus_int64 a, opus_int64 b)
|
|||
opus_int64 res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_INT(b))
|
||||
{
|
||||
fprintf (stderr, "MULT32_32_32: inputs are not int: %lld %lld\n", (long long)a, (long long)b);
|
||||
fprintf (stderr, "MULT32_32_32: inputs are not int: %d %d\n", a, b);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -424,7 +424,7 @@ static OPUS_INLINE int MULT32_32_32(opus_int64 a, opus_int64 b)
|
|||
res = a*b;
|
||||
if (!VERIFY_INT(res))
|
||||
{
|
||||
fprintf (stderr, "MULT32_32_32: output is not int: %lld\n", (long long)res);
|
||||
fprintf (stderr, "MULT32_32_32: output is not int: %d\n", res);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -438,7 +438,7 @@ static OPUS_INLINE int MULT32_32_Q16(opus_int64 a, opus_int64 b)
|
|||
opus_int64 res;
|
||||
if (!VERIFY_INT(a) || !VERIFY_INT(b))
|
||||
{
|
||||
fprintf (stderr, "MULT32_32_Q16: inputs are not int: %lld %lld\n", (long long)a, (long long)b);
|
||||
fprintf (stderr, "MULT32_32_Q16: inputs are not int: %d %d\n", a, b);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -446,7 +446,7 @@ static OPUS_INLINE int MULT32_32_Q16(opus_int64 a, opus_int64 b)
|
|||
res = ((opus_int64)(a)*(opus_int64)(b)) >> 16;
|
||||
if (!VERIFY_INT(res))
|
||||
{
|
||||
fprintf (stderr, "MULT32_32_Q16: output is not int: %lld*%lld=%lld\n", (long long)a, (long long)b, (long long)res);
|
||||
fprintf (stderr, "MULT32_32_Q16: output is not int: %d*%d=%d\n", a, b, (int)res);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
celt_assert(0);
|
||||
#endif
|
||||
|
|
@ -831,6 +831,6 @@ static OPUS_INLINE opus_val16 SIG2WORD16_generic(celt_sig x)
|
|||
|
||||
|
||||
#undef PRINT_MIPS
|
||||
#define PRINT_MIPS(file) do {fprintf (file, "total complexity = %llu MIPS\n", (unsigned long long)celt_mips);} while (0);
|
||||
#define PRINT_MIPS(file) do {fprintf (file, "total complexity = %llu MIPS\n", celt_mips);} while (0);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_s
|
|||
return intgr ;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_LRINTF) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#elif defined(HAVE_LRINTF)
|
||||
|
||||
/* These defines enable functionality introduced with the 1999 ISO C
|
||||
** standard. They must be defined before the inclusion of math.h to
|
||||
|
|
@ -117,7 +117,7 @@ static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_s
|
|||
#include <math.h>
|
||||
#define float2int(x) lrintf(x)
|
||||
|
||||
#elif defined(HAVE_LRINT) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#elif (defined(HAVE_LRINT))
|
||||
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
|
|
|
|||
|
|
@ -173,10 +173,7 @@ static void compute_allocation_table(CELTMode *mode)
|
|||
mode->nbAllocVectors = BITALLOC_SIZE;
|
||||
allocVectors = opus_alloc(sizeof(unsigned char)*(BITALLOC_SIZE*mode->nbEBands));
|
||||
if (allocVectors==NULL)
|
||||
{
|
||||
mode->allocVectors = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check for standard mode */
|
||||
if (mode->Fs == 400*(opus_int32)mode->shortMdctSize)
|
||||
|
|
|
|||
|
|
@ -161,26 +161,17 @@ 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);
|
||||
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);
|
||||
}
|
||||
#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];
|
||||
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];
|
||||
}
|
||||
#endif
|
||||
for (i=1;i<len>>1;i++)
|
||||
x_lp[i] = SHR32(HALF32(HALF32(x[0][(2*i-1)]+x[0][(2*i+1)])+x[0][2*i]), shift);
|
||||
x_lp[0] = SHR32(HALF32(HALF32(x[0][1])+x[0][0]), shift);
|
||||
if (C==2)
|
||||
{
|
||||
for (i=1;i<len>>1;i++)
|
||||
x_lp[i] += SHR32(HALF32(HALF32(x[1][(2*i-1)]+x[1][(2*i+1)])+x[1][2*i]), shift);
|
||||
x_lp[0] += SHR32(HALF32(HALF32(x[1][1])+x[1][0]), shift);
|
||||
}
|
||||
|
||||
_celt_autocorr(x_lp, ac, NULL, 0,
|
||||
4, len>>1, arch);
|
||||
|
||||
|
|
@ -258,7 +249,7 @@ celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y,
|
|||
opus_val32 maxcorr=1;
|
||||
#endif
|
||||
celt_assert(max_pitch>0);
|
||||
celt_sig_assert(((size_t)_x&3)==0);
|
||||
celt_sig_assert((((unsigned char *)_x-(unsigned char *)NULL)&3)==0);
|
||||
for (i=0;i<max_pitch-3;i+=4)
|
||||
{
|
||||
opus_val32 sum[4]={0,0,0,0};
|
||||
|
|
|
|||
|
|
@ -356,8 +356,6 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end,
|
|||
else
|
||||
depth_threshold = 0;
|
||||
#ifdef FUZZING
|
||||
(void)signalBandwidth;
|
||||
(void)depth_threshold;
|
||||
if ((rand()&0x1) == 0)
|
||||
#else
|
||||
if (codedBands<=start+2 || (band_bits > (depth_threshold*band_width<<LM<<BITRES)>>4 && j<=signalBandwidth))
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)
|
||||
#define OVERRIDE_CELT_FIR
|
||||
|
||||
void celt_fir_sse4_1(
|
||||
const opus_val16 *x,
|
||||
|
|
@ -43,11 +44,10 @@ void celt_fir_sse4_1(
|
|||
int arch);
|
||||
|
||||
#if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#define OVERRIDE_CELT_FIR
|
||||
#define celt_fir(x, num, y, N, ord, arch) \
|
||||
((void)arch, celt_fir_sse4_1(x, num, y, N, ord, arch))
|
||||
|
||||
#elif defined(OPUS_HAVE_RTCD)
|
||||
#else
|
||||
|
||||
extern void (*const CELT_FIR_IMPL[OPUS_ARCHMASK + 1])(
|
||||
const opus_val16 *x,
|
||||
|
|
@ -57,7 +57,6 @@ extern void (*const CELT_FIR_IMPL[OPUS_ARCHMASK + 1])(
|
|||
int ord,
|
||||
int arch);
|
||||
|
||||
#define OVERRIDE_CELT_FIR
|
||||
# define celt_fir(x, num, y, N, ord, arch) \
|
||||
((*CELT_FIR_IMPL[(arch) & OPUS_ARCHMASK])(x, num, y, N, ord, arch))
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void xcorr_kernel_sse(
|
|||
#define xcorr_kernel(x, y, sum, len, arch) \
|
||||
((void)arch, xcorr_kernel_sse(x, y, sum, len))
|
||||
|
||||
#elif defined(OPUS_HAVE_RTCD) && ((defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)) || (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)))
|
||||
#elif (defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)) || (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT))
|
||||
|
||||
extern void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
|
||||
const opus_val16 *x,
|
||||
|
|
@ -115,8 +115,8 @@ opus_val32 celt_inner_prod_sse(
|
|||
((void)arch, celt_inner_prod_sse(x, y, N))
|
||||
|
||||
|
||||
#elif defined(OPUS_HAVE_RTCD) && (((defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)) && defined(FIXED_POINT)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)))
|
||||
#elif ((defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)) && defined(FIXED_POINT)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT))
|
||||
|
||||
extern opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])(
|
||||
const opus_val16 *x,
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@
|
|||
#include "pitch.h"
|
||||
#include "x86cpu.h"
|
||||
|
||||
#if defined(OPUS_HAVE_RTCD) && \
|
||||
((defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \
|
||||
#if (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \
|
||||
(defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX)))
|
||||
(defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX))
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
|
|
@ -68,8 +68,7 @@ static void cpuid(unsigned int CPUInfo[4], unsigned int InfoType)
|
|||
"=r" (CPUInfo[1]),
|
||||
"=c" (CPUInfo[2]),
|
||||
"=d" (CPUInfo[3]) :
|
||||
/* We clear ECX to avoid a valgrind false-positive prior to v3.17.0. */
|
||||
"0" (InfoType), "2" (0)
|
||||
"0" (InfoType)
|
||||
);
|
||||
#else
|
||||
__asm__ __volatile__ (
|
||||
|
|
@ -78,22 +77,11 @@ static void cpuid(unsigned int CPUInfo[4], unsigned int InfoType)
|
|||
"=b" (CPUInfo[1]),
|
||||
"=c" (CPUInfo[2]),
|
||||
"=d" (CPUInfo[3]) :
|
||||
/* We clear ECX to avoid a valgrind false-positive prior to v3.17.0. */
|
||||
"0" (InfoType), "2" (0)
|
||||
"0" (InfoType)
|
||||
);
|
||||
#endif
|
||||
#elif defined(CPU_INFO_BY_C)
|
||||
/* We use __get_cpuid_count to clear ECX to avoid a valgrind false-positive
|
||||
prior to v3.17.0.*/
|
||||
if (!__get_cpuid_count(InfoType, 0, &(CPUInfo[0]), &(CPUInfo[1]), &(CPUInfo[2]), &(CPUInfo[3]))) {
|
||||
/* Our function cannot fail, but __get_cpuid{_count} can.
|
||||
Returning all zeroes will effectively disable all SIMD, which is
|
||||
what we want on CPUs that don't support CPUID. */
|
||||
CPUInfo[3] = CPUInfo[2] = CPUInfo[1] = CPUInfo[0] = 0;
|
||||
}
|
||||
#else
|
||||
# error "Configured to use x86 RTCD, but no CPU detection method available. " \
|
||||
"Reconfigure with --disable-rtcd (or send patches)."
|
||||
__get_cpuid(InfoType, &(CPUInfo[0]), &(CPUInfo[1]), &(CPUInfo[2]), &(CPUInfo[3]));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +98,7 @@ typedef struct CPU_Feature{
|
|||
|
||||
static void opus_cpu_feature_check(CPU_Feature *cpu_feature)
|
||||
{
|
||||
unsigned int info[4];
|
||||
unsigned int info[4] = {0};
|
||||
unsigned int nIds = 0;
|
||||
|
||||
cpuid(info, 0);
|
||||
|
|
@ -131,7 +119,7 @@ static void opus_cpu_feature_check(CPU_Feature *cpu_feature)
|
|||
}
|
||||
}
|
||||
|
||||
static int opus_select_arch_impl(void)
|
||||
int opus_select_arch(void)
|
||||
{
|
||||
CPU_Feature cpu_feature;
|
||||
int arch;
|
||||
|
|
@ -166,13 +154,4 @@ static int opus_select_arch_impl(void)
|
|||
return arch;
|
||||
}
|
||||
|
||||
int opus_select_arch(void) {
|
||||
int arch = opus_select_arch_impl();
|
||||
#ifdef FUZZING
|
||||
/* Randomly downgrade the architecture. */
|
||||
arch = rand()%(arch+1);
|
||||
#endif
|
||||
return arch;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -56,16 +56,8 @@
|
|||
int opus_select_arch(void);
|
||||
# endif
|
||||
|
||||
/*MOVD should not impose any alignment restrictions, but the C standard does,
|
||||
and UBSan will report errors if we actually make unaligned accesses.
|
||||
Use this to work around those restrictions (which should hopefully all get
|
||||
optimized to a single MOVD instruction).*/
|
||||
#define OP_LOADU_EPI32(x) \
|
||||
(int)((*(unsigned char *)(x) | *((unsigned char *)(x) + 1) << 8U |\
|
||||
*((unsigned char *)(x) + 2) << 16U | (opus_uint32)*((unsigned char *)(x) + 3) << 24U))
|
||||
|
||||
#define OP_CVTEPI8_EPI32_M32(x) \
|
||||
(_mm_cvtepi8_epi32(_mm_cvtsi32_si128(OP_LOADU_EPI32(x))))
|
||||
(_mm_cvtepi8_epi32(_mm_cvtsi32_si128(*(int *)(x))))
|
||||
|
||||
#define OP_CVTEPI16_EPI32_M64(x) \
|
||||
(_mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i *)(x))))
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_encoder_get_size(int channels);
|
|||
* This must be one of 8000, 12000, 16000,
|
||||
* 24000, or 48000.
|
||||
* @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
|
||||
* @param [in] application <tt>int</tt>: Coding mode (one of @ref OPUS_APPLICATION_VOIP, @ref OPUS_APPLICATION_AUDIO, or @ref OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|
||||
* @param [in] application <tt>int</tt>: Coding mode (@ref OPUS_APPLICATION_VOIP/@ref OPUS_APPLICATION_AUDIO/@ref OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|
||||
* @param [out] error <tt>int*</tt>: @ref opus_errorcodes
|
||||
* @note Regardless of the sampling rate and number channels selected, the Opus encoder
|
||||
* can switch to a lower audio bandwidth or number of channels if the bitrate
|
||||
|
|
@ -222,7 +222,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusEncoder *opus_encoder_create(
|
|||
* This must be one of 8000, 12000, 16000,
|
||||
* 24000, or 48000.
|
||||
* @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
|
||||
* @param [in] application <tt>int</tt>: Coding mode (one of OPUS_APPLICATION_VOIP, OPUS_APPLICATION_AUDIO, or OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|
||||
* @param [in] application <tt>int</tt>: Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO/OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|
||||
* @retval #OPUS_OK Success or @ref opus_errorcodes
|
||||
*/
|
||||
OPUS_EXPORT int opus_encoder_init(
|
||||
|
|
|
|||
|
|
@ -104,8 +104,7 @@ typedef struct OpusCustomDecoder OpusCustomDecoder;
|
|||
/** The mode contains all the information necessary to create an
|
||||
encoder. Both the encoder and decoder need to be initialized
|
||||
with exactly the same mode, otherwise the output will be
|
||||
corrupted. The mode MUST NOT BE DESTROYED until the encoders and
|
||||
decoders that use it are destroyed as well.
|
||||
corrupted.
|
||||
@brief Mode configuration
|
||||
*/
|
||||
typedef struct OpusCustomMode OpusCustomMode;
|
||||
|
|
|
|||
|
|
@ -482,8 +482,7 @@ extern "C" {
|
|||
* @param[in] x <tt>opus_int32</tt>: Allowed values:
|
||||
* <dl>
|
||||
* <dt>0</dt><dd>Disable inband FEC (default).</dd>
|
||||
* <dt>1</dt><dd>Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.</dd>
|
||||
* <dt>2</dt><dd>Inband FEC enabled, but does not necessarily switch to SILK if we have music.</dd>
|
||||
* <dt>1</dt><dd>Enable inband FEC.</dd>
|
||||
* </dl>
|
||||
* @hideinitializer */
|
||||
#define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
|
||||
|
|
@ -492,8 +491,7 @@ extern "C" {
|
|||
* @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
|
||||
* <dl>
|
||||
* <dt>0</dt><dd>Inband FEC disabled (default).</dd>
|
||||
* <dt>1</dt><dd>Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.</dd>
|
||||
* <dt>2</dt><dd>Inband FEC enabled, but does not necessarily switch to SILK if we have music.</dd>
|
||||
* <dt>1</dt><dd>Inband FEC enabled.</dd>
|
||||
* </dl>
|
||||
* @hideinitializer */
|
||||
#define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)
|
||||
|
|
|
|||
|
|
@ -85,16 +85,13 @@ else:
|
|||
|
||||
if CONFIG["CPU_ARCH"] in ("x86", "x86_64"):
|
||||
DEFINES["OPUS_HAVE_RTCD"] = True
|
||||
DEFINES["CPU_INFO_BY_ASM"] = True
|
||||
DEFINES["OPUS_X86_MAY_HAVE_SSE"] = True
|
||||
DEFINES["OPUS_X86_MAY_HAVE_SSE2"] = True
|
||||
DEFINES["OPUS_X86_MAY_HAVE_SSE4_1"] = True
|
||||
DEFINES["OPUS_X86_MAY_HAVE_AVX"] = True
|
||||
SOURCES += celt_sources_x86_rtcd
|
||||
SOURCES += celt_sources_sse
|
||||
SOURCES += celt_sources_sse2
|
||||
SOURCES += celt_sources_sse4_1
|
||||
SOURCES += silk_sources_x86_rtcd
|
||||
SOURCES += silk_sources_sse4_1
|
||||
if not CONFIG["MOZ_SAMPLE_TYPE_FLOAT32"]:
|
||||
SOURCES += silk_sources_fixed_sse4_1
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ origin:
|
|||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: 243987518a65218ffe5cf260756cbf66583a9bb4 (2022-07-10T16:25:01.000-07:00).
|
||||
release: 2654707e86cc94413998976d179b2ab4a2aa3114 (2022-04-01T14:32:38.000-04:00).
|
||||
|
||||
# Revision to pull in
|
||||
# Must be a long or short commit SHA (long preferred)
|
||||
revision: 243987518a65218ffe5cf260756cbf66583a9bb4
|
||||
revision: 2654707e86cc94413998976d179b2ab4a2aa3114
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
|
@ -65,4 +65,3 @@ vendoring:
|
|||
file: moz.build
|
||||
pattern: 'DEFINES\["OPUS_VERSION"\] = "(.+)"'
|
||||
with: 'DEFINES["OPUS_VERSION"] = "{revision}"'
|
||||
|
||||
|
|
|
|||
|
|
@ -2,22 +2,20 @@ diff --git a/media/libopus/sources.mozbuild b/media/libopus/sources.mozbuild
|
|||
index 8a39b9f..dfc2c62 100644
|
||||
--- a/media/libopus/sources.mozbuild
|
||||
+++ b/media/libopus/sources.mozbuild
|
||||
@@ -2,8 +2,5 @@
|
||||
@@ -2,8 +2,6 @@
|
||||
celt_sources = [
|
||||
'celt/bands.c',
|
||||
- 'celt/celt.c',
|
||||
'celt/celt.c',
|
||||
- 'celt/celt_decoder.c',
|
||||
- 'celt/celt_encoder.c',
|
||||
'celt/celt_lpc.c',
|
||||
'celt/cwrs.c',
|
||||
'celt/entcode.c',
|
||||
@@ -20,6 +18,17 @@ celt_sources = [
|
||||
@@ -20,6 +18,15 @@ celt_sources = [
|
||||
'celt/vq.c',
|
||||
]
|
||||
|
||||
+opus_nonunified_sources = [
|
||||
+ # Disabled because of undefined reference to celt_fatal at link time
|
||||
+ 'celt/celt.c',
|
||||
+ # Disabled because of name clash of opus_custom_encoder_get_size.
|
||||
+ 'celt/celt_decoder.c',
|
||||
+ 'celt/celt_encoder.c',
|
||||
|
|
|
|||
34
media/libopus/nonunified2.patch
Normal file
34
media/libopus/nonunified2.patch
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/media/libopus/sources.mozbuild b/media/libopus/sources.mozbuild
|
||||
--- a/media/libopus/sources.mozbuild
|
||||
+++ b/media/libopus/sources.mozbuild
|
||||
@@ -1,12 +1,11 @@
|
||||
# THIS FILE WAS AUTOMATICALLY GENERATED BY gen-sources.py. DO NOT EDIT.
|
||||
celt_sources = [
|
||||
'celt/bands.c',
|
||||
- 'celt/celt.c',
|
||||
'celt/celt_lpc.c',
|
||||
'celt/cwrs.c',
|
||||
'celt/entcode.c',
|
||||
'celt/entdec.c',
|
||||
'celt/entenc.c',
|
||||
'celt/kiss_fft.c',
|
||||
'celt/laplace.c',
|
||||
'celt/mathops.c',
|
||||
@@ -14,16 +13,18 @@ celt_sources = [
|
||||
'celt/modes.c',
|
||||
'celt/pitch.c',
|
||||
'celt/quant_bands.c',
|
||||
'celt/rate.c',
|
||||
'celt/vq.c',
|
||||
]
|
||||
|
||||
opus_nonunified_sources = [
|
||||
+ # Disabled because of undefined reference to celt_fatal at link time
|
||||
+ 'celt/celt.c',
|
||||
# Disabled because of name clash of opus_custom_encoder_get_size.
|
||||
'celt/celt_decoder.c',
|
||||
'celt/celt_encoder.c',
|
||||
# Disabled for (safe) warning about QA redefinition.
|
||||
'silk/LPC_inv_pred_gain.c',
|
||||
'silk/NLSF2A.c',
|
||||
]
|
||||
|
|
@ -55,7 +55,7 @@ static OPUS_INLINE opus_int16 silk_ADD16_(opus_int16 a, opus_int16 b, char *file
|
|||
static OPUS_INLINE opus_int32 silk_ADD32_(opus_int32 a, opus_int32 b, char *file, int line){
|
||||
opus_int32 ret;
|
||||
|
||||
ret = (opus_int32)((opus_uint32)a + (opus_uint32)b);
|
||||
ret = a + b;
|
||||
if ( ret != silk_ADD_SAT32( a, b ) )
|
||||
{
|
||||
fprintf (stderr, "silk_ADD32(%d, %d) in %s: line %d\n", a, b, file, line);
|
||||
|
|
@ -257,7 +257,7 @@ static OPUS_INLINE opus_int64 silk_SUB_SAT64_( opus_int64 a64, opus_int64 b64, c
|
|||
static OPUS_INLINE opus_int32 silk_MUL_(opus_int32 a32, opus_int32 b32, char *file, int line){
|
||||
opus_int32 ret;
|
||||
opus_int64 ret64;
|
||||
ret = (opus_int32)((opus_uint32)a32 * (opus_uint32)b32);
|
||||
ret = a32 * b32;
|
||||
ret64 = (opus_int64)a32 * (opus_int64)b32;
|
||||
if ( (opus_int64)ret != ret64 )
|
||||
{
|
||||
|
|
@ -491,6 +491,12 @@ static OPUS_INLINE opus_int32 silk_SMLAWW_(opus_int32 a32, opus_int32 b32, opus_
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) */
|
||||
#undef silk_MLA_ovflw
|
||||
#define silk_MLA_ovflw(a32, b32, c32) ((a32) + ((b32) * (c32)))
|
||||
#undef silk_SMLABB_ovflw
|
||||
#define silk_SMLABB_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32)))
|
||||
|
||||
/* no checking needed for silk_SMULL
|
||||
no checking needed for silk_SMLAL
|
||||
no checking needed for silk_SMLALBB
|
||||
|
|
@ -540,10 +546,10 @@ static OPUS_INLINE opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, cha
|
|||
static OPUS_INLINE opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *file, int line){
|
||||
opus_int8 ret;
|
||||
int fail = 0;
|
||||
ret = (opus_int8)((opus_uint8)a << shift);
|
||||
ret = a << shift;
|
||||
fail |= shift < 0;
|
||||
fail |= shift >= 8;
|
||||
fail |= (opus_int64)ret != (opus_int64)(((opus_uint64)a) << shift);
|
||||
fail |= (opus_int64)ret != ((opus_int64)a) << shift;
|
||||
if ( fail )
|
||||
{
|
||||
fprintf (stderr, "silk_LSHIFT8(%d, %d) in %s: line %d\n", a, shift, file, line);
|
||||
|
|
@ -559,10 +565,10 @@ static OPUS_INLINE opus_int8 silk_LSHIFT8_(opus_int8 a, opus_int32 shift, char *
|
|||
static OPUS_INLINE opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, char *file, int line){
|
||||
opus_int16 ret;
|
||||
int fail = 0;
|
||||
ret = (opus_int16)((opus_uint16)a << shift);
|
||||
ret = a << shift;
|
||||
fail |= shift < 0;
|
||||
fail |= shift >= 16;
|
||||
fail |= (opus_int64)ret != (opus_int64)(((opus_uint64)a) << shift);
|
||||
fail |= (opus_int64)ret != ((opus_int64)a) << shift;
|
||||
if ( fail )
|
||||
{
|
||||
fprintf (stderr, "silk_LSHIFT16(%d, %d) in %s: line %d\n", a, shift, file, line);
|
||||
|
|
@ -578,10 +584,10 @@ static OPUS_INLINE opus_int16 silk_LSHIFT16_(opus_int16 a, opus_int32 shift, cha
|
|||
static OPUS_INLINE opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, char *file, int line){
|
||||
opus_int32 ret;
|
||||
int fail = 0;
|
||||
ret = (opus_int32)((opus_uint32)a << shift);
|
||||
ret = a << shift;
|
||||
fail |= shift < 0;
|
||||
fail |= shift >= 32;
|
||||
fail |= (opus_int64)ret != (opus_int64)(((opus_uint64)a) << shift);
|
||||
fail |= (opus_int64)ret != ((opus_int64)a) << shift;
|
||||
if ( fail )
|
||||
{
|
||||
fprintf (stderr, "silk_LSHIFT32(%d, %d) in %s: line %d\n", a, shift, file, line);
|
||||
|
|
@ -597,7 +603,7 @@ static OPUS_INLINE opus_int32 silk_LSHIFT32_(opus_int32 a, opus_int32 shift, cha
|
|||
static OPUS_INLINE opus_int64 silk_LSHIFT64_(opus_int64 a, opus_int shift, char *file, int line){
|
||||
opus_int64 ret;
|
||||
int fail = 0;
|
||||
ret = (opus_int64)((opus_uint64)a << shift);
|
||||
ret = a << shift;
|
||||
fail |= shift < 0;
|
||||
fail |= shift >= 64;
|
||||
fail |= (ret>>shift) != ((opus_int64)a);
|
||||
|
|
@ -708,8 +714,8 @@ static OPUS_INLINE opus_uint32 silk_RSHIFT_uint_(opus_uint32 a, opus_int32 shift
|
|||
#define silk_ADD_LSHIFT(a,b,c) silk_ADD_LSHIFT_((a), (b), (c), __FILE__, __LINE__)
|
||||
static OPUS_INLINE int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int line){
|
||||
opus_int16 ret;
|
||||
ret = a + (opus_int16)((opus_uint16)b << shift);
|
||||
if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (opus_int64)(((opus_uint64)b) << shift)) )
|
||||
ret = a + (b << shift);
|
||||
if ( (shift < 0) || (shift>15) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) )
|
||||
{
|
||||
fprintf (stderr, "silk_ADD_LSHIFT(%d, %d, %d) in %s: line %d\n", a, b, shift, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
|
|
@ -723,8 +729,8 @@ static OPUS_INLINE int silk_ADD_LSHIFT_(int a, int b, int shift, char *file, int
|
|||
#define silk_ADD_LSHIFT32(a,b,c) silk_ADD_LSHIFT32_((a), (b), (c), __FILE__, __LINE__)
|
||||
static OPUS_INLINE opus_int32 silk_ADD_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){
|
||||
opus_int32 ret;
|
||||
ret = a + (opus_int32)((opus_uint32)b << shift);
|
||||
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (opus_int64)(((opus_uint64)b) << shift)) )
|
||||
ret = a + (b << shift);
|
||||
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a + (((opus_int64)b) << shift)) )
|
||||
{
|
||||
fprintf (stderr, "silk_ADD_LSHIFT32(%d, %d, %d) in %s: line %d\n", a, b, shift, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
|
|
@ -798,8 +804,8 @@ static OPUS_INLINE opus_uint32 silk_ADD_RSHIFT_uint_(opus_uint32 a, opus_uint32
|
|||
#define silk_SUB_LSHIFT32(a,b,c) silk_SUB_LSHIFT32_((a), (b), (c), __FILE__, __LINE__)
|
||||
static OPUS_INLINE opus_int32 silk_SUB_LSHIFT32_(opus_int32 a, opus_int32 b, opus_int32 shift, char *file, int line){
|
||||
opus_int32 ret;
|
||||
ret = a - (opus_int32)((opus_uint32)b << shift);
|
||||
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (opus_int64)(((opus_uint64)b) << shift)) )
|
||||
ret = a - (b << shift);
|
||||
if ( (shift < 0) || (shift>31) || ((opus_int64)ret != (opus_int64)a - (((opus_int64)b) << shift)) )
|
||||
{
|
||||
fprintf (stderr, "silk_SUB_LSHIFT32(%d, %d, %d) in %s: line %d\n", a, b, shift, file, line);
|
||||
#ifdef FIXED_DEBUG_ASSERT
|
||||
|
|
|
|||
|
|
@ -609,12 +609,10 @@ static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
|
|||
/* the following seems faster on x86 */
|
||||
#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL((a32), (b32)), 32)
|
||||
|
||||
#if !defined(OVERRIDE_silk_burg_modified)
|
||||
#if !defined(OPUS_X86_MAY_HAVE_SSE4_1)
|
||||
#define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
|
||||
((void)(arch), silk_burg_modified_c(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
|
||||
#endif
|
||||
|
||||
#if !defined(OVERRIDE_silk_inner_prod16)
|
||||
#define silk_inner_prod16(inVec1, inVec2, len, arch) \
|
||||
((void)(arch),silk_inner_prod16_c(inVec1, inVec2, len))
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ void silk_find_pred_coefs_FIX(
|
|||
{
|
||||
opus_int i;
|
||||
opus_int32 invGains_Q16[ MAX_NB_SUBFR ], local_gains[ MAX_NB_SUBFR ];
|
||||
/* Set to NLSF_Q15 to zero so we don't copy junk to the state. */
|
||||
opus_int16 NLSF_Q15[ MAX_LPC_ORDER ]={0};
|
||||
opus_int16 NLSF_Q15[ MAX_LPC_ORDER ];
|
||||
const opus_int16 *x_ptr;
|
||||
opus_int16 *x_pre_ptr;
|
||||
VARDECL( opus_int16, LPC_in_pre );
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "SigProc_FIX.h"
|
||||
#include "pitch.h"
|
||||
#include "celt/x86/x86cpu.h"
|
||||
|
||||
opus_int64 silk_inner_prod16_sse4_1(
|
||||
const opus_int16 *inVec1, /* I input vector 1 */
|
||||
|
|
@ -79,7 +78,7 @@ opus_int64 silk_inner_prod16_sse4_1(
|
|||
_mm_storel_epi64( (__m128i *)&sum, acc1 );
|
||||
|
||||
for( ; i < len; i++ ) {
|
||||
sum = silk_SMLALBB( sum, inVec1[ i ], inVec2[ i ] );
|
||||
sum = silk_SMLABB( sum, inVec1[ i ], inVec2[ i ] );
|
||||
}
|
||||
|
||||
#ifdef OPUS_CHECK_ASM
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ void silk_find_pred_coefs_FLP(
|
|||
silk_float XXLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ];
|
||||
silk_float xXLTP[ MAX_NB_SUBFR * LTP_ORDER ];
|
||||
silk_float invGains[ MAX_NB_SUBFR ];
|
||||
/* Set to NLSF_Q15 to zero so we don't copy junk to the state. */
|
||||
opus_int16 NLSF_Q15[ MAX_LPC_ORDER ]={0};
|
||||
opus_int16 NLSF_Q15[ MAX_LPC_ORDER ];
|
||||
const silk_float *x_ptr;
|
||||
silk_float *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ];
|
||||
silk_float minInvGain;
|
||||
|
|
|
|||
|
|
@ -190,14 +190,12 @@ void silk_quant_LTP_gains_FLP(
|
|||
opus_int32 XX_Q17[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ];
|
||||
opus_int32 xX_Q17[ MAX_NB_SUBFR * LTP_ORDER ];
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
for( i = 0; i < nb_subfr * LTP_ORDER * LTP_ORDER; i++ ) {
|
||||
XX_Q17[ i ] = (opus_int32)silk_float2int( XX[ i ] * 131072.0f );
|
||||
} while ( ++i < nb_subfr * LTP_ORDER * LTP_ORDER );
|
||||
i = 0;
|
||||
do {
|
||||
}
|
||||
for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) {
|
||||
xX_Q17[ i ] = (opus_int32)silk_float2int( xX[ i ] * 131072.0f );
|
||||
} while ( ++i < nb_subfr * LTP_ORDER );
|
||||
}
|
||||
|
||||
silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, sum_log_gain_Q7, &pred_gain_dB_Q7, XX_Q17, xX_Q17, subfr_len, nb_subfr, arch );
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void silk_stereo_LR_to_MS(
|
|||
ALLOC( LP_mid, frame_length, opus_int16 );
|
||||
ALLOC( HP_mid, frame_length, opus_int16 );
|
||||
for( n = 0; n < frame_length; n++ ) {
|
||||
sum = silk_RSHIFT_ROUND( silk_ADD_LSHIFT32( mid[ n ] + (opus_int32)mid[ n + 2 ], mid[ n + 1 ], 1 ), 2 );
|
||||
sum = silk_RSHIFT_ROUND( silk_ADD_LSHIFT( mid[ n ] + (opus_int32)mid[ n + 2 ], mid[ n + 1 ], 1 ), 2 );
|
||||
LP_mid[ n ] = sum;
|
||||
HP_mid[ n ] = mid[ n + 1 ] - sum;
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ void silk_stereo_LR_to_MS(
|
|||
ALLOC( LP_side, frame_length, opus_int16 );
|
||||
ALLOC( HP_side, frame_length, opus_int16 );
|
||||
for( n = 0; n < frame_length; n++ ) {
|
||||
sum = silk_RSHIFT_ROUND( silk_ADD_LSHIFT32( side[ n ] + (opus_int32)side[ n + 2 ], side[ n + 1 ], 1 ), 2 );
|
||||
sum = silk_RSHIFT_ROUND( silk_ADD_LSHIFT( side[ n ] + (opus_int32)side[ n + 2 ], side[ n + 1 ], 1 ), 2 );
|
||||
LP_side[ n ] = sum;
|
||||
HP_side[ n ] = side[ n + 1 ] - sum;
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ void silk_stereo_LR_to_MS(
|
|||
pred0_Q13 += delta0_Q13;
|
||||
pred1_Q13 += delta1_Q13;
|
||||
w_Q24 += deltaw_Q24;
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT32( mid[ n ] + (opus_int32)mid[ n + 2 ], mid[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT( mid[ n ] + (opus_int32)mid[ n + 2 ], mid[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_SMLAWB( silk_SMULWB( w_Q24, side[ n + 1 ] ), sum, pred0_Q13 ); /* Q8 */
|
||||
sum = silk_SMLAWB( sum, silk_LSHIFT( (opus_int32)mid[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */
|
||||
x2[ n - 1 ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( sum, 8 ) );
|
||||
|
|
@ -217,7 +217,7 @@ void silk_stereo_LR_to_MS(
|
|||
pred1_Q13 = -pred_Q13[ 1 ];
|
||||
w_Q24 = silk_LSHIFT( width_Q14, 10 );
|
||||
for( n = STEREO_INTERP_LEN_MS * fs_kHz; n < frame_length; n++ ) {
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT32( mid[ n ] + (opus_int32)mid[ n + 2 ], mid[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT( mid[ n ] + (opus_int32)mid[ n + 2 ], mid[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_SMLAWB( silk_SMULWB( w_Q24, side[ n + 1 ] ), sum, pred0_Q13 ); /* Q8 */
|
||||
sum = silk_SMLAWB( sum, silk_LSHIFT( (opus_int32)mid[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */
|
||||
x2[ n - 1 ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( sum, 8 ) );
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void silk_stereo_MS_to_LR(
|
|||
for( n = 0; n < STEREO_INTERP_LEN_MS * fs_kHz; n++ ) {
|
||||
pred0_Q13 += delta0_Q13;
|
||||
pred1_Q13 += delta1_Q13;
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT32( x1[ n ] + (opus_int32)x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_SMLAWB( silk_LSHIFT( (opus_int32)x2[ n + 1 ], 8 ), sum, pred0_Q13 ); /* Q8 */
|
||||
sum = silk_SMLAWB( sum, silk_LSHIFT( (opus_int32)x1[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */
|
||||
x2[ n + 1 ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( sum, 8 ) );
|
||||
|
|
@ -67,7 +67,7 @@ void silk_stereo_MS_to_LR(
|
|||
pred0_Q13 = pred_Q13[ 0 ];
|
||||
pred1_Q13 = pred_Q13[ 1 ];
|
||||
for( n = STEREO_INTERP_LEN_MS * fs_kHz; n < frame_length; n++ ) {
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT32( x1[ n ] + (opus_int32)x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_LSHIFT( silk_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 ); /* Q11 */
|
||||
sum = silk_SMLAWB( silk_LSHIFT( (opus_int32)x2[ n + 1 ], 8 ), sum, pred0_Q13 ); /* Q8 */
|
||||
sum = silk_SMLAWB( sum, silk_LSHIFT( (opus_int32)x1[ n + 1 ], 11 ), pred1_Q13 ); /* Q8 */
|
||||
x2[ n + 1 ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( sum, 8 ) );
|
||||
|
|
|
|||
|
|
@ -387,7 +387,6 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1(
|
|||
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;
|
||||
int rdo_offset;
|
||||
|
||||
VARDECL( NSQ_sample_pair, psSampleState );
|
||||
NSQ_del_dec_struct *psDD;
|
||||
|
|
@ -400,7 +399,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1(
|
|||
celt_assert( nStatesDelayedDecision > 0 );
|
||||
ALLOC( psSampleState, nStatesDelayedDecision, NSQ_sample_pair );
|
||||
|
||||
rdo_offset = (Lambda_Q10 >> 1) - 512;
|
||||
int rdo_offset = (Lambda_Q10 >> 1) - 512;
|
||||
|
||||
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 ];
|
||||
|
|
|
|||
|
|
@ -719,10 +719,10 @@ static OPUS_INLINE void silk_nsq_scale_states_sse4_1(
|
|||
|
||||
/* Adjust for changing gain */
|
||||
if( Gains_Q16[ subfr ] != NSQ->prev_gain_Q16 ) {
|
||||
__m128i xmm_gain_adj_Q16, xmm_sLTP_shp_Q14_x2x0, xmm_sLTP_shp_Q14_x3x1;
|
||||
gain_adj_Q16 = silk_DIV32_varQ( NSQ->prev_gain_Q16, Gains_Q16[ subfr ], 16 );
|
||||
|
||||
/* Scale long-term shaping state */
|
||||
__m128i xmm_gain_adj_Q16, xmm_sLTP_shp_Q14_x2x0, xmm_sLTP_shp_Q14_x3x1;
|
||||
|
||||
/* prepare gain_adj_Q16 in packed 4 32-bits */
|
||||
xmm_gain_adj_Q16 = _mm_set1_epi32(gain_adj_Q16);
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@
|
|||
*/
|
||||
|
||||
#ifndef SIGPROC_FIX_SSE_H
|
||||
# define SIGPROC_FIX_SSE_H
|
||||
#define SIGPROC_FIX_SSE_H
|
||||
|
||||
# ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# endif
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
# if defined(OPUS_X86_MAY_HAVE_SSE4_1)
|
||||
#if defined(OPUS_X86_MAY_HAVE_SSE4_1)
|
||||
void silk_burg_modified_sse4_1(
|
||||
opus_int32 *res_nrg, /* O Residual energy */
|
||||
opus_int *res_nrg_Q, /* O Residual energy Q value */
|
||||
|
|
@ -45,13 +45,11 @@ void silk_burg_modified_sse4_1(
|
|||
int arch /* I Run-time architecture */
|
||||
);
|
||||
|
||||
# if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
|
||||
((void)(arch), silk_burg_modified_sse4_1(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
|
||||
|
||||
# define OVERRIDE_silk_burg_modified
|
||||
# define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
|
||||
((void)(arch), silk_burg_modified_sse4_1(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
|
||||
|
||||
# elif defined(OPUS_HAVE_RTCD)
|
||||
#else
|
||||
|
||||
extern void (*const SILK_BURG_MODIFIED_IMPL[OPUS_ARCHMASK + 1])(
|
||||
opus_int32 *res_nrg, /* O Residual energy */
|
||||
|
|
@ -64,11 +62,10 @@ extern void (*const SILK_BURG_MODIFIED_IMPL[OPUS_ARCHMASK + 1])(
|
|||
const opus_int D, /* I Order */
|
||||
int arch /* I Run-time architecture */);
|
||||
|
||||
# define OVERRIDE_silk_burg_modified
|
||||
# define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
|
||||
((*SILK_BURG_MODIFIED_IMPL[(arch) & OPUS_ARCHMASK])(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
|
||||
# define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
|
||||
((*SILK_BURG_MODIFIED_IMPL[(arch) & OPUS_ARCHMASK])(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
opus_int64 silk_inner_prod16_sse4_1(
|
||||
const opus_int16 *inVec1,
|
||||
|
|
@ -77,23 +74,21 @@ opus_int64 silk_inner_prod16_sse4_1(
|
|||
);
|
||||
|
||||
|
||||
# if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
|
||||
# define OVERRIDE_silk_inner_prod16
|
||||
# define silk_inner_prod16(inVec1, inVec2, len, arch) \
|
||||
((void)(arch),silk_inner_prod16_sse4_1(inVec1, inVec2, len))
|
||||
#define silk_inner_prod16(inVec1, inVec2, len, arch) \
|
||||
((void)(arch),silk_inner_prod16_sse4_1(inVec1, inVec2, len))
|
||||
|
||||
# elif defined(OPUS_HAVE_RTCD)
|
||||
#else
|
||||
|
||||
extern opus_int64 (*const SILK_INNER_PROD16_IMPL[OPUS_ARCHMASK + 1])(
|
||||
const opus_int16 *inVec1,
|
||||
const opus_int16 *inVec2,
|
||||
const opus_int len);
|
||||
|
||||
# define OVERRIDE_silk_inner_prod16
|
||||
# define silk_inner_prod16(inVec1, inVec2, len, arch) \
|
||||
((*SILK_INNER_PROD16_IMPL[(arch) & OPUS_ARCHMASK])(inVec1, inVec2, len))
|
||||
# define silk_inner_prod16(inVec1, inVec2, len, arch) \
|
||||
((*SILK_INNER_PROD16_IMPL[(arch) & OPUS_ARCHMASK])(inVec1, inVec2, len))
|
||||
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,14 +26,16 @@
|
|||
*/
|
||||
|
||||
#ifndef MAIN_SSE_H
|
||||
# define MAIN_SSE_H
|
||||
#define MAIN_SSE_H
|
||||
|
||||
# ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# endif
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
# if defined(OPUS_X86_MAY_HAVE_SSE4_1)
|
||||
|
||||
# define OVERRIDE_silk_VQ_WMat_EC
|
||||
|
||||
void silk_VQ_WMat_EC_sse4_1(
|
||||
opus_int8 *ind, /* O index of best codebook vector */
|
||||
opus_int32 *res_nrg_Q15, /* O best residual energy */
|
||||
|
|
@ -49,15 +51,14 @@ void silk_VQ_WMat_EC_sse4_1(
|
|||
const opus_int L /* I number of vectors in codebook */
|
||||
);
|
||||
|
||||
# if defined OPUS_X86_PRESUME_SSE4_1
|
||||
#if defined OPUS_X86_PRESUME_SSE4_1
|
||||
|
||||
# define OVERRIDE_silk_VQ_WMat_EC
|
||||
# define silk_VQ_WMat_EC(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, \
|
||||
subfr_len, max_gain_Q7, L, arch) \
|
||||
#define silk_VQ_WMat_EC(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, \
|
||||
subfr_len, max_gain_Q7, L, arch) \
|
||||
((void)(arch),silk_VQ_WMat_EC_sse4_1(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, \
|
||||
subfr_len, max_gain_Q7, L))
|
||||
|
||||
# elif defined(OPUS_HAVE_RTCD)
|
||||
#else
|
||||
|
||||
extern void (*const SILK_VQ_WMAT_EC_IMPL[OPUS_ARCHMASK + 1])(
|
||||
opus_int8 *ind, /* O index of best codebook vector */
|
||||
|
|
@ -74,13 +75,14 @@ extern void (*const SILK_VQ_WMAT_EC_IMPL[OPUS_ARCHMASK + 1])(
|
|||
const opus_int L /* I number of vectors in codebook */
|
||||
);
|
||||
|
||||
# define OVERRIDE_silk_VQ_WMat_EC
|
||||
# define silk_VQ_WMat_EC(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, \
|
||||
subfr_len, max_gain_Q7, L, arch) \
|
||||
# define silk_VQ_WMat_EC(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, \
|
||||
subfr_len, max_gain_Q7, L, arch) \
|
||||
((*SILK_VQ_WMAT_EC_IMPL[(arch) & OPUS_ARCHMASK])(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, \
|
||||
subfr_len, max_gain_Q7, L))
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define OVERRIDE_silk_NSQ
|
||||
|
||||
void silk_NSQ_sse4_1(
|
||||
const silk_encoder_state *psEncC, /* I Encoder State */
|
||||
|
|
@ -100,15 +102,14 @@ void silk_NSQ_sse4_1(
|
|||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
);
|
||||
|
||||
# if defined OPUS_X86_PRESUME_SSE4_1
|
||||
#if defined OPUS_X86_PRESUME_SSE4_1
|
||||
|
||||
# define OVERRIDE_silk_NSQ
|
||||
# define silk_NSQ(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
#define silk_NSQ(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
((void)(arch),silk_NSQ_sse4_1(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
|
||||
|
||||
# elif defined(OPUS_HAVE_RTCD)
|
||||
#else
|
||||
|
||||
extern void (*const SILK_NSQ_IMPL[OPUS_ARCHMASK + 1])(
|
||||
const silk_encoder_state *psEncC, /* I Encoder State */
|
||||
|
|
@ -128,13 +129,14 @@ extern void (*const SILK_NSQ_IMPL[OPUS_ARCHMASK + 1])(
|
|||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
);
|
||||
|
||||
# define OVERRIDE_silk_NSQ
|
||||
# define silk_NSQ(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
# define silk_NSQ(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
((*SILK_NSQ_IMPL[(arch) & OPUS_ARCHMASK])(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define OVERRIDE_silk_NSQ_del_dec
|
||||
|
||||
void silk_NSQ_del_dec_sse4_1(
|
||||
const silk_encoder_state *psEncC, /* I Encoder State */
|
||||
|
|
@ -154,15 +156,14 @@ void silk_NSQ_del_dec_sse4_1(
|
|||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
);
|
||||
|
||||
# if defined OPUS_X86_PRESUME_SSE4_1
|
||||
#if defined OPUS_X86_PRESUME_SSE4_1
|
||||
|
||||
# define OVERRIDE_silk_NSQ_del_dec
|
||||
# define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
#define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
((void)(arch),silk_NSQ_del_dec_sse4_1(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
|
||||
|
||||
# elif defined(OPUS_HAVE_RTCD)
|
||||
#else
|
||||
|
||||
extern void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])(
|
||||
const silk_encoder_state *psEncC, /* I Encoder State */
|
||||
|
|
@ -182,13 +183,12 @@ extern void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])(
|
|||
const opus_int LTP_scale_Q14 /* I LTP state scaling */
|
||||
);
|
||||
|
||||
# define OVERRIDE_silk_NSQ_del_dec
|
||||
# define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
# define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
|
||||
((*SILK_NSQ_DEL_DEC_IMPL[(arch) & OPUS_ARCHMASK])(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
|
||||
HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void silk_noise_shape_quantizer(
|
||||
silk_nsq_state *NSQ, /* I/O NSQ state */
|
||||
|
|
@ -221,27 +221,26 @@ void silk_VAD_GetNoiseLevels(
|
|||
silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */
|
||||
);
|
||||
|
||||
# define OVERRIDE_silk_VAD_GetSA_Q8
|
||||
|
||||
opus_int silk_VAD_GetSA_Q8_sse4_1(
|
||||
silk_encoder_state *psEnC,
|
||||
const opus_int16 pIn[]
|
||||
);
|
||||
|
||||
# if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#if defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#define silk_VAD_GetSA_Q8(psEnC, pIn, arch) ((void)(arch),silk_VAD_GetSA_Q8_sse4_1(psEnC, pIn))
|
||||
|
||||
# define OVERRIDE_silk_VAD_GetSA_Q8
|
||||
# define silk_VAD_GetSA_Q8(psEnC, pIn, arch) ((void)(arch),silk_VAD_GetSA_Q8_sse4_1(psEnC, pIn))
|
||||
#else
|
||||
|
||||
# elif defined(OPUS_HAVE_RTCD)
|
||||
# define silk_VAD_GetSA_Q8(psEnC, pIn, arch) \
|
||||
((*SILK_VAD_GETSA_Q8_IMPL[(arch) & OPUS_ARCHMASK])(psEnC, pIn))
|
||||
|
||||
extern opus_int (*const SILK_VAD_GETSA_Q8_IMPL[OPUS_ARCHMASK + 1])(
|
||||
silk_encoder_state *psEnC,
|
||||
const opus_int16 pIn[]);
|
||||
|
||||
# define OVERRIDE_silk_VAD_GetSA_Q8
|
||||
# define silk_VAD_GetSA_Q8(psEnC, pIn, arch) \
|
||||
((*SILK_VAD_GETSA_Q8_IMPL[(arch) & OPUS_ARCHMASK])(psEnC, pIn))
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "pitch.h"
|
||||
#include "main.h"
|
||||
|
||||
#if defined(OPUS_HAVE_RTCD) && !defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
#if !defined(OPUS_X86_PRESUME_SSE4_1)
|
||||
|
||||
#if defined(FIXED_POINT)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,11 +17,6 @@ celt_sources = [
|
|||
'celt/vq.c',
|
||||
]
|
||||
|
||||
celt_sources_x86_rtcd = [
|
||||
'celt/x86/x86_celt_map.c',
|
||||
'celt/x86/x86cpu.c',
|
||||
]
|
||||
|
||||
opus_nonunified_sources = [
|
||||
# Disabled because of undefined reference to celt_fatal at link time
|
||||
'celt/celt.c',
|
||||
|
|
@ -35,6 +30,8 @@ opus_nonunified_sources = [
|
|||
|
||||
celt_sources_sse = [
|
||||
'celt/x86/pitch_sse.c',
|
||||
'celt/x86/x86_celt_map.c',
|
||||
'celt/x86/x86cpu.c',
|
||||
]
|
||||
|
||||
celt_sources_sse2 = [
|
||||
|
|
@ -47,7 +44,7 @@ celt_sources_sse4_1 = [
|
|||
'celt/x86/pitch_sse4_1.c',
|
||||
]
|
||||
|
||||
celt_sources_arm_rtcd = [
|
||||
celt_sources_arm = [
|
||||
'celt/arm/arm_celt_map.c',
|
||||
'celt/arm/armcpu.c',
|
||||
]
|
||||
|
|
@ -167,22 +164,16 @@ silk_sources = [
|
|||
'silk/VQ_WMat_EC.c',
|
||||
]
|
||||
|
||||
silk_sources_x86_rtcd = [
|
||||
'silk/x86/x86_silk_map.c',
|
||||
]
|
||||
|
||||
silk_sources_sse4_1 = [
|
||||
'silk/x86/NSQ_del_dec_sse4_1.c',
|
||||
'silk/x86/NSQ_sse4_1.c',
|
||||
'silk/x86/VAD_sse4_1.c',
|
||||
'silk/x86/VQ_WMat_EC_sse4_1.c',
|
||||
]
|
||||
|
||||
silk_sources_arm_rtcd = [
|
||||
'silk/arm/arm_silk_map.c',
|
||||
'silk/x86/x86_silk_map.c',
|
||||
]
|
||||
|
||||
silk_sources_arm_neon_intr = [
|
||||
'silk/arm/arm_silk_map.c',
|
||||
'silk/arm/biquad_alt_neon_intr.c',
|
||||
'silk/arm/LPC_inv_pred_gain_neon_intr.c',
|
||||
'silk/arm/NSQ_del_dec_neon_intr.c',
|
||||
|
|
|
|||
|
|
@ -278,8 +278,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
|||
ec_dec_init(&dec,(unsigned char*)data,len);
|
||||
} else {
|
||||
audiosize = frame_size;
|
||||
/* Run PLC using last used mode (CELT if we ended with CELT redundancy) */
|
||||
mode = st->prev_redundancy ? MODE_CELT_ONLY : st->prev_mode;
|
||||
mode = st->prev_mode;
|
||||
bandwidth = 0;
|
||||
|
||||
if (mode == 0)
|
||||
|
|
@ -420,7 +419,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
|||
|
||||
start_band = 0;
|
||||
if (!decode_fec && mode != MODE_CELT_ONLY && data != NULL
|
||||
&& ec_tell(&dec)+17+20*(mode == MODE_HYBRID) <= 8*len)
|
||||
&& ec_tell(&dec)+17+20*(st->mode == MODE_HYBRID) <= 8*len)
|
||||
{
|
||||
/* Check if we have a redundant 0-8 kHz band */
|
||||
if (mode == MODE_HYBRID)
|
||||
|
|
@ -500,11 +499,6 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
|||
/* 5 ms redundant frame for CELT->SILK*/
|
||||
if (redundancy && celt_to_silk)
|
||||
{
|
||||
/* If the previous frame did not use CELT (the first redundancy frame in
|
||||
a transition from SILK may have been lost) then the CELT decoder is
|
||||
stale at this point and the redundancy audio is not useful, however
|
||||
the final range is still needed (for testing), so the redundancy is
|
||||
always decoded but the decoded audio may not be used */
|
||||
MUST_SUCCEED(celt_decoder_ctl(celt_dec, CELT_SET_START_BAND(0)));
|
||||
celt_decode_with_ec(celt_dec, data+len, redundancy_bytes,
|
||||
redundant_audio, F5, NULL, 0);
|
||||
|
|
@ -567,10 +561,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
|
|||
smooth_fade(pcm+st->channels*(frame_size-F2_5), redundant_audio+st->channels*F2_5,
|
||||
pcm+st->channels*(frame_size-F2_5), F2_5, st->channels, window, st->Fs);
|
||||
}
|
||||
/* 5ms redundant frame for CELT->SILK; ignore if the previous frame did not
|
||||
use CELT (the first redundancy frame in a transition from SILK may have
|
||||
been lost) */
|
||||
if (redundancy && celt_to_silk && (st->prev_mode != MODE_SILK_ONLY || st->prev_redundancy))
|
||||
if (redundancy && celt_to_silk)
|
||||
{
|
||||
for (c=0;c<st->channels;c++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ struct OpusEncoder {
|
|||
int lfe;
|
||||
int arch;
|
||||
int use_dtx; /* general DTX for both SILK and CELT */
|
||||
int fec_config;
|
||||
#ifndef DISABLE_FLOAT_API
|
||||
TonalityAnalysisState analysis;
|
||||
#endif
|
||||
|
|
@ -1315,8 +1314,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
|
|||
st->stream_channels = st->force_channels;
|
||||
} else {
|
||||
#ifdef FUZZING
|
||||
(void)stereo_music_threshold;
|
||||
(void)stereo_voice_threshold;
|
||||
/* Random mono/stereo decision */
|
||||
if (st->channels == 2 && (rand()&0x1F)==0)
|
||||
st->stream_channels = 3-st->stream_channels;
|
||||
|
|
@ -1355,8 +1352,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
|
|||
} else if (st->user_forced_mode == OPUS_AUTO)
|
||||
{
|
||||
#ifdef FUZZING
|
||||
(void)stereo_width;
|
||||
(void)mode_thresholds;
|
||||
/* Random mode switching */
|
||||
if ((rand()&0xF)==0)
|
||||
{
|
||||
|
|
@ -1394,9 +1389,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
|
|||
|
||||
st->mode = (equiv_rate >= threshold) ? MODE_CELT_ONLY: MODE_SILK_ONLY;
|
||||
|
||||
/* When FEC is enabled and there's enough packet loss, use SILK.
|
||||
Unless the FEC is set to 2, in which case we don't switch to SILK if we're confident we have music. */
|
||||
if (st->silk_mode.useInBandFEC && st->silk_mode.packetLossPercentage > (128-voice_est)>>4 && (st->fec_config != 2 || voice_est > 25))
|
||||
/* When FEC is enabled and there's enough packet loss, use SILK */
|
||||
if (st->silk_mode.useInBandFEC && st->silk_mode.packetLossPercentage > (128-voice_est)>>4)
|
||||
st->mode = MODE_SILK_ONLY;
|
||||
/* When encoding voice and DTX is enabled but the generalized DTX cannot be used,
|
||||
use SILK in order to make use of its DTX. */
|
||||
|
|
@ -2445,12 +2439,11 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
|
|||
case OPUS_SET_INBAND_FEC_REQUEST:
|
||||
{
|
||||
opus_int32 value = va_arg(ap, opus_int32);
|
||||
if(value<0 || value>2)
|
||||
if(value<0 || value>1)
|
||||
{
|
||||
goto bad_arg;
|
||||
}
|
||||
st->fec_config = value;
|
||||
st->silk_mode.useInBandFEC = (value != 0);
|
||||
st->silk_mode.useInBandFEC = value;
|
||||
}
|
||||
break;
|
||||
case OPUS_GET_INBAND_FEC_REQUEST:
|
||||
|
|
@ -2460,7 +2453,7 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
|
|||
{
|
||||
goto bad_arg;
|
||||
}
|
||||
*value = st->fec_config;
|
||||
*value = st->silk_mode.useInBandFEC;
|
||||
}
|
||||
break;
|
||||
case OPUS_SET_PACKET_LOSS_PERC_REQUEST:
|
||||
|
|
|
|||
|
|
@ -66,3 +66,4 @@ python3 gen-sources.py $1
|
|||
|
||||
# apply outstanding local patches
|
||||
patch -p3 --no-backup-if-mismatch < nonunified.patch
|
||||
patch -p3 --no-backup-if-mismatch < nonunified2.patch
|
||||
|
|
|
|||
Loading…
Reference in a new issue