A deblocking JPEG decoder

Overview

Knusperli

The goal of Knusperli is to reduce blocking artifacts in decoded JPEG images, by interpreting quantized DCT coefficients in the image data as an interval, rather than a fixed value, and choosing the value from that interval that minimizes discontinuities at block boundaries.

a traditional JPEG decoder (Imagemagick 7.0.8-59) Knusperli
baboon JPEG, zoomed baboon Knusperli, zoomed
baboon JPEG baboon Knusperli

Building

Knusperli builds with Bazel:

CC=gcc bazel build :knusperli
bazel-bin/knusperli input.jpg output.png

Details

A JPEG encoder quantizes DCT coefficients by rounding coefficients to the nearest multiple of the elements of the quantization matrix. For every coefficient, there is an interval of values that would round to the same multiple. A traditional decoder uses the center of this interval to reconstruct the image. Knusperli instead chooses the value in the interval that reduces discontinuities at block boundaries. The coefficients that Knusperli uses, would have rounded to the same values that are stored in the JPEG image.

Disclaimer

This is not an officially supported Google product.

Issues
  • Replace the picture of Lena

    Replace the picture of Lena

    Fixes #4 Some people find the picture of Lena offensive, so this commit replaces it by another well-known picture in the image compression community: mandrill.jpg

    See: http://sipi.usc.edu/database/database.php?volume=misc&image=10#top

    new README.md, rendered

    opened by lovasoa 5
  • bazel build fails during evaluating WORKSPACE file

    bazel build fails during evaluating WORKSPACE file

    # bazel version
    Build label: 0.23.0
    Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
    Build time: Tue Feb 26 17:42:16 2019 (1551202936)
    Build timestamp: 1551202936
    Build timestamp as int: 1551202936
    

    here the actual error-message:

    # CC=gcc bazel build :knusperli
    ERROR: /home/bastian/software/knusperli/WORKSPACE:1:1: name 'new_git_repository' is not defined
    ERROR: Error evaluating WORKSPACE file
    ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
    ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
    INFO: Elapsed time: 0.142s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully (0 packages loaded)
    

    I did not changed anything, this is a fresh checkout and the WORKSPACE file has newer changed according to git history. What I'am doing wrong?

    opened by bittorf 2
  • Use an alternative to Lenna for image samples

    Use an alternative to Lenna for image samples

    The Lenna/Lena image is from a Playboy centrefold. The image compression community has been moving away from its use since the 1990's.

    There are plenty of alternative images that you can use to demonstrate deblocking, including some that have been around nearly as long as Lenna, such as Mandrill or Peppers, available here: http://sipi.usc.edu/database/database.php?volume=misc&image=13#top

    Note also that SIPI has removed access to Lenna as well as other images of dubious origin.

    opened by cocoademon 1
  • Fix

    Fix "warning: control reaches end of non-void function" in decode.cc

    I discovered that there's no explicit return statement at the end of int main() function while moving from C++ to Rust in my fork. Bazel doesn't report this warning at all, even with -Wall.

    opened by ziemek99 0
  • Fix .gitignore

    Fix .gitignore

    .gitignore doesn't work at all because of trailing slashes, which is wrong because Bazel "directories" are actually symlinks and should be treated as files. This PR simplifies the rule, too.

    opened by ziemek99 0
  • Added fuzzers to be run with OSS-Fuzz.

    Added fuzzers to be run with OSS-Fuzz.

    Hi maintainers,

    It would be nice to have this project fuzzed by way of OSS-Fuzz, which is a service run by Google that performs continuous fuzzing of open source projects.

    Over here: https://github.com/google/oss-fuzz/pull/5016 I have set up the necessary artifacts to get the project integrated. In that PR you also see the fuzzer attached, but it would be nicer to have the fuzzer integrated into the upstream project itself rather than keeping it in OSS-Fuzz - so if this PR gets merged I will remove it from OSS-Fuzz. For integration, the only thing we need email of the maintainers that will be receiving access to bug reports, coverage reports and similar.

    If you have any questions you can ask me, but as this is a Google open source project I assume you can reach out internally to @inferno-chromium

    opened by DavidKorczynski 0
  • Unexpected end of input

    Unexpected end of input

    I wanted to test this so I saved a new JPEG image in MS Paint (this), but I am getting an error when I try to convert this image:

    Unexpected end of input: pos=230 need=162 len=273
    Error reading jpeg data from input file.
    

    This image is in yuv420p. When I convert the image with ffmpeg to a new JPEG file, it works on it.

    opened by IllidanS4 1
  • Deleting on-topic comments without consent in issue #4

    Deleting on-topic comments without consent in issue #4

    @jyrkialakuijala After saying "Thank you everyone for sharing your views on this topic.", you deleted all on-topic comments that you could. One-sidedly. And I gotta tell you that is a pretty nasty thing to do. You have no right to silence people on an open platform like this one for contributing to a valid discussion.

    Link to issue #4 for reference.

    opened by tagcup 0
