40#ifndef INCLUDED_volk_16i_max_star_16i_a_H
41#define INCLUDED_volk_16i_max_star_16i_a_H
55 const unsigned int num_bytes = num_points * 2;
57 short candidate = src0[0];
59 __m128i xmm0, xmm1, xmm3, xmm4, xmm5, xmm6;
65 int bound = num_bytes >> 4;
66 int leftovers = (num_bytes >> 1) & 7;
76 for (i = 0; i < bound; ++i) {
95 for (i = 0; i < 8; ++i) {
96 candidate = ((short)(candidate - cands[i]) > 0) ? candidate : cands[i];
99 for (i = 0; i < leftovers; ++i) {
100 candidate = ((short)(candidate - src0[(bound << 3) + i]) > 0)
102 : src0[(bound << 3) + i];
105 target[0] = candidate;
116 const unsigned int eighth_points = num_points / 8;
119 int16x8_t diff, zeros;
120 uint16x8_t comp1, comp2;
121 zeros = vdupq_n_s16(0);
125 int16x8_t candidate_vec = vld1q_dup_s16(src0);
129 for (number = 0; number < eighth_points; ++number) {
130 input_vec = vld1q_s16(src0);
132 diff = vsubq_s16(candidate_vec, input_vec);
133 comp1 = vcgeq_s16(diff, zeros);
134 comp2 = vcltq_s16(diff, zeros);
136 tmpvec.val[0] = vandq_s16(candidate_vec, (int16x8_t)comp1);
137 tmpvec.val[1] = vandq_s16(input_vec, (int16x8_t)comp2);
139 candidate_vec = vaddq_s16(tmpvec.val[0], tmpvec.val[1]);
142 vst1q_s16(&candidate, candidate_vec);
144 for (number = 0; number < num_points % 8; number++) {
145 candidate = ((int16_t)(candidate - src0[number]) > 0) ? candidate : src0[number];
147 target[0] = candidate;
151#ifdef LV_HAVE_GENERIC
156 const unsigned int num_bytes = num_points * 2;
160 int bound = num_bytes >> 1;
162 short candidate = src0[0];
163 for (i = 1; i < bound; ++i) {
164 candidate = ((short)(candidate - src0[i]) > 0) ? candidate : src0[i];
166 target[0] = candidate;