xine-lib: xine-lib-1.2.13/src/spu_dec/cc_decoder.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
cc_decoder.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <sys/time.h>`
`#include <inttypes.h>`
`#include <xine/xine_internal.h>`
`#include <xine/video_out.h>`
`#include <xine/xineutils.h>`
`#include <xine/osd.h>`
`#include "cc_decoder.h"`

## Data Structures
struct | colorinfo_s
struct | cc_renderer_s
struct | cc_attribute_s
struct | cc_char_cell_s
struct | cc_row_s
struct | cc_buffer_s
struct | cc_memory_s
struct | cc_decoder_s

## Macros
#define | NTSC_FRAME_DURATION 3003
#define | CC_ROWS 15
#define | CC_COLUMNS 32
#define | CC_CHANNELS 2
#define | CAP_BG_COL 1
#define | NUM_FG_COL 7
#define | TRANSP_SPACE

## Typedefs
typedef struct colorinfo_s | colorinfo_t
typedef struct cc_attribute_s | cc_attribute_t
typedef struct cc_char_cell_s | cc_char_cell_t
typedef struct cc_row_s | cc_row_t
typedef struct cc_buffer_s | cc_buffer_t
typedef struct cc_memory_s | cc_memory_t

## Enumerations
enum | { WHITE , GREEN , BLUE , CYAN , RED , YELLOW , MAGENTA , BLACK , TRANSPARENT }

## Functions
static void | get_font_metrics (osd_renderer_t *renderer, const char *fontname, int font_size, int *maxw, int *maxh)
static int | good_parity (uint16_t data)
static clut_t | interpolate_color (clut_t src, clut_t dest, int steps, int current_step)
static void | ccrow_fill_transp (cc_row_t *rowbuf)
static int | ccrow_find_next_text_part (cc_row_t *this, int pos)
static int | ccrow_find_end_of_text_part (cc_row_t *this, int pos)
static int | ccrow_find_current_attr (cc_row_t *this, int pos)
static int | ccrow_find_next_attr_change (cc_row_t *this, int pos, int lastpos)
static void | ccrow_set_attributes (cc_renderer_t *renderer, cc_row_t *this, int pos)
static void | ccrow_render (cc_renderer_t *renderer, cc_row_t *this, int rownum)
static int | ccbuf_has_displayable (cc_buffer_t *this)
static void | ccbuf_add_char (cc_buffer_t *this, uint8_t c)
static void | ccbuf_set_cursor (cc_buffer_t *this, int row, int column, int underline, int italics, int color)
static void | ccbuf_apply_attribute (cc_buffer_t *this, cc_attribute_t *attr)
static void | ccbuf_tab (cc_buffer_t *this, int tabsize)
static void | ccbuf_render (cc_renderer_t *renderer, cc_buffer_t *this)
static void | ccmem_clear (cc_memory_t *this)
static void | ccmem_init (cc_memory_t *this)
static void | ccmem_exit (cc_memory_t *this)
static void | cc_renderer_build_palette (cc_renderer_t *this)
static int64_t | cc_renderer_calc_vpts (cc_renderer_t *this, int64_t pts, uint32_t ntsc_frame_offset)
static int | cc_renderer_on_display (cc_renderer_t *this)
static void | cc_renderer_hide_caption (cc_renderer_t *this, int64_t vpts)
static void | cc_renderer_show_caption (cc_renderer_t *this, cc_buffer_t *buf, int64_t vpts)
static void | cc_renderer_free_osd_object (cc_renderer_t *this)
static void | cc_renderer_adjust_osd_object (cc_renderer_t *this)
cc_renderer_t * | cc_renderer_open (osd_renderer_t *osd_renderer, metronom_t *metronom, cc_state_t *cc_state, int video_width, int video_height)
void | cc_renderer_close (cc_renderer_t *this_obj)
void | cc_renderer_update_cfg (cc_renderer_t *this_obj, int video_width, int video_height)
static void | cc_set_channel (cc_decoder_t *this, int channel)
static cc_buffer_t * | active_ccbuffer (cc_decoder_t *this)
static int | cc_onscreen_displayable (cc_decoder_t *this)
static void | cc_hide_displayed (cc_decoder_t *this)
static void | cc_show_displayed (cc_decoder_t *this)
static void | cc_swap_buffers (cc_decoder_t *this)
static void | cc_decode_standard_char (cc_decoder_t *this, uint8_t c1, uint8_t c2)
static void | cc_decode_PAC (cc_decoder_t *this, int channel, uint8_t c1, uint8_t c2)
static void | cc_decode_ext_attribute (cc_decoder_t *this, int channel, uint8_t c1, uint8_t c2)
static void | cc_decode_special_char (cc_decoder_t *this, int channel, uint8_t c1, uint8_t c2)
static void | cc_decode_midrow_attr (cc_decoder_t *this, int channel, uint8_t c1, uint8_t c2)
static void | cc_decode_misc_control_code (cc_decoder_t *this, int channel, uint8_t c1, uint8_t c2)
static void | cc_decode_tab (cc_decoder_t *this, int channel, uint8_t c1, uint8_t c2)
static void | cc_decode_EIA608 (cc_decoder_t *this, uint16_t data)
void | decode_cc (cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len, int64_t pts)
cc_decoder_t * | cc_decoder_open (cc_state_t *cc_state)
void | cc_decoder_close (cc_decoder_t *this)

