ref: 4680e2af3d04974ca41ef30ad7eca33848810114
parent: 19cf5c2010eaf197a474b040fa49dd37a351f4a5
author: Erik de Castro Lopo <erikd@miles>
date: Mon Nov 1 05:12:20 EST 2004
Ensure window values remain in [0, 1] range.
--- a/FIR-POLY/fir_interp.cc
+++ b/FIR-POLY/fir_interp.cc
@@ -237,6 +237,18 @@
return 1 ;
} ;
+ error = 0.0 ;
+ for (k = 0 ; k < interp->total_len ; k++)
+ { temp = fabs (interp->window [k] - 0.5) ;
+ if (temp > 0.5 && temp > error)
+ error = temp ;
+ } ;
+
+ if (error > 0.0)
+ { *returned_error = 1e16 * error ;
+ return 1 ;
+ } ;
+
return 0 ;
} /* calc_window */