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_q31_to_float.c 00009 * 00010 * Description: Converts the elements of the Q31 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 00057 void arm_q31_to_float( 00058 q31_t * pSrc, 00059 float32_t * pDst, 00060 uint32_t blockSize) 00061 { 00062 q31_t *pIn = pSrc; /* Src pointer */ 00063 uint32_t blkCnt; /* loop counter */ 00064 00065 00066 /*loop Unrolling */ 00067 blkCnt = blockSize >> 3u; 00068 00069 /* First part of the processing with loop unrolling. Compute 8 outputs at a time. 00070 ** a second loop below computes the remaining 1 to 7 samples. */ 00071 while(blkCnt > 0u) 00072 { 00073 /* C = (float32_t) A / 2147483648 */ 00074 /* convert from q31 to float and then store the results in the destination buffer */ 00075 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00076 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00077 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00078 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00079 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00080 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00081 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00082 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00083 00084 /* Decrement the loop counter */ 00085 blkCnt--; 00086 } 00087 00088 /* If the blockSize is not a multiple of 8, compute any remaining output samples here. 00089 ** No loop unrolling is used. */ 00090 blkCnt = blockSize % 0x8u; 00091 00092 while(blkCnt > 0u) 00093 { 00094 /* C = (float32_t) A / 2147483648 */ 00095 /* convert from q31 to float and then store the results in the destination buffer */ 00096 *pDst++ = ((float32_t) * pIn++ / 2147483648.0f); 00097 00098 /* Decrement the loop counter */ 00099 blkCnt--; 00100 } 00101 } 00102