Giter VIP home page Giter VIP logo

jpeg-baseline-codec's Introduction

This project was developed for the 'Multimedia Systems and Virtual Reality' course, part of the MEng in Electrical and Computer Engineering at the Aristotle University of Thessaloniki in 2019. The aim of the project is to develop a JPEG encoder/decoder following the ISO/IEC 10918-1:1994 standard, focusing on the baseline sequential DCT-based process.

Structure and Deliverables

JPEG Library

The primary goal is to assemble a library of functions that encapsulate key components of the JPEG encoding and decoding template. Each function will include its inverse to facilitate reconstruction, integral to the decoding process.

Preprocessing

Initial preprocessing converts images from RGB to YCbCr format, supporting different subsampling formats (4:4:4, 4:2:2, and 4:2:0). The function signature is as follows:

function [imageY, imageCb, imageCr] = convert2ycbcr(imageRGB, subsampling)
  • imageY, imageCb, imageCr: Components of the YCbCr image.
  • imageRGB: The original RGB image.
  • subsampling: A 1x3 array defining the subsampling format (e.g., [4 2 0]).

The inverse function, responsible for converting YCbCr back to RGB and oversampling to match the original image's dimensions, is specified as:

function imageRGB = convert2rgb(imageY, imageCr, imageCb, subsampling)

DCT Transformation

DCT transformations are applied at the block level:

function dctBlock = blockDCT(block)

And its inverse:

function block = iBlockDCT(dctBlock)

Quantization

Quantization of DCT blocks and the corresponding inverse function are defined as:

function qBlock = quantizeJPEG(dctBlock, qTable, qScale)
function dctBlock = dequantizeJPEG(qBlock, qTable, qScale)

Zig-zag Scanning and RLE

Functions for run-length encoding (RLE) and its inverse are outlined for processing quantized DCT coefficients:

function runSymbols = runLength(qBlock, DCpred)
function qBlock = irunLength(runSymbols, DCpred)

Huffman Coding

Huffman coding and decoding functions are provided for compressing run-length encoded symbols:

function huffStream = huffEnc(runSymbols)
function runSymbols = huffDec(huffStream)

Demo 1

demo1.m demonstrates the process of converting an RGB image to YCbCr and back, along with DCT coefficient processing. Different subsampling formats are used for two provided images.

JPEG Integration

Integrating the developed functions into a comprehensive encoder/decoder function is the second major deliverable, aiming at both quantitative and qualitative analysis of the achieved compression.

JPEG Encoder/Decoder

The function signatures for encoding and decoding are:

function JPEGenc = JPEGencode(img, subsampling, qScale)
function imgRec = JPEGdecode(JPEGenc)

Demo 2

demo2.m will calculate and compare entropies in different domains for two provided images, using the same parameters as in Demo 1.

JPEG Syntax

The final deliverable focuses on constructing and decoding a bitstream of the encoded image, ensuring compatibility with standard image processing software.

JPEG Syntax Encoder/Decoder

The functions for encoding to and decoding from a JPEG bitstream are defined as:

function JPEGencStream = JPEGencodeStream(img, subsampling, qScale)
function imgCmp = JPEGdecodeStream(JPEGencStream)

jpeg-baseline-codec's People

Contributors

annatz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.