Comcast/caption-inspector

Off-by-one pre-defined pen and window styles for DTVCC/708

micolous opened this issue · 0 comments

CEA-708-E DefineWindow (DF0 - DF7) declares:

  • window style ID: when non-zero, specifies 1 of 7 present window attribute styles...
  • pen style ID: when non-zero, specifies 1 of 7 present pen attribute styles...

Tables 26 and 27 define these presets, starting at 1.

Caption Inspector interprets the window style IDs starting at 0:

const char* predefWinStyle[8] = {
"608-PopUp", "PopUp-TransBG", "PopUp-Cntrd", "608-RollUp", "RollUp-TransBG", "RollUp-Cntrd", "TickerTape", "Unknown"
};

And pen style IDs starting at 0:

const char* predefPenStyle[8] = {
"Default", "MonoSerif", "ProportSerif", "MonoSanSerif", "ProportSanSerif", "MonoSanSerif-TransBG", "ProportSanSerif-TransBG", "Unknown"
};

As a result, Caption Inspector interprets every window and pen style off-by-one, eg: Pen Style 5 (ProportSanSerif, NTSC Style Prop w/o Serif) is reported as MonoSanSerif-TransBG.

The fix would be to remove the "Unknown" value at the end of each of the predefPenStyle and predefWinStyle arrays, and replace it with an "Undefined" value at the start of each array.

Relatedly, WINDOW_STYLE_* defines are also incorrect, and start at 0 instead of 1:

#define WINDOW_STYLE_608_POPUP 0x00
#define WINDOW_STYLE_POPUP_TRANS_BG 0x01
#define WINDOW_STYLE_POPUP_CENTERED 0x02
#define WINDOW_STYLE_608_ROLLUP 0x03
#define WINDOW_STYLE_ROLLUP_TRANS_BG 0x04
#define WINDOW_STYLE_ROLLUP_CENTERED 0x05
#define WINDOW_STYLE_TICKER_TAPE 0x06