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_decimate_init_q15.c
00001 /* ---------------------------------------------------------------------- 00002 * Project: CMSIS DSP Library 00003 * Title: arm_fir_decimate_init_q15.c 00004 * Description: Initialization function for the Q15 FIR Decimator 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_decimate 00037 * @{ 00038 */ 00039 00040 /** 00041 * @brief Initialization function for the Q15 FIR decimator. 00042 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. 00043 * @param[in] numTaps number of coefficients in the filter. 00044 * @param[in] M decimation factor. 00045 * @param[in] *pCoeffs points to the filter coefficients. 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 * <code>blockSize</code> is not a multiple of <code>M</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[N-2], ..., b[1], b[0]} 00056 * </pre> 00057 * \par 00058 * <code>pState</code> points to the array of state variables. 00059 * <code>pState</code> is of length <code>numTaps+blockSize-1</code> words where <code>blockSize</code> is the number of input samples 00060 * to the call <code>arm_fir_decimate_q15()</code>. 00061 * <code>M</code> is the decimation factor. 00062 */ 00063 00064 arm_status arm_fir_decimate_init_q15( 00065 arm_fir_decimate_instance_q15 * S, 00066 uint16_t numTaps, 00067 uint8_t M, 00068 q15_t * pCoeffs, 00069 q15_t * pState, 00070 uint32_t blockSize) 00071 { 00072 00073 arm_status status; 00074 00075 /* The size of the input block must be a multiple of the decimation factor */ 00076 if ((blockSize % M) != 0U) 00077 { 00078 /* Set status as ARM_MATH_LENGTH_ERROR */ 00079 status = ARM_MATH_LENGTH_ERROR; 00080 } 00081 else 00082 { 00083 /* Assign filter taps */ 00084 S->numTaps = numTaps; 00085 00086 /* Assign coefficient pointer */ 00087 S->pCoeffs = pCoeffs; 00088 00089 /* Clear the state buffer. The size of buffer is always (blockSize + numTaps - 1) */ 00090 memset(pState, 0, (numTaps + (blockSize - 1U)) * sizeof(q15_t)); 00091 00092 /* Assign state pointer */ 00093 S->pState = pState; 00094 00095 /* Assign Decimation factor */ 00096 S->M = M; 00097 00098 status = ARM_MATH_SUCCESS; 00099 } 00100 00101 return (status); 00102 00103 } 00104 00105 /** 00106 * @} end of FIR_decimate group 00107 */ 00108
Generated on Tue Jul 12 2022 16:47:27 by
1.7.2