Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -1213,15 +1213,17 @@ static int fft_channel(AVFilterContext *ctx, AVFrame *in, int ch) · 1212 unmodified lines | |||
| 1213 | AudioSurroundContext *s = ctx->priv; | 1213 | AudioSurroundContext *s = ctx->priv; |
| 1214 | float *src = (float *)s->input_in->extended_data[ch]; | 1214 | float *src = (float *)s->input_in->extended_data[ch]; |
| 1215 | float *win = (float *)s->window->extended_data[ch]; | 1215 | float *win = (float *)s->window->extended_data[ch]; |
| 1216 | const float *window_func_lut = s->window_func_lut; | ||
| 1216 | const int offset = s->win_size - s->hop_size; | 1217 | const int offset = s->win_size - s->hop_size; |
| 1217 | const float level_in = s->input_levels[ch]; | 1218 | const float level_in = s->input_levels[ch]; |
| 1219 | const int win_size = s->win_size; | ||
| 1218 | 1220 | ||
| 1219 | memmove(src, &src[s->hop_size], offset * sizeof(float)); | 1221 | memmove(src, &src[s->hop_size], offset * sizeof(float)); |
| 1220 | memcpy(&src[offset], in->extended_data[ch], in->nb_samples * sizeof(float)); | 1222 | memcpy(&src[offset], in->extended_data[ch], in->nb_samples * sizeof(float)); |
| 1221 | memset(&src[offset + in->nb_samples], 0, (s->hop_size - in->nb_samples) * sizeof(float)); | 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++) | 1225 | for (int n = 0; n < win_size; n++) |
| 1224 | win[n] = src[n] * s->window_func_lut[n] * level_in; | 1226 | win[n] = src[n] * window_func_lut[n] * level_in; |
| 1225 | 1227 | ||
| 1226 | s->tx_fn(s->rdft[ch], (float *)s->input->extended_data[ch], win, sizeof(float)); | 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 | AudioSurroundContext *s = ctx->priv; | 1247 | AudioSurroundContext *s = ctx->priv; |
| 1246 | const float level_out = s->output_levels[ch] * s->win_gain; | 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 | float *dst, *ptr; | 1251 | float *dst, *ptr; |
| 1248 | 1252 | ||
| 1249 | dst = (float *)s->output_out->extended_data[ch]; | 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 | memset(s->overlap_buffer->extended_data[ch] + s->win_size * sizeof(float), | 1260 | memset(s->overlap_buffer->extended_data[ch] + s->win_size * sizeof(float), |
| 1257 | 0, s->hop_size * sizeof(float)); | 1261 | 0, s->hop_size * sizeof(float)); |
| 1258 | 1262 | ||
| 1259 | for (int n = 0; n < s->win_size; n++) | 1263 | for (int n = 0; n < win_size; n++) |
| 1260 | ptr[n] += dst[n] * s->window_func_lut[n] * level_out; | 1264 | ptr[n] += dst[n] * window_func_lut[n] * level_out; |
| 1261 | 1265 | ||
| 1262 | ptr = (float *)s->overlap_buffer->extended_data[ch]; | 1266 | ptr = (float *)s->overlap_buffer->extended_data[ch]; |
| 1263 | dst = (float *)out->extended_data[ch]; | 1267 | dst = (float *)out->extended_data[ch]; |