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