RAWIC: Bit-Depth Adaptive Lossless Raw Image Compression
Authors: Chunhang Zheng, Tongda Xu, Mingli Xie, Yan Wang, Dou Li
Organizations: School of Electronics, Peking University, Beijing, 100871, China · Institute for AI Industry Research (AIR), Tsinghua University, Beijing, 100084, China · the University of Chinese Academy of Sciences, Beijing, 100190, China
Raw images preserve linear sensor measurements and high bit-depth information crucial for advanced vision tasks and photography applications, yet their storage remains challenging due to large file sizes, varying bit depths, and sensor-dependent characteristics. Existing learned lossless compression methods mainly target 8-bit sRGB images, while raw reconstruction approaches are inherently lossy and rely on camera-specific assumptions. To address these challenges, we introduce RAWIC, a bit-depth-adaptive learned lossless compression framework for Bayer-pattern raw images. We first convert single-channel Bayer data into a four-channel RGGB format and partition it into patches. For each patch, we compute its bit depth and use it as auxiliary input to guide compression. A bit-depth-adaptive entropy model is then designed to estimate patch distributions conditioned on their bit depths. This architecture enables a single model to handle raw images from diverse cameras and bit depths. Experiments show that RAWIC consistently surpasses traditional lossless codecs, achieving an average 7.7% bitrate reduction over JPEG-XL. Our code is available at https://github.com/chunbaobao/RAWIC.
Figures & tables
Fig. 1: The comparison between previous bit-depth-specific lossless image compression methods and our proposed bit-depth adaptive lossless raw image compression method. (a) Exiting methods train the model a specific bit depth and can only compress raw images with the same bit depth. (b) Our proposed method uses a single model to compress raw images across different bit depths.
Fig. 2: Visualization of raw image and corresponding pixel-wise bit depth map. The pixel-wise bit depth is computed as ⌈log2(value+1)⌉ . It can be observed that different regions in the raw image exhibit varying bit depths.
Fig. 3: The overall architecture of RAWIC. The input raw image is first converted to an RGGB four-channel format and split into patches. Each patch is then processed by a bit-depth adaptive entropy model that estimates the pixel distribution conditioned on the bit depth of the patch. Q denotes the quantization operation. AE and AD represent arithmetic encoder and arithmetic decoder, respectively.
Codec
Canon 1Ds MkIII
Canon 600D
Olympus EPL6
Panasonic GX1
Samsung NX2000
RAISE
QOI [ 31 ]
11.36 (+67.3%)
12.09 (+61.9%)
10.22 (+100.0%)
10.97 (+83.1%)
10.73 (+84.1%)
12.86 (+64.9%)
PNG [ 7 ]
10.28 (+51.4%)
10.96 (+46.7%)
8.13 (+59.1%)
9.45 (+57.8%)
9.16 (+57.1%)
11.37 (+45.8%)
WebP [ 13 ]
7.80 (+14.9%)
8.44 (+13.0%)
5.88 (+15.1%)
7.07 (+18.0%)
6.66 (+14.2%)
8.82 (+13.1%)
FLIF [ 30 ]
7.82 (+15.2%)
8.34 (+11.7%)
6.12 (+19.8%)
7.02 (+17.2%)
6.86 (+17.7%)
8.86 (+13.6%)
JPEG2000 [ 29 ]
7.34 (+8.1%)
8.04 (+7.7%)
5.70 (+11.6%)
6.67 (+11.3%)
6.58 (+12.9%)
8.58 (+10.0%)
JPEG-LS [ 36 ]
7.25 (+6.8%)
7.87 (+5.4%)
5.67 (+11.0%)
6.54 (+9.2%)
6.49 (+11.3%)
8.38 (+7.4%)
TABLE I: Lossless image compression performance (bpp) of our proposed method compared to other lossless image codec Canon 1Ds MkIII, Canon 600D, Olympus EPL6, Panasonic GX1, Samsung NX2000 and RAISE. The best results are highlighted in bold . We show the difference (%) between our method and each traditional codec in green color. Note that our method includes the bitrates for storing bit depths.
Codec
DIV2K
CLIC.m
Kodak
L3C [ 21 ]
9.27 (+22.9%)
7.92 (+23.4%)
9.78 (+15.5%)
RC [ 22 ]
9.24 (+22.6%)
7.62 (+18.7%)
-
SReC [ 8 ]
8.47 (+12.3%)
7.32 (+14.0%)
9.10 (+7.4%)
Near-Lossless [ 3 ]
8.43 (+11.8%)
7.53 (+17.3%)
9.12 (+7.7%)
iVPF [ 40 ]
8.04 (+6.6%)
7.17 (+11.7%)
-
iFlow [ 39 ]
7.71 (+2.3%)
6.78 (+5.6%)
-
TABLE II: Lossless RGB image compression performance (bpp) compared to other learned lossless image codecs.
Codec
Canon 600D
Olympus EPL6
PNG [ 7 ]
4.55/0.59
4.56/0.46
WebP [ 13 ]
5.99/0.26
3.86/0.18
JPEG-XL [ 1 ]
6.08/1.38
6.62/1.46
FLIF [ 30 ]
25.97/9.36
20.41/9.36
RAWIC (Ours)
45.7/119.3
37.1/98.4
TABLE III: Average runtime (sec.) of RAWIC compared to other codecs (Encoding/Decoding time).
Codec
768 × 512
1024 × 768
2048 × 1536
WebP [ 13 ]
0.15/0.01
0.20/0.01
2.23/0.05
JPEG-XL [ 1 ]
0.24/0.06
0.39/0.09
2.97/0.53
BPG [ 6 ]
0.23/0.19
0.44/0.32
5.71/1.42
FLIF [ 30 ]
4.13/0.66
7.31/1.13
33.07/5.27
SReC [ 8 ]
0.58/0.59
1.10/1.16
4.11/4.58
L3C [ 21 ]
0.70/0.64
1.30/1.26
4.93/5.06
TABLE IV: Average runtime (sec.) of RAWIC compared to other codecs (Encoding/Decoding time). OOM: out of memory.
Dataset
Bit-Depth Adaptive (Ours)
Fixed Bit Depth
Canon 1Ds MkIII
6.79
8.78 (+29.3%)
Canon 600D
7.47
8.77 (+17.4%)
Olympus EPL6
5.11
8.98 (+75.7%)
Panasonic GX1
5.99
9.20 (+53.6%)
Samsung NX2000
5.83
9.37 (+60.7%)
RAISE
7.80
9.29 (+19.1%)
TABLE V: Ablation study on the effectiveness of the bit-depth adaptive entropy model.
Dataset
All-in-One Model (Ours)
Camera-Specific Model
Canon 1Ds MkIII
6.79
7.91 (+16.5%)
Canon 600D
7.47
8.85 (+18.5%)
Olympus EPL6
5.11
6.79 (+32.9%)
Panasonic GX1
5.99
6.46 (+7.8%)
Samsung NX2000
5.83
5.82 (-0.1%)
RAISE
7.79
7.80 (+0.1%)
TABLE VI: Ablation study on the effectiveness of the all-in-one model.
School of Electrical and Information Engineering, Tianjin University · State key laboratory of Smart Power Distribution Equipment and System, Tianjin University · Individual