codecs: disable incompatible ARM assembly for Cortex-M

Some assembly routines don't work on Thumb as-is. For now
just disable these so the codecs compile.

Affected codecs:

- libflac
- libmad
- libspeex
- libtta
- libwavpack

A few DSP routines need to be disabled for the same reason:

- crossfeed_process
- crossfeed_meier_process
- resample_hermite
- filter_process
- sample_output_stereo

Change-Id: I277e0719652096745a19a7e2b597eff32d8e1553
This commit is contained in:
Aidan MacDonald 2024-11-14 18:06:35 +00:00
parent 94c7c908b3
commit da4e02cdd3
17 changed files with 28 additions and 23 deletions

View file

@ -2,6 +2,6 @@ decoder.c
shndec.c shndec.c
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
coldfire.S coldfire.S
#elif defined(CPU_ARM) #elif defined(CPU_ARM_CLASSIC)
arm.S arm.S
#endif #endif

View file

@ -320,7 +320,7 @@ static int decode_subframe_lpc(FLACContext *s, int32_t* decoded, int pred_order,
(void)sum; (void)sum;
lpc_decode_emac(s->blocksize - pred_order, qlevel, pred_order, lpc_decode_emac(s->blocksize - pred_order, qlevel, pred_order,
decoded + pred_order, coeffs); decoded + pred_order, coeffs);
#elif defined(CPU_ARM) #elif defined(CPU_ARM_CLASSIC)
(void)sum; (void)sum;
lpc_decode_arm(s->blocksize - pred_order, qlevel, pred_order, lpc_decode_arm(s->blocksize - pred_order, qlevel, pred_order,
decoded + pred_order, coeffs); decoded + pred_order, coeffs);

View file

@ -7,8 +7,7 @@ stream.c
synth.c synth.c
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
imdct_mcf5249.S imdct_mcf5249.S
#endif #elif defined(CPU_ARM_CLASSIC)
#if defined(CPU_ARM)
imdct_l_arm.S imdct_l_arm.S
synth_full_arm.S synth_full_arm.S
#endif #endif

View file

@ -28,7 +28,7 @@
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
#define FPM_COLDFIRE_EMAC #define FPM_COLDFIRE_EMAC
#elif defined(CPU_ARM) #elif defined(CPU_ARM_CLASSIC)
#define FPM_ARM #define FPM_ARM
#elif defined(CPU_MIPS) #elif defined(CPU_MIPS)
#define FPM_MIPS #define FPM_MIPS

View file

@ -922,7 +922,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp)
} }
/* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ /* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */
# if defined(CPU_ARM) # if defined(CPU_ARM_CLASSIC)
# define MASK(cache, sz, bits) \ # define MASK(cache, sz, bits) \
({ unsigned long res; \ ({ unsigned long res; \
asm ("mov %0, #1\n\t" \ asm ("mov %0, #1\n\t" \
@ -1557,7 +1557,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
return MAD_ERROR_NONE; return MAD_ERROR_NONE;
} }
#if defined(CPU_ARM) #if defined(CPU_ARM_CLASSIC)
void III_aliasreduce(mad_fixed_t xr[576], int lines); void III_aliasreduce(mad_fixed_t xr[576], int lines);
#else #else
/* /*
@ -2683,7 +2683,7 @@ void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36])
#endif #endif
#ifdef CPU_ARM #if defined(CPU_ARM_CLASSIC)
void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18],
mad_fixed_t sample[18][32], unsigned int sb); mad_fixed_t sample[18][32], unsigned int sb);
#else #else

View file

@ -39,7 +39,7 @@ resample.c
#ifdef CPU_COLDFIRE #ifdef CPU_COLDFIRE
filters_cf.S filters_cf.S
ltp_cf.S ltp_cf.S
#elif defined(CPU_ARM) #elif defined(CPU_ARM_CLASSIC)
filters_arm4.S filters_arm4.S
#endif #endif
#endif #endif

View file

@ -16,7 +16,7 @@
#define DISABLE_VBR #define DISABLE_VBR
/* Make use of ARM4E assembly optimizations */ /* Make use of ARM4E assembly optimizations */
#if defined(CPU_ARM) #if defined(CPU_ARM_CLASSIC)
#if (ARM_ARCH < 5) #if (ARM_ARCH < 5)
#define ARM4_ASM #define ARM4_ASM
#else #else

View file

@ -1,7 +1,6 @@
ttadec.c ttadec.c
#ifdef CPU_ARM #if defined(CPU_ARM_CLASSIC)
filter_arm.S filter_arm.S
#endif #elif defined(CPU_COLDFIRE)
#ifdef CPU_COLDFIRE
filter_coldfire.S filter_coldfire.S
#endif #endif

View file

@ -42,7 +42,7 @@
///////// Filter Settings ////////// ///////// Filter Settings //////////
static int flt_set[3] = {10, 9, 10}; static int flt_set[3] = {10, 9, 10};
#if defined(CPU_ARM) || defined(CPU_COLDFIRE) #if defined(CPU_ARM_CLASSIC) || defined(CPU_COLDFIRE)
int hybrid_filter(fltst *fs, int *in); /* implements in filter_arm.S */ int hybrid_filter(fltst *fs, int *in); /* implements in filter_arm.S */
#else #else

View file

@ -7,8 +7,7 @@ words.c
wputils.c wputils.c
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
coldfire.S coldfire.S
#endif #elif defined(CPU_ARM_CLASSIC)
#if defined(CPU_ARM)
arm.S arm.S
arml.S arml.S
#endif #endif

View file

@ -304,7 +304,7 @@ int read_sample_rate (WavpackContext *wpc, WavpackMetadata *wpmd)
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
extern void decorr_stereo_pass_cont_mcf5249 (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); extern void decorr_stereo_pass_cont_mcf5249 (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count);
#elif defined(CPU_ARM) #elif defined(CPU_ARM_CLASSIC)
extern void decorr_stereo_pass_cont_arm (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); extern void decorr_stereo_pass_cont_arm (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count);
extern void decorr_stereo_pass_cont_arml (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); extern void decorr_stereo_pass_cont_arml (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count);
#else #else
@ -369,7 +369,7 @@ int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_co
decorr_stereo_pass (dpp, buffer, 8); decorr_stereo_pass (dpp, buffer, 8);
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
decorr_stereo_pass_cont_mcf5249 (dpp, buffer + 16, sample_count - 8); decorr_stereo_pass_cont_mcf5249 (dpp, buffer + 16, sample_count - 8);
#elif defined(CPU_ARM) #elif defined(CPU_ARM_CLASSIC)
if (((flags & MAG_MASK) >> MAG_LSB) > 15) if (((flags & MAG_MASK) >> MAG_LSB) > 15)
decorr_stereo_pass_cont_arml (dpp, buffer + 16, sample_count - 8); decorr_stereo_pass_cont_arml (dpp, buffer + 16, sample_count - 8);
else else
@ -541,7 +541,7 @@ static void decorr_stereo_pass (struct decorr_pass *dpp, int32_t *buffer, int32_
dpp->weight_B = weight_B; dpp->weight_B = weight_B;
} }
#if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) #if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM_CLASSIC))
static void decorr_stereo_pass_cont (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count) static void decorr_stereo_pass_cont (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count)
{ {

View file

@ -172,7 +172,7 @@ void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, long cutoff)
dsp_get_output_frequency(dsp)); dsp_get_output_frequency(dsp));
} }
#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM) #if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) || defined(CPU_ARM_MICRO)
/* Apply the crossfade to the buffer in place */ /* Apply the crossfade to the buffer in place */
void crossfeed_process(struct dsp_proc_entry *this, struct dsp_buffer **buf_p) void crossfeed_process(struct dsp_proc_entry *this, struct dsp_buffer **buf_p)
{ {
@ -224,7 +224,7 @@ void crossfeed_process(struct dsp_proc_entry *this, struct dsp_buffer **buf_p)
} }
#endif /* CPU */ #endif /* CPU */
#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM) #if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) || defined(CPU_ARM_MICRO)
/** /**
* Implementation of the "simple" passive crossfeed circuit by Jan Meier. * Implementation of the "simple" passive crossfeed circuit by Jan Meier.
* See also: http://www.meier-audio.homepage.t-online.de/passivefilter.htm * See also: http://www.meier-audio.homepage.t-online.de/passivefilter.htm

View file

@ -185,6 +185,7 @@ channel_mode_proc_karaoke:
ldmpc regs=r4 @ ldmpc regs=r4 @
.size channel_mode_proc_karaoke, .-channel_mode_proc_karaoke .size channel_mode_proc_karaoke, .-channel_mode_proc_karaoke
#ifndef CPU_ARM_MICRO
/**************************************************************************** /****************************************************************************
* void crossfeed_process(struct dsp_proc_entry *this, * void crossfeed_process(struct dsp_proc_entry *this,
* struct dsp_buffer **buf_p) * struct dsp_buffer **buf_p)
@ -508,6 +509,7 @@ resample_hermite:
str r2, [r3] @ dst->remcount = r2 str r2, [r3] @ dst->remcount = r2
ldmpc regs=r4-r11 @ ... and we're out ldmpc regs=r4-r11 @ ... and we're out
.size resample_hermite, .-resample_hermite .size resample_hermite, .-resample_hermite
#endif /* CPU_ARM_MICRO */
/**************************************************************************** /****************************************************************************
* void pga_process(struct dsp_proc_entry *this, struct dsp_buffer **buf_p) * void pga_process(struct dsp_proc_entry *this, struct dsp_buffer **buf_p)
@ -558,6 +560,7 @@ pga_process:
ldmpc regs=r4-r8 ldmpc regs=r4-r8
.size pga_process, .-pga_process .size pga_process, .-pga_process
#ifndef CPU_ARM_MICRO
/**************************************************************************** /****************************************************************************
* void filter_process(struct dsp_filter *f, int32_t *buf[], int count, * void filter_process(struct dsp_filter *f, int32_t *buf[], int count,
* unsigned int channels) * unsigned int channels)
@ -623,6 +626,7 @@ filter_process:
add sp, sp, #16 @ compensate for temp storage add sp, sp, #16 @ compensate for temp storage
ldmpc regs=r4-r11 ldmpc regs=r4-r11
.size filter_process, .-filter_process .size filter_process, .-filter_process
#endif /* CPU_ARM_MICRO */
#if ARM_ARCH < 6 #if ARM_ARCH < 6
/**************************************************************************** /****************************************************************************

View file

@ -71,6 +71,7 @@ sample_output_mono:
ldmfd sp!, { r4, pc } @ ldmfd sp!, { r4, pc } @
.size sample_output_mono, .-sample_output_mono .size sample_output_mono, .-sample_output_mono
#ifndef CPU_ARM_MICRO
/**************************************************************************** /****************************************************************************
* void sample_output_stereo(struct sample_io_data *this, * void sample_output_stereo(struct sample_io_data *this,
* struct dsp_buffer *src, * struct dsp_buffer *src,
@ -131,3 +132,4 @@ sample_output_stereo:
@ @
ldmfd sp!, { r4-r7, pc } @ ldmfd sp!, { r4-r7, pc } @
.size sample_output_stereo, .-sample_output_stereo .size sample_output_stereo, .-sample_output_stereo
#endif /* CPU_ARM_MICRO */

