ZVBI Library 0.2.42
Functions
Error correction functions

Helper functions to decode sliced VBI data. More...

Functions

void vbi_par (uint8_t *p, unsigned int n)
 
int vbi_unpar (uint8_t *p, unsigned int n)
 
void vbi_ham24p (uint8_t *p, unsigned int c)
 
int vbi_unham24p (const uint8_t *p)
 
_vbi_inline unsigned int vbi_rev8 (unsigned int c)
 
_vbi_inline unsigned int vbi_rev16 (unsigned int c)
 
_vbi_inline unsigned int vbi_rev16p (const uint8_t *p)
 
_vbi_inline unsigned int vbi_par8 (unsigned int c)
 
_vbi_inline int vbi_unpar8 (unsigned int c)
 
_vbi_inline unsigned int vbi_ham8 (unsigned int c)
 
_vbi_inline int vbi_unham8 (unsigned int c)
 
_vbi_inline int vbi_unham16p (const uint8_t *p)
 

Detailed Description

Helper functions to decode sliced VBI data.

Function Documentation

◆ vbi_par()

void vbi_par ( uint8_t *  p,
unsigned int  n 
)
Parameters
pArray of unsigned bytes.
nSize of array.

Of each byte of the array, changes the most significant bit to make the number of set bits odd.

Since
0.2.12

◆ vbi_unpar()

int vbi_unpar ( uint8_t *  p,
unsigned int  n 
)
Parameters
pArray of unsigned bytes.
nSize of array.

Tests the parity and clears the most significant bit of each byte of the array.

Returns
A negative value if any byte of the array had even parity (sum of bits modulo 2 is 0).
Since
0.2.12

◆ vbi_ham24p()

void vbi_ham24p ( uint8_t *  p,
unsigned int  c 
)
Parameters
pA Hamming 24/18 protected 24 bit word will be stored here, last significant byte first, lsb first transmitted.
cInteger between 0 ... 1 << 18 - 1.

Encodes an 18 bit word with Hamming 24/18 protection as specified in ETS 300 706, Section 8.3.

Since
0.2.27

◆ vbi_unham24p()

int vbi_unham24p ( const uint8_t *  p)
Parameters
pPointer to a Hamming 24/18 protected 24 bit word, last significant byte first, lsb first transmitted.

Decodes a Hamming 24/18 protected byte triplet as specified in ETS 300 706, Section 8.3.

Returns
Triplet data bits D18 [msb] ... D1 [lsb] or a negative value if the triplet contained uncorrectable errors.
Since
0.2.12

◆ vbi_rev8()

_vbi_inline unsigned int vbi_rev8 ( unsigned int  c)
Parameters
cUnsigned byte.

Reverses the bits of the argument.

Returns
Data bits 0 [msb] ... 7 [lsb].
Since
0.2.12

Referenced by vbi_decode_teletext_8302_cni(), and vbi_decode_teletext_8302_pdc().

◆ vbi_rev16()

_vbi_inline unsigned int vbi_rev16 ( unsigned int  c)
Parameters
cUnsigned 16 bit word.

Reverses (or "reflects") the bits of the argument.

Returns
Data bits 0 [msb] ... 15 [lsb].
Since
0.2.12

◆ vbi_rev16p()

_vbi_inline unsigned int vbi_rev16p ( const uint8_t *  p)
Parameters
pPointer to a 16 bit word, last significant byte first.

Reverses (or "reflects") the bits of the argument.

Returns
Data bits 0 [msb] ... 15 [lsb].
Since
0.2.12

Referenced by vbi_decode_teletext_8301_cni().

◆ vbi_par8()

_vbi_inline unsigned int vbi_par8 ( unsigned int  c)
Parameters
cUnsigned byte.
Returns
Changes the most significant bit of the byte to make the number of set bits odd.
Since
0.2.12

◆ vbi_unpar8()

_vbi_inline int vbi_unpar8 ( unsigned int  c)
Parameters
cUnsigned byte.
Returns
If the byte has odd parity (sum of bits modulo 2 is 1) the byte AND 127, otherwise a negative value.
Since
0.2.12

Referenced by vbi_xds_demux_feed().

◆ vbi_ham8()

_vbi_inline unsigned int vbi_ham8 ( unsigned int  c)
Parameters
cInteger between 0 ... 15.

Encodes a nibble with Hamming 8/4 protection as specified in EN 300 706, Section 8.2.

Returns
Hamming encoded unsigned byte, lsb first transmitted.
Since
0.2.12

◆ vbi_unham8()

_vbi_inline int vbi_unham8 ( unsigned int  c)
Parameters
cHamming 8/4 protected byte, lsb first transmitted.

Decodes a Hamming 8/4 protected byte as specified in EN 300 706, Section 8.2.

Returns
Data bits (D4 [msb] ... D1 [lsb]) or a negative value if the byte contained uncorrectable errors.
Since
0.2.12

Referenced by vbi_decode_teletext_8302_pdc(), and vbi_idl_demux_feed().

◆ vbi_unham16p()

_vbi_inline int vbi_unham16p ( const uint8_t *  p)
Parameters
pPointer to a Hamming 8/4 protected 16 bit word, last significant byte first, lsb first transmitted.

Decodes a Hamming 8/4 protected byte pair as specified in EN 300 706, Section 8.2.

Returns
Data bits D4 [msb] ... D1 of first byte and D4 ... D1 [lsb] of second byte, or a negative value if any of the bytes contained uncorrectable errors.
Since
0.2.12

Referenced by vbi_decode_teletext_8302_cni(), vbi_decode_teletext_8302_pdc(), and vbi_pfc_demux_feed().