[FFmpeg-devel] [PATCH 1/3] avcodec/lpc: Avoid smearing NaNs in compute_ref_coefs()

Michael Niedermayer michael at niedermayer.cc
Mon May 16 14:24:25 CEST 2016


Testcase is fate

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/lpc.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
index edb1a6b..2c32409 100644
--- a/libavcodec/lpc.h
+++ b/libavcodec/lpc.h
@@ -149,7 +149,11 @@ static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order,
             gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
             gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
         }
-        ref[i] = -gen1[0] / err;
+
+        if (gen1[0] == 0 && err == 0)
+            ref[i] = 0;
+        else
+            ref[i] = -gen1[0] / err;
         err   +=  gen1[0] * ref[i];
         if (error)
             error[i] = err;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list