diff options
| author | Nils Wallménius <nils@rockbox.org> | 2009-11-29 18:11:49 +0000 |
|---|---|---|
| committer | Nils Wallménius <nils@rockbox.org> | 2009-11-29 18:11:49 +0000 |
| commit | 13f08d70fd5ba237ae53aad1de8bb3d613010246 (patch) | |
| tree | ab159172b0c4a8cf13f07f16e28008da4d732dfc /apps/codecs/mp3_enc.c | |
| parent | 685ca2672e5842fe185c8f12da6bf108fd8f074f (diff) | |
| download | rockbox-13f08d70fd5ba237ae53aad1de8bb3d613010246.zip rockbox-13f08d70fd5ba237ae53aad1de8bb3d613010246.tar.gz rockbox-13f08d70fd5ba237ae53aad1de8bb3d613010246.tar.bz2 rockbox-13f08d70fd5ba237ae53aad1de8bb3d613010246.tar.xz | |
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.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c index 82a8620..18774ef 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 |