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.
RAW images preserve superior fidelity and rich scene information compared to RGB, making them essential for tasks in challenging imaging conditions. To alleviate the high cost of data collection, recent RGB-to-RAW conversion methods aim to synthesize RAW images from RGB. However, they overlook two key challenges: (i) the reconstruction difficulty varies with pixel intensity, and (ii) multi-camera conversion requires camera-specific adaptation. To address these issues, we propose SpiralDiff, a diffusion-based framework tailored for RGB-to-RAW conversion with a signal-dependent noise weighting strategy that adapts reconstruction fidelity across intensity levels. In addition, we introduce CamLoRA, a camera-aware lightweight adaptation module that enables a unified model to adapt to different camera-specific ISP characteristics. Extensive experiments on four benchmark datasets demonstrate the superiority of SpiralDiff in RGB-to-RAW conversion quality and its downstream benefits in RAW-based object detection. Our code and model are available at https://github.com/Chuancy-TJU/SpiralDiff.
Huanjing Yue, Shangbin Xie, Cong Cao +4
School of Electrical and Information Engineering, Tianjin University · State key laboratory of Smart Power Distribution Equipment and System, Tianjin University · Individual
In-camera JPEG previews are ubiquitous in raw image formats and provide an sRGB reference at negligible storage cost. Although existing metadata-based reconstruction frameworks can exploit this side information when recovering raw images, their context models often become computationally expensive especially at high resolution, eg, 4K raw image, given that attention mechanisms scale quadratically with feature maps, hindering its practical application. To address these limitations, we propose MambaRaw, a JPEG-conditioned metadata-based raw image reconstruction framework that uses State Space Models (SSMs) to estimate entropy parameters efficiently. Our key contribution comprises a Spatial-Energy Coupled Context Modeling mechanism with two lightweight modules: (1) TileMambaBlock, which performs Mamba-style selective scanning only on information-dense tiles to improve the efficiency; and (2) Energy-Aware Refinement (EAR), an identity-initialized residual module that enhance feature representation to match the long-tail energy distribution of raw signals. Extensive experiments on three camera datasets (Sony, Olympus, Samsung) show consistent improvements over strong metadata-based baselines and set a new state of the art for JPEG-guided raw reconstruction with great efficiency. Notably, at low metadata bitrates, MambaRaw increases PSNR by 1.2--1.4 dB and reduces end-to-end coding latency by about 9%. Code is released at https://github.com/Peizeli1/MambaRaw.
Peize Li, Fanhu Zeng, Tongda Xu +5
Institute for AI Industry Research (AIR), Tsinghua University · King’s College London · Dalian University of Technology +3
Image reconstruction from corrupted images is crucial across many domains. Most reconstruction networks are trained on post-ISP sRGB images, even though the image-signal-processing pipeline irreversibly mixes colors, clips dynamic range, and blurs fine detail. This paper uses the rain degradation problem as a use case to show that these losses are avoidable, and demonstrates that learning directly on raw Bayer mosaics yields superior reconstructions. To substantiate the claim, we (i) evaluate post-ISP and Bayer reconstruction pipelines, (ii) curate Raw-Rain, the first public benchmark of real rainy scenes captured in both 12-bit Bayer and bit-depth-matched sRGB, and (iii) introduce Information Conservation Score (ICS), a color-invariant metric that aligns more closely with human opinion than PSNR or SSIM. On the test split, our raw-domain model improves sRGB results by up to +0.99 dB PSNR and +1.2% ICS, while running faster with half of the GFLOPs. The results advocate an ISP-last paradigm for low-level vision and open the door to end-to-end learnable camera pipelines.
Nate Rothschild, Moshe Kimhi, Avi Mendelson +1
Department of ECE, Technion, Israel · Department of CS, Technion, Israel · School of ECE, Ben-Gurion University