GCC Code Coverage Report


Directory: ./
File: kernels/volk/volk_8u_x3_encodepolarpuppet_8u.h
Date: 2023-10-23 23:10:04
Exec Total Coverage
Lines: 49 49 100.0%
Functions: 7 7 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
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>
17 #include <volk/volk_8u_x3_encodepolar_8u_x2.h>
18
19 22 static inline unsigned int next_lower_power_of_two(const unsigned int val)
20 {
21 // algorithm found and adopted from:
22 // http://acius2.blogspot.de/2007/11/calculating-next-power-of-2.html
23 22 unsigned int res = val;
24 22 res = (res >> 1) | res;
25 22 res = (res >> 2) | res;
26 22 res = (res >> 4) | res;
27 22 res = (res >> 8) | res;
28 22 res = (res >> 16) | res;
29 22 res += 1;
30 22 return res >> 1;
31 }
32
33 10 static 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
2/2
✓ Branch 0 taken 655360 times.
✓ Branch 1 taken 10 times.
655370 for (i = 0; i < frame_size; ++i) {
38
2/2
✓ Branch 0 taken 327145 times.
✓ Branch 1 taken 328215 times.
655360 *mask = (*mask & 0x80) ? 0xFF : 0x00;
39 655360 mask++;
40 }
41 10 }
42
43 #ifdef LV_HAVE_GENERIC
44 static inline void
45 2 volk_8u_x3_encodepolarpuppet_8u_generic(unsigned char* frame,
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 2 frame_size = next_lower_power_of_two(frame_size);
52 2 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
53 volk_get_alignment());
54 2 adjust_frozen_mask(frozen_bit_mask, frame_size);
55 2 volk_8u_x3_encodepolar_8u_x2_generic(
56 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
57 2 volk_free(temp);
58 2 }
59 #endif /* LV_HAVE_GENERIC */
60
61
62 #ifdef LV_HAVE_SSSE3
63 static inline void
64 2 volk_8u_x3_encodepolarpuppet_8u_u_ssse3(unsigned char* frame,
65 unsigned char* frozen_bit_mask,
66 const unsigned char* frozen_bits,
67 const unsigned char* info_bits,
68 unsigned int frame_size)
69 {
70 2 frame_size = next_lower_power_of_two(frame_size);
71 2 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
72 volk_get_alignment());
73 2 adjust_frozen_mask(frozen_bit_mask, frame_size);
74 2 volk_8u_x3_encodepolar_8u_x2_u_ssse3(
75 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
76 2 volk_free(temp);
77 2 }
78 #endif /* LV_HAVE_SSSE3 */
79
80 #ifdef LV_HAVE_AVX2
81 static inline void
82 2 volk_8u_x3_encodepolarpuppet_8u_u_avx2(unsigned char* frame,
83 unsigned char* frozen_bit_mask,
84 const unsigned char* frozen_bits,
85 const unsigned char* info_bits,
86 unsigned int frame_size)
87 {
88 2 frame_size = next_lower_power_of_two(frame_size);
89 2 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
90 volk_get_alignment());
91 2 adjust_frozen_mask(frozen_bit_mask, frame_size);
92 2 volk_8u_x3_encodepolar_8u_x2_u_avx2(
93 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
94 2 volk_free(temp);
95 2 }
96 #endif /* LV_HAVE_AVX2 */
97
98 #endif /* VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_H_ */
99
100 #ifndef VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_
101 #define VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_
102
103 #ifdef LV_HAVE_SSSE3
104 static inline void
105 2 volk_8u_x3_encodepolarpuppet_8u_a_ssse3(unsigned char* frame,
106 unsigned char* frozen_bit_mask,
107 const unsigned char* frozen_bits,
108 const unsigned char* info_bits,
109 unsigned int frame_size)
110 {
111 2 frame_size = next_lower_power_of_two(frame_size);
112 2 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
113 volk_get_alignment());
114 2 adjust_frozen_mask(frozen_bit_mask, frame_size);
115 2 volk_8u_x3_encodepolar_8u_x2_a_ssse3(
116 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
117 2 volk_free(temp);
118 2 }
119 #endif /* LV_HAVE_SSSE3 */
120
121 #ifdef LV_HAVE_AVX2
122 static inline void
123 2 volk_8u_x3_encodepolarpuppet_8u_a_avx2(unsigned char* frame,
124 unsigned char* frozen_bit_mask,
125 const unsigned char* frozen_bits,
126 const unsigned char* info_bits,
127 unsigned int frame_size)
128 {
129 2 frame_size = next_lower_power_of_two(frame_size);
130 2 unsigned char* temp = (unsigned char*)volk_malloc(sizeof(unsigned char) * frame_size,
131 volk_get_alignment());
132 2 adjust_frozen_mask(frozen_bit_mask, frame_size);
133 2 volk_8u_x3_encodepolar_8u_x2_a_avx2(
134 frame, temp, frozen_bit_mask, frozen_bits, info_bits, frame_size);
135 2 volk_free(temp);
136 2 }
137 #endif /* LV_HAVE_AVX2 */
138
139
140 #endif /* VOLK_KERNELS_VOLK_VOLK_8U_X3_ENCODEPOLARPUPPET_8U_A_H_ */
141