summaryrefslogtreecommitdiff
path: root/apps/codecs/mp3_enc.c
diff options
context:
space:
mode:
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