#include <atsc_randomizer.h>
Public Member Functions | |
atsc_randomizer () | |
void | reset () |
reset randomizer LFSR | |
void | randomize (atsc_mpeg_packet_no_sync &out, atsc_mpeg_packet &in) |
randomize (whiten) mpeg packet and remove leading MPEG-2 sync byte | |
void | derandomize (atsc_mpeg_packet &out, atsc_mpeg_packet_no_sync &in) |
derandomize (de-whiten) mpeg packet and add leading MPEG-2 sync byte | |
Private Member Functions | |
unsigned char | output () |
return current output value | |
void | clk () |
clock LFSR; advance to next state. | |
unsigned char | output_and_clk () |
return current output value and advance to next state | |
Static Private Member Functions | |
void | initialize_output_map () |
Generate the table used in the fast_output_map function. | |
unsigned char | slow_output_map (int st) |
unsigned char | fast_output_map (int st) |
Private Attributes | |
unsigned int | state |
Static Private Attributes | |
const unsigned int | preload_value = 0x018f |
const unsigned int | mask = 0xa638 |
unsigned char | output_map [1<< 14] |
bool | output_map_initialized_p = false |
The data randomizer described in ATSC standard A/53B. See figure D4 on page 54.
|
|
|
clock LFSR; advance to next state.
|
|
derandomize (de-whiten) mpeg packet and add leading MPEG-2 sync byte
|
|
|
|
Generate the table used in the fast_output_map function. The table has 16K byte entries, but because of how is is used, only 256 entries end up being resident in the cache. This seems like a good use of memory. We can get away with a 16K table because the low two bits of the state do not affect the output function. By shifting right those two bits we shrink the table, and also get better cache line utilization. |
|
return current output value
|
|
return current output value and advance to next state
|
|
randomize (whiten) mpeg packet and remove leading MPEG-2 sync byte
|
|
reset randomizer LFSR must be called during the Data Segment Sync interval prior to the first data segment. I.e., the LFSR is reset prior to the first field of each VSB data frame. |
|
|
|
|
|
|
|
|
|
|
|
|