u/Darkoman78

Built a Managed C# Lossless Image Codec that outperforms WebP by 1.4% - 3.3% (DAI Codec Evaluation)
▲ 4 r/csharp

Built a Managed C# Lossless Image Codec that outperforms WebP by 1.4% - 3.3% (DAI Codec Evaluation)

Hi everyone,

I wanted to share a project I've been working on: DAI (Dynamic Adaptive Image) Codec. It is a standalone lossless image codec written entirely in managed C# (targeting .NET Standard 2.0).

The main goal was to achieve higher compression ratios than WebP without relying on native C++ wrappers (like libwebp) which can be painful to manage in cross-platform .NET environments.

Key Benchmarks (Maximum Compression Ratio):

- Kodak Dataset: DAI is 3.31% smaller than WebP on average.

- DIV2K (2K High-Res Dataset): DAI is 1.47% smaller than WebP overall.

- Delta vs JPEG XL: Around +6.12% to +9.83% behind state-of-the-art.

How it works under the hood:

It uses a fully integer-reversible intra-channel correlation filter (similar to Y-CoCg-R), recursive QuadTree Variable Block-Size (VBS) partitioning from 64x64 down to 8x8, adaptive predictive modes (MedP/LOCO-I variant), and custom base-packing for specific palette streams, all feeding into a byte-aligned Brotli context window.

Project Status & Evaluation Repo:

To protect the proprietary spatial/RDO engine, the Encoder core is kept compiled inside a closed-source assembly (lib/DaiEngine.dll). However, the full Windows Forms interactive testing app, the standalone Decoder core pipeline, and the benchmarking tools are 100% open-source inside the repository.

You can clone the repo, run the WinForms sandbox app on your own BMP images, and verify the bit-exact 1:1 lossless integrity and compression ratios:

https://github.com/darkon1978-ai/DAI-Codec

Would love to hear your feedback on the architecture or ideas on optimizing the pure-managed streaming pipeline layout!

u/Darkoman78 — 2 days ago