10359 Stereo: Rounding & Scaling
1. [In Progress] “Verification of everything”.
The results of running 1 frame through the cross-correlation block are more or less ok now:
- took coefficients’ product bits [31:16] (that is 16 bit rounding)
Sample 1:
Fig.1 Source – test frame.
Fig. 2 Result (there are some errors on the top of the result image near the areas of color change).
Sample 2:
Fig. 3 The picture from the sensor w/o a lense (a bit dirty – dust on scotch).
Fig. 4 Result, again there are some errors – overflows are possible.
TODO:
1. Adjust the more suitable rounding for fft-coeffs multiplication – perform rounding after multiplication + perform rounding in IFFT?
Current Bits Calculation: 12bits -> FFT(8 stages with rounding) -> 12bits -> MULT(16 bits rounding) -> 8bits -> IFFT(no rounding) -> 16bits.
Try: 12 -> FFT (8 cut) -> 12 -> MULT (8 cut)-> 16 -> IFFT(8 cut) -> 16 – and there should be no errors.
2. Test frames from different channels.
Oleg, why do you have just 12 bits? Multipliers are 18 bits, memory – also 18-bit wide (using “parity”).
Do you use saturation when accumulating (adding/subtracting)?
When I was implementing FFT on DSP I used group scaling after each pass – calculated the maximal value and optionally scaled by 2 on the next pass (keeping track of this scaling). On average (total “energy”) the values grow sqrt(2) on each pass if I remember that right.
So I would recommend to try to increase precision while fighting overflows at the same time:
– saturate values when accumulating;
– watch fro maximal absolute value on each pass;
– downscale (shift right by 1 bit) after passes with maximal value above threshold. Scaling can be done while reading data during the next pass.
Andrey