Microchip | The Embedded Control Solutions Company Register Login
Browse All
Microchip Technology
 305 Code Snippets

CE150 - JPEG Entropy Coding

Microchip Technology

This example shows a simple JPEG encoder using the functions available in the DSP library.

About this Code Example

This example shows a simple JPEG encoder using the functions available in the DSP library.

The main blocks are as follows:
1.Zero Center Transformation: int VectorLevelShiftIP(fractional*, int, int);
Centers the input 8x8 matrix around 0 by performing level shifting by 128.

2.2-D Type II DCT: int DCT_2D(fractional*, int, int, fractional*, fractcomplex*, fractcomplex*, int, int);
Performs 2D DCT on the zero centered matrix using 1D type II DCT function in DSP library. It is also supported by vector and matrix functions.

3.Perceptual Quantization: int VectorDivideIP(fractional*, fractional*, int);
Performs quantization using the regular JPEG quantization matrix.

4.Zig-zag Transformation: int Matrix2Vector_ZigZag(fractional*, fractional*, int, int);
Arranges the 2-D Type II DCT transformed, quantized data in to a vector in a JPEG zig-zag fashion.

5.Huffman Encoder: int EntropyEncoder(fractional*, fractional*, int);
Encodes the zig-zag arranged vector using Huffman entropy coding.

The example takes an 8x8 image data block as input. Prints the transformed data at every stage and finally the code bits and the achieved compression rate.

Categories

Release History

  • Jul 22, 2011

    Version: 1.0.0

    first upload to ECS

Download Contact the Developer

*Required Fields

  • Current Version:1.0.0
  • Created:Jul 22, 2011
  • Updated:Feb 26, 2015
  • Downloads:2811
  • MPLAB Version:latest
  • C Compiler:MPLAB C30
  • Development Tools:Explorer16 development board with dsPIC33FJ256GP710 controller
  • Supported Devices:dsPIC33F dsPIC DSCs

Corporate News

Resources

Stay Connected

Stay up to date with the latest news from Microchip Technology.