SWB TBE: Fix constant in create_random_vector() to allow more reliable fixed point port.
The constant "0.0078f" should read 0.0078125f, which is 1/128.
void create_random_vector(
float output[], /* o : output random vector */
const int16_t length, /* i : length of random vector */
int16_t seed[] /* i/o: start seed */
)
{
int16_t i, j, k;
float scale1, scale2;
j = (int16_t) ( own_random( &seed[0] ) * 0.0078f );
j = abs( j ) & 0xff;
should be refactored to
j = (int16_t) ( own_random( &seed[0] ) * 0.0078125f );
j = min(abs(j), 255);
This allows a more reliable and bit exact output for the fixed point port, simply a division by 128 or right shift by 7
Edited by Markus Werner