How wangxuan95/nbli works
Project type and purpose
• This is a command-line, C++ based, single-threaded image compressor/decompressor.
• It has two deliverables:
• NBLI: prototype implementation (source + binary)
• fNBLI: optimized AVX2-accelerated binary only
• It reads .pgm/.ppm/.pnm/.png, applies a lossless (or optional lossy) entropy-coding pipeline, and writes .nbli/.fnbli files (and vice versa).
File structure
• Top-level:
• LICENSE, README.md
• NBLI.exe, fNBLI.exe (binaries)
• image/ (sample images)
• src/ (all source code)
• src/ hierarchy:
• src/NBLI – core compression engine
– main.cpp (CLI arg parsing + orchestrator)
– NBLI.cpp / NBLI.h (dispatcher for compress/decompress)
– AdvancedPredictor.h, PlaneModel.h (prediction stage)
– AutoReorder.h (pixel reordering module)
– GolombCodeTree.h, rANS.h, CRC32.h (entropy coder & metadata)
• src/imageio – image format abstraction
– imageio_pnm.c, imageio_png.c (PNM/PNG decoders)
– uPNG/ (tiny PNG library)
– imageio.h (high-level I/O interface)
• src/FileIO.h – file read/write helper
• Build scripts are ad-hoc g++ commands (static link, -O3).
README for additional insights
• Clearly states:
• Two modes: compress (encode) and decompress (decode).
• Switches control verbosity, CRC, distortion, predictor type, coder type.
• fNBLI leverages parallel ANS (AVX2) for speed.
Detailed capture of components
• Break the compression engine into sub-blocks: Predictor, Reorder, Entropy Coder, CRC32.
• Main.cpp as orchestrator, indicating call sequence.