Reusable C++ coding-related code library
Find a file
2023-04-21 12:00:40 +02:00
tests added reference implementation and exhaustive testing 2023-04-20 14:04:32 +02:00
.gitignore moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
avx2.hh added vcopysign() 2021-07-10 23:34:09 +02:00
bitman.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
bitstream.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
bose_chaudhuri_hocquenghem_decoder.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
bose_chaudhuri_hocquenghem_encoder.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
crc.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
exclusive_reduce.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
galois_field.hh use much faster __builtin_clz 2023-04-21 12:00:40 +02:00
hadamard_decoder.hh minor cleanup 2020-06-14 00:01:37 +02:00
hadamard_encoder.hh encoder and soft decoder for augmented Hadamard codes 2020-06-11 23:11:31 +02:00
interleave.hh added simple interleavers 2023-03-27 11:07:04 +02:00
ldpc_decoder.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
ldpc_encoder.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
LICENSE moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
mls.hh added bad() to test sequence 2020-05-29 11:33:37 +02:00
neon.hh added vcopysign() 2021-07-10 23:34:09 +02:00
osd.hh faster to xor the rows with machine word size 2020-08-10 10:56:20 +02:00
osd_bch.png added ordered statistics decoding 2020-08-06 13:39:09 +02:00
permute.hh added a simple reversible block wise shuffle 2023-03-28 11:44:15 +02:00
polar_decoder.hh simplified branches with only information bits 2021-07-13 10:50:06 +02:00
polar_encoder.hh use uint32_t for the frozen bits 2021-07-13 10:50:06 +02:00
polar_freezer.hh use uint32_t for the frozen bits 2021-07-13 10:50:06 +02:00
polar_helper.hh added polar bit freezers, encoders and decoders 2021-07-11 10:30:22 +02:00
polar_list_decoder.hh simplified branches with only information bits 2021-07-13 10:50:06 +02:00
README.md added polar bit freezers, encoders and decoders 2021-07-11 10:30:22 +02:00
reed_solomon_decoder.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
reed_solomon_encoder.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
reed_solomon_error_correction.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00
rotate.hh don't allow mixing of SSE and AVX code 2019-10-02 12:16:20 +02:00
short_bch_code_decoder.hh don't rely on err[] being signed 2020-07-08 13:46:07 +02:00
short_bch_code_encoder.hh moved constructor generator argument to template parameter 2020-06-14 20:43:45 +02:00
simd.hh added vcopysign() 2021-07-10 23:34:09 +02:00
simplex_decoder.hh improved unrolled K = 2 .. 4 and removed 5 and 6 2020-06-14 00:48:11 +02:00
simplex_encoder.hh added encoder and soft decoder for simplex codes 2020-05-31 17:43:29 +02:00
sse4_1.hh double needs __m128d 2021-07-13 10:50:06 +02:00
xorshift.hh time to embrace #pragma once 2020-08-05 10:43:49 +02:00

This is a work in progress and a long overdue attempt to bring all our not-DSP-related code together and make it reusable for our future projects.

Before using any of this you should enter the tests directory and execute "make". This will check if your compiler is able to create binaries that are able to produce correct results when executed.

What we have included so far:

crc.hh

A Cyclic redundancy check helps ensuring data integrity.

For example, if we need to integrate CRC32 checking for a few bytes, like in the following:

# echo -n 'Hello World!' | rhash -C -
(stdin) 1C291CA3

We can add it to our project as simple as that:

CODE::CRC<uint32_t> crc(0xEDB88320, 0xFFFFFFFF);
for (uint8_t c: std::string("Hello World!")) crc(c);
assert(~crc() == 0x1C291CA3);

xorshift.hh

Sometimes we need a sequence of "random enough" numbers but don't want to store them in an array to get a repeatable sequence. Here a Pseudorandom number generator can help by prodiving a deterministic and thus repeatable sequence of numbers. George Marsaglia discovered a class of simple and fast pseudorandom number generators, which he called Xorshift.

mls.hh

Maximum length sequences have useful correlation properties.

bitstream.hh

When dealing with unaligned and arbitrary-bit-sized elements in a data stream, the bitwise stream container might help avoiding some headaches.

bitman.hh

Simple bit manipulation on byte arrays.

galois_field.hh

We have to thank Évariste Galois for his contribution of the Finite field to mathematics, which laid the cornerstone for a variety of applications that we take for granted today. One of them is ReedSolomon error correction:

reed_solomon_error_correction.hh

Implemented are the following Encoders and Decoders:

short_bch_code_encoder.hh

Encoder for short BCH codes

short_bch_code_decoder.hh

Syndrome decoding based Soft-decision decoder for short BCH codes

simplex_encoder.hh

Encoder for Simplex codes.

simplex_decoder.hh

Soft-decision decoder for Simplex codes.

hadamard_encoder.hh

Encoder for augmented Hadamard codes.

hadamard_decoder.hh

Soft-decision decoder for augmented Hadamard codes.

ldpc_encoder.hh

Low-density parity-check encoder

ldpc_decoder.hh

SIMD intra-frame accelerated Low-density parity-check layered decoder.

polar_freezer.hh

Bit freezers for the construction of polar codes.

  • PolarFreezer: Constructs code for a given erasure probability without the need for storing nor sorting of erasure probabilities for the virtual channels.
  • PolarCodeConst0: Constructs code by choosing the K best virtual channels computed from a given erasure probability.

polar_encoder.hh

Encoders for non-systematic and systematic polar codes.

polar_decoder.hh

Successive cancellation decoding of polar codes.

polar_list_decoder.hh

Successive cancellation list decoding of polar codes.

List size depends on used SIMD type. Decoding performance of the fixed-point implementation is better with shorter codes, as the list size is larger but a deterioration can be observed with larger codes.

osd.hh

Ordered statistics decoding allows the practical soft-decision decoding of short to medium sized linear codes. Below are the BER plots of the BCH(127, 64) T=10 code, using the OSD Soft-decision decoder and the ReedSolomon error correction BCH decoder with erasures. OSD and BCH decoder comparison

exclusive_reduce.hh

Reduce N times while excluding ith input element

It computes the following, but having only O(N) complexity and using O(1) extra storage:

	output[0] = input[1];
	output[1] = input[0];
	for (int i = 2; i < N; ++i)
		output[i] = op(input[0], input[1]);
	for (int i = 0; i < N; ++i)
		for (int j = 2; j < N; ++j)
			if (i != j)
				output[i] = op(output[i], input[j]);

simd.hh

Single instruction, multiple data (SIMD) wrappers for:

rotate.hh

SIMD element wise horizontal rotation

It computes the following, but faster:

SIMD<int8_t, SIZE> rotate(SIMD<int8_t, SIZE> input, int shift, int WIDTH)
{
	SIMD<int8_t, SIZE> output;
	for (int n = 0; n < WIDTH; ++n)
		output.v[(n + shift + WIDTH) % WIDTH] = input.v[n];
	return output;
}