OBHS: An Optimized Block Huffman Scheme for Real-Time Audio Compression
Muntahi Safwan Mahfi, Md. Manzurul Hasan, Gahangir Hossain
TL;DR
OBHS addresses real-time lossless audio compression by partitioning audio into fixed-size blocks and applying per-block Huffman coding with canonical representations, enabling low-latency, memory-efficient decoding. The method integrates a fallback mechanism to guarantee no output expansion and reports linear time complexity $O(n)$ with per-block cost dominated by $O(k\log k)$ operations for tree construction and canonical code generation. Experimental results show up to $93$ ms latency plus $5$ ms processing and up to $93.6%$ compression for silence, with competitive performance on pink noise, tones, and real-world audio, making OBHS suitable for resource-constrained streaming. These contributions offer a practical, real-time-friendly alternative to heavier predictive codecs, balancing compression ratio, latency, and device requirements for streaming scenarios.
Abstract
In this paper, we introduce OBHS (Optimized Block Huffman Scheme), a novel lossless audio compression algorithm tailored for real-time streaming applications. OBHS leverages block-wise Huffman coding with canonical code representation and intelligent fallback mechanisms to achieve high compression ratios while maintaining low computational complexity. Our algorithm partitions audio data into fixed-size blocks, constructs optimal Huffman trees for each block, and employs canonical codes for efficient storage and transmission. Experimental results demonstrate that OBHS attains compression ratios of up to 93.6% for silence-rich audio and maintains competitive performance across various audio types, including pink noise, tones, and real-world recordings. With a linear time complexity of O(n) for n audio samples, OBHS effectively balances compression efficiency and computational demands, making it highly suitable for resource-constrained real-time audio streaming scenarios.
