diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-12-04 18:19:39 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-12-04 18:19:39 +0000 |
commit | a43df152c2adf737208bbeb294a0a13608d3cc43 (patch) | |
tree | c0534198745141699a08d9471303744948e51138 /apps/codecs/libspc/spc_dsp.c | |
parent | 700e360b612766eb2729597be55c43b5b69bbe7f (diff) | |
download | rockbox-a43df152c2adf737208bbeb294a0a13608d3cc43.tar.gz rockbox-a43df152c2adf737208bbeb294a0a13608d3cc43.zip |
Collect the 16-bit signed range sample clipping routines scattered about, which can be optimized on armv6 and create firmware/export/dsp-util.h (for lack of better place right now).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31142 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspc/spc_dsp.c')
-rw-r--r-- | apps/codecs/libspc/spc_dsp.c | 20 |
1 files changed, 1 insertions, 19 deletions
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, |