summaryrefslogtreecommitdiff
path: root/libavfilter/af_sofalizer.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-12-26 10:17:28 +0100
committerPaul B Mahol <onemda@gmail.com>2018-12-26 10:18:19 +0100
commit92ed9316bba13cb1b2cccb0db0389c1b92dd1032 (patch)
treef7dafb50ece364748245e8349f8fb983cbce69f1 /libavfilter/af_sofalizer.c
parent60e9007be2e9851a6c8948f1ab7fbe85f590d34f (diff)
downloadffmpeg-92ed9316bba13cb1b2cccb0db0389c1b92dd1032.tar.gz
avfilter/af_sofalizer: fix regression after 7ea4b928a264
Diffstat (limited to 'libavfilter/af_sofalizer.c')
-rw-r--r--libavfilter/af_sofalizer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index f9325ff312..bf721f22a0 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -395,12 +395,12 @@ static int sofalizer_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
/* current read position in ringbuffer: input sample write position
* - delay for l-th ch. + diff. betw. IR length and buffer length
* (mod buffer length) */
- read = (wr - delay[l] - (n_samples - 1) + buffer_length) & modulo;
+ read = (wr - delay[l] - (ir_samples - 1) + buffer_length) & modulo;
- if (read + n_samples < buffer_length) {
- memmove(temp_src, bptr + read, n_samples * sizeof(*temp_src));
+ if (read + ir_samples < buffer_length) {
+ memmove(temp_src, bptr + read, ir_samples * sizeof(*temp_src));
} else {
- int len = FFMIN(n_samples - (read % n_samples), buffer_length - read);
+ int len = FFMIN(n_samples - (read % ir_samples), buffer_length - read);
memmove(temp_src, bptr + read, len * sizeof(*temp_src));
memmove(temp_src + len, bptr, (n_samples - len) * sizeof(*temp_src));
@@ -436,7 +436,7 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
FFTComplex *hrtf = s->data_hrtf[jobnr]; /* get pointers to current HRTF data */
int *n_clippings = &td->n_clippings[jobnr];
float *ringbuffer = td->ringbuffer[jobnr];
- const int n_samples = s->sofa.n_samples; /* length of one IR */
+ const int ir_samples = s->sofa.ir_samples; /* length of one IR */
const int planar = in->format == AV_SAMPLE_FMT_FLTP;
const int mult = 1 + !planar;
float *dst = (float *)out->extended_data[jobnr * planar]; /* get pointer to audio output buffer */
@@ -462,7 +462,7 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
/* find minimum between number of samples and output buffer length:
* (important, if one IR is longer than the output buffer) */
- n_read = FFMIN(s->sofa.n_samples, in->nb_samples);
+ n_read = FFMIN(ir_samples, in->nb_samples);
for (j = 0; j < n_read; j++) {
/* initialize output buf with saved signal from overflow buf */
dst[mult * j] = ringbuffer[wr];
@@ -543,7 +543,7 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
dst[mult * j] += fft_acc[j].re * fft_scale;
}
- for (j = 0; j < n_samples - 1; j++) { /* overflow length is IR length - 1 */
+ for (j = 0; j < ir_samples - 1; j++) { /* overflow length is IR length - 1 */
/* write the rest of output signal to overflow buffer */
int write_pos = (wr + j) & modulo;