## Variables
static const int | text_colormap [7]
static const colorinfo_t | cc_text_trans [7]
static const colorinfo_t | cc_text_solid [7]
static const uint8_t | cc_text_trans_alpha [TEXT_PALETTE_SIZE]
static const uint8_t | cc_text_solid_alpha [TEXT_PALETTE_SIZE]
static const colorinfo_t *const | cc_text_palettes [2]
static const uint8_t *const | cc_alpha_palettes [2]
static const int | rowdata []
static const uint8_t | specialchar []
static const int | chartbl [128]
| Character translation table.
static const int | parity_table [256]
| Parity table for packets.

## Macro Definition Documentation

## ◆ CAP_BG_COL

#define CAP_BG_COL 1

Referenced by ccrow_render().

## ◆ CC_CHANNELS

#define CC_CHANNELS 2

## ◆ CC_COLUMNS

#define CC_COLUMNS 32

Referenced by cc_renderer_update_cfg(), ccbuf_add_char(), ccbuf_tab(), and ccrow_render().

## ◆ CC_ROWS

#define CC_ROWS 15

Referenced by cc_renderer_update_cfg(), ccbuf_has_displayable(), ccbuf_render(), and ccrow_render().

## ◆ NTSC_FRAME_DURATION

#define NTSC_FRAME_DURATION 3003

Referenced by cc_renderer_calc_vpts().

## ◆ NUM_FG_COL

#define NUM_FG_COL 7

Referenced by cc_renderer_build_palette().

## ◆ TRANSP_SPACE

#define TRANSP_SPACE

Value:
0x19 /* code for transparent space, essentially
arbitrary */

Referenced by ccrow_fill_transp(), ccrow_find_end_of_text_part(), and ccrow_find_next_text_part().

## Typedef Documentation

## ◆ cc_attribute_t

typedef struct cc_attribute_s cc_attribute_t

## ◆ cc_buffer_t

typedef struct cc_buffer_s cc_buffer_t

## ◆ cc_char_cell_t

typedef struct cc_char_cell_s cc_char_cell_t

## ◆ cc_memory_t

typedef struct cc_memory_s cc_memory_t

## ◆ cc_row_t

typedef struct cc_row_s cc_row_t

## ◆ colorinfo_t

typedef struct colorinfo_s colorinfo_t

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
WHITE |
GREEN |
BLUE |
CYAN |
RED |
YELLOW |
MAGENTA |
BLACK |
TRANSPARENT |

## Function Documentation

## ◆ active_ccbuffer()

