conv_acc_sse_impl.h
Go to the documentation of this file.
/*
* Copyright (C) 2013, 2014 Thomas Tsou <tom@tsou.cc>
*
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* Some distributions (notably Alpine Linux) for some strange reason
* don't have this #define */
#ifndef __always_inline
#define __always_inline inline __attribute__((always_inline))
#endif
extern int sse41_supported;
/* Octo-Viterbi butterfly
* Compute 8-wide butterfly generating 16 path decisions and 16 accumulated
* sums. Inputs all packed 16-bit integers in three 128-bit XMM registers.
* Two intermediate registers are used and results are set in the upper 4
* registers.
*
* Input:
* M0 - Path metrics 0 (packed 16-bit integers)
* M1 - Path metrics 1 (packed 16-bit integers)
* M2 - Branch metrics (packed 16-bit integers)
*
* Output:
* M2 - Selected and accumulated path metrics 0
* M4 - Selected and accumulated path metrics 1
* M3 - Path selections 0
* M1 - Path selections 1
*/
#define SSE_BUTTERFLY(M0, M1, M2, M3, M4) \
{ \
M3 = _mm_adds_epi16(M0, M2); \
M4 = _mm_subs_epi16(M1, M2); \
M0 = _mm_subs_epi16(M0, M2); \
M1 = _mm_adds_epi16(M1, M2); \
M2 = _mm_max_epi16(M3, M4); \
M3 = _mm_or_si128(_mm_cmpgt_epi16(M3, M4), _mm_cmpeq_epi16(M3, M4)); \
M4 = _mm_max_epi16(M0, M1); \
M1 = _mm_or_si128(_mm_cmpgt_epi16(M0, M1), _mm_cmpeq_epi16(M0, M1)); \
}
/* Two lane deinterleaving K = 5:
* Take 16 interleaved 16-bit integers and deinterleave to 2 packed 128-bit
* registers. The operation summarized below. Four registers are used with
* the lower 2 as input and upper 2 as output.
*
* In - 10101010 10101010 10101010 10101010
* Out - 00000000 11111111 00000000 11111111
*
* Input:
* M0:1 - Packed 16-bit integers
*
* Output:
* M2:3 - Deinterleaved packed 16-bit integers
*/
#define _I8_SHUFFLE_MASK 15, 14, 11, 10, 7, 6, 3, 2, 13, 12, 9, 8, 5, 4, 1, 0
#define SSE_DEINTERLEAVE_K5(M0, M1, M2, M3) \
{ \
M2 = _mm_set_epi8(_I8_SHUFFLE_MASK); \
M0 = _mm_shuffle_epi8(M0, M2); \
M1 = _mm_shuffle_epi8(M1, M2); \
M2 = _mm_unpacklo_epi64(M0, M1); \
M3 = _mm_unpackhi_epi64(M0, M1); \
}
/* Two lane deinterleaving K = 7:
* Take 64 interleaved 16-bit integers and deinterleave to 8 packed 128-bit
* registers. The operation summarized below. 16 registers are used with the
* lower 8 as input and upper 8 as output.
*
* In - 10101010 10101010 10101010 10101010 ...
* Out - 00000000 11111111 00000000 11111111 ...
*
* Input:
* M0:7 - Packed 16-bit integers
*
* Output:
* M8:15 - Deinterleaved packed 16-bit integers
*/
#define SSE_DEINTERLEAVE_K7(M0, M1, M2, M3, M4, M5, M6, M7, \
M8, M9, M10, M11, M12, M13, M14, M15) \
{ \
M8 = _mm_set_epi8(_I8_SHUFFLE_MASK); \
M0 = _mm_shuffle_epi8(M0, M8); \
M1 = _mm_shuffle_epi8(M1, M8); \
M2 = _mm_shuffle_epi8(M2, M8); \
M3 = _mm_shuffle_epi8(M3, M8); \
M4 = _mm_shuffle_epi8(M4, M8); \
M5 = _mm_shuffle_epi8(M5, M8); \
M6 = _mm_shuffle_epi8(M6, M8); \
M7 = _mm_shuffle_epi8(M7, M8); \
M8 = _mm_unpacklo_epi64(M0, M1); \
M9 = _mm_unpackhi_epi64(M0, M1); \
M10 = _mm_unpacklo_epi64(M2, M3); \
M11 = _mm_unpackhi_epi64(M2, M3); \
M12 = _mm_unpacklo_epi64(M4, M5); \
M13 = _mm_unpackhi_epi64(M4, M5); \
M14 = _mm_unpacklo_epi64(M6, M7); \
M15 = _mm_unpackhi_epi64(M6, M7); \
}
/* Generate branch metrics N = 2:
* Compute 16 branch metrics from trellis outputs and input values.
*
* Input:
* M0:3 - 16 x 2 packed 16-bit trellis outputs
* M4 - Expanded and packed 16-bit input value
*
* Output:
* M6:7 - 16 computed 16-bit branch metrics
*/
#define SSE_BRANCH_METRIC_N2(M0, M1, M2, M3, M4, M6, M7) \
{ \
M0 = _mm_sign_epi16(M4, M0); \
M1 = _mm_sign_epi16(M4, M1); \
M2 = _mm_sign_epi16(M4, M2); \
M3 = _mm_sign_epi16(M4, M3); \
M6 = _mm_hadds_epi16(M0, M1); \
M7 = _mm_hadds_epi16(M2, M3); \
}
/* Generate branch metrics N = 4:
* Compute 8 branch metrics from trellis outputs and input values. This
* macro is reused for N less than 4 where the extra soft input bits are
* padded.
*
* Input:
* M0:3 - 8 x 4 packed 16-bit trellis outputs
* M4 - Expanded and packed 16-bit input value
*
* Output:
* M5 - 8 computed 16-bit branch metrics
*/
#define SSE_BRANCH_METRIC_N4(M0, M1, M2, M3, M4, M5) \
{ \
M0 = _mm_sign_epi16(M4, M0); \
M1 = _mm_sign_epi16(M4, M1); \
M2 = _mm_sign_epi16(M4, M2); \
M3 = _mm_sign_epi16(M4, M3); \
M0 = _mm_hadds_epi16(M0, M1); \
M1 = _mm_hadds_epi16(M2, M3); \
M5 = _mm_hadds_epi16(M0, M1); \
}
/* Horizontal minimum
* Compute horizontal minimum of packed unsigned 16-bit integers and place
* result in the low 16-bit element of the source register. Only SSE 4.1
* has a dedicated minpos instruction. One intermediate register is used
* if SSE 4.1 is not available. This is a destructive operation and the
* source register is overwritten.
*
* Input:
* M0 - Packed unsigned 16-bit integers
*
* Output:
* M0 - Minimum value placed in low 16-bit element
*/
#if defined(HAVE_SSE4_1) || defined(HAVE_SSE41)
#define SSE_MINPOS(M0, M1) \
{ \
if (sse41_supported) { \
M0 = _mm_minpos_epu16(M0); \
} else { \
M1 = _mm_shuffle_epi32(M0, _MM_SHUFFLE(0, 0, 3, 2)); \
M0 = _mm_min_epi16(M0, M1); \
M1 = _mm_shufflelo_epi16(M0, _MM_SHUFFLE(0, 0, 3, 2)); \
M0 = _mm_min_epi16(M0, M1); \
M1 = _mm_shufflelo_epi16(M0, _MM_SHUFFLE(0, 0, 0, 1)); \
M0 = _mm_min_epi16(M0, M1); \
} \
}
#else
#define SSE_MINPOS(M0, M1) \
{ \
M1 = _mm_shuffle_epi32(M0, _MM_SHUFFLE(0, 0, 3, 2)); \
M0 = _mm_min_epi16(M0, M1); \
M1 = _mm_shufflelo_epi16(M0, _MM_SHUFFLE(0, 0, 3, 2)); \
M0 = _mm_min_epi16(M0, M1); \
M1 = _mm_shufflelo_epi16(M0, _MM_SHUFFLE(0, 0, 0, 1)); \
M0 = _mm_min_epi16(M0, M1); \
}
#endif
/* Normalize state metrics K = 5:
* Compute 16-wide normalization by subtracting the smallest value from
* all values. Inputs are 16 packed 16-bit integers across 2 XMM registers.
* Two intermediate registers are used and normalized results are placed
* in the originating locations.
*
* Input:
* M0:1 - Path metrics 0:1 (packed 16-bit integers)
*
* Output:
* M0:1 - Normalized path metrics 0:1
*/
#define SSE_NORMALIZE_K5(M0, M1, M2, M3) \
{ \
M2 = _mm_min_epi16(M0, M1); \
SSE_MINPOS(M2, M3) \
SSE_BROADCAST(M2) \
M0 = _mm_subs_epi16(M0, M2); \
M1 = _mm_subs_epi16(M1, M2); \
}
/* Normalize state metrics K = 7:
* Compute 64-wide normalization by subtracting the smallest value from
* all values. Inputs are 8 registers of accumulated sums and 4 temporary
* registers. Normalized results are returned in the originating locations.
*
* Input:
* M0:7 - Path metrics 0:7 (packed 16-bit integers)
*
* Output:
* M0:7 - Normalized path metrics 0:7
*/
#define SSE_NORMALIZE_K7(M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11) \
{ \
M8 = _mm_min_epi16(M0, M1); \
M9 = _mm_min_epi16(M2, M3); \
M10 = _mm_min_epi16(M4, M5); \
M11 = _mm_min_epi16(M6, M7); \
M8 = _mm_min_epi16(M8, M9); \
M10 = _mm_min_epi16(M10, M11); \
M8 = _mm_min_epi16(M8, M10); \
SSE_MINPOS(M8, M9) \
SSE_BROADCAST(M8) \
M0 = _mm_subs_epi16(M0, M8); \
M1 = _mm_subs_epi16(M1, M8); \
M2 = _mm_subs_epi16(M2, M8); \
M3 = _mm_subs_epi16(M3, M8); \
M4 = _mm_subs_epi16(M4, M8); \
M5 = _mm_subs_epi16(M5, M8); \
M6 = _mm_subs_epi16(M6, M8); \
M7 = _mm_subs_epi16(M7, M8); \
}
/* Combined BMU/PMU (K=5, N=2)
* Compute branch metrics followed by path metrics for half rate 16-state
* trellis. 8 butterflies are computed. Accumulated path sums are not
* preserved and read and written into the same memory location. Normalize
* sums if requires.
*/
__always_inline static void _sse_metrics_k5_n2(const int16_t *val,
const int16_t *out, int16_t *sums, int16_t *paths, int norm)
{
__m128i m0, m1, m2, m3, m4, m5, m6;
/* (BMU) Load input sequence */
m2 = _mm_castpd_si128(_mm_loaddup_pd((double const *) val));
/* (BMU) Load trellis outputs */
m0 = _mm_load_si128((__m128i *) &out[0]);
m1 = _mm_load_si128((__m128i *) &out[8]);
/* (BMU) Compute branch metrics */
m0 = _mm_sign_epi16(m2, m0);
m1 = _mm_sign_epi16(m2, m1);
m2 = _mm_hadds_epi16(m0, m1);
/* (PMU) Load accumulated path metrics */
m0 = _mm_load_si128((__m128i *) &sums[0]);
m1 = _mm_load_si128((__m128i *) &sums[8]);
SSE_DEINTERLEAVE_K5(m0, m1, m3, m4)
/* (PMU) Butterflies: 0-7 */
SSE_BUTTERFLY(m3, m4, m2, m5, m6)
if (norm)
SSE_NORMALIZE_K5(m2, m6, m0, m1)
_mm_store_si128((__m128i *) &sums[0], m2);
_mm_store_si128((__m128i *) &sums[8], m6);
_mm_store_si128((__m128i *) &paths[0], m5);
_mm_store_si128((__m128i *) &paths[8], m4);
}
/* Combined BMU/PMU (K=5, N=3 and N=4)
* Compute branch metrics followed by path metrics for 16-state and rates
* to 1/4. 8 butterflies are computed. The input sequence is read four 16-bit
* values at a time, and extra values should be set to zero for rates other
* than 1/4. Normally only rates 1/3 and 1/4 are used as there is a
* dedicated implementation of rate 1/2.
*/
__always_inline static void _sse_metrics_k5_n4(const int16_t *val,
const int16_t *out, int16_t *sums, int16_t *paths, int norm)
{
__m128i m0, m1, m2, m3, m4, m5, m6;
/* (BMU) Load input sequence */
m4 = _mm_castpd_si128(_mm_loaddup_pd((double const *) val));
/* (BMU) Load trellis outputs */
m0 = _mm_load_si128((__m128i *) &out[0]);
m1 = _mm_load_si128((__m128i *) &out[8]);
m2 = _mm_load_si128((__m128i *) &out[16]);
m3 = _mm_load_si128((__m128i *) &out[24]);
SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m4, m2)
/* (PMU) Load accumulated path metrics */
m0 = _mm_load_si128((__m128i *) &sums[0]);
m1 = _mm_load_si128((__m128i *) &sums[8]);
SSE_DEINTERLEAVE_K5(m0, m1, m3, m4)
/* (PMU) Butterflies: 0-7 */
SSE_BUTTERFLY(m3, m4, m2, m5, m6)
if (norm)
SSE_NORMALIZE_K5(m2, m6, m0, m1)
_mm_store_si128((__m128i *) &sums[0], m2);
_mm_store_si128((__m128i *) &sums[8], m6);
_mm_store_si128((__m128i *) &paths[0], m5);
_mm_store_si128((__m128i *) &paths[8], m4);
}
/* Combined BMU/PMU (K=7, N=2)
* Compute branch metrics followed by path metrics for half rate 64-state
* trellis. 32 butterfly operations are computed. Deinterleaving path
* metrics requires usage of the full SSE register file, so separate sums
* before computing branch metrics to avoid register spilling.
*/
__always_inline static void _sse_metrics_k7_n2(const int16_t *val,
const int16_t *out, int16_t *sums, int16_t *paths, int norm)
{
__m128i m0, m1, m2, m3, m4, m5, m6, m7, m8,
m9, m10, m11, m12, m13, m14, m15;
/* (PMU) Load accumulated path metrics */
m0 = _mm_load_si128((__m128i *) &sums[0]);
m1 = _mm_load_si128((__m128i *) &sums[8]);
m2 = _mm_load_si128((__m128i *) &sums[16]);
m3 = _mm_load_si128((__m128i *) &sums[24]);
m4 = _mm_load_si128((__m128i *) &sums[32]);
m5 = _mm_load_si128((__m128i *) &sums[40]);
m6 = _mm_load_si128((__m128i *) &sums[48]);
m7 = _mm_load_si128((__m128i *) &sums[56]);
/* (PMU) Deinterleave to even-odd registers */
SSE_DEINTERLEAVE_K7(m0, m1, m2, m3 ,m4 ,m5, m6, m7,
m8, m9, m10, m11, m12, m13, m14, m15)
/* (BMU) Load input symbols */
m7 = _mm_castpd_si128(_mm_loaddup_pd((double const *) val));
/* (BMU) Load trellis outputs */
m0 = _mm_load_si128((__m128i *) &out[0]);
m1 = _mm_load_si128((__m128i *) &out[8]);
m2 = _mm_load_si128((__m128i *) &out[16]);
m3 = _mm_load_si128((__m128i *) &out[24]);
SSE_BRANCH_METRIC_N2(m0, m1, m2, m3, m7, m4, m5)
m0 = _mm_load_si128((__m128i *) &out[32]);
m1 = _mm_load_si128((__m128i *) &out[40]);
m2 = _mm_load_si128((__m128i *) &out[48]);
m3 = _mm_load_si128((__m128i *) &out[56]);
SSE_BRANCH_METRIC_N2(m0, m1, m2, m3, m7, m6, m7)
/* (PMU) Butterflies: 0-15 */
SSE_BUTTERFLY(m8, m9, m4, m0, m1)
SSE_BUTTERFLY(m10, m11, m5, m2, m3)
_mm_store_si128((__m128i *) &paths[0], m0);
_mm_store_si128((__m128i *) &paths[8], m2);
_mm_store_si128((__m128i *) &paths[32], m9);
_mm_store_si128((__m128i *) &paths[40], m11);
/* (PMU) Butterflies: 17-31 */
SSE_BUTTERFLY(m12, m13, m6, m0, m2)
SSE_BUTTERFLY(m14, m15, m7, m9, m11)
_mm_store_si128((__m128i *) &paths[16], m0);
_mm_store_si128((__m128i *) &paths[24], m9);
_mm_store_si128((__m128i *) &paths[48], m13);
_mm_store_si128((__m128i *) &paths[56], m15);
if (norm)
SSE_NORMALIZE_K7(m4, m1, m5, m3, m6, m2,
m7, m11, m0, m8, m9, m10)
_mm_store_si128((__m128i *) &sums[0], m4);
_mm_store_si128((__m128i *) &sums[8], m5);
_mm_store_si128((__m128i *) &sums[16], m6);
_mm_store_si128((__m128i *) &sums[24], m7);
_mm_store_si128((__m128i *) &sums[32], m1);
_mm_store_si128((__m128i *) &sums[40], m3);
_mm_store_si128((__m128i *) &sums[48], m2);
_mm_store_si128((__m128i *) &sums[56], m11);
}
/* Combined BMU/PMU (K=7, N=3 and N=4)
* Compute branch metrics followed by path metrics for half rate 64-state
* trellis. 32 butterfly operations are computed. Deinterleave path
* metrics before computing branch metrics as in the half rate case.
*/
__always_inline static void _sse_metrics_k7_n4(const int16_t *val,
const int16_t *out, int16_t *sums, int16_t *paths, int norm)
{
__m128i m0, m1, m2, m3, m4, m5, m6, m7;
__m128i m8, m9, m10, m11, m12, m13, m14, m15;
/* (PMU) Load accumulated path metrics */
m0 = _mm_load_si128((__m128i *) &sums[0]);
m1 = _mm_load_si128((__m128i *) &sums[8]);
m2 = _mm_load_si128((__m128i *) &sums[16]);
m3 = _mm_load_si128((__m128i *) &sums[24]);
m4 = _mm_load_si128((__m128i *) &sums[32]);
m5 = _mm_load_si128((__m128i *) &sums[40]);
m6 = _mm_load_si128((__m128i *) &sums[48]);
m7 = _mm_load_si128((__m128i *) &sums[56]);
/* (PMU) Deinterleave into even and odd packed registers */
SSE_DEINTERLEAVE_K7(m0, m1, m2, m3 ,m4 ,m5, m6, m7,
m8, m9, m10, m11, m12, m13, m14, m15)
/* (BMU) Load and expand 8-bit input out to 16-bits */
m7 = _mm_castpd_si128(_mm_loaddup_pd((double const *) val));
/* (BMU) Load and compute branch metrics */
m0 = _mm_load_si128((__m128i *) &out[0]);
m1 = _mm_load_si128((__m128i *) &out[8]);
m2 = _mm_load_si128((__m128i *) &out[16]);
m3 = _mm_load_si128((__m128i *) &out[24]);
SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m4)
m0 = _mm_load_si128((__m128i *) &out[32]);
m1 = _mm_load_si128((__m128i *) &out[40]);
m2 = _mm_load_si128((__m128i *) &out[48]);
m3 = _mm_load_si128((__m128i *) &out[56]);
SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m5)
m0 = _mm_load_si128((__m128i *) &out[64]);
m1 = _mm_load_si128((__m128i *) &out[72]);
m2 = _mm_load_si128((__m128i *) &out[80]);
m3 = _mm_load_si128((__m128i *) &out[88]);
SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m6)
m0 = _mm_load_si128((__m128i *) &out[96]);
m1 = _mm_load_si128((__m128i *) &out[104]);
m2 = _mm_load_si128((__m128i *) &out[112]);
m3 = _mm_load_si128((__m128i *) &out[120]);
SSE_BRANCH_METRIC_N4(m0, m1, m2, m3, m7, m7)
/* (PMU) Butterflies: 0-15 */
SSE_BUTTERFLY(m8, m9, m4, m0, m1)
SSE_BUTTERFLY(m10, m11, m5, m2, m3)
_mm_store_si128((__m128i *) &paths[0], m0);
_mm_store_si128((__m128i *) &paths[8], m2);
_mm_store_si128((__m128i *) &paths[32], m9);
_mm_store_si128((__m128i *) &paths[40], m11);
/* (PMU) Butterflies: 17-31 */
SSE_BUTTERFLY(m12, m13, m6, m0, m2)
SSE_BUTTERFLY(m14, m15, m7, m9, m11)
_mm_store_si128((__m128i *) &paths[16], m0);
_mm_store_si128((__m128i *) &paths[24], m9);
_mm_store_si128((__m128i *) &paths[48], m13);
_mm_store_si128((__m128i *) &paths[56], m15);
if (norm)
SSE_NORMALIZE_K7(m4, m1, m5, m3, m6, m2,
m7, m11, m0, m8, m9, m10)
_mm_store_si128((__m128i *) &sums[0], m4);
_mm_store_si128((__m128i *) &sums[8], m5);
_mm_store_si128((__m128i *) &sums[16], m6);
_mm_store_si128((__m128i *) &sums[24], m7);
_mm_store_si128((__m128i *) &sums[32], m1);
_mm_store_si128((__m128i *) &sums[40], m3);
_mm_store_si128((__m128i *) &sums[48], m2);
_mm_store_si128((__m128i *) &sums[56], m11);
}
osmo_conv_decoder::state_history
uint8_t * state_history
state history [len][n_states]
Definition: conv.h:117
osmo_conv_encoder::i_idx
int i_idx
Next input bit index.
Definition: conv.h:82
vtrellis::num_states
int num_states
Definition: conv_acc.c:148
acs_butterfly
static void acs_butterfly(int state, int num_states, int16_t metric, int16_t *sum, int16_t *new_sum, int16_t *path)
Definition: conv_acc_generic.c:36
bitvec_read_field
uint64_t bitvec_read_field(struct bitvec *bv, unsigned int *read_index, unsigned int len)
read part of the vector
Definition: bitvec.c:485
osmo_conv_decoder::p_idx
int p_idx
puncture index
Definition: conv.h:113
bitvec::data
uint8_t * data
pointer to data array
Definition: bitvec.h:49
bitvec_get_int16_msb
int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits)
get multiple bits (num_bits) from beginning of vector (MSB side)
Definition: bitvec.c:258
vdecoder::n
int n
Definition: conv_acc.c:164
osmo_stderr_target
struct log_target * osmo_stderr_target
the default logging target, logging to stderr
Definition: application.c:85
SSE_BUTTERFLY
#define SSE_BUTTERFLY(M0, M1, M2, M3, M4)
Definition: conv_acc_sse_impl.h:52
log_add_target
void log_add_target(struct log_target *target)
Register a new log target with the logging core.
Definition: logging.c:567
osmo_conv_encoder::p_idx
int p_idx
Current puncture index.
Definition: conv.h:83
bitvec_get_bytes
int bitvec_get_bytes(struct bitvec *bv, uint8_t *bytes, unsigned int count)
get multiple bytes from current pos Assumes MSB first encoding.
Definition: bitvec.c:334
bitvec_get_bit_high
int bitvec_get_bit_high(struct bitvec *bv)
get the next bit (low/high) inside a bitvec
Definition: bitvec.c:192
osmo_ubit2pbit
int osmo_ubit2pbit(pbit_t *out, const ubit_t *in, unsigned int num_bits)
convert unpacked bits to packed bits, return length in bytes
Definition: bits.c:45
osmo_conv_code::term
enum osmo_conv_term term
Termination type.
Definition: conv.h:57
osmo_conv_decoder::ae_next
unsigned int * ae_next
next accumulated error (tmp in scan)
Definition: conv.h:116
bitvec_set_bit_pos
int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnum, enum bit_value bit)
set a bit at given position in a bit vector
Definition: bitvec.c:153
_osmo_backtrace
static void _osmo_backtrace(int use_printf, int subsys, int level)
Definition: backtrace.c:36
osmo_t4_encode
int osmo_t4_encode(struct bitvec *bv)
encode bit vector in-place using T4 encoding Assumes MSB first encoding.
Definition: bitcomp.c:316
_sse_metrics_k7_n4
static __always_inline void _sse_metrics_k7_n4(const int16_t *val, const int16_t *out, int16_t *sums, int16_t *paths, int norm)
Definition: conv_acc_sse_impl.h:423
_traceback
static void _traceback(struct vdecoder *dec, unsigned state, uint8_t *out, int len)
Definition: conv_acc.c:438
depuncture
static int depuncture(const int8_t *in, const int *punc, int8_t *out, int len)
Definition: conv_acc.c:588
osmo_pbit2ubit
int osmo_pbit2ubit(ubit_t *out, const pbit_t *in, unsigned int num_bits)
convert packed bits to unpacked bits, return length in bytes
Definition: bits.c:146
osmo_conv_encoder::state
uint8_t state
Current state.
Definition: conv.h:84
bitvec_get_bit_pos
enum bit_value bitvec_get_bit_pos(const struct bitvec *bv, unsigned int bitnr)
check if the bit is 0 or 1 for a given position inside a bitvec
Definition: bitvec.c:87
bitvec_pack
unsigned int bitvec_pack(const struct bitvec *bv, uint8_t *buffer)
Export a bit vector to a buffer.
Definition: bitvec.c:436
ZERO
@ ZERO
A zero (0) bit.
Definition: bitvec.h:39
osmo_init_logging2
int osmo_init_logging2(void *ctx, const struct log_info *log_info)
Definition: application.c:120
bitcomp.h
conv.h
bitvec_set_bit
int bitvec_set_bit(struct bitvec *bv, enum bit_value bit)
set the next bit inside a bitvec
Definition: bitvec.c:179
subsys
char subsys[16]
logging sub-system
Definition: gsmtap.h:11
bitvec_find_bit_pos
int bitvec_find_bit_pos(const struct bitvec *bv, unsigned int n, enum bit_value val)
find first bit set in bit vector
Definition: bitvec.c:314
vdec_init
static int vdec_init(struct vdecoder *dec, const struct osmo_conv_code *code)
Definition: conv_acc.c:517
bitvec_free
void bitvec_free(struct bitvec *bv)
Free a bit vector (release its memory)
Definition: bitvec.c:426
osmo_conv_encode_init
void osmo_conv_encode_init(struct osmo_conv_encoder *encoder, const struct osmo_conv_code *code)
Initialize a convolutional encoder.
Definition: conv.c:86
vdecoder::len
int len
Definition: conv_acc.c:166
osmo_conv_decode_reset
void osmo_conv_decode_reset(struct osmo_conv_decoder *decoder, int start_state)
Definition: conv.c:274
bitvec_set_bits
int bitvec_set_bits(struct bitvec *bv, const enum bit_value *bits, unsigned int count)
set multiple bits (based on array of bitvals) at current pos
Definition: bitvec.c:208
osmo_nibble_shift_left_unal
void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in, unsigned int num_nibbles)
Shift unaligned input to octet-aligned output.
Definition: bits.c:100
osmo_conv_decoder::len
int len
Max o_idx (excl.
Definition: conv.h:110
bitvec::data_len
unsigned int data_len
length of data array in bytes
Definition: bitvec.h:48
bit_value
bit_value
A single GSM bit.
Definition: bitvec.h:38
osmo_conv_encoder
convolutional encoder state
Definition: conv.h:80
BIT2NRZ
#define BIT2NRZ(REG, N)
Definition: conv_acc.c:33
log_info
Logging configuration, passed to log_init.
Definition: logging.h:197
osmo_conv_decode_get_output
int osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder, ubit_t *output, int has_flush, int end_state)
Definition: conv.c:531
log_target_create_stderr
struct log_target * log_target_create_stderr(void)
Create the STDERR log target.
Definition: logging.c:792
bitswap6
static unsigned bitswap6(unsigned v)
Definition: conv_acc.c:221
SSE_ALIGN
#define SSE_ALIGN
Definition: conv_acc_sse_avx.c:38
osmo_conv_decode_acc
int osmo_conv_decode_acc(const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output)
Definition: conv_acc.c:690
osmo_conv_code::next_term_state
const uint8_t * next_term_state
Flush termination state
Definition: conv.h:63
vdecoder::intrvl
int intrvl
Definition: conv_acc.c:168
bitswap2
static unsigned bitswap2(unsigned v)
Definition: conv_acc.c:198
osmo_conv_decoder::o_idx
int o_idx
output index
Definition: conv.h:112
vdecoder::recursive
int recursive
Definition: conv_acc.c:167
gen_branch_metrics_n4
static void gen_branch_metrics_n4(int num_states, const int8_t *seq, const int16_t *out, int16_t *metrics)
Definition: conv_acc_generic.c:94
sse41_supported
int sse41_supported
osmo_conv_encode
int osmo_conv_encode(const struct osmo_conv_code *code, const ubit_t *input, ubit_t *output)
All-in-one convolutional encoding function.
Definition: conv.c:212
SSE_DEINTERLEAVE_K7
#define SSE_DEINTERLEAVE_K7(M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15)
Definition: conv_acc_sse_impl.h:103
__attribute__
__attribute__((visibility("hidden")))
Include common SSE implementation.
Definition: conv_acc_sse.c:68
osmo_conv_decoder::code
const struct osmo_conv_code * code
for which code?
Definition: conv.h:106
gen_state_info
static int gen_state_info(uint8_t *val, unsigned reg, int16_t *output, const struct osmo_conv_code *code)
Definition: conv_acc.c:271
osmo_revbytebits_buf
void osmo_revbytebits_buf(uint8_t *buf, int len)
reverse bit-order of each byte in a buffer
Definition: bits.c:286
osmo_daemonize
int osmo_daemonize(void)
Turn the current process into a background daemon.
Definition: application.c:143
osmo_conv_decoder::ae
unsigned int * ae
accumulated error
Definition: conv.h:115
bitvec_shiftl
void bitvec_shiftl(struct bitvec *bv, unsigned n)
Shifts bitvec to the left, n MSB bits lost.
Definition: bitvec.c:646
vdecoder::trellis
struct vtrellis trellis
Definition: conv_acc.c:169
forward_traverse
static void forward_traverse(struct vdecoder *dec, const int8_t *seq)
Definition: conv_acc.c:610
bitvec_rl_curbit
unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits)
Return number (bits) of uninterrupted bit run in vector starting from the current bit.
Definition: bitvec.c:608
SSE_NORMALIZE_K7
#define SSE_NORMALIZE_K7(M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11)
Definition: conv_acc_sse_impl.h:239
sbit_t
int8_t sbit_t
soft bit with value (-127...127), as commonly used in communications receivers such as [viterbi] deco...
Definition: bits.h:21
log_targets_reopen
int log_targets_reopen(void)
close and re-open all log files (for log file rotation)
Definition: logging.c:908
osmo_init_ignore_signals
void osmo_init_ignore_signals(void)
Ignore SIGPIPE, SIGALRM, SIGHUP and SIGIO.
Definition: application.c:93
level
uint8_t level
logging level
Definition: gsmtap.h:8
bits.h
osmo_load16be
static uint16_t osmo_load16be(const void *p)
load unaligned 16-bit integer (big-endian encoding)
Definition: bit16gen.h:89
NUM_STATES
#define NUM_STATES(K)
Definition: conv_acc.c:34
vdecoder::paths
int16_t ** paths
Definition: conv_acc.c:170
osmo_conv_code::next_output
const uint8_t(* next_output)[2]
Next output array.
Definition: conv.h:59
log_target
structure representing a logging target
Definition: logging.h:232
_sse_metrics_k5_n4
static __always_inline void _sse_metrics_k5_n4(const int16_t *val, const int16_t *out, int16_t *sums, int16_t *paths, int norm)
Definition: conv_acc_sse_impl.h:308
vdecoder::metric_func
void(* metric_func)(const int8_t *, const int16_t *, int16_t *, int16_t *, int)
Definition: conv_acc.c:172
_sse_metrics_k7_n2
static __always_inline void _sse_metrics_k7_n2(const int16_t *val, const int16_t *out, int16_t *sums, int16_t *paths, int norm)
Definition: conv_acc_sse_impl.h:348
vtrellis::outputs
int16_t * outputs
Definition: conv_acc.c:150
traceback
static int traceback(struct vdecoder *dec, uint8_t *out, int term, int len)
Definition: conv_acc.c:468
utils.h
bitswap4
static unsigned bitswap4(unsigned v)
Definition: conv_acc.c:209
osmo_conv_decoder
convolutional decoder state
Definition: conv.h:105
osmo_conv_encode_load_state
void osmo_conv_encode_load_state(struct osmo_conv_encoder *encoder, const ubit_t *input)
Definition: conv.c:94
__attribute__
__attribute__((visibility("hidden")))
Definition: conv_acc.c:50
osmo_panic
void osmo_panic(const char *fmt,...) __attribute__((noreturn))
Terminate the current program with a panic.
Definition: panic.c:75
init_complete
static int init_complete
Definition: conv_acc.c:48
CONV_TERM_TAIL_BITING
@ CONV_TERM_TAIL_BITING
Tail biting.
Definition: conv.h:43
SSE_BRANCH_METRIC_N2
#define SSE_BRANCH_METRIC_N2(M0, M1, M2, M3, M4, M6, M7)
Definition: conv_acc_sse_impl.h:135
osmo_conv_get_output_length
int osmo_conv_get_output_length(const struct osmo_conv_code *code, int len)
Definition: conv.c:54
SSE_BRANCH_METRIC_N4
#define SSE_BRANCH_METRIC_N4(M0, M1, M2, M3, M4, M5)
Definition: conv_acc_sse_impl.h:157
osmo_bit_reversal
uint32_t osmo_bit_reversal(uint32_t x, enum osmo_br_mode k)
generalized bit reversal function
Definition: bits.c:239
bitswap3
static unsigned bitswap3(unsigned v)
Definition: conv_acc.c:203
gen_recursive_state_info
static int gen_recursive_state_info(uint8_t *val, unsigned reg, int16_t *output, const struct osmo_conv_code *code)
Definition: conv_acc.c:328
osmo_conv_encode_flush
int osmo_conv_encode_flush(struct osmo_conv_encoder *encoder, ubit_t *output)
Definition: conv.c:166
t4_rle
static int t4_rle(struct bitvec *bv, unsigned len, bool b)
Make-up codes for a given length.
Definition: bitcomp.c:230
conv_code_recursive
static int conv_code_recursive(const struct osmo_conv_code *code)
Definition: conv_acc.c:177
bitvec_add_array
unsigned int bitvec_add_array(struct bitvec *bv, const uint32_t *array, unsigned int array_len, bool dry_run, unsigned int num_bits)
Add given array to bitvec.
Definition: bitvec.c:688
osmo_conv_decode_scan
int osmo_conv_decode_scan(struct osmo_conv_decoder *decoder, const sbit_t *input, int n)
Definition: conv.c:325
osmo_revbytebits_32
uint32_t osmo_revbytebits_32(uint32_t x)
reverse the bit-order in each byte of a dword
Definition: bits.c:256
SSE_ALIGN
#define SSE_ALIGN
Definition: conv_acc_sse.c:37
vtrellis::sums
int16_t * sums
Definition: conv_acc.c:149
conv_acc_sse_impl.h
osmo_init_logging
int osmo_init_logging(const struct log_info *log_info)
Initialize the osmocom logging framework.
Definition: application.c:115
bitvec_set_u64
int bitvec_set_u64(struct bitvec *bv, uint64_t v, uint8_t num_bits, bool use_lh)
set multiple bits (based on numeric value) at current pos.
Definition: bitvec.c:227
osmo_conv_decode_rewind
void osmo_conv_decode_rewind(struct osmo_conv_decoder *decoder)
Definition: conv.c:295
pbit_t
uint8_t pbit_t
packed bits (8 bits in a byte).
Definition: bits.h:30
gen_output
static unsigned gen_output(struct vstate *state, int val, const struct osmo_conv_code *code)
Definition: conv_acc.c:254
gen_recursive_output
static unsigned gen_recursive_output(struct vstate *state, uint8_t *val, unsigned reg, const struct osmo_conv_code *code, int pos)
Definition: conv_acc.c:296
t4_term
static const unsigned t4_term[2][64]
Definition: bitcomp.c:43
osmo_revbytebits_8
uint32_t osmo_revbytebits_8(uint8_t x)
reverse the bit order in a byte
Definition: bits.c:271
pid
uint32_t pid
process ID
Definition: gsmtap.h:7
osmo_sbit2ubit
void osmo_sbit2ubit(ubit_t *out, const sbit_t *in, unsigned int num_bits)
convert soft bits to unpacked bits
Definition: bits.c:133
conv_decode
static int conv_decode(struct vdecoder *dec, const int8_t *seq, const int *punc, uint8_t *out, int len, int term)
Definition: conv_acc.c:628
signal.h
osmo_conv_decode
int osmo_conv_decode(const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output)
All-in-one convolutional decoding function.
Definition: conv.c:607
osmo_conv_init
static void osmo_conv_init(void)
Definition: conv_acc.c:647
osmo_conv_decode_flush
int osmo_conv_decode_flush(struct osmo_conv_decoder *decoder, const sbit_t *input)
Definition: conv.c:426
bitvec_write_field
int bitvec_write_field(struct bitvec *bv, unsigned int *write_index, uint64_t val, unsigned int len)
write into the vector
Definition: bitvec.c:509
bitvec_alloc
struct bitvec * bitvec_alloc(unsigned int size, TALLOC_CTX *bvctx)
Allocate a bit vector.
Definition: bitvec.c:407
_traceback_rec
static void _traceback_rec(struct vdecoder *dec, unsigned state, uint8_t *out, int len)
Definition: conv_acc.c:451
bitvec
structure describing a bit vector
Definition: bitvec.h:46
bitvec_to_string_r
void bitvec_to_string_r(const struct bitvec *bv, char *str)
prints bit vector to provided string It's caller's responsibility to ensure that we won't shoot him i...
Definition: bitvec.c:542
SSE_NORMALIZE_K5
#define SSE_NORMALIZE_K5(M0, M1, M2, M3)
Definition: conv_acc_sse_impl.h:219
t4_make_up
static const unsigned t4_make_up[2][15]
Definition: bitcomp.c:188
osmo_load32be
static uint32_t osmo_load32be(const void *p)
load unaligned 32-bit integer (big-endian encoding)
Definition: bit32gen.h:89
leading_bits
static unsigned leading_bits(uint8_t x, bool b)
Definition: bitvec.c:556
bitvec_shiftl
void bitvec_shiftl(struct bitvec *bv, unsigned int n)
gen_branch_metrics_n2
static void gen_branch_metrics_n2(int num_states, const int8_t *seq, const int16_t *out, int16_t *metrics)
Definition: conv_acc_generic.c:69
ONE
@ ONE
A one (1) bit.
Definition: bitvec.h:40
osmo_conv_code::next_state
const uint8_t(* next_state)[2]
Next state array
Definition: conv.h:60
osmo_conv_encoder::code
const struct osmo_conv_code * code
for which code?
Definition: conv.h:81
osmo_generate_backtrace
void osmo_generate_backtrace(void)
Generate and print a call back-trace.
Definition: backtrace.c:67
CONV_TERM_FLUSH
@ CONV_TERM_FLUSH
Flush encoder state.
Definition: conv.h:41
osmo_conv_code::K
int K
Constraint length.
Definition: conv.h:54
osmo_conv_decode_init
void osmo_conv_decode_init(struct osmo_conv_decoder *decoder, const struct osmo_conv_code *code, int len, int start_state)
Definition: conv.c:246
__attribute__
__attribute__((visibility("hidden")))
Definition: conv_acc_generic.c:134
osmo_conv_get_input_length
int osmo_conv_get_input_length(const struct osmo_conv_code *code, int len)
Definition: conv.c:48
osmo_conv_code::puncture
const int * puncture
Punctured bits indexes.
Definition: conv.h:65
bytenum_from_bitnum
static unsigned int bytenum_from_bitnum(unsigned int bitnum)
Definition: bitvec.c:51
bitvec_set_bytes
int bitvec_set_bytes(struct bitvec *bv, const uint8_t *bytes, unsigned int count)
set multiple bytes at current pos Assumes MSB first encoding.
Definition: bitvec.c:370
ubit_t
uint8_t ubit_t
unpacked bit (0 or 1): 1 bit per byte
Definition: bits.h:24
ARRAY_SIZE
#define ARRAY_SIZE(x)
Determine number of elements in an array of static size.
Definition: utils.h:14
bitval2mask
static uint8_t bitval2mask(enum bit_value bit, uint8_t bitnum)
Definition: bitvec.c:59
osmo_conv_code::N
int N
Inverse of code rate.
Definition: conv.h:53
gen_path_metrics
static void gen_path_metrics(int num_states, int16_t *sums, int16_t *metrics, int16_t *paths, int norm)
Definition: conv_acc_generic.c:108
osmo_conv_code::next_term_output
const uint8_t * next_term_output
Flush termination output.
Definition: conv.h:62
generate_trellis
static int generate_trellis(struct vdecoder *dec, const struct osmo_conv_code *code)
Definition: conv_acc.c:385
osmo_store16be
static void osmo_store16be(uint16_t x, void *p)
store unaligned 16-bit integer (big-endian encoding)
Definition: bit16gen.h:102
osmo_br_mode
osmo_br_mode
bit-reversal mode for osmo_bit_reversal()
Definition: bits.h:93
vdecoder::k
int k
Definition: conv_acc.c:165
vtrellis::vals
uint8_t * vals
Definition: conv_acc.c:151
logging.h
free_trellis
static void free_trellis(struct vtrellis *trellis)
Definition: conv_acc.c:369
__always_inline
#define __always_inline
Definition: conv_acc_sse_impl.h:30
bitvec_zero
void bitvec_zero(struct bitvec *bv)
force bit vector to all 0 and current bit to the beginnig of the vector
Definition: bitvec.c:578
osmo_store32be
static void osmo_store32be(uint32_t x, void *p)
store unaligned 32-bit integer (big-endian encoding)
Definition: bit32gen.h:102
t4_term_length
static const unsigned t4_term_length[2][64]
Definition: bitcomp.c:178
H
@ H
A CSN.1 "H" bit.
Definition: bitvec.h:42
vdec_deinit
static void vdec_deinit(struct vdecoder *dec)
Definition: conv_acc.c:500
panic.h
bitvec.h
bitvec_rl
unsigned bitvec_rl(const struct bitvec *bv, bool b)
Return number (bits) of uninterrupted bit run in vector starting from the MSB.
Definition: bitvec.c:589
log_init
void int log_init(const struct log_info *inf, void *talloc_ctx)
Initialize the Osmocom logging core.
Definition: logging.c:1075
bitvec_get_bit_pos_high
enum bit_value bitvec_get_bit_pos_high(const struct bitvec *bv, unsigned int bitnr)
check if the bit is L or H for a given position inside a bitvec
Definition: bitvec.c:109
LOGP
#define LOGP(ss, level, fmt, args...)
Log a new message through the Osmocom logging framework.
Definition: logging.h:46
osmo_conv_encode_raw
int osmo_conv_encode_raw(struct osmo_conv_encoder *encoder, const ubit_t *input, ubit_t *output, int n)
Definition: conv.c:137
bitvec_spare_padding
int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit)
pad all remaining bits up to num_bits
Definition: bitvec.c:303
bit_value_to_char
char bit_value_to_char(enum bit_value v)
convert enum to corresponding character
Definition: bitvec.c:527
vstate_lshift
static unsigned vstate_lshift(unsigned reg, int k, int val)
Definition: conv_acc.c:183
bitvec::cur_bit
unsigned int cur_bit
cursor to the next unused bit
Definition: bitvec.h:47
osmo_conv_code::len
int len
Definition: conv.h:55
osmo_ubit2sbit
void osmo_ubit2sbit(sbit_t *out, const ubit_t *in, unsigned int num_bits)
convert unpacked bits to soft bits
Definition: bits.c:121
bitswap
static unsigned bitswap(unsigned v, unsigned n)
Definition: conv_acc.c:227
vdecoder
Definition: conv_acc.c:163
osmo_log_backtrace
void osmo_log_backtrace(int subsys, int level)
Generate and log a call back-trace.
Definition: backtrace.c:79
_conv_encode_do_output
static int _conv_encode_do_output(struct osmo_conv_encoder *encoder, uint8_t out, ubit_t *output)
Definition: conv.c:107
gen_branch_metrics_n3
static void gen_branch_metrics_n3(int num_states, const int8_t *seq, const int16_t *out, int16_t *metrics)
Definition: conv_acc_generic.c:81
osmo_conv_decoder::n_states
int n_states
number of states
Definition: conv.h:108
bitvec_set_uint
int bitvec_set_uint(struct bitvec *bv, unsigned int in, unsigned int count)
set multiple bits (based on numeric value) at current pos.
Definition: bitvec.c:251
osmo_pbit2ubit_ext
int osmo_pbit2ubit_ext(ubit_t *out, unsigned int out_ofs, const pbit_t *in, unsigned int in_ofs, unsigned int num_bits, int lsb_mode)
convert packed bits to unpacked bits (extended options)
Definition: bits.c:216
bitvec_get_uint
int bitvec_get_uint(struct bitvec *bv, unsigned int num_bits)
get multiple bits (based on numeric value) from current pos
Definition: bitvec.c:271
osmo_ubit2pbit_ext
int osmo_ubit2pbit_ext(pbit_t *out, unsigned int out_ofs, const ubit_t *in, unsigned int in_ofs, unsigned int num_bits, int lsb_mode)
convert unpacked bits to packed bits (extended options)
Definition: bits.c:191
SSE_DEINTERLEAVE_K5
#define SSE_DEINTERLEAVE_K5(M0, M1, M2, M3)
Definition: conv_acc_sse_impl.h:80
sighup_hdlr
static void sighup_hdlr(int signal)
Definition: application.c:87
_sse_metrics_k5_n2
static __always_inline void _sse_metrics_k5_n2(const int16_t *val, const int16_t *out, int16_t *sums, int16_t *paths, int norm)
Definition: conv_acc_sse_impl.h:266
MAX_AE
#define MAX_AE
Definition: conv.c:238
__attribute__
__attribute__((visibility("hidden")))
Include common SSE implementation.
Definition: conv_acc_sse_avx.c:68
bitswap5
static unsigned bitswap5(unsigned v)
Definition: conv_acc.c:215
log_set_all_filter
void log_set_all_filter(struct log_target *target, int)
Enable the LOG_FLT_ALL log filter.
Definition: logging.c:615
osmo_conv_decode_deinit
void osmo_conv_decode_deinit(struct osmo_conv_decoder *decoder)
Definition: conv.c:315
osmo_conv_code
structure describing a given convolutional code
Definition: conv.h:52
bitvec_fill
int bitvec_fill(struct bitvec *bv, unsigned int num_bits, enum bit_value fill)
fill num_bits with \fill starting from the current position
Definition: bitvec.c:291
INIT_POINTERS
#define INIT_POINTERS(simd)
Definition: conv_acc.c:36
bitvec_unhex
int bitvec_unhex(struct bitvec *bv, const char *src)
read hexadecimap string into a bit vector
Definition: bitvec.c:463
vtrellis
Definition: conv_acc.c:147
bitvec_unpack
unsigned int bitvec_unpack(struct bitvec *bv, const uint8_t *buffer)
Copy buffer of unpacked bits into bit vector.
Definition: bitvec.c:449
application.h
bitvec_get_nth_set_bit
unsigned int bitvec_get_nth_set_bit(const struct bitvec *bv, unsigned int n)
get the Nth set bit inside the bit vector
Definition: bitvec.c:132
t4_make_up_length
static const unsigned t4_make_up_length[2][15]
Definition: bitcomp.c:183
L
@ L
A CSN.1 "L" bit.
Definition: bitvec.h:41
osmo_nibble_shift_right
void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in, unsigned int num_nibbles)
Shift unaligned input to octet-aligned output.
Definition: bits.c:73