Unified · Split
| @@ -1213,15 +1213,17 @@ static int fft_channel(AVFilterContext *ctx, AVFrame *in, int ch) · 1212 unmodified lines | ||
| 1213 | 1213 | AudioSurroundContext *s = ctx->priv; |
| 1214 | 1214 | float *src = (float *)s->input_in->extended_data[ch]; |
| 1215 | 1215 | float *win = (float *)s->window->extended_data[ch]; |
| 1216 | + const float *window_func_lut = s->window_func_lut; | |
| 1216 | 1217 | const int offset = s->win_size - s->hop_size; |
| 1217 | 1218 | const float level_in = s->input_levels[ch]; |
| 1219 | + const int win_size = s->win_size; | |
| 1218 | 1220 | |
| 1219 | 1221 | memmove(src, &src[s->hop_size], offset * sizeof(float)); |
| 1220 | 1222 | memcpy(&src[offset], in->extended_data[ch], in->nb_samples * sizeof(float)); |
| 1221 | 1223 | memset(&src[offset + in->nb_samples], 0, (s->hop_size - in->nb_samples) * sizeof(float)); |
| 1222 | 1224 | |
| 1223 | − for (int n = 0; n < s->win_size; n++) | |
| 1224 | − win[n] = src[n] * s->window_func_lut[n] * level_in; | |
| 1225 | + for (int n = 0; n < win_size; n++) | |
| 1226 | + win[n] = src[n] * window_func_lut[n] * level_in; | |
| 1225 | 1227 | |
| 1226 | 1228 | s->tx_fn(s->rdft[ch], (float *)s->input->extended_data[ch], win, sizeof(float)); |
| 1227 | 1229 | |
| @@ -1244,6 +1246,8 @@ static int ifft_channel(AVFilterContext *ctx, AVFrame *out, int ch) · 16 unmodified lines | ||
| 1244 | 1246 | { |
| 1245 | 1247 | AudioSurroundContext *s = ctx->priv; |
| 1246 | 1248 | const float level_out = s->output_levels[ch] * s->win_gain; |
| 1249 | + const float *window_func_lut = s->window_func_lut; | |
| 1250 | + const int win_size = s->win_size; | |
| 1247 | 1251 | float *dst, *ptr; |
| 1248 | 1252 | |
| 1249 | 1253 | dst = (float *)s->output_out->extended_data[ch]; |
| @@ -1256,8 +1260,8 @@ static int ifft_channel(AVFilterContext *ctx, AVFrame *out, int ch) · 6 unmodified lines | ||
| 1256 | 1260 | memset(s->overlap_buffer->extended_data[ch] + s->win_size * sizeof(float), |
| 1257 | 1261 | 0, s->hop_size * sizeof(float)); |
| 1258 | 1262 | |
| 1259 | − for (int n = 0; n < s->win_size; n++) | |
| 1260 | − ptr[n] += dst[n] * s->window_func_lut[n] * level_out; | |
| 1263 | + for (int n = 0; n < win_size; n++) | |
| 1264 | + ptr[n] += dst[n] * window_func_lut[n] * level_out; | |
| 1261 | 1265 | |
| 1262 | 1266 | ptr = (float *)s->overlap_buffer->extended_data[ch]; |
| 1263 | 1267 | dst = (float *)out->extended_data[ch]; |