From f90f8f8ada73f8bbfc7cb70a3795cdcfad0c3240 Mon Sep 17 00:00:00 2001 From: Andy Hung Date: Thu, 7 May 2015 17:48:38 -0700 Subject: Remove unused data conversion functions from usb hal Change-Id: I4ccf8441171ad796e8954b1960f76411ebb86e9d --- modules/usbaudio/audio_hal.c | 68 -------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'modules') diff --git a/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c index 84cc643..5431476 100644 --- a/modules/usbaudio/audio_hal.c +++ b/modules/usbaudio/audio_hal.c @@ -124,74 +124,6 @@ struct stream_in { }; /* - * Data Conversions - */ -/* - * Convert a buffer of packed (3-byte) PCM24LE samples to PCM16LE samples. - * in_buff points to the buffer of PCM24LE samples - * num_in_samples size of input buffer in SAMPLES - * out_buff points to the buffer to receive converted PCM16LE LE samples. - * returns - * the number of BYTES of output data. - * We are doing this since we *always* present to The Framework as A PCM16LE device, but need to - * support PCM24_3LE (24-bit, packed). - * NOTE: - * This conversion is safe to do in-place (in_buff == out_buff). - * TODO Move this to a utilities module. - */ -static size_t convert_24_3_to_16(const unsigned char * in_buff, size_t num_in_samples, - short * out_buff) -{ - /* - * Move from front to back so that the conversion can be done in-place - * i.e. in_buff == out_buff - */ - /* we need 2 bytes in the output for every 3 bytes in the input */ - unsigned char* dst_ptr = (unsigned char*)out_buff; - const unsigned char* src_ptr = in_buff; - size_t src_smpl_index; - for (src_smpl_index = 0; src_smpl_index < num_in_samples; src_smpl_index++) { - src_ptr++; /* lowest-(skip)-byte */ - *dst_ptr++ = *src_ptr++; /* low-byte */ - *dst_ptr++ = *src_ptr++; /* high-byte */ - } - - /* return number of *bytes* generated: */ - return num_in_samples * 2; -} - -/* - * Convert a buffer of packed (3-byte) PCM32 samples to PCM16LE samples. - * in_buff points to the buffer of PCM32 samples - * num_in_samples size of input buffer in SAMPLES - * out_buff points to the buffer to receive converted PCM16LE LE samples. - * returns - * the number of BYTES of output data. - * We are doing this since we *always* present to The Framework as A PCM16LE device, but need to - * support PCM_FORMAT_S32_LE (32-bit). - * NOTE: - * This conversion is safe to do in-place (in_buff == out_buff). - * TODO Move this to a utilities module. - */ -static size_t convert_32_to_16(const int32_t * in_buff, size_t num_in_samples, short * out_buff) -{ - /* - * Move from front to back so that the conversion can be done in-place - * i.e. in_buff == out_buff - */ - - short * dst_ptr = out_buff; - const int32_t* src_ptr = in_buff; - size_t src_smpl_index; - for (src_smpl_index = 0; src_smpl_index < num_in_samples; src_smpl_index++) { - *dst_ptr++ = *src_ptr++ >> 16; - } - - /* return number of *bytes* generated: */ - return num_in_samples * 2; -} - -/* * Extract the card and device numbers from the supplied key/value pairs. * kvpairs A null-terminated string containing the key/value pairs or card and device. * i.e. "card=1;device=42" -- cgit v1.1