JPEG ENCODER & DECODER ENCODER.pdfJPEG ENCODER & DECODER Download the source code ALGORITHM -...

2
JPEG ENCODER & DECODER Download the source code ALGORITHM - ENCODER Divide the image into 8*8 blocks and do the following for each block Shift the block 1. Perform a DCT on the block 2. Quantize the block 3. Subtract the last DC coefficient from the current DC coefficient 4. Zigzag the block 5. Zero run length encode the block 6. Break down the non-zero coefficients into variable-length binary numbers & their lengths 7. Entropy encode the run lengths & binary number lengths 8. Write the entropy encoded information & binary numbers to the output 9. ALGORITHM - DECODER Read bit-by-bit from the file to get the DC coefficient, non-zero AC coefficients and the run lengths. 1. Get the DC coefficient and the 63 AC coefficients. 2. Then we dezigzag the block. 3. Add the last DC coefficient to the current DC coefficient 4. Next we dequantize the block 5. Next we perform the Inverse Discrete Cosine Transform . 6. Finally, we shift the block by adding 128 to each value in the block 7. Merge all the blocks to get the final block . RESULTS Original Image Standard JPEG Compression JPEG Compression JPEG Compression (Lossless) Original BMP image : 54582 bytes Standard JPEG : 10529 bytes Compression Ratio : 1 : 5.2 Compressed Image : 5226 bytes Compression Ratio : 1 : 10.5 Compressed Image : 34102 bytes Compression Ratio : 1 : 1.6 Original BMP image : 53874 bytes Standard JPEG : 11553 bytes Compression Ratio : 1: 4.7 Compressed Image : 6218 bytes Compression Ratio : 1 : 8.7 Compressed Image : 42505 bytes Compression Ratio : 1 : 1.27 Original BMP image : 88918 bytes Standard JPEG : 20623 bytes Compression Ratio : 1 : 4.3 Compressed Image : 10658 bytes Compression Ratio : 1 : 8.3 Compressed Image : 64405 bytes Compression Ratio : 1 : 1.38 Original BMP image : 38830 bytes Standard JPEG : 10834 bytes Compression Ratio : 1 : 3.58 Compressed Image : 5029 bytes Compression Ratio : 1 : 7.72 Compressed Image : 36572 bytes Compression Ratio : 1 : 1.06 JPEG ENCODER http://www.cs.northwestern.edu/~agupta/_projects/image_processing/we... 1 of 2 11/17/2015 2:07 PM

Transcript of JPEG ENCODER & DECODER ENCODER.pdfJPEG ENCODER & DECODER Download the source code ALGORITHM -...

  • JPEG ENCODER & DECODER

    Download the source code

    ALGORITHM - ENCODER

    Divide the image into 8*8 blocks and do the following for each block

    Shift the block1. Perform a DCT on the block2. Quantize the block3. Subtract the last DC coefficient from the current DC coefficient4. Zigzag the block5. Zero run length encode the block6. Break down the non-zero coefficients into variable-length binary numbers & their lengths7. Entropy encode the run lengths & binary number lengths8. Write the entropy encoded information & binary numbers to the output9.

    ALGORITHM - DECODER

    Read bit-by-bit from the file to get the DC coefficient, non-zero AC coefficients and the run lengths.1. Get the DC coefficient and the 63 AC coefficients.2. Then we dezigzag the block.3. Add the last DC coefficient to the current DC coefficient4. Next we dequantize the block5. Next we perform the Inverse Discrete Cosine Transform .6. Finally, we shift the block by adding 128 to each value in the block7.

    Merge all the blocks to get the final block .

    RESULTS

    Original Image Standard JPEG Compression JPEG Compression JPEG Compression (Lossless)

    Original BMP image : 54582 bytes Standard JPEG : 10529 bytesCompression Ratio : 1 : 5.2

    Compressed Image : 5226 bytesCompression Ratio : 1 : 10.5

    Compressed Image : 34102 bytesCompression Ratio : 1 : 1.6

    Original BMP image : 53874 bytes Standard JPEG : 11553 bytesCompression Ratio : 1: 4.7

    Compressed Image : 6218 bytesCompression Ratio : 1 : 8.7

    Compressed Image : 42505 bytesCompression Ratio : 1 : 1.27

    Original BMP image : 88918 bytes Standard JPEG : 20623 bytesCompression Ratio : 1 : 4.3

    Compressed Image : 10658 bytesCompression Ratio : 1 : 8.3

    Compressed Image : 64405 bytesCompression Ratio : 1 : 1.38

    Original BMP image : 38830 bytes Standard JPEG : 10834 bytesCompression Ratio : 1 : 3.58

    Compressed Image : 5029 bytesCompression Ratio : 1 : 7.72

    Compressed Image : 36572 bytesCompression Ratio : 1 : 1.06

    JPEG ENCODER http://www.cs.northwestern.edu/~agupta/_projects/image_processing/we...

    1 of 2 11/17/2015 2:07 PM

  • Original BMP image : 62326 bytes Standard JPEG : 10881 bytesCompression Ratio : 1 : 5.7

    Compressed Image : 6055 bytesCompression Ratio : 1 : 10.29

    Compressed Image : 27322 bytesCompression Ratio : 1 : 2.28

    JPEG ENCODER http://www.cs.northwestern.edu/~agupta/_projects/image_processing/we...

    2 of 2 11/17/2015 2:07 PM