sz3 / libcimbar

Optimized implementation for color-icon-matrix barcodes
https://cimbar.org
Mozilla Public License 2.0
4.24k stars 307 forks source link

Update decoder objects for per-frame mode switching #94

Closed sz3 closed 8 months ago

sz3 commented 9 months ago

Motivation: per-frame bouncing between color_mode, so we can test success/failure for mode B/4C and pick the one that's working.

Details: When running a decoder across multiple frames, we have certain state (loaded hashes for imagehash hamming distance, for example) that is longer lived -- that we don't want to run each frame. This currently is stored in the CimbDecoder (also the fountain_decoder_sink, though that's not relevant to this change). To allow us to switch between modes, we need the CimbDecoder to not store color_mode, but rather take it as an argument where required.

Misc: There are other ways to accomplish this, but this change seems like the best immediate path forward. The actual technical requirement is: (1) to run in different modes (2) on different threads (3) at the same time.