RubyPDF Blog English,Open Source LibJpeg vs LibJpeg-turbo

LibJpeg vs LibJpeg-turbo

libjpeg is a library written entirely in C which contains a widely-used implementation of a JPEG decoder, JPEG encoder and other JPEG utilities. This library is maintained by the Independent JPEG Group.

libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression. libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal(for non-grayscale JPEG compression and decompression, libjpeg-turbo is between 1.8x and 4.5x as fast as libjpeg v6b).

libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but the TigerVNC and VirtualGL projects made numerous enhancements to the codec, including improved support for Mac OS X, 64-bit support, support for 32-bit and big endian pixel formats (RGBA, ABGR, etc.), accelerated Huffman encoding/decoding, and various bug fixes. The goal was to produce a fully open source codec that could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally achieves 80-120% of the performance of TurboJPEG/IPP. It is faster in some areas but slower in others(for non-grayscale JPEG compression and decompression, libjpeg-turbo 64-bit is between 80% and 118% as fast as TurboJPEG/IPP. libjpeg-turbo 32-bit is between 60% and 93% as fast as TurboJPEG/IPP. libjpeg-turbo‘s primary weakness relative to TurboJPEG/IPP is 32-bit performance, particularly on Intel processors and even more particularly on legacy Intel processors. This is largely due to the Huffman encoder/decoder running out of registers and having to swap some inner loop variables back and forth from memory).

In one word, libjpeg-turbo is a fork of libjpeg that uses SIMD instructions to accelerate JPEG encoding and decoding.

btw, projects such as Mozilla and fedora switched to libjpeg-turbo in 2010.

libjpeg-turbo HomePage
Independent JPEG Group’s JPEG software release 6b
with x86 SIMD extension for IJG JPEG library version 1.02

Independent JPEG Group(IJG)

4 thoughts on “LibJpeg vs LibJpeg-turbo”

  1. Greetings chromium developers,
    As you know, Chromium uses IJG libjpeg as its JPEG library at least on
    Windows. Today, I added a PageCyclerTest.JpegTestFile (*1)(*2),
    replaced this libjpeg with libjpeg-turbo (*3)(*4), and compared their
    results on my Windows PC just for my personal interest. To summarize
    the results, Chromium (+ libjpeg-turbo) can decode JPEG files almost
    twice as fast as the original one as listed below. (Please see the
    attached files for their full results.) Even though the real web pages
    does not include so many huge JPEG files used in this test and
    libjpeg-turbo does not improve the performance of Chromium as much as
    this test, it might be a good idea to consider replacing our JPEG
    library to a faster alternative?
    * Chromium r53428
    – PageCyclerTest.JpegTestFile: 63565 ms
    * Chromium r53428 + libjpeg-turbo
    – PageCyclerTest.JpegTestFile: 33283 ms
    (*1) <>
    (*2) <>
    (*3) <>
    (*4) I manually built its static library and replaced it with our
    libjpeg since this is just an initial test.
    Hironori Bono

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.