static cc_buffer_t * active_ccbuffer | ( | cc_decoder_t * | this | ) |
| static

References cc_memory_s::channel, and cc_memory_s::channel_no.

Referenced by cc_decode_midrow_attr(), cc_decode_PAC(), cc_decode_special_char(), cc_decode_standard_char(), and cc_decode_tab().

## ◆ cc_decode_EIA608()

static void cc_decode_EIA608 | ( | cc_decoder_t * | this,
|  | uint16_t | data )
| static

References cc_decode_ext_attribute(), cc_decode_midrow_attr(), cc_decode_misc_control_code(), cc_decode_PAC(), cc_decode_special_char(), cc_decode_standard_char(), and cc_decode_tab().

Referenced by decode_cc().

## ◆ cc_decode_ext_attribute()

static void cc_decode_ext_attribute | ( | cc_decoder_t * | this,
|  | int | channel,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References cc_set_channel().

Referenced by cc_decode_EIA608().

## ◆ cc_decode_midrow_attr()

static void cc_decode_midrow_attr | ( | cc_decoder_t * | this,
|  | int | channel,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References active_ccbuffer(), cc_attribute_s::background, BLACK, cc_set_channel(), ccbuf_apply_attribute(), cc_attribute_s::foreground, cc_attribute_s::italic, cc_attribute_s::underline, and WHITE.

Referenced by cc_decode_EIA608().

## ◆ cc_decode_misc_control_code()

static void cc_decode_misc_control_code | ( | cc_decoder_t * | this,
|  | int | channel,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References cc_hide_displayed(), cc_set_channel(), cc_swap_buffers(), and ccmem_clear().

Referenced by cc_decode_EIA608().

## ◆ cc_decode_PAC()

static void cc_decode_PAC | ( | cc_decoder_t * | this,
|  | int | channel,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References active_ccbuffer(), cc_set_channel(), ccbuf_set_cursor(), rowdata, and WHITE.

Referenced by cc_decode_EIA608().

## ◆ cc_decode_special_char()

static void cc_decode_special_char | ( | cc_decoder_t * | this,
|  | int | channel,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References active_ccbuffer(), cc_set_channel(), ccbuf_add_char(), and specialchar.

Referenced by cc_decode_EIA608().

## ◆ cc_decode_standard_char()

static void cc_decode_standard_char | ( | cc_decoder_t * | this,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References active_ccbuffer(), ccbuf_add_char(), and chartbl.

Referenced by cc_decode_EIA608().

## ◆ cc_decode_tab()

static void cc_decode_tab | ( | cc_decoder_t * | this,
|  | int | channel,
|  | uint8_t | c1,
|  | uint8_t | c2 )
| static

References active_ccbuffer(), cc_set_channel(), and ccbuf_tab().

Referenced by cc_decode_EIA608().

## ◆ cc_decoder_close()

void cc_decoder_close | ( | cc_decoder_t * | this | ) |

References ccmem_exit().

Referenced by spucc_do_close().

## ◆ cc_decoder_open()

cc_decoder_t * cc_decoder_open | ( | cc_state_t * | cc_state | ) |

References ccmem_init(), and NULL.

Referenced by spucc_do_init().

## ◆ cc_hide_displayed()

static void cc_hide_displayed | ( | cc_decoder_t * | this | ) |
| static

References cc_renderer_calc_vpts(), cc_renderer_hide_caption(), and cc_renderer_on_display().

Referenced by cc_decode_misc_control_code(), and cc_swap_buffers().

## ◆ cc_onscreen_displayable()

static int cc_onscreen_displayable | ( | cc_decoder_t * | this | ) |
| static

References ccbuf_has_displayable().

Referenced by cc_show_displayed().

## ◆ cc_renderer_adjust_osd_object()

static void cc_renderer_adjust_osd_object | ( | cc_renderer_t * | this | ) |
| static

References cc_renderer_free_osd_object(), height, and width.

Referenced by cc_renderer_update_cfg().

## ◆ cc_renderer_build_palette()

static void cc_renderer_build_palette | ( | cc_renderer_t * | this | ) |
| static

References cc_alpha_palettes, cc_text_palettes, interpolate_color(), NUM_FG_COL, OSD_TEXT1, and TEXT_PALETTE_SIZE.

Referenced by cc_renderer_update_cfg().

## ◆ cc_renderer_calc_vpts()

static int64_t cc_renderer_calc_vpts | ( | cc_renderer_t * | this,
|  | int64_t | pts,
|  | uint32_t | ntsc_frame_offset )
| static

References metronom_s::got_spu_packet, and NTSC_FRAME_DURATION.

Referenced by cc_hide_displayed(), and cc_show_displayed().

## ◆ cc_renderer_close()

void cc_renderer_close | ( | cc_renderer_t * | this_obj | ) |

References cc_renderer_free_osd_object().

Referenced by spucc_do_close().

## ◆ cc_renderer_free_osd_object()

static void cc_renderer_free_osd_object | ( | cc_renderer_t * | this | ) |
| static

References cc_renderer_hide_caption(), and NULL.

Referenced by cc_renderer_adjust_osd_object(), cc_renderer_close(), and cc_renderer_update_cfg().

## ◆ cc_renderer_hide_caption()

static void cc_renderer_hide_caption | ( | cc_renderer_t * | this,
|  | int64_t | vpts )
| static

Referenced by cc_hide_displayed(), cc_renderer_free_osd_object(), and cc_renderer_show_caption().

## ◆ cc_renderer_on_display()

static int cc_renderer_on_display | ( | cc_renderer_t * | this | ) |
| static

Referenced by cc_hide_displayed().

## ◆ cc_renderer_open()

cc_renderer_t * cc_renderer_open | ( | osd_renderer_t * | osd_renderer,
|  | metronom_t * | metronom,
|  | cc_state_t * | cc_state,
|  | int | video_width,
|  | int | video_height )

References cc_renderer_update_cfg(), and NULL.

Referenced by spucc_do_init().

## ◆ cc_renderer_show_caption()

static void cc_renderer_show_caption | ( | cc_renderer_t * | this,
|  | cc_buffer_t * | buf,
|  | int64_t | vpts )
| static

References cc_renderer_hide_caption(), ccbuf_render(), and MAX.

Referenced by cc_show_displayed().

## ◆ cc_renderer_update_cfg()

void cc_renderer_update_cfg | ( | cc_renderer_t * | this_obj,
|  | int | video_width,
|  | int | video_height )

References cc_state_s::can_cc, cc_state_s::cc_cfg, CC_COLUMNS, cc_renderer_adjust_osd_object(), cc_renderer_build_palette(), cc_renderer_free_osd_object(), CC_ROWS, cc_renderer_s::cc_state, cc_config_s::font, cc_config_s::font_size, get_font_metrics(), cc_renderer_s::height, cc_config_s::italic_font, MAX, cc_renderer_s::max_char_height, cc_renderer_s::max_char_width, cc_renderer_s::osd_renderer, cc_renderer_s::video_height, cc_renderer_s::video_width, cc_renderer_s::width, cc_renderer_s::x, and cc_renderer_s::y.

Referenced by cc_renderer_open(), and spucc_update_intrinsics().

## ◆ cc_set_channel()

static void cc_set_channel | ( | cc_decoder_t * | this,
|  | int | channel )
| static

Referenced by cc_decode_ext_attribute(), cc_decode_midrow_attr(), cc_decode_misc_control_code(), cc_decode_PAC(), cc_decode_special_char(), and cc_decode_tab().

## ◆ cc_show_displayed()

static void cc_show_displayed | ( | cc_decoder_t * | this | ) |
| static

References cc_onscreen_displayable(), cc_renderer_calc_vpts(), and cc_renderer_show_caption().

Referenced by cc_swap_buffers().

## ◆ cc_swap_buffers()

static void cc_swap_buffers | ( | cc_decoder_t * | this | ) |
| static

References cc_hide_displayed(), and cc_show_displayed().

Referenced by cc_decode_misc_control_code().

## ◆ ccbuf_add_char()

static void ccbuf_add_char | ( | cc_buffer_t * | this,
|  | uint8_t | c )
| static

References cc_row_s::attr_chg, cc_char_cell_s::attributes, cc_char_cell_s::c, CC_COLUMNS, ccrow_fill_transp(), cc_row_s::cells, cc_char_cell_s::midrow_attr, cc_row_s::num_chars, cc_row_s::pac_attr, cc_row_s::pac_attr_chg, and cc_row_s::pos.

Referenced by cc_decode_special_char(), cc_decode_standard_char(), and ccbuf_apply_attribute().

## ◆ ccbuf_apply_attribute()

static void ccbuf_apply_attribute | ( | cc_buffer_t * | this,
|  | cc_attribute_t * | attr )
| static

References cc_row_s::attr_chg, cc_char_cell_s::attributes, ccbuf_add_char(), cc_row_s::cells, chartbl, and cc_row_s::pos.

Referenced by cc_decode_midrow_attr().

## ◆ ccbuf_has_displayable()

static int ccbuf_has_displayable | ( | cc_buffer_t * | this | ) |
| static

References CC_ROWS.

Referenced by cc_onscreen_displayable().

## ◆ ccbuf_render()

static void ccbuf_render | ( | cc_renderer_t * | renderer,
|  | cc_buffer_t * | this )
| static

References CC_ROWS, and ccrow_render().

Referenced by cc_renderer_show_caption().

## ◆ ccbuf_set_cursor()

static void ccbuf_set_cursor | ( | cc_buffer_t * | this,
|  | int | row,
|  | int | column,
|  | int | underline,
|  | int | italics,
|  | int | color )
| static

References cc_row_s::attr_chg, cc_attribute_s::background, BLACK, cc_attribute_s::foreground, cc_attribute_s::italic, cc_row_s::pac_attr, cc_row_s::pac_attr_chg, cc_row_s::pos, and cc_attribute_s::underline.

Referenced by cc_decode_PAC().

## ◆ ccbuf_tab()

static void ccbuf_tab | ( | cc_buffer_t * | this,
|  | int | tabsize )
| static

References CC_COLUMNS, and cc_row_s::pos.

Referenced by cc_decode_tab().

## ◆ ccmem_clear()

static void ccmem_clear | ( | cc_memory_t * | this | ) |
| static

Referenced by cc_decode_misc_control_code(), and ccmem_init().

## ◆ ccmem_exit()

static void ccmem_exit | ( | cc_memory_t * | this | ) |
| static

Referenced by cc_decoder_close().

## ◆ ccmem_init()

static void ccmem_init | ( | cc_memory_t * | this | ) |
| static

References ccmem_clear().

Referenced by cc_decoder_open().

## ◆ ccrow_fill_transp()

static void ccrow_fill_transp | ( | cc_row_t * | rowbuf | ) |
| static

References cc_char_cell_s::c, cc_row_s::cells, cc_char_cell_s::midrow_attr, cc_row_s::num_chars, cc_row_s::pos, and TRANSP_SPACE.

Referenced by ccbuf_add_char().

## ◆ ccrow_find_current_attr()

static int ccrow_find_current_attr | ( | cc_row_t * | this,
|  | int | pos )
| static

Referenced by ccrow_render().

## ◆ ccrow_find_end_of_text_part()

static int ccrow_find_end_of_text_part | ( | cc_row_t * | this,
|  | int | pos )
| static

References TRANSP_SPACE.

Referenced by ccrow_render().

## ◆ ccrow_find_next_attr_change()

static int ccrow_find_next_attr_change | ( | cc_row_t * | this,
|  | int | pos,
|  | int | lastpos )
| static

Referenced by ccrow_render().

## ◆ ccrow_find_next_text_part()

static int ccrow_find_next_text_part | ( | cc_row_t * | this,
|  | int | pos )
| static

References TRANSP_SPACE.

Referenced by ccrow_render().

## ◆ ccrow_render()

static void ccrow_render | ( | cc_renderer_t * | renderer,
|  | cc_row_t * | this,
|  | int | rownum )
| static

References CAP_BG_COL, cc_renderer_s::cap_display, cc_state_s::cc_cfg, CC_COLUMNS, CC_ROWS, cc_renderer_s::cc_state, ccrow_find_current_attr(), ccrow_find_end_of_text_part(), ccrow_find_next_attr_change(), ccrow_find_next_text_part(), ccrow_set_attributes(), cc_config_s::center, osd_renderer_s::filled_rect, osd_renderer_s::get_text_size, cc_renderer_s::height, cc_renderer_s::max_char_height, cc_renderer_s::max_char_width, cc_renderer_s::osd_renderer, osd_renderer_s::render_text, text_colormap, and cc_renderer_s::width.

Referenced by ccbuf_render().

## ◆ ccrow_set_attributes()

static void ccrow_set_attributes | ( | cc_renderer_t * | renderer,
|  | cc_row_t * | this,
|  | int | pos )
| static

References cc_renderer_s::cap_display, cc_state_s::cc_cfg, cc_renderer_s::cc_state, cc_config_s::font, cc_config_s::font_size, cc_attribute_s::italic, cc_config_s::italic_font, cc_renderer_s::osd_renderer, and osd_renderer_s::set_font.

Referenced by ccrow_render().

## ◆ decode_cc()

void decode_cc | ( | cc_decoder_t * | this,
|  | uint8_t * | buffer,
|  | uint32_t | buf_len,
|  | int64_t | pts )

References cc_decode_EIA608(), and good_parity().

Referenced by spudec_decode_data().

## ◆ get_font_metrics()

static void get_font_metrics | ( | osd_renderer_t * | renderer,
|  | const char * | fontname,
|  | int | font_size,
|  | int * | maxw,
|  | int * | maxh )
| static

References osd_renderer_s::free_object, osd_renderer_s::get_text_size, MAX, osd_renderer_s::new_object, osd_renderer_s::set_encoding, and osd_renderer_s::set_font.

Referenced by cc_renderer_update_cfg().

## ◆ good_parity()

static int good_parity | ( | uint16_t | data | ) |
| static

References parity_table.

Referenced by decode_cc().

## ◆ interpolate_color()

static clut_t interpolate_color | ( | clut_t | src,
|  | clut_t | dest,
|  | int | steps,
|  | int | current_step )
| static

References clut_s::cb, CLUT_Y_CR_CB_INIT, clut_s::cr, clut_s::foo, and clut_s::y.

Referenced by cc_renderer_build_palette().

## Variable Documentation

## ◆ cc_alpha_palettes

const uint8_t* const cc_alpha_palettes[2]
| static

Initial value:
= {
cc_text_trans_alpha,
cc_text_solid_alpha
}
cc_text_solid_alpha
static const uint8_t cc_text_solid_alpha[TEXT_PALETTE_SIZE]
Definition cc_decoder.c:203
cc_text_trans_alpha
static const uint8_t cc_text_trans_alpha[TEXT_PALETTE_SIZE]
Definition cc_decoder.c:199

Referenced by cc_renderer_build_palette().

## ◆ cc_text_palettes

const colorinfo_t* const cc_text_palettes[2]
| static

Initial value:
= {
cc_text_trans,
cc_text_solid
}
cc_text_trans
static const colorinfo_t cc_text_trans[7]
Definition cc_decoder.c:96
cc_text_solid
static const colorinfo_t cc_text_solid[7]
Definition cc_decoder.c:147

Referenced by cc_renderer_build_palette().

## ◆ cc_text_solid

const colorinfo_t cc_text_solid[7]
| static

## ◆ cc_text_solid_alpha

const uint8_t cc_text_solid_alpha[TEXT_PALETTE_SIZE]
| static

Initial value:
= {
0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
}

## ◆ cc_text_trans

const colorinfo_t cc_text_trans[7]
| static

## ◆ cc_text_trans_alpha

const uint8_t cc_text_trans_alpha[TEXT_PALETTE_SIZE]
| static

Initial value:
= {
0, 8, 9, 10, 11, 12, 15, 15, 15, 15, 15
}

## ◆ chartbl

const int chartbl[128]
| static

Initial value:
= {
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
'\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
'\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
'\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
'\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27',
'\x28', '\x29', '\xe1', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f',
'\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37',
'\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f',
'\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47',
'\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f',
'\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57',
'\x58', '\x59', '\x5a', '\x5b', '\xe9', '\x5d', '\xed', '\xf3',
'\xfa', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67',
'\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f',
'\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77',
'\x78', '\x79', '\x7a', '\xe7', '\xf7', '\xd1', '\xf1', '\xa4'
}

Character translation table.

EIA 608 codes are not all the same as ASCII

The code to produce the characters table would be the following:

static void build_char_table(void) { int i; // first the normal ASCII codes for (i = 0; i < 128; i++) chartbl[i] = (char) i; // now the special codes chartbl[0x2a] = 225; // á chartbl[0x5c] = 233; // é chartbl[0x5e] = 237; // í chartbl[0x5f] = 243; // ó chartbl[0x60] = 250; // ú chartbl[0x7b] = 231; // ç chartbl[0x7c] = 247; // ÷ chartbl[0x7d] = 209; // Ñ chartbl[0x7e] = 241; // ñ chartbl[0x7f] = 164; // ¤ FIXME: should be a solid block ('█'; U+2588) }

Referenced by cc_decode_standard_char(), and ccbuf_apply_attribute().

## ◆ parity_table

const int parity_table[256]
| static

Initial value:
= {
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0
}

Parity table for packets.

CC codes use odd parity for error detection, since they originally were transmitted via noisy video signals.

The code to produce the parity table would be the following:

static int parity(uint8_t byte) { int i; int ones = 0;

for (i = 0; i < 7; i++) { if (byte & (1 << i)) ones++; }

return ones & 1; }

static void build_parity_table(void) { uint8_t byte; int parity_v; for (byte = 0; byte <= 127; byte++) { parity_v = parity(byte); // CC uses odd parity (i.e., # of 1's in byte is odd.) parity_table[byte] = parity_v; parity_table[byte | 0x80] = !parity_v; } }

Referenced by good_parity().

## ◆ rowdata

const int rowdata[]
| static

Initial value:
= {10, -1, 0, 1, 2, 3, 11, 12, 13, 14, 4, 5, 6,
7, 8, 9}

Referenced by cc_decode_PAC().

## ◆ specialchar

const uint8_t specialchar[]
| static

Initial value:
= {
174 , 176 , 189 , 191 ,
'T' , 162 , 163 , 182 ,
224 , 0x19 ,232 , 226 ,
234 , 238 , 244 , 251
}

Referenced by cc_decode_special_char().

## ◆ text_colormap

const int text_colormap[7]
| static

Initial value:
= {
OSD_TEXT1, OSD_TEXT2, OSD_TEXT3, OSD_TEXT4, OSD_TEXT5, OSD_TEXT6, OSD_TEXT7
}
OSD_TEXT2
#define OSD_TEXT2
Definition osd.h:282
OSD_TEXT4
#define OSD_TEXT4
Definition osd.h:284
OSD_TEXT7
#define OSD_TEXT7
Definition osd.h:287
OSD_TEXT5
#define OSD_TEXT5
Definition osd.h:285
OSD_TEXT3
#define OSD_TEXT3
Definition osd.h:283
OSD_TEXT1
#define OSD_TEXT1
Definition osd.h:281
OSD_TEXT6
#define OSD_TEXT6
Definition osd.h:286

Referenced by ccrow_render().