Owner
Google
Google ❤️ Open Source
Google
An 'embedded-friendly' (aka Arduino) JPEG image encoding library

Starting in the late 80's I wrote my own imaging codecs for the existing standards (CCITT G3/G4 was the first). I soon added GIF, JPEG and not long after that, the PNG specification was ratified. All of this code was "clean room" - written just from the specification. I used my imaging library in many projects and products over the years and recently decided that some of my codecs could get a new lease on life as open source, embedded-friendly libraries for microcontrollers.

Larry Bank 35 Jul 11, 2022
Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality

Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality. Guetzli-generated images are typically 20-30% smaller than images of equivalent quality generated by libjpeg. Guetzli generates only sequential (nonprogressive) JPEGs due to faster decompression speeds they offer.

Google 12.7k Aug 5, 2022
Python envelope for the popular C library libjpeg for handling JPEG files.

jpeglib Python envelope for the popular C library libjpeg for handling JPEG files. libjpeg offers full control over compression and decompression and

Martin Benes 3 Aug 4, 2022
Arduino PNG image decoder library

An 'embedded-friendly' (aka Arduino) PNG image decoding library

Larry Bank 91 Jun 24, 2022
Simple, generally spec-compliant, hacky PNG Decoder written in C99.

Simple, generally spec-compliant, hacky PNG Decoder written in C99.

cristei 2 Nov 2, 2021
PNG encoder and decoder in C and C++.

PNG encoder and decoder in C and C++, without dependencies

Lode Vandevenne 1.7k Aug 4, 2022
Tiny ISO-compliant C++ EXIF and XMP parsing library for JPEG.

TinyEXIF: Tiny ISO-compliant C++ EXIF and XMP parsing library for JPEG Introduction TinyEXIF is a tiny, lightweight C++ library for parsing the metada

cDc 78 Jul 31, 2022
Single header lib for JPEG encoding. Public domain. C99. stb style.

tiny_jpeg.h A header-only public domain implementation of Baseline JPEG compression. Features: stb-style header only library. Does not do dynamic allo

Sergio Gonzalez 196 Jul 20, 2022
JPEG XL image format reference C++ implementation

This repository contains a reference implementation of JPEG XL (encoder and decoder), called libjxl.

libjxl 651 Aug 7, 2022
An 'embedded-friendly' (aka Arduino) JPEG image encoding library

Starting in the late 80's I wrote my own imaging codecs for the existing standards (CCITT G3/G4 was the first). I soon added GIF, JPEG and not long after that, the PNG specification was ratified. All of this code was "clean room" - written just from the specification. I used my imaging library in many projects and products over the years and recently decided that some of my codecs could get a new lease on life as open source, embedded-friendly libraries for microcontrollers.

Larry Bank 35 Jul 11, 2022
Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality

Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality. Guetzli-generated images are typically 20-30% smaller than images of equivalent quality generated by libjpeg. Guetzli generates only sequential (nonprogressive) JPEGs due to faster decompression speeds they offer.

Google 12.7k Aug 5, 2022
Python envelope for the popular C library libjpeg for handling JPEG files.

jpeglib Python envelope for the popular C library libjpeg for handling JPEG files. libjpeg offers full control over compression and decompression and

Martin Benes 3 Aug 4, 2022
Analysing and implementation of lossless data compression techniques like Huffman encoding and LZW was conducted along with JPEG lossy compression technique based on discrete cosine transform (DCT) for Image compression.

