Vector Optimized Library of Kernels  2.5.0
Architecture-tuned implementations of math kernels
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 GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 /* For documentation see 'kernels/volk/volk_8u_x3_encodepolar_8u_x2.h'
24  * This file exists for test purposes only. Should not be used directly.
25  */
26 
27 #ifndef VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_
28 #define VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_
29 #include <volk/volk.h>
31 
32 static inline unsigned int next_lower_power_of_two(const unsigned int val)
33 {
34  // algorithm found and adopted from:
35  // http://acius2.blogspot.de/2007/11/calculating-next-power-of-2.html
36  unsigned int res = val;
37  res = (res >> 1) | res;
38  res = (res >> 2) | res;
39  res = (res >> 4) | res;
40  res = (res >> 8) | res;
41  res = (res >> 16) | res;
42  res += 1;
43  return res >> 1;
44 }
45 
46 static inline void adjust_frozen_mask(unsigned char* mask, const unsigned int frame_size)
47 {
48  // just like the rest of the puppet this function exists for test purposes only.
49  unsigned int i;
50  for (i = 0; i < frame_size; ++i) {
51  *mask = (*mask & 0x80) ? 0xFF : 0x00;
52  mask++;
53  }
54 }
55 
56 #ifdef LV_HAVE_GENERIC
57 static inline void
59  unsigned char* frozen_bit_mask,
60  const unsigned char* frozen_bits,
61  const unsigned char* info_bits,
62  unsigned int frame_size)
63 {
64  frame_size = next_lower_power_of_two(frame_size);
65  unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
67  adjust_frozen_mask(frozen_bit_mask, frame_size);
69  frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
70  volk_free(temp);
71 }
72 #endif /* LV_HAVE_GENERIC */
73 
74 
75 #ifdef LV_HAVE_SSSE3
76 static inline void
78  unsigned char* frozen_bit_mask,
79  const unsigned char* frozen_bits,
80  const unsigned char* info_bits,
81  unsigned int frame_size)
82 {
83  frame_size = next_lower_power_of_two(frame_size);
84  unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
86  adjust_frozen_mask(frozen_bit_mask, frame_size);
88  frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
89  volk_free(temp);
90 }
91 #endif /* LV_HAVE_SSSE3 */
92 
93 #ifdef LV_HAVE_AVX2
94 static inline void
95 volk_8u_x3_encodepolarpuppet_8u_u_avx2(unsigned char* frame,
96  unsigned char* frozen_bit_mask,
97  const unsigned char* frozen_bits,
98  const unsigned char* info_bits,
99  unsigned int frame_size)
100 {
101  frame_size = next_lower_power_of_two(frame_size);
102  unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
104  adjust_frozen_mask(frozen_bit_mask, frame_size);
105  volk_8u_x3_encodepolar_8u_x2_u_avx2(
106  frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
107  volk_free(temp);
108 }
109 #endif /* LV_HAVE_AVX2 */
110 
111 #endif /* VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_ */
112 
113 #ifndef VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_
114 #define VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_
115 
116 #ifdef LV_HAVE_SSSE3
117 static inline void
119  unsigned char* frozen_bit_mask,
120  const unsigned char* frozen_bits,
121  const unsigned char* info_bits,
122  unsigned int frame_size)
123 {
124  frame_size = next_lower_power_of_two(frame_size);
125  unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
127  adjust_frozen_mask(frozen_bit_mask, frame_size);
129  frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
130  volk_free(temp);
131 }
132 #endif /* LV_HAVE_SSSE3 */
133 
134 #ifdef LV_HAVE_AVX2
135 static inline void
136 volk_8u_x3_encodepolarpuppet_8u_a_avx2(unsigned char* frame,
137  unsigned char* frozen_bit_mask,
138  const unsigned char* frozen_bits,
139  const unsigned char* info_bits,
140  unsigned int frame_size)
141 {
142  frame_size = next_lower_power_of_two(frame_size);
143  unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
145  adjust_frozen_mask(frozen_bit_mask, frame_size);
146  volk_8u_x3_encodepolar_8u_x2_a_avx2(
147  frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
148  volk_free(temp);
149 }
150 #endif /* LV_HAVE_AVX2 */
151 
152 
153 #endif /* VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_ */
val
Definition: volk_arch_defs.py:66
size_t volk_get_alignment(void)
Get the machine alignment in bytes.
Definition: volk.tmpl.c:102
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:98
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:156
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:117
static void adjust_frozen_mask(unsigned char *mask, const unsigned int frame_size)
Definition: volk_8u_x3_encodepolarpuppet_8u.h:46
static unsigned int next_lower_power_of_two(const unsigned int val)
Definition: volk_8u_x3_encodepolarpuppet_8u.h:32
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:58
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:118
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:77
for i
Definition: volk_config_fixed.tmpl.h:25
__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:51
VOLK_API void volk_free(void *aptr)
Free's memory allocated by volk_malloc.
Definition: volk_malloc.c:93