Comcast / Comcast/caption-inspector
Off-by-one pre-defined pen and window styles for DTVCC/708
- Dominant language
- C
- Stars
- 100
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
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:
https://github.com/Comcast/caption-inspector/blob/476326f08a43ce38ecd1ea58b8910d7015e80cac/src/sink/dtvcc_output.c#L116-L118
And pen style IDs starting at 0:
https://github.com/Comcast/caption-inspector/blob/476326f08a43ce38ecd1ea58b8910d7015e80cac/src/sink/dtvcc_output.c#L73-L75
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:
https://github.com/Comcast/caption-inspector/blob/476326f08a43ce38ecd1ea58b8910d7015e80cac/include/dtvcc_decode.h#L376-L382
Contributor guide
Assessment
This issue has not been assessed yet.