PROJECT FILE COMPRESSION ALGORITHMS - Huffman compression LZW compression DCT Aim of the project - Implement above mentioned compression algorithms an

null 1 Dec 14, 2021
JS/WASM build of libjxl (JPEG-XL)

libjxl-js JS/WASM build of libjxl (JPEG-XL) Try It Out! Try it in your browser here Building This project uses git submodules to pull in libjxl. If de

Chris Hafey 9 Mar 27, 2022
Second life for famous JPEGView - fast and tiny viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF and TIFF images with a minimalist GUI and base image processing.

JPEGView-Image-Viewer-and-Editor Updated Dec 07 2021. Version 1.1.1.0 has been released. Download link1, link2 added. Second life for famous JPEGView

Ann Hatt 25 Aug 5, 2022
Single header lib for JPEG encoding. Public domain. C99. stb style.

tiny_jpeg.h A header-only public domain implementation of Baseline JPEG compression. Features: stb-style header only library. Does not do dynamic allo

Sergio Gonzalez 196 Jul 20, 2022
MozJPEG improves JPEG compression efficiency achieving higher visual quality and smaller file sizes at the same time

Mozilla JPEG Encoder Project MozJPEG improves JPEG compression efficiency achieving higher visual quality and smaller file sizes at the same time. It

Mozilla 4.9k Aug 9, 2022
Minimalistic MP3 decoder single header library

minimp3 Minimalistic, single-header library for decoding MP3. minimp3 is designed to be small, fast (with SSE and NEON support), and accurate (ISO con

Lion 1.2k Aug 8, 2022
Minimal Huffman coder/decoder

huffandpuff This is an extremely minimal huffman encoder/decoder. It uses no calls at all, not even stdlib/stdio, making it suitable for embedded appl

Adam Ierymenko 87 Aug 6, 2022
Minimalistic MP3 decoder single header library

minimp3 Minimalistic, single-header library for decoding MP3. minimp3 is designed to be small, fast (with SSE and NEON support), and accurate (ISO con

Lion 1.2k Aug 6, 2022
MPack - A C encoder/decoder for the MessagePack serialization format / msgpack.org[C]

Introduction MPack is a C implementation of an encoder and decoder for the MessagePack serialization format. It is: Simple and easy to use Secure agai

Nicholas Fraser 376 Jul 27, 2022
SleighCraft is a decoder based on ghidra's decompiler implementation.

SleighCraft is a decoder (or, linear disassembler) based on ghidra's decompiler implementation. Sleighcraft can be used in Rust or Python, with both high-level and low-level API.

PortalLab 231 Jul 10, 2022
Arduino PNG image decoder library

An 'embedded-friendly' (aka Arduino) PNG image decoding library

Larry Bank 91 Jun 24, 2022
White-Stuff - a simple xor encoder/decoder for your shellcode

White-Stuff - a simple xor encoder/decoder for your shellcode

null 14 Jul 22, 2022
A lean, efficient, accurate geohash encoder and decoder library implemented in C

Geohash encoder/decoder in C A lean, efficient, accurate geohash encoder and decoder library implemented in C. It does not depend on the C standard li

Christopher Wellons 18 May 30, 2022
An abstract soundfile decoder.

SDL_sound. An abstract soundfile decoder. SDL_sound is a library that handles the decoding of several popular sound file formats, such as .WAV and .

Ryan C. Gordon 114 Aug 6, 2022
SPDIF decoder for Kingst VIS

SPDIF Logic Analyzer This plugin is for use in the Kingst VIS program to decode captured data from any SPDIF Interface. It's a modified version of [ht

null 6 Aug 6, 2022
Software MBE decoder for codecserver / digiham / openwebrx

Introduction openwebrx is a web-based SDR receiver. That software used to be capable of decoding digital voice modes such as DMR, YSF, NXDN and D-STAR

null 13 Aug 6, 2022
combined decoder for DAB and FM

DUORECEIVER 1.0 COMBINED FM AND DAB MINI RECEIVER I got questions from family members why there was no combined FM and DAB receiver available, since t

JvanKatwijk 6 Dec 15, 2021