summaryrefslogtreecommitdiffstats
path: root/apps/codecs/mp3_enc.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-11-29 18:11:49 +0000
committerNils Wallménius <nils@rockbox.org>2009-11-29 18:11:49 +0000
commit13f08d70fd5ba237ae53aad1de8bb3d613010246 (patch)
treeab159172b0c4a8cf13f07f16e28008da4d732dfc /apps/codecs/mp3_enc.c
parent685ca2672e5842fe185c8f12da6bf108fd8f074f (diff)
downloadrockbox-13f08d70fd5ba237ae53aad1de8bb3d613010246.tar.gz
rockbox-13f08d70fd5ba237ae53aad1de8bb3d613010246.zip
Enable strict aliasing optimizations for codecs on gcc versions >= 4.0, fix alising violations that this uncovered, gives small speedups for most codecs, FS#10801
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23784 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mp3_enc.c')
-rw-r--r--apps/codecs/mp3_enc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c
index 82a8620027..18774ef456 100644
--- a/apps/codecs/mp3_enc.c
+++ b/apps/codecs/mp3_enc.c
@@ -2090,33 +2090,35 @@ STATICIRAM void to_mono_mm(void)
/* |llllllllllllllll|rrrrrrrrrrrrrrrr| =>
* |mmmmmmmmmmmmmmmm|mmmmmmmmmmmmmmmm|
*/
- uint32_t *samp = (uint32_t *)&mfbuf[2*512];
- uint32_t *samp_end = samp + samp_per_frame;
+ uint16_t *samp = &mfbuf[2*512];
+ uint16_t *samp_end = samp + 2*samp_per_frame;
- inline void to_mono(uint32_t **samp)
+ inline void to_mono(uint16_t **samp)
{
- int32_t lr = **samp;
+ int16_t l = **samp;
+ int16_t r = **(samp+1);
int32_t m;
switch(cfg.rec_mono_mode)
{
case 1:
/* mono = L */
- m = lr >> 16;
+ m = l;
break;
case 2:
/* mono = R */
- m = (int16_t)lr;
+ m = r;
break;
case 0:
default:
/* mono = (L+R)/2 */
- m = (int16_t)lr + (lr >> 16) + err;
+ m = r + r + err;
err = m & 1;
m >>= 1;
break;
}
- *(*samp)++ = (m << 16) | (uint16_t)m;
+ *(*samp)++ = (uint16_t)m;
+ *(*samp)++ = (uint16_t)m;
} /* to_mono */
do