Mercurial > libavcodec.hg
comparison aac.c @ 7661:258eb30e6f7d libavcodec
Separate code in imdct_and_windowing() into distinct IMDCT, windowing and
buffer update sections
author | superdump |
---|---|
date | Fri, 22 Aug 2008 18:18:50 +0000 |
parents | 80b097820403 |
children | dea70eae1e49 |
comparison
equal
deleted
inserted
replaced
7660:6fe7ff34a4db | 7661:258eb30e6f7d |
---|---|
1171 const float * lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024; | 1171 const float * lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024; |
1172 const float * swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; | 1172 const float * swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; |
1173 float * buf = ac->buf_mdct; | 1173 float * buf = ac->buf_mdct; |
1174 int i; | 1174 int i; |
1175 | 1175 |
1176 // imdct | |
1176 if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { | 1177 if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { |
1177 if (ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) | 1178 if (ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) |
1178 av_log(ac->avccontext, AV_LOG_WARNING, | 1179 av_log(ac->avccontext, AV_LOG_WARNING, |
1179 "Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. " | 1180 "Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. " |
1180 "If you heard an audible artifact, please submit the sample to the FFmpeg developers.\n"); | 1181 "If you heard an audible artifact, please submit the sample to the FFmpeg developers.\n"); |
1181 for (i = 0; i < 2048; i += 256) { | 1182 for (i = 0; i < 2048; i += 256) { |
1182 ff_imdct_calc(&ac->mdct_small, buf + i, in + i/2); | 1183 ff_imdct_calc(&ac->mdct_small, buf + i, in + i/2); |
1183 ac->dsp.vector_fmul_reverse(ac->revers + i/2, buf + i + 128, swindow, 128); | 1184 ac->dsp.vector_fmul_reverse(ac->revers + i/2, buf + i + 128, swindow, 128); |
1184 } | 1185 } |
1186 } else | |
1187 ff_imdct_calc(&ac->mdct, buf, in); | |
1188 | |
1189 /* window overlapping | |
1190 * NOTE: To simplify the overlapping code, all 'meaningless' short to long | |
1191 * and long to short transitions are considered to be short to short | |
1192 * transitions. This leaves just two cases (long to long and short to short) | |
1193 * with a little special sauce for EIGHT_SHORT_SEQUENCE. | |
1194 */ | |
1195 if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && | |
1196 (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { | |
1197 ac->dsp.vector_fmul_add_add(out, buf, lwindow_prev, saved, ac->add_bias, 1024, 1); | |
1198 } else { | |
1185 for (i = 0; i < 448; i++) out[i] = saved[i] + ac->add_bias; | 1199 for (i = 0; i < 448; i++) out[i] = saved[i] + ac->add_bias; |
1186 | 1200 |
1201 if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { | |
1187 ac->dsp.vector_fmul_add_add(out + 448 + 0*128, buf + 0*128, swindow_prev, saved + 448 , ac->add_bias, 128, 1); | 1202 ac->dsp.vector_fmul_add_add(out + 448 + 0*128, buf + 0*128, swindow_prev, saved + 448 , ac->add_bias, 128, 1); |
1188 ac->dsp.vector_fmul_add_add(out + 448 + 1*128, buf + 2*128, swindow, ac->revers + 0*128, ac->add_bias, 128, 1); | 1203 ac->dsp.vector_fmul_add_add(out + 448 + 1*128, buf + 2*128, swindow, ac->revers + 0*128, ac->add_bias, 128, 1); |
1189 ac->dsp.vector_fmul_add_add(out + 448 + 2*128, buf + 4*128, swindow, ac->revers + 1*128, ac->add_bias, 128, 1); | 1204 ac->dsp.vector_fmul_add_add(out + 448 + 2*128, buf + 4*128, swindow, ac->revers + 1*128, ac->add_bias, 128, 1); |
1190 ac->dsp.vector_fmul_add_add(out + 448 + 3*128, buf + 6*128, swindow, ac->revers + 2*128, ac->add_bias, 128, 1); | 1205 ac->dsp.vector_fmul_add_add(out + 448 + 3*128, buf + 6*128, swindow, ac->revers + 2*128, ac->add_bias, 128, 1); |
1191 ac->dsp.vector_fmul_add_add(out + 448 + 4*128, buf + 8*128, swindow, ac->revers + 3*128, ac->add_bias, 64, 1); | 1206 ac->dsp.vector_fmul_add_add(out + 448 + 4*128, buf + 8*128, swindow, ac->revers + 3*128, ac->add_bias, 64, 1); |
1192 | 1207 } else { |
1193 #if 0 | 1208 ac->dsp.vector_fmul_add_add(out + 448, buf + 448, swindow_prev, saved + 448, ac->add_bias, 128, 1); |
1194 vector_fmul_add_add_add(&ac->dsp, out + 448 + 1*128, buf + 2*128, swindow, saved + 448 + 1*128, ac->revers + 0*128, ac->add_bias, 128); | 1209 for (i = 576; i < 1024; i++) out[i] = buf[i] + saved[i] + ac->add_bias; |
1195 vector_fmul_add_add_add(&ac->dsp, out + 448 + 2*128, buf + 4*128, swindow, saved + 448 + 2*128, ac->revers + 1*128, ac->add_bias, 128); | 1210 } |
1196 vector_fmul_add_add_add(&ac->dsp, out + 448 + 3*128, buf + 6*128, swindow, saved + 448 + 3*128, ac->revers + 2*128, ac->add_bias, 128); | 1211 } |
1197 vector_fmul_add_add_add(&ac->dsp, out + 448 + 4*128, buf + 8*128, swindow, saved + 448 + 4*128, ac->revers + 3*128, ac->add_bias, 64); | 1212 |
1198 #endif | 1213 // buffer update |
1199 | 1214 if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { |
1200 ac->dsp.vector_fmul_add_add(saved, buf + 1024 + 64, swindow + 64, ac->revers + 3*128+64, 0, 64, 1); | 1215 ac->dsp.vector_fmul_add_add(saved, buf + 1024 + 64, swindow + 64, ac->revers + 3*128+64, 0, 64, 1); |
1201 ac->dsp.vector_fmul_add_add(saved + 64, buf + 1024 + 2*128, swindow, ac->revers + 4*128, 0, 128, 1); | 1216 ac->dsp.vector_fmul_add_add(saved + 64, buf + 1024 + 2*128, swindow, ac->revers + 4*128, 0, 128, 1); |
1202 ac->dsp.vector_fmul_add_add(saved + 192, buf + 1024 + 4*128, swindow, ac->revers + 5*128, 0, 128, 1); | 1217 ac->dsp.vector_fmul_add_add(saved + 192, buf + 1024 + 4*128, swindow, ac->revers + 5*128, 0, 128, 1); |
1203 ac->dsp.vector_fmul_add_add(saved + 320, buf + 1024 + 6*128, swindow, ac->revers + 6*128, 0, 128, 1); | 1218 ac->dsp.vector_fmul_add_add(saved + 320, buf + 1024 + 6*128, swindow, ac->revers + 6*128, 0, 128, 1); |
1204 memcpy( saved + 448, ac->revers + 7*128, 128 * sizeof(float)); | 1219 memcpy( saved + 448, ac->revers + 7*128, 128 * sizeof(float)); |
1205 memset( saved + 576, 0, 448 * sizeof(float)); | 1220 memset( saved + 576, 0, 448 * sizeof(float)); |
1206 } else { | 1221 } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { |
1207 ff_imdct_calc(&ac->mdct, buf, in); | |
1208 if (ics->window_sequence[0] == LONG_STOP_SEQUENCE) { | |
1209 for (i = 0; i < 448; i++) out[i] = saved[i] + ac->add_bias; | |
1210 ac->dsp.vector_fmul_add_add(out + 448, buf + 448, swindow_prev, saved + 448, ac->add_bias, 128, 1); | |
1211 for (i = 576; i < 1024; i++) out[i] = buf[i] + saved[i] + ac->add_bias; | |
1212 } else { | |
1213 ac->dsp.vector_fmul_add_add(out, buf, lwindow_prev, saved, ac->add_bias, 1024, 1); | |
1214 } | |
1215 if (ics->window_sequence[0] == LONG_START_SEQUENCE) { | |
1216 memcpy(saved, buf + 1024, 448 * sizeof(float)); | 1222 memcpy(saved, buf + 1024, 448 * sizeof(float)); |
1217 ac->dsp.vector_fmul_reverse(saved + 448, buf + 1024 + 448, swindow, 128); | 1223 ac->dsp.vector_fmul_reverse(saved + 448, buf + 1024 + 448, swindow, 128); |
1218 memset(saved + 576, 0, 448 * sizeof(float)); | 1224 memset(saved + 576, 0, 448 * sizeof(float)); |
1219 } else { | 1225 } else { // LONG_STOP or ONLY_LONG |
1220 ac->dsp.vector_fmul_reverse(saved, buf + 1024, lwindow, 1024); | 1226 ac->dsp.vector_fmul_reverse(saved, buf + 1024, lwindow, 1024); |
1221 } | |
1222 } | 1227 } |
1223 } | 1228 } |
1224 | 1229 |
1225 /** | 1230 /** |
1226 * Apply dependent channel coupling (applied before IMDCT). | 1231 * Apply dependent channel coupling (applied before IMDCT). |