OSDN Git Service

Fix float to i16 conversion in primitives.c
authorAndy Hung <hunga@google.com>
Tue, 25 Feb 2014 02:36:35 +0000 (18:36 -0800)
committerAndy Hung <hunga@google.com>
Thu, 27 Feb 2014 01:48:54 +0000 (17:48 -0800)
commitdb29e694d15e4993ccbacd897bec3b531c3989a9
treefac42fb5a562c6e7409cb076d0e3237018684eb1
parent68d41418bd3e7df36b6b5c35fbc07dc1fedbe883
Fix float to i16 conversion in primitives.c

Updated memcpy_to_i16_from_float():
Made bit-accurate invertible with power of 2 scaling.
Also removed discontinuity around 0 (round versus truncate).

Added clamp16FromFloat() to clamp float audio range of
[-1.0, 1.0) to int16_t.

Change-Id: I45b23f32ae46a4d7f86c8e5482ee43538298ce89
Signed-off-by: Andy Hung <hunga@google.com>
audio_utils/include/audio_utils/primitives.h
audio_utils/primitives.c