Latest 0.2.1
Homepage https://github.com/kean/DFJPEGTurbo
License MIT
Platforms ios 6.0, requires ARC

DFJPEGTurbo


Objective-C libjpeg-turbo wrapper (JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems). DFJPEGTurbo uses libjpeg-turbo version 1.4.1, which now includes arm64 support.

Requirements

  • iOS 6.0

Examples

Decompressing JPEG

NSData *jpegData;
UIImage *image = [DFJPEGTurboImageDecoder imageWithData:data];

Decompressing JPEG with one of the libjpeg-turbo scale factors

NSData *jpegData;
// Scale must be implemented by libjpeg-turbo which supports only several scaling factors (1/1, 1/2, 1/4 etc).
DFJPEGScale scale = DFJPEGScaleMake(1, 2); // 0.5 scale
UIImage *image = [DFJPEGTurboImageDecoder imageWithData:jpegData orientation:UIImageOrientationDown scale:scale];

Benchmark (Baseline JPEG)

Benchmark on older ARM-based systems (iPhone 4S, iPhone 5C) shows that libjpeg-turbo provides a very noticable performance boost over native CGContextDrawImage. However, libjpeg-turbo underperforms on newer systems (iPhone 6). For benchmark implementation see Demo/DFJPEGTurboBenchmark in a project folder.

iPhone 6 (Apple A8)

Input Image CGContextDrawImage libjpeg-turbo
1024×768, 0.3 compression quality 10.51 ms 9.75 ms
1024×768, 0.5 compression quality 10.56 ms 10.15 ms
1024×768, 0.7 compression quality 10.14 ms 11.61 ms
1024×768, 0.9 compression quality 10.13 ms 12.44 ms
2048×1536, 0.3 compression quality 41.60 ms 36.98 ms
2048×1536, 0.5 compression quality 33.46 ms 40.56 ms
2048×1536, 0.7 compression quality 33.85 ms 45.53 ms
2048×1536, 0.9 compression quality 34.79 ms 52.60 ms

iPhone 5C (Apple A6)

Input Image CGContextDrawImage DFJPEGTurbo
1024×768, 0.3 compression quality 42.47 ms 22.26 ms
1024×768, 0.5 compression quality 40.75 ms 23.28 ms
1024×768, 0.7 compression quality 40.51 ms 26.11 ms
1024×768, 0.9 compression quality 39.82 ms 29.77 ms
2048×1536, 0.3 compression quality 130.72 ms 81.95 ms
2048×1536, 0.5 compression quality 129.83 ms 86.50 ms
2048×1536, 0.7 compression quality 130.42 ms 98.17 ms
2048×1536, 0.9 compression quality 130.03 ms 106.18 ms

Installation using CocoaPods

To install DFJPEGTurbo add a dependency in your Podfile.

pod 'DFJPEGTurbo'

Contacts



License

DFJPEGTurbo is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DFJPEGTurbo",
    "version": "0.2.1",
    "summary": "Objective-C libjpeg-turbo wrapper with baseline and progressive JPEG support",
    "platforms": {
        "ios": "6.0"
    },
    "license": "MIT",
    "homepage": "https://github.com/kean/DFJPEGTurbo",
    "authors": "Alexander Grebenyuk",
    "source": {
        "git": "https://github.com/kean/DFJPEGTurbo.git",
        "tag": "0.2.1"
    },
    "source_files": "DFJPEGTurbo/**/*.{h,m}",
    "vendored_libraries": "DFJPEGTurbo/libturbojpeg/libturbojpeg.a",
    "requires_arc": true
}

Pin It on Pinterest

Share This