Latest 0.1.0
Homepage https://github.com/SDWebImage/SDWebImageAVIFCoder
License MIT
Platforms ios 8.0, osx 10.10
Dependencies SDWebImage, libavif
Authors

CI Status
Version
License
Platform
Carthage compatible

What’s for

This is a SDWebImage coder plugin to add AV1 Image File Format (AVIF) support. Which is built based on the open-sourced libavif codec.

This AVIF coder plugin currently support AVIF still image decoding. Including alpha channel, as well as 10bit/12bit HDR images.

The AVIF encoding is not currently support, because the software-based encoding speed is really slow. Need to wait for better enc implementation.

Note: AVIF image spec is still in evolve. And the current AVIF codec is a simple implementation.

Since AVIF is AV1-based inside HEIF image container. In the future, this repo may moved to existing HEIF coder plugin SDWebImageHEIFCoder instead.

Requirements

  • iOS 8
  • macOS 10.10
  • tvOS 9.0 (Carthage only)
  • watchOS 2.0 (Carthage only)

Installation

CocoaPods

SDWebImageAVIFCoder is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'SDWebImageAVIFCoder'

Note: Current libaom dependency via CocoaPods, use the pre-built static library for each architecutre.

The reason of this it’s that we want to use SIMD/SSE/AVX2 CPU instruction optimization for each platforms. However libaom does not using dynamic CPU detection for Apple’s platforms. We need the upstream to support it.

At the same time, CocoaPods does not allow you to write a framework contains so much of architecture detection (for example, iPhone Simulator is x86_x64, however, iPhone is ARM, they should use different assembly files). So we use the pre-built one instead.

If you’re using use_frameworks! in Podfile, you can check it with static framework instead.

pod 'SDWebImageAVIFCoder', :modular_headers => true

Carthage

SDWebImageAVIFCoder is available through Carthage.

github "SDWebImage/SDWebImageAVIFCoder"

Note: Carthage dependency of libaom using the C implementation codec, instead of original SIMD/SSE/AVX accelerated and assembly implementation, because it need extra dependency (CMake && NASM build tool).

The C implementation make it possible to cross-platform in tvOS/watchOS as well. But if you’re care about performance, try CocoaPods instead.

Usage

To use AVIF coder, you should firstly add the SDImageAVIFCoder.sharedCoder to the coders manager. Then you can call the View Category method to start load AVIF images.

  • Objective-C
SDImageAVIFCoder *AVIFCoder = SDImageAVIFCoder.sharedCoder;
[[SDImageCodersManager sharedManager] addCoder:AVIFCoder];
UIImageView *imageView;
[imageView sd_setImageWithURL:url];
  • Swift
let AVIFCoder = SDImageAVIFCoder.shared
SDImageCodersManager.shared.addCoder(AVIFCoder)
let imageView: UIImageView
imageView.sd_setImage(with: url)

Screenshot

SDWebImageAVIFCoder
SDWebImageAVIFCoder

The images are from AV1 Still Image File Format Specification Test Files.

Author

DreamPiggy, [email protected]

License

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

Thanks

Latest podspec

{
    "name": "SDWebImageAVIFCoder",
    "version": "0.1.0",
    "summary": "A SDWebImage coder plugin to support AVIF(AV1 Image File Format) image",
    "description": "This is a SDWebImage coder plugin to add AV1 Image File Format (AVIF) support.nWhich is built based on the open-sourced libavif codec.",
    "homepage": "https://github.com/SDWebImage/SDWebImageAVIFCoder",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "DreamPiggy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SDWebImage/SDWebImageAVIFCoder.git",
        "tag": "0.1.0"
    },
    "module_map": "SDWebImageAVIFCoder/Module/SDWebImageAVIFCoder.modulemap",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "source_files": [
        "SDWebImageAVIFCoder/Classes/**/*",
        "SDWebImageAVIFCoder/Module/SDWebImageAVIFCoder.h"
    ],
    "dependencies": {
        "SDWebImage": [
            "~> 5.0"
        ],
        "libavif": []
    }
}

Pin It on Pinterest

Share This