[FFmpeg-cvslog] avfilter/af_aiir: fix sp2zp mapping

Paul B Mahol git at videolan.org
Mon Oct 19 19:43:33 EEST 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Oct 19 18:34:50 2020 +0200| [f7379eafd276fd105441367759d4ca45f4c8d363] | committer: Paul B Mahol

avfilter/af_aiir: fix sp2zp mapping

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f7379eafd276fd105441367759d4ca45f4c8d363
---

 libavfilter/af_aiir.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index c5df4b1202..64bd78ad8a 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -877,23 +877,17 @@ static void convert_sp2zp(AVFilterContext *ctx, int channels)
         for (n = 0; n < iir->nb_ab[0]; n++) {
             double sr = iir->ab[0][2*n];
             double si = iir->ab[0][2*n+1];
-            double snr = 1. + sr;
-            double sdr = 1. - sr;
-            double div = sdr * sdr + si * si;
 
-            iir->ab[0][2*n]   = (snr * sdr - si * si) / div;
-            iir->ab[0][2*n+1] = (sdr * si + snr * si) / div;
+            iir->ab[0][2*n]   = exp(sr) * cos(si);
+            iir->ab[0][2*n+1] = exp(sr) * sin(si);
         }
 
         for (n = 0; n < iir->nb_ab[1]; n++) {
             double sr = iir->ab[1][2*n];
             double si = iir->ab[1][2*n+1];
-            double snr = 1. + sr;
-            double sdr = 1. - sr;
-            double div = sdr * sdr + si * si;
 
-            iir->ab[1][2*n]   = (snr * sdr - si * si) / div;
-            iir->ab[1][2*n+1] = (sdr * si + snr * si) / div;
+            iir->ab[1][2*n]   = exp(sr) * cos(si);
+            iir->ab[1][2*n+1] = exp(sr) * sin(si);
         }
     }
 }



More information about the ffmpeg-cvslog mailing list