Re: [igt-dev] [PATCH i-g-t] lib/igt_audio: normalize samples when extracting channel

Ser, Simon
2019-05-14T06:33:01Z

On Mon, 2019-05-13 at 19:25 +0300, Ville Syrjälä wrote:
> > - dst[i] = (double) src[i * n_channels + channel];
> > + dst[i] = (double) src[i * n_channels + channel] / INT32_MAX;
>
> Do we care that the most negative value could result
> in a normalized value < -1.0?

Ah, good point.

I'd be tempted not to care. These values are just used to compare the
amplitude of the signal we send to the amplitude of the signal we
receive.

However I agree this could be unexpected, especially if someone uses
these values for another goal. If we wanted to fix it, would
-(double)INT32_MIN be enough? (double can represent exact integers up
to 2^53 - 1)