ATLAS Offline Software
Loading...
Searching...
No Matches
ITkPixEncoding Namespace Reference

Functions

constexpr std::size_t LookUpTableSize (1<< 16)
template<std::size_t Length, typename Generator>
constexpr auto lut (Generator &&f)
constexpr uint32_t one_bit (uint32_t v)
constexpr void prepByte (uint32_t word, uint32_t b[8])
std::array< uint32_t, 8 > prepByte (uint32_t word)
uint32_t constexpr encode (uint32_t decoded, uint32_t &encoded)
auto create_lut_encode (bool length=false)

Variables

template<std::size_t Length>
constexpr auto LutLen
template<std::size_t Length>
constexpr auto LutBTree
constexpr std::array< uint32_t, LookUpTableSizeITkPixV2QCoreEncodingLUT_Tree = LutBTree<LookUpTableSize>
constexpr std::array< uint32_t, LookUpTableSizeITkPixV2QCoreEncodingLUT_Length = LutLen<LookUpTableSize>

Function Documentation

◆ create_lut_encode()

auto ITkPixEncoding::create_lut_encode ( bool length = false)
inline

Definition at line 88 of file ITkPixQCoreEncodingLUT.h.

88 {
89 std::array<uint32_t, LookUpTableSize> lut;
90 lut[0] = 0;
91 for (uint32_t i = 1; i < 1 << 16; i++) {
92 uint32_t encoded;
93 uint64_t len = encode(i, encoded);
94 lut[i] = length ? len : encoded;
95 }
96 return lut;
97 }
double length(const pvec &v)
constexpr auto lut(Generator &&f)
uint32_t constexpr encode(uint32_t decoded, uint32_t &encoded)

◆ encode()

uint32_t constexpr ITkPixEncoding::encode ( uint32_t decoded,
uint32_t & encoded )
constexpr

Definition at line 54 of file ITkPixQCoreEncodingLUT.h.

54 {
55 uint32_t b[8];
56 prepByte(decoded, b);
57 //
58 uint32_t S1 = (one_bit(b[0] | b[1] | b[2] | b[3]) << 1) | one_bit(b[4] | b[5] | b[6] | b[7]);
59 uint32_t S2t = (one_bit(b[0] | b[1]) << 1) | one_bit(b[2] | b[3]);
60 uint32_t S2b = (one_bit(b[4] | b[5]) << 1) | one_bit(b[6] | b[7]);
61 uint32_t S3tl = (one_bit(b[0]) << 1) | one_bit(b[1]);
62 uint32_t S3tr = (one_bit(b[2]) << 1) | one_bit(b[3]);
63 uint32_t S3bl = (one_bit(b[4]) << 1) | one_bit(b[5]);
64 uint32_t S3br = (one_bit(b[6]) << 1) | one_bit(b[7]);
65
66 uint32_t pos = 0;
67 encoded = 0;
68
69 auto writeTwo = [&](uint32_t src) {
70 if (src == 0b01) {
71 encoded |= (0b0) << (28 - pos);
72 pos++;
73 } else {
74 encoded |= (src & 0x3) << (28 - pos);
75 pos += 2;
76 }
77 };
78 for(auto & val:{
79 S1, S2t, S3tl, S3tr, b[0], b[1],b[2], b[3],
80 S2b, S3bl, S3br,b[4], b[5], b[6], b[7]
81 }) if(val) writeTwo(val);
82 return pos;
83 }
struct TBPatternUnitContext S1
constexpr uint32_t one_bit(uint32_t v)
constexpr void prepByte(uint32_t word, uint32_t b[8])

◆ LookUpTableSize()

std::size_t ITkPixEncoding::LookUpTableSize ( 1<< 16)
constexpr

◆ lut()

template<std::size_t Length, typename Generator>
auto ITkPixEncoding::lut ( Generator && f)
constexpr

Definition at line 19 of file ITkPixQCoreEncodingLUT.h.

19 {
20 using content_type = decltype(f(std::size_t{0}));
21 std::array<content_type, Length> arr;
22 using namespace std::ranges;
23 auto rangy = views::iota(std::size_t{0}, Length) // Generate a sequence
24 | views::transform(std::forward<Generator>(f)); // Transform using our generator
25 copy(rangy, arr.begin());
26 return arr;
27 }
bool copy
Definition calibdata.py:26

◆ one_bit()

uint32_t ITkPixEncoding::one_bit ( uint32_t v)
constexpr

Definition at line 30 of file ITkPixQCoreEncodingLUT.h.

30 {
31 return v!=0;
32 }

◆ prepByte() [1/2]

std::array< uint32_t, 8 > ITkPixEncoding::prepByte ( uint32_t word)

Definition at line 44 of file ITkPixQCoreEncodingLUT.h.

45 {
46 std::array<uint32_t, 8> b;
47 prepByte(word, b.data());
48 return b;
49 }

◆ prepByte() [2/2]

void ITkPixEncoding::prepByte ( uint32_t word,
uint32_t b[8] )
constexpr

Definition at line 38 of file ITkPixQCoreEncodingLUT.h.

38 {
39 for(int i = 0 ;i<8;i++) {
40 b[i] = ((word >> (2*i)) & 0x1) << 1 | ((word >> (2*i+1)) & 0x1);
41 }
42 }

Variable Documentation

◆ ITkPixV2QCoreEncodingLUT_Length

std::array<uint32_t, LookUpTableSize > ITkPixEncoding::ITkPixV2QCoreEncodingLUT_Length = LutLen<LookUpTableSize>
constexpr

Definition at line 116 of file ITkPixQCoreEncodingLUT.h.

◆ ITkPixV2QCoreEncodingLUT_Tree

std::array<uint32_t, LookUpTableSize > ITkPixEncoding::ITkPixV2QCoreEncodingLUT_Tree = LutBTree<LookUpTableSize>
constexpr

Definition at line 115 of file ITkPixQCoreEncodingLUT.h.

◆ LutBTree

template<std::size_t Length>
auto ITkPixEncoding::LutBTree
constexpr
Initial value:
= lut<Length>([](uint32_t i){
uint32_t encoded;
uint64_t len = encode(i, encoded);
return encoded >> (30 - len);
})

Definition at line 108 of file ITkPixQCoreEncodingLUT.h.

◆ LutLen

template<std::size_t Length>
auto ITkPixEncoding::LutLen
constexpr
Initial value:
= lut<Length>([](uint32_t i){
uint32_t encoded;
return encode(i, encoded);
})

Definition at line 102 of file ITkPixQCoreEncodingLUT.h.