[Speex-dev] normalize16()

Jerry Trantow jtrantow at ieee.org
Fri Feb 3 14:11:37 PST 2006


I have a question on the normalize16() implementation.  The DSP I am using
implements a norm() instruction that returns the number of bits up to the
first nonredundant sign bit.  

Values in the range [-2^m, 2^m -1) return 30-m as the norm.  

I am using this in an override of the normalize16() implementation.  I'm
running some test vectors and comparing my routine to the speex
implementation.  I think the default method is using the wrong shift for the
positive power of 2 boundary case.

This implements the following shifts
Value		shift	expected
+16383	0	0
-16384	0	0
+16384	0	1	Seems like a mistake.  
+16385	1	1	Notice this requires a shift, but previous didn't.
-16385	1	1	

I think the while (max_val>max_scale) comparison should be changed to >= and
the NEG32(tmp) changed to NEG32(tmp+1).  This would shift values according
to the number of bits for the entire [-2^m,+2^m -1) range.




Jerry J. Trantow
Applied Signal Processing, Inc.
jtrantow at ieee.org





More information about the Speex-dev mailing list