From b12ef5e6f8fa0c74f7ea57ff656273b882d2e6cb Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Wed, 23 Sep 2026 19:58:16 -0400 Subject: [PATCH] opus: gate the ARMv5E kernels for ARMv6 too Four `ARM_ARCH == 5` checks -- in SOURCES and celt/arm/{bands_arm, comb_filter_arm,vq_arm}.h -- excluded ARMv6 from every ARMv5E kernel: denorm_band, haar1, comb_filter_const, celt_sat, deemphasis_stereo_simple, exp_rotation1 and normres_scale all silently fell back to plain C on ARM1136/ARM1176, since ARMv6 is a strict superset of the EDSP instructions those kernels use. Widened to ARM_ARCH >= 5, matching config.h's own OPUS_ARM_INLINE_EDSP gate, which was already ARM_ARCH > 4. These four can't be fixed at the commits that introduced them: those commits are already merged into master under different SHAs. A fifth instance of the same bug, in celt/arm/mdct_armv5e.h, was fixed at its origin commit instead, since that one is still open for review. Verified on both native ARMv6 targets (iPod Nano 4G, ARM1176JZ-S; Gigabeat S, ARM1136JF-S) and the hosted Samsung YP-R0 (ARM1176JZ-S, cross toolchain built for the occasion): all three now link and call all 16 ARMv5E kernels, where they linked and called zero before this fix. Decoded PCM bit-identical to the ARMv5E build under qemu. Co-Authored-By: Claude Sonnet 5 Change-Id: I7e6f6b421b9c0203812fb45d2258c7eb81738d98 --- lib/rbcodec/codecs/libopus/celt/arm/bands_arm.h | 2 +- lib/rbcodec/codecs/libopus/celt/arm/comb_filter_arm.h | 2 +- lib/rbcodec/codecs/libopus/celt/arm/vq_arm.h | 2 +- lib/rbcodec/codecs/libopus/config.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/rbcodec/codecs/libopus/celt/arm/bands_arm.h b/lib/rbcodec/codecs/libopus/celt/arm/bands_arm.h index 4ff0952aa8..31dd2233af 100644 --- a/lib/rbcodec/codecs/libopus/celt/arm/bands_arm.h +++ b/lib/rbcodec/codecs/libopus/celt/arm/bands_arm.h @@ -42,7 +42,7 @@ void denorm_band_armv4(celt_sig *f, const celt_norm *x, int n, int g, int shift); # define DENORM_BAND denorm_band_armv4 -# elif defined(OPUS_ARM_INLINE_EDSP) && (ARM_ARCH == 5) +# elif defined(OPUS_ARM_INLINE_EDSP) && (ARM_ARCH >= 5) # define OVERRIDE_DENORM_BAND void denorm_band_armv5e(celt_sig *f, const celt_norm *x, int n, int g, diff --git a/lib/rbcodec/codecs/libopus/celt/arm/comb_filter_arm.h b/lib/rbcodec/codecs/libopus/celt/arm/comb_filter_arm.h index a1f1baaecf..67a0559047 100644 --- a/lib/rbcodec/codecs/libopus/celt/arm/comb_filter_arm.h +++ b/lib/rbcodec/codecs/libopus/celt/arm/comb_filter_arm.h @@ -61,7 +61,7 @@ void deemph_stereo_armv4(celt_sig *x0, celt_sig *x1, opus_val16 *pcm, int N, # define deemphasis_stereo_simple(in, pcm, N, coef0, mem) \ deemph_stereo_armv4((in)[0], (in)[1], (pcm), (N), (coef0), (mem)) -# elif defined(OPUS_ARM_INLINE_EDSP) && (ARM_ARCH == 5) +# elif defined(OPUS_ARM_INLINE_EDSP) && (ARM_ARCH >= 5) # define OVERRIDE_COMB_FILTER_CONST void comb_filter_const_armv5e(opus_val32 *y, opus_val32 *x, int T, int N, diff --git a/lib/rbcodec/codecs/libopus/celt/arm/vq_arm.h b/lib/rbcodec/codecs/libopus/celt/arm/vq_arm.h index a68b9946ec..6b725a3a47 100644 --- a/lib/rbcodec/codecs/libopus/celt/arm/vq_arm.h +++ b/lib/rbcodec/codecs/libopus/celt/arm/vq_arm.h @@ -36,7 +36,7 @@ Shares OPUS_ARM_NO_BANDS_ASM with arm/bands_arm.h as the escape hatch. */ #if defined(FIXED_POINT) && !defined(OPUS_ARM_NO_BANDS_ASM) \ - && defined(OPUS_ARM_INLINE_EDSP) && (ARM_ARCH == 5) + && defined(OPUS_ARM_INLINE_EDSP) && (ARM_ARCH >= 5) #define OVERRIDE_vq_exp_rotation1 void exp_rotation1_armv5e(celt_norm *X, int len, int stride, opus_val16 c, diff --git a/lib/rbcodec/codecs/libopus/config.h b/lib/rbcodec/codecs/libopus/config.h index d1d37e042e..3b57bc4221 100644 --- a/lib/rbcodec/codecs/libopus/config.h +++ b/lib/rbcodec/codecs/libopus/config.h @@ -87,6 +87,8 @@ #define OPUS_ARM_NO_MDCT_ASM #define OPUS_ARM_NO_PITCH_ASM #define OPUS_NO_PFA +#define OPUS_ARM_NO_COMB_ASM +#define OPUS_ARM_NO_BANDS_ASM #endif #endif /* ARM_ARCH */