avfilter/af_sofalizer: set delays when interpolation is disabled
authorPaul B Mahol <onemda@gmail.com>
Sun, 23 Dec 2018 20:40:07 +0000 (21:40 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 23 Dec 2018 20:40:07 +0000 (21:40 +0100)
libavfilter/af_sofalizer.c

index 7812e25..c30f99c 100644 (file)
@@ -627,6 +627,13 @@ static int getfilter_float(AVFilterContext *ctx, float x, float y, float z,
                                  nearest, neighbors,
                                  s->sofa.fir, delays);
     } else {
+        if (s->sofa.hrtf->DataDelay.elements > s->sofa.hrtf->R) {
+            delays[0] = s->sofa.hrtf->DataDelay.values[nearest * s->sofa.hrtf->R];
+            delays[1] = s->sofa.hrtf->DataDelay.values[nearest * s->sofa.hrtf->R + 1];
+        } else {
+            delays[0] = s->sofa.hrtf->DataDelay.values[0];
+            delays[1] = s->sofa.hrtf->DataDelay.values[1];
+        }
         res = s->sofa.hrtf->DataIR.values + nearest * s->sofa.hrtf->N * s->sofa.hrtf->R;
     }