summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-12-01 00:39:37 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-12-01 00:39:37 +0000
commit3b7d7033292bad94fc9d55a1aac6072ba4856b4f (patch)
tree054f24439e2ff745fdd9248aa4bea8abd0def0a1
parent416acea2d825a289e63ed4132b430c33816c451a (diff)
downloadrockbox-3b7d7033292bad94fc9d55a1aac6072ba4856b4f.tar.gz
rockbox-3b7d7033292bad94fc9d55a1aac6072ba4856b4f.zip
Encoders: Mixdown to mono should round towards zero not -infinity.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11634 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/aiff_enc.c4
-rw-r--r--apps/codecs/mp3_enc.c2
-rw-r--r--apps/codecs/wav_enc.c4
-rw-r--r--apps/codecs/wavpack_enc.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/apps/codecs/aiff_enc.c b/apps/codecs/aiff_enc.c
index c1c2a9ec48..aca1951654 100644
--- a/apps/codecs/aiff_enc.c
+++ b/apps/codecs/aiff_enc.c
@@ -240,10 +240,10 @@ static void chunk_to_aiff_format(uint32_t *src, uint32_t *dst)
240 int32_t lr1, lr2; 240 int32_t lr1, lr2;
241 241
242 lr1 = *(*src)++; 242 lr1 = *(*src)++;
243 lr1 = ((int16_t)lr1 + (lr1 >> 16)) >> 1; 243 lr1 = ((int16_t)lr1 + (lr1 >> 16)) / 2;
244 244
245 lr2 = *(*src)++; 245 lr2 = *(*src)++;
246 lr2 = ((int16_t)lr2 + (lr2 >> 16)) >> 1; 246 lr2 = ((int16_t)lr2 + (lr2 >> 16)) / 2;
247 *(*dst)++ = swap_odd_even_le32((lr1 << 16) | (uint16_t)lr2); 247 *(*dst)++ = swap_odd_even_le32((lr1 << 16) | (uint16_t)lr2);
248 } /* to_mono */ 248 } /* to_mono */
249 249
diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c
index bbae3502bd..300787fcc2 100644
--- a/apps/codecs/mp3_enc.c
+++ b/apps/codecs/mp3_enc.c
@@ -2055,7 +2055,7 @@ static void to_mono_mm(void)
2055 inline void to_mono(uint32_t **samp) 2055 inline void to_mono(uint32_t **samp)
2056 { 2056 {
2057 int32_t lr = **samp; 2057 int32_t lr = **samp;
2058 int32_t m = ((int16_t)lr + (lr >> 16)) >> 1; 2058 int32_t m = ((int16_t)lr + (lr >> 16)) / 2;
2059 *(*samp)++ = (m << 16) | (uint16_t)m; 2059 *(*samp)++ = (m << 16) | (uint16_t)m;
2060 } /* to_mono */ 2060 } /* to_mono */
2061 2061
diff --git a/apps/codecs/wav_enc.c b/apps/codecs/wav_enc.c
index 083465ab54..4b7b0083c8 100644
--- a/apps/codecs/wav_enc.c
+++ b/apps/codecs/wav_enc.c
@@ -229,10 +229,10 @@ static void chunk_to_wav_format(uint32_t *src, uint32_t *dst)
229 int32_t lr1, lr2; 229 int32_t lr1, lr2;
230 230
231 lr1 = *(*src)++; 231 lr1 = *(*src)++;
232 lr1 = ((int16_t)lr1 + (lr1 >> 16)) >> 1; 232 lr1 = ((int16_t)lr1 + (lr1 >> 16)) / 2;
233 233
234 lr2 = *(*src)++; 234 lr2 = *(*src)++;
235 lr2 = ((int16_t)lr2 + (lr2 >> 16)) >> 1; 235 lr2 = ((int16_t)lr2 + (lr2 >> 16)) / 2;
236 *(*dst)++ = swap_odd_even_be32((lr1 << 16) | (uint16_t)lr2); 236 *(*dst)++ = swap_odd_even_be32((lr1 << 16) | (uint16_t)lr2);
237 } /* to_mono */ 237 } /* to_mono */
238 238
diff --git a/apps/codecs/wavpack_enc.c b/apps/codecs/wavpack_enc.c
index c602ca4f55..208cd3bc68 100644
--- a/apps/codecs/wavpack_enc.c
+++ b/apps/codecs/wavpack_enc.c
@@ -126,7 +126,7 @@ static void chunk_to_int32(int32_t *src)
126 { 126 {
127 int32_t t = *(*src)++; 127 int32_t t = *(*src)++;
128 /* endianness irrelevant */ 128 /* endianness irrelevant */
129 *(*dst)++ = ((int16_t)t + (t >> 16)) >> 1; 129 *(*dst)++ = ((int16_t)t + (t >> 16)) / 2;
130 } /* to_int32 */ 130 } /* to_int32 */
131 131
132 do 132 do