1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Yoshihisa Uchida 2010-03-12 11:34:09 +00:00
parent c7517f5662
commit 2a9c42d1ed
7 changed files with 9 additions and 9 deletions

View file

@ -87,7 +87,7 @@ enum codec_status codec_main(void)
uint32_t size;
/* Generic codec initialisation */
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH);
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
next_track:
if (codec_init()) {

View file

@ -95,7 +95,7 @@ static inline void decode_s16le(const uint8_t *inbuf, size_t inbufsize, int32_t
size_t i = 0;
for ( ; i < inbufsize; i += 2)
outbuf[i/2] = (inbuf[i] << INC_DEPTH_16)|(SE(inbuf[i+1]) << INC_DEPTH_16);
outbuf[i/2] = (inbuf[i] << INC_DEPTH_16)|(SE(inbuf[i+1]) << INC_DEPTH_8);
}
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
size_t i = 0;
for ( ; i < inbufsize; i += 3)
outbuf[i/3] = (inbuf[i+2] << INC_DEPTH_24)|(inbuf[i+1] << INC_DEPTH_8)|
outbuf[i/3] = (inbuf[i+2] << INC_DEPTH_24)|(inbuf[i+1] << INC_DEPTH_16)|
(SFT(inbuf[i]) << INC_DEPTH_8);
}

View file

@ -25,8 +25,8 @@
#include <stdbool.h>
#include <inttypes.h>
/* decoded pcm sample depth */
#define PCM_OUTPUT_DEPTH 28
/* decoded pcm sample depth (sample 28bit + sign 1bit) */
#define PCM_OUTPUT_DEPTH 29
/* Macro that sign extends an unsigned byte */
#define SE(x) ((int32_t)((int8_t)(x)))

View file

@ -284,7 +284,7 @@ enum codec_status codec_main(void)
const struct pcm_codec *codec;
/* Generic codec initialisation */
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH);
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
next_track:
if (codec_init()) {

View file

@ -57,7 +57,7 @@ enum codec_status codec_main(void)
int offset = 0;
/* Generic codec initialisation */
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH);
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
next_track:
if (codec_init()) {

View file

@ -165,7 +165,7 @@ enum codec_status codec_main(void)
uint32_t size;
/* Generic codec initialisation */
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH);
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
next_track:
if (codec_init()) {

View file

@ -173,7 +173,7 @@ enum codec_status codec_main(void)
uint64_t size;
/* Generic codec initialisation */
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH);
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
next_track:
if (codec_init()) {