View file

@ -277,7 +277,7 @@ void filter_flush(struct dsp_filter *f)
* form 1 was chosen because of better numerical properties for fixed point * form 1 was chosen because of better numerical properties for fixed point
* implementations. * implementations.
*/ */
#if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) #if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) || defined(CPU_ARM_MICRO)
void filter_process(struct dsp_filter *f, int32_t * const buf[], int count, void filter_process(struct dsp_filter *f, int32_t * const buf[], int count,
unsigned int channels) unsigned int channels)
{ {

View file

@ -63,7 +63,9 @@ void sample_output_mono(struct sample_io_data *this,
} }
while (--count > 0); while (--count > 0);
} }
#endif /* CPU */
#if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) || defined(CPU_ARM_MICRO)
/* write stereo internal format to output format */ /* write stereo internal format to output format */
void sample_output_stereo(struct sample_io_data *this, void sample_output_stereo(struct sample_io_data *this,
struct dsp_buffer *src, struct dsp_buffer *dst) struct dsp_buffer *src, struct dsp_buffer *dst)

View file

@ -97,7 +97,7 @@ static bool resample_new_delta(struct resample_data *data,
return true; return true;
} }
#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM) #if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) || defined(CPU_ARM_MICRO)
int resample_hermite(struct resample_data *data, struct dsp_buffer *src, int resample_hermite(struct resample_data *data, struct dsp_buffer *src,
struct dsp_buffer *dst) struct dsp_buffer *dst)
{ {