diff options
author | Yoshihisa Uchida <uchida@rockbox.org> | 2010-03-12 11:34:09 +0000 |
---|---|---|
committer | Yoshihisa Uchida <uchida@rockbox.org> | 2010-03-12 11:34:09 +0000 |
commit | 2a9c42d1ed265f67d5dfb15b01c3ca1235127197 (patch) | |
tree | 70a1dd858a8aa85e9e12157cdce71ac5b196c3d9 | |
parent | c7517f5662eda9af236e6206af6f8b02e77bf118 (diff) | |
download | rockbox-2a9c42d1ed265f67d5dfb15b01c3ca1235127197.tar.gz rockbox-2a9c42d1ed265f67d5dfb15b01c3ca1235127197.zip |
libpcm: output depth corrects for the sign 1bit. linear pcm corrects bits shift.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25131 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/aiff.c | 2 | ||||
-rw-r--r-- | apps/codecs/libpcm/linear_pcm.c | 4 | ||||
-rw-r--r-- | apps/codecs/libpcm/pcm_common.h | 4 | ||||
-rw-r--r-- | apps/codecs/smaf.c | 2 | ||||
-rw-r--r-- | apps/codecs/vox.c | 2 | ||||
-rw-r--r-- | apps/codecs/wav.c | 2 | ||||
-rw-r--r-- | apps/codecs/wav64.c | 2 |
7 files changed, 9 insertions, 9 deletions
diff --git a/apps/codecs/aiff.c b/apps/codecs/aiff.c index 18a48a329a..62d79ac340 100644 --- a/apps/codecs/aiff.c +++ b/apps/codecs/aiff.c | |||
@@ -87,7 +87,7 @@ enum codec_status codec_main(void) | |||
87 | uint32_t size; | 87 | uint32_t size; |
88 | 88 | ||
89 | /* Generic codec initialisation */ | 89 | /* Generic codec initialisation */ |
90 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH); | 90 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); |
91 | 91 | ||
92 | next_track: | 92 | next_track: |
93 | if (codec_init()) { | 93 | if (codec_init()) { |
diff --git a/apps/codecs/libpcm/linear_pcm.c b/apps/codecs/libpcm/linear_pcm.c index 2a37f3d2a8..82c70eb3b6 100644 --- a/apps/codecs/libpcm/linear_pcm.c +++ b/apps/codecs/libpcm/linear_pcm.c | |||
@@ -95,7 +95,7 @@ static inline void decode_s16le(const uint8_t *inbuf, size_t inbufsize, int32_t | |||
95 | size_t i = 0; | 95 | size_t i = 0; |
96 | 96 | ||
97 | for ( ; i < inbufsize; i += 2) | 97 | for ( ; i < inbufsize; i += 2) |
98 | outbuf[i/2] = (inbuf[i] << INC_DEPTH_16)|(SE(inbuf[i+1]) << INC_DEPTH_16); | 98 | outbuf[i/2] = (inbuf[i] << INC_DEPTH_16)|(SE(inbuf[i+1]) << INC_DEPTH_8); |
99 | } | 99 | } |
100 | 100 | ||
101 | static inline void decode_u16le(const uint8_t *inbuf, size_t inbufsize, int32_t *outbuf) | 101 | static inline void decode_u16le(const uint8_t *inbuf, size_t inbufsize, int32_t *outbuf) |
@@ -155,7 +155,7 @@ static inline void decode_u24be(const uint8_t *inbuf, size_t inbufsize, int32_t | |||
155 | size_t i = 0; | 155 | size_t i = 0; |
156 | 156 | ||
157 | for ( ; i < inbufsize; i += 3) | 157 | for ( ; i < inbufsize; i += 3) |
158 | outbuf[i/3] = (inbuf[i+2] << INC_DEPTH_24)|(inbuf[i+1] << INC_DEPTH_8)| | 158 | outbuf[i/3] = (inbuf[i+2] << INC_DEPTH_24)|(inbuf[i+1] << INC_DEPTH_16)| |
159 | (SFT(inbuf[i]) << INC_DEPTH_8); | 159 | (SFT(inbuf[i]) << INC_DEPTH_8); |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/apps/codecs/libpcm/pcm_common.h b/apps/codecs/libpcm/pcm_common.h index b303273667..412ffbce0b 100644 --- a/apps/codecs/libpcm/pcm_common.h +++ b/apps/codecs/libpcm/pcm_common.h | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <stdbool.h> | 25 | #include <stdbool.h> |
26 | #include <inttypes.h> | 26 | #include <inttypes.h> |
27 | 27 | ||
28 | /* decoded pcm sample depth */ | 28 | /* decoded pcm sample depth (sample 28bit + sign 1bit) */ |
29 | #define PCM_OUTPUT_DEPTH 28 | 29 | #define PCM_OUTPUT_DEPTH 29 |
30 | 30 | ||
31 | /* Macro that sign extends an unsigned byte */ | 31 | /* Macro that sign extends an unsigned byte */ |
32 | #define SE(x) ((int32_t)((int8_t)(x))) | 32 | #define SE(x) ((int32_t)((int8_t)(x))) |
diff --git a/apps/codecs/smaf.c b/apps/codecs/smaf.c index 9309937700..8349d394ac 100644 --- a/apps/codecs/smaf.c +++ b/apps/codecs/smaf.c | |||
@@ -284,7 +284,7 @@ enum codec_status codec_main(void) | |||
284 | const struct pcm_codec *codec; | 284 | const struct pcm_codec *codec; |
285 | 285 | ||
286 | /* Generic codec initialisation */ | 286 | /* Generic codec initialisation */ |
287 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH); | 287 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); |
288 | 288 | ||
289 | next_track: | 289 | next_track: |
290 | if (codec_init()) { | 290 | if (codec_init()) { |
diff --git a/apps/codecs/vox.c b/apps/codecs/vox.c index f306d8e1f1..21742e16d9 100644 --- a/apps/codecs/vox.c +++ b/apps/codecs/vox.c | |||
@@ -57,7 +57,7 @@ enum codec_status codec_main(void) | |||
57 | int offset = 0; | 57 | int offset = 0; |
58 | 58 | ||
59 | /* Generic codec initialisation */ | 59 | /* Generic codec initialisation */ |
60 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH); | 60 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); |
61 | 61 | ||
62 | next_track: | 62 | next_track: |
63 | if (codec_init()) { | 63 | if (codec_init()) { |
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c index f4e7f778fd..14d7136592 100644 --- a/apps/codecs/wav.c +++ b/apps/codecs/wav.c | |||
@@ -165,7 +165,7 @@ enum codec_status codec_main(void) | |||
165 | uint32_t size; | 165 | uint32_t size; |
166 | 166 | ||
167 | /* Generic codec initialisation */ | 167 | /* Generic codec initialisation */ |
168 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH); | 168 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); |
169 | 169 | ||
170 | next_track: | 170 | next_track: |
171 | if (codec_init()) { | 171 | if (codec_init()) { |
diff --git a/apps/codecs/wav64.c b/apps/codecs/wav64.c index f70fb53ba4..1913dafe5c 100644 --- a/apps/codecs/wav64.c +++ b/apps/codecs/wav64.c | |||
@@ -173,7 +173,7 @@ enum codec_status codec_main(void) | |||
173 | uint64_t size; | 173 | uint64_t size; |
174 | 174 | ||
175 | /* Generic codec initialisation */ | 175 | /* Generic codec initialisation */ |
176 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH); | 176 | ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); |
177 | 177 | ||
178 | next_track: | 178 | next_track: |
179 | if (codec_init()) { | 179 | if (codec_init()) { |