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

Ville Syrjälä ville.syrjala at linux.intel.com
Tue May 14 12:29:40 UTC 2019


On Tue, May 14, 2019 at 06:32:58AM +0000, Ser, Simon wrote:
> 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)

Whatever works for you.

Either way
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list