This repository contains a practical implementation of the binary Golay C(23,12) code and an end-to-end pipeline that: reads 24-bit BMP images, splits the byte stream into 12-bit payloads, encodes them to 23-bit codewords, simulates transmission through a Binary Symmetric Channel (BSC), decodes with IMLD, and reconstructs the image. An experiment harness is included to evaluate Bit Error Rate (BER) and timings.
- Python 3.10+ (3.13 recommended)
- Install dependencies:
pip install pillowOptional (to make a single exe):
pip install pyinstaller
pyinstaller --onefile main.pyRun the interactive demo:
python .\main.pyFollow the menu to test:
1— enter a 12-bit vector (interactive)2— encode/decode a short text string3— run the full image pipeline on a 24-bit BMP file
Use experiments.py to run a set of trials over several channel error
probabilities p and collect averaged BER and timing results. The script
will create a 1 MB dummy file (dummy_1MB.bin) if one isn't present.
Run experiments:
python .\experiments.pyConfigurable parameters inside experiments.py:
p_values— list of channel error probabilities to testmax_workers— number of worker processes used for parallel stagesnum_runs— number of independent runs perp(default in the script: 10)
Outputs produced by experiments:
experiments_results.csv— row per run with timings and error countsexperiments_results_avg.csv— per-paverages acrossnum_runs
- The code uses
multiprocessingand spawns worker processes viaProcessPoolExecutor. On Windows the spawn overhead and antivirus (e.g., Windows Defender) can increase timing variance. If you see large fluctuations, try loweringmax_workersor reusing a long-lived pool. - The script calls
multiprocessing.freeze_support()to be compatible with frozen executables and Windows spawn semantics.
main.py— interactive demo and image pipelinefunctions.py— core encode/decode/channel/packing helpersexperiments.py— experiment harness that saves CSVsreport.tex— LaTeX report (includes PGFPlots templates usingexperiments_results_avg.csv)