Add floating point to unsigned 8 bit conversion
Change-Id: Icc4591ab8f594f9c203644812208b227442d1f05
diff --git a/audio_utils/format.c b/audio_utils/format.c
index e91e057..4ac862a 100644
--- a/audio_utils/format.c
+++ b/audio_utils/format.c
@@ -29,6 +29,7 @@
switch (dst_format) {
case AUDIO_FORMAT_PCM_16_BIT:
case AUDIO_FORMAT_PCM_FLOAT:
+ case AUDIO_FORMAT_PCM_8_BIT:
case AUDIO_FORMAT_PCM_24_BIT_PACKED:
case AUDIO_FORMAT_PCM_32_BIT:
case AUDIO_FORMAT_PCM_8_24_BIT:
@@ -44,6 +45,9 @@
case AUDIO_FORMAT_PCM_FLOAT:
memcpy_to_i16_from_float((int16_t*)dst, (float*)src, count);
return;
+ case AUDIO_FORMAT_PCM_8_BIT:
+ memcpy_to_i16_from_u8((int16_t*)dst, (uint8_t*)src, count);
+ return;
case AUDIO_FORMAT_PCM_24_BIT_PACKED:
memcpy_to_i16_from_p24((int16_t*)dst, (uint8_t*)src, count);
return;
@@ -62,6 +66,9 @@
case AUDIO_FORMAT_PCM_16_BIT:
memcpy_to_float_from_i16((float*)dst, (int16_t*)src, count);
return;
+ case AUDIO_FORMAT_PCM_8_BIT:
+ memcpy_to_float_from_u8((float*)dst, (uint8_t*)src, count);
+ return;
case AUDIO_FORMAT_PCM_24_BIT_PACKED:
memcpy_to_float_from_p24((float*)dst, (uint8_t*)src, count);
return;
@@ -75,6 +82,18 @@
break;
}
break;
+ case AUDIO_FORMAT_PCM_8_BIT:
+ switch (src_format) {
+ case AUDIO_FORMAT_PCM_16_BIT:
+ memcpy_to_u8_from_i16((uint8_t*)dst, (int16_t*)src, count);
+ return;
+ case AUDIO_FORMAT_PCM_FLOAT:
+ memcpy_to_u8_from_float((uint8_t*)dst, (float*)src, count);
+ return;
+ default:
+ break;
+ }
+ break;
case AUDIO_FORMAT_PCM_24_BIT_PACKED:
switch (src_format) {
case AUDIO_FORMAT_PCM_16_BIT: