diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs.h | 1 | ||||
-rw-r--r-- | apps/codecs/libspc/spc_dsp.c | 20 | ||||
-rw-r--r-- | apps/dsp.c | 15 | ||||
-rw-r--r-- | apps/pcmbuf.c | 9 | ||||
-rw-r--r-- | apps/plugin.h | 1 |
5 files changed, 6 insertions, 40 deletions
diff --git a/apps/codecs.h b/apps/codecs.h index 527c59ac9c..f1e2a51eac 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "pcm_record.h" | 43 | #include "pcm_record.h" |
44 | #endif | 44 | #endif |
45 | #include "dsp.h" | 45 | #include "dsp.h" |
46 | #include "dsp-util.h" | ||
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #include "gcc_extensions.h" | 49 | #include "gcc_extensions.h" |
diff --git a/apps/codecs/libspc/spc_dsp.c b/apps/codecs/libspc/spc_dsp.c index 28e05425fb..6350c4c331 100644 --- a/apps/codecs/libspc/spc_dsp.c +++ b/apps/codecs/libspc/spc_dsp.c | |||
@@ -57,25 +57,7 @@ void DSP_write( struct Spc_Dsp* this, int i, int data ) | |||
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | #if ARM_ARCH >= 6 | 60 | #define CLAMP16( n ) clip_sample_16( n ) |
61 | /* if ( n < -32768 ) out = -32768; */ | ||
62 | /* if ( n > 32767 ) out = 32767; */ | ||
63 | #define CLAMP16( n ) \ | ||
64 | ({ \ | ||
65 | asm ("ssat %0, #16, %1" \ | ||
66 | : "=r" ( n ) : "r"( n ) ); \ | ||
67 | n; \ | ||
68 | }) | ||
69 | #else | ||
70 | /* if ( n < -32768 ) out = -32768; */ | ||
71 | /* if ( n > 32767 ) out = 32767; */ | ||
72 | #define CLAMP16( n ) \ | ||
73 | ({ \ | ||
74 | if ( (int16_t) n != n ) \ | ||
75 | n = 0x7FFF ^ (n >> 31); \ | ||
76 | n; \ | ||
77 | }) | ||
78 | #endif | ||
79 | 61 | ||
80 | #if SPC_BRRCACHE | 62 | #if SPC_BRRCACHE |
81 | static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, | 63 | static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, |
diff --git a/apps/dsp.c b/apps/dsp.c index d9c097af66..00de511dd0 100644 --- a/apps/dsp.c +++ b/apps/dsp.c | |||
@@ -19,15 +19,12 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "config.h" | 21 | #include "config.h" |
22 | 22 | #include "system.h" | |
23 | #include <stdbool.h> | ||
24 | #include <inttypes.h> | ||
25 | #include <string.h> | ||
26 | #include <sound.h> | 23 | #include <sound.h> |
27 | #include "dsp.h" | 24 | #include "dsp.h" |
25 | #include "dsp-util.h" | ||
28 | #include "eq.h" | 26 | #include "eq.h" |
29 | #include "kernel.h" | 27 | #include "kernel.h" |
30 | #include "system.h" | ||
31 | #include "settings.h" | 28 | #include "settings.h" |
32 | #include "replaygain.h" | 29 | #include "replaygain.h" |
33 | #include "tdspeed.h" | 30 | #include "tdspeed.h" |
@@ -261,14 +258,6 @@ static int32_t release_gain IBSS_ATTR; /* S7.24 format */ | |||
261 | static void compressor_process(int count, int32_t *buf[]); | 258 | static void compressor_process(int count, int32_t *buf[]); |
262 | 259 | ||
263 | 260 | ||
264 | /* Clip sample to signed 16 bit range */ | ||
265 | static inline int32_t clip_sample_16(int32_t sample) | ||
266 | { | ||
267 | if ((int16_t)sample != sample) | ||
268 | sample = 0x7fff ^ (sample >> 31); | ||
269 | return sample; | ||
270 | } | ||
271 | |||
272 | #ifdef HAVE_PITCHSCREEN | 261 | #ifdef HAVE_PITCHSCREEN |
273 | int32_t sound_get_pitch(void) | 262 | int32_t sound_get_pitch(void) |
274 | { | 263 | { |
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 8135a30a36..32e1157132 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "pcm.h" | 27 | #include "pcm.h" |
28 | #include "pcm_mixer.h" | 28 | #include "pcm_mixer.h" |
29 | #include "pcmbuf.h" | 29 | #include "pcmbuf.h" |
30 | #include "dsp-util.h" | ||
30 | #include "playback.h" | 31 | #include "playback.h" |
31 | #include "codec_thread.h" | 32 | #include "codec_thread.h" |
32 | 33 | ||
@@ -828,14 +829,6 @@ static size_t crossfade_find_buftail(size_t buffer_rem, size_t buffer_need) | |||
828 | return buffer_rem; | 829 | return buffer_rem; |
829 | } | 830 | } |
830 | 831 | ||
831 | /* Clip sample to signed 16 bit range */ | ||
832 | static FORCE_INLINE int32_t clip_sample_16(int32_t sample) | ||
833 | { | ||
834 | if ((int16_t)sample != sample) | ||
835 | sample = 0x7fff ^ (sample >> 31); | ||
836 | return sample; | ||
837 | } | ||
838 | |||
839 | /* Returns the number of bytes _NOT_ mixed/faded */ | 832 | /* Returns the number of bytes _NOT_ mixed/faded */ |
840 | static int crossfade_mix_fade(int factor, size_t size, void *buf, size_t *out_index, | 833 | static int crossfade_mix_fade(int factor, size_t size, void *buf, size_t *out_index, |
841 | unsigned long elapsed, off_t offset) | 834 | unsigned long elapsed, off_t offset) |
diff --git a/apps/plugin.h b/apps/plugin.h index 0ee37bb4fe..e2b7fe7e11 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -66,6 +66,7 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
66 | #include "filefuncs.h" | 66 | #include "filefuncs.h" |
67 | #if (CONFIG_CODEC == SWCODEC) | 67 | #if (CONFIG_CODEC == SWCODEC) |
68 | #include "pcm_mixer.h" | 68 | #include "pcm_mixer.h" |
69 | #include "dsp-util.h" | ||
69 | #include "dsp.h" | 70 | #include "dsp.h" |
70 | #include "codecs.h" | 71 | #include "codecs.h" |
71 | #include "playback.h" | 72 | #include "playback.h" |