Vector Optimized Library of Kernels 3.2.0
Architecture-tuned implementations of math kernels
Loading...
Searching...
No Matches
volk_8u_x3_encodepolarpuppet_8u.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2015 Free Software Foundation, Inc.
4 *
5 * This file is part of VOLK
6 *
7 * SPDX-License-Identifier: LGPL-3.0-or-later
8 */
9
10/* For documentation see 'kernels/volk/volk_8u_x3_encodepolar_8u_x2.h'
11 * This file exists for test purposes only. Should not be used directly.
12 */
13
14#ifndef VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_
15#define VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_
16#include <volk/volk.h>
18
19static inline unsigned int next_lower_power_of_two(const unsigned int val)
20{
21 // algorithm found and adopted from:
22 // https://acius2.blogspot.com/2007/11/calculating-next-power-of-2.html
23 unsigned int res = val;
24 res = (res >> 1) | res;
25 res = (res >> 2) | res;
26 res = (res >> 4) | res;
27 res = (res >> 8) | res;
28 res = (res >> 16) | res;
29 res += 1;
30 return res >> 1;
31}
32
33static inline void adjust_frozen_mask(unsigned char* mask, const unsigned int frame_size)
34{
35 // just like the rest of the puppet this function exists for test purposes only.
36 unsigned int i;
37 for (i = 0; i < frame_size; ++i) {
38 *mask = (*mask & 0x80) ? 0xFF : 0x00;
39 mask++;
40 }
41}
42
43#ifdef LV_HAVE_GENERIC
44static inline void
46 unsigned char* frozen_bit_mask,
47 const unsigned char* frozen_bits,
48 const unsigned char* info_bits,
49 unsigned int frame_size)
50{
51 if (frame_size < 1) {
52 return;
53 }
54
55 frame_size = next_lower_power_of_two(frame_size);
56 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
58 adjust_frozen_mask(frozen_bit_mask, frame_size);
60 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
61 volk_free(temp);
62}
63#endif /* LV_HAVE_GENERIC */
64
65
66#ifdef LV_HAVE_SSSE3
67static inline void
69 unsigned char* frozen_bit_mask,
70 const unsigned char* frozen_bits,
71 const unsigned char* info_bits,
72 unsigned int frame_size)
73{
74 if (frame_size < 1) {
75 return;
76 }
77
78 frame_size = next_lower_power_of_two(frame_size);
79 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
81 adjust_frozen_mask(frozen_bit_mask, frame_size);
83 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
84 volk_free(temp);
85}
86#endif /* LV_HAVE_SSSE3 */
87
88#ifdef LV_HAVE_AVX2
89static inline void
90volk_8u_x3_encodepolarpuppet_8u_u_avx2(unsigned char* frame,
91 unsigned char* frozen_bit_mask,
92 const unsigned char* frozen_bits,
93 const unsigned char* info_bits,
94 unsigned int frame_size)
95{
96 if (frame_size < 1) {
97 return;
98 }
99
100 frame_size = next_lower_power_of_two(frame_size);
101 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
103 adjust_frozen_mask(frozen_bit_mask, frame_size);
104 volk_8u_x3_encodepolar_8u_x2_u_avx2(
105 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
106 volk_free(temp);
107}
108#endif /* LV_HAVE_AVX2 */
109
110#endif /* VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_ */
111
112#ifndef VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_
113#define VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_
114
115#ifdef LV_HAVE_SSSE3
116static inline void
118 unsigned char* frozen_bit_mask,
119 const unsigned char* frozen_bits,
120 const unsigned char* info_bits,
121 unsigned int frame_size)
122{
123 if (frame_size < 1) {
124 return;
125 }
126
127 frame_size = next_lower_power_of_two(frame_size);
128 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
130 adjust_frozen_mask(frozen_bit_mask, frame_size);
132 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
133 volk_free(temp);
134}
135#endif /* LV_HAVE_SSSE3 */
136
137#ifdef LV_HAVE_AVX2
138static inline void
139volk_8u_x3_encodepolarpuppet_8u_a_avx2(unsigned char* frame,
140 unsigned char* frozen_bit_mask,
141 const unsigned char* frozen_bits,
142 const unsigned char* info_bits,
143 unsigned int frame_size)
144{
145 if (frame_size < 1) {
146 return;
147 }
148
149 frame_size = next_lower_power_of_two(frame_size);
150 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
152 adjust_frozen_mask(frozen_bit_mask, frame_size);
153 volk_8u_x3_encodepolar_8u_x2_a_avx2(
154 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
155 volk_free(temp);
156}
157#endif /* LV_HAVE_AVX2 */
158
159#ifdef LV_HAVE_RVV
160static inline void volk_8u_x3_encodepolarpuppet_8u_rvv(unsigned char* frame,
161 unsigned char* frozen_bit_mask,
162 const unsigned char* frozen_bits,
163 const unsigned char* info_bits,
164 unsigned int frame_size)
165{
166 if (frame_size < 1) {
167 return;
168 }
169
170 frame_size = next_lower_power_of_two(frame_size);
171 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
173 adjust_frozen_mask(frozen_bit_mask, frame_size);
174 volk_8u_x3_encodepolar_8u_x2_rvv(
175 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
176 volk_free(temp);
177}
178#endif /* LV_HAVE_RVV */
179
180#ifdef LV_HAVE_RVVSEG
181static inline void
182volk_8u_x3_encodepolarpuppet_8u_rvvseg(unsigned char* frame,
183 unsigned char* frozen_bit_mask,
184 const unsigned char* frozen_bits,
185 const unsigned char* info_bits,
186 unsigned int frame_size)
187{
188 if (frame_size < 1) {
189 return;
190 }
191
192 frame_size = next_lower_power_of_two(frame_size);
193 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
195 adjust_frozen_mask(frozen_bit_mask, frame_size);
196 volk_8u_x3_encodepolar_8u_x2_rvvseg(
197 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
198 volk_free(temp);
199}
200#endif /* LV_HAVE_RVVSEG */
201
202#endif /* VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_ */
size_t volk_get_alignment(void)
Get the machine alignment in bytes.
Definition volk.tmpl.c:90
static void volk_8u_x3_encodepolar_8u_x2_generic(unsigned char *frame, unsigned char *temp, const unsigned char *frozen_bit_mask, const unsigned char *frozen_bits, const unsigned char *info_bits, unsigned int frame_size)
Definition volk_8u_x3_encodepolar_8u_x2.h:85
static void volk_8u_x3_encodepolar_8u_x2_a_ssse3(unsigned char *frame, unsigned char *temp, const unsigned char *frozen_bit_mask, const unsigned char *frozen_bits, const unsigned char *info_bits, unsigned int frame_size)
Definition volk_8u_x3_encodepolar_8u_x2.h:143
static void volk_8u_x3_encodepolar_8u_x2_u_ssse3(unsigned char *frame, unsigned char *temp, const unsigned char *frozen_bit_mask, const unsigned char *frozen_bits, const unsigned char *info_bits, unsigned int frame_size)
Definition volk_8u_x3_encodepolar_8u_x2.h:104
static void adjust_frozen_mask(unsigned char *mask, const unsigned int frame_size)
Definition volk_8u_x3_encodepolarpuppet_8u.h:33
static unsigned int next_lower_power_of_two(const unsigned int val)
Definition volk_8u_x3_encodepolarpuppet_8u.h:19
static void volk_8u_x3_encodepolarpuppet_8u_generic(unsigned char *frame, unsigned char *frozen_bit_mask, const unsigned char *frozen_bits, const unsigned char *info_bits, unsigned int frame_size)
Definition volk_8u_x3_encodepolarpuppet_8u.h:45
static void volk_8u_x3_encodepolarpuppet_8u_a_ssse3(unsigned char *frame, unsigned char *frozen_bit_mask, const unsigned char *frozen_bits, const unsigned char *info_bits, unsigned int frame_size)
Definition volk_8u_x3_encodepolarpuppet_8u.h:117
static void volk_8u_x3_encodepolarpuppet_8u_u_ssse3(unsigned char *frame, unsigned char *frozen_bit_mask, const unsigned char *frozen_bits, const unsigned char *info_bits, unsigned int frame_size)
Definition volk_8u_x3_encodepolarpuppet_8u.h:68
for i
Definition volk_config_fixed.tmpl.h:13
__VOLK_DECL_BEGIN VOLK_API void * volk_malloc(size_t size, size_t alignment)
Allocate size bytes of data aligned to alignment.
Definition volk_malloc.c:38
VOLK_API void volk_free(void *aptr)
Free's memory allocated by volk_malloc.
Definition volk_malloc.c:70