szatmary / libcaption

Free open-source CEA608 / CEA708 closed-caption encoder/decoder
MIT License
150 stars 64 forks source link

Replace bitfields in caption_frame_cell_t and caption_frame_state_t s… #61

Open sdroege opened 4 years ago

sdroege commented 4 years ago

…tructs with uint8_t

Contrary to what one might believe, this actually reduces the size of the structs due to alignment constraints. On Linux x86-64 clang/gcc it reduces the size of the caption_frame_t struct from 7760 bytes to 6800 bytes, on Windows x86-64 MSVC from 11600 bytes to 6800 bytes.

It also causes simpler and potentially faster assembly to be generated as the values can be directly accessed as uint8_t instead of having to extract the corresponding bits with bitwise operations.