sz3 /libcimbar

Optimized implementation for color-icon-matrix barcodes

★ 6,531⑂ 486👁 31▤ 19
C++Created 2020-04-10cimbar.org
+0
Daily
+0
Weekly
+30
Monthly
6,531
stars
486
forks
31
watchers
–
prs
–
issues
19
releases

README

INTRODUCTION | ABOUT | CFC | LIBCIMBAR
 DETAILS | PERFORMANCE | TODO

 libcimbar: Color Icon Matrix Barcodes

Behold: an experimental barcode format for air-gapped data transfer.

It can sustain speeds of 850 kilobits/s (~106 KB/s) using just a computer monitor and a smartphone camera!





 Explain?

The encoder outputs an animated barcode to a computer or smartphone screen:
 Encoder web app: https://cimbar.org

While the decoder is a cell phone app that uses the phone camera to read the animated barcode:
 Decoder android app: https://github.com/sz3/cfc

No internet/bluetooth/NFC/etc is used. All data is transmitted through the camera lens. You can try it out yourself, or take my word that it works. :)

 How does it work?

cimbar is a high-density 2D barcode format. Data is stored in a grid of colored tiles -- bits are encoded based on which tile is chosen, and which color is chosen to draw the tile. Reed Solomon error correction is applied on the data, to account for the lossy nature of the video - digital decoding. Sub-1% error rates are expected, and corrected.

libcimbar, this optimized implementation, includes a simple protocol for file encoding built on fountain codes (wirehair) and zstd compression. Files of up to 33MB (after compression!) are encoded in a series of cimbar codes, which can be output as images or a live video feed. Once enough distinct image frames have been decoded successfully, the file will be reconstructed and decompressed successfully. This is true even if the images are received out of order, or if some have been corrupted or are missing.

 Platforms

The code is written in C++, and developed/tested on amd64+linux, arm64+android (decoder only), and emscripten+WASM (encoder only). It probably works, or can be made to work, on other platforms.

Crucially, because the encoder compiles to asmjs and wasm, it can run on anything with a modern web browser. For offline use, you can either install cimbar.org as a progressive web app, or download the latest release of cimbar_js.html, save it locally, and open it in your web browser.

 Library dependencies

OpenCV and GLFW (+ OpenGL ES headers) must be installed before building. All other dependencies are included in the source tree.

 opencv - https://opencv.org/ (libopencv-dev)
 GLFW - https://github.com/glfw/glfw (libglfw3-dev)
 GLES3/gl3.h - libgles2-mesa-dev
 base - https://github.com/r-lyeh-archived/base
 catch2 - https://github.com/catchorg/Catch2
 concurrentqueue - https://github.com/cameron314/concurrentqueue
 cxxopts - https://github.com/jarro2783/cxxopts (used for command line tools)
 fmt - https://github.com/fmtlib/fmt
 intx - https://github.com/chfast/intx
 libcorrect - https://github.com/quiet/libcorrect
 libpopcnt - https://github.com/kimwalisch/libpopcnt
 PicoSHA2 - https://github.com/okdshin/PicoSHA2 (used for testing)
 stb_image - https://github.com/nothings/stb (for loading embedded pngs)
 wirehair - https://github.com/catid/wirehair
 zstd - https://github.co

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON