summaryrefslogtreecommitdiff
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)
2090 /* |llllllllllllllll|rrrrrrrrrrrrrrrr| => 2090 /* |llllllllllllllll|rrrrrrrrrrrrrrrr| =>
2091 * |mmmmmmmmmmmmmmmm|mmmmmmmmmmmmmmmm| 2091 * |mmmmmmmmmmmmmmmm|mmmmmmmmmmmmmmmm|
2092 */ 2092 */
2093 uint32_t *samp = (uint32_t *)&mfbuf[2*512]; 2093 uint16_t *samp = &mfbuf[2*512];
2094 uint32_t *samp_end = samp + samp_per_frame; 2094 uint16_t *samp_end = samp + 2*samp_per_frame;
2095 2095
2096 inline void to_mono(uint32_t **samp) 2096 inline void to_mono(uint16_t **samp)
2097 { 2097 {
2098 int32_t lr = **samp; 2098 int16_t l = **samp;
2099 int16_t r = **(samp+1);
2099 int32_t m; 2100 int32_t m;
2100 2101
2101 switch(cfg.rec_mono_mode) 2102 switch(cfg.rec_mono_mode)
2102 { 2103 {
2103 case 1: 2104 case 1:
2104 /* mono = L */ 2105 /* mono = L */
2105 m = lr >> 16; 2106 m = l;
2106 break; 2107 break;
2107 case 2: 2108 case 2:
2108 /* mono = R */ 2109 /* mono = R */
2109 m = (int16_t)lr; 2110 m = r;
2110 break; 2111 break;
2111 case 0: 2112 case 0:
2112 default: 2113 default:
2113 /* mono = (L+R)/2 */ 2114 /* mono = (L+R)/2 */
2114 m = (int16_t)lr + (lr >> 16) + err; 2115 m = r + r + err;
2115 err = m & 1; 2116 err = m & 1;
2116 m >>= 1; 2117 m >>= 1;
2117 break; 2118 break;
2118 } 2119 }
2119 *(*samp)++ = (m << 16) | (uint16_t)m; 2120 *(*samp)++ = (uint16_t)m;
2121 *(*samp)++ = (uint16_t)m;
2120 } /* to_mono */ 2122 } /* to_mono */
2121 2123
2122 do 2124 do