Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
arm_fir_interpolate_init_q15.c
00001 /* ---------------------------------------------------------------------- 00002 * Project: CMSIS DSP Library 00003 * Title: arm_fir_interpolate_init_q15.c 00004 * Description: Q15 FIR interpolator initialization function 00005 * 00006 * $Date: 27. January 2017 00007 * $Revision: V.1.5.1 00008 * 00009 * Target Processor: Cortex-M cores 00010 * -------------------------------------------------------------------- */ 00011 /* 00012 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 00013 * 00014 * SPDX-License-Identifier: Apache-2.0 00015 * 00016 * Licensed under the Apache License, Version 2.0 (the License); you may 00017 * not use this file except in compliance with the License. 00018 * You may obtain a copy of the License at 00019 * 00020 * www.apache.org/licenses/LICENSE-2.0 00021 * 00022 * Unless required by applicable law or agreed to in writing, software 00023 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00024 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 */ 00028 00029 #include "arm_math.h" 00030 00031 /** 00032 * @ingroup groupFilters 00033 */ 00034 00035 /** 00036 * @addtogroup FIR_Interpolate 00037 * @{ 00038 */ 00039 00040 /** 00041 * @brief Initialization function for the Q15 FIR interpolator. 00042 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. 00043 * @param[in] L upsample factor. 00044 * @param[in] numTaps number of filter coefficients in the filter. 00045 * @param[in] *pCoeffs points to the filter coefficient buffer. 00046 * @param[in] *pState points to the state buffer. 00047 * @param[in] blockSize number of input samples to process per call. 00048 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_LENGTH_ERROR if 00049 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. 00050 * 00051 * <b>Description:</b> 00052 * \par 00053 * <code>pCoeffs</code> points to the array of filter coefficients stored in time reversed order: 00054 * <pre> 00055 * {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]} 00056 * </pre> 00057 * The length of the filter <code>numTaps</code> must be a multiple of the interpolation factor <code>L</code>. 00058 * \par 00059 * <code>pState</code> points to the array of state variables. 00060 * <code>pState</code> is of length <code>(numTaps/L)+blockSize-1</code> words 00061 * where <code>blockSize</code> is the number of input samples processed by each call to <code>arm_fir_interpolate_q15()</code>. 00062 */ 00063 00064 arm_status arm_fir_interpolate_init_q15( 00065 arm_fir_interpolate_instance_q15 * S, 00066 uint8_t L, 00067 uint16_t numTaps, 00068 q15_t * pCoeffs, 00069 q15_t * pState, 00070 uint32_t blockSize) 00071 { 00072 arm_status status; 00073 00074 /* The filter length must be a multiple of the interpolation factor */ 00075 if ((numTaps % L) != 0U) 00076 { 00077 /* Set status as ARM_MATH_LENGTH_ERROR */ 00078 status = ARM_MATH_LENGTH_ERROR; 00079 } 00080 else 00081 { 00082 00083 /* Assign coefficient pointer */ 00084 S->pCoeffs = pCoeffs; 00085 00086 /* Assign Interpolation factor */ 00087 S->L = L; 00088 00089 /* Assign polyPhaseLength */ 00090 S->phaseLength = numTaps / L; 00091 00092 /* Clear state buffer and size of buffer is always phaseLength + blockSize - 1 */ 00093 memset(pState, 0, 00094 (blockSize + ((uint32_t) S->phaseLength - 1U)) * sizeof(q15_t)); 00095 00096 /* Assign state pointer */ 00097 S->pState = pState; 00098 00099 status = ARM_MATH_SUCCESS; 00100 } 00101 00102 return (status); 00103 00104 } 00105 00106 /** 00107 * @} end of FIR_Interpolate group 00108 */ 00109
Generated on Tue Jul 12 2022 16:47:27 by
 1.7.2
 1.7.2