diff options
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 c29094b372..4346a23304 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) | |||
221 | const int32_t* data1_32; | 221 | const int32_t* data1_32; |
222 | const int32_t* data2_32; | 222 | const int32_t* data2_32; |
223 | unsigned char* p = wavbuffer; | 223 | unsigned char* p = wavbuffer; |
224 | int scale = wavinfo.sampledepth - 15; | 224 | const int scale = wavinfo.sampledepth - 15; |
225 | const int dc_bias = 1 << (scale - 1); | ||
225 | 226 | ||
226 | /* Prevent idle poweroff */ | 227 | /* Prevent idle poweroff */ |
227 | rb->reset_poweroff_timer(); | 228 | rb->reset_poweroff_timer(); |
@@ -266,18 +267,18 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count) | |||
266 | { | 267 | { |
267 | case STEREO_INTERLEAVED: | 268 | case STEREO_INTERLEAVED: |
268 | while (count--) { | 269 | while (count--) { |
269 | int2le16(p, clip_sample((*data1_32++) >> scale)); | 270 | int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); |
270 | p += 2; | 271 | p += 2; |
271 | int2le16(p, clip_sample((*data1_32++) >> scale)); | 272 | int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); |
272 | p += 2; | 273 | p += 2; |
273 | } | 274 | } |
274 | break; | 275 | break; |
275 | 276 | ||
276 | case STEREO_NONINTERLEAVED: | 277 | case STEREO_NONINTERLEAVED: |
277 | while (count--) { | 278 | while (count--) { |
278 | int2le16(p, clip_sample((*data1_32++) >> scale)); | 279 | int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); |
279 | p += 2; | 280 | p += 2; |
280 | int2le16(p, clip_sample((*data2_32++) >> scale)); | 281 | int2le16(p, clip_sample((*data2_32++ + dc_bias) >> scale)); |
281 | p += 2; | 282 | p += 2; |
282 | } | 283 | } |
283 | 284 | ||
@@ -285,7 +286,7 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count) | |||
285 | 286 | ||
286 | case STEREO_MONO: | 287 | case STEREO_MONO: |
287 | while (count--) { | 288 | while (count--) { |
288 | int2le16(p, clip_sample((*data1_32++) >> scale)); | 289 | int2le16(p, clip_sample((*data1_32++ + dc_bias) >> scale)); |
289 | p += 2; | 290 | p += 2; |
290 | } | 291 | } |
291 | break; | 292 | break; |