• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------
2  * Project:      CMSIS DSP Library
3  * Title:        arm_absmin_no_idx_f64.c
4  * Description:  Minimum value of absolute values of a floating-point vector
5  *
6  * $Date:        10 August 2022
7  * $Revision:    V1.10.1
8  *
9  * Target Processor: Cortex-M and Cortex-A cores
10  * -------------------------------------------------------------------- */
11 /*
12  * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
13  *
14  * SPDX-License-Identifier: Apache-2.0
15  *
16  * Licensed under the Apache License, Version 2.0 (the License); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #include "dsp/statistics_functions.h"
30 
31 /**
32   @ingroup groupStats
33  */
34 
35 /**
36   @addtogroup AbsMin
37   @{
38  */
39 
40 /**
41   @brief         Minimum value of absolute values of a floating-point vector.
42   @param[in]     pSrc       points to the input vector
43   @param[in]     blockSize  number of samples in input vector
44   @param[out]    pResult    minimum value returned here
45   @return        none
46  */
47 
48 #if defined(ARM_MATH_NEON) && defined(__aarch64__)
arm_absmin_no_idx_f64(const float64_t * pSrc,uint32_t blockSize,float64_t * pResult)49 void arm_absmin_no_idx_f64(
50     const float64_t * pSrc,
51     uint32_t blockSize,
52     float64_t * pResult)
53 {
54     float64_t minVal , in;                         /* Temporary variables to store the output value. */
55     uint32_t blkCnt;                     /* Loop counter */
56 
57     float64x2_t minV;
58     float64x2_t pSrcV ;
59     pSrcV = vld1q_f64(pSrc);
60     pSrc += 2 ;
61     minV = vabsq_f64(pSrcV);
62 
63 
64 
65 
66     /* Load first input value that act as reference value for comparision */
67 
68 
69     /* Initialize blkCnt with number of samples */
70     blkCnt = (blockSize - 2U) >> 1U;
71 
72     while (blkCnt > 0U)
73     {
74         /* Initialize maxVal to the next consecutive values one by one */
75         pSrcV = vld1q_f64(pSrc);
76         minV = vminq_f64(minV, vabsq_f64(pSrcV));
77 
78         pSrc += 2 ;
79 
80         /* Decrement loop counter */
81         blkCnt--;
82     }
83     minVal =vgetq_lane_f64(minV, 0);
84     if(minVal > vgetq_lane_f64(minV, 1))
85     {
86         minVal = vgetq_lane_f64(minV, 1);
87     }
88     blkCnt = (blockSize - 2U) & 1;
89 
90     while (blkCnt > 0U)
91     {
92         /* Initialize maxVal to the next consecutive values one by one */
93         in = fabs(*pSrc++);
94 
95         /* compare for the maximum value */
96         if (minVal > in)
97         {
98             /* Update the maximum value and it's index */
99             minVal = in;
100         }
101 
102         /* Decrement loop counter */
103         blkCnt--;
104     }
105     *pResult = minVal;
106 
107 
108     /* Store the maximum value and it's index into destination pointers */
109 
110 }
111 #else
arm_absmin_no_idx_f64(const float64_t * pSrc,uint32_t blockSize,float64_t * pResult)112 void arm_absmin_no_idx_f64(
113     const float64_t * pSrc,
114     uint32_t blockSize,
115     float64_t * pResult)
116 {
117     float64_t minVal, out;                         /* Temporary variables to store the output value. */
118     uint32_t blkCnt;                     /* Loop counter */
119 
120 
121     /* Load first input value that act as reference value for comparision */
122     out = fabs(*pSrc++);
123 
124     /* Initialize blkCnt with number of samples */
125     blkCnt = (blockSize - 1U);
126 
127     while (blkCnt > 0U)
128     {
129         /* Initialize minVal to the next consecutive values one by one */
130         minVal = fabs(*pSrc++);
131 
132         /* compare for the minimum value */
133         if (out > minVal)
134         {
135             /* Update the minimum value and it's index */
136             out = minVal;
137         }
138 
139         /* Decrement loop counter */
140         blkCnt--;
141     }
142 
143     /* Store the minimum value and it's index into destination pointers */
144     *pResult = out;
145 }
146 #endif
147 /**
148   @} end of AbsMin group
149  */
150