Skip to content

Commit

Permalink
Merge pull request #30 from SDWebImage/support_libavif_0.9.1
Browse files Browse the repository at this point in the history
Support libavif 0.9.1
  • Loading branch information
dreampiggy authored Jul 31, 2021
2 parents e5dc92d + 7bba93f commit 0375da1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/check-image-decoding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ jobs:
CMD="../Example/CLI.xcarchive/Products/usr/local/bin/SDWebImageAVIFCoder_Example CLI"
for file in $(find . -name \*.avif); do
file=$(basename ${file})
if (echo ${file} | grep "\(monochrome\|crop\|rotate\|mirror\)"); then
# FIXME(ledyba-z): Check them.
echo "Ignore: ${file}"
continue
elif (echo ${file} | grep "profile"); then
if (echo ${file} | grep "profile"); then
# FIXME(ledyba-z): https://github.com/SDWebImage/SDWebImageAVIFCoder/issues/21
echo "Ignore: ${file}"
continue
Expand All @@ -58,11 +54,7 @@ jobs:
cd avif-sample-images
for file in $(find . -name \*.avif); do
file=$(basename ${file})
if (echo ${file} | grep "\(monochrome\|crop\|rotate\|mirror\)"); then
# FIXME(ledyba-z): Check them.
echo "Ignore: ${file}"
continue
elif (echo ${file} | grep "profile"); then
if (echo ${file} | grep "profile"); then
# FIXME(ledyba-z): https://github.com/SDWebImage/SDWebImageAVIFCoder/issues/21
echo "Ignore: ${file}"
continue
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "SDWebImage/SDWebImage" ~> 5.10
github "SDWebImage/libavif-Xcode" >= 0.8.2
github "SDWebImage/libavif-Xcode" >= 0.9.1
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.10.0"),
.package(url: "https://github.com/SDWebImage/libavif-Xcode.git", from: "0.8.2")
.package(url: "https://github.com/SDWebImage/libavif-Xcode.git", from: "0.9.1")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion SDWebImageAVIFCoder.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ Which is built based on the open-sourced libavif codec.
}

s.dependency 'SDWebImage', '~> 5.10'
s.dependency 'libavif', '>= 0.8.2'
s.dependency 'libavif', '>= 0.9.1'
s.libraries = 'c++'
end
2 changes: 2 additions & 0 deletions SDWebImageAVIFCoder/Classes/SDImageAVIFCoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ - (nullable CGImageRef)sd_createAVIFImageWithData:(nonnull NSData *)data CF_RETU
// Decode it
avifDecoder * decoder = avifDecoderCreate();
avifDecoderSetIOMemory(decoder, data.bytes, data.length);
// Disable strict mode to keep some AVIF image compatible
decoder->strictFlags = AVIF_STRICT_DISABLED;
avifResult decodeResult = avifDecoderParse(decoder);
if (decodeResult != AVIF_RESULT_OK) {
NSLog(@"Failed to decode image: %s", avifResultToString(decodeResult));
Expand Down

0 comments on commit 0375da1

Please sign in to comment.