Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

NBLI is a fast, better lossless image compression algorithm. The optimized version (fNBLI) can get 1.5x compression ratio, 8x faster encoding, and 1.2x faster decoding compared to PNG. It can also beat the SOTA JPEG-XL on photographs.

License

NotificationsYou must be signed in to change notification settings

WangXuan95/NBLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

languagebuildbuild

NBLI Image Compression

NBLI (new-bee lossless image,v0.4) is a fast, better lossless compression algorithm, which support bothRGB 24-bit andGray 8-bit image. This repo provide:

  • fNBLI : The optimized NBLI, currently only provide executable file without source code.
  • NBLI : The prototype of NBLI, provide both executable file and source code.

 

Compared to the popular state-of-the-art lossless image formats,fNBLI is outstanding in both speed and compression ratio.

Lossless FormatsCompressed Size (vs. PNG)Compress SpeedDecompress Speed
BMF (-s)-35.07%1.3 MB/s1.5 MB/s
Gralic-34.32%4.2 MB/s3.5 MB/s
NBLI (-g)-30.37%14.7 MB/s17.0 MB/s
JPEG-XL (-e 8)-30.25%0.6 MB/s14.5 MB/s
fNBLI-29.79%94.8 MB/s149.1 MB/s
JPEG-XL (-e 6)-28.63%2.4 MB/s19.1 MB/s
JPEG-XL (-e 3)-26.53%19.2 MB/s27.9 MB/s
WEBP (-5)-22.53%3.7 MB/s82.8 MB/s
JPEG-XL (-e 1)-13.49%95.2 MB/s71.0 MB/s
PNG (optipng)0.00%0.9 MB/s153.7 MB/s
JPEG2000+4.60%12.8 MB/s14.9 MB/s
PNG+5.13%12.2 MB/s121.5 MB/s
Uncompressed+114.77%

The dataset of above comparison is thetraining image set ofCLIC2021 competition, which includes585 RGB 24-bit images, totaling4GB (the downloaded zip file is about 2GB). All above compressor/decompressor are tested in single-threaded, SeeLossless-Image-Compression-Benchmark for detail.

 

Compile NBLI.exe

Compile in Windows CMD

If you installed MinGW Compiler for Windows, you can run following command to compile NBLI, getting the executable fileNBLI.exe

g++ src\NBLI\main.cpp src\imageio\*.c src\imageio\uPNG\*.c src\NBLI\NBLI.cpp-static-O3-Wall-oNBLI.exe

Compile in Linux

Run following command to compile NBLI, getting the binary fileNBLI

g++ src/NBLI/main.cpp  src/imageio/*.c src/imageio/uPNG/*.c src/NBLI/NBLI.cpp -static -O3 -Wall -o NBLI

 

Use NBLI.exe

RunNBLI.exe without any parameters to display its usage:

> .\NBLI.exe|----------------------------------------------------------------------------------|| NBLI: new-bee lossless image codec (single-threaded, v0.4, 202409)||   by https://github.com/WangXuan95/||----------------------------------------------------------------------------------|| Usage:||   NBLI [-switches]<in1> [-o<out1>]  [<in2> [-o<out2]]  ...|||| To compress:||<in>  can be .pgm, .ppm, .pnm, or .png||<out> can be .nbli. It will be generatedif not specified.|||| To decompress:||<in>  can be .nbli||<out> can be .pgm, .ppm, .pnm, or .png. It will be generatedif not specified.|||| switches: -v: verbose||           -f: force overwrite of output file||           -x: putting CRC32 when compressing||           -0~7: distortion level. 0=lossless (default), 1~7=lossy||           -g: use golomb arithmetic coding tree instead of ANS coding (slower)||           -a: use advanced predictor (extremely slow)||----------------------------------------------------------------------------------|

Take the images I provided in the./image/ folder as examples :

Compress a .png file to a .nbli file :

NBLI.exe -vf image\RGB.png -o RGB.nbli

Compress a .png file to a .nbli file, use Golomb coding tree (-g) and Advanced predictor (-a) to obtain higher compression ratio :

NBLI.exe -vfga image\RGB.png -o RGB.nbli

Compress a .png file to a .nbli file, set distortion level to 1 (lossy!!) :

NBLI.exe -vf1 image\RGB.png -o RGB.nbli

Decompress the .nbli file back to a .png file :

NBLI.exe -vf RGB.nbli -o RGB.png

 

Use fNBLI.exe

RunfNBLI.exe without any parameters to display its usage:

> .\fNBLI.exe|----------------------------------------------------------------------------------|| fNBLI: fast new-bee lossless image codec (single-threaded, v0.4, 202409)||   by https://github.com/WangXuan95/||----------------------------------------------------------------------------------|| this CPU: AVX2 supported||----------------------------------------------------------------------------------|| Usage:||   fNBLI [-switches]<in1> [-o<out1>]  [<in2> [-o<out2]]  ...|||| To compress:||<in>  can be .pgm, .ppm, .pnm, or .png||<out> can be .fnbli. It will be generatedif not specified.|||| To decompress:||<in>  can be .fnbli||<out> can be .pgm, .ppm, .pnm, or .png. It will be generatedif not specified.|||| switches: -v: verbose||           -f: force overwrite of output file||           -x: putting CRC32 when compressing||----------------------------------------------------------------------------------|

Take the images I provided in the./image/ folder as examples :

Compress a .pgm file (Gray image) to a .fnbli file :

fNBLI.exe -vf image\Gray.pgm -o Gray.fnbli

Compress a .ppm file (RGB image) to a .fnbli file :

fNBLI.exe -vf image\RGB.ppm -o RGB.fnbli

Compress a .png file to .fnbli file :

fNBLI.exe -vf image\RGB.png -o RGB.fnbli

Decompress the .fnbli file back to a .ppm file :

fNBLI.exe -vf RGB.fnbli -o RGB.ppm

Decompress the .fnbli file back to a .png file :

fNBLI.exe -vf RGB.fnbli -o RGB.png

 

Acknowledgments

Thank the bottle of beer I drank on the evening after my PhD dissertation, which inspired me to come up with a novel parallel entropy encoding method that does not affect the compression ratio, which is the basis offNBLI.

As forNBLI, Its main method is not novel. The following works and peoples need to be mentioned:

About

NBLI is a fast, better lossless image compression algorithm. The optimized version (fNBLI) can get 1.5x compression ratio, 8x faster encoding, and 1.2x faster decoding compared to PNG. It can also beat the SOTA JPEG-XL on photographs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp