00001 /* ---------------------------------------------------------------------------- 00002 * Copyright (C) 2011 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 15. December 2011 00005 * $Revision: V2.0.0 00006 * 00007 * Project: Cortex-R DSP Library 00008 * Title: arm_q15_to_float.c 00009 * 00010 * Description: Converts the elements of the Q15 vector to floating-point vector. 00011 * 00012 * Target Processor: Cortex-R4/R5 00013 * 00014 * Version 1.0.0 2011/03/08 00015 * Alpha release. 00016 * 00017 * Version 1.0.1 2011/09/30 00018 * Beta release. 00019 * 00020 * Version 2.0.0 2011/12/15 00021 * Final release. 00022 * 00023 * ---------------------------------------------------------------------------- */ 00024 #include "arm_math.h" 00025 00064 void arm_q15_to_float( 00065 q15_t * pSrc, 00066 float32_t * pDst, 00067 uint32_t blockSize) 00068 { 00069 q15_t *pIn = pSrc; /* Src pointer */ 00070 uint32_t blkCnt; /* loop counter */ 00071 00072 00073 /*loop Unrolling */ 00074 blkCnt = blockSize >> 3u; 00075 00076 /* First part of the processing with loop unrolling. Compute 8 outputs at a time. 00077 ** a second loop below computes the remaining 1 to 7 samples. */ 00078 while(blkCnt > 0u) 00079 { 00080 /* C = (float32_t) A / 32768 */ 00081 /* convert from q15 to float and then store the results in the destination buffer */ 00082 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00083 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00084 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00085 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00086 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00087 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00088 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00089 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00090 00091 /* Decrement the loop counter */ 00092 blkCnt--; 00093 } 00094 00095 /* If the blockSize is not a multiple of 8, compute any remaining output samples here. 00096 ** No loop unrolling is used. */ 00097 blkCnt = blockSize % 0x8u; 00098 00099 while(blkCnt > 0u) 00100 { 00101 /* C = (float32_t) A / 32768 */ 00102 /* convert from q15 to float and then store the results in the destination buffer */ 00103 *pDst++ = ((float32_t) * pIn++ / 32768.0f); 00104 00105 /* Decrement the loop counter */ 00106 blkCnt--; 00107 } 00108 } 00109