diff options
| author | Thom Johansen <thomj@rockbox.org> | 2007-08-29 14:32:52 +0000 |
|---|---|---|
| committer | Thom Johansen <thomj@rockbox.org> | 2007-08-29 14:32:52 +0000 |
| commit | c668de30852552a275b809a24648aa5a887eac65 (patch) | |
| tree | 785f4423564a37743fe111eede84c58e034e3468 /apps/plugins/test_codec.c | |
| parent | 8f5f690760bbf9c8dbb3d142b12cbab236e79d26 (diff) | |
| download | rockbox-c668de30852552a275b809a24648aa5a887eac65.zip rockbox-c668de30852552a275b809a24648aa5a887eac65.tar.gz rockbox-c668de30852552a275b809a24648aa5a887eac65.tar.bz2 rockbox-c668de30852552a275b809a24648aa5a887eac65.tar.xz | |
FS #7286. Do correct rounding of final 16 bit samples before sending to DAC, for you golden-eared people.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14514 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_codec.c')
| -rw-r--r-- | apps/plugins/test_codec.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index c29094b..4346a23 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -221,7 +221,8 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count) const int32_t* data1_32; const int32_t* data2_32; unsigned char* p = wavbuffer; - int scale = wavinfo.sampledepth - 15; + const int scale = wavinfo.sampledepth - 15; + const int dc_bias = 1 << (scale - 1); /* Prevent idle poweroff */ rb->reset_poweroff_timer(); @@ -266,18 +267,18 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count) { case STEREO_INTERLEAVED: while (count--) { - int2le16(p, clip_sample((*data1_32++) >> scale)); + int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); p += 2; - int2le16(p, clip_sample((*data1_32++) >> scale)); + int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); p += 2; } break; case STEREO_NONINTERLEAVED: while (count--) { - int2le16(p, clip_sample((*data1_32++) >> scale)); + int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); p += 2; - int2le16(p, clip_sample((*data2_32++) >> scale)); + int2le16(p, clip_sample((*data2_32++ + dc_bias) >> scale)); p += 2; } @@ -285,7 +286,7 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count) case STEREO_MONO: while (count--) { - int2le16(p, clip_sample((*data1_32++) >> scale)); + int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); p += 2; } break; |