[gst-devel] General question for converting audio/x-raw-int from/to audio/x-raw-float
ds at schleef.org
Wed May 2 21:12:45 CEST 2007
On Wed, May 02, 2007 at 11:46:40AM +0200, Sebastian Dröge wrote:
> I have a general question for converting audio/x-raw-int from or to
> Let's assume a width/depth of 32 for audio/x-raw-int in this mail.
> When converting from integer to float the goal is to get everything in
> the range [-1.0,1.0] but two's complement integers have an asymmetric
> range of values, going for -2^31 to 2^31 - 1.
The scale factor is 1<<31, because it's the only thing that is
consistent among various conversions.
For example, if you convert from float to int32, and then from
int32 to int16, you would expect to get the same result as if you
went directly from float to int16. And converting from int32 to
int16 only makes sense as a rounded shift.
More information about the gstreamer-devel