From 99f7fe733568171527483d0c2b642390cea6c561 Mon Sep 17 00:00:00 2001 From: jk Date: Mon, 28 Sep 2020 19:11:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?WKWebView=E6=98=BE=E7=A4=BAwebp=E5=8A=A8?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WKWebView显示webp动图 --- BAWKWebView-WebP.xcodeproj/project.pbxproj | 58 +- .../xcschemes/xcschememanagement.plist | 14 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../UserInterfaceState.xcuserstate | Bin 0 -> 51165 bytes .../xcdebugger/Breakpoints_v2.xcbkptlist | 20 + BAWKWebView-WebP/AppDelegate.m | 6 + .../BAWKWebView-WebP/BAURLSessionProtocol.m | 209 +- .../BAWKWebView-WebP/BAWKWebView_WebP.h | 64 +- .../JKInvoker/NSObject+RuntimeInvoker.h | 80 + .../JKInvoker/NSObject+RuntimeInvoker.m | 415 +++ .../NSURLProtocol+BAWebView.m | 40 +- BAWKWebView-WebP/BAWebpController.m | 54 +- BAWKWebView-WebP/ViewController.m | 21 +- Podfile | 5 +- Podfile.lock | 59 +- .../NSBezierPath+SDRoundedCorners.h | 1 + .../Private/SDWebImage/NSButton+WebCache.h | 1 + .../SDWebImage/NSData+ImageContentType.h | 2 +- .../SDWebImage/NSImage+Compatibility.h | 1 + .../Private/SDWebImage/NSImage+WebCache.h | 1 - .../Private/SDWebImage/SDAnimatedImage.h | 1 + .../SDWebImage/SDAnimatedImagePlayer.h | 1 + .../Private/SDWebImage/SDAnimatedImageRep.h | 1 + .../SDWebImage/SDAnimatedImageView+WebCache.h | 1 + .../Private/SDWebImage/SDAnimatedImageView.h | 1 + .../Private/SDWebImage/SDAssociatedObject.h | 1 + .../SDWebImage/SDAsyncBlockOperation.h | 1 + .../Private/SDWebImage/SDDeviceHelper.h | 1 + Pods/Headers/Private/SDWebImage/SDDiskCache.h | 1 + .../Private/SDWebImage/SDDisplayLink.h | 1 + .../SDWebImage/SDFileAttributeHelper.h | 1 + .../SDWebImage/SDGraphicsImageRenderer.h | 1 + .../Private/SDWebImage/SDImageAPNGCoder.h | 1 + .../Private/SDWebImage/SDImageAWebPCoder.h | 1 + .../Private/SDWebImage/SDImageAssetManager.h | 1 + .../Headers/Private/SDWebImage/SDImageCache.h | 2 +- .../Private/SDWebImage/SDImageCacheConfig.h | 2 +- .../Private/SDWebImage/SDImageCacheDefine.h | 1 + .../Private/SDWebImage/SDImageCachesManager.h | 1 + .../SDImageCachesManagerOperation.h | 1 + .../Headers/Private/SDWebImage/SDImageCoder.h | 1 + .../Private/SDWebImage/SDImageCoderHelper.h | 1 + .../Private/SDWebImage/SDImageCodersManager.h | 1 + .../Headers/Private/SDWebImage/SDImageFrame.h | 1 + .../Private/SDWebImage/SDImageGIFCoder.h | 1 + .../Private/SDWebImage/SDImageGraphics.h | 1 + .../Private/SDWebImage/SDImageHEICCoder.h | 1 + .../SDWebImage/SDImageIOAnimatedCoder.h | 1 + .../SDImageIOAnimatedCoderInternal.h | 1 + .../Private/SDWebImage/SDImageIOCoder.h | 1 + .../Private/SDWebImage/SDImageLoader.h | 1 + .../SDWebImage/SDImageLoadersManager.h | 1 + .../Private/SDWebImage/SDImageTransformer.h | 1 + .../Private/SDWebImage/SDInternalMacros.h | 1 + .../Private/SDWebImage/SDMemoryCache.h | 1 + Pods/Headers/Private/SDWebImage/SDWeakProxy.h | 1 + Pods/Headers/Private/SDWebImage/SDWebImage.h | 1 + .../SDWebImage/SDWebImageCacheKeyFilter.h | 1 + .../SDWebImage/SDWebImageCacheSerializer.h | 1 + .../Private/SDWebImage/SDWebImageCompat.h | 2 +- .../Private/SDWebImage/SDWebImageDecoder.h | 1 - .../Private/SDWebImage/SDWebImageDefine.h | 1 + .../Private/SDWebImage/SDWebImageDownloader.h | 2 +- .../SDWebImage/SDWebImageDownloaderConfig.h | 1 + .../SDWebImageDownloaderDecryptor.h | 1 + .../SDWebImageDownloaderOperation.h | 2 +- .../SDWebImageDownloaderRequestModifier.h | 1 + .../SDWebImageDownloaderResponseModifier.h | 1 + .../Private/SDWebImage/SDWebImageError.h | 1 + .../Private/SDWebImage/SDWebImageIndicator.h | 1 + .../Private/SDWebImage/SDWebImageManager.h | 2 +- .../Private/SDWebImage/SDWebImageOperation.h | 2 +- .../SDWebImage/SDWebImageOptionsProcessor.h | 1 + .../Private/SDWebImage/SDWebImagePrefetcher.h | 2 +- .../Private/SDWebImage/SDWebImageTransition.h | 1 + .../SDWebImage/SDWebImageTransitionInternal.h | 1 + .../Headers/Private/SDWebImage/SDmetamacros.h | 1 + .../Private/SDWebImage/UIButton+WebCache.h | 2 +- .../Private/SDWebImage/UIColor+SDHexString.h | 1 + .../SDWebImage/UIImage+ExtendedCacheData.h | 1 + .../Private/SDWebImage/UIImage+ForceDecode.h | 1 + Pods/Headers/Private/SDWebImage/UIImage+GIF.h | 2 +- .../SDWebImage/UIImage+MemoryCacheCost.h | 1 + .../Private/SDWebImage/UIImage+Metadata.h | 1 + .../Private/SDWebImage/UIImage+MultiFormat.h | 2 +- .../Private/SDWebImage/UIImage+Transform.h | 1 + .../Headers/Private/SDWebImage/UIImage+WebP.h | 1 - .../UIImageView+HighlightedWebCache.h | 2 +- .../Private/SDWebImage/UIImageView+WebCache.h | 2 +- .../Private/SDWebImage/UIView+WebCache.h | 2 +- .../SDWebImage/UIView+WebCacheOperation.h | 2 +- .../SDWebImageWebPCoder/SDImageWebPCoder.h | 1 + .../SDWebImageWebPCoder/SDWebImageWebPCoder.h | 1 + .../SDWebImageWebPCoder/UIImage+WebP.h | 1 + Pods/Headers/Private/libwebp/common_sse41.h | 1 + Pods/Headers/Private/libwebp/decode.h | 1 + .../Private/libwebp/delta_palettization_enc.h | 1 - Pods/Headers/Private/libwebp/demux.h | 1 + Pods/Headers/Private/libwebp/encode.h | 1 + .../Private/libwebp/format_constants.h | 1 + Pods/Headers/Private/libwebp/mux.h | 1 + Pods/Headers/Private/libwebp/mux_types.h | 1 + Pods/Headers/Private/libwebp/quant.h | 1 + Pods/Headers/Private/libwebp/types.h | 1 + Pods/Headers/Private/libwebp/webp/decode.h | 1 - Pods/Headers/Private/libwebp/webp/demux.h | 1 - Pods/Headers/Private/libwebp/webp/encode.h | 1 - .../Private/libwebp/webp/format_constants.h | 1 - Pods/Headers/Private/libwebp/webp/mux.h | 1 - Pods/Headers/Private/libwebp/webp/mux_types.h | 1 - Pods/Headers/Private/libwebp/webp/types.h | 1 - .../Public/SDWebImage/NSButton+WebCache.h | 1 + .../SDWebImage/NSData+ImageContentType.h | 2 +- .../Public/SDWebImage/NSImage+Compatibility.h | 1 + .../Public/SDWebImage/NSImage+WebCache.h | 1 - .../Public/SDWebImage/SDAnimatedImage.h | 1 + .../Public/SDWebImage/SDAnimatedImagePlayer.h | 1 + .../Public/SDWebImage/SDAnimatedImageRep.h | 1 + .../SDWebImage/SDAnimatedImageView+WebCache.h | 1 + .../Public/SDWebImage/SDAnimatedImageView.h | 1 + Pods/Headers/Public/SDWebImage/SDDiskCache.h | 1 + .../SDWebImage/SDGraphicsImageRenderer.h | 1 + .../Public/SDWebImage/SDImageAPNGCoder.h | 1 + .../Public/SDWebImage/SDImageAWebPCoder.h | 1 + Pods/Headers/Public/SDWebImage/SDImageCache.h | 2 +- .../Public/SDWebImage/SDImageCacheConfig.h | 2 +- .../Public/SDWebImage/SDImageCacheDefine.h | 1 + .../Public/SDWebImage/SDImageCachesManager.h | 1 + Pods/Headers/Public/SDWebImage/SDImageCoder.h | 1 + .../Public/SDWebImage/SDImageCoderHelper.h | 1 + .../Public/SDWebImage/SDImageCodersManager.h | 1 + Pods/Headers/Public/SDWebImage/SDImageFrame.h | 1 + .../Public/SDWebImage/SDImageGIFCoder.h | 1 + .../Public/SDWebImage/SDImageGraphics.h | 1 + .../Public/SDWebImage/SDImageHEICCoder.h | 1 + .../SDWebImage/SDImageIOAnimatedCoder.h | 1 + .../Public/SDWebImage/SDImageIOCoder.h | 1 + .../Headers/Public/SDWebImage/SDImageLoader.h | 1 + .../Public/SDWebImage/SDImageLoadersManager.h | 1 + .../Public/SDWebImage/SDImageTransformer.h | 1 + .../Headers/Public/SDWebImage/SDMemoryCache.h | 1 + Pods/Headers/Public/SDWebImage/SDWebImage.h | 1 + .../SDWebImage/SDWebImageCacheKeyFilter.h | 1 + .../SDWebImage/SDWebImageCacheSerializer.h | 1 + .../Public/SDWebImage/SDWebImageCompat.h | 2 +- .../Public/SDWebImage/SDWebImageDecoder.h | 1 - .../Public/SDWebImage/SDWebImageDefine.h | 1 + .../Public/SDWebImage/SDWebImageDownloader.h | 2 +- .../SDWebImage/SDWebImageDownloaderConfig.h | 1 + .../SDWebImageDownloaderDecryptor.h | 1 + .../SDWebImageDownloaderOperation.h | 2 +- .../SDWebImageDownloaderRequestModifier.h | 1 + .../SDWebImageDownloaderResponseModifier.h | 1 + .../Public/SDWebImage/SDWebImageError.h | 1 + .../Public/SDWebImage/SDWebImageIndicator.h | 1 + .../Public/SDWebImage/SDWebImageManager.h | 2 +- .../Public/SDWebImage/SDWebImageOperation.h | 2 +- .../SDWebImage/SDWebImageOptionsProcessor.h | 1 + .../Public/SDWebImage/SDWebImagePrefetcher.h | 2 +- .../Public/SDWebImage/SDWebImageTransition.h | 1 + .../Public/SDWebImage/UIButton+WebCache.h | 2 +- .../SDWebImage/UIImage+ExtendedCacheData.h | 1 + .../Public/SDWebImage/UIImage+ForceDecode.h | 1 + Pods/Headers/Public/SDWebImage/UIImage+GIF.h | 2 +- .../SDWebImage/UIImage+MemoryCacheCost.h | 1 + .../Public/SDWebImage/UIImage+Metadata.h | 1 + .../Public/SDWebImage/UIImage+MultiFormat.h | 2 +- .../Public/SDWebImage/UIImage+Transform.h | 1 + Pods/Headers/Public/SDWebImage/UIImage+WebP.h | 1 - .../UIImageView+HighlightedWebCache.h | 2 +- .../Public/SDWebImage/UIImageView+WebCache.h | 2 +- .../Public/SDWebImage/UIView+WebCache.h | 2 +- .../SDWebImage/UIView+WebCacheOperation.h | 2 +- .../SDWebImageWebPCoder/SDImageWebPCoder.h | 1 + .../SDWebImageWebPCoder/SDWebImageWebPCoder.h | 1 + .../Public/SDWebImageWebPCoder/UIImage+WebP.h | 1 + Pods/Headers/Public/libwebp/alphai_dec.h | 1 - Pods/Headers/Public/libwebp/animi.h | 1 - .../Public/libwebp/backward_references_enc.h | 1 - .../Public/libwebp/bit_reader_inl_utils.h | 1 - .../Headers/Public/libwebp/bit_reader_utils.h | 1 - .../Headers/Public/libwebp/bit_writer_utils.h | 1 - .../Public/libwebp/color_cache_utils.h | 1 - Pods/Headers/Public/libwebp/common_dec.h | 1 - Pods/Headers/Public/libwebp/common_sse2.h | 1 - Pods/Headers/Public/libwebp/cost_enc.h | 1 - Pods/Headers/Public/libwebp/decode.h | 1 + .../Public/libwebp/delta_palettization_enc.h | 1 - Pods/Headers/Public/libwebp/demux.h | 1 + Pods/Headers/Public/libwebp/dsp.h | 1 - Pods/Headers/Public/libwebp/encode.h | 1 + .../Headers/Public/libwebp/endian_inl_utils.h | 1 - Pods/Headers/Public/libwebp/filters_utils.h | 1 - .../Headers/Public/libwebp/format_constants.h | 1 + Pods/Headers/Public/libwebp/histogram_enc.h | 1 - .../Public/libwebp/huffman_encode_utils.h | 1 - Pods/Headers/Public/libwebp/huffman_utils.h | 1 - Pods/Headers/Public/libwebp/lossless.h | 1 - Pods/Headers/Public/libwebp/lossless_common.h | 1 - Pods/Headers/Public/libwebp/mips_macro.h | 1 - Pods/Headers/Public/libwebp/msa_macro.h | 1 - Pods/Headers/Public/libwebp/mux.h | 1 + Pods/Headers/Public/libwebp/mux_types.h | 1 + Pods/Headers/Public/libwebp/muxi.h | 1 - Pods/Headers/Public/libwebp/neon.h | 1 - .../Public/libwebp/quant_levels_dec_utils.h | 1 - .../Public/libwebp/quant_levels_utils.h | 1 - Pods/Headers/Public/libwebp/random_utils.h | 1 - Pods/Headers/Public/libwebp/rescaler_utils.h | 1 - Pods/Headers/Public/libwebp/thread_utils.h | 1 - Pods/Headers/Public/libwebp/types.h | 1 + Pods/Headers/Public/libwebp/utils.h | 1 - Pods/Headers/Public/libwebp/vp8_dec.h | 1 - Pods/Headers/Public/libwebp/vp8i_dec.h | 1 - Pods/Headers/Public/libwebp/vp8i_enc.h | 1 - Pods/Headers/Public/libwebp/vp8li_dec.h | 1 - Pods/Headers/Public/libwebp/vp8li_enc.h | 1 - Pods/Headers/Public/libwebp/webp/decode.h | 1 - Pods/Headers/Public/libwebp/webp/demux.h | 1 - Pods/Headers/Public/libwebp/webp/encode.h | 1 - .../Public/libwebp/webp/format_constants.h | 1 - Pods/Headers/Public/libwebp/webp/mux.h | 1 - Pods/Headers/Public/libwebp/webp/mux_types.h | 1 - Pods/Headers/Public/libwebp/webp/types.h | 1 - Pods/Headers/Public/libwebp/webpi_dec.h | 1 - Pods/Headers/Public/libwebp/yuv.h | 1 - Pods/Manifest.lock | 59 +- Pods/Pods.xcodeproj/project.pbxproj | 2767 ++++++++++------- .../xcschemes/Pods-BAWKWebView-WebP.xcscheme | 60 + .../xcschemes/SDWebImage.xcscheme | 60 + .../xcschemes/SDWebImageWebPCoder.xcscheme | 60 + .../xcschemes/libwebp.xcscheme | 60 + .../xcschemes/xcschememanagement.plist | 39 + Pods/SDWebImage/LICENSE | 2 +- Pods/SDWebImage/README.md | 292 +- .../SDWebImage/Core/NSButton+WebCache.h | 340 ++ .../SDWebImage/Core/NSButton+WebCache.m | 172 + .../SDWebImage/Core/NSData+ImageContentType.h | 61 + .../SDWebImage/Core/NSData+ImageContentType.m | 153 + .../SDWebImage/Core/NSImage+Compatibility.h | 67 + .../SDWebImage/Core/NSImage+Compatibility.m | 120 + .../SDWebImage/Core/SDAnimatedImage.h | 114 + .../SDWebImage/Core/SDAnimatedImage.m | 388 +++ .../SDWebImage/Core/SDAnimatedImagePlayer.h | 90 + .../SDWebImage/Core/SDAnimatedImagePlayer.m | 391 +++ .../SDWebImage/Core/SDAnimatedImageRep.h | 23 + .../SDWebImage/Core/SDAnimatedImageRep.m | 127 + .../SDAnimatedImageView+WebCache.h} | 161 +- .../Core/SDAnimatedImageView+WebCache.m | 79 + .../SDWebImage/Core/SDAnimatedImageView.h | 99 + .../SDWebImage/Core/SDAnimatedImageView.m | 519 ++++ Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h | 145 + Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m | 326 ++ .../SDWebImage/Core/SDGraphicsImageRenderer.h | 73 + .../SDWebImage/Core/SDGraphicsImageRenderer.m | 244 ++ .../SDWebImage/Core/SDImageAPNGCoder.h | 19 + .../SDWebImage/Core/SDImageAPNGCoder.m | 65 + .../SDWebImage/Core/SDImageAWebPCoder.h | 23 + .../SDWebImage/Core/SDImageAWebPCoder.m | 98 + .../SDWebImage/SDWebImage/Core/SDImageCache.h | 422 +++ .../SDWebImage/SDWebImage/Core/SDImageCache.m | 888 ++++++ .../SDWebImage/Core/SDImageCacheConfig.h | 137 + .../SDWebImage/Core/SDImageCacheConfig.m | 63 + .../SDWebImage/Core/SDImageCacheDefine.h | 143 + .../SDWebImage/Core/SDImageCacheDefine.m | 85 + .../SDWebImage/Core/SDImageCachesManager.h | 81 + .../SDWebImage/Core/SDImageCachesManager.m | 557 ++++ .../SDWebImage/SDWebImage/Core/SDImageCoder.h | 266 ++ .../SDWebImage/SDWebImage/Core/SDImageCoder.m | 23 + .../SDWebImage/Core/SDImageCoderHelper.h | 127 + .../SDWebImage/Core/SDImageCoderHelper.m | 686 ++++ .../SDWebImage/Core/SDImageCodersManager.h | 58 + .../SDWebImage/Core/SDImageCodersManager.m | 133 + .../SDWebImage/SDWebImage/Core/SDImageFrame.h | 36 + .../SDWebImage/SDWebImage/Core/SDImageFrame.m | 28 + .../SDWebImage/Core/SDImageGIFCoder.h | 22 + .../SDWebImage/Core/SDImageGIFCoder.m | 57 + .../SDWebImage/Core/SDImageGraphics.h | 28 + .../SDWebImage/Core/SDImageGraphics.m | 105 + .../SDWebImage/Core/SDImageHEICCoder.h | 25 + .../SDWebImage/Core/SDImageHEICCoder.m | 104 + .../SDWebImage/Core/SDImageIOAnimatedCoder.h | 59 + .../SDWebImage/Core/SDImageIOAnimatedCoder.m | 663 ++++ .../SDWebImage/Core/SDImageIOCoder.h | 30 + .../SDWebImage/Core/SDImageIOCoder.m | 292 ++ .../SDWebImage/Core/SDImageLoader.h | 101 + .../SDWebImage/Core/SDImageLoader.m | 200 ++ .../SDWebImage/Core/SDImageLoadersManager.h | 40 + .../SDWebImage/Core/SDImageLoadersManager.m | 114 + .../SDWebImage/Core/SDImageTransformer.h | 241 ++ .../SDWebImage/Core/SDImageTransformer.m | 331 ++ .../SDWebImage/Core/SDMemoryCache.h | 78 + .../SDWebImage/Core/SDMemoryCache.m | 155 + .../Core/SDWebImageCacheKeyFilter.h | 32 + .../Core/SDWebImageCacheKeyFilter.m | 39 + .../Core/SDWebImageCacheSerializer.h | 36 + .../Core/SDWebImageCacheSerializer.m | 39 + .../SDWebImage/{ => Core}/SDWebImageCompat.h | 40 +- .../SDWebImageCompat.m} | 16 +- .../SDWebImage/Core/SDWebImageDefine.h | 319 ++ .../SDWebImage/Core/SDWebImageDefine.m | 139 + .../SDWebImage/Core/SDWebImageDownloader.h | 314 ++ .../SDWebImage/Core/SDWebImageDownloader.m | 619 ++++ .../Core/SDWebImageDownloaderConfig.h | 98 + .../Core/SDWebImageDownloaderConfig.m | 49 + .../Core/SDWebImageDownloaderDecryptor.h | 49 + .../Core/SDWebImageDownloaderDecryptor.m | 55 + .../Core/SDWebImageDownloaderOperation.h | 153 + .../Core/SDWebImageDownloaderOperation.m | 561 ++++ .../SDWebImageDownloaderRequestModifier.h | 69 + .../SDWebImageDownloaderRequestModifier.m | 71 + .../SDWebImageDownloaderResponseModifier.h | 69 + .../SDWebImageDownloaderResponseModifier.m | 73 + .../SDWebImage/Core/SDWebImageError.h | 27 + .../SDWebImage/Core/SDWebImageError.m | 13 + .../SDWebImage/Core/SDWebImageIndicator.h | 115 + .../SDWebImage/Core/SDWebImageIndicator.m | 284 ++ .../SDWebImage/Core/SDWebImageManager.h | 287 ++ .../SDWebImage/Core/SDWebImageManager.m | 702 +++++ .../SDWebImage/Core/SDWebImageOperation.h | 21 + .../SDWebImageOperation.m} | 11 +- .../Core/SDWebImageOptionsProcessor.h | 72 + .../Core/SDWebImageOptionsProcessor.m | 59 + .../SDWebImage/Core/SDWebImagePrefetcher.h | 143 + .../SDWebImage/Core/SDWebImagePrefetcher.m | 305 ++ .../SDWebImage/Core/SDWebImageTransition.h | 131 + .../SDWebImage/Core/SDWebImageTransition.m | 187 ++ .../SDWebImage/Core/UIButton+WebCache.h | 387 +++ .../SDWebImage/Core/UIButton+WebCache.m | 234 ++ .../Core/UIImage+ExtendedCacheData.h | 24 + .../Core/UIImage+ExtendedCacheData.m | 23 + .../SDWebImage/Core/UIImage+ForceDecode.h | 46 + .../SDWebImage/Core/UIImage+ForceDecode.m | 42 + Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h | 26 + Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m | 22 + .../SDWebImage/Core/UIImage+MemoryCacheCost.h | 27 + .../SDWebImage/Core/UIImage+MemoryCacheCost.m | 46 + .../SDWebImage/Core/UIImage+Metadata.h | 57 + .../SDWebImage/Core/UIImage+Metadata.m | 150 + .../SDWebImage/Core/UIImage+MultiFormat.h | 80 + .../SDWebImage/Core/UIImage+MultiFormat.m | 47 + .../SDWebImage/Core/UIImage+Transform.h | 146 + .../SDWebImage/Core/UIImage+Transform.m | 711 +++++ .../UIImageView+HighlightedWebCache.h | 43 +- .../Core/UIImageView+HighlightedWebCache.m | 76 + .../{ => Core}/UIImageView+WebCache.h | 70 +- .../SDWebImage/Core/UIImageView+WebCache.m | 67 + .../SDWebImage/Core/UIView+WebCache.h | 109 + .../SDWebImage/Core/UIView+WebCache.m | 427 +++ .../{ => Core}/UIView+WebCacheOperation.h | 23 +- .../Core/UIView+WebCacheOperation.m | 84 + .../SDWebImage/NSData+ImageContentType.h | 33 - .../SDWebImage/NSData+ImageContentType.m | 46 - Pods/SDWebImage/SDWebImage/NSImage+WebCache.m | 32 - .../Private/NSBezierPath+SDRoundedCorners.h | 24 + .../Private/NSBezierPath+SDRoundedCorners.m | 42 + .../SDWebImage/Private/SDAssociatedObject.h | 14 + .../SDWebImage/Private/SDAssociatedObject.m | 27 + .../Private/SDAsyncBlockOperation.h | 21 + .../Private/SDAsyncBlockOperation.m | 92 + .../SDWebImage/Private/SDDeviceHelper.h | 18 + .../SDWebImage/Private/SDDeviceHelper.m | 32 + .../SDWebImage/Private/SDDisplayLink.h | 29 + .../SDWebImage/Private/SDDisplayLink.m | 222 ++ .../Private/SDFileAttributeHelper.h | 19 + .../Private/SDFileAttributeHelper.m | 127 + .../SDWebImage/Private/SDImageAssetManager.h | 23 + .../SDWebImage/Private/SDImageAssetManager.m | 158 + .../Private/SDImageCachesManagerOperation.h | 21 + .../Private/SDImageCachesManagerOperation.m | 84 + .../Private/SDImageIOAnimatedCoderInternal.h | 28 + .../SDWebImage/Private/SDInternalMacros.h | 77 + .../SDInternalMacros.m} | 10 +- .../SDWeakProxy.h} | 9 +- .../SDWebImage/Private/SDWeakProxy.m | 79 + .../Private/SDWebImageTransitionInternal.h | 19 + .../SDWebImage/Private/SDmetamacros.h | 667 ++++ .../UIColor+SDHexString.h} | 10 +- .../SDWebImage/Private/UIColor+SDHexString.m | 42 + Pods/SDWebImage/SDWebImage/SDImageCache.h | 267 -- Pods/SDWebImage/SDWebImage/SDImageCache.m | 639 ---- .../SDWebImage/SDImageCacheConfig.h | 40 - .../SDWebImage/SDImageCacheConfig.m | 26 - Pods/SDWebImage/SDWebImage/SDWebImageCompat.m | 59 - .../SDWebImage/SDWebImage/SDWebImageDecoder.m | 279 -- .../SDWebImage/SDWebImageDownloader.h | 233 -- .../SDWebImage/SDWebImageDownloader.m | 315 -- .../SDWebImageDownloaderOperation.h | 122 - .../SDWebImageDownloaderOperation.m | 540 ---- .../SDWebImage/SDWebImage/SDWebImageManager.h | 275 -- .../SDWebImage/SDWebImage/SDWebImageManager.m | 336 -- .../SDWebImage/SDWebImagePrefetcher.h | 112 - .../SDWebImage/SDWebImagePrefetcher.m | 142 - .../SDWebImage/SDWebImage/UIButton+WebCache.m | 157 - Pods/SDWebImage/SDWebImage/UIImage+GIF.h | 24 - Pods/SDWebImage/SDWebImage/UIImage+GIF.m | 60 - .../SDWebImage/UIImage+MultiFormat.m | 161 - Pods/SDWebImage/SDWebImage/UIImage+WebP.m | 172 - .../UIImageView+HighlightedWebCache.m | 52 - .../SDWebImage/UIImageView+WebCache.m | 110 - Pods/SDWebImage/SDWebImage/UIView+WebCache.h | 82 - Pods/SDWebImage/SDWebImage/UIView+WebCache.m | 200 -- .../SDWebImage/UIView+WebCacheOperation.m | 68 - Pods/SDWebImage/WebImage/SDWebImage.h | 89 + Pods/SDWebImageWebPCoder/LICENSE | 19 + Pods/SDWebImageWebPCoder/README.md | 218 ++ .../Classes/SDImageWebPCoder.h | 22 + .../Classes/SDImageWebPCoder.m | 1125 +++++++ .../Classes/UIImage+WebP.h | 27 + .../Classes/UIImage+WebP.m | 21 + .../Module/SDWebImageWebPCoder.h | 15 + .../Module/SDWebImageWebPCoder.modulemap | 6 + ...BAWKWebView-WebP-acknowledgements.markdown | 25 +- ...ds-BAWKWebView-WebP-acknowledgements.plist | 35 +- .../Pods-BAWKWebView-WebP.debug.xcconfig | 13 +- .../Pods-BAWKWebView-WebP.release.xcconfig | 13 +- .../SDWebImage/SDWebImage-prefix.pch | 8 + .../SDWebImage/SDWebImage.debug.xcconfig | 12 + .../SDWebImage/SDWebImage.release.xcconfig | 12 + .../SDWebImageWebPCoder-dummy.m | 5 + .../SDWebImageWebPCoder-prefix.pch | 12 + .../SDWebImageWebPCoder.debug.xcconfig | 11 + .../SDWebImageWebPCoder.release.xcconfig | 11 + .../libwebp/libwebp-prefix.pch | 8 + .../libwebp/libwebp.debug.xcconfig | 11 + .../libwebp/libwebp.release.xcconfig | 11 + Pods/libwebp/README | 51 +- Pods/libwebp/README.mux | 35 +- Pods/libwebp/README.webp_js | 80 + Pods/libwebp/src/Makefile.am | 55 + Pods/libwebp/src/dec/Makefile.am | 29 + Pods/libwebp/src/dec/alpha_dec.c | 14 +- Pods/libwebp/src/dec/alphai_dec.h | 10 +- Pods/libwebp/src/dec/buffer_dec.c | 54 +- Pods/libwebp/src/dec/common_dec.h | 6 +- Pods/libwebp/src/dec/frame_dec.c | 39 +- Pods/libwebp/src/dec/idec_dec.c | 50 +- Pods/libwebp/src/dec/io_dec.c | 24 +- Pods/libwebp/src/dec/quant_dec.c | 19 +- Pods/libwebp/src/dec/tree_dec.c | 75 +- Pods/libwebp/src/dec/vp8_dec.c | 95 +- Pods/libwebp/src/dec/vp8_dec.h | 18 +- Pods/libwebp/src/dec/vp8i_dec.h | 23 +- Pods/libwebp/src/dec/vp8l_dec.c | 234 +- Pods/libwebp/src/dec/vp8li_dec.h | 34 +- Pods/libwebp/src/dec/webp_dec.c | 14 +- Pods/libwebp/src/dec/webpi_dec.h | 10 +- Pods/libwebp/src/demux/Makefile.am | 18 + Pods/libwebp/src/demux/anim_decode.c | 8 +- Pods/libwebp/src/demux/demux.c | 28 +- Pods/libwebp/src/demux/libwebpdemux.pc.in | 11 + Pods/libwebp/src/demux/libwebpdemux.rc | 41 + Pods/libwebp/src/dsp/Makefile.am | 185 ++ Pods/libwebp/src/dsp/alpha_processing.c | 141 +- .../src/dsp/alpha_processing_mips_dsp_r2.c | 101 +- Pods/libwebp/src/dsp/alpha_processing_neon.c | 4 +- Pods/libwebp/src/dsp/alpha_processing_sse2.c | 88 +- Pods/libwebp/src/dsp/alpha_processing_sse41.c | 10 +- Pods/libwebp/src/dsp/argb.c | 68 - Pods/libwebp/src/dsp/argb_mips_dsp_r2.c | 110 - Pods/libwebp/src/dsp/argb_sse2.c | 67 - Pods/libwebp/src/dsp/common_sse2.h | 14 +- Pods/libwebp/src/dsp/common_sse41.h | 132 + Pods/libwebp/src/dsp/cost.c | 29 +- Pods/libwebp/src/dsp/cost_mips32.c | 14 +- Pods/libwebp/src/dsp/cost_mips_dsp_r2.c | 8 +- Pods/libwebp/src/dsp/cost_neon.c | 122 + Pods/libwebp/src/dsp/cost_sse2.c | 18 +- Pods/libwebp/src/dsp/cpu.c | 8 +- Pods/libwebp/src/dsp/dec.c | 406 ++- Pods/libwebp/src/dsp/dec_clip_tables.c | 13 +- Pods/libwebp/src/dsp/dec_mips32.c | 4 +- Pods/libwebp/src/dsp/dec_mips_dsp_r2.c | 4 +- Pods/libwebp/src/dsp/dec_msa.c | 15 +- Pods/libwebp/src/dsp/dec_neon.c | 736 ++--- Pods/libwebp/src/dsp/dec_sse2.c | 478 ++- Pods/libwebp/src/dsp/dec_sse41.c | 10 +- Pods/libwebp/src/dsp/dsp.h | 154 +- Pods/libwebp/src/dsp/enc.c | 305 +- Pods/libwebp/src/dsp/enc_avx2.c | 21 - Pods/libwebp/src/dsp/enc_mips32.c | 77 +- Pods/libwebp/src/dsp/enc_mips_dsp_r2.c | 99 +- Pods/libwebp/src/dsp/enc_msa.c | 122 +- Pods/libwebp/src/dsp/enc_neon.c | 198 +- Pods/libwebp/src/dsp/enc_sse2.c | 479 ++- Pods/libwebp/src/dsp/enc_sse41.c | 66 +- Pods/libwebp/src/dsp/filters.c | 156 +- Pods/libwebp/src/dsp/filters_mips_dsp_r2.c | 97 +- Pods/libwebp/src/dsp/filters_msa.c | 22 +- Pods/libwebp/src/dsp/filters_neon.c | 18 +- Pods/libwebp/src/dsp/filters_sse2.c | 127 +- Pods/libwebp/src/dsp/lossless.c | 219 +- Pods/libwebp/src/dsp/lossless.h | 28 +- Pods/libwebp/src/dsp/lossless_common.h | 14 +- Pods/libwebp/src/dsp/lossless_enc.c | 238 +- Pods/libwebp/src/dsp/lossless_enc_mips32.c | 130 +- .../src/dsp/lossless_enc_mips_dsp_r2.c | 40 +- Pods/libwebp/src/dsp/lossless_enc_msa.c | 17 +- Pods/libwebp/src/dsp/lossless_enc_neon.c | 29 +- Pods/libwebp/src/dsp/lossless_enc_sse2.c | 147 +- Pods/libwebp/src/dsp/lossless_enc_sse41.c | 103 +- Pods/libwebp/src/dsp/lossless_mips_dsp_r2.c | 109 +- Pods/libwebp/src/dsp/lossless_msa.c | 41 +- Pods/libwebp/src/dsp/lossless_neon.c | 63 +- Pods/libwebp/src/dsp/lossless_sse2.c | 293 +- Pods/libwebp/src/dsp/msa_macro.h | 4 +- Pods/libwebp/src/dsp/neon.h | 11 +- Pods/libwebp/src/dsp/quant.h | 85 + Pods/libwebp/src/dsp/rescaler.c | 66 +- Pods/libwebp/src/dsp/rescaler_mips32.c | 26 +- Pods/libwebp/src/dsp/rescaler_mips_dsp_r2.c | 34 +- Pods/libwebp/src/dsp/rescaler_msa.c | 33 +- Pods/libwebp/src/dsp/rescaler_neon.c | 66 +- Pods/libwebp/src/dsp/rescaler_sse2.c | 131 +- Pods/libwebp/src/dsp/ssim.c | 159 + Pods/libwebp/src/dsp/ssim_sse2.c | 165 + Pods/libwebp/src/dsp/upsampling.c | 189 +- Pods/libwebp/src/dsp/upsampling_mips_dsp_r2.c | 47 +- Pods/libwebp/src/dsp/upsampling_msa.c | 60 +- Pods/libwebp/src/dsp/upsampling_neon.c | 62 +- Pods/libwebp/src/dsp/upsampling_sse2.c | 138 +- Pods/libwebp/src/dsp/upsampling_sse41.c | 239 ++ Pods/libwebp/src/dsp/yuv.c | 125 +- Pods/libwebp/src/dsp/yuv.h | 90 +- Pods/libwebp/src/dsp/yuv_mips32.c | 20 +- Pods/libwebp/src/dsp/yuv_mips_dsp_r2.c | 20 +- Pods/libwebp/src/dsp/yuv_neon.c | 288 ++ Pods/libwebp/src/dsp/yuv_sse2.c | 349 ++- Pods/libwebp/src/dsp/yuv_sse41.c | 613 ++++ Pods/libwebp/src/enc/Makefile.am | 42 + Pods/libwebp/src/enc/alpha_enc.c | 34 +- Pods/libwebp/src/enc/analysis_enc.c | 14 +- .../src/enc/backward_references_cost_enc.c | 790 +++++ .../libwebp/src/enc/backward_references_enc.c | 1491 ++------- .../libwebp/src/enc/backward_references_enc.h | 57 +- Pods/libwebp/src/enc/config_enc.c | 4 +- Pods/libwebp/src/enc/cost_enc.c | 2 +- Pods/libwebp/src/enc/cost_enc.h | 8 +- .../libwebp/src/enc/delta_palettization_enc.c | 455 --- .../libwebp/src/enc/delta_palettization_enc.h | 25 - Pods/libwebp/src/enc/filter_enc.c | 22 +- Pods/libwebp/src/enc/frame_enc.c | 52 +- Pods/libwebp/src/enc/histogram_enc.c | 819 +++-- Pods/libwebp/src/enc/histogram_enc.h | 33 +- Pods/libwebp/src/enc/iterator_enc.c | 12 +- Pods/libwebp/src/enc/near_lossless_enc.c | 73 +- Pods/libwebp/src/enc/picture_csp_enc.c | 241 +- Pods/libwebp/src/enc/picture_enc.c | 27 +- Pods/libwebp/src/enc/picture_psnr_enc.c | 55 +- Pods/libwebp/src/enc/picture_rescale_enc.c | 53 +- Pods/libwebp/src/enc/picture_tools_enc.c | 162 +- Pods/libwebp/src/enc/predictor_enc.c | 50 +- Pods/libwebp/src/enc/quant_enc.c | 143 +- Pods/libwebp/src/enc/syntax_enc.c | 14 +- Pods/libwebp/src/enc/token_enc.c | 42 +- Pods/libwebp/src/enc/tree_enc.c | 2 +- Pods/libwebp/src/enc/vp8i_enc.h | 54 +- Pods/libwebp/src/enc/vp8l_enc.c | 946 +++--- Pods/libwebp/src/enc/vp8li_enc.h | 55 +- Pods/libwebp/src/enc/webp_enc.c | 34 +- Pods/libwebp/src/libwebp.pc.in | 11 + Pods/libwebp/src/libwebp.rc | 41 + Pods/libwebp/src/libwebpdecoder.pc.in | 11 + Pods/libwebp/src/libwebpdecoder.rc | 41 + Pods/libwebp/src/mux/Makefile.am | 22 + Pods/libwebp/src/mux/anim_encode.c | 56 +- Pods/libwebp/src/mux/animi.h | 4 +- Pods/libwebp/src/mux/libwebpmux.pc.in | 12 + Pods/libwebp/src/mux/libwebpmux.rc | 41 + Pods/libwebp/src/mux/muxedit.c | 22 +- Pods/libwebp/src/mux/muxi.h | 26 +- Pods/libwebp/src/mux/muxinternal.c | 74 +- Pods/libwebp/src/mux/muxread.c | 72 +- Pods/libwebp/src/utils/Makefile.am | 51 + Pods/libwebp/src/utils/bit_reader_inl_utils.h | 27 +- Pods/libwebp/src/utils/bit_reader_utils.c | 92 +- Pods/libwebp/src/utils/bit_reader_utils.h | 44 +- Pods/libwebp/src/utils/bit_writer_utils.c | 36 +- Pods/libwebp/src/utils/bit_writer_utils.h | 18 +- Pods/libwebp/src/utils/color_cache_utils.c | 4 +- Pods/libwebp/src/utils/color_cache_utils.h | 26 +- Pods/libwebp/src/utils/endian_inl_utils.h | 19 +- Pods/libwebp/src/utils/filters_utils.c | 2 +- Pods/libwebp/src/utils/filters_utils.h | 10 +- Pods/libwebp/src/utils/huffman_encode_utils.c | 6 +- Pods/libwebp/src/utils/huffman_encode_utils.h | 8 +- Pods/libwebp/src/utils/huffman_utils.c | 32 +- Pods/libwebp/src/utils/huffman_utils.h | 12 +- .../src/utils/quant_levels_dec_utils.c | 17 +- .../src/utils/quant_levels_dec_utils.h | 8 +- Pods/libwebp/src/utils/quant_levels_utils.c | 2 +- Pods/libwebp/src/utils/quant_levels_utils.h | 8 +- Pods/libwebp/src/utils/random_utils.c | 2 +- Pods/libwebp/src/utils/random_utils.h | 8 +- Pods/libwebp/src/utils/rescaler_utils.c | 14 +- Pods/libwebp/src/utils/rescaler_utils.h | 8 +- Pods/libwebp/src/utils/thread_utils.c | 75 +- Pods/libwebp/src/utils/thread_utils.h | 19 +- Pods/libwebp/src/utils/utils.c | 21 +- Pods/libwebp/src/utils/utils.h | 62 +- Pods/libwebp/src/webp/decode.h | 104 +- Pods/libwebp/src/webp/demux.h | 69 +- Pods/libwebp/src/webp/encode.h | 144 +- Pods/libwebp/src/webp/format_constants.h | 2 +- Pods/libwebp/src/webp/mux.h | 74 +- Pods/libwebp/src/webp/mux_types.h | 12 +- Pods/libwebp/src/webp/types.h | 26 +- Pods/libwebp/src/webp/types.h.bak | 68 + 608 files changed, 35641 insertions(+), 13364 deletions(-) create mode 100644 BAWKWebView-WebP.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 BAWKWebView-WebP.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.h create mode 100644 BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.m create mode 120000 Pods/Headers/Private/SDWebImage/NSBezierPath+SDRoundedCorners.h create mode 120000 Pods/Headers/Private/SDWebImage/NSButton+WebCache.h create mode 120000 Pods/Headers/Private/SDWebImage/NSImage+Compatibility.h delete mode 120000 Pods/Headers/Private/SDWebImage/NSImage+WebCache.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAnimatedImage.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAnimatedImagePlayer.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAnimatedImageRep.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAnimatedImageView+WebCache.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAnimatedImageView.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAssociatedObject.h create mode 120000 Pods/Headers/Private/SDWebImage/SDAsyncBlockOperation.h create mode 120000 Pods/Headers/Private/SDWebImage/SDDeviceHelper.h create mode 120000 Pods/Headers/Private/SDWebImage/SDDiskCache.h create mode 120000 Pods/Headers/Private/SDWebImage/SDDisplayLink.h create mode 120000 Pods/Headers/Private/SDWebImage/SDFileAttributeHelper.h create mode 120000 Pods/Headers/Private/SDWebImage/SDGraphicsImageRenderer.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageAPNGCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageAWebPCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageAssetManager.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageCacheDefine.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageCachesManager.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageCachesManagerOperation.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageCoderHelper.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageCodersManager.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageFrame.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageGIFCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageGraphics.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageHEICCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoderInternal.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageIOCoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageLoader.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageLoadersManager.h create mode 120000 Pods/Headers/Private/SDWebImage/SDImageTransformer.h create mode 120000 Pods/Headers/Private/SDWebImage/SDInternalMacros.h create mode 120000 Pods/Headers/Private/SDWebImage/SDMemoryCache.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWeakProxy.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImage.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageCacheKeyFilter.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageCacheSerializer.h delete mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageDefine.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageDownloaderConfig.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageDownloaderDecryptor.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageDownloaderRequestModifier.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageDownloaderResponseModifier.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageError.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageIndicator.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageOptionsProcessor.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageTransition.h create mode 120000 Pods/Headers/Private/SDWebImage/SDWebImageTransitionInternal.h create mode 120000 Pods/Headers/Private/SDWebImage/SDmetamacros.h create mode 120000 Pods/Headers/Private/SDWebImage/UIColor+SDHexString.h create mode 120000 Pods/Headers/Private/SDWebImage/UIImage+ExtendedCacheData.h create mode 120000 Pods/Headers/Private/SDWebImage/UIImage+ForceDecode.h create mode 120000 Pods/Headers/Private/SDWebImage/UIImage+MemoryCacheCost.h create mode 120000 Pods/Headers/Private/SDWebImage/UIImage+Metadata.h create mode 120000 Pods/Headers/Private/SDWebImage/UIImage+Transform.h delete mode 120000 Pods/Headers/Private/SDWebImage/UIImage+WebP.h create mode 120000 Pods/Headers/Private/SDWebImageWebPCoder/SDImageWebPCoder.h create mode 120000 Pods/Headers/Private/SDWebImageWebPCoder/SDWebImageWebPCoder.h create mode 120000 Pods/Headers/Private/SDWebImageWebPCoder/UIImage+WebP.h create mode 120000 Pods/Headers/Private/libwebp/common_sse41.h create mode 120000 Pods/Headers/Private/libwebp/decode.h delete mode 120000 Pods/Headers/Private/libwebp/delta_palettization_enc.h create mode 120000 Pods/Headers/Private/libwebp/demux.h create mode 120000 Pods/Headers/Private/libwebp/encode.h create mode 120000 Pods/Headers/Private/libwebp/format_constants.h create mode 120000 Pods/Headers/Private/libwebp/mux.h create mode 120000 Pods/Headers/Private/libwebp/mux_types.h create mode 120000 Pods/Headers/Private/libwebp/quant.h create mode 120000 Pods/Headers/Private/libwebp/types.h delete mode 120000 Pods/Headers/Private/libwebp/webp/decode.h delete mode 120000 Pods/Headers/Private/libwebp/webp/demux.h delete mode 120000 Pods/Headers/Private/libwebp/webp/encode.h delete mode 120000 Pods/Headers/Private/libwebp/webp/format_constants.h delete mode 120000 Pods/Headers/Private/libwebp/webp/mux.h delete mode 120000 Pods/Headers/Private/libwebp/webp/mux_types.h delete mode 120000 Pods/Headers/Private/libwebp/webp/types.h create mode 120000 Pods/Headers/Public/SDWebImage/NSButton+WebCache.h create mode 120000 Pods/Headers/Public/SDWebImage/NSImage+Compatibility.h delete mode 120000 Pods/Headers/Public/SDWebImage/NSImage+WebCache.h create mode 120000 Pods/Headers/Public/SDWebImage/SDAnimatedImage.h create mode 120000 Pods/Headers/Public/SDWebImage/SDAnimatedImagePlayer.h create mode 120000 Pods/Headers/Public/SDWebImage/SDAnimatedImageRep.h create mode 120000 Pods/Headers/Public/SDWebImage/SDAnimatedImageView+WebCache.h create mode 120000 Pods/Headers/Public/SDWebImage/SDAnimatedImageView.h create mode 120000 Pods/Headers/Public/SDWebImage/SDDiskCache.h create mode 120000 Pods/Headers/Public/SDWebImage/SDGraphicsImageRenderer.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageAPNGCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageAWebPCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageCacheDefine.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageCachesManager.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageCoderHelper.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageCodersManager.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageFrame.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageGIFCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageGraphics.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageHEICCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageIOAnimatedCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageIOCoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageLoader.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageLoadersManager.h create mode 120000 Pods/Headers/Public/SDWebImage/SDImageTransformer.h create mode 120000 Pods/Headers/Public/SDWebImage/SDMemoryCache.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImage.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageCacheKeyFilter.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageCacheSerializer.h delete mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageDefine.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageDownloaderConfig.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageDownloaderDecryptor.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageDownloaderRequestModifier.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageDownloaderResponseModifier.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageError.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageIndicator.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageOptionsProcessor.h create mode 120000 Pods/Headers/Public/SDWebImage/SDWebImageTransition.h create mode 120000 Pods/Headers/Public/SDWebImage/UIImage+ExtendedCacheData.h create mode 120000 Pods/Headers/Public/SDWebImage/UIImage+ForceDecode.h create mode 120000 Pods/Headers/Public/SDWebImage/UIImage+MemoryCacheCost.h create mode 120000 Pods/Headers/Public/SDWebImage/UIImage+Metadata.h create mode 120000 Pods/Headers/Public/SDWebImage/UIImage+Transform.h delete mode 120000 Pods/Headers/Public/SDWebImage/UIImage+WebP.h create mode 120000 Pods/Headers/Public/SDWebImageWebPCoder/SDImageWebPCoder.h create mode 120000 Pods/Headers/Public/SDWebImageWebPCoder/SDWebImageWebPCoder.h create mode 120000 Pods/Headers/Public/SDWebImageWebPCoder/UIImage+WebP.h delete mode 120000 Pods/Headers/Public/libwebp/alphai_dec.h delete mode 120000 Pods/Headers/Public/libwebp/animi.h delete mode 120000 Pods/Headers/Public/libwebp/backward_references_enc.h delete mode 120000 Pods/Headers/Public/libwebp/bit_reader_inl_utils.h delete mode 120000 Pods/Headers/Public/libwebp/bit_reader_utils.h delete mode 120000 Pods/Headers/Public/libwebp/bit_writer_utils.h delete mode 120000 Pods/Headers/Public/libwebp/color_cache_utils.h delete mode 120000 Pods/Headers/Public/libwebp/common_dec.h delete mode 120000 Pods/Headers/Public/libwebp/common_sse2.h delete mode 120000 Pods/Headers/Public/libwebp/cost_enc.h create mode 120000 Pods/Headers/Public/libwebp/decode.h delete mode 120000 Pods/Headers/Public/libwebp/delta_palettization_enc.h create mode 120000 Pods/Headers/Public/libwebp/demux.h delete mode 120000 Pods/Headers/Public/libwebp/dsp.h create mode 120000 Pods/Headers/Public/libwebp/encode.h delete mode 120000 Pods/Headers/Public/libwebp/endian_inl_utils.h delete mode 120000 Pods/Headers/Public/libwebp/filters_utils.h create mode 120000 Pods/Headers/Public/libwebp/format_constants.h delete mode 120000 Pods/Headers/Public/libwebp/histogram_enc.h delete mode 120000 Pods/Headers/Public/libwebp/huffman_encode_utils.h delete mode 120000 Pods/Headers/Public/libwebp/huffman_utils.h delete mode 120000 Pods/Headers/Public/libwebp/lossless.h delete mode 120000 Pods/Headers/Public/libwebp/lossless_common.h delete mode 120000 Pods/Headers/Public/libwebp/mips_macro.h delete mode 120000 Pods/Headers/Public/libwebp/msa_macro.h create mode 120000 Pods/Headers/Public/libwebp/mux.h create mode 120000 Pods/Headers/Public/libwebp/mux_types.h delete mode 120000 Pods/Headers/Public/libwebp/muxi.h delete mode 120000 Pods/Headers/Public/libwebp/neon.h delete mode 120000 Pods/Headers/Public/libwebp/quant_levels_dec_utils.h delete mode 120000 Pods/Headers/Public/libwebp/quant_levels_utils.h delete mode 120000 Pods/Headers/Public/libwebp/random_utils.h delete mode 120000 Pods/Headers/Public/libwebp/rescaler_utils.h delete mode 120000 Pods/Headers/Public/libwebp/thread_utils.h create mode 120000 Pods/Headers/Public/libwebp/types.h delete mode 120000 Pods/Headers/Public/libwebp/utils.h delete mode 120000 Pods/Headers/Public/libwebp/vp8_dec.h delete mode 120000 Pods/Headers/Public/libwebp/vp8i_dec.h delete mode 120000 Pods/Headers/Public/libwebp/vp8i_enc.h delete mode 120000 Pods/Headers/Public/libwebp/vp8li_dec.h delete mode 120000 Pods/Headers/Public/libwebp/vp8li_enc.h delete mode 120000 Pods/Headers/Public/libwebp/webp/decode.h delete mode 120000 Pods/Headers/Public/libwebp/webp/demux.h delete mode 120000 Pods/Headers/Public/libwebp/webp/encode.h delete mode 120000 Pods/Headers/Public/libwebp/webp/format_constants.h delete mode 120000 Pods/Headers/Public/libwebp/webp/mux.h delete mode 120000 Pods/Headers/Public/libwebp/webp/mux_types.h delete mode 120000 Pods/Headers/Public/libwebp/webp/types.h delete mode 120000 Pods/Headers/Public/libwebp/webpi_dec.h delete mode 120000 Pods/Headers/Public/libwebp/yuv.h create mode 100644 Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/Pods-BAWKWebView-WebP.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImage.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImageWebPCoder.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/libwebp.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m rename Pods/SDWebImage/SDWebImage/{UIButton+WebCache.h => Core/SDAnimatedImageView+WebCache.h} (53%) create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCache.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m rename Pods/SDWebImage/SDWebImage/{ => Core}/SDWebImageCompat.h (59%) rename Pods/SDWebImage/SDWebImage/{NSImage+WebCache.h => Core/SDWebImageCompat.m} (56%) create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h rename Pods/SDWebImage/SDWebImage/{UIImage+WebP.h => Core/SDWebImageOperation.m} (61%) create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m rename Pods/SDWebImage/SDWebImage/{ => Core}/UIImageView+HighlightedWebCache.h (62%) create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m rename Pods/SDWebImage/SDWebImage/{ => Core}/UIImageView+WebCache.h (78%) create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m rename Pods/SDWebImage/SDWebImage/{ => Core}/UIView+WebCacheOperation.h (51%) create mode 100644 Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m delete mode 100644 Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h delete mode 100644 Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m delete mode 100644 Pods/SDWebImage/SDWebImage/NSImage+WebCache.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h rename Pods/SDWebImage/SDWebImage/{SDWebImageOperation.h => Private/SDInternalMacros.m} (67%) rename Pods/SDWebImage/SDWebImage/{SDWebImageDecoder.h => Private/SDWeakProxy.h} (52%) create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h create mode 100644 Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h rename Pods/SDWebImage/SDWebImage/{UIImage+MultiFormat.h => Private/UIColor+SDHexString.h} (52%) create mode 100644 Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDImageCache.h delete mode 100644 Pods/SDWebImage/SDWebImage/SDImageCache.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h delete mode 100644 Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageCompat.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageDownloader.h delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageDownloader.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageManager.h delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImageManager.m delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h delete mode 100644 Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIButton+WebCache.m delete mode 100755 Pods/SDWebImage/SDWebImage/UIImage+GIF.h delete mode 100755 Pods/SDWebImage/SDWebImage/UIImage+GIF.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIImage+WebP.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIView+WebCache.h delete mode 100644 Pods/SDWebImage/SDWebImage/UIView+WebCache.m delete mode 100644 Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m create mode 100644 Pods/SDWebImage/WebImage/SDWebImage.h create mode 100644 Pods/SDWebImageWebPCoder/LICENSE create mode 100644 Pods/SDWebImageWebPCoder/README.md create mode 100644 Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h create mode 100644 Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m create mode 100644 Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.h create mode 100644 Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.m create mode 100644 Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h create mode 100644 Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.modulemap create mode 100644 Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig create mode 100644 Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig create mode 100644 Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-dummy.m create mode 100644 Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-prefix.pch create mode 100644 Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.debug.xcconfig create mode 100644 Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.release.xcconfig create mode 100644 Pods/Target Support Files/libwebp/libwebp.debug.xcconfig create mode 100644 Pods/Target Support Files/libwebp/libwebp.release.xcconfig create mode 100644 Pods/libwebp/README.webp_js create mode 100644 Pods/libwebp/src/Makefile.am create mode 100644 Pods/libwebp/src/dec/Makefile.am create mode 100644 Pods/libwebp/src/demux/Makefile.am create mode 100644 Pods/libwebp/src/demux/libwebpdemux.pc.in create mode 100644 Pods/libwebp/src/demux/libwebpdemux.rc create mode 100644 Pods/libwebp/src/dsp/Makefile.am delete mode 100644 Pods/libwebp/src/dsp/argb.c delete mode 100644 Pods/libwebp/src/dsp/argb_mips_dsp_r2.c delete mode 100644 Pods/libwebp/src/dsp/argb_sse2.c create mode 100644 Pods/libwebp/src/dsp/common_sse41.h create mode 100644 Pods/libwebp/src/dsp/cost_neon.c delete mode 100644 Pods/libwebp/src/dsp/enc_avx2.c create mode 100644 Pods/libwebp/src/dsp/quant.h create mode 100644 Pods/libwebp/src/dsp/ssim.c create mode 100644 Pods/libwebp/src/dsp/ssim_sse2.c create mode 100644 Pods/libwebp/src/dsp/upsampling_sse41.c create mode 100644 Pods/libwebp/src/dsp/yuv_neon.c create mode 100644 Pods/libwebp/src/dsp/yuv_sse41.c create mode 100644 Pods/libwebp/src/enc/Makefile.am create mode 100644 Pods/libwebp/src/enc/backward_references_cost_enc.c delete mode 100644 Pods/libwebp/src/enc/delta_palettization_enc.c delete mode 100644 Pods/libwebp/src/enc/delta_palettization_enc.h create mode 100644 Pods/libwebp/src/libwebp.pc.in create mode 100644 Pods/libwebp/src/libwebp.rc create mode 100644 Pods/libwebp/src/libwebpdecoder.pc.in create mode 100644 Pods/libwebp/src/libwebpdecoder.rc create mode 100644 Pods/libwebp/src/mux/Makefile.am create mode 100644 Pods/libwebp/src/mux/libwebpmux.pc.in create mode 100644 Pods/libwebp/src/mux/libwebpmux.rc create mode 100644 Pods/libwebp/src/utils/Makefile.am create mode 100644 Pods/libwebp/src/webp/types.h.bak diff --git a/BAWKWebView-WebP.xcodeproj/project.pbxproj b/BAWKWebView-WebP.xcodeproj/project.pbxproj index 92f04d5..5e1b089 100644 --- a/BAWKWebView-WebP.xcodeproj/project.pbxproj +++ b/BAWKWebView-WebP.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 2F07DB7F1F316A6600591F87 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2F07DB7E1F316A6600591F87 /* Assets.xcassets */; }; 2F07DB821F316A6600591F87 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F07DB801F316A6600591F87 /* LaunchScreen.storyboard */; }; 2F07DB921F31725600591F87 /* BAWebpController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F07DB911F31725600591F87 /* BAWebpController.m */; }; + 461460C02521D80D000A43FB /* NSObject+RuntimeInvoker.m in Sources */ = {isa = PBXBuildFile; fileRef = 461460BF2521D80D000A43FB /* NSObject+RuntimeInvoker.m */; }; 60A835DFB6D4CE808DC2ACFB /* libPods-BAWKWebView-WebP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FC0889131276AE7F58D8BE0D /* libPods-BAWKWebView-WebP.a */; }; C4C3BE131F31D360009B89D4 /* NSURLProtocol+BAWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = C4BEC3F51F31C71800A2054F /* NSURLProtocol+BAWebView.m */; }; C4C3BE141F31D360009B89D4 /* BAURLSessionProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = C4BEC3F21F31C71800A2054F /* BAURLSessionProtocol.m */; }; @@ -33,6 +34,8 @@ 2F07DB831F316A6600591F87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2F07DB901F31725600591F87 /* BAWebpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BAWebpController.h; sourceTree = ""; }; 2F07DB911F31725600591F87 /* BAWebpController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BAWebpController.m; sourceTree = ""; }; + 461460BE2521D80D000A43FB /* NSObject+RuntimeInvoker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+RuntimeInvoker.h"; sourceTree = ""; }; + 461460BF2521D80D000A43FB /* NSObject+RuntimeInvoker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+RuntimeInvoker.m"; sourceTree = ""; }; C4BEC3F11F31C71800A2054F /* BAURLSessionProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAURLSessionProtocol.h; sourceTree = ""; }; C4BEC3F21F31C71800A2054F /* BAURLSessionProtocol.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BAURLSessionProtocol.m; sourceTree = ""; }; C4BEC3F31F31C71800A2054F /* BAWKWebView_WebP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAWKWebView_WebP.h; sourceTree = ""; }; @@ -99,9 +102,19 @@ name = "Supporting Files"; sourceTree = ""; }; + 461460BD2521D80D000A43FB /* JKInvoker */ = { + isa = PBXGroup; + children = ( + 461460BE2521D80D000A43FB /* NSObject+RuntimeInvoker.h */, + 461460BF2521D80D000A43FB /* NSObject+RuntimeInvoker.m */, + ); + path = JKInvoker; + sourceTree = ""; + }; C4BEC3F01F31C71800A2054F /* BAWKWebView-WebP */ = { isa = PBXGroup; children = ( + 461460BD2521D80D000A43FB /* JKInvoker */, C4BEC3F11F31C71800A2054F /* BAURLSessionProtocol.h */, C4BEC3F21F31C71800A2054F /* BAURLSessionProtocol.m */, C4BEC3F31F31C71800A2054F /* BAWKWebView_WebP.h */, @@ -139,8 +152,6 @@ 2F07DB6B1F316A6600591F87 /* Sources */, 2F07DB6C1F316A6600591F87 /* Frameworks */, 2F07DB6D1F316A6600591F87 /* Resources */, - 058224387ED777999BE43788 /* [CP] Embed Pods Frameworks */, - 623A3DB3A6E321F9A2706320 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -172,6 +183,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -199,49 +211,22 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 058224387ED777999BE43788 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 623A3DB3A6E321F9A2706320 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 6AA7E8A1F9BE664BA6F91F11 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-BAWKWebView-WebP-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -257,6 +242,7 @@ 2F07DB921F31725600591F87 /* BAWebpController.m in Sources */, C4C3BE131F31D360009B89D4 /* NSURLProtocol+BAWebView.m in Sources */, C4C3BE141F31D360009B89D4 /* BAURLSessionProtocol.m in Sources */, + 461460C02521D80D000A43FB /* NSObject+RuntimeInvoker.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -323,7 +309,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -365,7 +351,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; @@ -379,6 +365,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = JB3QR65942; INFOPLIST_FILE = "BAWKWebView-WebP/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.boai.BAWKWebView-WebP"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -392,6 +379,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = JB3QR65942; INFOPLIST_FILE = "BAWKWebView-WebP/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.boai.BAWKWebView-WebP"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/BAWKWebView-WebP.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist b/BAWKWebView-WebP.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..e508695 --- /dev/null +++ b/BAWKWebView-WebP.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + BAWKWebView-WebP.xcscheme_^#shared#^_ + + orderHint + 4 + + + + diff --git a/BAWKWebView-WebP.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/BAWKWebView-WebP.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/BAWKWebView-WebP.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate b/BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..d9e567b5a9f755cc0030d3860c4fbe7e319dacde GIT binary patch literal 51165 zcmeEvcVHCNxBuLGr_XHI&^v+9A)OR@I)oZh=nyu^CRs?bVK<>jn~R8u1uKeJNGKXa zu%n2*D}sW6T@X>QV!;BazjJ4HLPCHqKi+%4_xl52m)V)y&*z?d?m2hP$*(B&_$wnL zKj09DIl}Rrz=@p1sS~@-ar^upZ~3IIE?+^32Y%&rt@Kt*?CQ;*=`N`BH|5asb$QMv zW3orO=erA&0*T(|WKPM=u5?wp4YVzoZ^LPv&b8uNb8WZ?E|QDlqPZBZ9~aBTaq(ON z*Plz{(z#*Wa4v%z%jI(8xvAVtZWdR{m2u^qm#g4rb5-1YZV`74x176{TgBbX-NN0< z-NxO;t>y0LHgdJxX6{AqCGKVJ74B8;HSTrp4em|uE$&_J18zTefIG;2#(mCx&3(fi z1YHRiN>N#l!J27Bs3XKM|r3K6`~U4L1m~M z`H&yYMf1=?vxD1zLFRs9|aTQ*Om*T7O z_4o#SBfbN###`{icq`t9AHk2}$MEC$3H&5}2ET}3!Y|`j@LTw8ych4oAK*{%XZTnA z8$OAD$A92I@n859K8?>1jz~l%3TZ-|q%~KmgJK0WID+sGe`;XkR`+*lq@AzlV#)@vYcE?R*)OWZRB=x2U$z*Asfg>vWaXZ z+sJF=b@B#zle|UVChw44?I$OkI5(GF!_>vOTHuDli$cmUgLG%!3Xh8cqbps zH|3l0&H2`RCq9Jl%=h4X@{xQLAI%To2lC_iEIymh;dA-%`~-d?KZ&2rPv_ly5nsxe z@m2gBel9PwlaYB|*B6x(E!YrXwC=<#BuTUY(7OI4W!Xja@uuQl{ zxKX%CSS8#n+$F3Lwh502j|z_oj|)!-PYO>7+l8lvox&@^tHNu-JHjsE17W{#KsYFT zAsiBZ7yc0b6#f!U38#fK!r#I_!oMOBRZ$alv8mWhY$vuCJBZ!H?&2VEusB2;uNQ9+ZxnA4 z?-JLDcZ=)9YOz+_EIuSYEMC`Ux=VefFez4wlj5ZWDN#z2CP)*d zNz!C#iZoT4CQX;}q#077G)pR#e3D;UAT5*@NsFZ=(zVhG=|1UxX`NIp)ky254bnzw zlk|Y}ko1`Jxb%dyLwZ(vMS4|wO?qA0E$xwxN?%LgNXMk((znug()ZF2(vQ+F(qGak znUj&M$f~T#y6li!$Svi*a+n-0N63+KlpHO`$o=G4xxbt!r_00Sv2vz7PM#!BmMi4h zvQPHQm2#ClN1iLsljqBeCLfi*mcN&OkbhJ}MN(u%QB*}!bj6_rDNPio609^; znkmhd7D`K{mC{-1qJ%14mA*=x60amE{gnaAKxL4Ut_)L#D;Y|*lB47*pzatbC~)QNB`sSN>4`RQ^&bTwZsPzzPJTBH`MC8|fAsm@YM)iSkQ^{PI# zN}Z<~Dpi-NH>s=Co7G#?Th-gt+tqdI1L{NSHuZ7!3H3?!8Fh#Hy84Ftruvrpwz^y0 zqwZG^s2{7JsE5=O>d)#g>aXf=>Pd}gye4R(CTX%3q&3l;TCmn!Ypr$BLbcvnq!y*c zYW=kV+7K;SOVLub;aY|^LK~@#(z3K{ZM-%?o2E_IinL;_L|dU)ek*KW{m)NayN zX*X-PXt!#&X}4>4Xsfk5wR^SuwDsD<+E#6w_K5bV_L#O)dro^^dqI0edqaCu+pX=< z4rm{1pJ-obhqSM>W7=`;2kmF=q>gl~6P?!uJy>t5H`ANzE%bJJd%d&XNAIhL>G67k z-d`W8C+ewsran&3(zEp(eY&2f&(K|Zu|8K{q%YG~=-25t>bK~3=&SX+^|ksv`n`I! zzFB`n->yHazo5UOzoEaW@6zAZck2iB&-5euH~KOCd;Ns|vwqT{Idq4^5#(s%a5{n= zO&!e~%^j^BogCd9-5ueM2uGwN!O`C_*pcKI;mCAMa7=OJISL%bjuJAJG z@LBHp{>kuvK>irtwV>4H_t$X2TvG!Zq=swGwEzx|j~T=AoXs;*(JDGtxNW~U9&2@p7Kh6QbDC>4oFLddCs<}?jl!JX=PfW zr_$>)Whj5T*O!|$%0Jai=FToCahJKF0PAN~Re7r0U+F1#Rf43J=ZqZX@>iyK%PLCU zP+%q#;QW=)aVuN0%MWrItIkt7Kg(U=^}&cVu?J^@r@YWR*AK0*u9AE{S9vkiR$iIv z&aW!YC@=Ct@@#i0NPq6ay5z01+y#)vYO`G!YqDaG;{a|b7rucT$PMBKb3+WL5o|Oy znr+|`xg;)`OEH=o;l?N(XG^w6 zU<5ac3$Nxz8ZD~1(MD^d^FA&UpgoSu;I%@p|G=Pm_W&T$)@(aLC<=gcgE z1`mjch{*K=H6zOAlvU1&u$$wL80M)gsmhN?PMR=sf;)e_$2~U;{?BZ5BYYkk*9sWW zz1#$DA~%VfJlUE*<*qXKMC;P+&mEHul&gWqQznkd9%~Bvb|0p31zh+>ZaSC8&EQ;I zzR|{LYqT@k8yz-sg`Ar!;)=NvqodKu2r;@CVT_vAVA*uE=$Gkp&+&Mx`~l)xH&fV5 z&U5xP2lxExb6mb+cK~I9n$hFPnI^A~P|*&fhQ-U4$bL0h^vC@4^fb+3L? z@|>+2B&=U!)5gi|!Sr!{E_~fOqq9YhIo#YlXR|TcqpK=i`K9hu4@^>Txyv_yJvWD& z$4!|!Cj0EYy(U|{id$ICEigijz8`Rlxh0$dc%s}=?rLt?B)>UF+1{ufa#Q|OG8p^R@j2&awrW|!-3{}T zF~j*a+!}6*-LZSPdo2puH`Z}AY>rnO5!Kv!BdXyXf6$!Ik$KL=^TOt_sTfx1@dM`F zW%;G^VR{3N3TEXM`Cu{*Ep=6u7nEeX{cQK0+ojcl7?kRIsE~UWdEiE+{+i-7Dk>3rAV&jth^-`63%Aq~y?^04# zWr^1Z6*Yd$$e!*kE%cNZTT}RLHih3Y1{r;=-@Cbm8@N3%#_%x)!^pBvU#I5eWSedu zavyUotGSPiq-yRHBbiA$AT*R#x~w4|)v&*It}nPRxt2BDA?~n|Vx-n^N4T$yG$Y*@ zHidO1qrA{P&+VUXbBIyy^5V)8t4YVXh3kyI!C1B?!#wVX8pe-8xxgR0h7;VctcIVt zUyKpP$a*#87D12CE!)m@iaW!m%xPnEHTSnMw!xG^*qkzB@|@B3lqvNV!&HfhiHqu& zo)#GvpB5ht5?p$GSpR;}v0+JRaq)5SQ7Qf6<6;68AOT5G0TPYOY9t%u7);w-kms8{ zM!MN!yMQLBHy6Im*%mobFlvgLq2{OsYKdB*)~F3?i`t>~r~~SVI-wBM8FfLSs4MD* zx}zSbC+cNn8@a{=W0En&m}cY|E~CJ38^wmlm}Qh1USqc5H>!-e#(ZOevB+3rP~&Rj z8dg;w)E9-Ja1?iF5``4(TEWvfopqb!BE*UW*^wdFi|CN zKfD2<^34WK&vTalPcc%{I))bI!lKHe421ax+Xy^ko-WLDPPx1>J-4U8_{`O(UY8pZ@iDW)#d*$W>}fyR$uIRdCDe3$F+~sh2oAb!6jo z{=!)imMSk|lqcT@+L8!!Up$woeIwGnRpl_}VAmIJZmZedh~aJ*NN9eLJ7B?Y*q!ZW zcZ~mKaj*e+cA8CEn&GZm&ka8+TlqwgsI+f1BDCbOy97 zt80*q{sq;;oyM?pG%Uf04}IZ;rAP_Xhy^U0dK4^y9_8)}=e5%Z;nn~u+ypyuFm8&Q z;pVsnZi!nN_ZasY_Zjya>x^on##nD`sKsq8P~i?1sBmXvV*peS20-=j6;NFUsBjp7 z3Wpn;0-(ZC04f~K?PMS00RR>I^mS(1MC*?S0<7==qqZ6kGB#fttZ*VuF=2(10ag!z ziVdfM5^qamSSe4~6^+27Ei{b+G;O_b7CU`5p2pCWgLCnCJONL{lkj9b1y3~|F&;G@ zGafgdFrGA?GPWB}*W&2`H04`bVO(T96F}3m0j=M`HdYmn&w=LMd3ww z3B%H2V`nusjOQ*9OUv-J01SK$cgT3&NU6aqKs)*ZFsVi?3MbjvxC!54Vd-YT(o4XZ z@CwNALZd8p`a5wo!_r-N4Za(%#rNQQ@qPGyyv}&Vc-45#c-?rzc++^xc-wfV7S{x@ zv?+k4&Bm?(mfjCw>A)2%T@IF>Vp!U4ylZ1=2jfi7;+^n$-q>yIfzNxunVLJ>Is4dz zdlkRV5cQg|w;I1;?7Kuny@Pi%MC}4ZeZUa42N1RYe29|!*%j@_A6key2#7k!5VZ#~ z?7twQKF7xxqQ1a~@L~KVK7zl(NAcHipyDIrW8)L!Q{yw^bK?u+ka4&c9}ghv2mB-c ziQA5UHogoX>TBaW<9oRN;R>QI2T^}BMEzqN2_T9fKor4*u#fSTan$_ubqY@V6b(^{ z4tOG(@l7>x80O)e|7@}%!K68WgER#^9S1y-7J#R3&xfb}M?w=LEg>oxT@}C<=|DnE zY>`fYtsenfqy=RD_CnYq-AN>1i}WBpNiWiy^dWso7zrm4#tGwR;}_#s<2U1^@w@Sd z@n>$D|DQN&#V*JXf{1CV?3B56DDhDu_}4HbRE;sEs8TDYURuV2q#$T{w%KVJ4|$V46ir zNf{|8UQ$736Cd$YL@44Z5-1WWk|>fXQYca>(rQUn09Es?HIOW#NVi}`k<(fQDQa;A zSC@mU>lm(9Qsl6KbtB_iH<4BBLs1Y#O{{NN3w5Vx({VMqivjFTih`@j8j6};BE;?` z>lp94k2^$BGse8Y_)Jmr^KmZ{VORD5*=(V#mZ7XAV_DV4IF{{Pq0G+l2-(44_9%Ib zJWie&n$e-jd za*CWLXUN~=AM!6nVHAZ^6hToWMNt$*Qxro{KZ;^&d1Qf%7c7wRz~tg=kPWawHuMU} zE(2tI3ji74lA`zk$lwL5g&X*`d^`4`D1oB>);I97U}s!_j(iusE5M8orD$L^-;JU{ zmj*Mw7vC2U!}n&qY%uULK8!m;(GXZN&t*%&*k+u33?FC0jE`k7ON14Z4>QtOwsSMt z%^Sq01I+lr{1AR9pU5Zi$$Sc*%0r%HiU8lK6v1^mMZ+i>PEiI$BWn3!0ho>CM`6&C z@?$9)X~S#`McJ^w8A?&k6`WlT&ZaP&O{Hj*jk7$4vl-T3ibmJ{1Dt_o+thLM#k_~1 ztc0Sm)%;9~GA|Kj<@{`hGA~2fIEFGGLs{1OP{!XLnmDw9(v+XiFSOvcfWa-7!Oh3u zmUTh6E#+@uaJ!mc#$UrP=da~g@YnGx`Rgf~K+!~sCQ&q*qA3)?08FE3Iz@T4{EY#) z-D1i8{2dg{u;Er{Oa7iKXuBM=RWr2JP~@`FwvnN26aN7FP?S$mf%Oe&Q=M&Wylv$l zVR+j{k-M6Il%k?b#M_hn(+n|(`0Z@*EM|z=!4Ol@2r<`Y~dA{T@K8?VK6&J(Ht9Q-!Tbo6-a3Cfn5NT(BR9kEkOJ){BI0kzfv@> znmgQMAGa7;wOwDFS07MYmpo*kwRW=mQWF;Oy;n0f-3^05KtwpTRy9tu)t7_6?lu z4x5hgLVtjn0K(f1)xrRZZoD*@2}6V=laC3BjE~&}h!Ij4VpcUmOmNqaLlYCMb<=sB zUGE6NG7t%1Afo8Di{!U+WDCqhB;*LW!gyhVFj1H!OctgHuuj5qxSAr^EZ;@Z8j9|w zXe~weP;_st5U>>q`S?en5D-^H(S0`JYK-qFdVm4$!7G5f9KbPqkpN4_{Wjp3!AO`Z z%wr#l)=^Y#eFNZ{Ig4yUE)gh$959LX)dDby4VMVH<-&Cq=sE2}@iPexvAZ8*#gBac$of zyj=#~L=NyKB8uJ#;7#NKZ=xWI>_gEmir%%p0dK^K19TJ}ViUld7(~&YYSBs2dzXec zvANg^5F@r=czYl4CbnjH+j~B|DJ$&CI*Of5n28|_W*-2|#MTUEdoKhtv4{l!I z8)io+I!57C6EL=KuK?|GfR@gH2CAh)Hqb^eppE2qilf=S;4s@4d}(TKr#YwFl+PA( z8O(Ah`l?zSPtnm!gxO?q8biz>aVlFuzh;QZV~F{t5n_S|{TiCsFCer{wCgPrLCFH| z+KD9$ao=4ezn#M?&S!|L5NC@%(JxktRpK0Rt_ae>4;1}K(N7eepy+3cexV4qI>5qC z){0jJ5VzQ3Y$C`AzuSmAWiz&aui))+@OBf!+bW9wu<>>)!`p4*?d(I*pA`LNeFI~Y zovmy-t`+ZPhy$VebhUUNg#(6{^!}$ zFnd*eO?Vy{+nW??0hr++ikpEz0gMedzXG(&0on%)X!|MFZJ>R~fc6o<>>~mcaWIr& z2OQhz>l|j2@sJ2_3s;MWDQ;3Ng5MJ7C8F#b@mm0lcnp?L9L$!_??C5)o1RbS;n@+I z*t3DSCjKJASzE@{eq(TJ0UHGIJJ?r1{tMU)#M6?%;C4p*Tl`1-SK=fjVTnk9vQ`wg zrnn8oZ7FU?aeIn8P~4H?PPLL~!A(-dcuD8BO8~JD8*W|MI*NNSxb?mQx66Q=)E3|- z!H9Pbz)k81aFaSoA?!nO7m7ozZ+NGiIGim4kdt~yy#R7jPl~%$OT8)Xerb@C!lfva zu}P7@*l-WvQBn*rHr%rjXo44h987EpQR*)ZGQlPdWME@<&1n;s}Z(DUPBzn&KFW`%xTQD~%3-ZJd-PWdqo9DYosPxIe{1 zCl>KcaGQ>0l9wS3-gh5REmcrF z@Dh<$Db2NzHisc?5JSv-hP1(rk>)55O^gi)ZSi)!hIF-sxTOqnNf*g)=eSO~jUjHO zbiH(gbfa{Wv`V^Jx<$H`VrW1r#lRcWDIP}gaEdc1hEhk?O1B3PcbBvVPM>d=?xA>; z&E7I8&V{4s0J!m20CzcndyoOHmSRxdn!X~WEevoEOIz88;xQDDwY~vxIZpdzkMyLp zok8v?ipNz;Pg4wL$xHFtA?=i2upkFVv?wgE~gRXz!mG%qoIkDUo=r?1LzIu zZ3}X5G0080NPauVd(y`Ya_>ufrG3%|(thcHbWr+G`iSC56i=pj3dK_?o<{L>it{L* zL9we=`Xm6kFQh}#VSwBbit}yAxhbAW@hpb9(kqy|9L)X1Fn5CD0vmI`GR*xZJkLH9 z7czaD`3);7;%q{mmf#hnYUvEcMb*+j6c=9_O*7UWT&Yr~7rr)wj-ZLnm? zpmBjcf}F$PWdKK$M=_4LxDh<<98+XBgV$7fnmk?3lV`{-IbSZ23n^Yo@zoSBqxc$% zms5N##VaVjj^dTIa!~+YGv!%wDYsn)Vc~ikUaKg+o#HzfM_YXbV3z|h=D1E?K=BPW zz!n3*q!^~}sFcUnIh9(XVur$A2@7*%!To~r=VVJw~BKhqc>*a?T<~GP1#GHs&@2v~9Td3gRvY zaW6B(y+ZMN8*#5+l%>5Z?_o&WP4UKR`8|rkvUw@;n*4!$kRj!ee1IYC0k-&k#1_v7 z8zT*e*^xM|g#?ke+?&d+nUs9)J=aM@ML+;=o;1o*5d@PQj$a1QCI zU>+*`wug$Se&OKBvB^1i&v$1?;hf4sv)f_kq#lr*loZoHA-!K%a!Nv4SU>RM7?zNn zlpL0p5|^5k9+MoGmKrsFUP4@6T)**_hm6VAe^JqWZU1&kYo$FGzFujgv{l+s{1U}4 zQ~b($rGwH@=|u6X6n{zKr8@9>7YPVy==nF`B^dl;WLK4yf%6OtJlXDI=J6MXzICH4 zV=I_D4S3YD(W4wsWvScT6e-=5J{y(pN)M%{(o5-0@oNjQ_zdCoo;PnZlY zHnZIoE+6wUlIQGo@zhow<6Wgy?$AWpS``YokZza@x$p#21}jPD>r}Fm!U*y%#lTg7 zAfbs?f!w%|+~g`xX`wwRBa|`c%Rg4hRA9||pW?j~gE2WY(PzkC1zZ!QP;oQI#LREe*x;5A=G%cn5GK4JN|zrXL{@Tq zUT-Bt2XS`M^k&UFb_(g;Ct~2B!9%(YO&K|A^q8@^lO|7@UQkpqcizG!0cYTjpeD}X zrr?w~Ko`qnG5EzzssyH&UsdV$gA?%12APyyRZ!q|7rG1gwP+dCs%?k!xDKyr-NxVz zp{8AXaOBdfs`rUQm=1+=PsdLgSvI^(X$sk$@X03hI)(AOI^i&=7`q~ zzCb+{fFXFuxNc}-cZ(RoE1cjITr%2C4$n>>lO2`}t}pin^$iP$t{^s?QR z;19gmf4(HS8M%INRX7%0s`@;I^-F1Oml8-)mwRu^pv2_rByif@k~K1QScjUlbmqXj zW_X6t3|x1&$aA)X2H2G|=ipvnMj`MJ@LJ=BdDg1#Df2aW_KA~oihDE1Wo4hw5p@HH z$2D0wb>65U$M^};>pUf!etFlApU8Y@o7cdFt>IvUZ}t`#zI7+9tfIu_htad{LrGJo zUBK(|)T|tMoCp5?oaYj5y(=F)Vm7)Bw=58yB{7sx=ng=urZ8uJafxSU(5%w3axXM? zLW!r+4ZUP+7}gfxxaJQ)UpDht4@(z3tMXTR%S=d`HpJOv@cz!h`I zFc&OZA<^N{A>b&F`6psY{(JwFl~%EKvp=2Sqx)xNkA(ljq5aDWU8(FE4pgGY3S4Q~ zf$MMQc*c)`>qL&jT`DS*v*3CJT<2HK%1wgnzHq&z$d{fA*F)g?!;-4u>>6zRq~%p5 zITPTzBV3Ot&mS`ut_Q$%Nr69QGFzWdG2BQ;<8F|}NnUMq6P#^ix=gng2dvhE= zsL-97X5HtDW_d@lHgtjePx$9#v-@V7uPRAl?S#7c12bJCGT|DS82_8QbQntyA$ zggVTHaDL7MZqeCQG3SCXQ7*WOhV;?gFi2GnA0MRfLl7yJ!p9x0dv51oc`D$E7rfSc zAk@?_vmC1==F8s7$I9@+hy7yZ9y7}=2-Fu2^`&&&2*IgBxDp5}RSw@F+-UBQd1oH9 zuMB>tz}+f%Rt(qmYl#LNMMDq()>f+x>^ZCDc%T+9v&x(rGH;v1fzR7Gc>wCyjU!JF6&#Ds_ zp_)ZsyCg>8um*G+TOSuDQVJX40_qa>3hxP@3mXeIk4ce?O{gPbReA z#seFBh8z!kd*H5(01H_K<{d_hQuxd0(zu;xX=askP6>#Z^|Br%nWZpaO!mWAK5aA4O1p!2}K2`=WRUiBH z5x~aF9xayMrqoPx)EZNwK4KWfF0DoN%W23FEb5rEE+{l8Do6_I9TXds6oi60!{6wj zM7RnK>Jl_6s1-aN9@HZ!HK<+Pcvy3swS!TQAO zx;0*mqn*F?^=F1#9012G)5IQT*=Fw`l-Y1GoeL48*nK!}IRdWxvs9Jtc_4dmT#C11 zzRy!!QW?Vh9J)g?$_v8#hD1k3!Rp3jCYFZdejR7ZLa61gf-2t}>mJYk6F3#*spb&o zup<`=t92OkDxMn%Yi1hA0Aslvh^jIj`cVRu^ufq3# zf=PHJ`23oNiy?5}Rd^Y`3A{GdK)}GK@Jsj|ydV7Se1}g$06>kjB%Q%8N&Bx1IE36Q;AiuT`5Pdp-h=#8{Hy#v z2$^?+{|8=MYA^H=20-w;i9#{Ft*~5JEo_2dcCP`4J}UeU$9!7?ed2*`lf;?g0thd6 zueeQo5yHnE5l>1I1cvJ)4VK1AE~!#lF0GNaNH2ip@~HGDglFpn!PwFv@LIXN6hf5&$?7JLH`&wVd#B>;?o4sI zoQs`nozFNAI!^{S3yumN8(bEAL-6L{w}Ou~m6~>Mn%19VHlo4(TYNHfwbv{_2C zf@W7Y+tBQ_W=ETg&3iP@Xg;&~_01n{zPtH}7EN39YcamXycTO)JlEn-OVYA?%Z!$# zEmyUCtmT20r&@JrmDI}J>bh22TkUQ2N9%U26I;7muWY@o_5RkU+Jv-8Ycs3OEp4{9 z`K&G9ws+fcZRfVVukCAXzi-#P-N1GQ?N+vXtlh`$ar@rwv)V6czrOvh_9r`Z>@ciD zMTa#VUg_|C$Ce!vJI?HQd&lQH9`Dqw(~wS{PPcb@q0_e^Ekcq)N<;1nc{Suj=k}e4 zcdqJO-FbKC(_MOW$?dYV%eF3`g{q+mp+%v$hrS$oqHCwFqq{Eb`cT)8yD8lgx|MXh zv)dcp{^;JL`-JY-cHiFpSdZ2{GJ0IqZq^j_P0PaoVTu8*hBy?x&AEA;K(x4dsn--BU#SW?)Wu!q79hqnwL6}~ild-#tL zT_Yw(+!FCd#6OX-k)^P@eG=6)YDCo1s2x$iME8y^h+Z50L5w3NJ!VPF(=k8y>(kHO z@4kK?#x{!`9eZu;%dvk$&qv}Wj+ ziJ^&wiJKC?N$Qm}GigiGkI9kAzT_v9|412-vMA-nRFXO@b!F=Aw5DmfX?Lf6p57(B zIQ^mY6T@PMEg1IVaAEk!;kOJwn9(7lAfq8CyHukg39+|TV#V-9GVz0anZzgCbga9ne_BzY4Z5Vn!`&bY?9YFsDtGxG1r zKT(iUaA(1Hg^7i?7an&HcHip$rf6`{twqO*2N&N~e7t06$?B5tJt>~MJwMMJKJ)&W zf6N*?>w#JSmQE<$RwkFtD0`;7Y5A=3SG^s*^Stj@^r={0acK5{*>}u7;T!4OZ>Z&y#addIR3%Zz15t{HaC zL(7Af`<5TPcHp)5ui#gBR_wkm=DIc4{j;)g<=fXsUcdVKGdC36@b-;SH{NyQzc&@# zw0l+Ds{3vhZ!W+2z%4^>dGOZYTd%tH$Zexih3h@2tA> z&|RbMdU{RQH8-z0b9c$z``0F~-F8p=d#=0Zk9!O6-Fsi+eOvGEaR2r9pIYZx_hI$0 z>ZfYD*Q{PIuAj61>kZ>KysR-@NJ}{7}_H z$G1$~^4`O#4?n#%Y-{zlmfNm>gnOjwk#8TJ@#ulaMn3lP;|Y&%eWKeF_dMC`$(2u` zr{+I(VtdK)J8t(=d*b&z{a*j~cDz66{pa@%-TTtM)P1jiknzDg`^W5m|3L16 z4-ZZ~c<95z508CR`q9rH&-wT?xP22oUHO^wv(=xs|GeglUSDiG6nE&k!>NaNeVP5` zCr1j7eD{_At20NJeeL*q^*5cqsXZ2bZ0GUxSYy zv~-&_OF_W|>YsD(gT^M9V=)PPnUX~YH;Nm_WkWcg#Sj|#CXga(K!(`FJqR+yGay0i z;`VUw!-sH5NakK!pTfRQ_wUBb?ia2Ak?uJ z%|>(3JaiRE5{r=mp^cwGpQ1m|8T1e4AV9GK(nAn<>oP{}Ar1!Jigj z*8k9qRiqRvCDZEkgsGs#UJtiC+!WBrv0t{veU{?m!Z(2#qD(1QB9#hdwrPy`nBq^s z9zpS^6o0l!iRNc0RmvRZ{esyh!2JdOoZ>_50*z)yiY^zoCNS0Ke@q0;f{Lgjf=ZRxtaw` zbLMypLCxl>42d5Q6&aE_+Ddn=vf^Cjt8y&|VbPr5TGpTIl|I!FkCW6h^sG{Dfgnum zX0-yR7mu=_cR|pgJI*GxZmd!IfHC~A_2V9H;bw@n)CTo}7)xy-`cenf4k9ddhgeE( z;~Ha@QEcQIWroL?Yb>dIUtg(J9_7LxP&O+MDO;3>m95G)1&o@Z~o;I=D|!{+sd~AGbe02Y?@i@Df$40Gm^tVGX4C4J=M07sv>sUF z$gB>*;Nm~Sjx}kfhtRQ%iasDAWXMh!R#X#ZJk_j?DyN8?R)j^17@U%$oPaI!^e!x%$_iD zQr-+#As7_O$}Iy~p0guRD+J5~Kq-?@a2*M|*M14sukq0I0Wtl-czgb6N3i77N0ZgQ zOfa6nT{|-3S?uj&ma5peKn&iAbIsVX8L42Mhu98*ptEO9J%$1{3)yTzT)(~j2Mio^ zKAR78VN7;rUH06JwDJNl%ojooL$}XeUf`}7IJnLZv~Or)R8s0N#?j7+3tW?&VrWJa zW~ORtv^3i6%NP*_Rz(0b&A^vZzvZC$R=KF z^rC%}r$kMi263?3*zmDBVv#Dqh&nZVR=*8q3fpGae!+sUs022t!}`b7o8i&Xv5OW# zyi9m(btx=5A%Q)&I~WxY9H9Sz{DL|VTdkB@STtl!deQH zh>8zsBr%nOo_Z<71l;$)BS4=r8jV4jXdKE$ zxo85KjHaULpkFCKOVJ9@sXPMul+V!@AQSxqF8hOUH{1jF!hLWw$U@1WO)14*JP$7c zIp|h=2fh=0VBZ7Yuh)TAr53-6Kf<5j&+r#SB+W=`(gXa>Mv)j23v$tPa2o0ZNeHAL z@aXsy*-uWAQ@q0KpigN5I{r3%KYlcy#pm();4#bmQzr>|8wf%i4+qRXw1u44mG|IC zn(~J7rt+5Zw(^d$OLt?Z%rSBih5_$0-@Q~U?T@HQA61v*9XX$Wbp>{a$DA1M2k z1Ij^IDnBxUC_Y0;IVE07d=wm-67Wn!$vn1JI)P7QLo|jlt~nlv!^2Kkuv>LMlOWP!D8ZDF z2b3R`pOh2I&&n^#ugY(f@RSIYw4kItC1I2#QZkD5J=l&ZS=VMbjA91B35N!-FeP;l z!s|u;wr-jSpqdQxd8;a{VyrVZR$$x4`7`|fDi-Xt-37`|2UZNH0xs~hZefA|r58wI z4(BD5V2|d%D!hibQRP&mVwI>cL?R^;B{C%nCF(}ieC1A6RFx9*%}z?1Qqqi#TN4-^ zd+2h2Gg~6<*%7K6wRBHurQ0{Q9IV?OcB}w;*bVYtBxPDTlcoxppcatXAWS(sJq9Dc-4Rl3qs)Ez$YPA_9dbJ8vcCeFwtdZt1Ab(PW#BJ1eAl9mFDG91p z0S`@#&Xekf*Df(c?ZOguro>sThEfvDy4@wIv^2yDt__jC!%{-h<`uZDvsED>8L1&r z;Zbbit;ZwdqhSq*jOn*%kzH^vwa?k6_N4^e#M+M{RPbfJZXJu|X?o>TW7PhPLjBZO zHBOCJ6DVm(Nh?ZPQ__Z#wi}h>>OesHH_Epr_}ej@!(1T9Z0z}AV&XO224m-oB?ddmRL<3eQp;roaV2Zl$#5!9_uCkIyhQhYR1L4p%eO5$Z^FlsZ}+ zqmETG)p2T;noUUuN;*=~iINaXfRbG(0ZMkIq#GsODd|B;&n;@MI$oWiPT;n)5BQ>- z!LHN^l=PycHzj@GA7hp91^>a8kzKQ&of{#P30(H1sN)dOTgE!;kjwUyaIY2IOPg2W z0!g*dJo#av3ZAg7OPbH;^;uH~HXwl+VLhrVs9`R)AAorR$59$*YY)#DgJ&mJd~i6^ z4eAOwQD;gOe%1^2(4Rct+Ul~_25tmmds+f!UBxDq&g~Y|%DUAU`jH@&nEOJtqTVJ^ z^{bWZD1o=JAf~-KN1Y4DVBq{yjXI|;PPaN=T?hfl)vMG6l!Q|fQKK$W7gG{R$xsIG zHnXeTzWJGOD6kC9diwllMcipcCez7uRl@yp8!K0N52jb-8*iB~g?_QxZc- zKX^$(U8!EL-T=-bNGv6Bl*F?dTC&k%$DzuLvkM^fSxSl5>t}0NdkA`8ndb7(&+%rI z!-5DK`*Ex>=6+*}*)Dcu(+k^@rsl6~SR#S@SrOJO$voLrSx~~Do&!cKGxr3a8v>{m zxDTjzsH@dG!I-gzYogw*t_4L-8>1TcfWaNnUVq7Wpm0bLT*tX2DV$LyRn4y_39RN zD>nr;0M>6S=_Bf+=M0272&_*v>SIii!KPE)DAheY=YHMj<*)-#R?$zX+hIr2D0c%Q z)TmFhI{rf{JMfSCtokAY&rbC@^?CILN|Go^rX+=u)D7xO>dWdY>PwWQQIbx{Ft}jo zX>LtKQ!S7@pUqa-w*oU51=y+MjqEl6Etdtzg%LkDacip#IQN#(@R1Gbchp^6OIR^r zwPSpvLAlvp5Z2&$u$}fjbuU|Z-lt@EwYrazjEm-Cq&}#AsD1=TAYn7d*5u4m58Gb{ zW`!A{kCKs;j2Iit&uFMl$j+HO369B?nXLvvkxiJSf&!EIFg@6GzZsQ1)9Z)n<1L@& zhg0JPmF~g}wy$%d`*Ys|e8TGDFClO^E^h+26j{C+0ahD6XltUR9e-J{w(cFX%2Vy_DDI zKpAb?K^bj9u02~yT~t0N-rJ#Lr%Nwz-w#k=XXl14p`l%&FXsl!JkPC3brG5O!l75~ zQU_qD{tDF8+gaV`JZ0_$eZ?iWc?c-4%iwNaZ9*m+?`-&*v37|J;m+dUgO^8K7(EK zN$wQ)4{DBDqIM9xelYB$N5T%e04xaxx(3~a9)Ml*lW02xK-`1AL_b5Ayno>wLQC8Z zhvUIG9d^xQunW(Go%2$B3&f1NA9l-6;vM*1{3*ow`4<0#f5U%)1)&}33Nc#x!k#&m zWRt1HO-f+bTuJ5R2W zKQf2i3^2>}>gVbgjLBbO`aEZTUQXq(l<`qs4vWa`A!c^2TT9 z#YCM=XY!kD*i)AmpVg=3+06K`3L%j;sb8u`)UVW|Ai;h^$!JQ(P%@U1OjB|lw+STC zZ{bWyH}wbgM<#b>8AD(vPf95%V=GLDfTT9IymWpBglPq7g~=*R5CW;ik}*vYKF7yc zAlx(C#H7#ECUez zhVe6HVsjy|_KIc~l1f1hP&l78tvuc98{?jv>8i3MS!Q~Pf@TkQ&4DoVOdKmMoo|N zv0hW*(1}jTBuXYzGKG?<(5-V>cu2QyAqnSUZWl-zW1?Pbsx<@M+UTlEhHem(*K19g zplsFM0*o;lYzyJNki+}6HdkSJTfT5~O6N$w~E= zfg1hnZDwI$i|p7UJMYo4`A+3+r7y1##?bISBpRGC9Y!fBocWsH0Kakxd&up5Gl&w#R+E1vGzLyrsd@`K<9bN=XhsX5~CKa#eh@~ zvX8$41&D<|fZFzANF*pD^VDFBJt2m9tw z>t;!yV_o4aILw9+KS)e4fFTfXIpka{4QaOIU+a&Bk~A&dvQjmm!r2}*l-z2xVXQ;U zs&z@}r^Xk#^7Eryaq-dlkpS28>NuQyXkta8$+QDZK^v`&1wD!ejIE+t1I9L+P4~_) zb$wvt0rP;*U6=x7Dh8ck+C1P}th*VhehVQv)|Rnuk+Tb(s7+>t!c?oQ1{0uZ@@r>q zS{dI8sEyd75ZG1Q`SP@U*ivdUGyvNiO6Hp33(c2x84s!}V3gZ6%Ux*my-pLe>YfC6 zWxCH>cCN+q+|#533?Qr>;~YtN4w^E%D^zf_%^(Y>Gv{ioI8(&qz(*~ zrD?TRfRMnCs?tgi9Hz{M&0!_HsmES4wCn}2hp|{H>{r-BHqMh9lwdPd>n2m+nh67w zsj`GAciE6y&w=}}A9k6R9=S*+;X1eKiCz$Snas1Ej-v=#YBA7-@|)=sBAPhHI3&s4~Z! z#m=YNIJ`@{o8fm2CD&DJYbjaDs1*!SN8Ny$OOQ1Q?pONMXzR3UO0K8mmb2!0ZG-k8 z*K)nKQQM?FK*ow5-YY$Pfimk6V!z;#6>{$*vmHo0U+>Gy!&tdc%?J9RgkHLJ)78$k%jdGV4n=4Vhd!}?j$!d$gy{f$iM%%g!HQMXkl=?R&kF9W* zXOx4X)?aTO)ZWtGhIMckcmpLhl-zBuTWgFVc}^?PJ=4=SV1U*N6<#;JVIi;-oEA0S zV~f`N+Fos+_5me8yL&0QpOSTF7p;T*494HV*CPmYut;6NY-@A=Pc6=WUx4#B+V!0` zoqhADmAU$YnK=WFHZMW>+IL)*F`bh224{`tkJ?XweIUQRzT2`vjdp@94Ci}f!}k~M z*9LlO?RV`os7JIvv_G}Kv{RI9q6856ASJaMv@_b@qNx2#$!1EnF~7g$X`}N*HYphJ zfbBA7VDpi>893RRJd7nxGN%qp9H?Ixbq%W1C0*7PU8MxjzJ-#9DcQP#9l}O3I~D@6 z^0>gtV7`G4q7&fWJ=f&rS+2R3WdO7r4W9-S5vCpu_(y|>W_GWy-pioCKUy|OVwTSK z1$J9o>JaCf)4zK>#jdW<@wd~C@cyZ9OMCb$b zL981CDS4(EVq*_6djYGV-&^XolvIpV<`mJBKqA#aJqE4?>N=37k6K_97)(npH|B`;EPit??&GqhQ}#fR9@50|AG15{e~hJzvs1O{_A;-A8J zR#X!z&hcW9lj03_RmJo8Uai@sILcrZ3KWlfLiDv#EGhoZzfMgHp zTWpejLdpJyBzu&R>@odu{R#a^3ceZ1K}tTPW>V|Py>_+SavdMv;Bh) zjM#2p_(f5y|6mQv(f>3oD^0+bn}D@B-tP_;`BDEv|5N`a|LCv;AEV?r zCErr=9VOpW@&hG5Qt}feCu$vt89%x04#6S9@#F0dg_57moe?Z8zf$stF_X}^3(gH-s}9E}&zmL#ln8$2bOzSk z#-)Ja%3D=g$Fm?!XyZ~$n}aFIhkJ{P{BF>ZH7?1rOjxOyZt+50N~)>^V;oe}xX0}9 zTRM0#0G*S``5Y|tqoXAyzXbdkIaugN{459I++i`@4a+I}*s-e|A&xF!sd03s-O9zN`_WqT~$aTQ!=Ij9ocW9cj8> zJ9w5|Q67YWzs(tW&$;}{G14(AFe7=Ml7AY^NXIxBS4Wm3+mYh{t>eFx=O~XTkL#x8 zf0bW33eAbhlm9d^>+`F?#B`K7=EB5ulsmkR3dd}R&*6u+&Z-=9C@)f8qP$EY;3}_D zUZcED|4)188I@Mr_Iu-)#D)l%*keHu2_;AoMFbHc2qK6GA_$6;-g_dNn4knjlZh3j ziGU!PNw1SSPI{a4WYW7SV8nUAJ`xE{6fzuy%A zs1FG90G9nbn3{k5Vt`fk0l#XyC?d1TQ0sro${~xjQeZtf;?STK?OaHGo|K6+r zd+n_J=dQ1J6zy|Pp!{%tS$;GhrBdoA_p1nO5A5;z@HPeR4LlrpH1K%f$-r}g=Y86= zD}lcSMFb@U5rRlTWFMWG9h4J94`Ku{gIGajLFGPMkt#?XG$m+y(5#@jK?{Nw1vLk` zeJA%%2YvN%o0wpFaCxviczW=H;6=VeAj^DbJ=XY+XXt|UzS9^j!N)=ZLNFl}zIxgm zUnOm!uZFhNR{%5kc+Q>>Q-~$xRmg|X(V=0X5uwqc$)VW4_b8z`q4ZEjC^NJuR2V7> z75f(bWufJv&7pfkhXIlQ;ymX9G=N$_9bgqe53mAUfNg+%fP;X;KJxRDkNq45yaBug zyaRjydfc!hH@T-wdyD;gR9d;j!WI;R)eM;e>Ef zI5|8kJUcumoF2{yXNI%FCx?FRgq(()h5Q1!0J#jg2Dt&b4Y>z-2zdf|2Kf#0JLC_@TgZFJ zC&lf=E8xT7;RufwnyDD~doL?Lu4j2cDgTzgbTN1Y{Zbh6X?qb~CxchMr;~vM0 z;#Kig@zwED;`hg&j6WTJHvX3hmC$dk|C)zX?@a$r1qqNBu|nz>HDNj zNn4V(CGAMsm9!`6$E0gXeW{8#dOs6R9W3V;HkASeVn z4w?*wK~tefC<=;!a-mYF0;+^o`Z(Tc&>7HK&>CnRROe%QjnH1G8ES_*pf0Ezx(oU< z^eXf^^ak`6^bYhM^a1n{^a=DS^b_<;ieHL}RP1=wZSeb^J&Q`mFZ@37afH?X(x(Qq)_2bI9n;1l6!I2MkB z211Ca@KMYQ5sMK^5z7%Zh+4!-L_J~+q7%`L=s}ne7KF{mI6Dw7gc~u4IEHwf7MzAk z6QnIk>q*;_b}j8*+QYQRX~Su+(mtepO8bKJ^D)o?$T7%3WH2%k8H0>NCLoiLP$V5$ zh%82yAWMlCor+FFPeh~9STqjJM6=M7(FJH8nvWKs zi_s-$3A)V3c6Xrnpl_hRVqh2!W*SC^S&wPMbYQwLHjD@3#e9$1gxP}GhB<^8!W_XI z$DG8R#yrKm#eBqk#(c#FV8>tsvBB7AY%CUmMPsqpbZiDT6HCETu{>-Ub{2Lnb^&%V zb{Vz?TZgU3YOy+O57vyeV*9ZDSQplf9mHCU9# zNzW&ZO!|G&dz?RRG%gSqf(yfi`$+Q$ToNt?mx@FB5D+YmhbzNX;3{!y+%()w+-%%j zTpg|+*NSVyb>O;jW}Fpg$2oA@aEEXgaaVBHaW`>yaQAVKaKpIgxRLZx=>h3u(gV|j z(*fzgbWl1ZeSCUUIx)Q@eOY=>`hoO^_&|KBk7O^x7vsfv30{Stj-Q2}gP)IIh+m9f zieHXz#Ov_}{5t#wd^>&%{s4Xme*}LVe+GXJe*u39{{a6O{|EjZ{saCq!JiO77)uBu zL=j*FGJ!(KA>4cet*@U@-1%yR}C4^;!8bU3hhp>lmi|~~Q zC31+fi3XyVxShC*xR+C|z+ zIz#$}bb)kw3qsb(4 zCOMl-BQwZMGK(xCmy*lKa2m$Q|S!vYBip_mMY~w~_aePms@&e<5Ea zUnBoYzD2%69wC3s49f&%Mr1~2#$?84CT2o2;hAZf*_pJ=+|0bp{LIOj1)01|ex@)} zlsPYRUFNpT%RW~?LRMZ@RaSjgQ&vmX`m7CEy;+W|fvmx-@3S`h90J?3c4iG_9nCtC zbvo-@*7>ZFtdA5wia%vEC72RQ0a8GeL<*ELi9)1gP_igAN-l*-VNt}CD#~KYGD;1l zj#5w2QgoCiN(*H@rJv%WxP3-~jg(E4EtGAP9hBXay_Bnzx7jh-+1aY>#_YlD6WPPr zud?4{|CRlo>Q4=!hEc<*5b8K;BsGPaN<~u9)JfEIY7tfLa~V`qr%-27=TPTS7f|b| zTIzSyPHH!`mujQhsZQzubtiR*dWCwOdXsvGdY}4;I!t{|9ihI;3CJ0n6OC>obmLX*&BG&${C+8o+^+9KLg+6tP6R!3{5 zwbH($wbQz2M%qr=5bZeaB<&3C0__s*D(yOLnD(6ZhW3{J4Ly(^Ob5`x^ay$+J(`Z7 z6X}!bTsogFq?gbobQxViSJBn{$jk(8=ptaE6c0Nv*sPid&&%CrZOin@k|nv%*83e<@pu)s{E?_ z>ints)AJkio%tv7pR<50BCCwGjMc@mvHDpqmYcPOwU@P@b%-^@I?6iEI>|cCy3V@E zy2HB9dc=Cd4q$`WC%7(F1*(7!*o5kj`3)up;m@Q$;*mCwv_A+)eyOsSN zyPe&|?qQqRHg-ST#ooi-$3DP5#QuqWgngWSihYLt3;P25<>au*>61$)FPm(c{L|!n z96wGFCzJ!^fH*N6CiSPAz98XEjI1(Q^!( zR*sot^BFX}oZX!LoP(U7ILA0AIHx&hIkz~^IG+pr3ce{AQxH@TS^z8n7mO>2DwtS+ zDVS7{UO@0UH!=$-1=Iq10i!@!P*-3t__<)18^%rN3c2&R%eflvN^U*3iQC5Qg=m^>k`nm3ggmv%)_LKNWuE`}0Th$MS>tA^a$QEPnz&iJ!uU^Yi!u zzL+oN%lJxu6~CH4g}<1;j9<@h<+t%W_}zRn-^#c19sF(lL;Q>UEBx#HoBTWc`}{}z zVg7UeNYSXGfTA%)fknYZfTHjsNYS{WsG^vnjH1$_6-B0^Lq(4T!GbiwWPwmnB9I8m z1XY5Wf;m1H$s)m0!E%8{P$y^>vNOcbJpbYY&5CFBTs!Xja@P%M-R%Y}1<^MwnAi-k*tD}=Se zRl?Q62BA*q5Dp2S6bBWfi$%pti#v;V6dx!)T>NwK(c*K(*NSfx-!8sa{IK|O@o@2< z#qWwg7Jm_q5`7~|6rn}wB7!JGlr72;<%;q|#Uin&LZlMS7WrCDqNO5@s7_QbS|i#Z zvWm8fc8GS1eiR)L9Txp8Iwm?PIwQI(dLVivdLnu%dLeo#dL{Zp^j7q)WLycML|U?< z#8UEe$*_2=7%s+&)5Sz_hM4Ztv+~46;$pE_ED@K9%f-{gGsSbn^TmtAOT=wro7gEH z5D$tsiMNQii+75Th);?yitmaaiJyp{iC>CeiQkCdmX0n3m%>UBr4vgrrMOZ;X+~*Q zDYcYdDk?24m6pnUeivnFRq3~-Q%h%*&MMWHx=T-&j!3`~vP3Sak@QIVB`%3a;+1Td z?3Wyp3`vekPDoBk&Pr}bZcFY-9!j1_o=V3^A<`&mj5J=FEKQN7O4FodDMiYZvZNxZ zR4S7yq*c;t=~U@-=`v}9v|HLMwMhG<4(Wh&Q2M=evviyEsPu&Nl=O`Bob-b9lJtu7 zn)HVBmh?kebQ!fwS+=IkQ+B58g)BrCA&Zp7$l_!$8AdiqmM$a6NHVf4Up86BmGNal znMgKIRx4XAYmn(=2H85!Bw1zIslK~!WYvJ}}0u0pDqshFdfuUMp5s#u|@Rjg91Q8X%y3X{U3 zuqo^cr(!_iQFs+UC^jq3C|*>ASEN^zR%j}06$dMBS3IeBR`FZK%Zhi(QOa+Wqm^To zLCO$ilrmO1L7AjXQNopZN`X?Wlqh9NrO(V$t(>A{Sjb zcPaNO_bU%6hm=Q@7nP5df2aagA*wJHNEM-qRK=*`Rf#I73a+B4a#XphJXOAGvWlzX ztAwf&RjEpU;@8GY^`YgJ#> z$*Oni6g65+P_xw~>T-33x>8-Oo~fRrp08e{UZP&9u2<{S?do2&Mct=%sJ-eR)LYcs z)jQP()jz2(tM99ys$ZyIs$Z+$t3Ro~R{K{6R0FCbs^hC+E6%UDwBpu^=PO>XcwaN7 z22wM=Cb}lBCZQ&|23C_^L#!d!P-=2&a%-41teTlM>udJbJgoVx=Fgfhno*iy4M;Oy zlcq`6nl_C|vqiH_vqQ5> zvq$rzX20g3=CEc+b3}7Yb4l|+^H}p#^Fs4d^IG$#=3VXB+MwFd+OS$sZA5KkZFFsH zEvYuYc22Fa_Q%>!by0Qry6iPK*4$q6e9af_C~bgttTtE+(1vRv+VR?GElP{g;d>$UA#w|0m2l=imvh4y_zU_(elSOcgbq9L*&rXjuo)qrhC zZy+|18z>Dq4Y>_@4U&e2hOUNP4VN3&Q7jdL64H!f^k z(zv{_rm>}QSL2<=5#4AVST{}=rHj=~&?V~9bu=AAm#>?wE(4Ep<(_Pp7s=KLss(YjROZP$dd9B~tZ`Ovb1+9%(8@V=S zZT#AVwam5C)~;W>ckQjUpY%ccWIare&`;E3^f*01pP|pvQ}uLxo}Q&w>Z|nM>Zj>v z>Sycc=@;l1>6hx4>oxk7`g;9(y<5Lee?|YQDYOaE#BM5Wn$fhfsjbP|w7qFZ)9$9j zO+PgqX*%0)mV zMYF1Td2@HOqj^vB`R41*uYGQ)F@|tMtO0IFGoTD;1J;mkAR1VP3d2;xEW=#Ge8VC` ztwCpKGPD}H3?9Q~!ydy=hF=YL41cu%TOwNGTXI_RTB=*VZCTJ#(^A(`-=b~NwXAPx zYw2t;wwPKhEjwCHwA^p`+#1{((i++t)|%EzYRzoTZl$#{TA8iN)@iK`t!rDGH@w{N zt}Uqz(I#x$**4VnOWVb^D{a@?ZnoWNyWjS*?N!^GwzqBX+CH{@Y4`J)su8LzRn|^XFJb#Uh2Hs z`D^FR&ZnJkIzM!N?)=*2-^J=G>YCHFuxmq?waeb+>~eQ)={nGLxNE5EXxGKAD_z&R zZgl&1hjd4D)4G}6bGtR&?cJT-*6xkno4U7l@95s$y|?>z_ml47?&sZajH8SJ#<9j= zW2iCAh%#mxbBwu0rjcXh8Vij@#;HcVvD3KCxYM}DxX*ad_>=L7@woAn@vQN@@sjbX z@mJ$5;|Jp>G|9X?Pc}Kdl&Uud$;!_pja$rm?0l6UY={iZo3y zC7GZmxCvn*net4fCY5QrX^E-Uw92%`)M#oktv78jb(p$L9@AFScGF?gWz(?fx#^AB z&pg@;GRK*5W`a4xoMon(Y3BLn73MYOMzh{*Ft0OzXSSI8%ntK_`H=aH`4{sA^JVj} z`A_pZ^9S>1ORxoC0b0Nom?hmpuw+;=Eewm)qOdHqtg_TwR$H`|?<_qQv&ClVx40~u zEL$x*EW0f~TJ~FxT5emOTK=&5S%a*hR-hGZ9cP_jO|&LkQ><_+!pgF$t&LWzb)$8Y zb*puUb+>h|^{n-(^``ZX^}h9y^|kfA^^^6h&EFPe3$=yWKsJai&IYrk+cIt0HkyrL zZ|Ts+NbZ^&}Zy3^;!GueU82( zefR96?U8n(onsf<7uuKDm)mRXb@qC@*4}8>+b#A!yTd+UAGB|@@30@RAGZH&KW0B^ zKW)EmziGc?zi4Gy1do3;SjL@_uE1Wq)n|_x&gO zFZ4g{A90L!z#VB0lmp|yIS7snN2Vj&A#{{DBo3KF;ZQoJIp#YSIhHzBIBFd$9R|lb z#|B4-!|rf81{{NqU5>queU5{U(~fhF^Nvf7CyqCcw~qIYk4}Iy*_r2LIXOuhwkIM+MdoSn{Yr_3U`&e+C9}h-M!3R@7B6??k0De`v>pAbaMe%=Icj+gB%@D_TDyi#wa zSMB}QJJmbgJJY+&TjQ + + + + + + + + diff --git a/BAWKWebView-WebP/AppDelegate.m b/BAWKWebView-WebP/AppDelegate.m index 9c8bb5a..aadef5c 100644 --- a/BAWKWebView-WebP/AppDelegate.m +++ b/BAWKWebView-WebP/AppDelegate.m @@ -8,6 +8,7 @@ #import "AppDelegate.h" #import "ViewController.h" +#import @interface AppDelegate () @@ -24,6 +25,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; [self.window setRootViewController:nav]; [self.window makeKeyAndVisible]; + + /// 添加Webp格式解码 + [SDImageCodersManager.sharedManager addCoder:[SDImageWebPCoder sharedCoder]]; + [SDWebImageDownloader.sharedDownloader setValue:@"image/webp,image/*,*/*;q=0.8" forHTTPHeaderField:@"Accept"]; + return YES; } diff --git a/BAWKWebView-WebP/BAWKWebView-WebP/BAURLSessionProtocol.m b/BAWKWebView-WebP/BAWKWebView-WebP/BAURLSessionProtocol.m index a3e74f1..8449e3c 100644 --- a/BAWKWebView-WebP/BAWKWebView-WebP/BAURLSessionProtocol.m +++ b/BAWKWebView-WebP/BAWKWebView-WebP/BAURLSessionProtocol.m @@ -8,16 +8,31 @@ #import "BAURLSessionProtocol.h" #import -#import -#import +#import +#import +#import + +#if __has_include("webp/decode.h") && __has_include("webp/encode.h") && __has_include("webp/demux.h") && __has_include("webp/mux.h") +#import "webp/decode.h" +#import "webp/encode.h" +#import "webp/demux.h" +#import "webp/mux.h" +#elif __has_include() && __has_include() && __has_include() && __has_include() +#import +#import +#import +#import +#else +@import libwebp; +#endif static NSString *URLProtocolHandledKey = @"URLHasHandle"; @interface BAURLSessionProtocol() -@property (nonatomic,strong) NSURLSession *session; -@property (strong, nonatomic) NSMutableData *imageData; -@property (nonatomic) BOOL beginAppendData; +@property (nonatomic, strong) NSURLSession *session; +@property (nonatomic, strong) NSMutableData *imageData; +@property (nonatomic, assign) BOOL beginAppendData; @end @@ -27,15 +42,14 @@ @implementation BAURLSessionProtocol /** 判断是否启用SD_WEBP 并且图片格式为webp 如果为YES 则标记请求需要自行处理并且防止无限循环 为NO则不处理 */ -+ (BOOL)canInitWithRequest:(NSURLRequest *)request -{ - //只处理http和https请求 ++ (BOOL)canInitWithRequest:(NSURLRequest *)request { NSString *scheme = [[request URL] scheme]; - if ( (([scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || - [scheme caseInsensitiveCompare:@"https"] == NSOrderedSame)) && - ([[request.URL absoluteString] hasSuffix:@"webp"])) - { - // 看看是否已经处理过了,防止无限循环 + BOOL commonScheme = ([scheme caseInsensitiveCompare:@"http"] == NSOrderedSame || + [scheme caseInsensitiveCompare:@"https"] == NSOrderedSame); + NSString * urlString = request.URL.absoluteString.lowercaseString; + + /// 只处理webp结尾的请求,避免重定向所有的请求,特别是POST请求(body丢失的问题) + if (commonScheme && [urlString hasSuffix:@"webp"]) { if ([NSURLProtocol propertyForKey:URLProtocolHandledKey inRequest:request]) { return NO; } @@ -50,27 +64,27 @@ + (NSURLRequest *) canonicalRequestForRequest:(NSURLRequest *)request { #pragma mark 通信协议内容实现 // 开始 -- (void)startLoading -{ +- (void)startLoading { NSMutableURLRequest *mutableReqeust = [[self request] mutableCopy]; [NSURLProtocol setProperty:@YES forKey:URLProtocolHandledKey inRequest:mutableReqeust]; NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration]; self.session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue currentQueue]]; [[self.session dataTaskWithRequest:mutableReqeust] resume]; - } // 停止 -- (void)stopLoading -{ +- (void)stopLoading { [self.session invalidateAndCancel]; } #pragma mark - dataDelegate -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)newRequest completionHandler:(void (^)(NSURLRequest *))completionHandler -{ - NSMutableURLRequest * redirectRequest; +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task +willPerformHTTPRedirection:(NSHTTPURLResponse *)response + newRequest:(NSURLRequest *)newRequest + completionHandler:(void (^)(NSURLRequest *))completionHandler { + + NSMutableURLRequest * redirectRequest; redirectRequest = [newRequest mutableCopy]; [[self class] removePropertyForKey:URLProtocolHandledKey inRequest:redirectRequest]; @@ -78,21 +92,27 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPer [[self client] URLProtocol:self wasRedirectedToRequest:redirectRequest redirectResponse:response]; [self.session invalidateAndCancel]; - [[self client] URLProtocol:self didFailWithError:[NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]]; + NSError * error = [NSError errorWithDomain:NSCocoaErrorDomain + code:NSUserCancelledError userInfo:nil]; + [[self client] URLProtocol:self didFailWithError:error]; } -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler -{ - [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { + [self.client URLProtocol:self didReceiveResponse:response + cacheStoragePolicy:NSURLCacheStorageNotAllowed]; NSInteger expected = response.expectedContentLength > 0 ? (NSInteger)response.expectedContentLength : 0; self.imageData = [[NSMutableData alloc] initWithCapacity:expected]; + if (completionHandler) { completionHandler(NSURLSessionResponseAllow); } - } -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data{ +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask + didReceiveData:(NSData *)data{ if ([dataTask.currentRequest.URL.absoluteString hasSuffix:@"webp"]) { self.beginAppendData = YES; @@ -106,22 +126,135 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(nullable NSError *)error{ if (error) { - [self.client URLProtocol:self didFailWithError:error]; - }else{ - if ([task.currentRequest.URL.absoluteString hasSuffix:@"webp"]) { - // 如果判断是需要处理的webp图片,就对图片进行转换 - NSLog(@"webp---%@",task.currentRequest.URL); - UIImage *imgData = [UIImage sd_imageWithWebPData:self.imageData]; - NSData *transData = UIImageJPEGRepresentation(imgData, 0.8f); - self.beginAppendData = NO; - self.imageData = nil; - [self.client URLProtocol:self didLoadData:transData]; + + } else if ([task.currentRequest.URL.absoluteString hasSuffix:@"webp"]) { + // 如果判断是需要处理的webp图片,就对图片进行转换 + NSLog(@"webp---%@",task.currentRequest.URL); + + UIImage *imgData = [UIImage sd_imageWithWebPData:self.imageData]; + NSArray * images = imgData.images; + + if (images.count > 1) { + /// 转换成gif + NSString * fileName = [[task.currentRequest.URL URLByDeletingPathExtension] lastPathComponent]; + fileName = [NSString stringWithFormat:@"%@.gif",fileName]; + NSString *cachePath = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName]; + [self handleAnimatedImage:imgData images:images cachePath:cachePath]; + } else { + [self handleStaticImage:imgData]; } + [self.client URLProtocolDidFinishLoading:self]; } - } +- (void)finishWithData:(NSData *)imageData { + self.beginAppendData = NO; + self.imageData = nil; + [self.client URLProtocol:self didLoadData:imageData]; +} + + +- (void)handleStaticImage:(UIImage *)image { + NSData *transData = UIImageJPEGRepresentation(image, 0.9f); + [self finishWithData:transData]; +} + +- (void)handleAnimatedImage:(UIImage *)image + images:(NSArray *)images + cachePath:(NSString *)cachePath { + + if (image.sd_imageFormat == SDImageFormatGIF) { + [self finishWithData:[self.imageData copy]]; + return; + } + + NSAssert(image.sd_imageFormat == SDImageFormatWebP, @"请校验格式"); + + + WebPData webpData; + WebPDataInit(&webpData); + webpData.bytes = self.imageData.bytes; + webpData.size = self.imageData.length; + WebPDemuxer *demuxer = WebPDemux(&webpData); + if (!demuxer) { + [self finishWithData:[self.imageData copy]]; + return; + } + + // for animated webp image + WebPIterator iter; + // libwebp's index start with 1 + if (!WebPDemuxGetFrame(demuxer, 1, &iter)) { + WebPDemuxReleaseIterator(&iter); + WebPDemuxDelete(demuxer); + [self finishWithData:[self.imageData copy]]; + return; + } + + /// 获取每一帧的时长 + NSMutableArray *frames = [NSMutableArray array]; + do { + @autoreleasepool { + int duration = iter.duration; + if (duration <= 10) { + duration = 100; + } + [frames addObject:[NSNumber numberWithDouble:duration / 1000.0]]; + } + } while (WebPDemuxNextFrame(&iter)); + WebPDemuxReleaseIterator(&iter); + WebPDemuxDelete(demuxer); + + + NSURL * cacheURL = [NSURL fileURLWithPath:cachePath]; + + // 设置gif的彩色空间格式、颜色深度、执行次数 + NSDictionary *gifDic = @{ + (NSString *)kCGImagePropertyGIFLoopCount:@(image.sd_imageLoopCount), + (NSString *)kCGImagePropertyColorModel:(NSString *)kCGImagePropertyColorModelRGB, + (NSString *)kCGImagePropertyDepth:@(16) + }; + NSDictionary *gifProperties = @{(NSString *)kCGImagePropertyGIFDictionary:gifDic}; + CGImageDestinationRef destination = CGImageDestinationCreateWithURL((CFURLRef)cacheURL, + kUTTypeGIF, + images.count, + NULL); + CGImageDestinationSetProperties(destination, (CFDictionaryRef)gifProperties); + + + NSUInteger repeatCount = images.count / frames.count; + for (int32_t index = 0; index < frames.count; index ++) { + /// 对于大部分动图而言,取平均值 image.duration / images.count 即可 + /// 但是也有遇到过 异常卡顿的动图,详细对比后发现,frames只取到了58帧,但是images有348帧 + /// 相当于重复了6次,所以要算出重复的次数,取image的时候跳着取 + /// + /// 具体原因看 [SDImageCoderHelper animatedImageWithFrames:frames] 方法 + /// 里面有求最大公约数 NSUInteger const gcd = gcdArray(frameCount, durations); + /// 然后按最大公约数gcd重复插入同一阵gcd次 for (size_t i = 0; i < repeatCount; ++i) { + /// 正常情况下gcd是1,每1帧插入1次生成新的动图(animatedImage) + /// 异常情况下gcd会大于1,就会出现同一帧重复插入的情况,会导致总时长累加gcd倍 + /// 出现肉眼可见的卡顿。所以这里要跳着取 (repeatCount = gcd) + + NSUInteger imageIndex = index * repeatCount; + NSNumber * duration = frames[index]; + + UIImage * frameImage = [images objectAtIndex:imageIndex]; + NSDictionary * gifDict = @{ + (NSString *)kCGImagePropertyGIFDelayTime:duration + }; + NSDictionary * frameProperties = @{ + (NSString *)kCGImagePropertyGIFDictionary:gifDict + }; + CGImageDestinationAddImage(destination, frameImage.CGImage, (CFDictionaryRef)frameProperties); + } + + CGImageDestinationFinalize(destination); + CFRelease(destination); + + NSData *transData = [NSData dataWithContentsOfFile:cachePath]; + [self finishWithData:transData]; +} @end diff --git a/BAWKWebView-WebP/BAWKWebView-WebP/BAWKWebView_WebP.h b/BAWKWebView-WebP/BAWKWebView-WebP/BAWKWebView_WebP.h index 47d6865..8a5e097 100644 --- a/BAWKWebView-WebP/BAWKWebView-WebP/BAWKWebView_WebP.h +++ b/BAWKWebView-WebP/BAWKWebView-WebP/BAWKWebView_WebP.h @@ -1,60 +1,3 @@ - -/*! - * @header BAKit.h - * - * @brief BAKit - * - * @author 博爱 - * @copyright Copyright © 2016年 博爱. All rights reserved. - * @version V1.0 - */ - -// _ooOoo_ -// o8888888o -// 88" . "88 -// (| -_- |) -// O\ = /O -// ____/`---'\____ -// . ' \\| |// `. -// / \\||| : |||// \ -// / _||||| -:- |||||- \ -// | | \\\ - /// | | -// | \_| ''\---/'' | | -// \ .-\__ `-` ___/-. / -// ___`. .' /--.--\ `. . __ -// ."" '< `.___\_<|>_/___.' >'"". -// | | : `- \`.;`\ _ /`;.`/ - ` : | | -// \ \ `-. \_ __\ /__ _/ .-` / / -// ======`-.____`-.___\_____/___.-`____.-'====== -// `=---=' -// -// ............................................. -// 佛祖镇楼 BUG辟易 -// 佛曰: -// 一人 我编程累 累得只想把觉睡 -// 两眼 是辛酸泪 代码咋写都不对 -// -// 重启是也不行 关机它也不灵 -// 我狂敲键盘怒砸鼠标 异常也不停 -// -// 这循环它有点绕 注释也很微妙 -// 我看了半天稀里糊涂马隔壁我草 -// -// 加断点 再抵坝 堆栈瞬间就爆炸 -// 日志输出如雨下 看到异常就害怕 -// -// 调试一夜没人陪 心想这锅该归谁 -// 回想当初心后悔 不该重构这地雷 -// -// 翻日志 看半天 博客看了几百篇 -// 闪退还是没复现 低头又点一根烟 -// -// 加着班我心烦乱 烂摊子我不想干 -// 离职损失就几万 一拍桌子把工作换 -// -// 离职 我不再忙 在家 我守空房 -// 我闲得无聊掏出电脑 代码又写几行 - /* ********************************************************************************* @@ -75,7 +18,6 @@ #ifndef BAWKWebView_WebP_h #define BAWKWebView_WebP_h -//#import "BAURLSessionProtocol.h" #import "NSURLProtocol+BAWebView.h" /*! @@ -89,11 +31,13 @@ 项目源码地址: OC 版 :https://github.com/BAHome/BAWKWebView_WebP - 最新更新时间:2017-08-02 【倒叙】
- 最新Version:【Version:1.0.0】
+ 最新更新时间:2020-09-28 【倒叙】
+ 最新Version:【Version:1.0.3】
更新内容:
1.0.0.1、用分类封装 WKWebView,代码无任何侵入更改
1.0.0.2、WKWebView 目前可以兼容 GIF 动图显示,和 webp 的静态图片显示(webp 的动态图片显示需要等待后期版本更新)
+ 1.0.3: 已支持webp动图显示
+ */ #endif /* BAWKWebView_WebP_h */ diff --git a/BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.h b/BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.h new file mode 100644 index 0000000..7d9af16 --- /dev/null +++ b/BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.h @@ -0,0 +1,80 @@ +// +// NSObject+JKInvoker.h +// JKInvoker +// +// Created by XiFengLang on 2019/3/26. +// Copyright © 2019 https://github.com/XiFengLang. All rights reserved. +// modify from https://github.com/cyanzhong/RuntimeInvoker + +#import + + +/// Objective-C type encoding: http://nshipster.com/type-encodings/ +typedef NS_ENUM(NSUInteger, JKMethodArgumentType) { + JKMethodArgumentTypeUnknown = 0, + JKMethodArgumentTypeChar, + JKMethodArgumentTypeInt, + JKMethodArgumentTypeShort, + JKMethodArgumentTypeLong, + JKMethodArgumentTypeLongLong, + JKMethodArgumentTypeUnsignedChar, + JKMethodArgumentTypeUnsignedInt, + JKMethodArgumentTypeUnsignedShort, + JKMethodArgumentTypeUnsignedLong, + JKMethodArgumentTypeUnsignedLongLong, + JKMethodArgumentTypeFloat, + JKMethodArgumentTypeDouble, + JKMethodArgumentTypeBool, + JKMethodArgumentTypeVoid, + JKMethodArgumentTypeCharacterString, + JKMethodArgumentTypeCGPoint, + JKMethodArgumentTypeCGSize, + JKMethodArgumentTypeCGRect, + JKMethodArgumentTypeUIEdgeInsets, + JKMethodArgumentTypeObject, + JKMethodArgumentTypeClass, + JKMethodArgumentTypeBlock, + JKMethodArgumentTypeSEL, + JKMethodArgumentTypeIMP, +}; + + +/** 去除字符串中的`@*#`字符,还原接口名,以访问私有接口 */ +static inline NSString * _Nonnull fOriginalInterfaceName(NSString * _Nonnull api) { + NSString * result = [api stringByReplacingOccurrencesOfString:@"@" withString:@""]; + result = [result stringByReplacingOccurrencesOfString:@"*" withString:@""]; + return [result stringByReplacingOccurrencesOfString:@"#" withString:@""]; +} + + + +@interface NSMethodSignature (JKRuntimeInvoker) + +- (JKMethodArgumentType)argumentTypeAtIndex:(NSUInteger)index; + +@end + + + + + + +/// 方法调用,替换performSelector +@interface NSObject (RuntimeInvoker) + +- (id _Nullable )invokeSelector:(nonnull NSString *)aSelectorName + arguments:(nullable NSArray *)arguments; +- (id _Nullable )invokeSelector:(nonnull NSString *)aSelectorName + argument:(nullable id)argument,... NS_REQUIRES_NIL_TERMINATION; +- (id _Nullable )invokeSelector:(nonnull NSString *)aSelectorName; + + +- (id _Nullable )invokeSEL:(nonnull SEL)aSelector + arguments:(nullable NSArray *)arguments; +- (id _Nullable )invokeSEL:(nonnull SEL)aSelector + argument:(nullable id)argument,... NS_REQUIRES_NIL_TERMINATION; +- (id _Nullable )invokeSEL:(nonnull SEL)aSelector; + + + +@end diff --git a/BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.m b/BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.m new file mode 100644 index 0000000..b8471a2 --- /dev/null +++ b/BAWKWebView-WebP/BAWKWebView-WebP/JKInvoker/NSObject+RuntimeInvoker.m @@ -0,0 +1,415 @@ +// +// NSObject+JKInvoker.m +// JKInvoker +// +// Created by XiFengLang on 2019/3/26. +// Copyright © 2019 https://github.com/XiFengLang. All rights reserved. +// modify from https://github.com/cyanzhong/RuntimeInvoker + +#import "NSObject+RuntimeInvoker.h" +#import + + + +_Bool jk_equalChar(const char *s1, const char *s2) { + return strcmp(s1, s2) == 0; +} + + +/** + 判断参数类型编码 + + @param encode 参数类型编码 + @note https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100-SW1 + @return 参数类型 + */ +JKMethodArgumentType jk_argumentTypeWithEncode(const char *encode) { + if (jk_equalChar(encode, "@")) { + return JKMethodArgumentTypeObject; // @encode(id) + } else if (jk_equalChar(encode, "B")) { + return JKMethodArgumentTypeBool; // @encode(_Bool) + } else if (jk_equalChar(encode, "f")) { + return JKMethodArgumentTypeFloat; // @encode(float) + } else if (jk_equalChar(encode, "d")) { + return JKMethodArgumentTypeDouble; // @encode(double) + } else if (jk_equalChar(encode, "i")) { + return JKMethodArgumentTypeInt; // @encode(int) + } else if (jk_equalChar(encode, "@?")) { + return JKMethodArgumentTypeBlock; + } else if (jk_equalChar(encode, @encode(CGPoint))) { + return JKMethodArgumentTypeCGPoint; + } else if (jk_equalChar(encode, @encode(CGSize))) { + return JKMethodArgumentTypeCGSize; + } else if (jk_equalChar(encode, @encode(CGRect))) { + return JKMethodArgumentTypeCGRect; + } else if (jk_equalChar(encode, "s")) { + return JKMethodArgumentTypeShort; // @encode(short) + } else if (jk_equalChar(encode, "l")) { + return JKMethodArgumentTypeLong; // @encode(long) + } else if (jk_equalChar(encode, "q")) { + return JKMethodArgumentTypeLongLong; // @encode(long long) + } else if (jk_equalChar(encode, "C")) { + return JKMethodArgumentTypeUnsignedChar; // @encode(unsigned char) + } else if (jk_equalChar(encode, "I")) { + return JKMethodArgumentTypeUnsignedInt; // @encode(unsigned int) + } else if (jk_equalChar(encode, "S")) { + return JKMethodArgumentTypeUnsignedShort; // @encode(unsigned short) + } else if (jk_equalChar(encode, "L")) { + return JKMethodArgumentTypeUnsignedLong; // @encode(unsigned long) + } else if (jk_equalChar(encode, "Q")) { + return JKMethodArgumentTypeUnsignedLongLong;// @encode(unsigned long long) + } else if (jk_equalChar(encode, "v")) { + return JKMethodArgumentTypeVoid; // @encode(void) + } else if (jk_equalChar(encode, "c")) { + return JKMethodArgumentTypeChar; // @encode(char) + } else if (jk_equalChar(encode, "*")) { + return JKMethodArgumentTypeCharacterString;// @encode(char *) + } else if (jk_equalChar(encode, "#")) { + return JKMethodArgumentTypeClass; // @encode(Class) + } else if (jk_equalChar(encode, @encode(UIEdgeInsets))) { + return JKMethodArgumentTypeUIEdgeInsets; + } else if (jk_equalChar(encode, ":")) { + return JKMethodArgumentTypeSEL; // @encode(SEL) + } else if (strcmp(encode, @encode(IMP))) { + return JKMethodArgumentTypeIMP; + } + NSLog(@"JKRuntimeInvoker 未知的参数类型:%s",encode); + return JKMethodArgumentTypeUnknown; +} + + +@implementation NSMethodSignature (JKRuntimeInvoker) + +- (NSInvocation *)invocationWithArguments:(NSArray *)arguments{ + NSInvocation * invocation = [NSInvocation invocationWithMethodSignature:self]; + [arguments enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + NSUInteger index = idx + 2; + NSAssert(index < [self numberOfArguments], @"传递的参数过多"); + if (index >= [self numberOfArguments]) { + *stop = true; + return ; + } + + JKMethodArgumentType argumentType = [self argumentTypeAtIndex:index]; + + switch (argumentType) { + case JKMethodArgumentTypeChar: { + char value = [obj charValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeInt: { + int value = [obj intValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeShort: { + short value = [obj shortValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeLong: { + long value = [obj longValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeLongLong: { + long long value = [obj longLongValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeUnsignedChar: { + unsigned char value = [obj unsignedCharValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeUnsignedInt: { + unsigned int value = [obj unsignedIntValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeUnsignedShort: { + unsigned short value = [obj unsignedShortValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeUnsignedLong: { + unsigned long value = [obj unsignedLongValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeUnsignedLongLong: { + unsigned long long value = [obj unsignedLongLongValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeFloat: { + float value = [obj floatValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeDouble: { + double value = [obj doubleValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeBool: { + _Bool value = [obj boolValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeVoid: { + + } break; + case JKMethodArgumentTypeCharacterString: { + const char * value = [obj UTF8String]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeCGPoint: { + CGPoint value = [obj CGPointValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeCGSize: { + CGSize value = [obj CGSizeValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeCGRect: { + CGRect value = [obj CGRectValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeUIEdgeInsets: { + UIEdgeInsets value = [obj UIEdgeInsetsValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeObject: { + [invocation setArgument:&obj atIndex:index]; + } break; + case JKMethodArgumentTypeClass: { + Class value = [obj class]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeBlock: { + [invocation setArgument:&obj atIndex:index]; + } break; + case JKMethodArgumentTypeSEL: { + SEL value = [obj pointerValue]; + [invocation setArgument:&value atIndex:index]; + } break; + case JKMethodArgumentTypeIMP: { + IMP value = [obj pointerValue]; + [invocation setArgument:&value atIndex:index]; + } break; + default: break; + } + }]; + return invocation; +} + + +- (JKMethodArgumentType)argumentTypeAtIndex:(NSUInteger)index { + const char * encode = [self getArgumentTypeAtIndex:index]; + return jk_argumentTypeWithEncode(encode); +} + + + +@end + + + + +@implementation NSInvocation (JKRuntimeInvoker) + + + +- (id)invokeWithTarget:(id)target selector:(SEL)selector returnType:(JKMethodArgumentType)returnType { + self.target = target; + self.selector = selector; + [self invoke]; + return [self getReturnValueForType:returnType]; +} + + +- (id)getReturnValueForType:(JKMethodArgumentType)type { + __unsafe_unretained id returnValue = nil; + switch (type) { + case JKMethodArgumentTypeChar: { + char value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeInt: { + int value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeShort: { + short value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeLong: { + long value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeLongLong: { + long long value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeUnsignedChar: { + unsigned char value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeUnsignedInt: { + unsigned int value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeUnsignedShort: { + unsigned short value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeUnsignedLong: { + unsigned long value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeUnsignedLongLong: { + unsigned long long value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeFloat: { + float value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeDouble: { + double value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeBool: { + _Bool value; + [self getReturnValue:&value]; + returnValue = @(value); + } break; + case JKMethodArgumentTypeVoid: { + + } break; + case JKMethodArgumentTypeCharacterString: { + const char * value; + [self getReturnValue:&value]; + returnValue = [NSString stringWithUTF8String:value]; + } break; + case JKMethodArgumentTypeCGPoint: { + CGPoint value; + [self getReturnValue:&value]; + returnValue = [NSValue valueWithCGPoint:value]; + } break; + case JKMethodArgumentTypeCGSize: { + CGSize value; + [self getReturnValue:&value]; + returnValue = [NSValue valueWithCGSize:value]; + } break; + case JKMethodArgumentTypeCGRect: { + CGRect value; + [self getReturnValue:&value]; + returnValue = [NSValue valueWithCGRect:value]; + } break; + case JKMethodArgumentTypeUIEdgeInsets: { + UIEdgeInsets value; + [self getReturnValue:&value]; + returnValue = [NSValue valueWithUIEdgeInsets:value]; + } break; + case JKMethodArgumentTypeObject: { + [self getReturnValue:&returnValue]; + } break; + case JKMethodArgumentTypeClass: { + [self getReturnValue:&returnValue]; + } break; + case JKMethodArgumentTypeBlock: { + [self getReturnValue:&returnValue]; + } break; + case JKMethodArgumentTypeSEL: { + SEL value; + [self getReturnValue:&value]; + returnValue = [NSValue valueWithPointer:value]; + } break; + case JKMethodArgumentTypeIMP: { + IMP value; + [self getReturnValue:&value]; + returnValue = [NSValue valueWithPointer:value]; + } break; + default: break; + } + return returnValue; +} + + + +@end + + + + + + +@implementation NSObject (JKRuntimeInvoker) +#define AnalysisArgument(argument)\ +va_list argList;\ +NSMutableArray * arguments = [[NSMutableArray alloc] initWithCapacity:3];\ +if (argument) {\ +[arguments addObject:argument];\ +va_start(argList, argument);\ +id nextArgument = nil;\ +while ((nextArgument = va_arg(argList, id))) {\ +[arguments addObject:nextArgument];\ +}\ +}\ + + +#define JKParameterAssert(condition, desc)\ +if (!(condition)) {\ +NSLog(@"JKRuntimeInvoker Error⚠️: %@",desc);\ +return nil;\ +}\ + + +- (id)invokeSelector:(NSString *)aSelectorName { + return [self invokeSelector:aSelectorName arguments:nil]; +} + +- (id)invokeSelector:(NSString *)aSelectorName argument:(id)argument, ... { + AnalysisArgument(argument) + return [self invokeSelector:aSelectorName arguments:arguments]; +} + + +- (id)invokeSelector:(NSString *)aSelectorName arguments:(NSArray *)arguments { + JKParameterAssert(!(arguments && ![arguments isKindOfClass:NSArray.class]), @"无效的arguments"); + + SEL method = NSSelectorFromString(aSelectorName); + return [self invokeSEL:method arguments:arguments]; +} + + +- (id)invokeSEL:(SEL)aSelector { + return [self invokeSEL:aSelector arguments:nil]; +} + + +- (id)invokeSEL:(SEL)aSelector argument:(id)argument, ... { + AnalysisArgument(argument) + return [self invokeSEL:aSelector arguments:arguments]; +} + + + + + +- (id)invokeSEL:(SEL)aSelector arguments:(NSArray *)arguments { + JKParameterAssert(aSelector, @"无效的selector"); + + NSMethodSignature * signature = [self methodSignatureForSelector:aSelector]; + JKParameterAssert(signature, @"无效的方法签名"); + + NSInvocation * invocation = [signature invocationWithArguments:arguments]; + JKMethodArgumentType returnType = jk_argumentTypeWithEncode(signature.methodReturnType); + return [invocation invokeWithTarget:self selector:aSelector returnType:returnType]; +} + + + +@end diff --git a/BAWKWebView-WebP/BAWKWebView-WebP/NSURLProtocol+BAWebView.m b/BAWKWebView-WebP/BAWKWebView-WebP/NSURLProtocol+BAWebView.m index 4ee52db..dda2989 100644 --- a/BAWKWebView-WebP/BAWKWebView-WebP/NSURLProtocol+BAWebView.m +++ b/BAWKWebView-WebP/BAWKWebView-WebP/NSURLProtocol+BAWebView.m @@ -7,51 +7,29 @@ // #import "NSURLProtocol+BAWebView.h" - +#import "NSObject+RuntimeInvoker.h" #import -/** - * The functions below use some undocumented APIs, which may lead to rejection by Apple. - */ +@implementation NSURLProtocol (BAWebView) -FOUNDATION_STATIC_INLINE Class ContextControllerClass() { +Class ContextControllerClass() { static Class cls; if (!cls) { - cls = [[[WKWebView new] valueForKey:@"browsingContextController"] class]; - } - return cls; -} - -FOUNDATION_STATIC_INLINE SEL RegisterSchemeSelector() { - return NSSelectorFromString(@"registerSchemeForCustomProtocol:"); + cls = [[[WKWebView new] valueForKey:fOriginalInterfaceName(@"browsing#Context#Controller")] class]; + }return cls; } -FOUNDATION_STATIC_INLINE SEL UnregisterSchemeSelector() { - return NSSelectorFromString(@"unregisterSchemeForCustomProtocol:"); -} - -@implementation NSURLProtocol (BAWebView) + (void)ba_web_registerScheme:(NSString *)scheme { Class cls = ContextControllerClass(); - SEL sel = RegisterSchemeSelector(); - if ([(id)cls respondsToSelector:sel]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - [(id)cls performSelector:sel withObject:scheme]; -#pragma clang diagnostic pop - } + [cls invokeSelector:fOriginalInterfaceName(@"register#SchemeFor#Custom#Protocol:") + argument:scheme, nil]; } + (void)ba_web_unregisterScheme:(NSString *)scheme { Class cls = ContextControllerClass(); - SEL sel = UnregisterSchemeSelector(); - if ([(id)cls respondsToSelector:sel]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - [(id)cls performSelector:sel withObject:scheme]; -#pragma clang diagnostic pop - } + [cls invokeSelector:fOriginalInterfaceName(@"unregister#SchemeFor#Custom#Protocol:") + argument:scheme, nil]; } @end diff --git a/BAWKWebView-WebP/BAWebpController.m b/BAWKWebView-WebP/BAWebpController.m index 679ef82..1732824 100644 --- a/BAWKWebView-WebP/BAWebpController.m +++ b/BAWKWebView-WebP/BAWebpController.m @@ -5,6 +5,8 @@ // Created by 海洋唐 on 2017/8/2. // Copyright © 2017年 boai. All rights reserved. // + + /*! * 获取屏幕宽度和高度 */ @@ -17,20 +19,20 @@ #import "BAWKWebView_WebP.h" @interface BAWebpController () + @property (nonatomic,strong)WKWebView *wkWebview; + @end @implementation BAWebpController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - + self.view.backgroundColor = UIColor.whiteColor; [self setupUI]; } -- (void)setupUI -{ +- (void)setupUI { self.wkWebview.hidden = NO; [self.view setBackgroundColor:[UIColor whiteColor]]; @@ -39,36 +41,40 @@ - (void)setupUI [self.wkWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; } -- (void)viewDidLayoutSubviews -{ +- (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; self.wkWebview.frame = CGRectMake(0, 0, BAKit_SCREEN_WIDTH, BAKit_SCREEN_HEIGHT); } #pragma mark - 注册自定义 NSURLProtocol -- (void)ba_registerURLProtocol -{ - [NSURLProtocol registerClass:NSClassFromString(@"BAURLSessionProtocol")]; - // 注册registerScheme使得WKWebView支持NSURLProtocol - [NSURLProtocol ba_web_registerScheme:@"http"]; - [NSURLProtocol ba_web_registerScheme:@"https"]; +BOOL beforeiOS(CGFloat aVersion) { + return UIDevice.currentDevice.systemVersion.floatValue < aVersion; } -- (void)dealloc -{ - [NSURLProtocol unregisterClass:NSClassFromString(@"BAURLSessionProtocol")]; - // 移除 registerScheme - [NSURLProtocol ba_web_unregisterScheme:@"http"]; - [NSURLProtocol ba_web_unregisterScheme:@"https"]; + +- (void)ba_registerURLProtocol { + // 新版WebKit内核已经支持webp + if (beforeiOS(14)) { + [NSURLProtocol registerClass:NSClassFromString(@"BAURLSessionProtocol")]; + // 注册registerScheme使得WKWebView支持NSURLProtocol + [NSURLProtocol ba_web_registerScheme:@"http"]; + [NSURLProtocol ba_web_registerScheme:@"https"]; + } } -- (WKWebView *)wkWebview -{ - if (!_wkWebview) - { - _wkWebview = [[WKWebView alloc]initWithFrame:CGRectZero]; +- (void)dealloc{ + if (beforeiOS(14)) { + [NSURLProtocol unregisterClass:NSClassFromString(@"BAURLSessionProtocol")]; + // 移除 registerScheme + [NSURLProtocol ba_web_unregisterScheme:@"http"]; + [NSURLProtocol ba_web_unregisterScheme:@"https"]; } - return _wkWebview; +} + +- (WKWebView *)wkWebview { + if (!_wkWebview) { + _wkWebview = [[WKWebView alloc]initWithFrame:CGRectZero]; + } return _wkWebview; } @end diff --git a/BAWKWebView-WebP/ViewController.m b/BAWKWebView-WebP/ViewController.m index f91c702..57adad1 100644 --- a/BAWKWebView-WebP/ViewController.m +++ b/BAWKWebView-WebP/ViewController.m @@ -16,7 +16,7 @@ #import "ViewController.h" #import "BAWebpController.h" -static NSString * const kURL2 = @"http://onzbjws3p.bkt.clouddn.com/testForwebpSrc/webpForhtml.html"; +static NSString * const kURL2 = @"https://h5.mvmtv.com/2020-09-27/f488ebe1-4d54-a5cb-a38d-0d3097458999.html"; static NSString * const kURL3 = @"https://isparta.github.io/compare-webp/index_a.html#12"; // webp动图测试 @interface ViewController () @@ -29,6 +29,7 @@ @interface ViewController () @implementation ViewController + - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. @@ -40,8 +41,7 @@ - (void)viewDidLoad { - (NSMutableArray *)dataArray { if (!_dataArray) { _dataArray = [NSMutableArray arrayWithObjects:@"webp静态图片",@"webp动图待完善", nil]; - } - return _dataArray; + } return _dataArray; } - (UITableView *)baTableView { @@ -53,13 +53,11 @@ - (UITableView *)baTableView { return _baTableView; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.dataArray count]; } -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"UITableViewCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { @@ -69,19 +67,16 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 50.0f; } -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; BAWebpController *webpVC = [[BAWebpController alloc]init]; if (indexPath.row == 0) { webpVC.urlString = kURL2; - } - else if (indexPath.row == 1){ + } else if (indexPath.row == 1){ webpVC.urlString = kURL3; } [self.navigationController pushViewController:webpVC animated:YES]; diff --git a/Podfile b/Podfile index 93b1cf0..a4e9e40 100644 --- a/Podfile +++ b/Podfile @@ -1,11 +1,12 @@ # Uncomment this line to define a global platform for your project - platform :ios, '8.0' + platform :ios, '9.0' target 'BAWKWebView-WebP' do # Uncomment this line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for BAWKWebView-WebP - pod 'SDWebImage/WebP' + pod 'SDWebImage','>= 5.9' + pod 'SDWebImageWebPCoder' end diff --git a/Podfile.lock b/Podfile.lock index 246042d..2e35b91 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,40 +1,35 @@ PODS: - - libwebp (0.6.0): - - libwebp/core (= 0.6.0) - - libwebp/dec (= 0.6.0) - - libwebp/demux (= 0.6.0) - - libwebp/dsp (= 0.6.0) - - libwebp/enc (= 0.6.0) - - libwebp/mux (= 0.6.0) - - libwebp/utils (= 0.6.0) - - libwebp/webp (= 0.6.0) - - libwebp/core (0.6.0): + - libwebp (1.1.0): + - libwebp/demux (= 1.1.0) + - libwebp/mux (= 1.1.0) + - libwebp/webp (= 1.1.0) + - libwebp/demux (1.1.0): - libwebp/webp - - libwebp/dec (0.6.0): - - libwebp/core - - libwebp/demux (0.6.0): - - libwebp/core - - libwebp/dsp (0.6.0): - - libwebp/core - - libwebp/enc (0.6.0): - - libwebp/core - - libwebp/mux (0.6.0): - - libwebp/core - - libwebp/utils (0.6.0): - - libwebp/core - - libwebp/webp (0.6.0) - - SDWebImage/Core (4.0.0) - - SDWebImage/WebP (4.0.0): - - libwebp - - SDWebImage/Core + - libwebp/mux (1.1.0): + - libwebp/demux + - libwebp/webp (1.1.0) + - SDWebImage (5.9.1): + - SDWebImage/Core (= 5.9.1) + - SDWebImage/Core (5.9.1) + - SDWebImageWebPCoder (0.6.1): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.7) DEPENDENCIES: - - SDWebImage/WebP + - SDWebImage (>= 5.9) + - SDWebImageWebPCoder + +SPEC REPOS: + trunk: + - libwebp + - SDWebImage + - SDWebImageWebPCoder SPEC CHECKSUMS: - libwebp: 1d5a07c2eb97f9c31bd5f154bb82efc0ea67c6a2 - SDWebImage: 76a6348bdc74eb5a55dd08a091ef298e56b55e41 + libwebp: 946cb3063cea9236285f7e9a8505d806d30e07f3 + SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5 + SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21 -PODFILE CHECKSUM: 0b4a18e8d55605d6055b6de28ddd6c22c5ea617c +PODFILE CHECKSUM: 65862234018995f74a645dc7f7dca4cdf9941215 -COCOAPODS: 1.0.1 +COCOAPODS: 1.9.3 diff --git a/Pods/Headers/Private/SDWebImage/NSBezierPath+SDRoundedCorners.h b/Pods/Headers/Private/SDWebImage/NSBezierPath+SDRoundedCorners.h new file mode 120000 index 0000000..2c6051a --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/NSBezierPath+SDRoundedCorners.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/NSButton+WebCache.h b/Pods/Headers/Private/SDWebImage/NSButton+WebCache.h new file mode 120000 index 0000000..39dabdc --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/NSButton+WebCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/NSButton+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h b/Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h index 8457498..a862229 120000 --- a/Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h +++ b/Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/NSData+ImageContentType.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/NSData+ImageContentType.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/NSImage+Compatibility.h b/Pods/Headers/Private/SDWebImage/NSImage+Compatibility.h new file mode 120000 index 0000000..bf36207 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/NSImage+Compatibility.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/NSImage+Compatibility.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/NSImage+WebCache.h b/Pods/Headers/Private/SDWebImage/NSImage+WebCache.h deleted file mode 120000 index b7a00e1..0000000 --- a/Pods/Headers/Private/SDWebImage/NSImage+WebCache.h +++ /dev/null @@ -1 +0,0 @@ -../../../SDWebImage/SDWebImage/NSImage+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAnimatedImage.h b/Pods/Headers/Private/SDWebImage/SDAnimatedImage.h new file mode 120000 index 0000000..9a9aca4 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAnimatedImage.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImage.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAnimatedImagePlayer.h b/Pods/Headers/Private/SDWebImage/SDAnimatedImagePlayer.h new file mode 120000 index 0000000..786cc5e --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAnimatedImagePlayer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAnimatedImageRep.h b/Pods/Headers/Private/SDWebImage/SDAnimatedImageRep.h new file mode 120000 index 0000000..5068f2b --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAnimatedImageRep.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAnimatedImageView+WebCache.h b/Pods/Headers/Private/SDWebImage/SDAnimatedImageView+WebCache.h new file mode 120000 index 0000000..b95eb57 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAnimatedImageView+WebCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAnimatedImageView.h b/Pods/Headers/Private/SDWebImage/SDAnimatedImageView.h new file mode 120000 index 0000000..e249f15 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAnimatedImageView.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImageView.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAssociatedObject.h b/Pods/Headers/Private/SDWebImage/SDAssociatedObject.h new file mode 120000 index 0000000..f104a13 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAssociatedObject.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDAssociatedObject.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDAsyncBlockOperation.h b/Pods/Headers/Private/SDWebImage/SDAsyncBlockOperation.h new file mode 120000 index 0000000..1fcccbe --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDAsyncBlockOperation.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDDeviceHelper.h b/Pods/Headers/Private/SDWebImage/SDDeviceHelper.h new file mode 120000 index 0000000..44b99b8 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDDeviceHelper.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDDeviceHelper.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDDiskCache.h b/Pods/Headers/Private/SDWebImage/SDDiskCache.h new file mode 120000 index 0000000..225610c --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDDiskCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDDiskCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDDisplayLink.h b/Pods/Headers/Private/SDWebImage/SDDisplayLink.h new file mode 120000 index 0000000..ba2e28c --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDDisplayLink.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDDisplayLink.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDFileAttributeHelper.h b/Pods/Headers/Private/SDWebImage/SDFileAttributeHelper.h new file mode 120000 index 0000000..deb8153 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDFileAttributeHelper.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDGraphicsImageRenderer.h b/Pods/Headers/Private/SDWebImage/SDGraphicsImageRenderer.h new file mode 120000 index 0000000..d390c1f --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDGraphicsImageRenderer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageAPNGCoder.h b/Pods/Headers/Private/SDWebImage/SDImageAPNGCoder.h new file mode 120000 index 0000000..c237e5a --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageAPNGCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageAWebPCoder.h b/Pods/Headers/Private/SDWebImage/SDImageAWebPCoder.h new file mode 120000 index 0000000..a0aa6b1 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageAWebPCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageAssetManager.h b/Pods/Headers/Private/SDWebImage/SDImageAssetManager.h new file mode 120000 index 0000000..17c176c --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageAssetManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDImageAssetManager.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCache.h b/Pods/Headers/Private/SDWebImage/SDImageCache.h index 0040b06..e2ed28f 120000 --- a/Pods/Headers/Private/SDWebImage/SDImageCache.h +++ b/Pods/Headers/Private/SDWebImage/SDImageCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDImageCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDImageCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCacheConfig.h b/Pods/Headers/Private/SDWebImage/SDImageCacheConfig.h index f0f1f8f..728d9a8 120000 --- a/Pods/Headers/Private/SDWebImage/SDImageCacheConfig.h +++ b/Pods/Headers/Private/SDWebImage/SDImageCacheConfig.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDImageCacheConfig.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDImageCacheConfig.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCacheDefine.h b/Pods/Headers/Private/SDWebImage/SDImageCacheDefine.h new file mode 120000 index 0000000..9132110 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageCacheDefine.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCacheDefine.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCachesManager.h b/Pods/Headers/Private/SDWebImage/SDImageCachesManager.h new file mode 120000 index 0000000..92539dc --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageCachesManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCachesManager.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCachesManagerOperation.h b/Pods/Headers/Private/SDWebImage/SDImageCachesManagerOperation.h new file mode 120000 index 0000000..3b6f379 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageCachesManagerOperation.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCoder.h b/Pods/Headers/Private/SDWebImage/SDImageCoder.h new file mode 120000 index 0000000..2753205 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCoderHelper.h b/Pods/Headers/Private/SDWebImage/SDImageCoderHelper.h new file mode 120000 index 0000000..2397896 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageCoderHelper.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCoderHelper.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageCodersManager.h b/Pods/Headers/Private/SDWebImage/SDImageCodersManager.h new file mode 120000 index 0000000..a20da4d --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageCodersManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCodersManager.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageFrame.h b/Pods/Headers/Private/SDWebImage/SDImageFrame.h new file mode 120000 index 0000000..455d5e9 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageFrame.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageFrame.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageGIFCoder.h b/Pods/Headers/Private/SDWebImage/SDImageGIFCoder.h new file mode 120000 index 0000000..bb2583c --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageGIFCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageGIFCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageGraphics.h b/Pods/Headers/Private/SDWebImage/SDImageGraphics.h new file mode 120000 index 0000000..903206c --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageGraphics.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageGraphics.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageHEICCoder.h b/Pods/Headers/Private/SDWebImage/SDImageHEICCoder.h new file mode 120000 index 0000000..745e8d0 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageHEICCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageHEICCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoder.h b/Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoder.h new file mode 120000 index 0000000..c898dc7 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoderInternal.h b/Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoderInternal.h new file mode 120000 index 0000000..33a6f00 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageIOAnimatedCoderInternal.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageIOCoder.h b/Pods/Headers/Private/SDWebImage/SDImageIOCoder.h new file mode 120000 index 0000000..60dc1a5 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageIOCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageIOCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageLoader.h b/Pods/Headers/Private/SDWebImage/SDImageLoader.h new file mode 120000 index 0000000..0ba2c8e --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageLoader.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageLoader.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageLoadersManager.h b/Pods/Headers/Private/SDWebImage/SDImageLoadersManager.h new file mode 120000 index 0000000..f78e2a4 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageLoadersManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageLoadersManager.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDImageTransformer.h b/Pods/Headers/Private/SDWebImage/SDImageTransformer.h new file mode 120000 index 0000000..7848178 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDImageTransformer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageTransformer.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDInternalMacros.h b/Pods/Headers/Private/SDWebImage/SDInternalMacros.h new file mode 120000 index 0000000..6e6ed32 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDInternalMacros.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDInternalMacros.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDMemoryCache.h b/Pods/Headers/Private/SDWebImage/SDMemoryCache.h new file mode 120000 index 0000000..6011bab --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDMemoryCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDMemoryCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWeakProxy.h b/Pods/Headers/Private/SDWebImage/SDWeakProxy.h new file mode 120000 index 0000000..c683464 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWeakProxy.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDWeakProxy.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImage.h b/Pods/Headers/Private/SDWebImage/SDWebImage.h new file mode 120000 index 0000000..48f99e3 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImage.h @@ -0,0 +1 @@ +../../../SDWebImage/WebImage/SDWebImage.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageCacheKeyFilter.h b/Pods/Headers/Private/SDWebImage/SDWebImageCacheKeyFilter.h new file mode 120000 index 0000000..59f23c6 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageCacheKeyFilter.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageCacheSerializer.h b/Pods/Headers/Private/SDWebImage/SDWebImageCacheSerializer.h new file mode 120000 index 0000000..6f4d99a --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageCacheSerializer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageCompat.h b/Pods/Headers/Private/SDWebImage/SDWebImageCompat.h index 6ca2478..d4c2592 120000 --- a/Pods/Headers/Private/SDWebImage/SDWebImageCompat.h +++ b/Pods/Headers/Private/SDWebImage/SDWebImageCompat.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageCompat.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageCompat.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h b/Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h deleted file mode 120000 index a2f3a68..0000000 --- a/Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h +++ /dev/null @@ -1 +0,0 @@ -../../../SDWebImage/SDWebImage/SDWebImageDecoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDefine.h b/Pods/Headers/Private/SDWebImage/SDWebImageDefine.h new file mode 120000 index 0000000..4fc6168 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDefine.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDefine.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h b/Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h index 303b03b..b025d29 120000 --- a/Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageDownloader.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloader.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderConfig.h b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderConfig.h new file mode 120000 index 0000000..7b18950 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderConfig.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderDecryptor.h b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderDecryptor.h new file mode 120000 index 0000000..2163ce7 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderDecryptor.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h index 99441c4..73ecd13 120000 --- a/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderRequestModifier.h b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderRequestModifier.h new file mode 120000 index 0000000..d8aedd1 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderRequestModifier.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderResponseModifier.h b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderResponseModifier.h new file mode 120000 index 0000000..3c78451 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageDownloaderResponseModifier.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageError.h b/Pods/Headers/Private/SDWebImage/SDWebImageError.h new file mode 120000 index 0000000..919f86d --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageError.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageError.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageIndicator.h b/Pods/Headers/Private/SDWebImage/SDWebImageIndicator.h new file mode 120000 index 0000000..b501d59 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageIndicator.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageIndicator.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageManager.h b/Pods/Headers/Private/SDWebImage/SDWebImageManager.h index 1b81848..c6641ed 120000 --- a/Pods/Headers/Private/SDWebImage/SDWebImageManager.h +++ b/Pods/Headers/Private/SDWebImage/SDWebImageManager.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageManager.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageManager.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageOperation.h b/Pods/Headers/Private/SDWebImage/SDWebImageOperation.h index 20e5b89..a628f80 120000 --- a/Pods/Headers/Private/SDWebImage/SDWebImageOperation.h +++ b/Pods/Headers/Private/SDWebImage/SDWebImageOperation.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageOperation.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageOperation.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageOptionsProcessor.h b/Pods/Headers/Private/SDWebImage/SDWebImageOptionsProcessor.h new file mode 120000 index 0000000..c417739 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageOptionsProcessor.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h b/Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h index 50585c6..37c6f64 120000 --- a/Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h +++ b/Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageTransition.h b/Pods/Headers/Private/SDWebImage/SDWebImageTransition.h new file mode 120000 index 0000000..ea5bb46 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageTransition.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageTransition.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDWebImageTransitionInternal.h b/Pods/Headers/Private/SDWebImage/SDWebImageTransitionInternal.h new file mode 120000 index 0000000..0f3ec14 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDWebImageTransitionInternal.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/SDmetamacros.h b/Pods/Headers/Private/SDWebImage/SDmetamacros.h new file mode 120000 index 0000000..e1485f5 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/SDmetamacros.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/SDmetamacros.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIButton+WebCache.h b/Pods/Headers/Private/SDWebImage/UIButton+WebCache.h index 19d2d8e..130f62d 120000 --- a/Pods/Headers/Private/SDWebImage/UIButton+WebCache.h +++ b/Pods/Headers/Private/SDWebImage/UIButton+WebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIButton+WebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIButton+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIColor+SDHexString.h b/Pods/Headers/Private/SDWebImage/UIColor+SDHexString.h new file mode 120000 index 0000000..2c443ec --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/UIColor+SDHexString.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Private/UIColor+SDHexString.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+ExtendedCacheData.h b/Pods/Headers/Private/SDWebImage/UIImage+ExtendedCacheData.h new file mode 120000 index 0000000..2642489 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/UIImage+ExtendedCacheData.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+ForceDecode.h b/Pods/Headers/Private/SDWebImage/UIImage+ForceDecode.h new file mode 120000 index 0000000..81cd8f2 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/UIImage+ForceDecode.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+GIF.h b/Pods/Headers/Private/SDWebImage/UIImage+GIF.h index 14d5aad..17e7a5d 120000 --- a/Pods/Headers/Private/SDWebImage/UIImage+GIF.h +++ b/Pods/Headers/Private/SDWebImage/UIImage+GIF.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImage+GIF.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImage+GIF.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+MemoryCacheCost.h b/Pods/Headers/Private/SDWebImage/UIImage+MemoryCacheCost.h new file mode 120000 index 0000000..704be7f --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/UIImage+MemoryCacheCost.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+Metadata.h b/Pods/Headers/Private/SDWebImage/UIImage+Metadata.h new file mode 120000 index 0000000..9480200 --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/UIImage+Metadata.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+Metadata.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h b/Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h index 1fb9650..28afd5c 120000 --- a/Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h +++ b/Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+Transform.h b/Pods/Headers/Private/SDWebImage/UIImage+Transform.h new file mode 120000 index 0000000..df8105a --- /dev/null +++ b/Pods/Headers/Private/SDWebImage/UIImage+Transform.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+Transform.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImage+WebP.h b/Pods/Headers/Private/SDWebImage/UIImage+WebP.h deleted file mode 120000 index 55ccb39..0000000 --- a/Pods/Headers/Private/SDWebImage/UIImage+WebP.h +++ /dev/null @@ -1 +0,0 @@ -../../../SDWebImage/SDWebImage/UIImage+WebP.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h b/Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h index fd4dea4..afd7f97 120000 --- a/Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h +++ b/Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h b/Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h index 0c53a47..662a4eb 120000 --- a/Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h +++ b/Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImageView+WebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImageView+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIView+WebCache.h b/Pods/Headers/Private/SDWebImage/UIView+WebCache.h index 641671a..7da0846 120000 --- a/Pods/Headers/Private/SDWebImage/UIView+WebCache.h +++ b/Pods/Headers/Private/SDWebImage/UIView+WebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIView+WebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIView+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h b/Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h index f9890c4..ea0a6a5 120000 --- a/Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h +++ b/Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImageWebPCoder/SDImageWebPCoder.h b/Pods/Headers/Private/SDWebImageWebPCoder/SDImageWebPCoder.h new file mode 120000 index 0000000..06a8e52 --- /dev/null +++ b/Pods/Headers/Private/SDWebImageWebPCoder/SDImageWebPCoder.h @@ -0,0 +1 @@ +../../../SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImageWebPCoder/SDWebImageWebPCoder.h b/Pods/Headers/Private/SDWebImageWebPCoder/SDWebImageWebPCoder.h new file mode 120000 index 0000000..7bd896b --- /dev/null +++ b/Pods/Headers/Private/SDWebImageWebPCoder/SDWebImageWebPCoder.h @@ -0,0 +1 @@ +../../../SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h \ No newline at end of file diff --git a/Pods/Headers/Private/SDWebImageWebPCoder/UIImage+WebP.h b/Pods/Headers/Private/SDWebImageWebPCoder/UIImage+WebP.h new file mode 120000 index 0000000..9fe2374 --- /dev/null +++ b/Pods/Headers/Private/SDWebImageWebPCoder/UIImage+WebP.h @@ -0,0 +1 @@ +../../../SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/common_sse41.h b/Pods/Headers/Private/libwebp/common_sse41.h new file mode 120000 index 0000000..fa2f46e --- /dev/null +++ b/Pods/Headers/Private/libwebp/common_sse41.h @@ -0,0 +1 @@ +../../../libwebp/src/dsp/common_sse41.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/decode.h b/Pods/Headers/Private/libwebp/decode.h new file mode 120000 index 0000000..8f4be12 --- /dev/null +++ b/Pods/Headers/Private/libwebp/decode.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/decode.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/delta_palettization_enc.h b/Pods/Headers/Private/libwebp/delta_palettization_enc.h deleted file mode 120000 index cd3906d..0000000 --- a/Pods/Headers/Private/libwebp/delta_palettization_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/delta_palettization_enc.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/demux.h b/Pods/Headers/Private/libwebp/demux.h new file mode 120000 index 0000000..ceec8f5 --- /dev/null +++ b/Pods/Headers/Private/libwebp/demux.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/demux.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/encode.h b/Pods/Headers/Private/libwebp/encode.h new file mode 120000 index 0000000..11ac057 --- /dev/null +++ b/Pods/Headers/Private/libwebp/encode.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/encode.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/format_constants.h b/Pods/Headers/Private/libwebp/format_constants.h new file mode 120000 index 0000000..be70fdf --- /dev/null +++ b/Pods/Headers/Private/libwebp/format_constants.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/format_constants.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/mux.h b/Pods/Headers/Private/libwebp/mux.h new file mode 120000 index 0000000..2578c2a --- /dev/null +++ b/Pods/Headers/Private/libwebp/mux.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/mux.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/mux_types.h b/Pods/Headers/Private/libwebp/mux_types.h new file mode 120000 index 0000000..ef1edce --- /dev/null +++ b/Pods/Headers/Private/libwebp/mux_types.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/mux_types.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/quant.h b/Pods/Headers/Private/libwebp/quant.h new file mode 120000 index 0000000..9b7c88e --- /dev/null +++ b/Pods/Headers/Private/libwebp/quant.h @@ -0,0 +1 @@ +../../../libwebp/src/dsp/quant.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/types.h b/Pods/Headers/Private/libwebp/types.h new file mode 120000 index 0000000..86ac06f --- /dev/null +++ b/Pods/Headers/Private/libwebp/types.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/types.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/decode.h b/Pods/Headers/Private/libwebp/webp/decode.h deleted file mode 120000 index cb9e6a2..0000000 --- a/Pods/Headers/Private/libwebp/webp/decode.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/decode.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/demux.h b/Pods/Headers/Private/libwebp/webp/demux.h deleted file mode 120000 index 4b1b108..0000000 --- a/Pods/Headers/Private/libwebp/webp/demux.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/demux.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/encode.h b/Pods/Headers/Private/libwebp/webp/encode.h deleted file mode 120000 index 336598a..0000000 --- a/Pods/Headers/Private/libwebp/webp/encode.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/encode.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/format_constants.h b/Pods/Headers/Private/libwebp/webp/format_constants.h deleted file mode 120000 index 2b3e467..0000000 --- a/Pods/Headers/Private/libwebp/webp/format_constants.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/format_constants.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/mux.h b/Pods/Headers/Private/libwebp/webp/mux.h deleted file mode 120000 index 03e4964..0000000 --- a/Pods/Headers/Private/libwebp/webp/mux.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/mux.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/mux_types.h b/Pods/Headers/Private/libwebp/webp/mux_types.h deleted file mode 120000 index 2076102..0000000 --- a/Pods/Headers/Private/libwebp/webp/mux_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/mux_types.h \ No newline at end of file diff --git a/Pods/Headers/Private/libwebp/webp/types.h b/Pods/Headers/Private/libwebp/webp/types.h deleted file mode 120000 index e00cbb0..0000000 --- a/Pods/Headers/Private/libwebp/webp/types.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/types.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/NSButton+WebCache.h b/Pods/Headers/Public/SDWebImage/NSButton+WebCache.h new file mode 120000 index 0000000..39dabdc --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/NSButton+WebCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/NSButton+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h b/Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h index 8457498..a862229 120000 --- a/Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h +++ b/Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/NSData+ImageContentType.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/NSData+ImageContentType.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/NSImage+Compatibility.h b/Pods/Headers/Public/SDWebImage/NSImage+Compatibility.h new file mode 120000 index 0000000..bf36207 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/NSImage+Compatibility.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/NSImage+Compatibility.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/NSImage+WebCache.h b/Pods/Headers/Public/SDWebImage/NSImage+WebCache.h deleted file mode 120000 index b7a00e1..0000000 --- a/Pods/Headers/Public/SDWebImage/NSImage+WebCache.h +++ /dev/null @@ -1 +0,0 @@ -../../../SDWebImage/SDWebImage/NSImage+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDAnimatedImage.h b/Pods/Headers/Public/SDWebImage/SDAnimatedImage.h new file mode 120000 index 0000000..9a9aca4 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDAnimatedImage.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImage.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDAnimatedImagePlayer.h b/Pods/Headers/Public/SDWebImage/SDAnimatedImagePlayer.h new file mode 120000 index 0000000..786cc5e --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDAnimatedImagePlayer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDAnimatedImageRep.h b/Pods/Headers/Public/SDWebImage/SDAnimatedImageRep.h new file mode 120000 index 0000000..5068f2b --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDAnimatedImageRep.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDAnimatedImageView+WebCache.h b/Pods/Headers/Public/SDWebImage/SDAnimatedImageView+WebCache.h new file mode 120000 index 0000000..b95eb57 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDAnimatedImageView+WebCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDAnimatedImageView.h b/Pods/Headers/Public/SDWebImage/SDAnimatedImageView.h new file mode 120000 index 0000000..e249f15 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDAnimatedImageView.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDAnimatedImageView.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDDiskCache.h b/Pods/Headers/Public/SDWebImage/SDDiskCache.h new file mode 120000 index 0000000..225610c --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDDiskCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDDiskCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDGraphicsImageRenderer.h b/Pods/Headers/Public/SDWebImage/SDGraphicsImageRenderer.h new file mode 120000 index 0000000..d390c1f --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDGraphicsImageRenderer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageAPNGCoder.h b/Pods/Headers/Public/SDWebImage/SDImageAPNGCoder.h new file mode 120000 index 0000000..c237e5a --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageAPNGCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageAWebPCoder.h b/Pods/Headers/Public/SDWebImage/SDImageAWebPCoder.h new file mode 120000 index 0000000..a0aa6b1 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageAWebPCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCache.h b/Pods/Headers/Public/SDWebImage/SDImageCache.h index 0040b06..e2ed28f 120000 --- a/Pods/Headers/Public/SDWebImage/SDImageCache.h +++ b/Pods/Headers/Public/SDWebImage/SDImageCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDImageCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDImageCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCacheConfig.h b/Pods/Headers/Public/SDWebImage/SDImageCacheConfig.h index f0f1f8f..728d9a8 120000 --- a/Pods/Headers/Public/SDWebImage/SDImageCacheConfig.h +++ b/Pods/Headers/Public/SDWebImage/SDImageCacheConfig.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDImageCacheConfig.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDImageCacheConfig.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCacheDefine.h b/Pods/Headers/Public/SDWebImage/SDImageCacheDefine.h new file mode 120000 index 0000000..9132110 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageCacheDefine.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCacheDefine.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCachesManager.h b/Pods/Headers/Public/SDWebImage/SDImageCachesManager.h new file mode 120000 index 0000000..92539dc --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageCachesManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCachesManager.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCoder.h b/Pods/Headers/Public/SDWebImage/SDImageCoder.h new file mode 120000 index 0000000..2753205 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCoderHelper.h b/Pods/Headers/Public/SDWebImage/SDImageCoderHelper.h new file mode 120000 index 0000000..2397896 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageCoderHelper.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCoderHelper.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageCodersManager.h b/Pods/Headers/Public/SDWebImage/SDImageCodersManager.h new file mode 120000 index 0000000..a20da4d --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageCodersManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageCodersManager.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageFrame.h b/Pods/Headers/Public/SDWebImage/SDImageFrame.h new file mode 120000 index 0000000..455d5e9 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageFrame.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageFrame.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageGIFCoder.h b/Pods/Headers/Public/SDWebImage/SDImageGIFCoder.h new file mode 120000 index 0000000..bb2583c --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageGIFCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageGIFCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageGraphics.h b/Pods/Headers/Public/SDWebImage/SDImageGraphics.h new file mode 120000 index 0000000..903206c --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageGraphics.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageGraphics.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageHEICCoder.h b/Pods/Headers/Public/SDWebImage/SDImageHEICCoder.h new file mode 120000 index 0000000..745e8d0 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageHEICCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageHEICCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageIOAnimatedCoder.h b/Pods/Headers/Public/SDWebImage/SDImageIOAnimatedCoder.h new file mode 120000 index 0000000..c898dc7 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageIOAnimatedCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageIOCoder.h b/Pods/Headers/Public/SDWebImage/SDImageIOCoder.h new file mode 120000 index 0000000..60dc1a5 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageIOCoder.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageIOCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageLoader.h b/Pods/Headers/Public/SDWebImage/SDImageLoader.h new file mode 120000 index 0000000..0ba2c8e --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageLoader.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageLoader.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageLoadersManager.h b/Pods/Headers/Public/SDWebImage/SDImageLoadersManager.h new file mode 120000 index 0000000..f78e2a4 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageLoadersManager.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageLoadersManager.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDImageTransformer.h b/Pods/Headers/Public/SDWebImage/SDImageTransformer.h new file mode 120000 index 0000000..7848178 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDImageTransformer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDImageTransformer.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDMemoryCache.h b/Pods/Headers/Public/SDWebImage/SDMemoryCache.h new file mode 120000 index 0000000..6011bab --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDMemoryCache.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDMemoryCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImage.h b/Pods/Headers/Public/SDWebImage/SDWebImage.h new file mode 120000 index 0000000..48f99e3 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImage.h @@ -0,0 +1 @@ +../../../SDWebImage/WebImage/SDWebImage.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageCacheKeyFilter.h b/Pods/Headers/Public/SDWebImage/SDWebImageCacheKeyFilter.h new file mode 120000 index 0000000..59f23c6 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageCacheKeyFilter.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageCacheSerializer.h b/Pods/Headers/Public/SDWebImage/SDWebImageCacheSerializer.h new file mode 120000 index 0000000..6f4d99a --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageCacheSerializer.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageCompat.h b/Pods/Headers/Public/SDWebImage/SDWebImageCompat.h index 6ca2478..d4c2592 120000 --- a/Pods/Headers/Public/SDWebImage/SDWebImageCompat.h +++ b/Pods/Headers/Public/SDWebImage/SDWebImageCompat.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageCompat.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageCompat.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h b/Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h deleted file mode 120000 index a2f3a68..0000000 --- a/Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h +++ /dev/null @@ -1 +0,0 @@ -../../../SDWebImage/SDWebImage/SDWebImageDecoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDefine.h b/Pods/Headers/Public/SDWebImage/SDWebImageDefine.h new file mode 120000 index 0000000..4fc6168 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDefine.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDefine.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h b/Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h index 303b03b..b025d29 120000 --- a/Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageDownloader.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloader.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderConfig.h b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderConfig.h new file mode 120000 index 0000000..7b18950 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderConfig.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderDecryptor.h b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderDecryptor.h new file mode 120000 index 0000000..2163ce7 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderDecryptor.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h index 99441c4..73ecd13 120000 --- a/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderRequestModifier.h b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderRequestModifier.h new file mode 120000 index 0000000..d8aedd1 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderRequestModifier.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderResponseModifier.h b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderResponseModifier.h new file mode 120000 index 0000000..3c78451 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageDownloaderResponseModifier.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageError.h b/Pods/Headers/Public/SDWebImage/SDWebImageError.h new file mode 120000 index 0000000..919f86d --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageError.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageError.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageIndicator.h b/Pods/Headers/Public/SDWebImage/SDWebImageIndicator.h new file mode 120000 index 0000000..b501d59 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageIndicator.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageIndicator.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageManager.h b/Pods/Headers/Public/SDWebImage/SDWebImageManager.h index 1b81848..c6641ed 120000 --- a/Pods/Headers/Public/SDWebImage/SDWebImageManager.h +++ b/Pods/Headers/Public/SDWebImage/SDWebImageManager.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageManager.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageManager.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageOperation.h b/Pods/Headers/Public/SDWebImage/SDWebImageOperation.h index 20e5b89..a628f80 120000 --- a/Pods/Headers/Public/SDWebImage/SDWebImageOperation.h +++ b/Pods/Headers/Public/SDWebImage/SDWebImageOperation.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImageOperation.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImageOperation.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageOptionsProcessor.h b/Pods/Headers/Public/SDWebImage/SDWebImageOptionsProcessor.h new file mode 120000 index 0000000..c417739 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageOptionsProcessor.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h b/Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h index 50585c6..37c6f64 120000 --- a/Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h +++ b/Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/SDWebImageTransition.h b/Pods/Headers/Public/SDWebImage/SDWebImageTransition.h new file mode 120000 index 0000000..ea5bb46 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/SDWebImageTransition.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/SDWebImageTransition.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIButton+WebCache.h b/Pods/Headers/Public/SDWebImage/UIButton+WebCache.h index 19d2d8e..130f62d 120000 --- a/Pods/Headers/Public/SDWebImage/UIButton+WebCache.h +++ b/Pods/Headers/Public/SDWebImage/UIButton+WebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIButton+WebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIButton+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+ExtendedCacheData.h b/Pods/Headers/Public/SDWebImage/UIImage+ExtendedCacheData.h new file mode 120000 index 0000000..2642489 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/UIImage+ExtendedCacheData.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+ForceDecode.h b/Pods/Headers/Public/SDWebImage/UIImage+ForceDecode.h new file mode 120000 index 0000000..81cd8f2 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/UIImage+ForceDecode.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+GIF.h b/Pods/Headers/Public/SDWebImage/UIImage+GIF.h index 14d5aad..17e7a5d 120000 --- a/Pods/Headers/Public/SDWebImage/UIImage+GIF.h +++ b/Pods/Headers/Public/SDWebImage/UIImage+GIF.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImage+GIF.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImage+GIF.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+MemoryCacheCost.h b/Pods/Headers/Public/SDWebImage/UIImage+MemoryCacheCost.h new file mode 120000 index 0000000..704be7f --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/UIImage+MemoryCacheCost.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+Metadata.h b/Pods/Headers/Public/SDWebImage/UIImage+Metadata.h new file mode 120000 index 0000000..9480200 --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/UIImage+Metadata.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+Metadata.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h b/Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h index 1fb9650..28afd5c 120000 --- a/Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h +++ b/Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+Transform.h b/Pods/Headers/Public/SDWebImage/UIImage+Transform.h new file mode 120000 index 0000000..df8105a --- /dev/null +++ b/Pods/Headers/Public/SDWebImage/UIImage+Transform.h @@ -0,0 +1 @@ +../../../SDWebImage/SDWebImage/Core/UIImage+Transform.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImage+WebP.h b/Pods/Headers/Public/SDWebImage/UIImage+WebP.h deleted file mode 120000 index 55ccb39..0000000 --- a/Pods/Headers/Public/SDWebImage/UIImage+WebP.h +++ /dev/null @@ -1 +0,0 @@ -../../../SDWebImage/SDWebImage/UIImage+WebP.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h b/Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h index fd4dea4..afd7f97 120000 --- a/Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h +++ b/Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h b/Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h index 0c53a47..662a4eb 120000 --- a/Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h +++ b/Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIImageView+WebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIImageView+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIView+WebCache.h b/Pods/Headers/Public/SDWebImage/UIView+WebCache.h index 641671a..7da0846 120000 --- a/Pods/Headers/Public/SDWebImage/UIView+WebCache.h +++ b/Pods/Headers/Public/SDWebImage/UIView+WebCache.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIView+WebCache.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIView+WebCache.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h b/Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h index f9890c4..ea0a6a5 120000 --- a/Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h +++ b/Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h @@ -1 +1 @@ -../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h \ No newline at end of file +../../../SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImageWebPCoder/SDImageWebPCoder.h b/Pods/Headers/Public/SDWebImageWebPCoder/SDImageWebPCoder.h new file mode 120000 index 0000000..06a8e52 --- /dev/null +++ b/Pods/Headers/Public/SDWebImageWebPCoder/SDImageWebPCoder.h @@ -0,0 +1 @@ +../../../SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImageWebPCoder/SDWebImageWebPCoder.h b/Pods/Headers/Public/SDWebImageWebPCoder/SDWebImageWebPCoder.h new file mode 120000 index 0000000..7bd896b --- /dev/null +++ b/Pods/Headers/Public/SDWebImageWebPCoder/SDWebImageWebPCoder.h @@ -0,0 +1 @@ +../../../SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h \ No newline at end of file diff --git a/Pods/Headers/Public/SDWebImageWebPCoder/UIImage+WebP.h b/Pods/Headers/Public/SDWebImageWebPCoder/UIImage+WebP.h new file mode 120000 index 0000000..9fe2374 --- /dev/null +++ b/Pods/Headers/Public/SDWebImageWebPCoder/UIImage+WebP.h @@ -0,0 +1 @@ +../../../SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/alphai_dec.h b/Pods/Headers/Public/libwebp/alphai_dec.h deleted file mode 120000 index 56033f9..0000000 --- a/Pods/Headers/Public/libwebp/alphai_dec.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dec/alphai_dec.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/animi.h b/Pods/Headers/Public/libwebp/animi.h deleted file mode 120000 index 03a1a39..0000000 --- a/Pods/Headers/Public/libwebp/animi.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/mux/animi.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/backward_references_enc.h b/Pods/Headers/Public/libwebp/backward_references_enc.h deleted file mode 120000 index 63bd649..0000000 --- a/Pods/Headers/Public/libwebp/backward_references_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/backward_references_enc.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/bit_reader_inl_utils.h b/Pods/Headers/Public/libwebp/bit_reader_inl_utils.h deleted file mode 120000 index f633e01..0000000 --- a/Pods/Headers/Public/libwebp/bit_reader_inl_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/bit_reader_inl_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/bit_reader_utils.h b/Pods/Headers/Public/libwebp/bit_reader_utils.h deleted file mode 120000 index 4599a53..0000000 --- a/Pods/Headers/Public/libwebp/bit_reader_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/bit_reader_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/bit_writer_utils.h b/Pods/Headers/Public/libwebp/bit_writer_utils.h deleted file mode 120000 index dc9eb1b..0000000 --- a/Pods/Headers/Public/libwebp/bit_writer_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/bit_writer_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/color_cache_utils.h b/Pods/Headers/Public/libwebp/color_cache_utils.h deleted file mode 120000 index f224335..0000000 --- a/Pods/Headers/Public/libwebp/color_cache_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/color_cache_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/common_dec.h b/Pods/Headers/Public/libwebp/common_dec.h deleted file mode 120000 index 27df772..0000000 --- a/Pods/Headers/Public/libwebp/common_dec.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dec/common_dec.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/common_sse2.h b/Pods/Headers/Public/libwebp/common_sse2.h deleted file mode 120000 index 07f8eef..0000000 --- a/Pods/Headers/Public/libwebp/common_sse2.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/common_sse2.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/cost_enc.h b/Pods/Headers/Public/libwebp/cost_enc.h deleted file mode 120000 index 7005dad..0000000 --- a/Pods/Headers/Public/libwebp/cost_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/cost_enc.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/decode.h b/Pods/Headers/Public/libwebp/decode.h new file mode 120000 index 0000000..8f4be12 --- /dev/null +++ b/Pods/Headers/Public/libwebp/decode.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/decode.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/delta_palettization_enc.h b/Pods/Headers/Public/libwebp/delta_palettization_enc.h deleted file mode 120000 index cd3906d..0000000 --- a/Pods/Headers/Public/libwebp/delta_palettization_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/delta_palettization_enc.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/demux.h b/Pods/Headers/Public/libwebp/demux.h new file mode 120000 index 0000000..ceec8f5 --- /dev/null +++ b/Pods/Headers/Public/libwebp/demux.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/demux.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/dsp.h b/Pods/Headers/Public/libwebp/dsp.h deleted file mode 120000 index 1bace90..0000000 --- a/Pods/Headers/Public/libwebp/dsp.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/dsp.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/encode.h b/Pods/Headers/Public/libwebp/encode.h new file mode 120000 index 0000000..11ac057 --- /dev/null +++ b/Pods/Headers/Public/libwebp/encode.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/encode.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/endian_inl_utils.h b/Pods/Headers/Public/libwebp/endian_inl_utils.h deleted file mode 120000 index 9567247..0000000 --- a/Pods/Headers/Public/libwebp/endian_inl_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/endian_inl_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/filters_utils.h b/Pods/Headers/Public/libwebp/filters_utils.h deleted file mode 120000 index 9e8efbc..0000000 --- a/Pods/Headers/Public/libwebp/filters_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/filters_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/format_constants.h b/Pods/Headers/Public/libwebp/format_constants.h new file mode 120000 index 0000000..be70fdf --- /dev/null +++ b/Pods/Headers/Public/libwebp/format_constants.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/format_constants.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/histogram_enc.h b/Pods/Headers/Public/libwebp/histogram_enc.h deleted file mode 120000 index 7aad9f4..0000000 --- a/Pods/Headers/Public/libwebp/histogram_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/histogram_enc.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/huffman_encode_utils.h b/Pods/Headers/Public/libwebp/huffman_encode_utils.h deleted file mode 120000 index 10f66b3..0000000 --- a/Pods/Headers/Public/libwebp/huffman_encode_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/huffman_encode_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/huffman_utils.h b/Pods/Headers/Public/libwebp/huffman_utils.h deleted file mode 120000 index d167f81..0000000 --- a/Pods/Headers/Public/libwebp/huffman_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/huffman_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/lossless.h b/Pods/Headers/Public/libwebp/lossless.h deleted file mode 120000 index a3b07cf..0000000 --- a/Pods/Headers/Public/libwebp/lossless.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/lossless.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/lossless_common.h b/Pods/Headers/Public/libwebp/lossless_common.h deleted file mode 120000 index 96b0bbe..0000000 --- a/Pods/Headers/Public/libwebp/lossless_common.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/lossless_common.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/mips_macro.h b/Pods/Headers/Public/libwebp/mips_macro.h deleted file mode 120000 index da76de0..0000000 --- a/Pods/Headers/Public/libwebp/mips_macro.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/mips_macro.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/msa_macro.h b/Pods/Headers/Public/libwebp/msa_macro.h deleted file mode 120000 index 71689df..0000000 --- a/Pods/Headers/Public/libwebp/msa_macro.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/msa_macro.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/mux.h b/Pods/Headers/Public/libwebp/mux.h new file mode 120000 index 0000000..2578c2a --- /dev/null +++ b/Pods/Headers/Public/libwebp/mux.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/mux.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/mux_types.h b/Pods/Headers/Public/libwebp/mux_types.h new file mode 120000 index 0000000..ef1edce --- /dev/null +++ b/Pods/Headers/Public/libwebp/mux_types.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/mux_types.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/muxi.h b/Pods/Headers/Public/libwebp/muxi.h deleted file mode 120000 index d96d598..0000000 --- a/Pods/Headers/Public/libwebp/muxi.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/mux/muxi.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/neon.h b/Pods/Headers/Public/libwebp/neon.h deleted file mode 120000 index 8213e48..0000000 --- a/Pods/Headers/Public/libwebp/neon.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/neon.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/quant_levels_dec_utils.h b/Pods/Headers/Public/libwebp/quant_levels_dec_utils.h deleted file mode 120000 index a87d53e..0000000 --- a/Pods/Headers/Public/libwebp/quant_levels_dec_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/quant_levels_dec_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/quant_levels_utils.h b/Pods/Headers/Public/libwebp/quant_levels_utils.h deleted file mode 120000 index 662e202..0000000 --- a/Pods/Headers/Public/libwebp/quant_levels_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/quant_levels_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/random_utils.h b/Pods/Headers/Public/libwebp/random_utils.h deleted file mode 120000 index f83752e..0000000 --- a/Pods/Headers/Public/libwebp/random_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/random_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/rescaler_utils.h b/Pods/Headers/Public/libwebp/rescaler_utils.h deleted file mode 120000 index d120ed0..0000000 --- a/Pods/Headers/Public/libwebp/rescaler_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/rescaler_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/thread_utils.h b/Pods/Headers/Public/libwebp/thread_utils.h deleted file mode 120000 index 0e380e6..0000000 --- a/Pods/Headers/Public/libwebp/thread_utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/thread_utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/types.h b/Pods/Headers/Public/libwebp/types.h new file mode 120000 index 0000000..86ac06f --- /dev/null +++ b/Pods/Headers/Public/libwebp/types.h @@ -0,0 +1 @@ +../../../libwebp/src/webp/types.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/utils.h b/Pods/Headers/Public/libwebp/utils.h deleted file mode 120000 index ba04668..0000000 --- a/Pods/Headers/Public/libwebp/utils.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/utils/utils.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/vp8_dec.h b/Pods/Headers/Public/libwebp/vp8_dec.h deleted file mode 120000 index bb2863f..0000000 --- a/Pods/Headers/Public/libwebp/vp8_dec.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dec/vp8_dec.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/vp8i_dec.h b/Pods/Headers/Public/libwebp/vp8i_dec.h deleted file mode 120000 index 38bda7e..0000000 --- a/Pods/Headers/Public/libwebp/vp8i_dec.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dec/vp8i_dec.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/vp8i_enc.h b/Pods/Headers/Public/libwebp/vp8i_enc.h deleted file mode 120000 index d47bf01..0000000 --- a/Pods/Headers/Public/libwebp/vp8i_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/vp8i_enc.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/vp8li_dec.h b/Pods/Headers/Public/libwebp/vp8li_dec.h deleted file mode 120000 index 92ada24..0000000 --- a/Pods/Headers/Public/libwebp/vp8li_dec.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dec/vp8li_dec.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/vp8li_enc.h b/Pods/Headers/Public/libwebp/vp8li_enc.h deleted file mode 120000 index d6487ea..0000000 --- a/Pods/Headers/Public/libwebp/vp8li_enc.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/enc/vp8li_enc.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/decode.h b/Pods/Headers/Public/libwebp/webp/decode.h deleted file mode 120000 index cb9e6a2..0000000 --- a/Pods/Headers/Public/libwebp/webp/decode.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/decode.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/demux.h b/Pods/Headers/Public/libwebp/webp/demux.h deleted file mode 120000 index 4b1b108..0000000 --- a/Pods/Headers/Public/libwebp/webp/demux.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/demux.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/encode.h b/Pods/Headers/Public/libwebp/webp/encode.h deleted file mode 120000 index 336598a..0000000 --- a/Pods/Headers/Public/libwebp/webp/encode.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/encode.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/format_constants.h b/Pods/Headers/Public/libwebp/webp/format_constants.h deleted file mode 120000 index 2b3e467..0000000 --- a/Pods/Headers/Public/libwebp/webp/format_constants.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/format_constants.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/mux.h b/Pods/Headers/Public/libwebp/webp/mux.h deleted file mode 120000 index 03e4964..0000000 --- a/Pods/Headers/Public/libwebp/webp/mux.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/mux.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/mux_types.h b/Pods/Headers/Public/libwebp/webp/mux_types.h deleted file mode 120000 index 2076102..0000000 --- a/Pods/Headers/Public/libwebp/webp/mux_types.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/mux_types.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webp/types.h b/Pods/Headers/Public/libwebp/webp/types.h deleted file mode 120000 index e00cbb0..0000000 --- a/Pods/Headers/Public/libwebp/webp/types.h +++ /dev/null @@ -1 +0,0 @@ -../../../../libwebp/src/webp/types.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/webpi_dec.h b/Pods/Headers/Public/libwebp/webpi_dec.h deleted file mode 120000 index a1ee1f1..0000000 --- a/Pods/Headers/Public/libwebp/webpi_dec.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dec/webpi_dec.h \ No newline at end of file diff --git a/Pods/Headers/Public/libwebp/yuv.h b/Pods/Headers/Public/libwebp/yuv.h deleted file mode 120000 index eaa7fa9..0000000 --- a/Pods/Headers/Public/libwebp/yuv.h +++ /dev/null @@ -1 +0,0 @@ -../../../libwebp/src/dsp/yuv.h \ No newline at end of file diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 246042d..2e35b91 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -1,40 +1,35 @@ PODS: - - libwebp (0.6.0): - - libwebp/core (= 0.6.0) - - libwebp/dec (= 0.6.0) - - libwebp/demux (= 0.6.0) - - libwebp/dsp (= 0.6.0) - - libwebp/enc (= 0.6.0) - - libwebp/mux (= 0.6.0) - - libwebp/utils (= 0.6.0) - - libwebp/webp (= 0.6.0) - - libwebp/core (0.6.0): + - libwebp (1.1.0): + - libwebp/demux (= 1.1.0) + - libwebp/mux (= 1.1.0) + - libwebp/webp (= 1.1.0) + - libwebp/demux (1.1.0): - libwebp/webp - - libwebp/dec (0.6.0): - - libwebp/core - - libwebp/demux (0.6.0): - - libwebp/core - - libwebp/dsp (0.6.0): - - libwebp/core - - libwebp/enc (0.6.0): - - libwebp/core - - libwebp/mux (0.6.0): - - libwebp/core - - libwebp/utils (0.6.0): - - libwebp/core - - libwebp/webp (0.6.0) - - SDWebImage/Core (4.0.0) - - SDWebImage/WebP (4.0.0): - - libwebp - - SDWebImage/Core + - libwebp/mux (1.1.0): + - libwebp/demux + - libwebp/webp (1.1.0) + - SDWebImage (5.9.1): + - SDWebImage/Core (= 5.9.1) + - SDWebImage/Core (5.9.1) + - SDWebImageWebPCoder (0.6.1): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.7) DEPENDENCIES: - - SDWebImage/WebP + - SDWebImage (>= 5.9) + - SDWebImageWebPCoder + +SPEC REPOS: + trunk: + - libwebp + - SDWebImage + - SDWebImageWebPCoder SPEC CHECKSUMS: - libwebp: 1d5a07c2eb97f9c31bd5f154bb82efc0ea67c6a2 - SDWebImage: 76a6348bdc74eb5a55dd08a091ef298e56b55e41 + libwebp: 946cb3063cea9236285f7e9a8505d806d30e07f3 + SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5 + SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21 -PODFILE CHECKSUM: 0b4a18e8d55605d6055b6de28ddd6c22c5ea617c +PODFILE CHECKSUM: 65862234018995f74a645dc7f7dca4cdf9941215 -COCOAPODS: 1.0.1 +COCOAPODS: 1.9.3 diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index 8c7c1c5..5199840 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -7,949 +7,1394 @@ objects = { /* Begin PBXBuildFile section */ - 01CF3D9EE9965E7363247BEA4199F606 /* lossless_enc_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = C0476AAA1524F15BD78E0B27BDD7167E /* lossless_enc_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 030145440EBF3CCE033B89111A11161A /* SDWebImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FB4613EE0FC905FB5248D149C312DFC2 /* SDWebImage-dummy.m */; }; - 03A8CA66D7EA6166252E1DB203DA8EE9 /* yuv_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = E8E893045FACB15A3E7F8BACB56A2179 /* yuv_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 05DC8164E7F932AF38DCC301D099E741 /* near_lossless_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = D338ED8DAB214F41D35FE22F2F70D9ED /* near_lossless_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 071E36682EB08BFCD6D80A787079DD6B /* upsampling_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 41718D837EAA5F1D3BBB4DC60006C316 /* upsampling_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 07BB5453421EE5858BF73C176DF7B656 /* tree_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = AF821DF0B457FF4B923C234F4A7E1C50 /* tree_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 095D4905553D8F90B78366512A694D55 /* webpi_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D015B31E9944123CC9BAC63E47891F7 /* webpi_dec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0A27B161AF351244AF8F7FB7A791AC95 /* bit_writer_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 04D0AD8C7CE04A56EE1961218A1930A5 /* bit_writer_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0B4670D76E01840C374ABB91368B8B19 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = D550C79ED74B00036054236337232B31 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0BE38971FBFBA9D05AE5A2C6A81B39F1 /* cost_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = F73F01C41DF3DDFA6A57FAE8287E4337 /* cost_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 0DC3A1A8228A8F91311FB822114F3AA9 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 339352C0B5D785A58F2F40C3A9DB8500 /* SDImageCache.m */; }; - 0E05908EDF73911E21B79943CD40224F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CE29CF4FF5C02028C0A06EC0D2A6120 /* Foundation.framework */; }; - 10B07E886195BE557FBA22C360E6BA42 /* enc_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = 52604F8208305AC14CC070FFCC1477F8 /* enc_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 122547B22220D61DCA8985C366E5ECE5 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 531BF50508FED07C5884D105EF31EF2B /* types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 13DF82442C97416D066BB72828F5EAFC /* quant_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 189A7AB49F9A87D232247067CC3D4258 /* quant_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 15A9AC346F352BEC0A93008B4BCB7DA4 /* argb_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9E6D5AD78E69842B3D620E77B6D5512C /* argb_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 16304DB7459CE602884C6F921B6F7CB1 /* dec_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = CAC88D87B34B5F6676DE25A807EF9FD0 /* dec_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 178250CFF1CB2FEF9F21625325D26FCE /* huffman_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAD9DAA8309B8F3E0E3C5D6D37D3A7 /* huffman_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 17EF6764749DF7703907F32FE27EC530 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FA5C79A6DC9B288DE03682D61EF8F84 /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 19674A4E91F6BD1AAE2F39C27F9212A9 /* anim_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = BED86A2B541E9DF7218641E267B8FE1B /* anim_encode.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 197FCDD97986C1882E8AB47C91366B62 /* thread_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = B78F3B48B08D8BEFF8B1F7863912B573 /* thread_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 1C78A85BEC1B77EE1F0F48CE1E162538 /* bit_reader_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = E6C02AFFE197D5A81026DA7BE4E40E42 /* bit_reader_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 1D0C6E2F896D855E2D6A13073166892A /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D5C3472E5D8F4E603D4D66BF051C4101 /* UIButton+WebCache.m */; }; - 1E186C5D5131C950386CACCDA056E3C3 /* color_cache_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = CB21FA537FE1AEACE2DDAB762B57550E /* color_cache_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 1F598247F6AE0803DACAF791B232CD35 /* common_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A0A95D9E76BBB7F2096B5717F7C19A6 /* common_dec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2018D8AD570D5BB0DE270186C23ACF1F /* rescaler_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 1FF5497429B3BB2A0F55B983A3594FCE /* rescaler_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 20D99B76EE2FA08CC397C8F53399EFAA /* vp8li_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 34F2B0137AD76AE6A507D5E3A905F795 /* vp8li_enc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 231DFB22AF6C21F8F7677DF0CFADCA4F /* lossless_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = EFD848156EF77FAC4DB3228C2FD9ABF4 /* lossless_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 2BF24364742A9A8DB07AC563ABEF3821 /* yuv.h in Headers */ = {isa = PBXBuildFile; fileRef = 146CC9720D7B923F4DA0EFA0C02B86AC /* yuv.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2D61F15DD6CDB36C3B60C628505B1509 /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A33BE896F83C07BD074408A1475EEF /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2E56072B3E0E4FB10118C3FEDA32E817 /* bit_reader_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DFD6820FEAFAB43C4CFF511817518B98 /* bit_reader_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2E8B346F9337878B493307F7E4A55B22 /* dec_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 4F3728BBEF5FA7E4311802DF38EC348B /* dec_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 2FE446DAF7976412564117A74440771F /* vp8i_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B58F4E5B5D02276A53066814E94B524 /* vp8i_dec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 32B6D23EB37C0561283FFD42DBF71DC0 /* msa_macro.h in Headers */ = {isa = PBXBuildFile; fileRef = 62ED24F22812AAE5F17EC3515C7B07B5 /* msa_macro.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3308F7ED6A3241827595B7C46FBCCCB8 /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F6817F129F248B26709FF1FACACB3F1B /* SDWebImageDownloaderOperation.m */; }; - 34DD7504166CCE07253FEFA65C63AF1D /* dec.c in Sources */ = {isa = PBXBuildFile; fileRef = F05BDEE1D6FE9B73E198CF508089CF6A /* dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 384F622FBFD74EE3BB38E6995EB34669 /* webp_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 5038D75A2F0E1B08B278CCFE2D753B42 /* webp_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 3A58F3C09A66F315200586E8A82F1B8E /* quant_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 4586E938EFAF02D88CF835FC6B02B371 /* quant_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 3AF19589172E23FA6FFE6725FA1C155C /* filters_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = E53F34B3A22FBF443D71AE2EA3EF3B8B /* filters_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3BB68661B1FC282927009791BAC602FC /* rescaler_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D382756D49126C8879D0F173B2A136C /* rescaler_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 3C58BF5E9E62E35D5A84CF97DDB080C9 /* Pods-BAWKWebView-WebP-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 991780B5D6746B152A725F9F025D1BDA /* Pods-BAWKWebView-WebP-dummy.m */; }; - 3DAD2CEF8944EC89DD6208233065FEBC /* filters_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = C6097A7BC5AD677EADFF5D32164D2254 /* filters_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 3EA8EE5C7E4ADDDC879C4B26DF2FF091 /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = F7DE141E810176A48EF1F87DB1871154 /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3FDA4E7EE8A4B1A312E779032F2CAAF5 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 635A4BD1CEF7E623C71F97A54BFC3616 /* ImageIO.framework */; }; - 41423EE8E33A344DB2173DEC60D99E64 /* huffman_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = A429697AC37504BA2A4EB42B29D782AE /* huffman_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 42449017B412957A9A0AD06C0B7C2E10 /* enc_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 3EDFE2ED55510BEAB58FF8071C305091 /* enc_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4434B00162E276B3312791980ACC694F /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 7533C70B69DB2C1E51452D44250C2083 /* utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4456E2D460F706375E2FB38D43716FF9 /* alpha_processing_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = A37CCF97524596901920DBA9A3015CB7 /* alpha_processing_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 456E9F576506B7D751FE36007CBCC7FB /* enc_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = 23805FB6FEDC8941E4CEBB83D9FC9B85 /* enc_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 45C8C768AF42C31F53BE0A8598891094 /* frame_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = F20A8DA5F0CF034E1B0D64BD6FE69FC0 /* frame_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4925650DB5719C49FE6CAC0276AD0811 /* SDImageCacheConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = AB76C0C252D5C80C00ED2F1E3F85D06D /* SDImageCacheConfig.m */; }; - 4931CDB25957ED3B2E76FB49BE693C45 /* rescaler_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DB5308B72FB4C93850FBA59103F6183 /* rescaler_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 49558CC1148F9C0926A84BAD76709D56 /* mux_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 94AB76933441E7D98010BCE1A68F9192 /* mux_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4A4D22F2F983A2C9F44FD5D6E1E556FC /* yuv_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 768465670623F75542DD8B2237C47917 /* yuv_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4BD38E193F2DC2E7EE7A44B650F0C95B /* lossless_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 7B907599F625013154ABE72A5D8CAE14 /* lossless_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4C9ADE63641408213BB88FA5DF4DC8A1 /* vp8i_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E9050392CA9C1DB374D4DB0B19BBACC /* vp8i_enc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4CACF4BC0142176659AD440C6A1FCE73 /* quant_levels_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 76EFAE2D57D909A3DC8F94FB83EE25E3 /* quant_levels_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4D55E9742F187AE0FABCCFF5AF3E8126 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 56441565BFB2BA0078F6383393FA14BD /* utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4D66BD16CE5977C81FBD68E2F567BA7E /* format_constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A1AEDD4D6CE0234EA47A9A0D9A3E4A2 /* format_constants.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4D66D2C59A3418F6E6CF33007DB5557E /* encode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E1EE565C4B417FED86AD12844B48937 /* encode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4E5331CCCF0B6E326BE2F8851E3154F9 /* enc_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 616E799AC9183EFE82F9A398E57273D6 /* enc_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4E8B6D725A5B06D62D675AF985D15021 /* lossless_enc_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9BCD0D26A417326FEA42AB6009D05344 /* lossless_enc_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 4ECDE63D104846DE9C2CF62B8E0BF912 /* SDWebImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 7541F858B15FDCB24B7F35E657947D33 /* SDWebImageDecoder.m */; }; - 4FD1BF41B8F11978A557B2CAB5EFDABE /* rescaler_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 8978776383E9C9DBEF2C387C5FD10CFA /* rescaler_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 5027062026C24D17E10777772A79DBB3 /* endian_inl_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = E814A16CC5832448B34DEBAFEBA038A3 /* endian_inl_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 523DF275271AECE6B49A5D8D51948C5B /* lossless.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DECF924EDD277C948133751B5EC9C6E /* lossless.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 524FEA883297A3D6CF7703908F3EE2FE /* picture_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = CB62B1B588F319B60D0B4AE68FD72774 /* picture_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 52B939E27245847773CD4D08F7B4313E /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 993BCFE033C6E3D2E962620B184B7FA1 /* NSData+ImageContentType.m */; }; - 530B312298B521C533FCD8F09BC97ECA /* SDWebImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AE3EFD4958A608F90B0BE1730498928 /* SDWebImageDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5341C423EA5F960F1C304D961709C1D6 /* NSImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A698B17D4A618AF77F21F115599FA0F /* NSImage+WebCache.m */; }; - 5372CC22397AB8A1C278A8A9374700E6 /* lossless.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BA03AD0A344385FD4371A7049309CA /* lossless.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 541CD2E3D5B9C423CC11E7D05F1E3387 /* buffer_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E689CA2AECAC018C014ABBBD5CC4434 /* buffer_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 54B156398B1C41BE141BB6F8E45AC150 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = BAD5AE968131E1EF2A84FEA1705A06DA /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 552F11E1FE546C4D981FB5A4D9EE9E82 /* dec_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = F8EF0FD5910DDFE44B7B0C2EEBFD3D20 /* dec_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 556FCC73482CEDD2ECB862158C93B4C8 /* idec_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 31D3AE61A99A7CBBA417A1EF6EDB23FC /* idec_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 576361C68FAA2E7917142D50B931311A /* filters.c in Sources */ = {isa = PBXBuildFile; fileRef = 75A8F849CD87952D8A6014163D20A16A /* filters.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 57B11B5A4A20379C159A1D8B5E8795AC /* frame_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = B75BE342AB4E0CBA7E1E370C7D1E6066 /* frame_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 5853F985A0EF8FA559562BEB69EA1676 /* cost_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = AF3D593EFD9D540B4EA0A86538C74D71 /* cost_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 586D44338F17A807AB0DBE8AB054876E /* rescaler_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = E094215356DD4E0C796FF030A5B6C4B7 /* rescaler_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 5B80C17040B9A779762FC86950982B5D /* thread_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 300804CC1C47DCADA733F47EEAE58E42 /* thread_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5C121251655B711E54998130AFD43983 /* bit_reader_inl_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1A5AC41A5B9A7F4F8F3D54DF1A11B4 /* bit_reader_inl_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5C37C6B83D1B70CFAEB769216CBAE8FB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CE29CF4FF5C02028C0A06EC0D2A6120 /* Foundation.framework */; }; - 5E196E7E37AE26E094B32E15E0CA4AD4 /* NSImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 96B1A250CAD0F990FF7FA07BC3F489CC /* NSImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5F9AB0E236C0B8626983AF13E7FDED1F /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = B60D283A1491E38E530541E0E6F6A534 /* SDWebImagePrefetcher.m */; }; - 60B48A94F890CF100835646A15B12715 /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B053BF8762763D45A322C072AF0F940E /* SDWebImageManager.m */; }; - 64F9DBBD1D57C6F8FD20C9A31EBAD36C /* lossless_enc_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = AC092801836BE501CE5D1430194412BB /* lossless_enc_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 6536E9FF3714557E7A1BA34C10752900 /* dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 96CDEAF3F8C8DCB78C3507C88BD1CBDD /* dsp.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 666475067148173B549ABA53B39664A1 /* alpha_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = BAEDB1C378E6A55D0BE217E9FF79E125 /* alpha_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 668AA30C15A3ED3865208EEB87C3720C /* random_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DCFF2DCAE34CE7E4D92CE9C7366E97 /* random_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6753BEDAE266647E738A547D20C5CDEC /* config_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = D1F6422437DE4FDF6D687A53902030DF /* config_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 69ABB00ECBF5B4599FC6A5E3C80AE35B /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = AF4CB436A1905894FFF226874B234E52 /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6A6FA4C326453999D2E23E5550B99083 /* muxread.c in Sources */ = {isa = PBXBuildFile; fileRef = 231B2C3AC7C410843C1AE0777CC2FEB6 /* muxread.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 6D00B5661D6A0CBFE820F7BF6D375976 /* alphai_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = DFB11E49EADA83FC3535B17967EA57E5 /* alphai_dec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6F9065932DBA28FF60BADDED1EEB0C2C /* rescaler_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = B82868D4CF37761788C57E478FE98880 /* rescaler_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 6FC3FB3C443A655D6EC7E43587CB6204 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 92F1FE8CA757CC3D7E16149A98464295 /* UIImageView+HighlightedWebCache.m */; }; - 702D2F21769D4D65464396E40BBE8BAF /* upsampling.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A9C7CED37BE90E6C2F5F6358E9A7984 /* upsampling.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 71D1FAB0D40EDB160EFA4A448E91F2C2 /* quant_levels_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 63020B60D2C9FC34306AC8E7C82C9116 /* quant_levels_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 72F281A2CA796C4CF7C8FA54838021C1 /* upsampling_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = A3B977DB3CD08004F1ED08E08A61D42C /* upsampling_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 74B269F9AC4453A5FDC99FC4ED87D05E /* enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 373FE07527F74CF6418844EF3D73C61C /* enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 7825B2061A301D3FEF0ED395FDD13376 /* lossless_enc_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = ED381B1B005427FE1A42700263176914 /* lossless_enc_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 793C0B05270E72F56D237CE9DA3EBDE3 /* anim_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 511621F6C95356FA35A0732AB9C8471C /* anim_decode.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 79F065451B0393135996F4780713FE61 /* alpha_processing_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B00680366E3EA7E93925A84077868D /* alpha_processing_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 7A8A01A8C3F0F9C875AA6D80AD009834 /* dec_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = ECA83D82F08ED3D5A3234D79C4DEC298 /* dec_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 7B30E0F573D1EBF13827900EF5835AE3 /* cost.c in Sources */ = {isa = PBXBuildFile; fileRef = 276CCC3883E4B31EB6BB9EB32AF6CFFA /* cost.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 7CD7DD98075DDDDE2F0B05100BA99185 /* lossless_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 024ECB129F48BFB81041D67EEAD1DB38 /* lossless_common.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7D46498AC02DFCA4C92BC30EC6BFEFCD /* tree_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = A417768449EA1B267BCC899E9CDA199C /* tree_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 7DA4D17DA9A9CB80CD124409AB08F21E /* predictor_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 93C6EA48352BA7397DE40A9D3FC57609 /* predictor_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 7F19780C33E35CD60D26B4201FC10996 /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 82CEBA7D38FE8FBAC58EE4AF0A57AFA4 /* decode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7F89454692AFB206BDF96F574E0B6217 /* color_cache_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = F25106E1CBAC5EBEBD6AFE53C38DD7A2 /* color_cache_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7F97DF22CDE2C0D0FFCA758FB2D05E5F /* yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = 551217A993D070E428227F487341110E /* yuv.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 80C1B1C729B77788A2F952C306C77B0C /* histogram_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 6D4608A7510ED3BAF1DCC57A8D3C19DD /* histogram_enc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 80ED1FD30DC8A01A46DBFB84CBF12FC9 /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = 797CCACA1FF334B81AC60A447F0DBA79 /* SDWebImageCompat.m */; }; - 811059F9BE51E53E55414B95B0BA47F5 /* lossless_enc_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 668D284887BD84066B67AB8D4C53E2C3 /* lossless_enc_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 841A23B8E1F461EAE3457D82553F174A /* backward_references_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = CD037CC5E1FC47EC82B4749A4EDD5B15 /* backward_references_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 854F232D3DD36361372F3518380265FD /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 103CA74F155DBF4F4261A80F6F750D48 /* UIView+WebCacheOperation.m */; }; - 865F4022BA6999B58F56AB340D4A0275 /* libwebp-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B6E3372E9CAECFED9042C69C0ECC9B7D /* libwebp-dummy.m */; }; - 86D45BCBEFF8F5B7C342E9837DAC9F47 /* webp_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DFBC70F76B6EEFD8E9310BC4997F45A /* webp_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 87A3521EEF2EB2F9A7DECC323E668226 /* demux.c in Sources */ = {isa = PBXBuildFile; fileRef = 0A0FFC18FA3530DC3EED10EC3E25841A /* demux.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 88F767A0D7D3BF7F40BC9236455D437C /* huffman_encode_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C265B12DACF50DDD5ED7DE64D08C06B /* huffman_encode_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 897DD4B7D8CB1EABF43C735D8449E28C /* huffman_encode_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = E384D0E6C5EE52559BB411F9A0507DB3 /* huffman_encode_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 8B9E1C2AD50CF8EA6FF38EC9F51D22A9 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 62A8D117E6CD9448B247F71253369976 /* alpha_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 8EB868EABCB1D844BBFB2E4A4A47C559 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0388506281CFBCACF326B7A9E30178A6 /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9046F10CF5D795BB9EBDB9D7183CF6A2 /* UIView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 208BE0C034E1DDD6DBFC8A3616E1C531 /* UIView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 91405C5B85DC2FCBFA2FFBDC4AEF8F45 /* animi.h in Headers */ = {isa = PBXBuildFile; fileRef = 575279E6EB877E78818659DC8B8EF163 /* animi.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 932FAAAC99E212FDB48CFD715ACBA195 /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = BDC6F1EDF90E47B2A267CBA185FA2AC8 /* SDWebImageDownloader.m */; }; - 943FD7D10CF13D1E92F16D4589807959 /* analysis_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = A6907917A14351DA9EE12DD00F190A4B /* analysis_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 946830271A52B7DEFDE815417B830C28 /* neon.h in Headers */ = {isa = PBXBuildFile; fileRef = A64880B6650EFEF31BA6FFD685BD6336 /* neon.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 94729876798C4307378E91E3B0127503 /* random_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = A202AAC4C8E98D65D0BD7F4EA8DD5587 /* random_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 94CE56D26BBAF6298F664E8D53DDEDB9 /* iterator_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AFB3D60C26D76087CFF0B10517880D /* iterator_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 9545551D99110135D09F35202B039AC5 /* vp8l_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = E4B62DF08D0017EFD1397CA69FC31728 /* vp8l_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 95AD051C4B6CB4D0EE5D937098398EB5 /* cost_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = F7670DBA6B12AF94EE4EC6836F6B5FD7 /* cost_enc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 960EE063376FEDD5BC8CC9DAA7C06922 /* vp8_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = F765E2246CE0E6CE15C6F9352E62F5DF /* vp8_dec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9634BF376C33E804351958AA4A8F2C35 /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = C69C05EA665406970B3F3FE259C85457 /* cpu.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 983E627BDABE1F2D6894B22AB54A02A0 /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 8573E5FFF3999AC4CD1261C6E01CC65E /* SDImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 99D3D70C9DE6834976BF0467004F4F66 /* dec_clip_tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECD30A295759333C72E68CBC8DA0A1C /* dec_clip_tables.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 99EDAAD1CE117B19531E5F46366288B2 /* histogram_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C1C934A7F0E5A033012E3B421743036 /* histogram_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 9A41DD3CA26AC00C2CD95029720BE833 /* vp8l_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 6F1A7A427E65B94BA17EE92199885DE3 /* vp8l_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 9A60BC61105F874564CF481A3FD30B74 /* delta_palettization_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = A215E046AB052D89704AD143C424C6AF /* delta_palettization_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 9A63CD70F2F69A79AE0BFEDFE9F50B7F /* demux.h in Headers */ = {isa = PBXBuildFile; fileRef = B1ABFE7140FE1ABD314AD9A97E1F91F1 /* demux.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9BCE6946D929F74D12DD41F53759AF1F /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4871F6C58E55217D10955C03B5C511E2 /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9F1CA954BE7A6C1B84E4BBC2FD3BFD99 /* muxedit.c in Sources */ = {isa = PBXBuildFile; fileRef = 5BA3CBC2350133C20AA4A2E24EBBA672 /* muxedit.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - 9FB7626E15050A979FA210C94C367905 /* muxinternal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9DACF4F3FA941723E0343D07718FA80 /* muxinternal.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A0066DA1A1FBDC137BCFDCEC0832AD09 /* lossless_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D8773D101F94C4AC16510F8AC97BB65 /* lossless_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A0294FB0CD4D24607CF53C81E0656F22 /* picture_tools_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 052DB1D40AD9EEFC1F0D3BD096167DFA /* picture_tools_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A12AF81C603BA849A5CB05351085525C /* syntax_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F52BF281F3D298C5DCA1027FD8CC759 /* syntax_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A209F727815C972FD2A45AB7BEAC808A /* enc_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 328D7FBF646C01B71BD7D597A60756B0 /* enc_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A350A19AF7E6E7CBA40963972924E976 /* filters_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D5DD007CAC0B662476ECD3315BA0DE /* filters_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A519CCD29786C1668C0C84A478B84247 /* UIView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8E44FC00416EA4763BD37016000A4A /* UIView+WebCache.m */; }; - A58A4444DDCC48217E0415286224FB5B /* mips_macro.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B4AE3EA5395CB7073DF8F42D5DEB6C2 /* mips_macro.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A7200895D03D5E3CB3E8456CE3255049 /* quant_levels_dec_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ED36195C66ABF5658D777F6B645BB11 /* quant_levels_dec_utils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A799F57F01F851C7826ABBB7B925FC4C /* UIImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A14B550C2A8A3798C6996D1C39E35B6 /* UIImage+WebP.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A80F99106C388614D9DE653154F602E2 /* upsampling_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = F375518518A0506826C246E90CD100AB /* upsampling_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A832CA161D153313960551432059F944 /* filters_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = A6F6448B21C37A0CFC1111D5F97D46BB /* filters_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A8826B00E26DCD1C761D13E5209BE82F /* alpha_processing_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = D2CC26F0959A37DA471F1E448111A793 /* alpha_processing_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A922B14567B3A64B5342F9BA79BC2B14 /* argb_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 50FB840B590B4374D733ED71CFFE2795 /* argb_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A9A42A52AAED41828D0CB7028EAF96E5 /* upsampling_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = F2E9F537965331CDABA2D3930215A123 /* upsampling_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - A9BEBCE5385060F7A5387D219EF4900A /* filter_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 0231121C915B17518BC7904985B3AB58 /* filter_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - AA31C03B80CF7B795C772BB2E86D187F /* quant_levels_dec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C76E93FF974EDFDAB0F986B17E44B7CA /* quant_levels_dec_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - B1B1E6D702D05BF22CE4A989F56E07D8 /* mux.h in Headers */ = {isa = PBXBuildFile; fileRef = 49660BEDAA566C8693E20282A3F8DD2D /* mux.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B2123B94BD159808B958C3097C4AE7D1 /* yuv_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = FFBEFE612DDE08FECB0A38AC11CFDC65 /* yuv_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - B4752F9E2070CB4B185ADF538FF8AFD6 /* io_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 7159B700027C2E55475CD79B6EB4F7E8 /* io_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - B570CB6DB3A4D583786D5D6F0DCE22A5 /* rescaler.c in Sources */ = {isa = PBXBuildFile; fileRef = 6653CFE2F496F33977E841E6081907F2 /* rescaler.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - B6B1DD4331198D8B9EB2D7173D964EDC /* vp8li_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = F06B41EB1517F712C1BE8F7625102CA5 /* vp8li_dec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BA303AC78DD2F2FC4AFD2C201312ED11 /* argb.c in Sources */ = {isa = PBXBuildFile; fileRef = 65E51A17AAC90C3F6D2B8A4439095455 /* argb.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - BBBF5B3FECBE86195C5E9D83BEF2E9DC /* picture_csp_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = D5FA2D02464DD4A65CF2E80F4B6C9180 /* picture_csp_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - BC09EC2869D77D118902846BD42C1E1C /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 44AAD21219953FB66BB2CBFFA5E0D02A /* UIImageView+WebCache.m */; }; - C315EB4F16C60823D16DF2F491C2EDB3 /* rescaler_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = DD48E681F598C2826B4FBB4B36CC46CA /* rescaler_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - C4244162D3E794ABF4D6D716246C6478 /* lossless_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 45022404D6FA3F5A1AB05E26B0996769 /* lossless_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - C47662F42A8AFD089C3D77E1B0F8C9E8 /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 96C3B2B1349FB5BA91971F37B47A1A50 /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C4AFDDF03BCF9DC266320A0648F16ED0 /* delta_palettization_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 0501062747DF50ABDF95881FF4450E96 /* delta_palettization_enc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CBC5763636D2E4F3D15AB3855246D827 /* backward_references_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A820C9586B5D047627D09F99756A668 /* backward_references_enc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D18327E5BAFFBA6877A0367A8B7DC340 /* SDImageCacheConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 39A7E4C24006A7AB46A1704E784F10FA /* SDImageCacheConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D6DB5DBFA7C57FF43248EFDF538621AD /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C773770BA63E6D809D56EE6932CA759 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D91E21A92C5F8CACF1375D70C5055B97 /* token_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 50DBE1FF96163239B49D9945C62230A3 /* token_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - D9285098BFAFC2A8CFF7A94F95B6CF9B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CE29CF4FF5C02028C0A06EC0D2A6120 /* Foundation.framework */; }; - D9B22EC448A940B277B365C8B292E828 /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = A98E660E2FAC8EE420CB48B95AFE1FAA /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D9E09E1B3D5FA05128AF87E1165A077E /* lossless_enc_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 1044C6C9147747629C5A8CCB8ED5A94B /* lossless_enc_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - DDC00491ABF7D2FF861B3DE561116F9B /* vp8_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 6146B50AB836D198B07F92CBFF27F16C /* vp8_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - E08164D65676AE602E593B61024E8752 /* common_sse2.h in Headers */ = {isa = PBXBuildFile; fileRef = 956D21517B420AB4AD8864E879BE0513 /* common_sse2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E177D6271986D3B423442E9BAADEC7AE /* dec_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5F13947BA1CC99B85FAE2A5029A7E0D1 /* dec_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - E25052B7048E1AFB94766D6027185205 /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = B1F5D9B9A3031F0976C63E1C2C2A93CC /* UIImage+GIF.m */; }; - E45EBC9EA7CA26786C924319FDB72EC3 /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 634DADD2C57B8F44DFFC6F71C9CE7438 /* UIImage+MultiFormat.m */; }; - E5B2B8BD64C7EFEF2DE571099300942C /* lossless_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 40697FA767824DC00D42B15F251526F0 /* lossless_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - E72A2D19ED9DDC745772CDADA20D9345 /* muxi.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FA0292C933A228AF15A82AEEF148469 /* muxi.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E76F79BD0538E8F9CF6EA43D90D12DA9 /* dec_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5B0C538EC10EEA8B39D3868A1213B6A0 /* dec_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - E835019F5E4FE9C176B2F62CC54107C3 /* alpha_processing.c in Sources */ = {isa = PBXBuildFile; fileRef = CF9A2EBC31A738ED93A5D7E2DB4338E8 /* alpha_processing.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - EBF49AEDEB9D1D22DD68975274B30C81 /* filters_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = A1FA76313E48A0C5EEEB3AE2ECAEE0B1 /* filters_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - ED53A5815DBDFADDE07E36B720D4F46D /* cost_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = 25FBEEF91BB61CA112652CECA03A3929 /* cost_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - ED5D923DE079AEB45FCC88E0CE4A890E /* filters_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = A18E39F77E4D2A85C1C9241830AF749A /* filters_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - EDE3A90DCD01712555ECB0D09BE325F8 /* UIImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = 9098D0B5647E129B3DB16CB32FA48EB5 /* UIImage+WebP.m */; }; - F1A877793B2BF25180ED8A4BFE13FFBE /* enc_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = F1018EC0C8920BBC5D5084576B9C7D63 /* enc_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - F34899DAC8CDB83A1CAA13C7B4B1E12B /* picture_rescale_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = CDD1D2CF00D57E04E69B18783E9C7CE8 /* picture_rescale_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - F535F3029BDE5E00FE755E56DBE0F62D /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF0FAD2DFB69A2201A5FE2B4541D9CB /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F7842E697CF754A77E0093178B7D2F0C /* picture_psnr_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = AC8828C8FC8859C3DF8E60751F90B20C /* picture_psnr_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - F8164DAF5B417C58D8E1C95E12118A4D /* cost_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 004BE760467DF39A207D21A452DB83FC /* cost_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - F8B7444652DBA14C5E18C553C641D245 /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = F8CD6B8AE72082529B0F0BFA15C1082B /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FBA67B1EB74122D7495F4AE61800B495 /* bit_writer_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = D2223C785D56C3C8BE5AC3755E78651C /* bit_writer_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - FE393CB77FD2EF6E3432D07495E47744 /* alpha_processing_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = 3BEF0676AE3CE1AEA70EF6D8DF98E3FE /* alpha_processing_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; - FE9B4F4AFC850ECE6AE4F8911605A70B /* enc_avx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 967DAE3CCD5520E6076C0F516A1F1947 /* enc_avx2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 00019CCAA3EBAB3F8539E6183612530B /* SDDeviceHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = B38DE92A0C5EB539760189D2CDE29A1B /* SDDeviceHelper.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 00EBCA1C52BDA2BAD2EFF56CFC38BB6B /* format_constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 07639BEEF0C64623EFABA8277CD0DAC3 /* format_constants.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 01EEAAAE410356BC64AF4CED471DA9D6 /* UIImage+ExtendedCacheData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51856D2B46FD9DD64A53377DE0CAAD43 /* UIImage+ExtendedCacheData.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 028EBFD3BDD333D1FC466C51AF274395 /* huffman_encode_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 638B8EBB10F02A66F176A72990E664D9 /* huffman_encode_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 02D7E2B52239A310FE2F9E172E268793 /* dec_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 41F39803C444C7C9DE0EB0B404B816A0 /* dec_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 03A3C427BCEAEB0168C5B1DA5B9A0B86 /* SDAnimatedImagePlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AE0D280D017F1372720FBB48213ED82 /* SDAnimatedImagePlayer.m */; }; + 03ECE44E890B0E77E66141A886FF7384 /* SDWebImageDownloaderConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 5559EE269536D40564DDA2E3C4EDEE51 /* SDWebImageDownloaderConfig.m */; }; + 06001FD93320CD1B989AE9EFA5C0F396 /* random_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 701D7C8A50E500BDA3C223A795FBAB4F /* random_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 0650AA299D9E18C22F3D7978B8D13F0E /* UIImage+Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = 8FEB9687617CC701191071B437EB401E /* UIImage+Transform.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 06943F195425D70618781500ECA5D13A /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = D63A7ED6B9FD93C31690C65EFE8C6240 /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 0784D52FFF9FF94B5628050CDA88862E /* backward_references_cost_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04156A1494B350F1118EF4E2D4E0D86F /* backward_references_cost_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 084F36480B7CF5E32993077A0B5A31F4 /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 058919D50C3BB7E6A85AB707380BF835 /* NSData+ImageContentType.m */; }; + 098E8CC8DF32416A428381F52273D2A6 /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = F9147CF43D6C46D070F3EFE5E478AC15 /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 09BB6FF47D5A11F537E308ED12029DF8 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D31ABA2898D63DDF256F2DE7DEE008D /* SDImageCache.m */; }; + 0A702DA7DBB0598F2A8D0EA31A425C64 /* bit_writer_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 712E86C301578212ED0BF401E84D2626 /* bit_writer_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 0ADFB8408D908E0C8F0A263AF44E663B /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = A12BA1BA784BD44315BE95ED319CF777 /* SDWebImageDownloader.m */; }; + 0BC931185BC5EA4B6E0B6AE750229CF6 /* webp_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 2F8106CE13DB175CBF5F0F9CFE701820 /* webp_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 0E312B5257A85597AE14A7B58AB149DE /* UIImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = B9837BB7B02C1D7AE129699575101D90 /* UIImage+WebP.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 0EAAA0E3EDF492EA9072C71CEB81AD7A /* bit_writer_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 1FF6AAEE8547B36A282E33BA79C2AC7D /* bit_writer_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 10C93244A795BA758378F709D2E64E2D /* dec.c in Sources */ = {isa = PBXBuildFile; fileRef = CED09E0AF970EAA30254705AB2C13320 /* dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 128CB82581C01598C1E2F282C3EF6E6E /* SDAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = E95C3D59659B8B104F7E0B1C2E36CF3E /* SDAnimatedImage.m */; }; + 13DD0ED8B2550861225C063394042F40 /* SDImageWebPCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 428E5AB5460842BEABBFA0E83D4746ED /* SDImageWebPCoder.m */; }; + 144BEE51D1565EA55832A06723119666 /* quant_levels_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 848919187EAE1845DE108F91C4788D92 /* quant_levels_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 14C549A762DA24F3F10E5722D8D40FFD /* UIView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CD29D8335CBBF074A4BD3A12C588FC2 /* UIView+WebCache.m */; }; + 14E576329E0DD1AA7F16E7E5C629C447 /* SDImageCoderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 872B2DAA2839A5F0DC73F4BBEF5F30BA /* SDImageCoderHelper.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 1666EEFBA88DF2529D5AC364D0E1E376 /* cost_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 654142E9D3FD4A5C8FBD0347C57A1AE8 /* cost_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 16F055F044196FBCAB05C2274E5925D3 /* filters.c in Sources */ = {isa = PBXBuildFile; fileRef = FAE5C886CC0D22024F0903EF88475013 /* filters.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 170F97CD69BD6031D937C92D34FD4706 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 35EF36A799B84547B6952F09332F0FF2 /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 19558CF36F8291F10C60620A48DDA431 /* quant_levels_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = D9578E54949E867487C1EBB6A8A431A0 /* quant_levels_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 1A296D9023756DF9DF7E2977BE422FB2 /* SDImageCoderHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 425A9FDE527245E1F5D3F6BF5A29DF7D /* SDImageCoderHelper.m */; }; + 1B7FDF02A13B654CBEDB846B2D82B85B /* SDWebImageDownloaderRequestModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 267E323578FFDAFDC4B9A235178BC8C9 /* SDWebImageDownloaderRequestModifier.m */; }; + 1C492DD17AE0B343F869E7947AB90AC2 /* SDImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0105B67959BA81D85FD761F2B3C75F42 /* SDImageLoader.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 1C67C8CE2ABF17A444CD161132FDA871 /* rescaler_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 6D0A65137436FD41880D7F4CAB18DFA8 /* rescaler_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 1D684B565C58B9807F83660880EFC634 /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = E45404B8A6BE99A0CDA859B6A4A5ED51 /* decode.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 1DCCEA0FF50522086331A713487A4EF6 /* predictor_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 7F28BE05E4A9070D7550FDD260425207 /* predictor_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 1E06190F195923FEB645A405D6DC1BCF /* SDImageCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E106551C0153474DAA8600167310529 /* SDImageCoder.m */; }; + 2184532A10E7502EA915D91369DFAC3C /* SDAsyncBlockOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = E509325FF13F871273F75FF6402298A6 /* SDAsyncBlockOperation.m */; }; + 240C1DE6C392B6B83ADCF49E7E64F9F0 /* vp8l_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 9DE787876603CEC024673C3CCBD3C459 /* vp8l_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 24D5A665091087501AA9B1F6AD200331 /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D7B599AEF5906119593C4415A569A965 /* UIView+WebCacheOperation.m */; }; + 252A8CD5EF71DFA598A0584EB3B8A382 /* filter_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = C7E9447EC067DCAE1E837578E5687E6A /* filter_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 265D49A837950E796D67DF1A7BA105FE /* SDWebImageCacheKeyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = C938DF53E5F06FBD446E965954D5C3FA /* SDWebImageCacheKeyFilter.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 26DDBD2684FE4D8C192BF32194D36314 /* animi.h in Headers */ = {isa = PBXBuildFile; fileRef = 994B15BA78A7B1D18BA237F47D68CDE2 /* animi.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 26E3DD206F42A74D6DB08F757B22A6DB /* SDWebImageWebPCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 41406E32711CC8BC3A0191642D644777 /* SDWebImageWebPCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 2700A36B8534C45316DAB554E8498A28 /* SDDiskCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B49025D3D96BD270CB7C8CEAAF4975DF /* SDDiskCache.m */; }; + 27BD40A62B5DBCB190894006CB9BDA98 /* histogram_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 03C65F1F8A146656C1BAD0831392C99F /* histogram_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 27D5F96CDA76CA186352155CF0366CF3 /* muxread.c in Sources */ = {isa = PBXBuildFile; fileRef = FDBA1FBD2EC501DD5987933648A0A20E /* muxread.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 284EF2C9155791325EE03FEF211F11F6 /* SDImageWebPCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 3905E209BA104742A8F6F82F5CBAF9FD /* SDImageWebPCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 293B9392E2E0687D5CD3A77E69A5095A /* NSButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 79807143CF24A8A9E12257EF52E7C798 /* NSButton+WebCache.m */; }; + 29C5E1AF8AE16F1F32B96B212AC91C37 /* UIColor+SDHexString.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A1C22ECB48BA441CEA6ACE4764BCC6B /* UIColor+SDHexString.m */; }; + 2C373E626BA963FEE80693959C52DDAE /* quant_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 02165E73AD8E97F2C6A08329E76E3293 /* quant_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 2C46F977881E5684788823D4FC3B817C /* huffman_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C43E79CCA96219D7EFF19311AA16AC0D /* huffman_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 2C6A5195F45DEB1592DBB39BDB68B86D /* cost_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = B8A88D36C6F7CB80D68D253C5F2CA4A6 /* cost_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 2D34C9F476A929DBBCD3244403B8794C /* alpha_processing_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 860D3DC7DD98E18840EF00D42BDA2EB5 /* alpha_processing_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 2D81205FCD584D8A3DA373D966F3FAAF /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = A6551F5FD3B67506E8C6EF85AD5BB8E6 /* utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 2DB99E87328AB7C1FD3162AA94B0D3E7 /* NSButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A66863CBA74AEFBE89EE13AF4523883D /* NSButton+WebCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 2E4249141E2265AED28451EAE499B014 /* mux_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A64F761ADE9AC0F94436DE531412FEA /* mux_types.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 2ECB81FC72C7BB5040F10C021225ADED /* SDInternalMacros.m in Sources */ = {isa = PBXBuildFile; fileRef = A0C0C862382A0C71B7EE93D640AB18DF /* SDInternalMacros.m */; }; + 2FEBC0F3A58CD98F759E592B3916FEF0 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 86318FA7B1E0D4A05494806421454FC1 /* UIImage+ForceDecode.m */; }; + 3063231F3293E15061B3225DDE746FE6 /* SDWebImageCacheKeyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3867EF74B8F253E696B2D7791AE8422D /* SDWebImageCacheKeyFilter.m */; }; + 306DEF2B74C5BF2440D7DA9C6B9AF46B /* vp8i_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = F79A3BE8868384BDB3B3B6EF21408138 /* vp8i_dec.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 318F3F2D56C5B3C21D3B5E50F48EC6DE /* common_sse2.h in Headers */ = {isa = PBXBuildFile; fileRef = 2858359302BE791217CFCF3BA0EB069A /* common_sse2.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 31D6F0AEA41367B9D0E70E48C7E8F535 /* cost.c in Sources */ = {isa = PBXBuildFile; fileRef = ECEC083D29CFE502B6B2AF42C5466252 /* cost.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 32390D08501D28CB4546DF9527BE8542 /* histogram_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 045CA2B6F87FF1CFC2231A4211907BB6 /* histogram_enc.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 327DF3A45AD02490D6D3DFCC3A3A676C /* SDImageCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 823CD61606E64DE09EA8B0A7098EA69C /* SDImageCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 335B7A12B7EC0BD569580A3DE383D24D /* SDImageCodersManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CC2FA4E892843BA74D4D27D049D571C3 /* SDImageCodersManager.m */; }; + 33E0068183DD999ACC130323A1D563FA /* muxinternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ED8BE2AA578E3F99B031456DC1701A7 /* muxinternal.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 345E2C203E2D12E7E3546F2E8344A79B /* SDImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17BA5A569562ECFD2A051820DA38E7F7 /* SDImageLoader.m */; }; + 34D5336F3566955F80268EB214EAF86A /* upsampling_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = DD05C335753E2D65F7CC565D7D63D969 /* upsampling_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 35627D1149BB1E238A76EA293DFDE121 /* filters_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 2ACA7BF5F31AECC38E208E04B30680E9 /* filters_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 35DD6329D6839FF25AB703A9D7106550 /* vp8i_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5AB59DDD3B1D6CCEB33D6FF7085E34 /* vp8i_enc.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 361C64C99F2AB7479F201E6B74BB80C5 /* rescaler.c in Sources */ = {isa = PBXBuildFile; fileRef = 656D61FCFDECEC913336AE3EC9FB1392 /* rescaler.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 3694FBE54A9B05A19E577B49FD4800C5 /* Pods-BAWKWebView-WebP-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9434D5B1AC6A6FAB61E7EF65643DCD26 /* Pods-BAWKWebView-WebP-dummy.m */; }; + 3723CC5D9030ACD6B36711488589F8C5 /* rescaler_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 65CB4EE6E95D8B8A51CCD29243CE160B /* rescaler_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 38E225F83FB50A828F51F93E59069CF9 /* SDImageIOAnimatedCoderInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 506A4792D0DC3B1F6FB10F4220672D38 /* SDImageIOAnimatedCoderInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 3A9FAA5BD20B70FCB5966FD24C6152F4 /* SDImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 58268CB6ACE2615B68EAA512BDEF11A0 /* SDImageFrame.m */; }; + 3B202DB775F482F8C829FEBD7B83C154 /* SDWebImageDownloaderDecryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 71A34BAA26BE9C8BD3AC4C0C805E46BE /* SDWebImageDownloaderDecryptor.m */; }; + 3BD5CC5DE7B0FE1C6430E449E5FAD0BE /* lossless_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 056EF0342200211C063CBD984201A1AE /* lossless_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 3C9CFF7308EE1AB818109BDA90DB5500 /* lossless.c in Sources */ = {isa = PBXBuildFile; fileRef = A82F773962BB8FBC3A376473872CA8C7 /* lossless.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 3CC5752379425A7307AF5979D47E480B /* alphai_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = B593D791E9C7497ABD44153D85AF387F /* alphai_dec.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 3D2FEFBFF5B0E97FB3648C24FB791766 /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CDB71EB09859840923789536E53BE7D9 /* UIButton+WebCache.m */; }; + 3DA9427AF38AE205761D1D5222EB91C0 /* SDGraphicsImageRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = DF34878FC57FE08E0BAAD5C093634924 /* SDGraphicsImageRenderer.m */; }; + 3F5DDF6016B2CA35F391A79CC8B307FA /* iterator_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = A96E0BF839FBB5FA5E4881EFF0075F33 /* iterator_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 40D7050787F5656A10BC33473E3ED386 /* anim_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 3ED7D18833F77609CBC54363FAB15CD2 /* anim_decode.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 40D912D8612346E0BB4E2F3A7A242F58 /* yuv_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = 6DE71D55940622EAAB38B3B370F2A0D1 /* yuv_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4275C5D87D76EEB5E649A7FC3D2451A6 /* dec_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = FF2D0954C4DA8B111AB8F16716837067 /* dec_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 428323F5F727A7745DB9A0B99AF770B9 /* SDImageCachesManagerOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 54A7E4B4B358362B2206810B679131CD /* SDImageCachesManagerOperation.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 4294331616A3709CB1CE62326F456813 /* filters_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = E329EDA5C820E6C28A241D5FBCE65901 /* filters_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 43DB91F62A8B94C30D674DDACA0A26C3 /* mips_macro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEE5E4C5A9240ABFF8E9AA325A6657D /* mips_macro.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 446F9E8C1FF9D0E5B5679FF2CA418898 /* SDImageCodersManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F79B4188E77B515662B7AFB0CA514CC /* SDImageCodersManager.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 44C8DEEE4C2383275CB675F29D45C761 /* SDGraphicsImageRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = E2E2B34A277FBE73FD15136A1770B428 /* SDGraphicsImageRenderer.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 44D77CC53C0A24DFC8FB76B5FA05E5C1 /* yuv_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 992148CEC0C7E43DA82A3A83A236F0A1 /* yuv_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 454308F281F806DEB35D19FAD2B02B9E /* SDWebImageOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DFDB1065284F4475C6F6EF376BB6B1B /* SDWebImageOperation.m */; }; + 45A7004B4C4029FAB1EE07DD2D57D4C1 /* demux.c in Sources */ = {isa = PBXBuildFile; fileRef = BD3D11F35240310344FF338A07E7DB2C /* demux.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 45B725D59EEA0992270B943C42E3FA17 /* UIImage+MemoryCacheCost.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AE73858BDED6C9AC98D4EBC5611303A /* UIImage+MemoryCacheCost.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 4670045ED9E12409423D29E8C8BB46C2 /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = A424BB66D5D816AD67494E1E23655B56 /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 46D3037DBF6800978C2926590F172915 /* thread_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 30073E7033BC9AEFE8C6A9CFFCC74494 /* thread_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 472BDF20693240A7BBC7279CA137A73E /* SDAnimatedImageRep.h in Headers */ = {isa = PBXBuildFile; fileRef = 20E63DC1859B1BEBD6B5C88D50E6DB63 /* SDAnimatedImageRep.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 47948B0FA1D66D170049BDFF4F42F543 /* SDWebImageDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F96B3D5B2A23A9D07A38B914BFF63ED /* SDWebImageDefine.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 4810AEBF932187A3F1A94DFB6E028CB9 /* SDAnimatedImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 489F588BD9F7399173BB64441A80C26C /* SDAnimatedImageView+WebCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 49A8369D005F7438DC9E3796597CC8C1 /* filters_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 795E7361C397B82F7AF9B0522C423631 /* filters_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4A902A0B2167B7EFF593834F41B2EC0C /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = EA8E08701909B2FA6765439E729A14A7 /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 4AD4B383BF61AC474E0D4905A386A538 /* enc_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 81134A2B51EF1E9769C25C86E7CDA557 /* enc_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4B6BC1CD79F54D7B6E4EF93E60F24050 /* upsampling_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 021D6DA8E40455C4CF949957C38D72E8 /* upsampling_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4BFBD7E157BAA9C550CFEBFDBF83D633 /* yuv_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 427094677819A231C25413A893205961 /* yuv_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4C3912D9D711FFA2E8310EC6AD47EE62 /* NSImage+Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2082EB5ACA3EA02E0A7CFA82300A3A /* NSImage+Compatibility.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 4E2E631DAE70D9ADC5E05F1747055785 /* SDDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = CB54E44D409AF3B6897F1A1C204B9A91 /* SDDisplayLink.m */; }; + 4E3C1DE072E6C5336A03F8CC1F856A90 /* quant_levels_dec_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 448F86FD2D8BD5FCF05BFE6FB4DB4E72 /* quant_levels_dec_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 4EDBB4AAEEF26534BCF67340B60B9DC8 /* SDDeviceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = EC580A1C3D9E603F717A38067FFC907D /* SDDeviceHelper.m */; }; + 4EE2FB609D448D4820A415BEDF34F4F0 /* rescaler_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 449A368A273C009024AD2920345A6FC8 /* rescaler_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4F57B54C1285473282B715BEFA437827 /* muxedit.c in Sources */ = {isa = PBXBuildFile; fileRef = A33C05440153918258AFE8535AF4FB2D /* muxedit.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 4FECEDD0BEA6FBAF73160BA477508E26 /* common_sse41.h in Headers */ = {isa = PBXBuildFile; fileRef = 456B2194AF3E69711C33F97E515C973D /* common_sse41.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 5070DC5447295C7BE9412DC271EDED7B /* rescaler_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D993B8A1462C2729568F605D819ADAC /* rescaler_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 50BA43C8B4C7278FA449490F5ACEA40C /* SDmetamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 2628A10E591F7247B058A04ABEDEF0CE /* SDmetamacros.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 5100E42A38F6DA8DC0E8A3E25C5170BB /* alpha_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = EE0E634CDAE78D3986030EEA35DF6B03 /* alpha_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 511B2B2E911994B978C25D5FA3CD524B /* SDWebImageDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = 814C58D710276564466EA2D9FB423DDF /* SDWebImageDefine.m */; }; + 5376CD57545524F6266E36C055A7C0BD /* SDWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3317E991B6F00C4F95662015DB6E2FCC /* SDWeakProxy.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 53D5A906B201B5F4A53C894D88FF09FC /* SDWebImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7A17FA6FBE2F5A9D9C17F8464D63E4 /* SDWebImage-dummy.m */; }; + 53F80EABDB1A385F25DFA6710C51B600 /* UIImage+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C19F1FAB46731FA0A30FC7B7ACD97A /* UIImage+Transform.m */; }; + 55371E0911F21A2F708C6A746DE8C708 /* SDImageAWebPCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 00F48B414A782B5F543042D44B95E317 /* SDImageAWebPCoder.m */; }; + 55E9296400238C9E2506DE36EE4509E1 /* quant_levels_dec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = D913111E9E80427C23F96BB2A490A944 /* quant_levels_dec_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 565CB8B0FDE1675DA4A5E7B90A7F8E0F /* yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = A77486D18FF1AD89325C58576B8D30F3 /* yuv.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 57427279AA2D60422A3E2A128C18DDD9 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 5044CCABE41EA5742CEAFCFD4FE4D8BF /* utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 58A8084F0B525B5F00655FCD63877483 /* UIImage+Metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = CA42508944B98472636D44EDCB93717B /* UIImage+Metadata.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 58F4C5FFF7F1ADBD86EF4D72D10060F9 /* SDImageCacheConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 94337390ACE4D0E155B249C628EDCAC2 /* SDImageCacheConfig.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 5938E9D9A7E09FC96186D2651278B68C /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = BB9BD2E7755FDAC06FE953BA39521E7F /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 599AEB5E944F8E4CD7AD7766DBC5B9AD /* SDAnimatedImagePlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B31F8F79ECA5CD63A02E88FC3C4AE24 /* SDAnimatedImagePlayer.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 59EF4A1BF48F1375C1A16F1F67C4E1CB /* analysis_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = E799994A459804CFCBEE4EB30271D6AE /* analysis_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 5A17505C0F707D934A954ED86C875E74 /* lossless_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = BB4E3E20E058939EF27C1234AF7731DB /* lossless_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 5A7F854F64CE15676E36E4D1B701D3F3 /* enc.c in Sources */ = {isa = PBXBuildFile; fileRef = D4BF5D0BBED0BE006C5EA8F37E33FDDE /* enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 5AC5B35F7A1F8D81E38D71BA2C5BFBC4 /* SDAssociatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 789FAB4C6021BED2E076268995F11151 /* SDAssociatedObject.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 5B5B0D74898CA73CA5043A47CEA879FD /* filters_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 43C1AA5165AB3874E0E0FB1C4DFEA136 /* filters_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 5BE6FD1C2E1A7FD1DB259769EACBB324 /* backward_references_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 7A94D5041EFB1BE739B10F32B9109C89 /* backward_references_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 5CB41A59A4D3FA5BC111747983E0AE46 /* SDImageGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = 485AB5CDC42B78091D3B799BD9C13E13 /* SDImageGraphics.m */; }; + 5D311F299039B1501541239CC1AED43B /* vp8li_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BD2F2695D78B34BE61DCB7A3F49506 /* vp8li_dec.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 5F2E78FACD107E4277E2649CD6E886A9 /* dec_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = EA95257254528720C049397BAA70ABBD /* dec_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 608320766ED3066F8080E29D8BE0E1C6 /* SDFileAttributeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = CB33AB9A72465E1C5149610903F8EF0F /* SDFileAttributeHelper.m */; }; + 615BB2AA2A00B6D84EDCA5CDF4B9AA00 /* enc_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = B742B21BE7A1B51123CB7B8F0D762BC3 /* enc_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 6239F4687453A13853E0205B8D8C45A5 /* dec_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = 3EA01B4E1C500B7E694B9F6B14EC23CD /* dec_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 62DB9078449931A43F8B801A9EA12E22 /* enc_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = ECFE44B3A484160231C7DCBB78E10CE4 /* enc_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 6309AEB3667A67218B3D12AC247BE6E2 /* filters_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 615CE109EAED55DA7628F0689DF864FE /* filters_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 6311BC38C34B313676ABB3DC409CDEB6 /* lossless.h in Headers */ = {isa = PBXBuildFile; fileRef = 23246A10E766EC00C04B342BE1B2EAE5 /* lossless.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 68F51B1C47032D4C1E214D42B31D4336 /* SDWebImageDownloaderConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 407E2FC06BDC8AFECEBAB10C9DBC32C0 /* SDWebImageDownloaderConfig.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 68FB4C6A0AA72F66547FDF27B0099E96 /* libwebp-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = A362D2AC9D8BFEDFCF02EF5B5872C6E5 /* libwebp-dummy.m */; }; + 69C754CBBC23A9D99FF051A2C963CD59 /* UIImage+Metadata.m in Sources */ = {isa = PBXBuildFile; fileRef = EF209152A5EACB0EEF8DDF68465DDE18 /* UIImage+Metadata.m */; }; + 6A22FA3944743E3967A46D599F7ACBA7 /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = E41CD925C690C57ACA44FC4DE0FDAFB3 /* SDWebImagePrefetcher.m */; }; + 6A622015A2048536175D6CF33A2CC984 /* color_cache_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 940477999AB354DCFFD92C4F5BA913F6 /* color_cache_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 6AB6478F87ED222B02CE0A81708BF7A3 /* enc_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 500DABB4E012E698A10866644EE65801 /* enc_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 6B27BE8C3E5E28F3B309307E87B99329 /* SDAssociatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = F2A8E69F923031BCB7A079DF9189ABC0 /* SDAssociatedObject.m */; }; + 6B990DFF59699A54E9F4ADACB4DF432D /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = C2CFF5784D76CB5B7AB3A53C09EAE183 /* SDWebImageCompat.m */; }; + 6EC86A31DE9C7210CD8965CCE49A6342 /* SDWebImageError.m in Sources */ = {isa = PBXBuildFile; fileRef = FC94FDD53FA4237C8FF66857C7C55A4D /* SDWebImageError.m */; }; + 6F7962FF9B90836AFDA94BB5EA55E3CA /* quant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3E248E8EC54055C830B8E877ACBC2A /* quant.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 7031CFA5FD7EC7C8E5EFAF8325D2C8ED /* SDWebImageDownloaderRequestModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 508B8F61FDF5D858802ECF6ADF1F3F18 /* SDWebImageDownloaderRequestModifier.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 7264640A393F58A97339B5300E572445 /* lossless_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5FC5F4CB280162DF1BA990E6F1D59A15 /* lossless_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 732A7A9BBC1BFCF4AEE656BE2B97C21A /* encode.h in Headers */ = {isa = PBXBuildFile; fileRef = AC453575A9B1479737BE92C85D58F404 /* encode.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 73430F6B3C647B6A1C59F79E156A4637 /* enc_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = 698EE24AFF693B12323714B8F3E60F2A /* enc_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 74141DC8EBA403034EA6A22A0C20E181 /* quant_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 569E3EE14BE61EFCE9CCF52FFD3AF14A /* quant_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 74EAE5276D0EF19E1CF97B70E9965FB4 /* SDWebImageDownloaderDecryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0F94F43CC16C0A6CD89D1644B7B531 /* SDWebImageDownloaderDecryptor.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 7562C56441C73094C1EA5388B8382C1B /* muxi.h in Headers */ = {isa = PBXBuildFile; fileRef = C16E25503E607EAC5050032A3830F6D2 /* muxi.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 757EBD77D300E8FAF251BF89058A0063 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 91859BBA5BDFE60D3DA2DC2E4B07B871 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 759335CEF832A5F72222213C7AC7FFEA /* SDAsyncBlockOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 253652EB511794ED195C5EFB6B721D90 /* SDAsyncBlockOperation.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 787AE202E71EF711783ABDEAA6D52204 /* SDImageAPNGCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 739D9DE8A7D3B46680C3121BE283EE7C /* SDImageAPNGCoder.m */; }; + 78F67829A483CBE2715BC2C121EE2DA8 /* huffman_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 56E472CD3A69CCDECE520B239A3A67A2 /* huffman_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 79259121E54F7CFBA05BEC2278E94E56 /* random_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 832C487AEE86FA8381A769717FDBB4F3 /* random_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 7C2BFE7B58492F7EF2AC17967CCC2598 /* lossless_enc_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = A29B321ED4B750E9C205F80ECF0389D9 /* lossless_enc_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 7D098C8F2EA09FB3E2C09EBD602D28DB /* bit_reader_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 735FEBD5D6DC34B3EC46716ABC469DFD /* bit_reader_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 80ACED1ED78BFACD53EB4937DBDE9D1D /* rescaler_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 111F431982285E95FC80611A41DC1856 /* rescaler_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 80B7FBA8291E76D74A651249A0E211FC /* SDMemoryCache.m in Sources */ = {isa = PBXBuildFile; fileRef = AC51FA1F692785C8AB7A3AFA7908DB94 /* SDMemoryCache.m */; }; + 80E571D803509B44DD64950C26FB25F5 /* vp8l_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = AF2334E42FFFF6958CEB654321BA0461 /* vp8l_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 8385EA1E9A6EBC7120147A8E8128264B /* SDImageHEICCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A01D3A9B19518A970B60DAE7C31D9F /* SDImageHEICCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 8487E616E339280CA226EFA20E1095A4 /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 429891BE1A900CF163AD30A1313B2777 /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 84A3C303615E7E868E93032E261D7B36 /* lossless_enc_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = CBCA557985E0BA75F6D2308F192699A6 /* lossless_enc_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 8585FF0A4866CC89299A9F74DD9B6F14 /* upsampling_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = DA801E0CF44B487078180A7F6260A58C /* upsampling_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 85A8F825144DCAFA48EFBDD5CCD33659 /* cost_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = F52DC798FA646192C280EE311B9E300F /* cost_enc.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 8642D5924008D5431108F6D6AD77A008 /* buffer_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 47912CE175BA212563F5D2C38E18E770 /* buffer_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 867DB4166B5BC907107EB47AC10E6EC8 /* demux.h in Headers */ = {isa = PBXBuildFile; fileRef = 337AC89CD023E7066FF8D7B9B780DA6C /* demux.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 88EC2492778A65D49A56165E5DE416FF /* SDImageIOCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = D011FB8E98EF4CE59E212257B2EFF494 /* SDImageIOCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 8AACC5E42AFD75008FD59B8088FEF018 /* rescaler_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = 51269C442DA0D95DA54206819DF3A296 /* rescaler_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 8AE193AD518D868F8A380BFBA29EE940 /* SDImageIOCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = CAA4FCA7109FB564EE03E5EE9F72D395 /* SDImageIOCoder.m */; }; + 8BC5223AB347EDAADA0DC451439FC68E /* endian_inl_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = D4939C05C953084D0ECE3CCFC994412F /* endian_inl_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 8CB39B392ABF658314F209F7EC25352E /* SDImageLoadersManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FBDF1C7952EDD15269EBAB8550413C8E /* SDImageLoadersManager.m */; }; + 8D1BA441E2DAFB442FE3F2AAE448BACC /* picture_psnr_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 688DD3B6CC9E0F4AB549ABCE81C2DCA2 /* picture_psnr_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 8E27EC136C6FBA3867CE73898926070E /* SDImageAWebPCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 972FAFE56E1FEAEA7DCE4D590D66A35B /* SDImageAWebPCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 8E647828E4C169D55AAC86DB40DFF31C /* SDAnimatedImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 93E219E2DB402589E9D5BCAD9108B7BA /* SDAnimatedImageView+WebCache.m */; }; + 90CECDD9ED75F3F5DA4B25278BF37E23 /* frame_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 3A079F9CEB212334376FB3C441D82BE0 /* frame_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 90CEE202DA4A807D35EC6CD5D60BC729 /* picture_csp_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 630A9AD278AB2DE8C97390C65F3C0BB0 /* picture_csp_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 915D24E1F505FF3C580B62195F0BB2CB /* config_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 18946164FE3C17C5082F7F66C71371D5 /* config_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 9190EFE6D38E12D26CB9BC5C3A7AE8EA /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = EAF09AE6AD92259E3C4B2F2DDCF70E84 /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 92E4B15C6FF94A4FAA4A17621199703B /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = C743217EEF2C96947C8741E20115BB2A /* SDImageTransformer.m */; }; + 93147163DFC9AD7D994B83BB638828B9 /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = BC514E97874756CF723CD9C227D25821 /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 93C5B4B4C296A7F9AC4199D4D3E26C4F /* lossless_enc_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A678CA2F4F8850CC4ECA54B50733D3 /* lossless_enc_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 94294AA3E54A3AF30E4A868AE7747150 /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = BED4187FF922BD66BCF1836AA1840EA9 /* cpu.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 94FAADD7872A3D01DF60BC64898DDF72 /* picture_rescale_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = B3C8D6506A238A98A7074048E747A2AF /* picture_rescale_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 96BACC16C970F0B48B5B6F038BE861E3 /* token_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = EA75FD90AB06ACF4D46F3DD6825D4346 /* token_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 97799C73F159687FD7F213D33EE91CDB /* upsampling_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 32B6946A8B223A1202C8EAA0B911D68A /* upsampling_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 9881C8FF40D8F62F2B371FB262AA00FD /* SDWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 27DE23B07C2353E26C4FCDF59F3792C7 /* SDWeakProxy.m */; }; + 98C1BE9DD6E7F49A6239E6E2767508D1 /* SDWebImageWebPCoder-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9635A36CA0F476722A547A3420248CBA /* SDWebImageWebPCoder-dummy.m */; }; + 998389497E9FD2964EB1277B4831AFF8 /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 72CA495D5F2AAF4CFA8AD5175F80CF99 /* UIImageView+WebCache.m */; }; + 999AA04824D684C98E2EB6D1F2EF8A5F /* thread_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = A423723451A23CE7DD4B14D159DB7FD1 /* thread_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 999F1C702C6FE02406BBCFDC8534599F /* tree_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 685F396B8F514708AC61D24B0DD8FFB4 /* tree_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 9B12F156E1BEB77000D4E23081EC1F29 /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A8484176A5674E26F28594CC1E80D4AF /* SDImageCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9B2685DFE7C04FCD68207E3C6502301A /* upsampling_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = B74692ED6CE9609D0A5083FF249F1E32 /* upsampling_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 9B36EF7583EDEEFC684944DC2A86EE9D /* SDAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 62BCD13F736C59657BD2DFD3964B8D91 /* SDAnimatedImageView.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9B75E88E9B4FB2A3CE425C8CAB240D11 /* lossless_enc_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = F1FBD5606CB448B2D7C30B285887CF15 /* lossless_enc_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 9B8365733D88EDAC8AAB34412130B375 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A93B4AA0DA7D7938A6485826D49FD41 /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9D1A197EF0EE35A7DD4696BBB9459DE1 /* near_lossless_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 098095AB88EF3BBC12F7B0E7B2A99EE8 /* near_lossless_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + 9D5B7A2D161D6078DA4EB07849DDD72E /* SDImageGIFCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = D799A2DCFD3EBBB0BD25AF5BA2C58D2E /* SDImageGIFCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9D95FF90F4AE28C5DC99E498A09431C0 /* backward_references_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = B5341C81FD8164D34464E4C65A71A38F /* backward_references_enc.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9F43FE8C406984BF732D1AF01279BEEB /* vp8_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 23BEAA7669175EA15905F5DBB3DAE507 /* vp8_dec.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9F517EF334E49A9C29254BDB13F00FB2 /* SDImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FCFAF804FD8E30B51E6BC6B0192F53C /* SDImageFrame.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 9FE633D2FDB9D167609C6D9952BB688B /* rescaler_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = A93499F8924850040794B9CC25EDAD0D /* rescaler_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + A00B584A73A9FF6D08B9CC8E6FD90AFB /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 68653626F07B23B7CC4054D2A8E4173F /* UIImage+GIF.m */; }; + A19AA07C7DB4989CB3E0A6423F39F82B /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B8D9A85717B35BC24D75C80BB55B132 /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Project, ); }; }; + A1FCCFFB79A9FF9721AE7F0FDDBA732A /* vp8_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8AF4E628BE5962EA00B460FEFA228C9C /* vp8_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + A3C94056341DFA2A8A77147BF8CCD625 /* NSBezierPath+SDRoundedCorners.h in Headers */ = {isa = PBXBuildFile; fileRef = 67CBDFCB3248D1813A8DC65CC2AFF8E2 /* NSBezierPath+SDRoundedCorners.h */; settings = {ATTRIBUTES = (Project, ); }; }; + A4869E512A2621C326F66BC81CC2C95F /* alpha_processing_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 8F4647DFCC892C1D9184B9AFB0F19492 /* alpha_processing_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + A5ABDBAA0AF273222B55136436EDB26A /* UIImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = C4F89B11717564BD917713BF9BC43AB7 /* UIImage+WebP.m */; }; + A5C2E63BDEE0B253240BD476588A7841 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E008E4991A1E60B40604A264A9686E6 /* UIImageView+HighlightedWebCache.m */; }; + A5D3221BC3DADBEC08F49B502492A235 /* dec_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 7F9A1C6869ED094429C45D4DAE165123 /* dec_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + A6747B6E6D35FB0709A0E58F686A88A5 /* SDWebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B226A7EF5F755ED0576120E2D1380626 /* SDWebImage.h */; settings = {ATTRIBUTES = (Project, ); }; }; + A8745A14D9ECB939925A6FDDEFAD32F7 /* common_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 193FA3D95479A07735B769BC5A15CE4C /* common_dec.h */; settings = {ATTRIBUTES = (Project, ); }; }; + A94A79AE097EB3C0F8D1E5292152B9EF /* ssim_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 63A3A0E64307760192B0C76157066418 /* ssim_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + A9A2B1F25A522AFA441E04FFBC819682 /* bit_reader_inl_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = E97780AAE3F369BAB592180F7B1A8DF1 /* bit_reader_inl_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + ACB0B17031678E25550EDA948B61549F /* yuv_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = BA5CE2BFC24586CFF94E9473F7FFBD38 /* yuv_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + AD18C75F2CD24CEE016811DC7841078A /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = ADAC297FA7DEA3659613BA7575B100BE /* alpha_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + AE867D075484C878A384AAB20F6A719D /* anim_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = B8C6F69E2D8557D9E9CDFB861B34732E /* anim_encode.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + B07B0193B545AD11E0A9971DCDB97EDB /* UIImage+MemoryCacheCost.m in Sources */ = {isa = PBXBuildFile; fileRef = 67E3099D24C9F8F960DAA3F9336AB51D /* UIImage+MemoryCacheCost.m */; }; + B284E952224927D138B8A67AABA0A312 /* NSBezierPath+SDRoundedCorners.m in Sources */ = {isa = PBXBuildFile; fileRef = 43FE039B6426CD1DAB0C957EA30BB49C /* NSBezierPath+SDRoundedCorners.m */; }; + B3B004B8167E0A2AB77D5F6236EEAA6B /* huffman_encode_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 0A1F1783097070142C03654C2D9A3C41 /* huffman_encode_utils.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + B57742214BEE9AEBEBAD8AEA7EFCDB0D /* NSImage+Compatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = C01A1C5580029DC7C0BED6D098FF3E1A /* NSImage+Compatibility.m */; }; + B6ACC838DBDD8F64CBD50144750FB8F5 /* alpha_processing_sse41.c in Sources */ = {isa = PBXBuildFile; fileRef = 0640F13E13DB87517026FD9BDFE5CD13 /* alpha_processing_sse41.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + B83B6A071701DB7EF8D4D65EFB9EEC1B /* UIImage+ExtendedCacheData.m in Sources */ = {isa = PBXBuildFile; fileRef = 419D930EA5419E8E842286174ABA0238 /* UIImage+ExtendedCacheData.m */; }; + B92DB014092D3F8C4C168D2408447080 /* SDImageCachesManagerOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 92F9A018826DD5779801B17CA5060FB3 /* SDImageCachesManagerOperation.m */; }; + B9B27B8CD19BDA6896C5CBDE86CB744F /* cost_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 2E5F25723C0BD6A706AFD3EA15D15BF5 /* cost_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + BCC61FA7954E11291493E726363811AA /* dec_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 28F7EB0DF852DEFC4204A37EE5A542DC /* dec_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + BD581F43E1B1B9B45DD3DC6C4B709539 /* UIView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3386112FE1F10338CA81856A145904F6 /* UIView+WebCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + BD83DCDB2BACC262DC641340F62DBA95 /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 82CA3EA44F49C93A74F44B16D19577D1 /* SDWebImageDownloaderOperation.m */; }; + BDCEC74D09CA629346B8CDB4180B1BCF /* SDInternalMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E079B403D6D0B0B1040713F0111C3C4 /* SDInternalMacros.h */; settings = {ATTRIBUTES = (Project, ); }; }; + BF3C49F54B5EF7B66D446BFCF77FA2CA /* syntax_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 46DD0765B822D133DDB17B312055CA5F /* syntax_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + C04B6C0FD689A2129B95A7A8323543DB /* lossless_enc_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = B3DB6A2E81FFBF74DBD8E7E5B74A8BC2 /* lossless_enc_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + C29913785660B86873CCD667E5FF33E5 /* alpha_processing_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 10506352AD2E9695188E2AD3071F2E9E /* alpha_processing_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + C30CC261B75B92063A8E43BF9F019C47 /* SDImageCachesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 02932AE728BD3BB2B6921AA6C856FC7F /* SDImageCachesManager.m */; }; + C4A781EEFE89058B7265C6F721CA91AB /* SDWebImageOptionsProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = D642896A970E6F98AC0ED4FF58C04E62 /* SDWebImageOptionsProcessor.h */; settings = {ATTRIBUTES = (Project, ); }; }; + C5DD40727C7A2E24D4BA2A25C4C96C6D /* lossless_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 6079682185772D3181714CA23438B786 /* lossless_common.h */; settings = {ATTRIBUTES = (Project, ); }; }; + C72B383906D549B11D0F88B8218700A6 /* bit_reader_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 055791E259E9A880A9FEBE27FCF1A5B0 /* bit_reader_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + C75E911116AAB82905EC4995BA1093FA /* lossless_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 13D82D365FF6AA187D4393E7FB963EFF /* lossless_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + CA3ACF41F93F7558F479945F22129798 /* cost_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 70EE27FDF304C3D3BFD902BA0BB74EFA /* cost_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + CB0A87BC83D3DE363D02FDF133471DAC /* mux.h in Headers */ = {isa = PBXBuildFile; fileRef = E9C5F9C107727038DABE5155C40A6DF9 /* mux.h */; settings = {ATTRIBUTES = (Project, ); }; }; + CBE82899693869558FA85BB43917C7A3 /* frame_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8631AA3705B14FC06725870AF2098876 /* frame_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + CD2245532B231B39146928B82B664800 /* SDWebImageIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F7BC976A23406357C4A5255EE32593A /* SDWebImageIndicator.m */; }; + CD40EC89E9242EF2196E318E81133DCA /* SDWebImageTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 54E143A88200B1660DFCA6625E72E8E2 /* SDWebImageTransition.h */; settings = {ATTRIBUTES = (Project, ); }; }; + CD4DF4C53C61172849734EBB76490FF5 /* tree_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = D9CF7967267CDBA3CF9C803A10B55AB0 /* tree_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + CF015D6109D2B386D6A1F1F18CB0C9C3 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E2300C531A10C40A97208327AB5DC21 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Project, ); }; }; + CF683DA00CD75267D269199BEF91C27F /* color_cache_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 97CE87763CA381D1914A8265E43A1B22 /* color_cache_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + CFB4EFA7B2ADC28AD13CFFCA011596D7 /* SDImageAPNGCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5C0062A1DC0B03BC8F473CD1618A1D /* SDImageAPNGCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + D0B658E2ECD721230D2277001F13CA47 /* dec_clip_tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 932C94E12692B0133BFA50C1E4182514 /* dec_clip_tables.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + D19DEAF9E517C735C418D11C83A2E71A /* lossless_enc_mips32.c in Sources */ = {isa = PBXBuildFile; fileRef = 1D0FF6E435829B311BBFD6D9F9168438 /* lossless_enc_mips32.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + D29A03BBC9B95E677C2F51345F344088 /* SDMemoryCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5371A4704EAE384A037A199286A12179 /* SDMemoryCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + D2C0E6530E3AFBD6C079E42472F33800 /* SDDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = F782112C8359584641C16072010AAB1E /* SDDisplayLink.h */; settings = {ATTRIBUTES = (Project, ); }; }; + D39D2F4755A5BF6EA102F9CFE16E9D31 /* ssim.c in Sources */ = {isa = PBXBuildFile; fileRef = FEFFFA7EC311308C06795D55656F0F3B /* ssim.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + D45D3AEB9410A3EFF7DC52DDE5435CA8 /* SDWebImageCacheSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C16F211D473D298BCC97742917ECED6 /* SDWebImageCacheSerializer.m */; }; + D522C8B6C7C223E80D6BAB4BDDB5F69A /* SDFileAttributeHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 1BCA75CADACD909A6275041B19CC7820 /* SDFileAttributeHelper.h */; settings = {ATTRIBUTES = (Project, ); }; }; + D792F513C9F9D858D8614BC0F1515F89 /* lossless_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = C054F83487804DD694545FB162D9C8F6 /* lossless_msa.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + D7E39007ADC52A887967F78C6E5C61D9 /* SDDiskCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 65670E4F13A9198B3245543188ACEDA1 /* SDDiskCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; + DA1748D1A95CFB09630C1B1318088350 /* SDAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A97B2ADFC6CB29FBB1A3F3A486D16DA5 /* SDAnimatedImageView.m */; }; + DA765D01151CB2601493C20FAB272A99 /* SDImageGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = D174A9FBCEED3C22F04B413FC72B81C8 /* SDImageGraphics.h */; settings = {ATTRIBUTES = (Project, ); }; }; + DAB56CA3BF77D40CED6C19224D5E1794 /* SDImageCacheConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 301CF252102ADA342E9A50987DC2A19B /* SDImageCacheConfig.m */; }; + DABA0F52668EAA175AB2F8944C9A628C /* vp8li_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = 39687BD8B8DF046A1089BA37F9121765 /* vp8li_enc.h */; settings = {ATTRIBUTES = (Project, ); }; }; + DBB7C38541245840971728B2671146FF /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FB74AF230A96B1FADD4F5C974FC25B3 /* SDWebImageManager.m */; }; + DD54A07F91E6DFF248C0E09223D7A807 /* picture_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = C331E73CB9956C3A47EB050C5284E1E9 /* picture_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + DD557D39A3EBAFC72775EA5F2BE578F7 /* filters_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DDD2A637F3C7D13EB6130690B6A7092 /* filters_utils.h */; settings = {ATTRIBUTES = (Project, ); }; }; + DEB4DFFD793B2BC08438B39ADEC23C63 /* webpi_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = CBE40E7F8EFCE740B3AF6D3999F1E81B /* webpi_dec.h */; settings = {ATTRIBUTES = (Project, ); }; }; + DF091238315C2F3AE424E99745B03CB2 /* SDWebImageDownloaderResponseModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C2D2602A8B094EAAB8FEB8DD82E1F63 /* SDWebImageDownloaderResponseModifier.m */; }; + E1682D3F6C8B6D6AF0C845759DD95DF4 /* alpha_processing.c in Sources */ = {isa = PBXBuildFile; fileRef = 546DF3CB4540BC175F7327D57AA7BBE5 /* alpha_processing.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + E34D536EB38161183AC71F5403278288 /* SDWebImageDownloaderResponseModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B6AAD4D936A94AC0AFF1FEBF82EAC3E /* SDWebImageDownloaderResponseModifier.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E3E2BD738E7E9A105525F691CE53FDBF /* UIColor+SDHexString.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1A3DBB2558E7AC29121FD7B595615E /* UIColor+SDHexString.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E42A7D1C9E99A24203A295E85B978938 /* SDAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D29438AB0D95887FAD693FAABE7388CF /* SDAnimatedImage.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E51D30B8AB319E61C437334D13FC859F /* SDWebImageOptionsProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4354B9C8DAFE2F7C7CBD62D3357C16EF /* SDWebImageOptionsProcessor.m */; }; + E636DC65C5F701A11A1CCE6568863500 /* msa_macro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A56CC7629A574539DE00913DA9F9D51 /* msa_macro.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E6AD01F3482B5DC39109FDDC4FA258F5 /* SDWebImageTransitionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = AD97B9DD9CA1701117DD0FC372F425E7 /* SDWebImageTransitionInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E7165ACE4E69370B6C21B814BE564B38 /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C13E1629109271CE3801E01A800D6F /* UIImage+MultiFormat.m */; }; + E89678023EB928D8162BFC0B1DCF31D3 /* SDWebImageCacheSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 92C73DC7D95687D39A422F70CF1124FB /* SDWebImageCacheSerializer.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E8BC0E3B26159ED4D6462E921A5A69D9 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 45EE10EC4201C8A94253286EF5007E86 /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Project, ); }; }; + E8C96FF99FC6A03A737CD3202588C7D5 /* SDImageCachesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9AEAA3FC9BE6932536E22F299CC238E /* SDImageCachesManager.h */; settings = {ATTRIBUTES = (Project, ); }; }; + EA53B89AAC16CE584E6F5DD11D500FC8 /* SDImageCacheDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = AB452B4FF9F52D40EBDFBAFDE0FB1BB2 /* SDImageCacheDefine.m */; }; + EC357E611B3D5756D5863C4408BE6CE2 /* SDWebImageError.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A82461EAF937CBCE7F6715D2ABA1F86 /* SDWebImageError.h */; settings = {ATTRIBUTES = (Project, ); }; }; + EC553BCBFB97C4258734F55BD5F41ADE /* idec_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 64425064EF8E31B7ABB836B8B5C3ADCE /* idec_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + EC96457528865F0AB1500DA7A7DF652C /* neon.h in Headers */ = {isa = PBXBuildFile; fileRef = B94EC22AFAC1FCF25AA0D40822F47EFB /* neon.h */; settings = {ATTRIBUTES = (Project, ); }; }; + EDCD926B479A4DD0BCFFFA5B36BE2460 /* SDImageIOAnimatedCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = F2931E61306D7CF23EF5996F09A2A47E /* SDImageIOAnimatedCoder.m */; }; + EEA633264D70EB517CBC27CCA09DCA3E /* enc_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F5C18C6A44C78E0C17488AE6E34181F /* enc_sse2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + EF5491A4CB593F4B14C3A4CD72649405 /* SDWebImageIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FB8C99D8153F25731F71D4405F44E7B /* SDWebImageIndicator.h */; settings = {ATTRIBUTES = (Project, ); }; }; + F026D9C39DB59AD0F3F7F6F6371A22B7 /* SDImageAssetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A1BE91B1D9CF1A76B4AD036EF6F2083 /* SDImageAssetManager.m */; }; + F05B6301364E56BF74F3DEC11AAAD75B /* cost_mips_dsp_r2.c in Sources */ = {isa = PBXBuildFile; fileRef = 1DA7B81A849A38607606392A7ED5C0FD /* cost_mips_dsp_r2.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + F1452646310B7DF8D987010249536E76 /* SDImageAssetManager.h in Headers */ = {isa = PBXBuildFile; fileRef = B833207026BEEFBAA17FF0092B8C530A /* SDImageAssetManager.h */; settings = {ATTRIBUTES = (Project, ); }; }; + F1AD535E49AC4E77FEA30208554EDB69 /* SDWebImageTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AB14D98E07F7191DC89130C4DBF75D2 /* SDWebImageTransition.m */; }; + F1DD207E3FDE8FD41F4E8FAD4A840C13 /* SDImageIOAnimatedCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E126939437E647D99070B72CAA63485 /* SDImageIOAnimatedCoder.h */; settings = {ATTRIBUTES = (Project, ); }; }; + F26B29DEFD829AC98EFA198676E4CA13 /* upsampling.c in Sources */ = {isa = PBXBuildFile; fileRef = 948A5E94C3110E422BCDDB6414398D4F /* upsampling.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + F3C1F7F0CB3B466A65876F39EBDBFC65 /* SDImageGIFCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6697C2E81FDA6E41CE332945075A5102 /* SDImageGIFCoder.m */; }; + F3D9678DFB7618967EC3C72A8462E3FD /* webp_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = DA421095BCEC53647FB897801228780E /* webp_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + F464E4890B084765F9FF2E34C20A51FD /* yuv.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B8354E0C70E43B86BF07A80B7E145A4 /* yuv.h */; settings = {ATTRIBUTES = (Project, ); }; }; + F6541A2BAA913272621A7CB6C823B035 /* SDImageHEICCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4901A535626C107259275B83642C536F /* SDImageHEICCoder.m */; }; + F82CF4572FCCA28ECEE676EABA1BAAF3 /* UIImage+ForceDecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1BB56F9863772C2DE487EDF941AC5F6B /* UIImage+ForceDecode.h */; settings = {ATTRIBUTES = (Project, ); }; }; + FA7DFB408F4A73B37749C8A3D730F903 /* SDImageLoadersManager.h in Headers */ = {isa = PBXBuildFile; fileRef = AD0671F8FAAC30B0AAC2E1118D76504A /* SDImageLoadersManager.h */; settings = {ATTRIBUTES = (Project, ); }; }; + FBCBC855C2BC31EE3B180627DF0E51E2 /* SDImageCacheDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = FC12A660482A54F04DAF4EEBD964443B /* SDImageCacheDefine.h */; settings = {ATTRIBUTES = (Project, ); }; }; + FCC25A540DF0CA820C1CCC7FFBE456FD /* SDAnimatedImageRep.m in Sources */ = {isa = PBXBuildFile; fileRef = 99C151ED7706B7BEB7BF48DB11D2781D /* SDAnimatedImageRep.m */; }; + FE32ED5BFA5DB2420A7C262749A0F7A2 /* dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 7855A3B9A4996CA08A3628DB22A1FF9B /* dsp.h */; settings = {ATTRIBUTES = (Project, ); }; }; + FE33148111F4FD908AE3AB83358705DE /* io_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = B5167E7BD4063FE890336C2A31A9EB2D /* io_dec.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + FE924DD354B6C55F4CD72A37C1DBEFA4 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = CEE1D9965D20D5182C9F25464DAC1311 /* types.h */; settings = {ATTRIBUTES = (Project, ); }; }; + FF9B35D5406687AE668C6A60FB5EBB2F /* yuv_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = E44FB57F8AB7B60CB04372529B01252D /* yuv_neon.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; + FFD9E55353131B612B090216B3B9850E /* picture_tools_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C0978491FDDF92929C2BF5B55FD95FC /* picture_tools_enc.c */; settings = {COMPILER_FLAGS = "-D_THREAD_SAFE -fno-objc-arc"; }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 4691DE3F219FF6147B06234EEFEA13E1 /* PBXContainerItemProxy */ = { + 148FF36D1D131C39AF068467A3E59841 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = FB6F7635FB13EEAE9014EE007FE8B0B7; + remoteGlobalIDString = 3847153A6E5EEFB86565BA840768F429; + remoteInfo = SDWebImage; + }; + 5C3F4DB3061711016C2CF42C9FF1287C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 47D2E85A78C25869BB13521D8561A638; remoteInfo = libwebp; }; - A97A881B8C501BCC92A1721556A9BE7E /* PBXContainerItemProxy */ = { + A6C5BA4BEF92BB3CC25A178C4DC93AD1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 43603B6242089017A8B51CE72FE882A9; + remoteGlobalIDString = 3847153A6E5EEFB86565BA840768F429; remoteInfo = SDWebImage; }; - AE0D0DDF7508D399ED451485FD62C2FD /* PBXContainerItemProxy */ = { + AAC4D3A79161FBD590A1E718A45733A4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = FB6F7635FB13EEAE9014EE007FE8B0B7; + remoteGlobalIDString = 47D2E85A78C25869BB13521D8561A638; remoteInfo = libwebp; }; + F38F445980C110B347313AFCD63FE181 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1953860EA9853AA2BC8022B242F08512; + remoteInfo = SDWebImageWebPCoder; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 004BE760467DF39A207D21A452DB83FC /* cost_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_enc.c; path = src/enc/cost_enc.c; sourceTree = ""; }; - 0231121C915B17518BC7904985B3AB58 /* filter_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filter_enc.c; path = src/enc/filter_enc.c; sourceTree = ""; }; - 024ECB129F48BFB81041D67EEAD1DB38 /* lossless_common.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = lossless_common.h; path = src/dsp/lossless_common.h; sourceTree = ""; }; - 0388506281CFBCACF326B7A9E30178A6 /* UIView+WebCacheOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCacheOperation.h"; path = "SDWebImage/UIView+WebCacheOperation.h"; sourceTree = ""; }; - 04D0AD8C7CE04A56EE1961218A1930A5 /* bit_writer_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = bit_writer_utils.h; path = src/utils/bit_writer_utils.h; sourceTree = ""; }; - 0501062747DF50ABDF95881FF4450E96 /* delta_palettization_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = delta_palettization_enc.h; path = src/enc/delta_palettization_enc.h; sourceTree = ""; }; - 052DB1D40AD9EEFC1F0D3BD096167DFA /* picture_tools_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_tools_enc.c; path = src/enc/picture_tools_enc.c; sourceTree = ""; }; - 05E017D8118C24A1DC9CD910F5FF1BDA /* libwebp-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "libwebp-prefix.pch"; sourceTree = ""; }; - 07BA03AD0A344385FD4371A7049309CA /* lossless.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = lossless.h; path = src/dsp/lossless.h; sourceTree = ""; }; - 0A0FFC18FA3530DC3EED10EC3E25841A /* demux.c */ = {isa = PBXFileReference; includeInIndex = 1; name = demux.c; path = src/demux/demux.c; sourceTree = ""; }; - 0AE3EFD4958A608F90B0BE1730498928 /* SDWebImageDecoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDecoder.h; path = SDWebImage/SDWebImageDecoder.h; sourceTree = ""; }; - 0E9050392CA9C1DB374D4DB0B19BBACC /* vp8i_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8i_enc.h; path = src/enc/vp8i_enc.h; sourceTree = ""; }; - 103CA74F155DBF4F4261A80F6F750D48 /* UIView+WebCacheOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCacheOperation.m"; path = "SDWebImage/UIView+WebCacheOperation.m"; sourceTree = ""; }; - 1044C6C9147747629C5A8CCB8ED5A94B /* lossless_enc_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_neon.c; path = src/dsp/lossless_enc_neon.c; sourceTree = ""; }; - 146CC9720D7B923F4DA0EFA0C02B86AC /* yuv.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = yuv.h; path = src/dsp/yuv.h; sourceTree = ""; }; - 15AFB3D60C26D76087CFF0B10517880D /* iterator_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = iterator_enc.c; path = src/enc/iterator_enc.c; sourceTree = ""; }; - 189A7AB49F9A87D232247067CC3D4258 /* quant_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_enc.c; path = src/enc/quant_enc.c; sourceTree = ""; }; - 1A835D1E9BB76A09070281879A987535 /* liblibwebp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = liblibwebp.a; path = liblibwebp.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 1B58F4E5B5D02276A53066814E94B524 /* vp8i_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8i_dec.h; path = src/dec/vp8i_dec.h; sourceTree = ""; }; - 1BBAD9DAA8309B8F3E0E3C5D6D37D3A7 /* huffman_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = huffman_utils.c; path = src/utils/huffman_utils.c; sourceTree = ""; }; - 1F0BB5092F1868E49C84E448F2AA0656 /* SDWebImage.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.xcconfig; sourceTree = ""; }; - 1FA5C79A6DC9B288DE03682D61EF8F84 /* NSData+ImageContentType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSData+ImageContentType.h"; path = "SDWebImage/NSData+ImageContentType.h"; sourceTree = ""; }; - 1FF5497429B3BB2A0F55B983A3594FCE /* rescaler_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_mips_dsp_r2.c; path = src/dsp/rescaler_mips_dsp_r2.c; sourceTree = ""; }; - 208BE0C034E1DDD6DBFC8A3616E1C531 /* UIView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCache.h"; path = "SDWebImage/UIView+WebCache.h"; sourceTree = ""; }; - 231B2C3AC7C410843C1AE0777CC2FEB6 /* muxread.c */ = {isa = PBXFileReference; includeInIndex = 1; name = muxread.c; path = src/mux/muxread.c; sourceTree = ""; }; - 23805FB6FEDC8941E4CEBB83D9FC9B85 /* enc_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_sse41.c; path = src/dsp/enc_sse41.c; sourceTree = ""; }; - 25FBEEF91BB61CA112652CECA03A3929 /* cost_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_mips32.c; path = src/dsp/cost_mips32.c; sourceTree = ""; }; - 276CCC3883E4B31EB6BB9EB32AF6CFFA /* cost.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost.c; path = src/dsp/cost.c; sourceTree = ""; }; - 2A14B550C2A8A3798C6996D1C39E35B6 /* UIImage+WebP.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+WebP.h"; path = "SDWebImage/UIImage+WebP.h"; sourceTree = ""; }; - 2D8773D101F94C4AC16510F8AC97BB65 /* lossless_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc.c; path = src/dsp/lossless_enc.c; sourceTree = ""; }; - 2ED36195C66ABF5658D777F6B645BB11 /* quant_levels_dec_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = quant_levels_dec_utils.h; path = src/utils/quant_levels_dec_utils.h; sourceTree = ""; }; - 300804CC1C47DCADA733F47EEAE58E42 /* thread_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = thread_utils.h; path = src/utils/thread_utils.h; sourceTree = ""; }; - 31D3AE61A99A7CBBA417A1EF6EDB23FC /* idec_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = idec_dec.c; path = src/dec/idec_dec.c; sourceTree = ""; }; - 328D7FBF646C01B71BD7D597A60756B0 /* enc_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_mips_dsp_r2.c; path = src/dsp/enc_mips_dsp_r2.c; sourceTree = ""; }; - 339352C0B5D785A58F2F40C3A9DB8500 /* SDImageCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCache.m; path = SDWebImage/SDImageCache.m; sourceTree = ""; }; - 34F2B0137AD76AE6A507D5E3A905F795 /* vp8li_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8li_enc.h; path = src/enc/vp8li_enc.h; sourceTree = ""; }; - 36310DA34C483EA51C8004AA287098E7 /* Pods-BAWKWebView-WebP-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-BAWKWebView-WebP-resources.sh"; sourceTree = ""; }; - 373FE07527F74CF6418844EF3D73C61C /* enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc.c; path = src/dsp/enc.c; sourceTree = ""; }; - 39A7E4C24006A7AB46A1704E784F10FA /* SDImageCacheConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheConfig.h; path = SDWebImage/SDImageCacheConfig.h; sourceTree = ""; }; - 3A92C6C20F170DFFEB05DDCB81CB6243 /* libwebp.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = libwebp.xcconfig; sourceTree = ""; }; - 3BEF0676AE3CE1AEA70EF6D8DF98E3FE /* alpha_processing_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_sse41.c; path = src/dsp/alpha_processing_sse41.c; sourceTree = ""; }; - 3DECF924EDD277C948133751B5EC9C6E /* lossless.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless.c; path = src/dsp/lossless.c; sourceTree = ""; }; - 3DFBC70F76B6EEFD8E9310BC4997F45A /* webp_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = webp_enc.c; path = src/enc/webp_enc.c; sourceTree = ""; }; - 3E1EE565C4B417FED86AD12844B48937 /* encode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = encode.h; path = src/webp/encode.h; sourceTree = ""; }; - 3EDFE2ED55510BEAB58FF8071C305091 /* enc_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_msa.c; path = src/dsp/enc_msa.c; sourceTree = ""; }; - 40697FA767824DC00D42B15F251526F0 /* lossless_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_mips_dsp_r2.c; path = src/dsp/lossless_mips_dsp_r2.c; sourceTree = ""; }; - 41718D837EAA5F1D3BBB4DC60006C316 /* upsampling_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_msa.c; path = src/dsp/upsampling_msa.c; sourceTree = ""; }; - 44AAD21219953FB66BB2CBFFA5E0D02A /* UIImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+WebCache.m"; path = "SDWebImage/UIImageView+WebCache.m"; sourceTree = ""; }; - 45022404D6FA3F5A1AB05E26B0996769 /* lossless_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_neon.c; path = src/dsp/lossless_neon.c; sourceTree = ""; }; - 4586E938EFAF02D88CF835FC6B02B371 /* quant_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_dec.c; path = src/dec/quant_dec.c; sourceTree = ""; }; - 4871F6C58E55217D10955C03B5C511E2 /* SDWebImageManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageManager.h; path = SDWebImage/SDWebImageManager.h; sourceTree = ""; }; - 49660BEDAA566C8693E20282A3F8DD2D /* mux.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mux.h; path = src/webp/mux.h; sourceTree = ""; }; - 4A820C9586B5D047627D09F99756A668 /* backward_references_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = backward_references_enc.h; path = src/enc/backward_references_enc.h; sourceTree = ""; }; - 4D1A5AC41A5B9A7F4F8F3D54DF1A11B4 /* bit_reader_inl_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = bit_reader_inl_utils.h; path = src/utils/bit_reader_inl_utils.h; sourceTree = ""; }; - 4ECD30A295759333C72E68CBC8DA0A1C /* dec_clip_tables.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_clip_tables.c; path = src/dsp/dec_clip_tables.c; sourceTree = ""; }; - 4F3728BBEF5FA7E4311802DF38EC348B /* dec_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_neon.c; path = src/dsp/dec_neon.c; sourceTree = ""; }; - 4FA0292C933A228AF15A82AEEF148469 /* muxi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = muxi.h; path = src/mux/muxi.h; sourceTree = ""; }; - 5038D75A2F0E1B08B278CCFE2D753B42 /* webp_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = webp_dec.c; path = src/dec/webp_dec.c; sourceTree = ""; }; - 50A623F0F49F43F0F6CA81A309F432FD /* Pods-BAWKWebView-WebP-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-BAWKWebView-WebP-frameworks.sh"; sourceTree = ""; }; - 50DBE1FF96163239B49D9945C62230A3 /* token_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = token_enc.c; path = src/enc/token_enc.c; sourceTree = ""; }; - 50FB840B590B4374D733ED71CFFE2795 /* argb_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = argb_mips_dsp_r2.c; path = src/dsp/argb_mips_dsp_r2.c; sourceTree = ""; }; - 511621F6C95356FA35A0732AB9C8471C /* anim_decode.c */ = {isa = PBXFileReference; includeInIndex = 1; name = anim_decode.c; path = src/demux/anim_decode.c; sourceTree = ""; }; - 52604F8208305AC14CC070FFCC1477F8 /* enc_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_mips32.c; path = src/dsp/enc_mips32.c; sourceTree = ""; }; - 531BF50508FED07C5884D105EF31EF2B /* types.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = types.h; path = src/webp/types.h; sourceTree = ""; }; - 551217A993D070E428227F487341110E /* yuv.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv.c; path = src/dsp/yuv.c; sourceTree = ""; }; - 56441565BFB2BA0078F6383393FA14BD /* utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = utils.h; path = src/utils/utils.h; sourceTree = ""; }; - 575279E6EB877E78818659DC8B8EF163 /* animi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = animi.h; path = src/mux/animi.h; sourceTree = ""; }; - 5A1AEDD4D6CE0234EA47A9A0D9A3E4A2 /* format_constants.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = format_constants.h; path = src/webp/format_constants.h; sourceTree = ""; }; - 5B0C538EC10EEA8B39D3868A1213B6A0 /* dec_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_msa.c; path = src/dsp/dec_msa.c; sourceTree = ""; }; - 5BA3CBC2350133C20AA4A2E24EBBA672 /* muxedit.c */ = {isa = PBXFileReference; includeInIndex = 1; name = muxedit.c; path = src/mux/muxedit.c; sourceTree = ""; }; - 5F13947BA1CC99B85FAE2A5029A7E0D1 /* dec_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_mips_dsp_r2.c; path = src/dsp/dec_mips_dsp_r2.c; sourceTree = ""; }; - 6146B50AB836D198B07F92CBFF27F16C /* vp8_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vp8_dec.c; path = src/dec/vp8_dec.c; sourceTree = ""; }; - 616E799AC9183EFE82F9A398E57273D6 /* enc_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_sse2.c; path = src/dsp/enc_sse2.c; sourceTree = ""; }; - 61A33BE896F83C07BD074408A1475EEF /* SDWebImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloader.h; path = SDWebImage/SDWebImageDownloader.h; sourceTree = ""; }; - 62A8D117E6CD9448B247F71253369976 /* alpha_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_enc.c; path = src/enc/alpha_enc.c; sourceTree = ""; }; - 62ED24F22812AAE5F17EC3515C7B07B5 /* msa_macro.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = msa_macro.h; path = src/dsp/msa_macro.h; sourceTree = ""; }; - 63020B60D2C9FC34306AC8E7C82C9116 /* quant_levels_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_levels_utils.c; path = src/utils/quant_levels_utils.c; sourceTree = ""; }; - 634DADD2C57B8F44DFFC6F71C9CE7438 /* UIImage+MultiFormat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+MultiFormat.m"; path = "SDWebImage/UIImage+MultiFormat.m"; sourceTree = ""; }; - 635A4BD1CEF7E623C71F97A54BFC3616 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; }; - 64ADB6EFD774DDBCFD30DFA05B805786 /* libSDWebImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libSDWebImage.a; path = libSDWebImage.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 65E51A17AAC90C3F6D2B8A4439095455 /* argb.c */ = {isa = PBXFileReference; includeInIndex = 1; name = argb.c; path = src/dsp/argb.c; sourceTree = ""; }; - 6653CFE2F496F33977E841E6081907F2 /* rescaler.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler.c; path = src/dsp/rescaler.c; sourceTree = ""; }; - 668D284887BD84066B67AB8D4C53E2C3 /* lossless_enc_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_msa.c; path = src/dsp/lossless_enc_msa.c; sourceTree = ""; }; - 67B00680366E3EA7E93925A84077868D /* alpha_processing_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_neon.c; path = src/dsp/alpha_processing_neon.c; sourceTree = ""; }; - 6A698B17D4A618AF77F21F115599FA0F /* NSImage+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSImage+WebCache.m"; path = "SDWebImage/NSImage+WebCache.m"; sourceTree = ""; }; - 6CE29CF4FF5C02028C0A06EC0D2A6120 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 6D4608A7510ED3BAF1DCC57A8D3C19DD /* histogram_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = histogram_enc.h; path = src/enc/histogram_enc.h; sourceTree = ""; }; - 6F1A7A427E65B94BA17EE92199885DE3 /* vp8l_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vp8l_dec.c; path = src/dec/vp8l_dec.c; sourceTree = ""; }; - 7159B700027C2E55475CD79B6EB4F7E8 /* io_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = io_dec.c; path = src/dec/io_dec.c; sourceTree = ""; }; - 7533C70B69DB2C1E51452D44250C2083 /* utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = utils.c; path = src/utils/utils.c; sourceTree = ""; }; - 7541F858B15FDCB24B7F35E657947D33 /* SDWebImageDecoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDecoder.m; path = SDWebImage/SDWebImageDecoder.m; sourceTree = ""; }; - 75A8F849CD87952D8A6014163D20A16A /* filters.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters.c; path = src/dsp/filters.c; sourceTree = ""; }; - 768465670623F75542DD8B2237C47917 /* yuv_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_mips_dsp_r2.c; path = src/dsp/yuv_mips_dsp_r2.c; sourceTree = ""; }; - 76EFAE2D57D909A3DC8F94FB83EE25E3 /* quant_levels_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = quant_levels_utils.h; path = src/utils/quant_levels_utils.h; sourceTree = ""; }; - 797CCACA1FF334B81AC60A447F0DBA79 /* SDWebImageCompat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCompat.m; path = SDWebImage/SDWebImageCompat.m; sourceTree = ""; }; - 7A0A95D9E76BBB7F2096B5717F7C19A6 /* common_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = common_dec.h; path = src/dec/common_dec.h; sourceTree = ""; }; - 7B907599F625013154ABE72A5D8CAE14 /* lossless_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_msa.c; path = src/dsp/lossless_msa.c; sourceTree = ""; }; - 7C1C934A7F0E5A033012E3B421743036 /* histogram_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = histogram_enc.c; path = src/enc/histogram_enc.c; sourceTree = ""; }; - 7C773770BA63E6D809D56EE6932CA759 /* SDWebImageOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOperation.h; path = SDWebImage/SDWebImageOperation.h; sourceTree = ""; }; - 7D382756D49126C8879D0F173B2A136C /* rescaler_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_sse2.c; path = src/dsp/rescaler_sse2.c; sourceTree = ""; }; - 82CEBA7D38FE8FBAC58EE4AF0A57AFA4 /* decode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = decode.h; path = src/webp/decode.h; sourceTree = ""; }; - 8573E5FFF3999AC4CD1261C6E01CC65E /* SDImageCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCache.h; path = SDWebImage/SDImageCache.h; sourceTree = ""; }; - 8978776383E9C9DBEF2C387C5FD10CFA /* rescaler_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_utils.c; path = src/utils/rescaler_utils.c; sourceTree = ""; }; - 8B4AE3EA5395CB7073DF8F42D5DEB6C2 /* mips_macro.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mips_macro.h; path = src/dsp/mips_macro.h; sourceTree = ""; }; - 8C265B12DACF50DDD5ED7DE64D08C06B /* huffman_encode_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = huffman_encode_utils.h; path = src/utils/huffman_encode_utils.h; sourceTree = ""; }; - 8C8E44FC00416EA4763BD37016000A4A /* UIView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCache.m"; path = "SDWebImage/UIView+WebCache.m"; sourceTree = ""; }; - 8DB5308B72FB4C93850FBA59103F6183 /* rescaler_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = rescaler_utils.h; path = src/utils/rescaler_utils.h; sourceTree = ""; }; - 8E689CA2AECAC018C014ABBBD5CC4434 /* buffer_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = buffer_dec.c; path = src/dec/buffer_dec.c; sourceTree = ""; }; - 9098D0B5647E129B3DB16CB32FA48EB5 /* UIImage+WebP.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+WebP.m"; path = "SDWebImage/UIImage+WebP.m"; sourceTree = ""; }; - 92F1FE8CA757CC3D7E16149A98464295 /* UIImageView+HighlightedWebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+HighlightedWebCache.m"; path = "SDWebImage/UIImageView+HighlightedWebCache.m"; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 93C6EA48352BA7397DE40A9D3FC57609 /* predictor_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = predictor_enc.c; path = src/enc/predictor_enc.c; sourceTree = ""; }; - 94AB76933441E7D98010BCE1A68F9192 /* mux_types.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mux_types.h; path = src/webp/mux_types.h; sourceTree = ""; }; - 956D21517B420AB4AD8864E879BE0513 /* common_sse2.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = common_sse2.h; path = src/dsp/common_sse2.h; sourceTree = ""; }; - 962D0A891D2167D695D508748BF135C5 /* Pods-BAWKWebView-WebP.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-BAWKWebView-WebP.release.xcconfig"; sourceTree = ""; }; - 967DAE3CCD5520E6076C0F516A1F1947 /* enc_avx2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_avx2.c; path = src/dsp/enc_avx2.c; sourceTree = ""; }; - 96B1A250CAD0F990FF7FA07BC3F489CC /* NSImage+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSImage+WebCache.h"; path = "SDWebImage/NSImage+WebCache.h"; sourceTree = ""; }; - 96C3B2B1349FB5BA91971F37B47A1A50 /* SDWebImageCompat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCompat.h; path = SDWebImage/SDWebImageCompat.h; sourceTree = ""; }; - 96CDEAF3F8C8DCB78C3507C88BD1CBDD /* dsp.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = dsp.h; path = src/dsp/dsp.h; sourceTree = ""; }; - 989D0080ABA043EC5FBEE939572CA2D1 /* SDWebImage-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImage-prefix.pch"; sourceTree = ""; }; - 991780B5D6746B152A725F9F025D1BDA /* Pods-BAWKWebView-WebP-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-BAWKWebView-WebP-dummy.m"; sourceTree = ""; }; - 993BCFE033C6E3D2E962620B184B7FA1 /* NSData+ImageContentType.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSData+ImageContentType.m"; path = "SDWebImage/NSData+ImageContentType.m"; sourceTree = ""; }; - 9A9C7CED37BE90E6C2F5F6358E9A7984 /* upsampling.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling.c; path = src/dsp/upsampling.c; sourceTree = ""; }; - 9B370B8576F255230DA4AC1F32A77E57 /* Pods-BAWKWebView-WebP-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-BAWKWebView-WebP-acknowledgements.markdown"; sourceTree = ""; }; - 9BCD0D26A417326FEA42AB6009D05344 /* lossless_enc_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_mips_dsp_r2.c; path = src/dsp/lossless_enc_mips_dsp_r2.c; sourceTree = ""; }; - 9D015B31E9944123CC9BAC63E47891F7 /* webpi_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = webpi_dec.h; path = src/dec/webpi_dec.h; sourceTree = ""; }; - 9E6D5AD78E69842B3D620E77B6D5512C /* argb_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = argb_sse2.c; path = src/dsp/argb_sse2.c; sourceTree = ""; }; - 9F52BF281F3D298C5DCA1027FD8CC759 /* syntax_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = syntax_enc.c; path = src/enc/syntax_enc.c; sourceTree = ""; }; - A18E39F77E4D2A85C1C9241830AF749A /* filters_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_msa.c; path = src/dsp/filters_msa.c; sourceTree = ""; }; - A1FA76313E48A0C5EEEB3AE2ECAEE0B1 /* filters_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_sse2.c; path = src/dsp/filters_sse2.c; sourceTree = ""; }; - A202AAC4C8E98D65D0BD7F4EA8DD5587 /* random_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = random_utils.c; path = src/utils/random_utils.c; sourceTree = ""; }; - A215E046AB052D89704AD143C424C6AF /* delta_palettization_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = delta_palettization_enc.c; path = src/enc/delta_palettization_enc.c; sourceTree = ""; }; - A37CCF97524596901920DBA9A3015CB7 /* alpha_processing_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_mips_dsp_r2.c; path = src/dsp/alpha_processing_mips_dsp_r2.c; sourceTree = ""; }; - A3B977DB3CD08004F1ED08E08A61D42C /* upsampling_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_neon.c; path = src/dsp/upsampling_neon.c; sourceTree = ""; }; - A417768449EA1B267BCC899E9CDA199C /* tree_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = tree_dec.c; path = src/dec/tree_dec.c; sourceTree = ""; }; - A429697AC37504BA2A4EB42B29D782AE /* huffman_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = huffman_utils.h; path = src/utils/huffman_utils.h; sourceTree = ""; }; - A64880B6650EFEF31BA6FFD685BD6336 /* neon.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = neon.h; path = src/dsp/neon.h; sourceTree = ""; }; - A6907917A14351DA9EE12DD00F190A4B /* analysis_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = analysis_enc.c; path = src/enc/analysis_enc.c; sourceTree = ""; }; - A6F6448B21C37A0CFC1111D5F97D46BB /* filters_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_neon.c; path = src/dsp/filters_neon.c; sourceTree = ""; }; - A7D5DD007CAC0B662476ECD3315BA0DE /* filters_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_utils.c; path = src/utils/filters_utils.c; sourceTree = ""; }; - A98E660E2FAC8EE420CB48B95AFE1FAA /* SDWebImagePrefetcher.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImagePrefetcher.h; path = SDWebImage/SDWebImagePrefetcher.h; sourceTree = ""; }; - AB76C0C252D5C80C00ED2F1E3F85D06D /* SDImageCacheConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheConfig.m; path = SDWebImage/SDImageCacheConfig.m; sourceTree = ""; }; - AC092801836BE501CE5D1430194412BB /* lossless_enc_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_sse41.c; path = src/dsp/lossless_enc_sse41.c; sourceTree = ""; }; - AC8828C8FC8859C3DF8E60751F90B20C /* picture_psnr_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_psnr_enc.c; path = src/enc/picture_psnr_enc.c; sourceTree = ""; }; - AF3D593EFD9D540B4EA0A86538C74D71 /* cost_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_sse2.c; path = src/dsp/cost_sse2.c; sourceTree = ""; }; - AF4CB436A1905894FFF226874B234E52 /* UIButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIButton+WebCache.h"; path = "SDWebImage/UIButton+WebCache.h"; sourceTree = ""; }; - AF821DF0B457FF4B923C234F4A7E1C50 /* tree_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = tree_enc.c; path = src/enc/tree_enc.c; sourceTree = ""; }; - B053BF8762763D45A322C072AF0F940E /* SDWebImageManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageManager.m; path = SDWebImage/SDWebImageManager.m; sourceTree = ""; }; - B1ABFE7140FE1ABD314AD9A97E1F91F1 /* demux.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = demux.h; path = src/webp/demux.h; sourceTree = ""; }; - B1F5D9B9A3031F0976C63E1C2C2A93CC /* UIImage+GIF.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+GIF.m"; path = "SDWebImage/UIImage+GIF.m"; sourceTree = ""; }; - B327E482F5224CB51BC6D7CDB2490DD5 /* Pods-BAWKWebView-WebP-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-BAWKWebView-WebP-acknowledgements.plist"; sourceTree = ""; }; - B60D283A1491E38E530541E0E6F6A534 /* SDWebImagePrefetcher.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImagePrefetcher.m; path = SDWebImage/SDWebImagePrefetcher.m; sourceTree = ""; }; - B6E3372E9CAECFED9042C69C0ECC9B7D /* libwebp-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "libwebp-dummy.m"; sourceTree = ""; }; - B75BE342AB4E0CBA7E1E370C7D1E6066 /* frame_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = frame_dec.c; path = src/dec/frame_dec.c; sourceTree = ""; }; - B78F3B48B08D8BEFF8B1F7863912B573 /* thread_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = thread_utils.c; path = src/utils/thread_utils.c; sourceTree = ""; }; - B82868D4CF37761788C57E478FE98880 /* rescaler_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_msa.c; path = src/dsp/rescaler_msa.c; sourceTree = ""; }; - BAD5AE968131E1EF2A84FEA1705A06DA /* SDWebImageDownloaderOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderOperation.h; path = SDWebImage/SDWebImageDownloaderOperation.h; sourceTree = ""; }; - BAEDB1C378E6A55D0BE217E9FF79E125 /* alpha_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_dec.c; path = src/dec/alpha_dec.c; sourceTree = ""; }; - BDC6F1EDF90E47B2A267CBA185FA2AC8 /* SDWebImageDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloader.m; path = SDWebImage/SDWebImageDownloader.m; sourceTree = ""; }; - BED86A2B541E9DF7218641E267B8FE1B /* anim_encode.c */ = {isa = PBXFileReference; includeInIndex = 1; name = anim_encode.c; path = src/mux/anim_encode.c; sourceTree = ""; }; - C0476AAA1524F15BD78E0B27BDD7167E /* lossless_enc_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_sse2.c; path = src/dsp/lossless_enc_sse2.c; sourceTree = ""; }; - C6097A7BC5AD677EADFF5D32164D2254 /* filters_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_mips_dsp_r2.c; path = src/dsp/filters_mips_dsp_r2.c; sourceTree = ""; }; - C69C05EA665406970B3F3FE259C85457 /* cpu.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cpu.c; path = src/dsp/cpu.c; sourceTree = ""; }; - C76E93FF974EDFDAB0F986B17E44B7CA /* quant_levels_dec_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_levels_dec_utils.c; path = src/utils/quant_levels_dec_utils.c; sourceTree = ""; }; - C9DACF4F3FA941723E0343D07718FA80 /* muxinternal.c */ = {isa = PBXFileReference; includeInIndex = 1; name = muxinternal.c; path = src/mux/muxinternal.c; sourceTree = ""; }; - CAC88D87B34B5F6676DE25A807EF9FD0 /* dec_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_mips32.c; path = src/dsp/dec_mips32.c; sourceTree = ""; }; - CB21FA537FE1AEACE2DDAB762B57550E /* color_cache_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = color_cache_utils.c; path = src/utils/color_cache_utils.c; sourceTree = ""; }; - CB62B1B588F319B60D0B4AE68FD72774 /* picture_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_enc.c; path = src/enc/picture_enc.c; sourceTree = ""; }; - CD037CC5E1FC47EC82B4749A4EDD5B15 /* backward_references_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = backward_references_enc.c; path = src/enc/backward_references_enc.c; sourceTree = ""; }; - CDD1D2CF00D57E04E69B18783E9C7CE8 /* picture_rescale_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_rescale_enc.c; path = src/enc/picture_rescale_enc.c; sourceTree = ""; }; - CF9A2EBC31A738ED93A5D7E2DB4338E8 /* alpha_processing.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing.c; path = src/dsp/alpha_processing.c; sourceTree = ""; }; - D1F6422437DE4FDF6D687A53902030DF /* config_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = config_enc.c; path = src/enc/config_enc.c; sourceTree = ""; }; - D2223C785D56C3C8BE5AC3755E78651C /* bit_writer_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = bit_writer_utils.c; path = src/utils/bit_writer_utils.c; sourceTree = ""; }; - D2CC26F0959A37DA471F1E448111A793 /* alpha_processing_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_sse2.c; path = src/dsp/alpha_processing_sse2.c; sourceTree = ""; }; - D338ED8DAB214F41D35FE22F2F70D9ED /* near_lossless_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = near_lossless_enc.c; path = src/enc/near_lossless_enc.c; sourceTree = ""; }; - D550C79ED74B00036054236337232B31 /* UIImage+GIF.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+GIF.h"; path = "SDWebImage/UIImage+GIF.h"; sourceTree = ""; }; - D5C3472E5D8F4E603D4D66BF051C4101 /* UIButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIButton+WebCache.m"; path = "SDWebImage/UIButton+WebCache.m"; sourceTree = ""; }; - D5FA2D02464DD4A65CF2E80F4B6C9180 /* picture_csp_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_csp_enc.c; path = src/enc/picture_csp_enc.c; sourceTree = ""; }; - D8E6DC6AC893C4CC6618989D6F488FCB /* libPods-BAWKWebView-WebP.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = "libPods-BAWKWebView-WebP.a"; path = "libPods-BAWKWebView-WebP.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - DCF0FAD2DFB69A2201A5FE2B4541D9CB /* UIImageView+HighlightedWebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+HighlightedWebCache.h"; path = "SDWebImage/UIImageView+HighlightedWebCache.h"; sourceTree = ""; }; - DD48E681F598C2826B4FBB4B36CC46CA /* rescaler_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_neon.c; path = src/dsp/rescaler_neon.c; sourceTree = ""; }; - DEC54D6DBDF533CE64763A734C28800F /* Pods-BAWKWebView-WebP.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-BAWKWebView-WebP.debug.xcconfig"; sourceTree = ""; }; - DFB11E49EADA83FC3535B17967EA57E5 /* alphai_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = alphai_dec.h; path = src/dec/alphai_dec.h; sourceTree = ""; }; - DFD6820FEAFAB43C4CFF511817518B98 /* bit_reader_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = bit_reader_utils.h; path = src/utils/bit_reader_utils.h; sourceTree = ""; }; - E094215356DD4E0C796FF030A5B6C4B7 /* rescaler_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_mips32.c; path = src/dsp/rescaler_mips32.c; sourceTree = ""; }; - E384D0E6C5EE52559BB411F9A0507DB3 /* huffman_encode_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = huffman_encode_utils.c; path = src/utils/huffman_encode_utils.c; sourceTree = ""; }; - E4B62DF08D0017EFD1397CA69FC31728 /* vp8l_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vp8l_enc.c; path = src/enc/vp8l_enc.c; sourceTree = ""; }; - E53F34B3A22FBF443D71AE2EA3EF3B8B /* filters_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = filters_utils.h; path = src/utils/filters_utils.h; sourceTree = ""; }; - E6C02AFFE197D5A81026DA7BE4E40E42 /* bit_reader_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = bit_reader_utils.c; path = src/utils/bit_reader_utils.c; sourceTree = ""; }; - E814A16CC5832448B34DEBAFEBA038A3 /* endian_inl_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = endian_inl_utils.h; path = src/utils/endian_inl_utils.h; sourceTree = ""; }; - E8E893045FACB15A3E7F8BACB56A2179 /* yuv_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_sse2.c; path = src/dsp/yuv_sse2.c; sourceTree = ""; }; - ECA83D82F08ED3D5A3234D79C4DEC298 /* dec_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_sse2.c; path = src/dsp/dec_sse2.c; sourceTree = ""; }; - ED381B1B005427FE1A42700263176914 /* lossless_enc_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_mips32.c; path = src/dsp/lossless_enc_mips32.c; sourceTree = ""; }; - EFD848156EF77FAC4DB3228C2FD9ABF4 /* lossless_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_sse2.c; path = src/dsp/lossless_sse2.c; sourceTree = ""; }; - F05BDEE1D6FE9B73E198CF508089CF6A /* dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec.c; path = src/dsp/dec.c; sourceTree = ""; }; - F06B41EB1517F712C1BE8F7625102CA5 /* vp8li_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8li_dec.h; path = src/dec/vp8li_dec.h; sourceTree = ""; }; - F1018EC0C8920BBC5D5084576B9C7D63 /* enc_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_neon.c; path = src/dsp/enc_neon.c; sourceTree = ""; }; - F20A8DA5F0CF034E1B0D64BD6FE69FC0 /* frame_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = frame_enc.c; path = src/enc/frame_enc.c; sourceTree = ""; }; - F25106E1CBAC5EBEBD6AFE53C38DD7A2 /* color_cache_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = color_cache_utils.h; path = src/utils/color_cache_utils.h; sourceTree = ""; }; - F2E9F537965331CDABA2D3930215A123 /* upsampling_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_sse2.c; path = src/dsp/upsampling_sse2.c; sourceTree = ""; }; - F375518518A0506826C246E90CD100AB /* upsampling_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_mips_dsp_r2.c; path = src/dsp/upsampling_mips_dsp_r2.c; sourceTree = ""; }; - F3DCFF2DCAE34CE7E4D92CE9C7366E97 /* random_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = random_utils.h; path = src/utils/random_utils.h; sourceTree = ""; }; - F6817F129F248B26709FF1FACACB3F1B /* SDWebImageDownloaderOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderOperation.m; path = SDWebImage/SDWebImageDownloaderOperation.m; sourceTree = ""; }; - F73F01C41DF3DDFA6A57FAE8287E4337 /* cost_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_mips_dsp_r2.c; path = src/dsp/cost_mips_dsp_r2.c; sourceTree = ""; }; - F765E2246CE0E6CE15C6F9352E62F5DF /* vp8_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8_dec.h; path = src/dec/vp8_dec.h; sourceTree = ""; }; - F7670DBA6B12AF94EE4EC6836F6B5FD7 /* cost_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = cost_enc.h; path = src/enc/cost_enc.h; sourceTree = ""; }; - F7DE141E810176A48EF1F87DB1871154 /* UIImage+MultiFormat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+MultiFormat.h"; path = "SDWebImage/UIImage+MultiFormat.h"; sourceTree = ""; }; - F8CD6B8AE72082529B0F0BFA15C1082B /* UIImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+WebCache.h"; path = "SDWebImage/UIImageView+WebCache.h"; sourceTree = ""; }; - F8EF0FD5910DDFE44B7B0C2EEBFD3D20 /* dec_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_sse41.c; path = src/dsp/dec_sse41.c; sourceTree = ""; }; - FB4613EE0FC905FB5248D149C312DFC2 /* SDWebImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SDWebImage-dummy.m"; sourceTree = ""; }; - FFBEFE612DDE08FECB0A38AC11CFDC65 /* yuv_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_mips32.c; path = src/dsp/yuv_mips32.c; sourceTree = ""; }; + 00F48B414A782B5F543042D44B95E317 /* SDImageAWebPCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAWebPCoder.m; path = SDWebImage/Core/SDImageAWebPCoder.m; sourceTree = ""; }; + 0105B67959BA81D85FD761F2B3C75F42 /* SDImageLoader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageLoader.h; path = SDWebImage/Core/SDImageLoader.h; sourceTree = ""; }; + 02165E73AD8E97F2C6A08329E76E3293 /* quant_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_dec.c; path = src/dec/quant_dec.c; sourceTree = ""; }; + 021D6DA8E40455C4CF949957C38D72E8 /* upsampling_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_msa.c; path = src/dsp/upsampling_msa.c; sourceTree = ""; }; + 02932AE728BD3BB2B6921AA6C856FC7F /* SDImageCachesManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCachesManager.m; path = SDWebImage/Core/SDImageCachesManager.m; sourceTree = ""; }; + 03C65F1F8A146656C1BAD0831392C99F /* histogram_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = histogram_enc.c; path = src/enc/histogram_enc.c; sourceTree = ""; }; + 04156A1494B350F1118EF4E2D4E0D86F /* backward_references_cost_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = backward_references_cost_enc.c; path = src/enc/backward_references_cost_enc.c; sourceTree = ""; }; + 045CA2B6F87FF1CFC2231A4211907BB6 /* histogram_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = histogram_enc.h; path = src/enc/histogram_enc.h; sourceTree = ""; }; + 055791E259E9A880A9FEBE27FCF1A5B0 /* bit_reader_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = bit_reader_utils.h; path = src/utils/bit_reader_utils.h; sourceTree = ""; }; + 056EF0342200211C063CBD984201A1AE /* lossless_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc.c; path = src/dsp/lossless_enc.c; sourceTree = ""; }; + 058919D50C3BB7E6A85AB707380BF835 /* NSData+ImageContentType.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSData+ImageContentType.m"; path = "SDWebImage/Core/NSData+ImageContentType.m"; sourceTree = ""; }; + 0640F13E13DB87517026FD9BDFE5CD13 /* alpha_processing_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_sse41.c; path = src/dsp/alpha_processing_sse41.c; sourceTree = ""; }; + 07639BEEF0C64623EFABA8277CD0DAC3 /* format_constants.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = format_constants.h; path = src/webp/format_constants.h; sourceTree = ""; }; + 098095AB88EF3BBC12F7B0E7B2A99EE8 /* near_lossless_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = near_lossless_enc.c; path = src/enc/near_lossless_enc.c; sourceTree = ""; }; + 0A1F1783097070142C03654C2D9A3C41 /* huffman_encode_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = huffman_encode_utils.c; path = src/utils/huffman_encode_utils.c; sourceTree = ""; }; + 0A93B4AA0DA7D7938A6485826D49FD41 /* UIView+WebCacheOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCacheOperation.h"; path = "SDWebImage/Core/UIView+WebCacheOperation.h"; sourceTree = ""; }; + 0E079B403D6D0B0B1040713F0111C3C4 /* SDInternalMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDInternalMacros.h; path = SDWebImage/Private/SDInternalMacros.h; sourceTree = ""; }; + 0F79B4188E77B515662B7AFB0CA514CC /* SDImageCodersManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCodersManager.h; path = SDWebImage/Core/SDImageCodersManager.h; sourceTree = ""; }; + 10506352AD2E9695188E2AD3071F2E9E /* alpha_processing_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_sse2.c; path = src/dsp/alpha_processing_sse2.c; sourceTree = ""; }; + 111F431982285E95FC80611A41DC1856 /* rescaler_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = rescaler_utils.h; path = src/utils/rescaler_utils.h; sourceTree = ""; }; + 13D82D365FF6AA187D4393E7FB963EFF /* lossless_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_neon.c; path = src/dsp/lossless_neon.c; sourceTree = ""; }; + 158D5B12074B414E45620EBA540E900A /* SDWebImageWebPCoder.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImageWebPCoder.debug.xcconfig; sourceTree = ""; }; + 15DF3A2B1426ED2AC1A59FC36F9260E9 /* SDWebImage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.debug.xcconfig; sourceTree = ""; }; + 164DD2A67CBD3A44B38195E99221CDB3 /* SDWebImage-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImage-prefix.pch"; sourceTree = ""; }; + 17BA5A569562ECFD2A051820DA38E7F7 /* SDImageLoader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageLoader.m; path = SDWebImage/Core/SDImageLoader.m; sourceTree = ""; }; + 18946164FE3C17C5082F7F66C71371D5 /* config_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = config_enc.c; path = src/enc/config_enc.c; sourceTree = ""; }; + 193FA3D95479A07735B769BC5A15CE4C /* common_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = common_dec.h; path = src/dec/common_dec.h; sourceTree = ""; }; + 1A1A3DBB2558E7AC29121FD7B595615E /* UIColor+SDHexString.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIColor+SDHexString.h"; path = "SDWebImage/Private/UIColor+SDHexString.h"; sourceTree = ""; }; + 1B8D9A85717B35BC24D75C80BB55B132 /* SDWebImageCompat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCompat.h; path = SDWebImage/Core/SDWebImageCompat.h; sourceTree = ""; }; + 1BB56F9863772C2DE487EDF941AC5F6B /* UIImage+ForceDecode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+ForceDecode.h"; path = "SDWebImage/Core/UIImage+ForceDecode.h"; sourceTree = ""; }; + 1BCA75CADACD909A6275041B19CC7820 /* SDFileAttributeHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDFileAttributeHelper.h; path = SDWebImage/Private/SDFileAttributeHelper.h; sourceTree = ""; }; + 1D0FF6E435829B311BBFD6D9F9168438 /* lossless_enc_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_mips32.c; path = src/dsp/lossless_enc_mips32.c; sourceTree = ""; }; + 1DA7B81A849A38607606392A7ED5C0FD /* cost_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_mips_dsp_r2.c; path = src/dsp/cost_mips_dsp_r2.c; sourceTree = ""; }; + 1FF6AAEE8547B36A282E33BA79C2AC7D /* bit_writer_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = bit_writer_utils.c; path = src/utils/bit_writer_utils.c; sourceTree = ""; }; + 1FF73CAC210F42D83D9A68A7813D6725 /* libPods-BAWKWebView-WebP.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = "libPods-BAWKWebView-WebP.a"; path = "libPods-BAWKWebView-WebP.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 20E63DC1859B1BEBD6B5C88D50E6DB63 /* SDAnimatedImageRep.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImageRep.h; path = SDWebImage/Core/SDAnimatedImageRep.h; sourceTree = ""; }; + 23246A10E766EC00C04B342BE1B2EAE5 /* lossless.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = lossless.h; path = src/dsp/lossless.h; sourceTree = ""; }; + 23BEAA7669175EA15905F5DBB3DAE507 /* vp8_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8_dec.h; path = src/dec/vp8_dec.h; sourceTree = ""; }; + 253652EB511794ED195C5EFB6B721D90 /* SDAsyncBlockOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAsyncBlockOperation.h; path = SDWebImage/Private/SDAsyncBlockOperation.h; sourceTree = ""; }; + 2628A10E591F7247B058A04ABEDEF0CE /* SDmetamacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDmetamacros.h; path = SDWebImage/Private/SDmetamacros.h; sourceTree = ""; }; + 26632BF1573382E5076307FEF5547CBA /* SDWebImageWebPCoder.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImageWebPCoder.release.xcconfig; sourceTree = ""; }; + 267E323578FFDAFDC4B9A235178BC8C9 /* SDWebImageDownloaderRequestModifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderRequestModifier.m; path = SDWebImage/Core/SDWebImageDownloaderRequestModifier.m; sourceTree = ""; }; + 27DE23B07C2353E26C4FCDF59F3792C7 /* SDWeakProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWeakProxy.m; path = SDWebImage/Private/SDWeakProxy.m; sourceTree = ""; }; + 2858359302BE791217CFCF3BA0EB069A /* common_sse2.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = common_sse2.h; path = src/dsp/common_sse2.h; sourceTree = ""; }; + 28F7EB0DF852DEFC4204A37EE5A542DC /* dec_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_neon.c; path = src/dsp/dec_neon.c; sourceTree = ""; }; + 2ACA7BF5F31AECC38E208E04B30680E9 /* filters_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_utils.c; path = src/utils/filters_utils.c; sourceTree = ""; }; + 2AE0D280D017F1372720FBB48213ED82 /* SDAnimatedImagePlayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImagePlayer.m; path = SDWebImage/Core/SDAnimatedImagePlayer.m; sourceTree = ""; }; + 2CD29D8335CBBF074A4BD3A12C588FC2 /* UIView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCache.m"; path = "SDWebImage/Core/UIView+WebCache.m"; sourceTree = ""; }; + 2D3E248E8EC54055C830B8E877ACBC2A /* quant.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = quant.h; path = src/dsp/quant.h; sourceTree = ""; }; + 2E5F25723C0BD6A706AFD3EA15D15BF5 /* cost_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_sse2.c; path = src/dsp/cost_sse2.c; sourceTree = ""; }; + 2F6FF0D21CE328D625C601243A01B4E2 /* SDWebImage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.release.xcconfig; sourceTree = ""; }; + 2F8106CE13DB175CBF5F0F9CFE701820 /* webp_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = webp_dec.c; path = src/dec/webp_dec.c; sourceTree = ""; }; + 30073E7033BC9AEFE8C6A9CFFCC74494 /* thread_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = thread_utils.h; path = src/utils/thread_utils.h; sourceTree = ""; }; + 301CF252102ADA342E9A50987DC2A19B /* SDImageCacheConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheConfig.m; path = SDWebImage/Core/SDImageCacheConfig.m; sourceTree = ""; }; + 32B6946A8B223A1202C8EAA0B911D68A /* upsampling_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_mips_dsp_r2.c; path = src/dsp/upsampling_mips_dsp_r2.c; sourceTree = ""; }; + 3317E991B6F00C4F95662015DB6E2FCC /* SDWeakProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWeakProxy.h; path = SDWebImage/Private/SDWeakProxy.h; sourceTree = ""; }; + 337AC89CD023E7066FF8D7B9B780DA6C /* demux.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = demux.h; path = src/webp/demux.h; sourceTree = ""; }; + 3386112FE1F10338CA81856A145904F6 /* UIView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCache.h"; path = "SDWebImage/Core/UIView+WebCache.h"; sourceTree = ""; }; + 35EF36A799B84547B6952F09332F0FF2 /* NSData+ImageContentType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSData+ImageContentType.h"; path = "SDWebImage/Core/NSData+ImageContentType.h"; sourceTree = ""; }; + 3867EF74B8F253E696B2D7791AE8422D /* SDWebImageCacheKeyFilter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCacheKeyFilter.m; path = SDWebImage/Core/SDWebImageCacheKeyFilter.m; sourceTree = ""; }; + 3905E209BA104742A8F6F82F5CBAF9FD /* SDImageWebPCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageWebPCoder.h; path = SDWebImageWebPCoder/Classes/SDImageWebPCoder.h; sourceTree = ""; }; + 39687BD8B8DF046A1089BA37F9121765 /* vp8li_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8li_enc.h; path = src/enc/vp8li_enc.h; sourceTree = ""; }; + 3A079F9CEB212334376FB3C441D82BE0 /* frame_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = frame_dec.c; path = src/dec/frame_dec.c; sourceTree = ""; }; + 3C0F94F43CC16C0A6CD89D1644B7B531 /* SDWebImageDownloaderDecryptor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderDecryptor.h; path = SDWebImage/Core/SDWebImageDownloaderDecryptor.h; sourceTree = ""; }; + 3EA01B4E1C500B7E694B9F6B14EC23CD /* dec_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_sse41.c; path = src/dsp/dec_sse41.c; sourceTree = ""; }; + 3ED7D18833F77609CBC54363FAB15CD2 /* anim_decode.c */ = {isa = PBXFileReference; includeInIndex = 1; name = anim_decode.c; path = src/demux/anim_decode.c; sourceTree = ""; }; + 3FCFAF804FD8E30B51E6BC6B0192F53C /* SDImageFrame.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageFrame.h; path = SDWebImage/Core/SDImageFrame.h; sourceTree = ""; }; + 407E2FC06BDC8AFECEBAB10C9DBC32C0 /* SDWebImageDownloaderConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderConfig.h; path = SDWebImage/Core/SDWebImageDownloaderConfig.h; sourceTree = ""; }; + 41406E32711CC8BC3A0191642D644777 /* SDWebImageWebPCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageWebPCoder.h; path = SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h; sourceTree = ""; }; + 419D930EA5419E8E842286174ABA0238 /* UIImage+ExtendedCacheData.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+ExtendedCacheData.m"; path = "SDWebImage/Core/UIImage+ExtendedCacheData.m"; sourceTree = ""; }; + 41F39803C444C7C9DE0EB0B404B816A0 /* dec_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_sse2.c; path = src/dsp/dec_sse2.c; sourceTree = ""; }; + 425A9FDE527245E1F5D3F6BF5A29DF7D /* SDImageCoderHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCoderHelper.m; path = SDWebImage/Core/SDImageCoderHelper.m; sourceTree = ""; }; + 427094677819A231C25413A893205961 /* yuv_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_mips_dsp_r2.c; path = src/dsp/yuv_mips_dsp_r2.c; sourceTree = ""; }; + 428E5AB5460842BEABBFA0E83D4746ED /* SDImageWebPCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageWebPCoder.m; path = SDWebImageWebPCoder/Classes/SDImageWebPCoder.m; sourceTree = ""; }; + 429891BE1A900CF163AD30A1313B2777 /* UIButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIButton+WebCache.h"; path = "SDWebImage/Core/UIButton+WebCache.h"; sourceTree = ""; }; + 4354B9C8DAFE2F7C7CBD62D3357C16EF /* SDWebImageOptionsProcessor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageOptionsProcessor.m; path = SDWebImage/Core/SDWebImageOptionsProcessor.m; sourceTree = ""; }; + 43C1AA5165AB3874E0E0FB1C4DFEA136 /* filters_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_sse2.c; path = src/dsp/filters_sse2.c; sourceTree = ""; }; + 43FE039B6426CD1DAB0C957EA30BB49C /* NSBezierPath+SDRoundedCorners.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSBezierPath+SDRoundedCorners.m"; path = "SDWebImage/Private/NSBezierPath+SDRoundedCorners.m"; sourceTree = ""; }; + 448F86FD2D8BD5FCF05BFE6FB4DB4E72 /* quant_levels_dec_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = quant_levels_dec_utils.h; path = src/utils/quant_levels_dec_utils.h; sourceTree = ""; }; + 449A368A273C009024AD2920345A6FC8 /* rescaler_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_msa.c; path = src/dsp/rescaler_msa.c; sourceTree = ""; }; + 456B2194AF3E69711C33F97E515C973D /* common_sse41.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = common_sse41.h; path = src/dsp/common_sse41.h; sourceTree = ""; }; + 45EE10EC4201C8A94253286EF5007E86 /* SDWebImageDownloaderOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderOperation.h; path = SDWebImage/Core/SDWebImageDownloaderOperation.h; sourceTree = ""; }; + 46DD0765B822D133DDB17B312055CA5F /* syntax_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = syntax_enc.c; path = src/enc/syntax_enc.c; sourceTree = ""; }; + 47912CE175BA212563F5D2C38E18E770 /* buffer_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = buffer_dec.c; path = src/dec/buffer_dec.c; sourceTree = ""; }; + 485AB5CDC42B78091D3B799BD9C13E13 /* SDImageGraphics.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageGraphics.m; path = SDWebImage/Core/SDImageGraphics.m; sourceTree = ""; }; + 489F588BD9F7399173BB64441A80C26C /* SDAnimatedImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "SDAnimatedImageView+WebCache.h"; path = "SDWebImage/Core/SDAnimatedImageView+WebCache.h"; sourceTree = ""; }; + 4901A535626C107259275B83642C536F /* SDImageHEICCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageHEICCoder.m; path = SDWebImage/Core/SDImageHEICCoder.m; sourceTree = ""; }; + 4AE73858BDED6C9AC98D4EBC5611303A /* UIImage+MemoryCacheCost.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+MemoryCacheCost.h"; path = "SDWebImage/Core/UIImage+MemoryCacheCost.h"; sourceTree = ""; }; + 4B8354E0C70E43B86BF07A80B7E145A4 /* yuv.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = yuv.h; path = src/dsp/yuv.h; sourceTree = ""; }; + 4CEA2F3A1ACF2069715EA051CDED72C0 /* libwebp-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "libwebp-prefix.pch"; sourceTree = ""; }; + 4E9BA39C74333E685A8D77D9F3FEAC3C /* Pods-BAWKWebView-WebP-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-BAWKWebView-WebP-acknowledgements.markdown"; sourceTree = ""; }; + 500DABB4E012E698A10866644EE65801 /* enc_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_mips_dsp_r2.c; path = src/dsp/enc_mips_dsp_r2.c; sourceTree = ""; }; + 5044CCABE41EA5742CEAFCFD4FE4D8BF /* utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = utils.h; path = src/utils/utils.h; sourceTree = ""; }; + 506A4792D0DC3B1F6FB10F4220672D38 /* SDImageIOAnimatedCoderInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOAnimatedCoderInternal.h; path = SDWebImage/Private/SDImageIOAnimatedCoderInternal.h; sourceTree = ""; }; + 508B8F61FDF5D858802ECF6ADF1F3F18 /* SDWebImageDownloaderRequestModifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderRequestModifier.h; path = SDWebImage/Core/SDWebImageDownloaderRequestModifier.h; sourceTree = ""; }; + 51269C442DA0D95DA54206819DF3A296 /* rescaler_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_mips32.c; path = src/dsp/rescaler_mips32.c; sourceTree = ""; }; + 51856D2B46FD9DD64A53377DE0CAAD43 /* UIImage+ExtendedCacheData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+ExtendedCacheData.h"; path = "SDWebImage/Core/UIImage+ExtendedCacheData.h"; sourceTree = ""; }; + 5371A4704EAE384A037A199286A12179 /* SDMemoryCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDMemoryCache.h; path = SDWebImage/Core/SDMemoryCache.h; sourceTree = ""; }; + 546DF3CB4540BC175F7327D57AA7BBE5 /* alpha_processing.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing.c; path = src/dsp/alpha_processing.c; sourceTree = ""; }; + 54A7E4B4B358362B2206810B679131CD /* SDImageCachesManagerOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCachesManagerOperation.h; path = SDWebImage/Private/SDImageCachesManagerOperation.h; sourceTree = ""; }; + 54E143A88200B1660DFCA6625E72E8E2 /* SDWebImageTransition.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageTransition.h; path = SDWebImage/Core/SDWebImageTransition.h; sourceTree = ""; }; + 5559EE269536D40564DDA2E3C4EDEE51 /* SDWebImageDownloaderConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderConfig.m; path = SDWebImage/Core/SDWebImageDownloaderConfig.m; sourceTree = ""; }; + 55F01B7A768A9D12518E8A1380EC17E2 /* libwebp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = libwebp.release.xcconfig; sourceTree = ""; }; + 569E3EE14BE61EFCE9CCF52FFD3AF14A /* quant_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_enc.c; path = src/enc/quant_enc.c; sourceTree = ""; }; + 56E472CD3A69CCDECE520B239A3A67A2 /* huffman_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = huffman_utils.h; path = src/utils/huffman_utils.h; sourceTree = ""; }; + 58268CB6ACE2615B68EAA512BDEF11A0 /* SDImageFrame.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageFrame.m; path = SDWebImage/Core/SDImageFrame.m; sourceTree = ""; }; + 5C0978491FDDF92929C2BF5B55FD95FC /* picture_tools_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_tools_enc.c; path = src/enc/picture_tools_enc.c; sourceTree = ""; }; + 5E4674603A5D5B9215FFA0F8E69F8B71 /* liblibwebp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = liblibwebp.a; path = liblibwebp.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 5FC5F4CB280162DF1BA990E6F1D59A15 /* lossless_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_sse2.c; path = src/dsp/lossless_sse2.c; sourceTree = ""; }; + 6079682185772D3181714CA23438B786 /* lossless_common.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = lossless_common.h; path = src/dsp/lossless_common.h; sourceTree = ""; }; + 615CE109EAED55DA7628F0689DF864FE /* filters_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_msa.c; path = src/dsp/filters_msa.c; sourceTree = ""; }; + 62BCD13F736C59657BD2DFD3964B8D91 /* SDAnimatedImageView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImageView.h; path = SDWebImage/Core/SDAnimatedImageView.h; sourceTree = ""; }; + 630A9AD278AB2DE8C97390C65F3C0BB0 /* picture_csp_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_csp_enc.c; path = src/enc/picture_csp_enc.c; sourceTree = ""; }; + 637F61AB5953C5703B43DCF27E97EFB5 /* Pods-BAWKWebView-WebP-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-BAWKWebView-WebP-acknowledgements.plist"; sourceTree = ""; }; + 638B8EBB10F02A66F176A72990E664D9 /* huffman_encode_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = huffman_encode_utils.h; path = src/utils/huffman_encode_utils.h; sourceTree = ""; }; + 63A3A0E64307760192B0C76157066418 /* ssim_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = ssim_sse2.c; path = src/dsp/ssim_sse2.c; sourceTree = ""; }; + 64425064EF8E31B7ABB836B8B5C3ADCE /* idec_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = idec_dec.c; path = src/dec/idec_dec.c; sourceTree = ""; }; + 654142E9D3FD4A5C8FBD0347C57A1AE8 /* cost_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_enc.c; path = src/enc/cost_enc.c; sourceTree = ""; }; + 65670E4F13A9198B3245543188ACEDA1 /* SDDiskCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDiskCache.h; path = SDWebImage/Core/SDDiskCache.h; sourceTree = ""; }; + 656D61FCFDECEC913336AE3EC9FB1392 /* rescaler.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler.c; path = src/dsp/rescaler.c; sourceTree = ""; }; + 65CB4EE6E95D8B8A51CCD29243CE160B /* rescaler_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_mips_dsp_r2.c; path = src/dsp/rescaler_mips_dsp_r2.c; sourceTree = ""; }; + 6697C2E81FDA6E41CE332945075A5102 /* SDImageGIFCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageGIFCoder.m; path = SDWebImage/Core/SDImageGIFCoder.m; sourceTree = ""; }; + 67CBDFCB3248D1813A8DC65CC2AFF8E2 /* NSBezierPath+SDRoundedCorners.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSBezierPath+SDRoundedCorners.h"; path = "SDWebImage/Private/NSBezierPath+SDRoundedCorners.h"; sourceTree = ""; }; + 67E3099D24C9F8F960DAA3F9336AB51D /* UIImage+MemoryCacheCost.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+MemoryCacheCost.m"; path = "SDWebImage/Core/UIImage+MemoryCacheCost.m"; sourceTree = ""; }; + 685F396B8F514708AC61D24B0DD8FFB4 /* tree_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = tree_dec.c; path = src/dec/tree_dec.c; sourceTree = ""; }; + 68653626F07B23B7CC4054D2A8E4173F /* UIImage+GIF.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+GIF.m"; path = "SDWebImage/Core/UIImage+GIF.m"; sourceTree = ""; }; + 688DD3B6CC9E0F4AB549ABCE81C2DCA2 /* picture_psnr_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_psnr_enc.c; path = src/enc/picture_psnr_enc.c; sourceTree = ""; }; + 698EE24AFF693B12323714B8F3E60F2A /* enc_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_mips32.c; path = src/dsp/enc_mips32.c; sourceTree = ""; }; + 6A1C22ECB48BA441CEA6ACE4764BCC6B /* UIColor+SDHexString.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIColor+SDHexString.m"; path = "SDWebImage/Private/UIColor+SDHexString.m"; sourceTree = ""; }; + 6B31F8F79ECA5CD63A02E88FC3C4AE24 /* SDAnimatedImagePlayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImagePlayer.h; path = SDWebImage/Core/SDAnimatedImagePlayer.h; sourceTree = ""; }; + 6C2D2602A8B094EAAB8FEB8DD82E1F63 /* SDWebImageDownloaderResponseModifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderResponseModifier.m; path = SDWebImage/Core/SDWebImageDownloaderResponseModifier.m; sourceTree = ""; }; + 6D0A65137436FD41880D7F4CAB18DFA8 /* rescaler_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_neon.c; path = src/dsp/rescaler_neon.c; sourceTree = ""; }; + 6DE71D55940622EAAB38B3B370F2A0D1 /* yuv_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_mips32.c; path = src/dsp/yuv_mips32.c; sourceTree = ""; }; + 6F96B3D5B2A23A9D07A38B914BFF63ED /* SDWebImageDefine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDefine.h; path = SDWebImage/Core/SDWebImageDefine.h; sourceTree = ""; }; + 701D7C8A50E500BDA3C223A795FBAB4F /* random_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = random_utils.c; path = src/utils/random_utils.c; sourceTree = ""; }; + 70EE27FDF304C3D3BFD902BA0BB74EFA /* cost_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_neon.c; path = src/dsp/cost_neon.c; sourceTree = ""; }; + 712E86C301578212ED0BF401E84D2626 /* bit_writer_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = bit_writer_utils.h; path = src/utils/bit_writer_utils.h; sourceTree = ""; }; + 71A01D3A9B19518A970B60DAE7C31D9F /* SDImageHEICCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageHEICCoder.h; path = SDWebImage/Core/SDImageHEICCoder.h; sourceTree = ""; }; + 71A34BAA26BE9C8BD3AC4C0C805E46BE /* SDWebImageDownloaderDecryptor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderDecryptor.m; path = SDWebImage/Core/SDWebImageDownloaderDecryptor.m; sourceTree = ""; }; + 72CA495D5F2AAF4CFA8AD5175F80CF99 /* UIImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+WebCache.m"; path = "SDWebImage/Core/UIImageView+WebCache.m"; sourceTree = ""; }; + 735FEBD5D6DC34B3EC46716ABC469DFD /* bit_reader_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = bit_reader_utils.c; path = src/utils/bit_reader_utils.c; sourceTree = ""; }; + 739D9DE8A7D3B46680C3121BE283EE7C /* SDImageAPNGCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAPNGCoder.m; path = SDWebImage/Core/SDImageAPNGCoder.m; sourceTree = ""; }; + 77A678CA2F4F8850CC4ECA54B50733D3 /* lossless_enc_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_neon.c; path = src/dsp/lossless_enc_neon.c; sourceTree = ""; }; + 7855A3B9A4996CA08A3628DB22A1FF9B /* dsp.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = dsp.h; path = src/dsp/dsp.h; sourceTree = ""; }; + 789FAB4C6021BED2E076268995F11151 /* SDAssociatedObject.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAssociatedObject.h; path = SDWebImage/Private/SDAssociatedObject.h; sourceTree = ""; }; + 795E7361C397B82F7AF9B0522C423631 /* filters_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_neon.c; path = src/dsp/filters_neon.c; sourceTree = ""; }; + 79807143CF24A8A9E12257EF52E7C798 /* NSButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSButton+WebCache.m"; path = "SDWebImage/Core/NSButton+WebCache.m"; sourceTree = ""; }; + 7A82461EAF937CBCE7F6715D2ABA1F86 /* SDWebImageError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageError.h; path = SDWebImage/Core/SDWebImageError.h; sourceTree = ""; }; + 7A94D5041EFB1BE739B10F32B9109C89 /* backward_references_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = backward_references_enc.c; path = src/enc/backward_references_enc.c; sourceTree = ""; }; + 7B6AAD4D936A94AC0AFF1FEBF82EAC3E /* SDWebImageDownloaderResponseModifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderResponseModifier.h; path = SDWebImage/Core/SDWebImageDownloaderResponseModifier.h; sourceTree = ""; }; + 7C5C0062A1DC0B03BC8F473CD1618A1D /* SDImageAPNGCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAPNGCoder.h; path = SDWebImage/Core/SDImageAPNGCoder.h; sourceTree = ""; }; + 7D31ABA2898D63DDF256F2DE7DEE008D /* SDImageCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCache.m; path = SDWebImage/Core/SDImageCache.m; sourceTree = ""; }; + 7F28BE05E4A9070D7550FDD260425207 /* predictor_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = predictor_enc.c; path = src/enc/predictor_enc.c; sourceTree = ""; }; + 7F9A1C6869ED094429C45D4DAE165123 /* dec_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_mips_dsp_r2.c; path = src/dsp/dec_mips_dsp_r2.c; sourceTree = ""; }; + 81134A2B51EF1E9769C25C86E7CDA557 /* enc_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_neon.c; path = src/dsp/enc_neon.c; sourceTree = ""; }; + 814C58D710276564466EA2D9FB423DDF /* SDWebImageDefine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDefine.m; path = SDWebImage/Core/SDWebImageDefine.m; sourceTree = ""; }; + 823CD61606E64DE09EA8B0A7098EA69C /* SDImageCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCoder.h; path = SDWebImage/Core/SDImageCoder.h; sourceTree = ""; }; + 82CA3EA44F49C93A74F44B16D19577D1 /* SDWebImageDownloaderOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderOperation.m; path = SDWebImage/Core/SDWebImageDownloaderOperation.m; sourceTree = ""; }; + 832C487AEE86FA8381A769717FDBB4F3 /* random_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = random_utils.h; path = src/utils/random_utils.h; sourceTree = ""; }; + 848919187EAE1845DE108F91C4788D92 /* quant_levels_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = quant_levels_utils.h; path = src/utils/quant_levels_utils.h; sourceTree = ""; }; + 858C8799676F96546557800BBAE8B29C /* SDWebImageWebPCoder-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImageWebPCoder-prefix.pch"; sourceTree = ""; }; + 860D3DC7DD98E18840EF00D42BDA2EB5 /* alpha_processing_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_mips_dsp_r2.c; path = src/dsp/alpha_processing_mips_dsp_r2.c; sourceTree = ""; }; + 86318FA7B1E0D4A05494806421454FC1 /* UIImage+ForceDecode.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+ForceDecode.m"; path = "SDWebImage/Core/UIImage+ForceDecode.m"; sourceTree = ""; }; + 8631AA3705B14FC06725870AF2098876 /* frame_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = frame_enc.c; path = src/enc/frame_enc.c; sourceTree = ""; }; + 872B2DAA2839A5F0DC73F4BBEF5F30BA /* SDImageCoderHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCoderHelper.h; path = SDWebImage/Core/SDImageCoderHelper.h; sourceTree = ""; }; + 8A1BE91B1D9CF1A76B4AD036EF6F2083 /* SDImageAssetManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAssetManager.m; path = SDWebImage/Private/SDImageAssetManager.m; sourceTree = ""; }; + 8AF4E628BE5962EA00B460FEFA228C9C /* vp8_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vp8_dec.c; path = src/dec/vp8_dec.c; sourceTree = ""; }; + 8DDD2A637F3C7D13EB6130690B6A7092 /* filters_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = filters_utils.h; path = src/utils/filters_utils.h; sourceTree = ""; }; + 8E008E4991A1E60B40604A264A9686E6 /* UIImageView+HighlightedWebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+HighlightedWebCache.m"; path = "SDWebImage/Core/UIImageView+HighlightedWebCache.m"; sourceTree = ""; }; + 8E106551C0153474DAA8600167310529 /* SDImageCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCoder.m; path = SDWebImage/Core/SDImageCoder.m; sourceTree = ""; }; + 8E126939437E647D99070B72CAA63485 /* SDImageIOAnimatedCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOAnimatedCoder.h; path = SDWebImage/Core/SDImageIOAnimatedCoder.h; sourceTree = ""; }; + 8E2300C531A10C40A97208327AB5DC21 /* SDImageTransformer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageTransformer.h; path = SDWebImage/Core/SDImageTransformer.h; sourceTree = ""; }; + 8F4647DFCC892C1D9184B9AFB0F19492 /* alpha_processing_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_processing_neon.c; path = src/dsp/alpha_processing_neon.c; sourceTree = ""; }; + 8F7BC976A23406357C4A5255EE32593A /* SDWebImageIndicator.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageIndicator.m; path = SDWebImage/Core/SDWebImageIndicator.m; sourceTree = ""; }; + 8FEB9687617CC701191071B437EB401E /* UIImage+Transform.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+Transform.h"; path = "SDWebImage/Core/UIImage+Transform.h"; sourceTree = ""; }; + 91859BBA5BDFE60D3DA2DC2E4B07B871 /* SDWebImageOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOperation.h; path = SDWebImage/Core/SDWebImageOperation.h; sourceTree = ""; }; + 92C73DC7D95687D39A422F70CF1124FB /* SDWebImageCacheSerializer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCacheSerializer.h; path = SDWebImage/Core/SDWebImageCacheSerializer.h; sourceTree = ""; }; + 92F9A018826DD5779801B17CA5060FB3 /* SDImageCachesManagerOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCachesManagerOperation.m; path = SDWebImage/Private/SDImageCachesManagerOperation.m; sourceTree = ""; }; + 932C94E12692B0133BFA50C1E4182514 /* dec_clip_tables.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_clip_tables.c; path = src/dsp/dec_clip_tables.c; sourceTree = ""; }; + 93E219E2DB402589E9D5BCAD9108B7BA /* SDAnimatedImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "SDAnimatedImageView+WebCache.m"; path = "SDWebImage/Core/SDAnimatedImageView+WebCache.m"; sourceTree = ""; }; + 940477999AB354DCFFD92C4F5BA913F6 /* color_cache_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = color_cache_utils.c; path = src/utils/color_cache_utils.c; sourceTree = ""; }; + 94337390ACE4D0E155B249C628EDCAC2 /* SDImageCacheConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheConfig.h; path = SDWebImage/Core/SDImageCacheConfig.h; sourceTree = ""; }; + 9434D5B1AC6A6FAB61E7EF65643DCD26 /* Pods-BAWKWebView-WebP-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-BAWKWebView-WebP-dummy.m"; sourceTree = ""; }; + 948A5E94C3110E422BCDDB6414398D4F /* upsampling.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling.c; path = src/dsp/upsampling.c; sourceTree = ""; }; + 9635A36CA0F476722A547A3420248CBA /* SDWebImageWebPCoder-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SDWebImageWebPCoder-dummy.m"; sourceTree = ""; }; + 972FAFE56E1FEAEA7DCE4D590D66A35B /* SDImageAWebPCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAWebPCoder.h; path = SDWebImage/Core/SDImageAWebPCoder.h; sourceTree = ""; }; + 97C19F1FAB46731FA0A30FC7B7ACD97A /* UIImage+Transform.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+Transform.m"; path = "SDWebImage/Core/UIImage+Transform.m"; sourceTree = ""; }; + 97CE87763CA381D1914A8265E43A1B22 /* color_cache_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = color_cache_utils.h; path = src/utils/color_cache_utils.h; sourceTree = ""; }; + 992148CEC0C7E43DA82A3A83A236F0A1 /* yuv_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_sse2.c; path = src/dsp/yuv_sse2.c; sourceTree = ""; }; + 992777B890E8FC5A26DB1AE09612AF71 /* libwebp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = libwebp.debug.xcconfig; sourceTree = ""; }; + 994B15BA78A7B1D18BA237F47D68CDE2 /* animi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = animi.h; path = src/mux/animi.h; sourceTree = ""; }; + 99C151ED7706B7BEB7BF48DB11D2781D /* SDAnimatedImageRep.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImageRep.m; path = SDWebImage/Core/SDAnimatedImageRep.m; sourceTree = ""; }; + 9A56CC7629A574539DE00913DA9F9D51 /* msa_macro.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = msa_macro.h; path = src/dsp/msa_macro.h; sourceTree = ""; }; + 9A64F761ADE9AC0F94436DE531412FEA /* mux_types.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mux_types.h; path = src/webp/mux_types.h; sourceTree = ""; }; + 9AB14D98E07F7191DC89130C4DBF75D2 /* SDWebImageTransition.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageTransition.m; path = SDWebImage/Core/SDWebImageTransition.m; sourceTree = ""; }; + 9C16F211D473D298BCC97742917ECED6 /* SDWebImageCacheSerializer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCacheSerializer.m; path = SDWebImage/Core/SDWebImageCacheSerializer.m; sourceTree = ""; }; + 9CEE5E4C5A9240ABFF8E9AA325A6657D /* mips_macro.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mips_macro.h; path = src/dsp/mips_macro.h; sourceTree = ""; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9D993B8A1462C2729568F605D819ADAC /* rescaler_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_sse2.c; path = src/dsp/rescaler_sse2.c; sourceTree = ""; }; + 9DE787876603CEC024673C3CCBD3C459 /* vp8l_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vp8l_enc.c; path = src/enc/vp8l_enc.c; sourceTree = ""; }; + 9DFDB1065284F4475C6F6EF376BB6B1B /* SDWebImageOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageOperation.m; path = SDWebImage/Core/SDWebImageOperation.m; sourceTree = ""; }; + 9ED8BE2AA578E3F99B031456DC1701A7 /* muxinternal.c */ = {isa = PBXFileReference; includeInIndex = 1; name = muxinternal.c; path = src/mux/muxinternal.c; sourceTree = ""; }; + 9F5C18C6A44C78E0C17488AE6E34181F /* enc_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_sse2.c; path = src/dsp/enc_sse2.c; sourceTree = ""; }; + 9FB74AF230A96B1FADD4F5C974FC25B3 /* SDWebImageManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageManager.m; path = SDWebImage/Core/SDWebImageManager.m; sourceTree = ""; }; + 9FB8C99D8153F25731F71D4405F44E7B /* SDWebImageIndicator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageIndicator.h; path = SDWebImage/Core/SDWebImageIndicator.h; sourceTree = ""; }; + A0C0C862382A0C71B7EE93D640AB18DF /* SDInternalMacros.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDInternalMacros.m; path = SDWebImage/Private/SDInternalMacros.m; sourceTree = ""; }; + A12BA1BA784BD44315BE95ED319CF777 /* SDWebImageDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloader.m; path = SDWebImage/Core/SDWebImageDownloader.m; sourceTree = ""; }; + A29B321ED4B750E9C205F80ECF0389D9 /* lossless_enc_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_sse41.c; path = src/dsp/lossless_enc_sse41.c; sourceTree = ""; }; + A33C05440153918258AFE8535AF4FB2D /* muxedit.c */ = {isa = PBXFileReference; includeInIndex = 1; name = muxedit.c; path = src/mux/muxedit.c; sourceTree = ""; }; + A362D2AC9D8BFEDFCF02EF5B5872C6E5 /* libwebp-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "libwebp-dummy.m"; sourceTree = ""; }; + A423723451A23CE7DD4B14D159DB7FD1 /* thread_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = thread_utils.c; path = src/utils/thread_utils.c; sourceTree = ""; }; + A424BB66D5D816AD67494E1E23655B56 /* SDWebImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloader.h; path = SDWebImage/Core/SDWebImageDownloader.h; sourceTree = ""; }; + A6551F5FD3B67506E8C6EF85AD5BB8E6 /* utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = utils.c; path = src/utils/utils.c; sourceTree = ""; }; + A66863CBA74AEFBE89EE13AF4523883D /* NSButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSButton+WebCache.h"; path = "SDWebImage/Core/NSButton+WebCache.h"; sourceTree = ""; }; + A77486D18FF1AD89325C58576B8D30F3 /* yuv.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv.c; path = src/dsp/yuv.c; sourceTree = ""; }; + A82F773962BB8FBC3A376473872CA8C7 /* lossless.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless.c; path = src/dsp/lossless.c; sourceTree = ""; }; + A8484176A5674E26F28594CC1E80D4AF /* SDImageCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCache.h; path = SDWebImage/Core/SDImageCache.h; sourceTree = ""; }; + A93499F8924850040794B9CC25EDAD0D /* rescaler_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rescaler_utils.c; path = src/utils/rescaler_utils.c; sourceTree = ""; }; + A96E0BF839FBB5FA5E4881EFF0075F33 /* iterator_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = iterator_enc.c; path = src/enc/iterator_enc.c; sourceTree = ""; }; + A97B2ADFC6CB29FBB1A3F3A486D16DA5 /* SDAnimatedImageView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImageView.m; path = SDWebImage/Core/SDAnimatedImageView.m; sourceTree = ""; }; + AB452B4FF9F52D40EBDFBAFDE0FB1BB2 /* SDImageCacheDefine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheDefine.m; path = SDWebImage/Core/SDImageCacheDefine.m; sourceTree = ""; }; + AC453575A9B1479737BE92C85D58F404 /* encode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = encode.h; path = src/webp/encode.h; sourceTree = ""; }; + AC51FA1F692785C8AB7A3AFA7908DB94 /* SDMemoryCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDMemoryCache.m; path = SDWebImage/Core/SDMemoryCache.m; sourceTree = ""; }; + AD0671F8FAAC30B0AAC2E1118D76504A /* SDImageLoadersManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageLoadersManager.h; path = SDWebImage/Core/SDImageLoadersManager.h; sourceTree = ""; }; + AD97B9DD9CA1701117DD0FC372F425E7 /* SDWebImageTransitionInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageTransitionInternal.h; path = SDWebImage/Private/SDWebImageTransitionInternal.h; sourceTree = ""; }; + ADAC297FA7DEA3659613BA7575B100BE /* alpha_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_enc.c; path = src/enc/alpha_enc.c; sourceTree = ""; }; + AF2334E42FFFF6958CEB654321BA0461 /* vp8l_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vp8l_dec.c; path = src/dec/vp8l_dec.c; sourceTree = ""; }; + B0B214D775196BA7CA8E17E53048A493 /* libSDWebImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libSDWebImage.a; path = libSDWebImage.a; sourceTree = BUILT_PRODUCTS_DIR; }; + B226A7EF5F755ED0576120E2D1380626 /* SDWebImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImage.h; path = WebImage/SDWebImage.h; sourceTree = ""; }; + B38DE92A0C5EB539760189D2CDE29A1B /* SDDeviceHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDeviceHelper.h; path = SDWebImage/Private/SDDeviceHelper.h; sourceTree = ""; }; + B3C8D6506A238A98A7074048E747A2AF /* picture_rescale_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_rescale_enc.c; path = src/enc/picture_rescale_enc.c; sourceTree = ""; }; + B3DB6A2E81FFBF74DBD8E7E5B74A8BC2 /* lossless_enc_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_msa.c; path = src/dsp/lossless_enc_msa.c; sourceTree = ""; }; + B49025D3D96BD270CB7C8CEAAF4975DF /* SDDiskCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDiskCache.m; path = SDWebImage/Core/SDDiskCache.m; sourceTree = ""; }; + B5167E7BD4063FE890336C2A31A9EB2D /* io_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = io_dec.c; path = src/dec/io_dec.c; sourceTree = ""; }; + B5341C81FD8164D34464E4C65A71A38F /* backward_references_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = backward_references_enc.h; path = src/enc/backward_references_enc.h; sourceTree = ""; }; + B593D791E9C7497ABD44153D85AF387F /* alphai_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = alphai_dec.h; path = src/dec/alphai_dec.h; sourceTree = ""; }; + B742B21BE7A1B51123CB7B8F0D762BC3 /* enc_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_msa.c; path = src/dsp/enc_msa.c; sourceTree = ""; }; + B74692ED6CE9609D0A5083FF249F1E32 /* upsampling_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_sse41.c; path = src/dsp/upsampling_sse41.c; sourceTree = ""; }; + B833207026BEEFBAA17FF0092B8C530A /* SDImageAssetManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAssetManager.h; path = SDWebImage/Private/SDImageAssetManager.h; sourceTree = ""; }; + B8A88D36C6F7CB80D68D253C5F2CA4A6 /* cost_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost_mips32.c; path = src/dsp/cost_mips32.c; sourceTree = ""; }; + B8C6F69E2D8557D9E9CDFB861B34732E /* anim_encode.c */ = {isa = PBXFileReference; includeInIndex = 1; name = anim_encode.c; path = src/mux/anim_encode.c; sourceTree = ""; }; + B94EC22AFAC1FCF25AA0D40822F47EFB /* neon.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = neon.h; path = src/dsp/neon.h; sourceTree = ""; }; + B9837BB7B02C1D7AE129699575101D90 /* UIImage+WebP.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+WebP.h"; path = "SDWebImageWebPCoder/Classes/UIImage+WebP.h"; sourceTree = ""; }; + BA5CE2BFC24586CFF94E9473F7FFBD38 /* yuv_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_sse41.c; path = src/dsp/yuv_sse41.c; sourceTree = ""; }; + BB4E3E20E058939EF27C1234AF7731DB /* lossless_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_mips_dsp_r2.c; path = src/dsp/lossless_mips_dsp_r2.c; sourceTree = ""; }; + BB9BD2E7755FDAC06FE953BA39521E7F /* UIImage+GIF.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+GIF.h"; path = "SDWebImage/Core/UIImage+GIF.h"; sourceTree = ""; }; + BC514E97874756CF723CD9C227D25821 /* SDWebImagePrefetcher.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImagePrefetcher.h; path = SDWebImage/Core/SDWebImagePrefetcher.h; sourceTree = ""; }; + BD3D11F35240310344FF338A07E7DB2C /* demux.c */ = {isa = PBXFileReference; includeInIndex = 1; name = demux.c; path = src/demux/demux.c; sourceTree = ""; }; + BED4187FF922BD66BCF1836AA1840EA9 /* cpu.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cpu.c; path = src/dsp/cpu.c; sourceTree = ""; }; + C01A1C5580029DC7C0BED6D098FF3E1A /* NSImage+Compatibility.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSImage+Compatibility.m"; path = "SDWebImage/Core/NSImage+Compatibility.m"; sourceTree = ""; }; + C054F83487804DD694545FB162D9C8F6 /* lossless_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_msa.c; path = src/dsp/lossless_msa.c; sourceTree = ""; }; + C16E25503E607EAC5050032A3830F6D2 /* muxi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = muxi.h; path = src/mux/muxi.h; sourceTree = ""; }; + C2CFF5784D76CB5B7AB3A53C09EAE183 /* SDWebImageCompat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCompat.m; path = SDWebImage/Core/SDWebImageCompat.m; sourceTree = ""; }; + C331E73CB9956C3A47EB050C5284E1E9 /* picture_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = picture_enc.c; path = src/enc/picture_enc.c; sourceTree = ""; }; + C3BD2F2695D78B34BE61DCB7A3F49506 /* vp8li_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8li_dec.h; path = src/dec/vp8li_dec.h; sourceTree = ""; }; + C3C13E1629109271CE3801E01A800D6F /* UIImage+MultiFormat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+MultiFormat.m"; path = "SDWebImage/Core/UIImage+MultiFormat.m"; sourceTree = ""; }; + C43E79CCA96219D7EFF19311AA16AC0D /* huffman_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = huffman_utils.c; path = src/utils/huffman_utils.c; sourceTree = ""; }; + C4F89B11717564BD917713BF9BC43AB7 /* UIImage+WebP.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+WebP.m"; path = "SDWebImageWebPCoder/Classes/UIImage+WebP.m"; sourceTree = ""; }; + C743217EEF2C96947C8741E20115BB2A /* SDImageTransformer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageTransformer.m; path = SDWebImage/Core/SDImageTransformer.m; sourceTree = ""; }; + C7E9447EC067DCAE1E837578E5687E6A /* filter_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filter_enc.c; path = src/enc/filter_enc.c; sourceTree = ""; }; + C938DF53E5F06FBD446E965954D5C3FA /* SDWebImageCacheKeyFilter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCacheKeyFilter.h; path = SDWebImage/Core/SDWebImageCacheKeyFilter.h; sourceTree = ""; }; + CA42508944B98472636D44EDCB93717B /* UIImage+Metadata.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+Metadata.h"; path = "SDWebImage/Core/UIImage+Metadata.h"; sourceTree = ""; }; + CAA4FCA7109FB564EE03E5EE9F72D395 /* SDImageIOCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageIOCoder.m; path = SDWebImage/Core/SDImageIOCoder.m; sourceTree = ""; }; + CB33AB9A72465E1C5149610903F8EF0F /* SDFileAttributeHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDFileAttributeHelper.m; path = SDWebImage/Private/SDFileAttributeHelper.m; sourceTree = ""; }; + CB54E44D409AF3B6897F1A1C204B9A91 /* SDDisplayLink.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDisplayLink.m; path = SDWebImage/Private/SDDisplayLink.m; sourceTree = ""; }; + CBCA557985E0BA75F6D2308F192699A6 /* lossless_enc_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_sse2.c; path = src/dsp/lossless_enc_sse2.c; sourceTree = ""; }; + CBE40E7F8EFCE740B3AF6D3999F1E81B /* webpi_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = webpi_dec.h; path = src/dec/webpi_dec.h; sourceTree = ""; }; + CC2FA4E892843BA74D4D27D049D571C3 /* SDImageCodersManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCodersManager.m; path = SDWebImage/Core/SDImageCodersManager.m; sourceTree = ""; }; + CD61694F952DC7B18DBE9C9E6F81AED9 /* Pods-BAWKWebView-WebP.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-BAWKWebView-WebP.debug.xcconfig"; sourceTree = ""; }; + CDB71EB09859840923789536E53BE7D9 /* UIButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIButton+WebCache.m"; path = "SDWebImage/Core/UIButton+WebCache.m"; sourceTree = ""; }; + CE5AB59DDD3B1D6CCEB33D6FF7085E34 /* vp8i_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8i_enc.h; path = src/enc/vp8i_enc.h; sourceTree = ""; }; + CED09E0AF970EAA30254705AB2C13320 /* dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec.c; path = src/dsp/dec.c; sourceTree = ""; }; + CEE1D9965D20D5182C9F25464DAC1311 /* types.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = types.h; path = src/webp/types.h; sourceTree = ""; }; + D011FB8E98EF4CE59E212257B2EFF494 /* SDImageIOCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOCoder.h; path = SDWebImage/Core/SDImageIOCoder.h; sourceTree = ""; }; + D174A9FBCEED3C22F04B413FC72B81C8 /* SDImageGraphics.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageGraphics.h; path = SDWebImage/Core/SDImageGraphics.h; sourceTree = ""; }; + D29438AB0D95887FAD693FAABE7388CF /* SDAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImage.h; path = SDWebImage/Core/SDAnimatedImage.h; sourceTree = ""; }; + D4939C05C953084D0ECE3CCFC994412F /* endian_inl_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = endian_inl_utils.h; path = src/utils/endian_inl_utils.h; sourceTree = ""; }; + D4BF5D0BBED0BE006C5EA8F37E33FDDE /* enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc.c; path = src/dsp/enc.c; sourceTree = ""; }; + D63A7ED6B9FD93C31690C65EFE8C6240 /* UIImageView+HighlightedWebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+HighlightedWebCache.h"; path = "SDWebImage/Core/UIImageView+HighlightedWebCache.h"; sourceTree = ""; }; + D642896A970E6F98AC0ED4FF58C04E62 /* SDWebImageOptionsProcessor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOptionsProcessor.h; path = SDWebImage/Core/SDWebImageOptionsProcessor.h; sourceTree = ""; }; + D799A2DCFD3EBBB0BD25AF5BA2C58D2E /* SDImageGIFCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageGIFCoder.h; path = SDWebImage/Core/SDImageGIFCoder.h; sourceTree = ""; }; + D7B599AEF5906119593C4415A569A965 /* UIView+WebCacheOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCacheOperation.m"; path = "SDWebImage/Core/UIView+WebCacheOperation.m"; sourceTree = ""; }; + D913111E9E80427C23F96BB2A490A944 /* quant_levels_dec_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_levels_dec_utils.c; path = src/utils/quant_levels_dec_utils.c; sourceTree = ""; }; + D9578E54949E867487C1EBB6A8A431A0 /* quant_levels_utils.c */ = {isa = PBXFileReference; includeInIndex = 1; name = quant_levels_utils.c; path = src/utils/quant_levels_utils.c; sourceTree = ""; }; + D9CF7967267CDBA3CF9C803A10B55AB0 /* tree_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = tree_enc.c; path = src/enc/tree_enc.c; sourceTree = ""; }; + DA421095BCEC53647FB897801228780E /* webp_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = webp_enc.c; path = src/enc/webp_enc.c; sourceTree = ""; }; + DA7A17FA6FBE2F5A9D9C17F8464D63E4 /* SDWebImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SDWebImage-dummy.m"; sourceTree = ""; }; + DA801E0CF44B487078180A7F6260A58C /* upsampling_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_neon.c; path = src/dsp/upsampling_neon.c; sourceTree = ""; }; + DD05C335753E2D65F7CC565D7D63D969 /* upsampling_sse2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = upsampling_sse2.c; path = src/dsp/upsampling_sse2.c; sourceTree = ""; }; + DF2082EB5ACA3EA02E0A7CFA82300A3A /* NSImage+Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSImage+Compatibility.h"; path = "SDWebImage/Core/NSImage+Compatibility.h"; sourceTree = ""; }; + DF34878FC57FE08E0BAAD5C093634924 /* SDGraphicsImageRenderer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDGraphicsImageRenderer.m; path = SDWebImage/Core/SDGraphicsImageRenderer.m; sourceTree = ""; }; + E2E2B34A277FBE73FD15136A1770B428 /* SDGraphicsImageRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDGraphicsImageRenderer.h; path = SDWebImage/Core/SDGraphicsImageRenderer.h; sourceTree = ""; }; + E2FFE2459B53D5341EE0A8FF62FEE5FD /* Pods-BAWKWebView-WebP.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-BAWKWebView-WebP.release.xcconfig"; sourceTree = ""; }; + E329EDA5C820E6C28A241D5FBCE65901 /* filters_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters_mips_dsp_r2.c; path = src/dsp/filters_mips_dsp_r2.c; sourceTree = ""; }; + E41CD925C690C57ACA44FC4DE0FDAFB3 /* SDWebImagePrefetcher.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImagePrefetcher.m; path = SDWebImage/Core/SDWebImagePrefetcher.m; sourceTree = ""; }; + E44FB57F8AB7B60CB04372529B01252D /* yuv_neon.c */ = {isa = PBXFileReference; includeInIndex = 1; name = yuv_neon.c; path = src/dsp/yuv_neon.c; sourceTree = ""; }; + E45404B8A6BE99A0CDA859B6A4A5ED51 /* decode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = decode.h; path = src/webp/decode.h; sourceTree = ""; }; + E509325FF13F871273F75FF6402298A6 /* SDAsyncBlockOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAsyncBlockOperation.m; path = SDWebImage/Private/SDAsyncBlockOperation.m; sourceTree = ""; }; + E799994A459804CFCBEE4EB30271D6AE /* analysis_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = analysis_enc.c; path = src/enc/analysis_enc.c; sourceTree = ""; }; + E95C3D59659B8B104F7E0B1C2E36CF3E /* SDAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImage.m; path = SDWebImage/Core/SDAnimatedImage.m; sourceTree = ""; }; + E97780AAE3F369BAB592180F7B1A8DF1 /* bit_reader_inl_utils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = bit_reader_inl_utils.h; path = src/utils/bit_reader_inl_utils.h; sourceTree = ""; }; + E9AEAA3FC9BE6932536E22F299CC238E /* SDImageCachesManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCachesManager.h; path = SDWebImage/Core/SDImageCachesManager.h; sourceTree = ""; }; + E9C5F9C107727038DABE5155C40A6DF9 /* mux.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mux.h; path = src/webp/mux.h; sourceTree = ""; }; + EA75FD90AB06ACF4D46F3DD6825D4346 /* token_enc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = token_enc.c; path = src/enc/token_enc.c; sourceTree = ""; }; + EA8E08701909B2FA6765439E729A14A7 /* SDWebImageManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageManager.h; path = SDWebImage/Core/SDWebImageManager.h; sourceTree = ""; }; + EA95257254528720C049397BAA70ABBD /* dec_mips32.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_mips32.c; path = src/dsp/dec_mips32.c; sourceTree = ""; }; + EAF09AE6AD92259E3C4B2F2DDCF70E84 /* UIImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+WebCache.h"; path = "SDWebImage/Core/UIImageView+WebCache.h"; sourceTree = ""; }; + EC580A1C3D9E603F717A38067FFC907D /* SDDeviceHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDeviceHelper.m; path = SDWebImage/Private/SDDeviceHelper.m; sourceTree = ""; }; + ECEC083D29CFE502B6B2AF42C5466252 /* cost.c */ = {isa = PBXFileReference; includeInIndex = 1; name = cost.c; path = src/dsp/cost.c; sourceTree = ""; }; + ECFE44B3A484160231C7DCBB78E10CE4 /* enc_sse41.c */ = {isa = PBXFileReference; includeInIndex = 1; name = enc_sse41.c; path = src/dsp/enc_sse41.c; sourceTree = ""; }; + EE0E634CDAE78D3986030EEA35DF6B03 /* alpha_dec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alpha_dec.c; path = src/dec/alpha_dec.c; sourceTree = ""; }; + EF209152A5EACB0EEF8DDF68465DDE18 /* UIImage+Metadata.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+Metadata.m"; path = "SDWebImage/Core/UIImage+Metadata.m"; sourceTree = ""; }; + F1FBD5606CB448B2D7C30B285887CF15 /* lossless_enc_mips_dsp_r2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = lossless_enc_mips_dsp_r2.c; path = src/dsp/lossless_enc_mips_dsp_r2.c; sourceTree = ""; }; + F2931E61306D7CF23EF5996F09A2A47E /* SDImageIOAnimatedCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageIOAnimatedCoder.m; path = SDWebImage/Core/SDImageIOAnimatedCoder.m; sourceTree = ""; }; + F2A8E69F923031BCB7A079DF9189ABC0 /* SDAssociatedObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAssociatedObject.m; path = SDWebImage/Private/SDAssociatedObject.m; sourceTree = ""; }; + F52DC798FA646192C280EE311B9E300F /* cost_enc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = cost_enc.h; path = src/enc/cost_enc.h; sourceTree = ""; }; + F782112C8359584641C16072010AAB1E /* SDDisplayLink.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDisplayLink.h; path = SDWebImage/Private/SDDisplayLink.h; sourceTree = ""; }; + F79A3BE8868384BDB3B3B6EF21408138 /* vp8i_dec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vp8i_dec.h; path = src/dec/vp8i_dec.h; sourceTree = ""; }; + F9147CF43D6C46D070F3EFE5E478AC15 /* UIImage+MultiFormat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+MultiFormat.h"; path = "SDWebImage/Core/UIImage+MultiFormat.h"; sourceTree = ""; }; + FAE5C886CC0D22024F0903EF88475013 /* filters.c */ = {isa = PBXFileReference; includeInIndex = 1; name = filters.c; path = src/dsp/filters.c; sourceTree = ""; }; + FBDF1C7952EDD15269EBAB8550413C8E /* SDImageLoadersManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageLoadersManager.m; path = SDWebImage/Core/SDImageLoadersManager.m; sourceTree = ""; }; + FC12A660482A54F04DAF4EEBD964443B /* SDImageCacheDefine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheDefine.h; path = SDWebImage/Core/SDImageCacheDefine.h; sourceTree = ""; }; + FC94FDD53FA4237C8FF66857C7C55A4D /* SDWebImageError.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageError.m; path = SDWebImage/Core/SDWebImageError.m; sourceTree = ""; }; + FCF61D9B2B75054A9A3185DDC609B7FF /* libSDWebImageWebPCoder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libSDWebImageWebPCoder.a; path = libSDWebImageWebPCoder.a; sourceTree = BUILT_PRODUCTS_DIR; }; + FDBA1FBD2EC501DD5987933648A0A20E /* muxread.c */ = {isa = PBXFileReference; includeInIndex = 1; name = muxread.c; path = src/mux/muxread.c; sourceTree = ""; }; + FEFFFA7EC311308C06795D55656F0F3B /* ssim.c */ = {isa = PBXFileReference; includeInIndex = 1; name = ssim.c; path = src/dsp/ssim.c; sourceTree = ""; }; + FF2D0954C4DA8B111AB8F16716837067 /* dec_msa.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dec_msa.c; path = src/dsp/dec_msa.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 9E6190D3B278B96FE94F59D1F6838897 /* Frameworks */ = { + 2A007AB7EFA7E79E16C0EF6DFB79B4AF /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5C37C6B83D1B70CFAEB769216CBAE8FB /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - A007D207146C9360A206ECFB05096937 /* Frameworks */ = { + 3B91D1A4A91356045257E05C1040D5D1 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0E05908EDF73911E21B79943CD40224F /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - DD4EE3937410E5A99B7FF51F7CE987D7 /* Frameworks */ = { + 9A8E5412CB0D1C65610568029C8C6240 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B5FC95BA1E86633B8BFEE211EB680299 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D9285098BFAFC2A8CFF7A94F95B6CF9B /* Foundation.framework in Frameworks */, - 3FDA4E7EE8A4B1A312E779032F2CAAF5 /* ImageIO.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 02870D86F9FB577F5AA1F745A0ECE255 /* Pods-BAWKWebView-WebP */ = { + 0A9A48E9D2ABD092DD64161C5CBE153F /* Support Files */ = { isa = PBXGroup; children = ( - 9B370B8576F255230DA4AC1F32A77E57 /* Pods-BAWKWebView-WebP-acknowledgements.markdown */, - B327E482F5224CB51BC6D7CDB2490DD5 /* Pods-BAWKWebView-WebP-acknowledgements.plist */, - 991780B5D6746B152A725F9F025D1BDA /* Pods-BAWKWebView-WebP-dummy.m */, - 50A623F0F49F43F0F6CA81A309F432FD /* Pods-BAWKWebView-WebP-frameworks.sh */, - 36310DA34C483EA51C8004AA287098E7 /* Pods-BAWKWebView-WebP-resources.sh */, - DEC54D6DBDF533CE64763A734C28800F /* Pods-BAWKWebView-WebP.debug.xcconfig */, - 962D0A891D2167D695D508748BF135C5 /* Pods-BAWKWebView-WebP.release.xcconfig */, - ); - name = "Pods-BAWKWebView-WebP"; - path = "Target Support Files/Pods-BAWKWebView-WebP"; - sourceTree = ""; - }; - 1F261E77984E6C46ED0071B1BEB45EA3 /* Support Files */ = { - isa = PBXGroup; - children = ( - 1F0BB5092F1868E49C84E448F2AA0656 /* SDWebImage.xcconfig */, - FB4613EE0FC905FB5248D149C312DFC2 /* SDWebImage-dummy.m */, - 989D0080ABA043EC5FBEE939572CA2D1 /* SDWebImage-prefix.pch */, + 9635A36CA0F476722A547A3420248CBA /* SDWebImageWebPCoder-dummy.m */, + 858C8799676F96546557800BBAE8B29C /* SDWebImageWebPCoder-prefix.pch */, + 158D5B12074B414E45620EBA540E900A /* SDWebImageWebPCoder.debug.xcconfig */, + 26632BF1573382E5076307FEF5547CBA /* SDWebImageWebPCoder.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/SDWebImage"; + path = "../Target Support Files/SDWebImageWebPCoder"; sourceTree = ""; }; - 1FADA36CBBEBF5DF6696194D87183478 /* iOS */ = { + 20EB0866889E60ED86B61A3EA0915532 /* mux */ = { isa = PBXGroup; children = ( - 6CE29CF4FF5C02028C0A06EC0D2A6120 /* Foundation.framework */, - 635A4BD1CEF7E623C71F97A54BFC3616 /* ImageIO.framework */, + B8C6F69E2D8557D9E9CDFB861B34732E /* anim_encode.c */, + 994B15BA78A7B1D18BA237F47D68CDE2 /* animi.h */, + E9C5F9C107727038DABE5155C40A6DF9 /* mux.h */, + A33C05440153918258AFE8535AF4FB2D /* muxedit.c */, + C16E25503E607EAC5050032A3830F6D2 /* muxi.h */, + 9ED8BE2AA578E3F99B031456DC1701A7 /* muxinternal.c */, + FDBA1FBD2EC501DD5987933648A0A20E /* muxread.c */, ); - name = iOS; + name = mux; sourceTree = ""; }; - 3F8FDAA1E3BD5B10B57E17383D35BD5E /* core */ = { + 24A2A6EA023399A5BA44FB482B81D57F /* Support Files */ = { isa = PBXGroup; children = ( - BAEDB1C378E6A55D0BE217E9FF79E125 /* alpha_dec.c */, - 62A8D117E6CD9448B247F71253369976 /* alpha_enc.c */, - CF9A2EBC31A738ED93A5D7E2DB4338E8 /* alpha_processing.c */, - A37CCF97524596901920DBA9A3015CB7 /* alpha_processing_mips_dsp_r2.c */, - 67B00680366E3EA7E93925A84077868D /* alpha_processing_neon.c */, - D2CC26F0959A37DA471F1E448111A793 /* alpha_processing_sse2.c */, - 3BEF0676AE3CE1AEA70EF6D8DF98E3FE /* alpha_processing_sse41.c */, - DFB11E49EADA83FC3535B17967EA57E5 /* alphai_dec.h */, - A6907917A14351DA9EE12DD00F190A4B /* analysis_enc.c */, - 65E51A17AAC90C3F6D2B8A4439095455 /* argb.c */, - 50FB840B590B4374D733ED71CFFE2795 /* argb_mips_dsp_r2.c */, - 9E6D5AD78E69842B3D620E77B6D5512C /* argb_sse2.c */, - CD037CC5E1FC47EC82B4749A4EDD5B15 /* backward_references_enc.c */, - 4A820C9586B5D047627D09F99756A668 /* backward_references_enc.h */, - 4D1A5AC41A5B9A7F4F8F3D54DF1A11B4 /* bit_reader_inl_utils.h */, - E6C02AFFE197D5A81026DA7BE4E40E42 /* bit_reader_utils.c */, - DFD6820FEAFAB43C4CFF511817518B98 /* bit_reader_utils.h */, - D2223C785D56C3C8BE5AC3755E78651C /* bit_writer_utils.c */, - 04D0AD8C7CE04A56EE1961218A1930A5 /* bit_writer_utils.h */, - 8E689CA2AECAC018C014ABBBD5CC4434 /* buffer_dec.c */, - CB21FA537FE1AEACE2DDAB762B57550E /* color_cache_utils.c */, - F25106E1CBAC5EBEBD6AFE53C38DD7A2 /* color_cache_utils.h */, - 7A0A95D9E76BBB7F2096B5717F7C19A6 /* common_dec.h */, - 956D21517B420AB4AD8864E879BE0513 /* common_sse2.h */, - D1F6422437DE4FDF6D687A53902030DF /* config_enc.c */, - 276CCC3883E4B31EB6BB9EB32AF6CFFA /* cost.c */, - 004BE760467DF39A207D21A452DB83FC /* cost_enc.c */, - F7670DBA6B12AF94EE4EC6836F6B5FD7 /* cost_enc.h */, - 25FBEEF91BB61CA112652CECA03A3929 /* cost_mips32.c */, - F73F01C41DF3DDFA6A57FAE8287E4337 /* cost_mips_dsp_r2.c */, - AF3D593EFD9D540B4EA0A86538C74D71 /* cost_sse2.c */, - C69C05EA665406970B3F3FE259C85457 /* cpu.c */, - F05BDEE1D6FE9B73E198CF508089CF6A /* dec.c */, - 4ECD30A295759333C72E68CBC8DA0A1C /* dec_clip_tables.c */, - CAC88D87B34B5F6676DE25A807EF9FD0 /* dec_mips32.c */, - 5F13947BA1CC99B85FAE2A5029A7E0D1 /* dec_mips_dsp_r2.c */, - 5B0C538EC10EEA8B39D3868A1213B6A0 /* dec_msa.c */, - 4F3728BBEF5FA7E4311802DF38EC348B /* dec_neon.c */, - ECA83D82F08ED3D5A3234D79C4DEC298 /* dec_sse2.c */, - F8EF0FD5910DDFE44B7B0C2EEBFD3D20 /* dec_sse41.c */, - A215E046AB052D89704AD143C424C6AF /* delta_palettization_enc.c */, - 0501062747DF50ABDF95881FF4450E96 /* delta_palettization_enc.h */, - 96CDEAF3F8C8DCB78C3507C88BD1CBDD /* dsp.h */, - 373FE07527F74CF6418844EF3D73C61C /* enc.c */, - 967DAE3CCD5520E6076C0F516A1F1947 /* enc_avx2.c */, - 52604F8208305AC14CC070FFCC1477F8 /* enc_mips32.c */, - 328D7FBF646C01B71BD7D597A60756B0 /* enc_mips_dsp_r2.c */, - 3EDFE2ED55510BEAB58FF8071C305091 /* enc_msa.c */, - F1018EC0C8920BBC5D5084576B9C7D63 /* enc_neon.c */, - 616E799AC9183EFE82F9A398E57273D6 /* enc_sse2.c */, - 23805FB6FEDC8941E4CEBB83D9FC9B85 /* enc_sse41.c */, - E814A16CC5832448B34DEBAFEBA038A3 /* endian_inl_utils.h */, - 0231121C915B17518BC7904985B3AB58 /* filter_enc.c */, - 75A8F849CD87952D8A6014163D20A16A /* filters.c */, - C6097A7BC5AD677EADFF5D32164D2254 /* filters_mips_dsp_r2.c */, - A18E39F77E4D2A85C1C9241830AF749A /* filters_msa.c */, - A6F6448B21C37A0CFC1111D5F97D46BB /* filters_neon.c */, - A1FA76313E48A0C5EEEB3AE2ECAEE0B1 /* filters_sse2.c */, - A7D5DD007CAC0B662476ECD3315BA0DE /* filters_utils.c */, - E53F34B3A22FBF443D71AE2EA3EF3B8B /* filters_utils.h */, - B75BE342AB4E0CBA7E1E370C7D1E6066 /* frame_dec.c */, - F20A8DA5F0CF034E1B0D64BD6FE69FC0 /* frame_enc.c */, - 7C1C934A7F0E5A033012E3B421743036 /* histogram_enc.c */, - 6D4608A7510ED3BAF1DCC57A8D3C19DD /* histogram_enc.h */, - E384D0E6C5EE52559BB411F9A0507DB3 /* huffman_encode_utils.c */, - 8C265B12DACF50DDD5ED7DE64D08C06B /* huffman_encode_utils.h */, - 1BBAD9DAA8309B8F3E0E3C5D6D37D3A7 /* huffman_utils.c */, - A429697AC37504BA2A4EB42B29D782AE /* huffman_utils.h */, - 31D3AE61A99A7CBBA417A1EF6EDB23FC /* idec_dec.c */, - 7159B700027C2E55475CD79B6EB4F7E8 /* io_dec.c */, - 15AFB3D60C26D76087CFF0B10517880D /* iterator_enc.c */, - 3DECF924EDD277C948133751B5EC9C6E /* lossless.c */, - 07BA03AD0A344385FD4371A7049309CA /* lossless.h */, - 024ECB129F48BFB81041D67EEAD1DB38 /* lossless_common.h */, - 2D8773D101F94C4AC16510F8AC97BB65 /* lossless_enc.c */, - ED381B1B005427FE1A42700263176914 /* lossless_enc_mips32.c */, - 9BCD0D26A417326FEA42AB6009D05344 /* lossless_enc_mips_dsp_r2.c */, - 668D284887BD84066B67AB8D4C53E2C3 /* lossless_enc_msa.c */, - 1044C6C9147747629C5A8CCB8ED5A94B /* lossless_enc_neon.c */, - C0476AAA1524F15BD78E0B27BDD7167E /* lossless_enc_sse2.c */, - AC092801836BE501CE5D1430194412BB /* lossless_enc_sse41.c */, - 40697FA767824DC00D42B15F251526F0 /* lossless_mips_dsp_r2.c */, - 7B907599F625013154ABE72A5D8CAE14 /* lossless_msa.c */, - 45022404D6FA3F5A1AB05E26B0996769 /* lossless_neon.c */, - EFD848156EF77FAC4DB3228C2FD9ABF4 /* lossless_sse2.c */, - 8B4AE3EA5395CB7073DF8F42D5DEB6C2 /* mips_macro.h */, - 62ED24F22812AAE5F17EC3515C7B07B5 /* msa_macro.h */, - D338ED8DAB214F41D35FE22F2F70D9ED /* near_lossless_enc.c */, - A64880B6650EFEF31BA6FFD685BD6336 /* neon.h */, - D5FA2D02464DD4A65CF2E80F4B6C9180 /* picture_csp_enc.c */, - CB62B1B588F319B60D0B4AE68FD72774 /* picture_enc.c */, - AC8828C8FC8859C3DF8E60751F90B20C /* picture_psnr_enc.c */, - CDD1D2CF00D57E04E69B18783E9C7CE8 /* picture_rescale_enc.c */, - 052DB1D40AD9EEFC1F0D3BD096167DFA /* picture_tools_enc.c */, - 93C6EA48352BA7397DE40A9D3FC57609 /* predictor_enc.c */, - 4586E938EFAF02D88CF835FC6B02B371 /* quant_dec.c */, - 189A7AB49F9A87D232247067CC3D4258 /* quant_enc.c */, - C76E93FF974EDFDAB0F986B17E44B7CA /* quant_levels_dec_utils.c */, - 2ED36195C66ABF5658D777F6B645BB11 /* quant_levels_dec_utils.h */, - 63020B60D2C9FC34306AC8E7C82C9116 /* quant_levels_utils.c */, - 76EFAE2D57D909A3DC8F94FB83EE25E3 /* quant_levels_utils.h */, - A202AAC4C8E98D65D0BD7F4EA8DD5587 /* random_utils.c */, - F3DCFF2DCAE34CE7E4D92CE9C7366E97 /* random_utils.h */, - 6653CFE2F496F33977E841E6081907F2 /* rescaler.c */, - E094215356DD4E0C796FF030A5B6C4B7 /* rescaler_mips32.c */, - 1FF5497429B3BB2A0F55B983A3594FCE /* rescaler_mips_dsp_r2.c */, - B82868D4CF37761788C57E478FE98880 /* rescaler_msa.c */, - DD48E681F598C2826B4FBB4B36CC46CA /* rescaler_neon.c */, - 7D382756D49126C8879D0F173B2A136C /* rescaler_sse2.c */, - 8978776383E9C9DBEF2C387C5FD10CFA /* rescaler_utils.c */, - 8DB5308B72FB4C93850FBA59103F6183 /* rescaler_utils.h */, - 9F52BF281F3D298C5DCA1027FD8CC759 /* syntax_enc.c */, - B78F3B48B08D8BEFF8B1F7863912B573 /* thread_utils.c */, - 300804CC1C47DCADA733F47EEAE58E42 /* thread_utils.h */, - 50DBE1FF96163239B49D9945C62230A3 /* token_enc.c */, - A417768449EA1B267BCC899E9CDA199C /* tree_dec.c */, - AF821DF0B457FF4B923C234F4A7E1C50 /* tree_enc.c */, - 9A9C7CED37BE90E6C2F5F6358E9A7984 /* upsampling.c */, - F375518518A0506826C246E90CD100AB /* upsampling_mips_dsp_r2.c */, - 41718D837EAA5F1D3BBB4DC60006C316 /* upsampling_msa.c */, - A3B977DB3CD08004F1ED08E08A61D42C /* upsampling_neon.c */, - F2E9F537965331CDABA2D3930215A123 /* upsampling_sse2.c */, - 7533C70B69DB2C1E51452D44250C2083 /* utils.c */, - 56441565BFB2BA0078F6383393FA14BD /* utils.h */, - 6146B50AB836D198B07F92CBFF27F16C /* vp8_dec.c */, - F765E2246CE0E6CE15C6F9352E62F5DF /* vp8_dec.h */, - 1B58F4E5B5D02276A53066814E94B524 /* vp8i_dec.h */, - 0E9050392CA9C1DB374D4DB0B19BBACC /* vp8i_enc.h */, - 6F1A7A427E65B94BA17EE92199885DE3 /* vp8l_dec.c */, - E4B62DF08D0017EFD1397CA69FC31728 /* vp8l_enc.c */, - F06B41EB1517F712C1BE8F7625102CA5 /* vp8li_dec.h */, - 34F2B0137AD76AE6A507D5E3A905F795 /* vp8li_enc.h */, - 5038D75A2F0E1B08B278CCFE2D753B42 /* webp_dec.c */, - 3DFBC70F76B6EEFD8E9310BC4997F45A /* webp_enc.c */, - 9D015B31E9944123CC9BAC63E47891F7 /* webpi_dec.h */, - 551217A993D070E428227F487341110E /* yuv.c */, - 146CC9720D7B923F4DA0EFA0C02B86AC /* yuv.h */, - FFBEFE612DDE08FECB0A38AC11CFDC65 /* yuv_mips32.c */, - 768465670623F75542DD8B2237C47917 /* yuv_mips_dsp_r2.c */, - E8E893045FACB15A3E7F8BACB56A2179 /* yuv_sse2.c */, + DA7A17FA6FBE2F5A9D9C17F8464D63E4 /* SDWebImage-dummy.m */, + 164DD2A67CBD3A44B38195E99221CDB3 /* SDWebImage-prefix.pch */, + 15DF3A2B1426ED2AC1A59FC36F9260E9 /* SDWebImage.debug.xcconfig */, + 2F6FF0D21CE328D625C601243A01B4E2 /* SDWebImage.release.xcconfig */, ); - name = core; + name = "Support Files"; + path = "../Target Support Files/SDWebImage"; sourceTree = ""; }; - 433CD3331B6C3787F473C941B61FC68F /* Frameworks */ = { + 31A6A1E304321687A911249A6BECFEC4 /* demux */ = { isa = PBXGroup; children = ( - 1FADA36CBBEBF5DF6696194D87183478 /* iOS */, + 3ED7D18833F77609CBC54363FAB15CD2 /* anim_decode.c */, + BD3D11F35240310344FF338A07E7DB2C /* demux.c */, + 337AC89CD023E7066FF8D7B9B780DA6C /* demux.h */, ); - name = Frameworks; + name = demux; sourceTree = ""; }; - 58A86D74B193359892784ECB5836748D /* WebP */ = { + 41E4F34D88E4FF9E1FDDA0A46CAE6F7C /* Products */ = { isa = PBXGroup; children = ( - 2A14B550C2A8A3798C6996D1C39E35B6 /* UIImage+WebP.h */, - 9098D0B5647E129B3DB16CB32FA48EB5 /* UIImage+WebP.m */, + 5E4674603A5D5B9215FFA0F8E69F8B71 /* liblibwebp.a */, + 1FF73CAC210F42D83D9A68A7813D6725 /* libPods-BAWKWebView-WebP.a */, + B0B214D775196BA7CA8E17E53048A493 /* libSDWebImage.a */, + FCF61D9B2B75054A9A3185DDC609B7FF /* libSDWebImageWebPCoder.a */, ); - name = WebP; + name = Products; sourceTree = ""; }; - 7DB346D0F39D3F0E887471402A8071AB = { + 44A1A257A5A95144657D64AC702DA6BD /* libwebp */ = { isa = PBXGroup; children = ( - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, - 433CD3331B6C3787F473C941B61FC68F /* Frameworks */, - 87B5F1172E129A18F402E1EE8669CB0A /* Pods */, - F6E31DDACE17E1A349BC8E8410B10B10 /* Products */, - E58597F6AF921D7D8D0D3EE234366599 /* Targets Support Files */, + 31A6A1E304321687A911249A6BECFEC4 /* demux */, + 20EB0866889E60ED86B61A3EA0915532 /* mux */, + 54FA9C5DD62186D82801ECD73CAF1271 /* Support Files */, + E8CC13F974B5BEF186562D5DAD523182 /* webp */, ); + name = libwebp; + path = libwebp; sourceTree = ""; }; - 87B5F1172E129A18F402E1EE8669CB0A /* Pods */ = { + 54FA9C5DD62186D82801ECD73CAF1271 /* Support Files */ = { isa = PBXGroup; children = ( - F22871F0FC4DC302A5F6E82B8C30EA11 /* libwebp */, - A669A88BD81A761372C7DB8436F37C32 /* SDWebImage */, + A362D2AC9D8BFEDFCF02EF5B5872C6E5 /* libwebp-dummy.m */, + 4CEA2F3A1ACF2069715EA051CDED72C0 /* libwebp-prefix.pch */, + 992777B890E8FC5A26DB1AE09612AF71 /* libwebp.debug.xcconfig */, + 55F01B7A768A9D12518E8A1380EC17E2 /* libwebp.release.xcconfig */, ); - name = Pods; + name = "Support Files"; + path = "../Target Support Files/libwebp"; sourceTree = ""; }; - 8B84A817189D61BA13A25568C4AC37BE /* webp */ = { + 6A75B1FEB15603402781095DB2BC27B4 /* SDWebImageWebPCoder */ = { isa = PBXGroup; children = ( - 82CEBA7D38FE8FBAC58EE4AF0A57AFA4 /* decode.h */, - B1ABFE7140FE1ABD314AD9A97E1F91F1 /* demux.h */, - 3E1EE565C4B417FED86AD12844B48937 /* encode.h */, - 5A1AEDD4D6CE0234EA47A9A0D9A3E4A2 /* format_constants.h */, - 49660BEDAA566C8693E20282A3F8DD2D /* mux.h */, - 94AB76933441E7D98010BCE1A68F9192 /* mux_types.h */, - 531BF50508FED07C5884D105EF31EF2B /* types.h */, + 3905E209BA104742A8F6F82F5CBAF9FD /* SDImageWebPCoder.h */, + 428E5AB5460842BEABBFA0E83D4746ED /* SDImageWebPCoder.m */, + 41406E32711CC8BC3A0191642D644777 /* SDWebImageWebPCoder.h */, + B9837BB7B02C1D7AE129699575101D90 /* UIImage+WebP.h */, + C4F89B11717564BD917713BF9BC43AB7 /* UIImage+WebP.m */, + 0A9A48E9D2ABD092DD64161C5CBE153F /* Support Files */, ); - name = webp; + name = SDWebImageWebPCoder; + path = SDWebImageWebPCoder; sourceTree = ""; }; - 9E19CE4FE50E456F961B372A40FFA9FD /* Core */ = { + 6D87738D92C4817A55CB674C92A327BA /* Core */ = { isa = PBXGroup; children = ( - 1FA5C79A6DC9B288DE03682D61EF8F84 /* NSData+ImageContentType.h */, - 993BCFE033C6E3D2E962620B184B7FA1 /* NSData+ImageContentType.m */, - 96B1A250CAD0F990FF7FA07BC3F489CC /* NSImage+WebCache.h */, - 6A698B17D4A618AF77F21F115599FA0F /* NSImage+WebCache.m */, - 8573E5FFF3999AC4CD1261C6E01CC65E /* SDImageCache.h */, - 339352C0B5D785A58F2F40C3A9DB8500 /* SDImageCache.m */, - 39A7E4C24006A7AB46A1704E784F10FA /* SDImageCacheConfig.h */, - AB76C0C252D5C80C00ED2F1E3F85D06D /* SDImageCacheConfig.m */, - 96C3B2B1349FB5BA91971F37B47A1A50 /* SDWebImageCompat.h */, - 797CCACA1FF334B81AC60A447F0DBA79 /* SDWebImageCompat.m */, - 0AE3EFD4958A608F90B0BE1730498928 /* SDWebImageDecoder.h */, - 7541F858B15FDCB24B7F35E657947D33 /* SDWebImageDecoder.m */, - 61A33BE896F83C07BD074408A1475EEF /* SDWebImageDownloader.h */, - BDC6F1EDF90E47B2A267CBA185FA2AC8 /* SDWebImageDownloader.m */, - BAD5AE968131E1EF2A84FEA1705A06DA /* SDWebImageDownloaderOperation.h */, - F6817F129F248B26709FF1FACACB3F1B /* SDWebImageDownloaderOperation.m */, - 4871F6C58E55217D10955C03B5C511E2 /* SDWebImageManager.h */, - B053BF8762763D45A322C072AF0F940E /* SDWebImageManager.m */, - 7C773770BA63E6D809D56EE6932CA759 /* SDWebImageOperation.h */, - A98E660E2FAC8EE420CB48B95AFE1FAA /* SDWebImagePrefetcher.h */, - B60D283A1491E38E530541E0E6F6A534 /* SDWebImagePrefetcher.m */, - AF4CB436A1905894FFF226874B234E52 /* UIButton+WebCache.h */, - D5C3472E5D8F4E603D4D66BF051C4101 /* UIButton+WebCache.m */, - D550C79ED74B00036054236337232B31 /* UIImage+GIF.h */, - B1F5D9B9A3031F0976C63E1C2C2A93CC /* UIImage+GIF.m */, - F7DE141E810176A48EF1F87DB1871154 /* UIImage+MultiFormat.h */, - 634DADD2C57B8F44DFFC6F71C9CE7438 /* UIImage+MultiFormat.m */, - DCF0FAD2DFB69A2201A5FE2B4541D9CB /* UIImageView+HighlightedWebCache.h */, - 92F1FE8CA757CC3D7E16149A98464295 /* UIImageView+HighlightedWebCache.m */, - F8CD6B8AE72082529B0F0BFA15C1082B /* UIImageView+WebCache.h */, - 44AAD21219953FB66BB2CBFFA5E0D02A /* UIImageView+WebCache.m */, - 208BE0C034E1DDD6DBFC8A3616E1C531 /* UIView+WebCache.h */, - 8C8E44FC00416EA4763BD37016000A4A /* UIView+WebCache.m */, - 0388506281CFBCACF326B7A9E30178A6 /* UIView+WebCacheOperation.h */, - 103CA74F155DBF4F4261A80F6F750D48 /* UIView+WebCacheOperation.m */, + 67CBDFCB3248D1813A8DC65CC2AFF8E2 /* NSBezierPath+SDRoundedCorners.h */, + 43FE039B6426CD1DAB0C957EA30BB49C /* NSBezierPath+SDRoundedCorners.m */, + A66863CBA74AEFBE89EE13AF4523883D /* NSButton+WebCache.h */, + 79807143CF24A8A9E12257EF52E7C798 /* NSButton+WebCache.m */, + 35EF36A799B84547B6952F09332F0FF2 /* NSData+ImageContentType.h */, + 058919D50C3BB7E6A85AB707380BF835 /* NSData+ImageContentType.m */, + DF2082EB5ACA3EA02E0A7CFA82300A3A /* NSImage+Compatibility.h */, + C01A1C5580029DC7C0BED6D098FF3E1A /* NSImage+Compatibility.m */, + D29438AB0D95887FAD693FAABE7388CF /* SDAnimatedImage.h */, + E95C3D59659B8B104F7E0B1C2E36CF3E /* SDAnimatedImage.m */, + 6B31F8F79ECA5CD63A02E88FC3C4AE24 /* SDAnimatedImagePlayer.h */, + 2AE0D280D017F1372720FBB48213ED82 /* SDAnimatedImagePlayer.m */, + 20E63DC1859B1BEBD6B5C88D50E6DB63 /* SDAnimatedImageRep.h */, + 99C151ED7706B7BEB7BF48DB11D2781D /* SDAnimatedImageRep.m */, + 62BCD13F736C59657BD2DFD3964B8D91 /* SDAnimatedImageView.h */, + A97B2ADFC6CB29FBB1A3F3A486D16DA5 /* SDAnimatedImageView.m */, + 489F588BD9F7399173BB64441A80C26C /* SDAnimatedImageView+WebCache.h */, + 93E219E2DB402589E9D5BCAD9108B7BA /* SDAnimatedImageView+WebCache.m */, + 789FAB4C6021BED2E076268995F11151 /* SDAssociatedObject.h */, + F2A8E69F923031BCB7A079DF9189ABC0 /* SDAssociatedObject.m */, + 253652EB511794ED195C5EFB6B721D90 /* SDAsyncBlockOperation.h */, + E509325FF13F871273F75FF6402298A6 /* SDAsyncBlockOperation.m */, + B38DE92A0C5EB539760189D2CDE29A1B /* SDDeviceHelper.h */, + EC580A1C3D9E603F717A38067FFC907D /* SDDeviceHelper.m */, + 65670E4F13A9198B3245543188ACEDA1 /* SDDiskCache.h */, + B49025D3D96BD270CB7C8CEAAF4975DF /* SDDiskCache.m */, + F782112C8359584641C16072010AAB1E /* SDDisplayLink.h */, + CB54E44D409AF3B6897F1A1C204B9A91 /* SDDisplayLink.m */, + 1BCA75CADACD909A6275041B19CC7820 /* SDFileAttributeHelper.h */, + CB33AB9A72465E1C5149610903F8EF0F /* SDFileAttributeHelper.m */, + E2E2B34A277FBE73FD15136A1770B428 /* SDGraphicsImageRenderer.h */, + DF34878FC57FE08E0BAAD5C093634924 /* SDGraphicsImageRenderer.m */, + 7C5C0062A1DC0B03BC8F473CD1618A1D /* SDImageAPNGCoder.h */, + 739D9DE8A7D3B46680C3121BE283EE7C /* SDImageAPNGCoder.m */, + B833207026BEEFBAA17FF0092B8C530A /* SDImageAssetManager.h */, + 8A1BE91B1D9CF1A76B4AD036EF6F2083 /* SDImageAssetManager.m */, + 972FAFE56E1FEAEA7DCE4D590D66A35B /* SDImageAWebPCoder.h */, + 00F48B414A782B5F543042D44B95E317 /* SDImageAWebPCoder.m */, + A8484176A5674E26F28594CC1E80D4AF /* SDImageCache.h */, + 7D31ABA2898D63DDF256F2DE7DEE008D /* SDImageCache.m */, + 94337390ACE4D0E155B249C628EDCAC2 /* SDImageCacheConfig.h */, + 301CF252102ADA342E9A50987DC2A19B /* SDImageCacheConfig.m */, + FC12A660482A54F04DAF4EEBD964443B /* SDImageCacheDefine.h */, + AB452B4FF9F52D40EBDFBAFDE0FB1BB2 /* SDImageCacheDefine.m */, + E9AEAA3FC9BE6932536E22F299CC238E /* SDImageCachesManager.h */, + 02932AE728BD3BB2B6921AA6C856FC7F /* SDImageCachesManager.m */, + 54A7E4B4B358362B2206810B679131CD /* SDImageCachesManagerOperation.h */, + 92F9A018826DD5779801B17CA5060FB3 /* SDImageCachesManagerOperation.m */, + 823CD61606E64DE09EA8B0A7098EA69C /* SDImageCoder.h */, + 8E106551C0153474DAA8600167310529 /* SDImageCoder.m */, + 872B2DAA2839A5F0DC73F4BBEF5F30BA /* SDImageCoderHelper.h */, + 425A9FDE527245E1F5D3F6BF5A29DF7D /* SDImageCoderHelper.m */, + 0F79B4188E77B515662B7AFB0CA514CC /* SDImageCodersManager.h */, + CC2FA4E892843BA74D4D27D049D571C3 /* SDImageCodersManager.m */, + 3FCFAF804FD8E30B51E6BC6B0192F53C /* SDImageFrame.h */, + 58268CB6ACE2615B68EAA512BDEF11A0 /* SDImageFrame.m */, + D799A2DCFD3EBBB0BD25AF5BA2C58D2E /* SDImageGIFCoder.h */, + 6697C2E81FDA6E41CE332945075A5102 /* SDImageGIFCoder.m */, + D174A9FBCEED3C22F04B413FC72B81C8 /* SDImageGraphics.h */, + 485AB5CDC42B78091D3B799BD9C13E13 /* SDImageGraphics.m */, + 71A01D3A9B19518A970B60DAE7C31D9F /* SDImageHEICCoder.h */, + 4901A535626C107259275B83642C536F /* SDImageHEICCoder.m */, + 8E126939437E647D99070B72CAA63485 /* SDImageIOAnimatedCoder.h */, + F2931E61306D7CF23EF5996F09A2A47E /* SDImageIOAnimatedCoder.m */, + 506A4792D0DC3B1F6FB10F4220672D38 /* SDImageIOAnimatedCoderInternal.h */, + D011FB8E98EF4CE59E212257B2EFF494 /* SDImageIOCoder.h */, + CAA4FCA7109FB564EE03E5EE9F72D395 /* SDImageIOCoder.m */, + 0105B67959BA81D85FD761F2B3C75F42 /* SDImageLoader.h */, + 17BA5A569562ECFD2A051820DA38E7F7 /* SDImageLoader.m */, + AD0671F8FAAC30B0AAC2E1118D76504A /* SDImageLoadersManager.h */, + FBDF1C7952EDD15269EBAB8550413C8E /* SDImageLoadersManager.m */, + 8E2300C531A10C40A97208327AB5DC21 /* SDImageTransformer.h */, + C743217EEF2C96947C8741E20115BB2A /* SDImageTransformer.m */, + 0E079B403D6D0B0B1040713F0111C3C4 /* SDInternalMacros.h */, + A0C0C862382A0C71B7EE93D640AB18DF /* SDInternalMacros.m */, + 5371A4704EAE384A037A199286A12179 /* SDMemoryCache.h */, + AC51FA1F692785C8AB7A3AFA7908DB94 /* SDMemoryCache.m */, + 2628A10E591F7247B058A04ABEDEF0CE /* SDmetamacros.h */, + 3317E991B6F00C4F95662015DB6E2FCC /* SDWeakProxy.h */, + 27DE23B07C2353E26C4FCDF59F3792C7 /* SDWeakProxy.m */, + B226A7EF5F755ED0576120E2D1380626 /* SDWebImage.h */, + C938DF53E5F06FBD446E965954D5C3FA /* SDWebImageCacheKeyFilter.h */, + 3867EF74B8F253E696B2D7791AE8422D /* SDWebImageCacheKeyFilter.m */, + 92C73DC7D95687D39A422F70CF1124FB /* SDWebImageCacheSerializer.h */, + 9C16F211D473D298BCC97742917ECED6 /* SDWebImageCacheSerializer.m */, + 1B8D9A85717B35BC24D75C80BB55B132 /* SDWebImageCompat.h */, + C2CFF5784D76CB5B7AB3A53C09EAE183 /* SDWebImageCompat.m */, + 6F96B3D5B2A23A9D07A38B914BFF63ED /* SDWebImageDefine.h */, + 814C58D710276564466EA2D9FB423DDF /* SDWebImageDefine.m */, + A424BB66D5D816AD67494E1E23655B56 /* SDWebImageDownloader.h */, + A12BA1BA784BD44315BE95ED319CF777 /* SDWebImageDownloader.m */, + 407E2FC06BDC8AFECEBAB10C9DBC32C0 /* SDWebImageDownloaderConfig.h */, + 5559EE269536D40564DDA2E3C4EDEE51 /* SDWebImageDownloaderConfig.m */, + 3C0F94F43CC16C0A6CD89D1644B7B531 /* SDWebImageDownloaderDecryptor.h */, + 71A34BAA26BE9C8BD3AC4C0C805E46BE /* SDWebImageDownloaderDecryptor.m */, + 45EE10EC4201C8A94253286EF5007E86 /* SDWebImageDownloaderOperation.h */, + 82CA3EA44F49C93A74F44B16D19577D1 /* SDWebImageDownloaderOperation.m */, + 508B8F61FDF5D858802ECF6ADF1F3F18 /* SDWebImageDownloaderRequestModifier.h */, + 267E323578FFDAFDC4B9A235178BC8C9 /* SDWebImageDownloaderRequestModifier.m */, + 7B6AAD4D936A94AC0AFF1FEBF82EAC3E /* SDWebImageDownloaderResponseModifier.h */, + 6C2D2602A8B094EAAB8FEB8DD82E1F63 /* SDWebImageDownloaderResponseModifier.m */, + 7A82461EAF937CBCE7F6715D2ABA1F86 /* SDWebImageError.h */, + FC94FDD53FA4237C8FF66857C7C55A4D /* SDWebImageError.m */, + 9FB8C99D8153F25731F71D4405F44E7B /* SDWebImageIndicator.h */, + 8F7BC976A23406357C4A5255EE32593A /* SDWebImageIndicator.m */, + EA8E08701909B2FA6765439E729A14A7 /* SDWebImageManager.h */, + 9FB74AF230A96B1FADD4F5C974FC25B3 /* SDWebImageManager.m */, + 91859BBA5BDFE60D3DA2DC2E4B07B871 /* SDWebImageOperation.h */, + 9DFDB1065284F4475C6F6EF376BB6B1B /* SDWebImageOperation.m */, + D642896A970E6F98AC0ED4FF58C04E62 /* SDWebImageOptionsProcessor.h */, + 4354B9C8DAFE2F7C7CBD62D3357C16EF /* SDWebImageOptionsProcessor.m */, + BC514E97874756CF723CD9C227D25821 /* SDWebImagePrefetcher.h */, + E41CD925C690C57ACA44FC4DE0FDAFB3 /* SDWebImagePrefetcher.m */, + 54E143A88200B1660DFCA6625E72E8E2 /* SDWebImageTransition.h */, + 9AB14D98E07F7191DC89130C4DBF75D2 /* SDWebImageTransition.m */, + AD97B9DD9CA1701117DD0FC372F425E7 /* SDWebImageTransitionInternal.h */, + 429891BE1A900CF163AD30A1313B2777 /* UIButton+WebCache.h */, + CDB71EB09859840923789536E53BE7D9 /* UIButton+WebCache.m */, + 1A1A3DBB2558E7AC29121FD7B595615E /* UIColor+SDHexString.h */, + 6A1C22ECB48BA441CEA6ACE4764BCC6B /* UIColor+SDHexString.m */, + 51856D2B46FD9DD64A53377DE0CAAD43 /* UIImage+ExtendedCacheData.h */, + 419D930EA5419E8E842286174ABA0238 /* UIImage+ExtendedCacheData.m */, + 1BB56F9863772C2DE487EDF941AC5F6B /* UIImage+ForceDecode.h */, + 86318FA7B1E0D4A05494806421454FC1 /* UIImage+ForceDecode.m */, + BB9BD2E7755FDAC06FE953BA39521E7F /* UIImage+GIF.h */, + 68653626F07B23B7CC4054D2A8E4173F /* UIImage+GIF.m */, + 4AE73858BDED6C9AC98D4EBC5611303A /* UIImage+MemoryCacheCost.h */, + 67E3099D24C9F8F960DAA3F9336AB51D /* UIImage+MemoryCacheCost.m */, + CA42508944B98472636D44EDCB93717B /* UIImage+Metadata.h */, + EF209152A5EACB0EEF8DDF68465DDE18 /* UIImage+Metadata.m */, + F9147CF43D6C46D070F3EFE5E478AC15 /* UIImage+MultiFormat.h */, + C3C13E1629109271CE3801E01A800D6F /* UIImage+MultiFormat.m */, + 8FEB9687617CC701191071B437EB401E /* UIImage+Transform.h */, + 97C19F1FAB46731FA0A30FC7B7ACD97A /* UIImage+Transform.m */, + D63A7ED6B9FD93C31690C65EFE8C6240 /* UIImageView+HighlightedWebCache.h */, + 8E008E4991A1E60B40604A264A9686E6 /* UIImageView+HighlightedWebCache.m */, + EAF09AE6AD92259E3C4B2F2DDCF70E84 /* UIImageView+WebCache.h */, + 72CA495D5F2AAF4CFA8AD5175F80CF99 /* UIImageView+WebCache.m */, + 3386112FE1F10338CA81856A145904F6 /* UIView+WebCache.h */, + 2CD29D8335CBBF074A4BD3A12C588FC2 /* UIView+WebCache.m */, + 0A93B4AA0DA7D7938A6485826D49FD41 /* UIView+WebCacheOperation.h */, + D7B599AEF5906119593C4415A569A965 /* UIView+WebCacheOperation.m */, ); name = Core; sourceTree = ""; }; - A669A88BD81A761372C7DB8436F37C32 /* SDWebImage */ = { + 868ABE2687802DE01FF58385235BF16C /* Pods-BAWKWebView-WebP */ = { isa = PBXGroup; children = ( - 9E19CE4FE50E456F961B372A40FFA9FD /* Core */, - 1F261E77984E6C46ED0071B1BEB45EA3 /* Support Files */, - 58A86D74B193359892784ECB5836748D /* WebP */, + 4E9BA39C74333E685A8D77D9F3FEAC3C /* Pods-BAWKWebView-WebP-acknowledgements.markdown */, + 637F61AB5953C5703B43DCF27E97EFB5 /* Pods-BAWKWebView-WebP-acknowledgements.plist */, + 9434D5B1AC6A6FAB61E7EF65643DCD26 /* Pods-BAWKWebView-WebP-dummy.m */, + CD61694F952DC7B18DBE9C9E6F81AED9 /* Pods-BAWKWebView-WebP.debug.xcconfig */, + E2FFE2459B53D5341EE0A8FF62FEE5FD /* Pods-BAWKWebView-WebP.release.xcconfig */, ); - name = SDWebImage; - path = SDWebImage; + name = "Pods-BAWKWebView-WebP"; + path = "Target Support Files/Pods-BAWKWebView-WebP"; sourceTree = ""; }; - CA70ECD2587BEDE2A2A65FC224453F64 /* demux */ = { + A3DD3577CC47BD2A96E31921AB14AC1D /* Targets Support Files */ = { isa = PBXGroup; children = ( - 511621F6C95356FA35A0732AB9C8471C /* anim_decode.c */, - 0A0FFC18FA3530DC3EED10EC3E25841A /* demux.c */, + 868ABE2687802DE01FF58385235BF16C /* Pods-BAWKWebView-WebP */, ); - name = demux; + name = "Targets Support Files"; sourceTree = ""; }; - D5A12010B1A44767A86420096624650D /* mux */ = { + CB1D363CA4031C99598DCFA2FEB4C2A8 /* Pods */ = { isa = PBXGroup; children = ( - BED86A2B541E9DF7218641E267B8FE1B /* anim_encode.c */, - 575279E6EB877E78818659DC8B8EF163 /* animi.h */, - 5BA3CBC2350133C20AA4A2E24EBBA672 /* muxedit.c */, - 4FA0292C933A228AF15A82AEEF148469 /* muxi.h */, - C9DACF4F3FA941723E0343D07718FA80 /* muxinternal.c */, - 231B2C3AC7C410843C1AE0777CC2FEB6 /* muxread.c */, + 44A1A257A5A95144657D64AC702DA6BD /* libwebp */, + D56ECFFC064D35CF6D17159A2616F80F /* SDWebImage */, + 6A75B1FEB15603402781095DB2BC27B4 /* SDWebImageWebPCoder */, ); - name = mux; + name = Pods; sourceTree = ""; }; - E160C028240CC4AA1BA32A325D49862B /* Support Files */ = { + CF1408CF629C7361332E53B88F7BD30C = { isa = PBXGroup; children = ( - 3A92C6C20F170DFFEB05DDCB81CB6243 /* libwebp.xcconfig */, - B6E3372E9CAECFED9042C69C0ECC9B7D /* libwebp-dummy.m */, - 05E017D8118C24A1DC9CD910F5FF1BDA /* libwebp-prefix.pch */, + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, + D89477F20FB1DE18A04690586D7808C4 /* Frameworks */, + CB1D363CA4031C99598DCFA2FEB4C2A8 /* Pods */, + 41E4F34D88E4FF9E1FDDA0A46CAE6F7C /* Products */, + A3DD3577CC47BD2A96E31921AB14AC1D /* Targets Support Files */, ); - name = "Support Files"; - path = "../Target Support Files/libwebp"; sourceTree = ""; }; - E58597F6AF921D7D8D0D3EE234366599 /* Targets Support Files */ = { + D56ECFFC064D35CF6D17159A2616F80F /* SDWebImage */ = { isa = PBXGroup; children = ( - 02870D86F9FB577F5AA1F745A0ECE255 /* Pods-BAWKWebView-WebP */, + 6D87738D92C4817A55CB674C92A327BA /* Core */, + 24A2A6EA023399A5BA44FB482B81D57F /* Support Files */, ); - name = "Targets Support Files"; + name = SDWebImage; + path = SDWebImage; sourceTree = ""; }; - F22871F0FC4DC302A5F6E82B8C30EA11 /* libwebp */ = { + D89477F20FB1DE18A04690586D7808C4 /* Frameworks */ = { isa = PBXGroup; children = ( - 3F8FDAA1E3BD5B10B57E17383D35BD5E /* core */, - CA70ECD2587BEDE2A2A65FC224453F64 /* demux */, - D5A12010B1A44767A86420096624650D /* mux */, - E160C028240CC4AA1BA32A325D49862B /* Support Files */, - 8B84A817189D61BA13A25568C4AC37BE /* webp */, ); - name = libwebp; - path = libwebp; + name = Frameworks; sourceTree = ""; }; - F6E31DDACE17E1A349BC8E8410B10B10 /* Products */ = { + E8CC13F974B5BEF186562D5DAD523182 /* webp */ = { isa = PBXGroup; children = ( - 1A835D1E9BB76A09070281879A987535 /* liblibwebp.a */, - D8E6DC6AC893C4CC6618989D6F488FCB /* libPods-BAWKWebView-WebP.a */, - 64ADB6EFD774DDBCFD30DFA05B805786 /* libSDWebImage.a */, + EE0E634CDAE78D3986030EEA35DF6B03 /* alpha_dec.c */, + ADAC297FA7DEA3659613BA7575B100BE /* alpha_enc.c */, + 546DF3CB4540BC175F7327D57AA7BBE5 /* alpha_processing.c */, + 860D3DC7DD98E18840EF00D42BDA2EB5 /* alpha_processing_mips_dsp_r2.c */, + 8F4647DFCC892C1D9184B9AFB0F19492 /* alpha_processing_neon.c */, + 10506352AD2E9695188E2AD3071F2E9E /* alpha_processing_sse2.c */, + 0640F13E13DB87517026FD9BDFE5CD13 /* alpha_processing_sse41.c */, + B593D791E9C7497ABD44153D85AF387F /* alphai_dec.h */, + E799994A459804CFCBEE4EB30271D6AE /* analysis_enc.c */, + 04156A1494B350F1118EF4E2D4E0D86F /* backward_references_cost_enc.c */, + 7A94D5041EFB1BE739B10F32B9109C89 /* backward_references_enc.c */, + B5341C81FD8164D34464E4C65A71A38F /* backward_references_enc.h */, + E97780AAE3F369BAB592180F7B1A8DF1 /* bit_reader_inl_utils.h */, + 735FEBD5D6DC34B3EC46716ABC469DFD /* bit_reader_utils.c */, + 055791E259E9A880A9FEBE27FCF1A5B0 /* bit_reader_utils.h */, + 1FF6AAEE8547B36A282E33BA79C2AC7D /* bit_writer_utils.c */, + 712E86C301578212ED0BF401E84D2626 /* bit_writer_utils.h */, + 47912CE175BA212563F5D2C38E18E770 /* buffer_dec.c */, + 940477999AB354DCFFD92C4F5BA913F6 /* color_cache_utils.c */, + 97CE87763CA381D1914A8265E43A1B22 /* color_cache_utils.h */, + 193FA3D95479A07735B769BC5A15CE4C /* common_dec.h */, + 2858359302BE791217CFCF3BA0EB069A /* common_sse2.h */, + 456B2194AF3E69711C33F97E515C973D /* common_sse41.h */, + 18946164FE3C17C5082F7F66C71371D5 /* config_enc.c */, + ECEC083D29CFE502B6B2AF42C5466252 /* cost.c */, + 654142E9D3FD4A5C8FBD0347C57A1AE8 /* cost_enc.c */, + F52DC798FA646192C280EE311B9E300F /* cost_enc.h */, + B8A88D36C6F7CB80D68D253C5F2CA4A6 /* cost_mips32.c */, + 1DA7B81A849A38607606392A7ED5C0FD /* cost_mips_dsp_r2.c */, + 70EE27FDF304C3D3BFD902BA0BB74EFA /* cost_neon.c */, + 2E5F25723C0BD6A706AFD3EA15D15BF5 /* cost_sse2.c */, + BED4187FF922BD66BCF1836AA1840EA9 /* cpu.c */, + CED09E0AF970EAA30254705AB2C13320 /* dec.c */, + 932C94E12692B0133BFA50C1E4182514 /* dec_clip_tables.c */, + EA95257254528720C049397BAA70ABBD /* dec_mips32.c */, + 7F9A1C6869ED094429C45D4DAE165123 /* dec_mips_dsp_r2.c */, + FF2D0954C4DA8B111AB8F16716837067 /* dec_msa.c */, + 28F7EB0DF852DEFC4204A37EE5A542DC /* dec_neon.c */, + 41F39803C444C7C9DE0EB0B404B816A0 /* dec_sse2.c */, + 3EA01B4E1C500B7E694B9F6B14EC23CD /* dec_sse41.c */, + E45404B8A6BE99A0CDA859B6A4A5ED51 /* decode.h */, + 7855A3B9A4996CA08A3628DB22A1FF9B /* dsp.h */, + D4BF5D0BBED0BE006C5EA8F37E33FDDE /* enc.c */, + 698EE24AFF693B12323714B8F3E60F2A /* enc_mips32.c */, + 500DABB4E012E698A10866644EE65801 /* enc_mips_dsp_r2.c */, + B742B21BE7A1B51123CB7B8F0D762BC3 /* enc_msa.c */, + 81134A2B51EF1E9769C25C86E7CDA557 /* enc_neon.c */, + 9F5C18C6A44C78E0C17488AE6E34181F /* enc_sse2.c */, + ECFE44B3A484160231C7DCBB78E10CE4 /* enc_sse41.c */, + AC453575A9B1479737BE92C85D58F404 /* encode.h */, + D4939C05C953084D0ECE3CCFC994412F /* endian_inl_utils.h */, + C7E9447EC067DCAE1E837578E5687E6A /* filter_enc.c */, + FAE5C886CC0D22024F0903EF88475013 /* filters.c */, + E329EDA5C820E6C28A241D5FBCE65901 /* filters_mips_dsp_r2.c */, + 615CE109EAED55DA7628F0689DF864FE /* filters_msa.c */, + 795E7361C397B82F7AF9B0522C423631 /* filters_neon.c */, + 43C1AA5165AB3874E0E0FB1C4DFEA136 /* filters_sse2.c */, + 2ACA7BF5F31AECC38E208E04B30680E9 /* filters_utils.c */, + 8DDD2A637F3C7D13EB6130690B6A7092 /* filters_utils.h */, + 07639BEEF0C64623EFABA8277CD0DAC3 /* format_constants.h */, + 3A079F9CEB212334376FB3C441D82BE0 /* frame_dec.c */, + 8631AA3705B14FC06725870AF2098876 /* frame_enc.c */, + 03C65F1F8A146656C1BAD0831392C99F /* histogram_enc.c */, + 045CA2B6F87FF1CFC2231A4211907BB6 /* histogram_enc.h */, + 0A1F1783097070142C03654C2D9A3C41 /* huffman_encode_utils.c */, + 638B8EBB10F02A66F176A72990E664D9 /* huffman_encode_utils.h */, + C43E79CCA96219D7EFF19311AA16AC0D /* huffman_utils.c */, + 56E472CD3A69CCDECE520B239A3A67A2 /* huffman_utils.h */, + 64425064EF8E31B7ABB836B8B5C3ADCE /* idec_dec.c */, + B5167E7BD4063FE890336C2A31A9EB2D /* io_dec.c */, + A96E0BF839FBB5FA5E4881EFF0075F33 /* iterator_enc.c */, + A82F773962BB8FBC3A376473872CA8C7 /* lossless.c */, + 23246A10E766EC00C04B342BE1B2EAE5 /* lossless.h */, + 6079682185772D3181714CA23438B786 /* lossless_common.h */, + 056EF0342200211C063CBD984201A1AE /* lossless_enc.c */, + 1D0FF6E435829B311BBFD6D9F9168438 /* lossless_enc_mips32.c */, + F1FBD5606CB448B2D7C30B285887CF15 /* lossless_enc_mips_dsp_r2.c */, + B3DB6A2E81FFBF74DBD8E7E5B74A8BC2 /* lossless_enc_msa.c */, + 77A678CA2F4F8850CC4ECA54B50733D3 /* lossless_enc_neon.c */, + CBCA557985E0BA75F6D2308F192699A6 /* lossless_enc_sse2.c */, + A29B321ED4B750E9C205F80ECF0389D9 /* lossless_enc_sse41.c */, + BB4E3E20E058939EF27C1234AF7731DB /* lossless_mips_dsp_r2.c */, + C054F83487804DD694545FB162D9C8F6 /* lossless_msa.c */, + 13D82D365FF6AA187D4393E7FB963EFF /* lossless_neon.c */, + 5FC5F4CB280162DF1BA990E6F1D59A15 /* lossless_sse2.c */, + 9CEE5E4C5A9240ABFF8E9AA325A6657D /* mips_macro.h */, + 9A56CC7629A574539DE00913DA9F9D51 /* msa_macro.h */, + 9A64F761ADE9AC0F94436DE531412FEA /* mux_types.h */, + 098095AB88EF3BBC12F7B0E7B2A99EE8 /* near_lossless_enc.c */, + B94EC22AFAC1FCF25AA0D40822F47EFB /* neon.h */, + 630A9AD278AB2DE8C97390C65F3C0BB0 /* picture_csp_enc.c */, + C331E73CB9956C3A47EB050C5284E1E9 /* picture_enc.c */, + 688DD3B6CC9E0F4AB549ABCE81C2DCA2 /* picture_psnr_enc.c */, + B3C8D6506A238A98A7074048E747A2AF /* picture_rescale_enc.c */, + 5C0978491FDDF92929C2BF5B55FD95FC /* picture_tools_enc.c */, + 7F28BE05E4A9070D7550FDD260425207 /* predictor_enc.c */, + 2D3E248E8EC54055C830B8E877ACBC2A /* quant.h */, + 02165E73AD8E97F2C6A08329E76E3293 /* quant_dec.c */, + 569E3EE14BE61EFCE9CCF52FFD3AF14A /* quant_enc.c */, + D913111E9E80427C23F96BB2A490A944 /* quant_levels_dec_utils.c */, + 448F86FD2D8BD5FCF05BFE6FB4DB4E72 /* quant_levels_dec_utils.h */, + D9578E54949E867487C1EBB6A8A431A0 /* quant_levels_utils.c */, + 848919187EAE1845DE108F91C4788D92 /* quant_levels_utils.h */, + 701D7C8A50E500BDA3C223A795FBAB4F /* random_utils.c */, + 832C487AEE86FA8381A769717FDBB4F3 /* random_utils.h */, + 656D61FCFDECEC913336AE3EC9FB1392 /* rescaler.c */, + 51269C442DA0D95DA54206819DF3A296 /* rescaler_mips32.c */, + 65CB4EE6E95D8B8A51CCD29243CE160B /* rescaler_mips_dsp_r2.c */, + 449A368A273C009024AD2920345A6FC8 /* rescaler_msa.c */, + 6D0A65137436FD41880D7F4CAB18DFA8 /* rescaler_neon.c */, + 9D993B8A1462C2729568F605D819ADAC /* rescaler_sse2.c */, + A93499F8924850040794B9CC25EDAD0D /* rescaler_utils.c */, + 111F431982285E95FC80611A41DC1856 /* rescaler_utils.h */, + FEFFFA7EC311308C06795D55656F0F3B /* ssim.c */, + 63A3A0E64307760192B0C76157066418 /* ssim_sse2.c */, + 46DD0765B822D133DDB17B312055CA5F /* syntax_enc.c */, + A423723451A23CE7DD4B14D159DB7FD1 /* thread_utils.c */, + 30073E7033BC9AEFE8C6A9CFFCC74494 /* thread_utils.h */, + EA75FD90AB06ACF4D46F3DD6825D4346 /* token_enc.c */, + 685F396B8F514708AC61D24B0DD8FFB4 /* tree_dec.c */, + D9CF7967267CDBA3CF9C803A10B55AB0 /* tree_enc.c */, + CEE1D9965D20D5182C9F25464DAC1311 /* types.h */, + 948A5E94C3110E422BCDDB6414398D4F /* upsampling.c */, + 32B6946A8B223A1202C8EAA0B911D68A /* upsampling_mips_dsp_r2.c */, + 021D6DA8E40455C4CF949957C38D72E8 /* upsampling_msa.c */, + DA801E0CF44B487078180A7F6260A58C /* upsampling_neon.c */, + DD05C335753E2D65F7CC565D7D63D969 /* upsampling_sse2.c */, + B74692ED6CE9609D0A5083FF249F1E32 /* upsampling_sse41.c */, + A6551F5FD3B67506E8C6EF85AD5BB8E6 /* utils.c */, + 5044CCABE41EA5742CEAFCFD4FE4D8BF /* utils.h */, + 8AF4E628BE5962EA00B460FEFA228C9C /* vp8_dec.c */, + 23BEAA7669175EA15905F5DBB3DAE507 /* vp8_dec.h */, + F79A3BE8868384BDB3B3B6EF21408138 /* vp8i_dec.h */, + CE5AB59DDD3B1D6CCEB33D6FF7085E34 /* vp8i_enc.h */, + AF2334E42FFFF6958CEB654321BA0461 /* vp8l_dec.c */, + 9DE787876603CEC024673C3CCBD3C459 /* vp8l_enc.c */, + C3BD2F2695D78B34BE61DCB7A3F49506 /* vp8li_dec.h */, + 39687BD8B8DF046A1089BA37F9121765 /* vp8li_enc.h */, + 2F8106CE13DB175CBF5F0F9CFE701820 /* webp_dec.c */, + DA421095BCEC53647FB897801228780E /* webp_enc.c */, + CBE40E7F8EFCE740B3AF6D3999F1E81B /* webpi_dec.h */, + A77486D18FF1AD89325C58576B8D30F3 /* yuv.c */, + 4B8354E0C70E43B86BF07A80B7E145A4 /* yuv.h */, + 6DE71D55940622EAAB38B3B370F2A0D1 /* yuv_mips32.c */, + 427094677819A231C25413A893205961 /* yuv_mips_dsp_r2.c */, + E44FB57F8AB7B60CB04372529B01252D /* yuv_neon.c */, + 992148CEC0C7E43DA82A3A83A236F0A1 /* yuv_sse2.c */, + BA5CE2BFC24586CFF94E9473F7FFBD38 /* yuv_sse41.c */, ); - name = Products; + name = webp; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 03CCA74BF1715E67033B6A6E050BC7C0 /* Headers */ = { + 3D441B88F65A026ECC4D8B369ABA6026 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3CC5752379425A7307AF5979D47E480B /* alphai_dec.h in Headers */, + 26DDBD2684FE4D8C192BF32194D36314 /* animi.h in Headers */, + 9D95FF90F4AE28C5DC99E498A09431C0 /* backward_references_enc.h in Headers */, + A9A2B1F25A522AFA441E04FFBC819682 /* bit_reader_inl_utils.h in Headers */, + C72B383906D549B11D0F88B8218700A6 /* bit_reader_utils.h in Headers */, + 0A702DA7DBB0598F2A8D0EA31A425C64 /* bit_writer_utils.h in Headers */, + CF683DA00CD75267D269199BEF91C27F /* color_cache_utils.h in Headers */, + A8745A14D9ECB939925A6FDDEFAD32F7 /* common_dec.h in Headers */, + 318F3F2D56C5B3C21D3B5E50F48EC6DE /* common_sse2.h in Headers */, + 4FECEDD0BEA6FBAF73160BA477508E26 /* common_sse41.h in Headers */, + 85A8F825144DCAFA48EFBDD5CCD33659 /* cost_enc.h in Headers */, + 1D684B565C58B9807F83660880EFC634 /* decode.h in Headers */, + 867DB4166B5BC907107EB47AC10E6EC8 /* demux.h in Headers */, + FE32ED5BFA5DB2420A7C262749A0F7A2 /* dsp.h in Headers */, + 732A7A9BBC1BFCF4AEE656BE2B97C21A /* encode.h in Headers */, + 8BC5223AB347EDAADA0DC451439FC68E /* endian_inl_utils.h in Headers */, + DD557D39A3EBAFC72775EA5F2BE578F7 /* filters_utils.h in Headers */, + 00EBCA1C52BDA2BAD2EFF56CFC38BB6B /* format_constants.h in Headers */, + 32390D08501D28CB4546DF9527BE8542 /* histogram_enc.h in Headers */, + 028EBFD3BDD333D1FC466C51AF274395 /* huffman_encode_utils.h in Headers */, + 78F67829A483CBE2715BC2C121EE2DA8 /* huffman_utils.h in Headers */, + 6311BC38C34B313676ABB3DC409CDEB6 /* lossless.h in Headers */, + C5DD40727C7A2E24D4BA2A25C4C96C6D /* lossless_common.h in Headers */, + 43DB91F62A8B94C30D674DDACA0A26C3 /* mips_macro.h in Headers */, + E636DC65C5F701A11A1CCE6568863500 /* msa_macro.h in Headers */, + CB0A87BC83D3DE363D02FDF133471DAC /* mux.h in Headers */, + 2E4249141E2265AED28451EAE499B014 /* mux_types.h in Headers */, + 7562C56441C73094C1EA5388B8382C1B /* muxi.h in Headers */, + EC96457528865F0AB1500DA7A7DF652C /* neon.h in Headers */, + 6F7962FF9B90836AFDA94BB5EA55E3CA /* quant.h in Headers */, + 4E3C1DE072E6C5336A03F8CC1F856A90 /* quant_levels_dec_utils.h in Headers */, + 144BEE51D1565EA55832A06723119666 /* quant_levels_utils.h in Headers */, + 79259121E54F7CFBA05BEC2278E94E56 /* random_utils.h in Headers */, + 80ACED1ED78BFACD53EB4937DBDE9D1D /* rescaler_utils.h in Headers */, + 46D3037DBF6800978C2926590F172915 /* thread_utils.h in Headers */, + FE924DD354B6C55F4CD72A37C1DBEFA4 /* types.h in Headers */, + 57427279AA2D60422A3E2A128C18DDD9 /* utils.h in Headers */, + 9F43FE8C406984BF732D1AF01279BEEB /* vp8_dec.h in Headers */, + 306DEF2B74C5BF2440D7DA9C6B9AF46B /* vp8i_dec.h in Headers */, + 35DD6329D6839FF25AB703A9D7106550 /* vp8i_enc.h in Headers */, + 5D311F299039B1501541239CC1AED43B /* vp8li_dec.h in Headers */, + DABA0F52668EAA175AB2F8944C9A628C /* vp8li_enc.h in Headers */, + DEB4DFFD793B2BC08438B39ADEC23C63 /* webpi_dec.h in Headers */, + F464E4890B084765F9FF2E34C20A51FD /* yuv.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 45B52FF594BA25DD534721DAF0777C49 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BEA8651F99403447F29990C1A94F37D3 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 6D00B5661D6A0CBFE820F7BF6D375976 /* alphai_dec.h in Headers */, - 91405C5B85DC2FCBFA2FFBDC4AEF8F45 /* animi.h in Headers */, - CBC5763636D2E4F3D15AB3855246D827 /* backward_references_enc.h in Headers */, - 5C121251655B711E54998130AFD43983 /* bit_reader_inl_utils.h in Headers */, - 2E56072B3E0E4FB10118C3FEDA32E817 /* bit_reader_utils.h in Headers */, - 0A27B161AF351244AF8F7FB7A791AC95 /* bit_writer_utils.h in Headers */, - 7F89454692AFB206BDF96F574E0B6217 /* color_cache_utils.h in Headers */, - 1F598247F6AE0803DACAF791B232CD35 /* common_dec.h in Headers */, - E08164D65676AE602E593B61024E8752 /* common_sse2.h in Headers */, - 95AD051C4B6CB4D0EE5D937098398EB5 /* cost_enc.h in Headers */, - 7F19780C33E35CD60D26B4201FC10996 /* decode.h in Headers */, - C4AFDDF03BCF9DC266320A0648F16ED0 /* delta_palettization_enc.h in Headers */, - 9A63CD70F2F69A79AE0BFEDFE9F50B7F /* demux.h in Headers */, - 6536E9FF3714557E7A1BA34C10752900 /* dsp.h in Headers */, - 4D66D2C59A3418F6E6CF33007DB5557E /* encode.h in Headers */, - 5027062026C24D17E10777772A79DBB3 /* endian_inl_utils.h in Headers */, - 3AF19589172E23FA6FFE6725FA1C155C /* filters_utils.h in Headers */, - 4D66BD16CE5977C81FBD68E2F567BA7E /* format_constants.h in Headers */, - 80C1B1C729B77788A2F952C306C77B0C /* histogram_enc.h in Headers */, - 88F767A0D7D3BF7F40BC9236455D437C /* huffman_encode_utils.h in Headers */, - 41423EE8E33A344DB2173DEC60D99E64 /* huffman_utils.h in Headers */, - 5372CC22397AB8A1C278A8A9374700E6 /* lossless.h in Headers */, - 7CD7DD98075DDDDE2F0B05100BA99185 /* lossless_common.h in Headers */, - A58A4444DDCC48217E0415286224FB5B /* mips_macro.h in Headers */, - 32B6D23EB37C0561283FFD42DBF71DC0 /* msa_macro.h in Headers */, - B1B1E6D702D05BF22CE4A989F56E07D8 /* mux.h in Headers */, - 49558CC1148F9C0926A84BAD76709D56 /* mux_types.h in Headers */, - E72A2D19ED9DDC745772CDADA20D9345 /* muxi.h in Headers */, - 946830271A52B7DEFDE815417B830C28 /* neon.h in Headers */, - A7200895D03D5E3CB3E8456CE3255049 /* quant_levels_dec_utils.h in Headers */, - 4CACF4BC0142176659AD440C6A1FCE73 /* quant_levels_utils.h in Headers */, - 668AA30C15A3ED3865208EEB87C3720C /* random_utils.h in Headers */, - 4931CDB25957ED3B2E76FB49BE693C45 /* rescaler_utils.h in Headers */, - 5B80C17040B9A779762FC86950982B5D /* thread_utils.h in Headers */, - 122547B22220D61DCA8985C366E5ECE5 /* types.h in Headers */, - 4D55E9742F187AE0FABCCFF5AF3E8126 /* utils.h in Headers */, - 960EE063376FEDD5BC8CC9DAA7C06922 /* vp8_dec.h in Headers */, - 2FE446DAF7976412564117A74440771F /* vp8i_dec.h in Headers */, - 4C9ADE63641408213BB88FA5DF4DC8A1 /* vp8i_enc.h in Headers */, - B6B1DD4331198D8B9EB2D7173D964EDC /* vp8li_dec.h in Headers */, - 20D99B76EE2FA08CC397C8F53399EFAA /* vp8li_enc.h in Headers */, - 095D4905553D8F90B78366512A694D55 /* webpi_dec.h in Headers */, - 2BF24364742A9A8DB07AC563ABEF3821 /* yuv.h in Headers */, + A3C94056341DFA2A8A77147BF8CCD625 /* NSBezierPath+SDRoundedCorners.h in Headers */, + 2DB99E87328AB7C1FD3162AA94B0D3E7 /* NSButton+WebCache.h in Headers */, + 170F97CD69BD6031D937C92D34FD4706 /* NSData+ImageContentType.h in Headers */, + 4C3912D9D711FFA2E8310EC6AD47EE62 /* NSImage+Compatibility.h in Headers */, + E42A7D1C9E99A24203A295E85B978938 /* SDAnimatedImage.h in Headers */, + 599AEB5E944F8E4CD7AD7766DBC5B9AD /* SDAnimatedImagePlayer.h in Headers */, + 472BDF20693240A7BBC7279CA137A73E /* SDAnimatedImageRep.h in Headers */, + 4810AEBF932187A3F1A94DFB6E028CB9 /* SDAnimatedImageView+WebCache.h in Headers */, + 9B36EF7583EDEEFC684944DC2A86EE9D /* SDAnimatedImageView.h in Headers */, + 5AC5B35F7A1F8D81E38D71BA2C5BFBC4 /* SDAssociatedObject.h in Headers */, + 759335CEF832A5F72222213C7AC7FFEA /* SDAsyncBlockOperation.h in Headers */, + 00019CCAA3EBAB3F8539E6183612530B /* SDDeviceHelper.h in Headers */, + D7E39007ADC52A887967F78C6E5C61D9 /* SDDiskCache.h in Headers */, + D2C0E6530E3AFBD6C079E42472F33800 /* SDDisplayLink.h in Headers */, + D522C8B6C7C223E80D6BAB4BDDB5F69A /* SDFileAttributeHelper.h in Headers */, + 44C8DEEE4C2383275CB675F29D45C761 /* SDGraphicsImageRenderer.h in Headers */, + CFB4EFA7B2ADC28AD13CFFCA011596D7 /* SDImageAPNGCoder.h in Headers */, + F1452646310B7DF8D987010249536E76 /* SDImageAssetManager.h in Headers */, + 8E27EC136C6FBA3867CE73898926070E /* SDImageAWebPCoder.h in Headers */, + 9B12F156E1BEB77000D4E23081EC1F29 /* SDImageCache.h in Headers */, + 58F4C5FFF7F1ADBD86EF4D72D10060F9 /* SDImageCacheConfig.h in Headers */, + FBCBC855C2BC31EE3B180627DF0E51E2 /* SDImageCacheDefine.h in Headers */, + E8C96FF99FC6A03A737CD3202588C7D5 /* SDImageCachesManager.h in Headers */, + 428323F5F727A7745DB9A0B99AF770B9 /* SDImageCachesManagerOperation.h in Headers */, + 327DF3A45AD02490D6D3DFCC3A3A676C /* SDImageCoder.h in Headers */, + 14E576329E0DD1AA7F16E7E5C629C447 /* SDImageCoderHelper.h in Headers */, + 446F9E8C1FF9D0E5B5679FF2CA418898 /* SDImageCodersManager.h in Headers */, + 9F517EF334E49A9C29254BDB13F00FB2 /* SDImageFrame.h in Headers */, + 9D5B7A2D161D6078DA4EB07849DDD72E /* SDImageGIFCoder.h in Headers */, + DA765D01151CB2601493C20FAB272A99 /* SDImageGraphics.h in Headers */, + 8385EA1E9A6EBC7120147A8E8128264B /* SDImageHEICCoder.h in Headers */, + F1DD207E3FDE8FD41F4E8FAD4A840C13 /* SDImageIOAnimatedCoder.h in Headers */, + 38E225F83FB50A828F51F93E59069CF9 /* SDImageIOAnimatedCoderInternal.h in Headers */, + 88EC2492778A65D49A56165E5DE416FF /* SDImageIOCoder.h in Headers */, + 1C492DD17AE0B343F869E7947AB90AC2 /* SDImageLoader.h in Headers */, + FA7DFB408F4A73B37749C8A3D730F903 /* SDImageLoadersManager.h in Headers */, + CF015D6109D2B386D6A1F1F18CB0C9C3 /* SDImageTransformer.h in Headers */, + BDCEC74D09CA629346B8CDB4180B1BCF /* SDInternalMacros.h in Headers */, + D29A03BBC9B95E677C2F51345F344088 /* SDMemoryCache.h in Headers */, + 50BA43C8B4C7278FA449490F5ACEA40C /* SDmetamacros.h in Headers */, + 5376CD57545524F6266E36C055A7C0BD /* SDWeakProxy.h in Headers */, + A6747B6E6D35FB0709A0E58F686A88A5 /* SDWebImage.h in Headers */, + 265D49A837950E796D67DF1A7BA105FE /* SDWebImageCacheKeyFilter.h in Headers */, + E89678023EB928D8162BFC0B1DCF31D3 /* SDWebImageCacheSerializer.h in Headers */, + A19AA07C7DB4989CB3E0A6423F39F82B /* SDWebImageCompat.h in Headers */, + 47948B0FA1D66D170049BDFF4F42F543 /* SDWebImageDefine.h in Headers */, + 4670045ED9E12409423D29E8C8BB46C2 /* SDWebImageDownloader.h in Headers */, + 68F51B1C47032D4C1E214D42B31D4336 /* SDWebImageDownloaderConfig.h in Headers */, + 74EAE5276D0EF19E1CF97B70E9965FB4 /* SDWebImageDownloaderDecryptor.h in Headers */, + E8BC0E3B26159ED4D6462E921A5A69D9 /* SDWebImageDownloaderOperation.h in Headers */, + 7031CFA5FD7EC7C8E5EFAF8325D2C8ED /* SDWebImageDownloaderRequestModifier.h in Headers */, + E34D536EB38161183AC71F5403278288 /* SDWebImageDownloaderResponseModifier.h in Headers */, + EC357E611B3D5756D5863C4408BE6CE2 /* SDWebImageError.h in Headers */, + EF5491A4CB593F4B14C3A4CD72649405 /* SDWebImageIndicator.h in Headers */, + 4A902A0B2167B7EFF593834F41B2EC0C /* SDWebImageManager.h in Headers */, + 757EBD77D300E8FAF251BF89058A0063 /* SDWebImageOperation.h in Headers */, + C4A781EEFE89058B7265C6F721CA91AB /* SDWebImageOptionsProcessor.h in Headers */, + 93147163DFC9AD7D994B83BB638828B9 /* SDWebImagePrefetcher.h in Headers */, + CD40EC89E9242EF2196E318E81133DCA /* SDWebImageTransition.h in Headers */, + E6AD01F3482B5DC39109FDDC4FA258F5 /* SDWebImageTransitionInternal.h in Headers */, + 8487E616E339280CA226EFA20E1095A4 /* UIButton+WebCache.h in Headers */, + E3E2BD738E7E9A105525F691CE53FDBF /* UIColor+SDHexString.h in Headers */, + 01EEAAAE410356BC64AF4CED471DA9D6 /* UIImage+ExtendedCacheData.h in Headers */, + F82CF4572FCCA28ECEE676EABA1BAAF3 /* UIImage+ForceDecode.h in Headers */, + 5938E9D9A7E09FC96186D2651278B68C /* UIImage+GIF.h in Headers */, + 45B725D59EEA0992270B943C42E3FA17 /* UIImage+MemoryCacheCost.h in Headers */, + 58A8084F0B525B5F00655FCD63877483 /* UIImage+Metadata.h in Headers */, + 098E8CC8DF32416A428381F52273D2A6 /* UIImage+MultiFormat.h in Headers */, + 0650AA299D9E18C22F3D7978B8D13F0E /* UIImage+Transform.h in Headers */, + 06943F195425D70618781500ECA5D13A /* UIImageView+HighlightedWebCache.h in Headers */, + 9190EFE6D38E12D26CB9BC5C3A7AE8EA /* UIImageView+WebCache.h in Headers */, + BD581F43E1B1B9B45DD3DC6C4B709539 /* UIView+WebCache.h in Headers */, + 9B8365733D88EDAC8AAB34412130B375 /* UIView+WebCacheOperation.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 240BD67EBE5663ECC49E5FB418CF54E0 /* Headers */ = { + C15F68C78B66AC30B36A39461313E092 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 17EF6764749DF7703907F32FE27EC530 /* NSData+ImageContentType.h in Headers */, - 5E196E7E37AE26E094B32E15E0CA4AD4 /* NSImage+WebCache.h in Headers */, - 983E627BDABE1F2D6894B22AB54A02A0 /* SDImageCache.h in Headers */, - D18327E5BAFFBA6877A0367A8B7DC340 /* SDImageCacheConfig.h in Headers */, - C47662F42A8AFD089C3D77E1B0F8C9E8 /* SDWebImageCompat.h in Headers */, - 530B312298B521C533FCD8F09BC97ECA /* SDWebImageDecoder.h in Headers */, - 2D61F15DD6CDB36C3B60C628505B1509 /* SDWebImageDownloader.h in Headers */, - 54B156398B1C41BE141BB6F8E45AC150 /* SDWebImageDownloaderOperation.h in Headers */, - 9BCE6946D929F74D12DD41F53759AF1F /* SDWebImageManager.h in Headers */, - D6DB5DBFA7C57FF43248EFDF538621AD /* SDWebImageOperation.h in Headers */, - D9B22EC448A940B277B365C8B292E828 /* SDWebImagePrefetcher.h in Headers */, - 69ABB00ECBF5B4599FC6A5E3C80AE35B /* UIButton+WebCache.h in Headers */, - 0B4670D76E01840C374ABB91368B8B19 /* UIImage+GIF.h in Headers */, - 3EA8EE5C7E4ADDDC879C4B26DF2FF091 /* UIImage+MultiFormat.h in Headers */, - A799F57F01F851C7826ABBB7B925FC4C /* UIImage+WebP.h in Headers */, - F535F3029BDE5E00FE755E56DBE0F62D /* UIImageView+HighlightedWebCache.h in Headers */, - F8B7444652DBA14C5E18C553C641D245 /* UIImageView+WebCache.h in Headers */, - 9046F10CF5D795BB9EBDB9D7183CF6A2 /* UIView+WebCache.h in Headers */, - 8EB868EABCB1D844BBFB2E4A4A47C559 /* UIView+WebCacheOperation.h in Headers */, + 284EF2C9155791325EE03FEF211F11F6 /* SDImageWebPCoder.h in Headers */, + 26E3DD206F42A74D6DB08F757B22A6DB /* SDWebImageWebPCoder.h in Headers */, + 0E312B5257A85597AE14A7B58AB149DE /* UIImage+WebP.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 43603B6242089017A8B51CE72FE882A9 /* SDWebImage */ = { + 1953860EA9853AA2BC8022B242F08512 /* SDWebImageWebPCoder */ = { isa = PBXNativeTarget; - buildConfigurationList = 52FF492AA1DAA3E7C8E2A30CBF17EC2E /* Build configuration list for PBXNativeTarget "SDWebImage" */; + buildConfigurationList = 882E705FCDE06AF9F3A4A8B8F6C1CFC4 /* Build configuration list for PBXNativeTarget "SDWebImageWebPCoder" */; buildPhases = ( - 102BEB436B8AFA19579C507E0F5A84DB /* Sources */, - DD4EE3937410E5A99B7FF51F7CE987D7 /* Frameworks */, - 240BD67EBE5663ECC49E5FB418CF54E0 /* Headers */, + C15F68C78B66AC30B36A39461313E092 /* Headers */, + 7B7D6C939B19D9A1A4F242E4A7F545BC /* Sources */, + 3B91D1A4A91356045257E05C1040D5D1 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D97E6CD929CEF8FCA44F6FF8350FEC5E /* PBXTargetDependency */, + BD0C7079398DDDB809F854D10602CC16 /* PBXTargetDependency */, + ); + name = SDWebImageWebPCoder; + productName = SDWebImageWebPCoder; + productReference = FCF61D9B2B75054A9A3185DDC609B7FF /* libSDWebImageWebPCoder.a */; + productType = "com.apple.product-type.library.static"; + }; + 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */ = { + isa = PBXNativeTarget; + buildConfigurationList = B1FA491365904802AD9D5BF4683066A6 /* Build configuration list for PBXNativeTarget "SDWebImage" */; + buildPhases = ( + BEA8651F99403447F29990C1A94F37D3 /* Headers */, + 811E255F9DA765E3FED6313B480D487A /* Sources */, + 9A8E5412CB0D1C65610568029C8C6240 /* Frameworks */, ); buildRules = ( ); dependencies = ( - 32B1D4E7F61BB0DE791F1FC3549A72FD /* PBXTargetDependency */, ); name = SDWebImage; productName = SDWebImage; - productReference = 64ADB6EFD774DDBCFD30DFA05B805786 /* libSDWebImage.a */; + productReference = B0B214D775196BA7CA8E17E53048A493 /* libSDWebImage.a */; productType = "com.apple.product-type.library.static"; }; - AEE22CDD9D2839E0FBA7635BE73372D8 /* Pods-BAWKWebView-WebP */ = { + 3965B31D8AC903FD994105735F658C49 /* Pods-BAWKWebView-WebP */ = { isa = PBXNativeTarget; - buildConfigurationList = 782CF098BF9ED8595030B25E0F56FE2C /* Build configuration list for PBXNativeTarget "Pods-BAWKWebView-WebP" */; + buildConfigurationList = 2660B93F2F6B9EEBB622A5047DEBEF88 /* Build configuration list for PBXNativeTarget "Pods-BAWKWebView-WebP" */; buildPhases = ( - 782F5B05FDFB9DCEEB9E63CF3E0803BC /* Sources */, - A007D207146C9360A206ECFB05096937 /* Frameworks */, + 45B52FF594BA25DD534721DAF0777C49 /* Headers */, + 9906E39DEC4C580F808979C324FDF5A6 /* Sources */, + 2A007AB7EFA7E79E16C0EF6DFB79B4AF /* Frameworks */, ); buildRules = ( ); dependencies = ( - 56A64311E0D6C06E5B647BE2525060BF /* PBXTargetDependency */, - 5CCEAE0DD52702C7094C809D9ACA0720 /* PBXTargetDependency */, + 678C0BCF3F952AD7ED3D722ADF758E96 /* PBXTargetDependency */, + CD82CFE67C08BE8E59A0B6A6A621535E /* PBXTargetDependency */, + 901E45660B09D870DC10940C96C4120D /* PBXTargetDependency */, ); name = "Pods-BAWKWebView-WebP"; productName = "Pods-BAWKWebView-WebP"; - productReference = D8E6DC6AC893C4CC6618989D6F488FCB /* libPods-BAWKWebView-WebP.a */; + productReference = 1FF73CAC210F42D83D9A68A7813D6725 /* libPods-BAWKWebView-WebP.a */; productType = "com.apple.product-type.library.static"; }; - FB6F7635FB13EEAE9014EE007FE8B0B7 /* libwebp */ = { + 47D2E85A78C25869BB13521D8561A638 /* libwebp */ = { isa = PBXNativeTarget; - buildConfigurationList = 7ADC89279956A906200ACC52BAE3EF27 /* Build configuration list for PBXNativeTarget "libwebp" */; + buildConfigurationList = 12892FBF589BA736ED3577CA116AC0A1 /* Build configuration list for PBXNativeTarget "libwebp" */; buildPhases = ( - 9B58A8F76D843B577348CF7A62F7F973 /* Sources */, - 9E6190D3B278B96FE94F59D1F6838897 /* Frameworks */, - 03CCA74BF1715E67033B6A6E050BC7C0 /* Headers */, + 3D441B88F65A026ECC4D8B369ABA6026 /* Headers */, + 697217222E268905DB9A640B61FCC6C2 /* Sources */, + B5FC95BA1E86633B8BFEE211EB680299 /* Frameworks */, ); buildRules = ( ); @@ -957,470 +1402,650 @@ ); name = libwebp; productName = libwebp; - productReference = 1A835D1E9BB76A09070281879A987535 /* liblibwebp.a */; + productReference = 5E4674603A5D5B9215FFA0F8E69F8B71 /* liblibwebp.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + BFDFE7DC352907FC980B868725387E98 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0700; + LastSwiftUpdateCheck = 1100; + LastUpgradeCheck = 1100; }; - buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); - mainGroup = 7DB346D0F39D3F0E887471402A8071AB; - productRefGroup = F6E31DDACE17E1A349BC8E8410B10B10 /* Products */; + mainGroup = CF1408CF629C7361332E53B88F7BD30C; + productRefGroup = 41E4F34D88E4FF9E1FDDA0A46CAE6F7C /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - FB6F7635FB13EEAE9014EE007FE8B0B7 /* libwebp */, - AEE22CDD9D2839E0FBA7635BE73372D8 /* Pods-BAWKWebView-WebP */, - 43603B6242089017A8B51CE72FE882A9 /* SDWebImage */, + 47D2E85A78C25869BB13521D8561A638 /* libwebp */, + 3965B31D8AC903FD994105735F658C49 /* Pods-BAWKWebView-WebP */, + 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */, + 1953860EA9853AA2BC8022B242F08512 /* SDWebImageWebPCoder */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ - 102BEB436B8AFA19579C507E0F5A84DB /* Sources */ = { + 697217222E268905DB9A640B61FCC6C2 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 52B939E27245847773CD4D08F7B4313E /* NSData+ImageContentType.m in Sources */, - 5341C423EA5F960F1C304D961709C1D6 /* NSImage+WebCache.m in Sources */, - 0DC3A1A8228A8F91311FB822114F3AA9 /* SDImageCache.m in Sources */, - 4925650DB5719C49FE6CAC0276AD0811 /* SDImageCacheConfig.m in Sources */, - 030145440EBF3CCE033B89111A11161A /* SDWebImage-dummy.m in Sources */, - 80ED1FD30DC8A01A46DBFB84CBF12FC9 /* SDWebImageCompat.m in Sources */, - 4ECDE63D104846DE9C2CF62B8E0BF912 /* SDWebImageDecoder.m in Sources */, - 932FAAAC99E212FDB48CFD715ACBA195 /* SDWebImageDownloader.m in Sources */, - 3308F7ED6A3241827595B7C46FBCCCB8 /* SDWebImageDownloaderOperation.m in Sources */, - 60B48A94F890CF100835646A15B12715 /* SDWebImageManager.m in Sources */, - 5F9AB0E236C0B8626983AF13E7FDED1F /* SDWebImagePrefetcher.m in Sources */, - 1D0C6E2F896D855E2D6A13073166892A /* UIButton+WebCache.m in Sources */, - E25052B7048E1AFB94766D6027185205 /* UIImage+GIF.m in Sources */, - E45EBC9EA7CA26786C924319FDB72EC3 /* UIImage+MultiFormat.m in Sources */, - EDE3A90DCD01712555ECB0D09BE325F8 /* UIImage+WebP.m in Sources */, - 6FC3FB3C443A655D6EC7E43587CB6204 /* UIImageView+HighlightedWebCache.m in Sources */, - BC09EC2869D77D118902846BD42C1E1C /* UIImageView+WebCache.m in Sources */, - A519CCD29786C1668C0C84A478B84247 /* UIView+WebCache.m in Sources */, - 854F232D3DD36361372F3518380265FD /* UIView+WebCacheOperation.m in Sources */, + 5100E42A38F6DA8DC0E8A3E25C5170BB /* alpha_dec.c in Sources */, + AD18C75F2CD24CEE016811DC7841078A /* alpha_enc.c in Sources */, + E1682D3F6C8B6D6AF0C845759DD95DF4 /* alpha_processing.c in Sources */, + 2D34C9F476A929DBBCD3244403B8794C /* alpha_processing_mips_dsp_r2.c in Sources */, + A4869E512A2621C326F66BC81CC2C95F /* alpha_processing_neon.c in Sources */, + C29913785660B86873CCD667E5FF33E5 /* alpha_processing_sse2.c in Sources */, + B6ACC838DBDD8F64CBD50144750FB8F5 /* alpha_processing_sse41.c in Sources */, + 59EF4A1BF48F1375C1A16F1F67C4E1CB /* analysis_enc.c in Sources */, + 40D7050787F5656A10BC33473E3ED386 /* anim_decode.c in Sources */, + AE867D075484C878A384AAB20F6A719D /* anim_encode.c in Sources */, + 0784D52FFF9FF94B5628050CDA88862E /* backward_references_cost_enc.c in Sources */, + 5BE6FD1C2E1A7FD1DB259769EACBB324 /* backward_references_enc.c in Sources */, + 7D098C8F2EA09FB3E2C09EBD602D28DB /* bit_reader_utils.c in Sources */, + 0EAAA0E3EDF492EA9072C71CEB81AD7A /* bit_writer_utils.c in Sources */, + 8642D5924008D5431108F6D6AD77A008 /* buffer_dec.c in Sources */, + 6A622015A2048536175D6CF33A2CC984 /* color_cache_utils.c in Sources */, + 915D24E1F505FF3C580B62195F0BB2CB /* config_enc.c in Sources */, + 31D6F0AEA41367B9D0E70E48C7E8F535 /* cost.c in Sources */, + 1666EEFBA88DF2529D5AC364D0E1E376 /* cost_enc.c in Sources */, + 2C6A5195F45DEB1592DBB39BDB68B86D /* cost_mips32.c in Sources */, + F05B6301364E56BF74F3DEC11AAAD75B /* cost_mips_dsp_r2.c in Sources */, + CA3ACF41F93F7558F479945F22129798 /* cost_neon.c in Sources */, + B9B27B8CD19BDA6896C5CBDE86CB744F /* cost_sse2.c in Sources */, + 94294AA3E54A3AF30E4A868AE7747150 /* cpu.c in Sources */, + 10C93244A795BA758378F709D2E64E2D /* dec.c in Sources */, + D0B658E2ECD721230D2277001F13CA47 /* dec_clip_tables.c in Sources */, + 5F2E78FACD107E4277E2649CD6E886A9 /* dec_mips32.c in Sources */, + A5D3221BC3DADBEC08F49B502492A235 /* dec_mips_dsp_r2.c in Sources */, + 4275C5D87D76EEB5E649A7FC3D2451A6 /* dec_msa.c in Sources */, + BCC61FA7954E11291493E726363811AA /* dec_neon.c in Sources */, + 02D7E2B52239A310FE2F9E172E268793 /* dec_sse2.c in Sources */, + 6239F4687453A13853E0205B8D8C45A5 /* dec_sse41.c in Sources */, + 45A7004B4C4029FAB1EE07DD2D57D4C1 /* demux.c in Sources */, + 5A7F854F64CE15676E36E4D1B701D3F3 /* enc.c in Sources */, + 73430F6B3C647B6A1C59F79E156A4637 /* enc_mips32.c in Sources */, + 6AB6478F87ED222B02CE0A81708BF7A3 /* enc_mips_dsp_r2.c in Sources */, + 615BB2AA2A00B6D84EDCA5CDF4B9AA00 /* enc_msa.c in Sources */, + 4AD4B383BF61AC474E0D4905A386A538 /* enc_neon.c in Sources */, + EEA633264D70EB517CBC27CCA09DCA3E /* enc_sse2.c in Sources */, + 62DB9078449931A43F8B801A9EA12E22 /* enc_sse41.c in Sources */, + 252A8CD5EF71DFA598A0584EB3B8A382 /* filter_enc.c in Sources */, + 16F055F044196FBCAB05C2274E5925D3 /* filters.c in Sources */, + 4294331616A3709CB1CE62326F456813 /* filters_mips_dsp_r2.c in Sources */, + 6309AEB3667A67218B3D12AC247BE6E2 /* filters_msa.c in Sources */, + 49A8369D005F7438DC9E3796597CC8C1 /* filters_neon.c in Sources */, + 5B5B0D74898CA73CA5043A47CEA879FD /* filters_sse2.c in Sources */, + 35627D1149BB1E238A76EA293DFDE121 /* filters_utils.c in Sources */, + 90CECDD9ED75F3F5DA4B25278BF37E23 /* frame_dec.c in Sources */, + CBE82899693869558FA85BB43917C7A3 /* frame_enc.c in Sources */, + 27BD40A62B5DBCB190894006CB9BDA98 /* histogram_enc.c in Sources */, + B3B004B8167E0A2AB77D5F6236EEAA6B /* huffman_encode_utils.c in Sources */, + 2C46F977881E5684788823D4FC3B817C /* huffman_utils.c in Sources */, + EC553BCBFB97C4258734F55BD5F41ADE /* idec_dec.c in Sources */, + FE33148111F4FD908AE3AB83358705DE /* io_dec.c in Sources */, + 3F5DDF6016B2CA35F391A79CC8B307FA /* iterator_enc.c in Sources */, + 68FB4C6A0AA72F66547FDF27B0099E96 /* libwebp-dummy.m in Sources */, + 3C9CFF7308EE1AB818109BDA90DB5500 /* lossless.c in Sources */, + 3BD5CC5DE7B0FE1C6430E449E5FAD0BE /* lossless_enc.c in Sources */, + D19DEAF9E517C735C418D11C83A2E71A /* lossless_enc_mips32.c in Sources */, + 9B75E88E9B4FB2A3CE425C8CAB240D11 /* lossless_enc_mips_dsp_r2.c in Sources */, + C04B6C0FD689A2129B95A7A8323543DB /* lossless_enc_msa.c in Sources */, + 93C5B4B4C296A7F9AC4199D4D3E26C4F /* lossless_enc_neon.c in Sources */, + 84A3C303615E7E868E93032E261D7B36 /* lossless_enc_sse2.c in Sources */, + 7C2BFE7B58492F7EF2AC17967CCC2598 /* lossless_enc_sse41.c in Sources */, + 5A17505C0F707D934A954ED86C875E74 /* lossless_mips_dsp_r2.c in Sources */, + D792F513C9F9D858D8614BC0F1515F89 /* lossless_msa.c in Sources */, + C75E911116AAB82905EC4995BA1093FA /* lossless_neon.c in Sources */, + 7264640A393F58A97339B5300E572445 /* lossless_sse2.c in Sources */, + 4F57B54C1285473282B715BEFA437827 /* muxedit.c in Sources */, + 33E0068183DD999ACC130323A1D563FA /* muxinternal.c in Sources */, + 27D5F96CDA76CA186352155CF0366CF3 /* muxread.c in Sources */, + 9D1A197EF0EE35A7DD4696BBB9459DE1 /* near_lossless_enc.c in Sources */, + 90CEE202DA4A807D35EC6CD5D60BC729 /* picture_csp_enc.c in Sources */, + DD54A07F91E6DFF248C0E09223D7A807 /* picture_enc.c in Sources */, + 8D1BA441E2DAFB442FE3F2AAE448BACC /* picture_psnr_enc.c in Sources */, + 94FAADD7872A3D01DF60BC64898DDF72 /* picture_rescale_enc.c in Sources */, + FFD9E55353131B612B090216B3B9850E /* picture_tools_enc.c in Sources */, + 1DCCEA0FF50522086331A713487A4EF6 /* predictor_enc.c in Sources */, + 2C373E626BA963FEE80693959C52DDAE /* quant_dec.c in Sources */, + 74141DC8EBA403034EA6A22A0C20E181 /* quant_enc.c in Sources */, + 55E9296400238C9E2506DE36EE4509E1 /* quant_levels_dec_utils.c in Sources */, + 19558CF36F8291F10C60620A48DDA431 /* quant_levels_utils.c in Sources */, + 06001FD93320CD1B989AE9EFA5C0F396 /* random_utils.c in Sources */, + 361C64C99F2AB7479F201E6B74BB80C5 /* rescaler.c in Sources */, + 8AACC5E42AFD75008FD59B8088FEF018 /* rescaler_mips32.c in Sources */, + 3723CC5D9030ACD6B36711488589F8C5 /* rescaler_mips_dsp_r2.c in Sources */, + 4EE2FB609D448D4820A415BEDF34F4F0 /* rescaler_msa.c in Sources */, + 1C67C8CE2ABF17A444CD161132FDA871 /* rescaler_neon.c in Sources */, + 5070DC5447295C7BE9412DC271EDED7B /* rescaler_sse2.c in Sources */, + 9FE633D2FDB9D167609C6D9952BB688B /* rescaler_utils.c in Sources */, + D39D2F4755A5BF6EA102F9CFE16E9D31 /* ssim.c in Sources */, + A94A79AE097EB3C0F8D1E5292152B9EF /* ssim_sse2.c in Sources */, + BF3C49F54B5EF7B66D446BFCF77FA2CA /* syntax_enc.c in Sources */, + 999AA04824D684C98E2EB6D1F2EF8A5F /* thread_utils.c in Sources */, + 96BACC16C970F0B48B5B6F038BE861E3 /* token_enc.c in Sources */, + 999F1C702C6FE02406BBCFDC8534599F /* tree_dec.c in Sources */, + CD4DF4C53C61172849734EBB76490FF5 /* tree_enc.c in Sources */, + F26B29DEFD829AC98EFA198676E4CA13 /* upsampling.c in Sources */, + 97799C73F159687FD7F213D33EE91CDB /* upsampling_mips_dsp_r2.c in Sources */, + 4B6BC1CD79F54D7B6E4EF93E60F24050 /* upsampling_msa.c in Sources */, + 8585FF0A4866CC89299A9F74DD9B6F14 /* upsampling_neon.c in Sources */, + 34D5336F3566955F80268EB214EAF86A /* upsampling_sse2.c in Sources */, + 9B2685DFE7C04FCD68207E3C6502301A /* upsampling_sse41.c in Sources */, + 2D81205FCD584D8A3DA373D966F3FAAF /* utils.c in Sources */, + A1FCCFFB79A9FF9721AE7F0FDDBA732A /* vp8_dec.c in Sources */, + 80E571D803509B44DD64950C26FB25F5 /* vp8l_dec.c in Sources */, + 240C1DE6C392B6B83ADCF49E7E64F9F0 /* vp8l_enc.c in Sources */, + 0BC931185BC5EA4B6E0B6AE750229CF6 /* webp_dec.c in Sources */, + F3D9678DFB7618967EC3C72A8462E3FD /* webp_enc.c in Sources */, + 565CB8B0FDE1675DA4A5E7B90A7F8E0F /* yuv.c in Sources */, + 40D912D8612346E0BB4E2F3A7A242F58 /* yuv_mips32.c in Sources */, + 4BFBD7E157BAA9C550CFEBFDBF83D633 /* yuv_mips_dsp_r2.c in Sources */, + FF9B35D5406687AE668C6A60FB5EBB2F /* yuv_neon.c in Sources */, + 44D77CC53C0A24DFC8FB76B5FA05E5C1 /* yuv_sse2.c in Sources */, + ACB0B17031678E25550EDA948B61549F /* yuv_sse41.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 782F5B05FDFB9DCEEB9E63CF3E0803BC /* Sources */ = { + 7B7D6C939B19D9A1A4F242E4A7F545BC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3C58BF5E9E62E35D5A84CF97DDB080C9 /* Pods-BAWKWebView-WebP-dummy.m in Sources */, + 13DD0ED8B2550861225C063394042F40 /* SDImageWebPCoder.m in Sources */, + 98C1BE9DD6E7F49A6239E6E2767508D1 /* SDWebImageWebPCoder-dummy.m in Sources */, + A5ABDBAA0AF273222B55136436EDB26A /* UIImage+WebP.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9B58A8F76D843B577348CF7A62F7F973 /* Sources */ = { + 811E255F9DA765E3FED6313B480D487A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 666475067148173B549ABA53B39664A1 /* alpha_dec.c in Sources */, - 8B9E1C2AD50CF8EA6FF38EC9F51D22A9 /* alpha_enc.c in Sources */, - E835019F5E4FE9C176B2F62CC54107C3 /* alpha_processing.c in Sources */, - 4456E2D460F706375E2FB38D43716FF9 /* alpha_processing_mips_dsp_r2.c in Sources */, - 79F065451B0393135996F4780713FE61 /* alpha_processing_neon.c in Sources */, - A8826B00E26DCD1C761D13E5209BE82F /* alpha_processing_sse2.c in Sources */, - FE393CB77FD2EF6E3432D07495E47744 /* alpha_processing_sse41.c in Sources */, - 943FD7D10CF13D1E92F16D4589807959 /* analysis_enc.c in Sources */, - 793C0B05270E72F56D237CE9DA3EBDE3 /* anim_decode.c in Sources */, - 19674A4E91F6BD1AAE2F39C27F9212A9 /* anim_encode.c in Sources */, - BA303AC78DD2F2FC4AFD2C201312ED11 /* argb.c in Sources */, - A922B14567B3A64B5342F9BA79BC2B14 /* argb_mips_dsp_r2.c in Sources */, - 15A9AC346F352BEC0A93008B4BCB7DA4 /* argb_sse2.c in Sources */, - 841A23B8E1F461EAE3457D82553F174A /* backward_references_enc.c in Sources */, - 1C78A85BEC1B77EE1F0F48CE1E162538 /* bit_reader_utils.c in Sources */, - FBA67B1EB74122D7495F4AE61800B495 /* bit_writer_utils.c in Sources */, - 541CD2E3D5B9C423CC11E7D05F1E3387 /* buffer_dec.c in Sources */, - 1E186C5D5131C950386CACCDA056E3C3 /* color_cache_utils.c in Sources */, - 6753BEDAE266647E738A547D20C5CDEC /* config_enc.c in Sources */, - 7B30E0F573D1EBF13827900EF5835AE3 /* cost.c in Sources */, - F8164DAF5B417C58D8E1C95E12118A4D /* cost_enc.c in Sources */, - ED53A5815DBDFADDE07E36B720D4F46D /* cost_mips32.c in Sources */, - 0BE38971FBFBA9D05AE5A2C6A81B39F1 /* cost_mips_dsp_r2.c in Sources */, - 5853F985A0EF8FA559562BEB69EA1676 /* cost_sse2.c in Sources */, - 9634BF376C33E804351958AA4A8F2C35 /* cpu.c in Sources */, - 34DD7504166CCE07253FEFA65C63AF1D /* dec.c in Sources */, - 99D3D70C9DE6834976BF0467004F4F66 /* dec_clip_tables.c in Sources */, - 16304DB7459CE602884C6F921B6F7CB1 /* dec_mips32.c in Sources */, - E177D6271986D3B423442E9BAADEC7AE /* dec_mips_dsp_r2.c in Sources */, - E76F79BD0538E8F9CF6EA43D90D12DA9 /* dec_msa.c in Sources */, - 2E8B346F9337878B493307F7E4A55B22 /* dec_neon.c in Sources */, - 7A8A01A8C3F0F9C875AA6D80AD009834 /* dec_sse2.c in Sources */, - 552F11E1FE546C4D981FB5A4D9EE9E82 /* dec_sse41.c in Sources */, - 9A60BC61105F874564CF481A3FD30B74 /* delta_palettization_enc.c in Sources */, - 87A3521EEF2EB2F9A7DECC323E668226 /* demux.c in Sources */, - 74B269F9AC4453A5FDC99FC4ED87D05E /* enc.c in Sources */, - FE9B4F4AFC850ECE6AE4F8911605A70B /* enc_avx2.c in Sources */, - 10B07E886195BE557FBA22C360E6BA42 /* enc_mips32.c in Sources */, - A209F727815C972FD2A45AB7BEAC808A /* enc_mips_dsp_r2.c in Sources */, - 42449017B412957A9A0AD06C0B7C2E10 /* enc_msa.c in Sources */, - F1A877793B2BF25180ED8A4BFE13FFBE /* enc_neon.c in Sources */, - 4E5331CCCF0B6E326BE2F8851E3154F9 /* enc_sse2.c in Sources */, - 456E9F576506B7D751FE36007CBCC7FB /* enc_sse41.c in Sources */, - A9BEBCE5385060F7A5387D219EF4900A /* filter_enc.c in Sources */, - 576361C68FAA2E7917142D50B931311A /* filters.c in Sources */, - 3DAD2CEF8944EC89DD6208233065FEBC /* filters_mips_dsp_r2.c in Sources */, - ED5D923DE079AEB45FCC88E0CE4A890E /* filters_msa.c in Sources */, - A832CA161D153313960551432059F944 /* filters_neon.c in Sources */, - EBF49AEDEB9D1D22DD68975274B30C81 /* filters_sse2.c in Sources */, - A350A19AF7E6E7CBA40963972924E976 /* filters_utils.c in Sources */, - 57B11B5A4A20379C159A1D8B5E8795AC /* frame_dec.c in Sources */, - 45C8C768AF42C31F53BE0A8598891094 /* frame_enc.c in Sources */, - 99EDAAD1CE117B19531E5F46366288B2 /* histogram_enc.c in Sources */, - 897DD4B7D8CB1EABF43C735D8449E28C /* huffman_encode_utils.c in Sources */, - 178250CFF1CB2FEF9F21625325D26FCE /* huffman_utils.c in Sources */, - 556FCC73482CEDD2ECB862158C93B4C8 /* idec_dec.c in Sources */, - B4752F9E2070CB4B185ADF538FF8AFD6 /* io_dec.c in Sources */, - 94CE56D26BBAF6298F664E8D53DDEDB9 /* iterator_enc.c in Sources */, - 865F4022BA6999B58F56AB340D4A0275 /* libwebp-dummy.m in Sources */, - 523DF275271AECE6B49A5D8D51948C5B /* lossless.c in Sources */, - A0066DA1A1FBDC137BCFDCEC0832AD09 /* lossless_enc.c in Sources */, - 7825B2061A301D3FEF0ED395FDD13376 /* lossless_enc_mips32.c in Sources */, - 4E8B6D725A5B06D62D675AF985D15021 /* lossless_enc_mips_dsp_r2.c in Sources */, - 811059F9BE51E53E55414B95B0BA47F5 /* lossless_enc_msa.c in Sources */, - D9E09E1B3D5FA05128AF87E1165A077E /* lossless_enc_neon.c in Sources */, - 01CF3D9EE9965E7363247BEA4199F606 /* lossless_enc_sse2.c in Sources */, - 64F9DBBD1D57C6F8FD20C9A31EBAD36C /* lossless_enc_sse41.c in Sources */, - E5B2B8BD64C7EFEF2DE571099300942C /* lossless_mips_dsp_r2.c in Sources */, - 4BD38E193F2DC2E7EE7A44B650F0C95B /* lossless_msa.c in Sources */, - C4244162D3E794ABF4D6D716246C6478 /* lossless_neon.c in Sources */, - 231DFB22AF6C21F8F7677DF0CFADCA4F /* lossless_sse2.c in Sources */, - 9F1CA954BE7A6C1B84E4BBC2FD3BFD99 /* muxedit.c in Sources */, - 9FB7626E15050A979FA210C94C367905 /* muxinternal.c in Sources */, - 6A6FA4C326453999D2E23E5550B99083 /* muxread.c in Sources */, - 05DC8164E7F932AF38DCC301D099E741 /* near_lossless_enc.c in Sources */, - BBBF5B3FECBE86195C5E9D83BEF2E9DC /* picture_csp_enc.c in Sources */, - 524FEA883297A3D6CF7703908F3EE2FE /* picture_enc.c in Sources */, - F7842E697CF754A77E0093178B7D2F0C /* picture_psnr_enc.c in Sources */, - F34899DAC8CDB83A1CAA13C7B4B1E12B /* picture_rescale_enc.c in Sources */, - A0294FB0CD4D24607CF53C81E0656F22 /* picture_tools_enc.c in Sources */, - 7DA4D17DA9A9CB80CD124409AB08F21E /* predictor_enc.c in Sources */, - 3A58F3C09A66F315200586E8A82F1B8E /* quant_dec.c in Sources */, - 13DF82442C97416D066BB72828F5EAFC /* quant_enc.c in Sources */, - AA31C03B80CF7B795C772BB2E86D187F /* quant_levels_dec_utils.c in Sources */, - 71D1FAB0D40EDB160EFA4A448E91F2C2 /* quant_levels_utils.c in Sources */, - 94729876798C4307378E91E3B0127503 /* random_utils.c in Sources */, - B570CB6DB3A4D583786D5D6F0DCE22A5 /* rescaler.c in Sources */, - 586D44338F17A807AB0DBE8AB054876E /* rescaler_mips32.c in Sources */, - 2018D8AD570D5BB0DE270186C23ACF1F /* rescaler_mips_dsp_r2.c in Sources */, - 6F9065932DBA28FF60BADDED1EEB0C2C /* rescaler_msa.c in Sources */, - C315EB4F16C60823D16DF2F491C2EDB3 /* rescaler_neon.c in Sources */, - 3BB68661B1FC282927009791BAC602FC /* rescaler_sse2.c in Sources */, - 4FD1BF41B8F11978A557B2CAB5EFDABE /* rescaler_utils.c in Sources */, - A12AF81C603BA849A5CB05351085525C /* syntax_enc.c in Sources */, - 197FCDD97986C1882E8AB47C91366B62 /* thread_utils.c in Sources */, - D91E21A92C5F8CACF1375D70C5055B97 /* token_enc.c in Sources */, - 7D46498AC02DFCA4C92BC30EC6BFEFCD /* tree_dec.c in Sources */, - 07BB5453421EE5858BF73C176DF7B656 /* tree_enc.c in Sources */, - 702D2F21769D4D65464396E40BBE8BAF /* upsampling.c in Sources */, - A80F99106C388614D9DE653154F602E2 /* upsampling_mips_dsp_r2.c in Sources */, - 071E36682EB08BFCD6D80A787079DD6B /* upsampling_msa.c in Sources */, - 72F281A2CA796C4CF7C8FA54838021C1 /* upsampling_neon.c in Sources */, - A9A42A52AAED41828D0CB7028EAF96E5 /* upsampling_sse2.c in Sources */, - 4434B00162E276B3312791980ACC694F /* utils.c in Sources */, - DDC00491ABF7D2FF861B3DE561116F9B /* vp8_dec.c in Sources */, - 9A41DD3CA26AC00C2CD95029720BE833 /* vp8l_dec.c in Sources */, - 9545551D99110135D09F35202B039AC5 /* vp8l_enc.c in Sources */, - 384F622FBFD74EE3BB38E6995EB34669 /* webp_dec.c in Sources */, - 86D45BCBEFF8F5B7C342E9837DAC9F47 /* webp_enc.c in Sources */, - 7F97DF22CDE2C0D0FFCA758FB2D05E5F /* yuv.c in Sources */, - B2123B94BD159808B958C3097C4AE7D1 /* yuv_mips32.c in Sources */, - 4A4D22F2F983A2C9F44FD5D6E1E556FC /* yuv_mips_dsp_r2.c in Sources */, - 03A8CA66D7EA6166252E1DB203DA8EE9 /* yuv_sse2.c in Sources */, + B284E952224927D138B8A67AABA0A312 /* NSBezierPath+SDRoundedCorners.m in Sources */, + 293B9392E2E0687D5CD3A77E69A5095A /* NSButton+WebCache.m in Sources */, + 084F36480B7CF5E32993077A0B5A31F4 /* NSData+ImageContentType.m in Sources */, + B57742214BEE9AEBEBAD8AEA7EFCDB0D /* NSImage+Compatibility.m in Sources */, + 128CB82581C01598C1E2F282C3EF6E6E /* SDAnimatedImage.m in Sources */, + 03A3C427BCEAEB0168C5B1DA5B9A0B86 /* SDAnimatedImagePlayer.m in Sources */, + FCC25A540DF0CA820C1CCC7FFBE456FD /* SDAnimatedImageRep.m in Sources */, + 8E647828E4C169D55AAC86DB40DFF31C /* SDAnimatedImageView+WebCache.m in Sources */, + DA1748D1A95CFB09630C1B1318088350 /* SDAnimatedImageView.m in Sources */, + 6B27BE8C3E5E28F3B309307E87B99329 /* SDAssociatedObject.m in Sources */, + 2184532A10E7502EA915D91369DFAC3C /* SDAsyncBlockOperation.m in Sources */, + 4EDBB4AAEEF26534BCF67340B60B9DC8 /* SDDeviceHelper.m in Sources */, + 2700A36B8534C45316DAB554E8498A28 /* SDDiskCache.m in Sources */, + 4E2E631DAE70D9ADC5E05F1747055785 /* SDDisplayLink.m in Sources */, + 608320766ED3066F8080E29D8BE0E1C6 /* SDFileAttributeHelper.m in Sources */, + 3DA9427AF38AE205761D1D5222EB91C0 /* SDGraphicsImageRenderer.m in Sources */, + 787AE202E71EF711783ABDEAA6D52204 /* SDImageAPNGCoder.m in Sources */, + F026D9C39DB59AD0F3F7F6F6371A22B7 /* SDImageAssetManager.m in Sources */, + 55371E0911F21A2F708C6A746DE8C708 /* SDImageAWebPCoder.m in Sources */, + 09BB6FF47D5A11F537E308ED12029DF8 /* SDImageCache.m in Sources */, + DAB56CA3BF77D40CED6C19224D5E1794 /* SDImageCacheConfig.m in Sources */, + EA53B89AAC16CE584E6F5DD11D500FC8 /* SDImageCacheDefine.m in Sources */, + C30CC261B75B92063A8E43BF9F019C47 /* SDImageCachesManager.m in Sources */, + B92DB014092D3F8C4C168D2408447080 /* SDImageCachesManagerOperation.m in Sources */, + 1E06190F195923FEB645A405D6DC1BCF /* SDImageCoder.m in Sources */, + 1A296D9023756DF9DF7E2977BE422FB2 /* SDImageCoderHelper.m in Sources */, + 335B7A12B7EC0BD569580A3DE383D24D /* SDImageCodersManager.m in Sources */, + 3A9FAA5BD20B70FCB5966FD24C6152F4 /* SDImageFrame.m in Sources */, + F3C1F7F0CB3B466A65876F39EBDBFC65 /* SDImageGIFCoder.m in Sources */, + 5CB41A59A4D3FA5BC111747983E0AE46 /* SDImageGraphics.m in Sources */, + F6541A2BAA913272621A7CB6C823B035 /* SDImageHEICCoder.m in Sources */, + EDCD926B479A4DD0BCFFFA5B36BE2460 /* SDImageIOAnimatedCoder.m in Sources */, + 8AE193AD518D868F8A380BFBA29EE940 /* SDImageIOCoder.m in Sources */, + 345E2C203E2D12E7E3546F2E8344A79B /* SDImageLoader.m in Sources */, + 8CB39B392ABF658314F209F7EC25352E /* SDImageLoadersManager.m in Sources */, + 92E4B15C6FF94A4FAA4A17621199703B /* SDImageTransformer.m in Sources */, + 2ECB81FC72C7BB5040F10C021225ADED /* SDInternalMacros.m in Sources */, + 80B7FBA8291E76D74A651249A0E211FC /* SDMemoryCache.m in Sources */, + 9881C8FF40D8F62F2B371FB262AA00FD /* SDWeakProxy.m in Sources */, + 53D5A906B201B5F4A53C894D88FF09FC /* SDWebImage-dummy.m in Sources */, + 3063231F3293E15061B3225DDE746FE6 /* SDWebImageCacheKeyFilter.m in Sources */, + D45D3AEB9410A3EFF7DC52DDE5435CA8 /* SDWebImageCacheSerializer.m in Sources */, + 6B990DFF59699A54E9F4ADACB4DF432D /* SDWebImageCompat.m in Sources */, + 511B2B2E911994B978C25D5FA3CD524B /* SDWebImageDefine.m in Sources */, + 0ADFB8408D908E0C8F0A263AF44E663B /* SDWebImageDownloader.m in Sources */, + 03ECE44E890B0E77E66141A886FF7384 /* SDWebImageDownloaderConfig.m in Sources */, + 3B202DB775F482F8C829FEBD7B83C154 /* SDWebImageDownloaderDecryptor.m in Sources */, + BD83DCDB2BACC262DC641340F62DBA95 /* SDWebImageDownloaderOperation.m in Sources */, + 1B7FDF02A13B654CBEDB846B2D82B85B /* SDWebImageDownloaderRequestModifier.m in Sources */, + DF091238315C2F3AE424E99745B03CB2 /* SDWebImageDownloaderResponseModifier.m in Sources */, + 6EC86A31DE9C7210CD8965CCE49A6342 /* SDWebImageError.m in Sources */, + CD2245532B231B39146928B82B664800 /* SDWebImageIndicator.m in Sources */, + DBB7C38541245840971728B2671146FF /* SDWebImageManager.m in Sources */, + 454308F281F806DEB35D19FAD2B02B9E /* SDWebImageOperation.m in Sources */, + E51D30B8AB319E61C437334D13FC859F /* SDWebImageOptionsProcessor.m in Sources */, + 6A22FA3944743E3967A46D599F7ACBA7 /* SDWebImagePrefetcher.m in Sources */, + F1AD535E49AC4E77FEA30208554EDB69 /* SDWebImageTransition.m in Sources */, + 3D2FEFBFF5B0E97FB3648C24FB791766 /* UIButton+WebCache.m in Sources */, + 29C5E1AF8AE16F1F32B96B212AC91C37 /* UIColor+SDHexString.m in Sources */, + B83B6A071701DB7EF8D4D65EFB9EEC1B /* UIImage+ExtendedCacheData.m in Sources */, + 2FEBC0F3A58CD98F759E592B3916FEF0 /* UIImage+ForceDecode.m in Sources */, + A00B584A73A9FF6D08B9CC8E6FD90AFB /* UIImage+GIF.m in Sources */, + B07B0193B545AD11E0A9971DCDB97EDB /* UIImage+MemoryCacheCost.m in Sources */, + 69C754CBBC23A9D99FF051A2C963CD59 /* UIImage+Metadata.m in Sources */, + E7165ACE4E69370B6C21B814BE564B38 /* UIImage+MultiFormat.m in Sources */, + 53F80EABDB1A385F25DFA6710C51B600 /* UIImage+Transform.m in Sources */, + A5C2E63BDEE0B253240BD476588A7841 /* UIImageView+HighlightedWebCache.m in Sources */, + 998389497E9FD2964EB1277B4831AFF8 /* UIImageView+WebCache.m in Sources */, + 14C549A762DA24F3F10E5722D8D40FFD /* UIView+WebCache.m in Sources */, + 24D5A665091087501AA9B1F6AD200331 /* UIView+WebCacheOperation.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9906E39DEC4C580F808979C324FDF5A6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3694FBE54A9B05A19E577B49FD4800C5 /* Pods-BAWKWebView-WebP-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 32B1D4E7F61BB0DE791F1FC3549A72FD /* PBXTargetDependency */ = { + 678C0BCF3F952AD7ED3D722ADF758E96 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = libwebp; - target = FB6F7635FB13EEAE9014EE007FE8B0B7 /* libwebp */; - targetProxy = AE0D0DDF7508D399ED451485FD62C2FD /* PBXContainerItemProxy */; + name = SDWebImage; + target = 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */; + targetProxy = A6C5BA4BEF92BB3CC25A178C4DC93AD1 /* PBXContainerItemProxy */; }; - 56A64311E0D6C06E5B647BE2525060BF /* PBXTargetDependency */ = { + 901E45660B09D870DC10940C96C4120D /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = SDWebImage; - target = 43603B6242089017A8B51CE72FE882A9 /* SDWebImage */; - targetProxy = A97A881B8C501BCC92A1721556A9BE7E /* PBXContainerItemProxy */; + name = libwebp; + target = 47D2E85A78C25869BB13521D8561A638 /* libwebp */; + targetProxy = 5C3F4DB3061711016C2CF42C9FF1287C /* PBXContainerItemProxy */; }; - 5CCEAE0DD52702C7094C809D9ACA0720 /* PBXTargetDependency */ = { + BD0C7079398DDDB809F854D10602CC16 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = libwebp; - target = FB6F7635FB13EEAE9014EE007FE8B0B7 /* libwebp */; - targetProxy = 4691DE3F219FF6147B06234EEFEA13E1 /* PBXContainerItemProxy */; + target = 47D2E85A78C25869BB13521D8561A638 /* libwebp */; + targetProxy = AAC4D3A79161FBD590A1E718A45733A4 /* PBXContainerItemProxy */; + }; + CD82CFE67C08BE8E59A0B6A6A621535E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SDWebImageWebPCoder; + target = 1953860EA9853AA2BC8022B242F08512 /* SDWebImageWebPCoder */; + targetProxy = F38F445980C110B347313AFCD63FE181 /* PBXContainerItemProxy */; + }; + D97E6CD929CEF8FCA44F6FF8350FEC5E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SDWebImage; + target = 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */; + targetProxy = 148FF36D1D131C39AF068467A3E59841 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 2BFCD4C7635CD620C4FDD0AE9BB24112 /* Release */ = { + 315210CE8CB8097CE8C8C6529764346B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 26632BF1573382E5076307FEF5547CBA /* SDWebImageWebPCoder.release.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_MODULE_NAME = SDWebImageWebPCoder; + PRODUCT_NAME = SDWebImageWebPCoder; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 52918B1DFF0D957FAE684BF425D5C572 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55F01B7A768A9D12518E8A1380EC17E2 /* libwebp.release.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + GCC_PREFIX_HEADER = "Target Support Files/libwebp/libwebp-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_MODULE_NAME = libwebp; + PRODUCT_NAME = libwebp; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7C282B76F46AFC3BF8480C17A9C37646 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 158D5B12074B414E45620EBA540E900A /* SDWebImageWebPCoder.debug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_MODULE_NAME = SDWebImageWebPCoder; + PRODUCT_NAME = SDWebImageWebPCoder; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 8F17DC3A99F99FBAD606CE6963886315 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "POD_CONFIGURATION_RELEASE=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; SYMROOT = "${SRCROOT}/../build"; - VALIDATE_PRODUCT = YES; }; name = Release; }; - 3B492C6E1DC448FB38495E747B0EE3F4 /* Release */ = { + 916E0404255105F480DC4950B7625F7A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 962D0A891D2167D695D508748BF135C5 /* Pods-BAWKWebView-WebP.release.xcconfig */; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACH_O_TYPE = staticlib; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + SYMROOT = "${SRCROOT}/../build"; }; - name = Release; + name = Debug; }; - 4017162CAD6FD4907DAF25261F12E5B1 /* Debug */ = { + A709C29E6CAC388951C186EC5D8A8995 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3A92C6C20F170DFFEB05DDCB81CB6243 /* libwebp.xcconfig */; + baseConfigurationReference = 2F6FF0D21CE328D625C601243A01B4E2 /* SDWebImage.release.xcconfig */; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/libwebp/libwebp-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - MTL_ENABLE_DEBUG_INFO = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImage/SDWebImage-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_MODULE_NAME = SDWebImage; + PRODUCT_NAME = SDWebImage; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; }; - name = Debug; + name = Release; }; - 574EBF0D9CADDAD36243CFCA1AE77B35 /* Debug */ = { + CCCEF284F584CB5A39AE44DD66B06956 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DEC54D6DBDF533CE64763A734C28800F /* Pods-BAWKWebView-WebP.debug.xcconfig */; + baseConfigurationReference = CD61694F952DC7B18DBE9C9E6F81AED9 /* Pods-BAWKWebView-WebP.debug.xcconfig */; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MACH_O_TYPE = staticlib; - MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; - 69E54454C8D5087C3E771CA37ABD61B7 /* Release */ = { + CFFAD5DE82F514EE05CE1B0C9F369292 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3A92C6C20F170DFFEB05DDCB81CB6243 /* libwebp.xcconfig */; + baseConfigurationReference = E2FFE2459B53D5341EE0A8FF62FEE5FD /* Pods-BAWKWebView-WebP.release.xcconfig */; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/libwebp/libwebp-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - MTL_ENABLE_DEBUG_INFO = NO; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MACH_O_TYPE = staticlib; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; - PRIVATE_HEADERS_FOLDER_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; }; name = Release; }; - 925E690A6CF015E713D800EC49B46A3F /* Debug */ = { + E85DCFCCD542258F6520C6F1A1472887 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1F0BB5092F1868E49C84E448F2AA0656 /* SDWebImage.xcconfig */; + baseConfigurationReference = 992777B890E8FC5A26DB1AE09612AF71 /* libwebp.debug.xcconfig */; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/SDWebImage/SDWebImage-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - MTL_ENABLE_DEBUG_INFO = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + GCC_PREFIX_HEADER = "Target Support Files/libwebp/libwebp-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_MODULE_NAME = libwebp; + PRODUCT_NAME = libwebp; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; - A92FD8A9F6A3F264212D50D84D4A0A6C /* Debug */ = { + E8A5E0B347B5B18FB2CE48D6923CCD0A /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 15DF3A2B1426ED2AC1A59FC36F9260E9 /* SDWebImage.debug.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Debug; - }; - C2C3FAC0707968B555440E96F63964DB /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1F0BB5092F1868E49C84E448F2AA0656 /* SDWebImage.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/SDWebImage/SDWebImage-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - MTL_ENABLE_DEBUG_INFO = NO; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_MODULE_NAME = SDWebImage; + PRODUCT_NAME = SDWebImage; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + TARGETED_DEVICE_FAMILY = "1,2"; }; - name = Release; + name = Debug; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + 12892FBF589BA736ED3577CA116AC0A1 /* Build configuration list for PBXNativeTarget "libwebp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E85DCFCCD542258F6520C6F1A1472887 /* Debug */, + 52918B1DFF0D957FAE684BF425D5C572 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2660B93F2F6B9EEBB622A5047DEBEF88 /* Build configuration list for PBXNativeTarget "Pods-BAWKWebView-WebP" */ = { isa = XCConfigurationList; buildConfigurations = ( - A92FD8A9F6A3F264212D50D84D4A0A6C /* Debug */, - 2BFCD4C7635CD620C4FDD0AE9BB24112 /* Release */, + CCCEF284F584CB5A39AE44DD66B06956 /* Debug */, + CFFAD5DE82F514EE05CE1B0C9F369292 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 52FF492AA1DAA3E7C8E2A30CBF17EC2E /* Build configuration list for PBXNativeTarget "SDWebImage" */ = { + 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - 925E690A6CF015E713D800EC49B46A3F /* Debug */, - C2C3FAC0707968B555440E96F63964DB /* Release */, + 916E0404255105F480DC4950B7625F7A /* Debug */, + 8F17DC3A99F99FBAD606CE6963886315 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 782CF098BF9ED8595030B25E0F56FE2C /* Build configuration list for PBXNativeTarget "Pods-BAWKWebView-WebP" */ = { + 882E705FCDE06AF9F3A4A8B8F6C1CFC4 /* Build configuration list for PBXNativeTarget "SDWebImageWebPCoder" */ = { isa = XCConfigurationList; buildConfigurations = ( - 574EBF0D9CADDAD36243CFCA1AE77B35 /* Debug */, - 3B492C6E1DC448FB38495E747B0EE3F4 /* Release */, + 7C282B76F46AFC3BF8480C17A9C37646 /* Debug */, + 315210CE8CB8097CE8C8C6529764346B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 7ADC89279956A906200ACC52BAE3EF27 /* Build configuration list for PBXNativeTarget "libwebp" */ = { + B1FA491365904802AD9D5BF4683066A6 /* Build configuration list for PBXNativeTarget "SDWebImage" */ = { isa = XCConfigurationList; buildConfigurations = ( - 4017162CAD6FD4907DAF25261F12E5B1 /* Debug */, - 69E54454C8D5087C3E771CA37ABD61B7 /* Release */, + E8A5E0B347B5B18FB2CE48D6923CCD0A /* Debug */, + A709C29E6CAC388951C186EC5D8A8995 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; } diff --git a/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/Pods-BAWKWebView-WebP.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/Pods-BAWKWebView-WebP.xcscheme new file mode 100644 index 0000000..7cd3f06 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/Pods-BAWKWebView-WebP.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImage.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImage.xcscheme new file mode 100644 index 0000000..6302782 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImage.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImageWebPCoder.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImageWebPCoder.xcscheme new file mode 100644 index 0000000..b400429 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/SDWebImageWebPCoder.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/libwebp.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/libwebp.xcscheme new file mode 100644 index 0000000..3160cdb --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/libwebp.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..a082506 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/mvmtv.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,39 @@ + + + + + SchemeUserState + + Pods-BAWKWebView-WebP.xcscheme + + isShown + + orderHint + 1 + + SDWebImage.xcscheme + + isShown + + orderHint + 2 + + SDWebImageWebPCoder.xcscheme + + isShown + + orderHint + 3 + + libwebp.xcscheme + + isShown + + orderHint + 0 + + + SuppressBuildableAutocreation + + + diff --git a/Pods/SDWebImage/LICENSE b/Pods/SDWebImage/LICENSE index 810cf88..2f5785d 100644 --- a/Pods/SDWebImage/LICENSE +++ b/Pods/SDWebImage/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com +Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Pods/SDWebImage/README.md b/Pods/SDWebImage/README.md index e621454..f407802 100644 --- a/Pods/SDWebImage/README.md +++ b/Pods/SDWebImage/README.md @@ -1,16 +1,16 @@

- +

-[![Build Status](http://img.shields.io/travis/rs/SDWebImage/master.svg?style=flat)](https://travis-ci.org/rs/SDWebImage) +[![Build Status](http://img.shields.io/travis/SDWebImage/SDWebImage/master.svg?style=flat)](https://travis-ci.org/SDWebImage/SDWebImage) [![Pod Version](http://img.shields.io/cocoapods/v/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/) [![Pod Platform](http://img.shields.io/cocoapods/p/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/) [![Pod License](http://img.shields.io/cocoapods/l/SDWebImage.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html) -[![Dependency Status](https://www.versioneye.com/objective-c/sdwebimage/badge.svg?style=flat)](https://www.versioneye.com/objective-c/sdwebimage) -[![Reference Status](https://www.versioneye.com/objective-c/sdwebimage/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/sdwebimage/references) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/rs/SDWebImage) -[![codecov](https://codecov.io/gh/rs/SDWebImage/branch/master/graph/badge.svg)](https://codecov.io/gh/rs/SDWebImage) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg)](https://github.com/SDWebImage/SDWebImage) +[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/) +[![Mac Catalyst compatible](https://img.shields.io/badge/Catalyst-compatible-brightgreen.svg)](https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app/) +[![codecov](https://codecov.io/gh/SDWebImage/SDWebImage/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImage) This library provides an async image downloader with cache support. For convenience, we added categories for UI elements like `UIImageView`, `UIButton`, `MKAnnotationView`. @@ -19,43 +19,107 @@ This library provides an async image downloader with cache support. For convenie - [x] Categories for `UIImageView`, `UIButton`, `MKAnnotationView` adding web image and cache management - [x] An asynchronous image downloader - [x] An asynchronous memory + disk image caching with automatic cache expiration handling -- [x] A background image decompression +- [x] A background image decompression to avoid frame rate drop +- [x] [Progressive image loading](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#progressive-animation) (including animated image, like GIF showing in Web browser) +- [x] [Thumbnail image decoding](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#thumbnail-decoding-550) to save CPU && Memory for large images +- [x] [Extendable image coder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-coder-420) to support massive image format, like WebP +- [x] [Full-stack solution for animated images](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) which keep a balance between CPU && Memory +- [x] [Customizable and composable transformations](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#transformer-50) can be applied to the images right after download +- [x] [Customizable and multiple caches system](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-cache-50) +- [x] [Customizable and multiple loaders system](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-loader-50) to expand the capabilities, like [Photos Library](https://github.com/SDWebImage/SDWebImagePhotosPlugin) +- [x] [Image loading indicators](https://github.com/SDWebImage/SDWebImage/wiki/How-to-use#use-view-indicator-50) +- [x] [Image loading transition animation](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#image-transition-430) - [x] A guarantee that the same URL won't be downloaded several times - [x] A guarantee that bogus URLs won't be retried again and again - [x] A guarantee that main thread will never be blocked +- [x] Modern Objective-C and better Swift support - [x] Performances! -- [x] Use GCD and ARC ## Supported Image Formats -- Image formats supported by UIImage (JPEG, PNG, ...), including GIF -- WebP format, including animated WebP (use the `WebP` subspec) +- Image formats supported by Apple system (JPEG, PNG, TIFF, HEIC, ...), including GIF/APNG/HEIC animation +- WebP format, including animated WebP (use the [SDWebImageWebPCoder](https://github.com/SDWebImage/SDWebImageWebPCoder) project). Note iOS 14/macOS 11.0 supports built-in WebP decoding (no encoding). +- Support extendable coder plugins for new image formats like BPG, AVIF. And vector format like PDF, SVG. See all the list in [Image coder plugin List](https://github.com/SDWebImage/SDWebImage/wiki/Coder-Plugin-List) + +## Additional modules and Ecosystem + +In order to keep SDWebImage focused and limited to the core features, but also allow extensibility and custom behaviors, during the 5.0 refactoring we focused on modularizing the library. +As such, we have moved/built new modules to [SDWebImage org](https://github.com/SDWebImage). + +#### SwiftUI +[SwiftUI](https://developer.apple.com/xcode/swiftui/) is an innovative UI framework written in Swift to build user interfaces across all Apple platforms. + +We support SwiftUI by building a brand new framework called [SDWebImageSwiftUI](https://github.com/SDWebImage/SDWebImageSwiftUI), which is built on top of SDWebImage core functions (caching, loading and animation). + +The new framework introduce two View structs `WebImage` and `AnimatedImage` for SwiftUI world, `ImageIndicator` modifier for any View, `ImageManager` observable object for data source. Supports iOS 13+/macOS 10.15+/tvOS 13+/watchOS 6+ and Swift 5.1. Have a nice try and provide feedback! + +#### Coders for additional image formats +- [SDWebImageWebPCoder](https://github.com/SDWebImage/SDWebImageWebPCoder) - coder for WebP format. iOS 8+/macOS 10.10+. Based on [libwebp](https://chromium.googlesource.com/webm/libwebp) +- [SDWebImageHEIFCoder](https://github.com/SDWebImage/SDWebImageHEIFCoder) - coder for HEIF format, iOS 8+/macOS 10.10+ support. Based on [libheif](https://github.com/strukturag/libheif) +- [SDWebImageBPGCoder](https://github.com/SDWebImage/SDWebImageBPGCoder) - coder for BPG format. Based on [libbpg](https://github.com/mirrorer/libbpg) +- [SDWebImageFLIFCoder](https://github.com/SDWebImage/SDWebImageFLIFCoder) - coder for FLIF format. Based on [libflif](https://github.com/FLIF-hub/FLIF) +- [SDWebImageAVIFCoder](https://github.com/SDWebImage/SDWebImageAVIFCoder) - coder for AVIF (AV1-based) format. Based on [libavif](https://github.com/AOMediaCodec/libavif) +- [SDWebImagePDFCoder](https://github.com/SDWebImage/SDWebImagePDFCoder) - coder for PDF vector format. Using built-in frameworks +- [SDWebImageSVGCoder](https://github.com/SDWebImage/SDWebImageSVGCoder) - coder for SVG vector format. Using built-in frameworks +- [SDWebImageLottieCoder](https://github.com/SDWebImage/SDWebImageLottieCoder) - coder for Lottie animation format. Based on [rlottie](https://github.com/Samsung/rlottie) +- and more from community! + +#### Custom Caches +- [SDWebImageYYPlugin](https://github.com/SDWebImage/SDWebImageYYPlugin) - plugin to support caching images with [YYCache](https://github.com/ibireme/YYCache) +- [SDWebImagePINPlugin](https://github.com/SDWebImage/SDWebImagePINPlugin) - plugin to support caching images with [PINCache](https://github.com/pinterest/PINCache) + +#### Custom Loaders +- [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin) - plugin to support loading images from Photos (using `Photos.framework`) +- [SDWebImageLinkPlugin](https://github.com/SDWebImage/SDWebImageLinkPlugin) - plugin to support loading images from rich link url, as well as `LPLinkView` (using `LinkPresentation.framework`) + +#### Integration with 3rd party libraries +- [SDWebImageLottiePlugin](https://github.com/SDWebImage/SDWebImageLottiePlugin) - plugin to support [Lottie-iOS](https://github.com/airbnb/lottie-ios), vector animation rending with remote JSON files +- [SDWebImageSVGKitPlugin](https://github.com/SDWebImage/SDWebImageLottiePlugin) - plugin to support [SVGKit](https://github.com/SVGKit/SVGKit), SVG rendering using Core Animation, iOS 8+/macOS 10.10+ support +- [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin) - plugin to support [FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) as the engine for animated GIFs +- [SDWebImageYYPlugin](https://github.com/SDWebImage/SDWebImageYYPlugin) - plugin to integrate [YYImage](https://github.com/ibireme/YYImage) & [YYCache](https://github.com/ibireme/YYCache) for image rendering & caching + +#### Community driven popular libraries +- [FirebaseUI](https://github.com/firebase/FirebaseUI-iOS) - Firebase Storage binding for query images, based on SDWebImage loader system +- [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image) - React Native fast image component, based on SDWebImage Animated Image solution +- [flutter_image_compress](https://github.com/OpenFlutter/flutter_image_compress) - Flutter compresses image plugin, based on SDWebImage WebP coder plugin + +#### Make our lives easier +- [libwebp-Xcode](https://github.com/SDWebImage/libwebp-Xcode) - A wrapper for [libwebp](https://chromium.googlesource.com/webm/libwebp) + an Xcode project. +- [libheif-Xcode](https://github.com/SDWebImage/libheif-Xcode) - A wrapper for [libheif](https://github.com/strukturag/libheif) + an Xcode project. +- [libavif-Xcode](https://github.com/SDWebImage/libavif-Xcode) - A wrapper for [libavif](https://github.com/AOMediaCodec/libavif) + an Xcode project. +- and more third-party C/C++ image codec libraries with CocoaPods/Carthage/SwiftPM support. + +You can use those directly, or create similar components of your own, by using the customizable architecture of SDWebImage. ## Requirements -- iOS 7.0 or later +- iOS 8.0 or later - tvOS 9.0 or later - watchOS 2.0 or later -- OS X 10.8 or later -- Xcode 7.3 or later +- macOS 10.10 or later (10.15 for Catalyst) +- Xcode 10.0 or later #### Backwards compatibility -- For iOS 5 and 6, use [any 3.x version up to 3.7.6](https://github.com/rs/SDWebImage/tree/3.7.6) -- For iOS < 5.0, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat). +- For iOS 7, macOS 10.9 or Xcode < 8, use [any 4.x version up to 4.4.6](https://github.com/SDWebImage/SDWebImage/releases/tag/4.4.6) +- For macOS 10.8, use [any 4.x version up to 4.3.0](https://github.com/SDWebImage/SDWebImage/releases/tag/4.3.0) +- For iOS 5 and 6, use [any 3.x version up to 3.7.6](https://github.com/SDWebImage/SDWebImage/tag/3.7.6) +- For iOS < 5.0, please use the last [2.0 version](https://github.com/SDWebImage/SDWebImage/tree/2.0-compat). ## Getting Started - Read this Readme doc -- Read the [How to use section](https://github.com/rs/SDWebImage#how-to-use) -- Read the [documentation @ CocoaDocs](http://cocoadocs.org/docsets/SDWebImage/) -- Read [How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F) +- Read the [How to use section](https://github.com/SDWebImage/SDWebImage#how-to-use) +- Read the [Latest Documentation](https://sdwebimage.github.io/) and [CocoaDocs for old version](http://cocoadocs.org/docsets/SDWebImage/) - Try the example by downloading the project from Github or even easier using CocoaPods try `pod try SDWebImage` -- Get to the [installation steps](https://github.com/rs/SDWebImage#installation) -- Read the [SDWebImage 4.0 Migration Guide](Docs/SDWebImage-4.0-Migration-guide.md) to get an idea of the changes from 3.x to 4.x +- Read the [Installation Guide](https://github.com/SDWebImage/SDWebImage/wiki/Installation-Guide) +- Read the [SDWebImage 5.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/SDWebImage-5.0-Migration-guide.md) to get an idea of the changes from 4.x to 5.x +- Read the [SDWebImage 4.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/SDWebImage-4.0-Migration-guide.md) to get an idea of the changes from 3.x to 4.x +- Read the [Common Problems](https://github.com/SDWebImage/SDWebImage/wiki/Common-Problems) to find the solution for common problems +- Go to the [Wiki Page](https://github.com/SDWebImage/SDWebImage/wiki) for more information such as [Advanced Usage](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage) ## Who Uses It -- Find out [who uses SDWebImage](https://github.com/rs/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list. +- Find out [who uses SDWebImage](https://github.com/SDWebImage/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list. ## Communication @@ -63,83 +127,73 @@ This library provides an async image downloader with cache support. For convenie - If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage). - If you **found a bug**, open an issue. - If you **have a feature request**, open an issue. -- If you **want to contribute**, submit a pull request. +- If you **need IRC channel**, use [Gitter](https://gitter.im/SDWebImage/community). -## Installation +## Contribution + +- If you **want to contribute**, read the [Contributing Guide](https://github.com/SDWebImage/SDWebImage/blob/master/.github/CONTRIBUTING.md) +- For **development contribution guide**, read the [How-To-Contribute](https://github.com/SDWebImage/SDWebImage/wiki/How-to-Contribute) +- For **understanding code architecture**, read the [Code Architecture Analysis](https://github.com/SDWebImage/SDWebImage/wiki/5.6-Code-Architecture-Analysis) ## How To Use -```objective-c -Objective-C: +* Objective-C -#import +```objective-c +#import ... [imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; ``` -```swift -Swift: +* Swift -@import SDWebImage +```swift +import SDWebImage imageView.sd_setImage(with: URL(string: "http://www.domain.com/path/to/image.jpg"), placeholderImage: UIImage(named: "placeholder.png")) ``` -- For details about how to use the library and clear examples, see [The detailed How to use](Docs/HowToUse.md) +- For details about how to use the library and clear examples, see [The detailed How to use](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/HowToUse.md) ## Animated Images (GIF) support -- Starting with the 4.0 version, we rely on [FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) to take care of our animated images. -- To use it, simply make sure you use `FLAnimatedImageView` instead of `UIImageView`. -- **Note**: there is a backwards compatible feature, so if you are still trying to load a GIF into a `UIImageView`, it will only show the 1st frame as a static image. -- **Important**: FLAnimatedImage only works on the iOS platform, so for all the other platforms (OS X, tvOS, watchOS) we will fallback to the backwards compatibility feature described above - -Common Problems ---------------- - -### Using dynamic image size with UITableViewCell +In 5.0, we introduced a brand new mechanism for supporting animated images. This includes animated image loading, rendering, decoding, and also supports customizations (for advanced users). -UITableView determines the size of the image by the first image set for a cell. If your remote images -don't have the same size as your placeholder image, you may experience strange anamorphic scaling issue. -The following article gives a way to workaround this issue: +This animated image solution is available for `iOS`/`tvOS`/`macOS`. The `SDAnimatedImage` is subclass of `UIImage/NSImage`, and `SDAnimatedImageView` is subclass of `UIImageView/NSImageView`, to make them compatible with the common frameworks APIs. -[http://www.wrichards.com/blog/2011/11/sdwebimage-fixed-width-cell-images/](http://www.wrichards.com/blog/2011/11/sdwebimage-fixed-width-cell-images/) +The `SDAnimatedImageView` supports the familiar image loading category methods, works like drop-in replacement for `UIImageView/NSImageView`. +Don't have UIView (like WatchKit or CALayer)? you can still use `SDAnimatedPlayer` the player engine for advanced playback and rendering. -### Handle image refresh +See [Animated Image](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) for more detailed information. -SDWebImage does very aggressive caching by default. It ignores all kind of caching control header returned by the HTTP server and cache the returned images with no time restriction. It implies your images URLs are static URLs pointing to images that never change. If the pointed image happen to change, some parts of the URL should change accordingly. +* Objective-C -If you don't control the image server you're using, you may not be able to change the URL when its content is updated. This is the case for Facebook avatar URLs for instance. In such case, you may use the `SDWebImageRefreshCached` flag. This will slightly degrade the performance but will respect the HTTP caching control headers: - -``` objective-c -[imageView sd_setImageWithURL:[NSURL URLWithString:@"https://graph.facebook.com/olivier.poitrey/picture"] - placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"] - options:SDWebImageRefreshCached]; +```objective-c +SDAnimatedImageView *imageView = [SDAnimatedImageView new]; +SDAnimatedImage *animatedImage = [SDAnimatedImage imageNamed:@"image.gif"]; +imageView.image = animatedImage; ``` -### Add a progress indicator +* Swift -Add these before you call ```sd_setImageWithURL``` - -``` objective-c -[imageView setShowActivityIndicatorView:YES]; -[imageView setIndicatorStyle:UIActivityIndicatorViewStyleGray]; +```swift +let imageView = SDAnimatedImageView() +let animatedImage = SDAnimatedImage(named: "image.gif") +imageView.image = animatedImage ``` -``` swift -imageView.setShowActivityIndicatorView(true) -imageView.setIndicatorStyle(.Gray) -``` +#### FLAnimatedImage integration has its own dedicated repo +In order to clean up things and make our core project do less things, we decided that the `FLAnimatedImage` integration does not belong here. From 5.0, this will still be available, but under a dedicated repo [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin). -Installation ------------- +## Installation -There are three ways to use SDWebImage in your project: +There are four ways to use SDWebImage in your project: - using CocoaPods - using Carthage -- by cloning the project into your repository +- using Swift Package Manager +- manual install (build frameworks or embed Xcode Project) ### Installation with CocoaPods @@ -147,23 +201,41 @@ There are three ways to use SDWebImage in your project: #### Podfile ``` -platform :ios, '7.0' -pod 'SDWebImage', '~>3.8' +platform :ios, '8.0' +pod 'SDWebImage', '~> 5.0' ``` -If you are using Swift, be sure to add `use_frameworks!` and set your target to iOS 8+: +##### Swift and static framework + +Swift project previously have to use `use_frameworks!` to make all Pods into dynamic framework to let CocoaPods works. + +However, start with `CocoaPods 1.5.0+` (with `Xcode 9+`), which supports to build both Objective-C && Swift code into static framework. You can use modular headers to use SDWebImage as static framework, without the need of `use_frameworks!`: + +``` +platform :ios, '8.0' +# Uncomment the next line when you want all Pods as static framework +# use_modular_headers! +pod 'SDWebImage', :modular_headers => true +``` + +See more on [CocoaPods 1.5.0 — Swift Static Libraries](http://blog.cocoapods.org/CocoaPods-1.5.0/) + +If not, you still need to add `use_frameworks!` to use SDWebImage as dynamic framework: + ``` platform :ios, '8.0' use_frameworks! +pod 'SDWebImage' ``` #### Subspecs -There are 3 subspecs available now: `Core`, `MapKit` and `WebP` (this means you can install only some of the SDWebImage modules. By default, you get just `Core`, so if you need `WebP`, you need to specify it). +There are 2 subspecs available now: `Core` and `MapKit` (this means you can install only some of the SDWebImage modules. By default, you get just `Core`, so if you need `MapKit`, you need to specify it). Podfile example: + ``` -pod 'SDWebImage/WebP' +pod 'SDWebImage/MapKit' ``` ### Installation with Carthage (iOS 8+) @@ -172,20 +244,50 @@ pod 'SDWebImage/WebP' To install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage) -#### Cartfile -``` -github "rs/SDWebImage" +Carthage users can point to this repository and use whichever generated framework they'd like: SDWebImage, SDWebImageMapKit or both. + +Make the following entry in your Cartfile: `github "SDWebImage/SDWebImage"` +Then run `carthage update` +If this is your first time using Carthage in the project, you'll need to go through some additional steps as explained [over at Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application). + +> NOTE: At this time, Carthage does not provide a way to build only specific repository subcomponents (or equivalent of CocoaPods's subspecs). All components and their dependencies will be built with the above command. However, you don't need to copy frameworks you aren't using into your project. For instance, if you aren't using `SDWebImageMapKit`, feel free to delete that framework from the Carthage Build directory after `carthage update` completes. + +### Installation with Swift Package Manager (Xcode 11+) + +[Swift Package Manager](https://swift.org/package-manager/) (SwiftPM) is a tool for managing the distribution of Swift code as well as C-family dependency. From Xcode 11, SwiftPM got natively integrated with Xcode. + +SDWebImage support SwiftPM from version 5.1.0. To use SwiftPM, you should use Xcode 11 to open your project. Click `File` -> `Swift Packages` -> `Add Package Dependency`, enter [SDWebImage repo's URL](https://github.com/SDWebImage/SDWebImage.git). Or you can login Xcode with your GitHub account and just type `SDWebImage` to search. + +After select the package, you can choose the dependency type (tagged version, branch or commit). Then Xcode will setup all the stuff for you. + +If you're a framework author and use SDWebImage as a dependency, update your `Package.swift` file: + +```swift +let package = Package( + // 5.1.0 ..< 6.0.0 + dependencies: [ + .package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0") + ], + // ... +) ``` -### Installation by cloning the repository -- see [Manual install](Docs/ManualInstallation.md) +### Manual Installation Guide + +See more on [Manual install Guide](https://github.com/SDWebImage/SDWebImage/wiki/Installation-Guide#manual-installation-guide) ### Import headers in your source files -In the source files where you need to use the library, import the header file: +In the source files where you need to use the library, import the umbrella header file: ```objective-c -#import +#import +``` + +It's also recommend to use the module import syntax, available for CocoaPods(enable `modular_headers`)/Carthage/SwiftPM. + +```objecitivec +@import SDWebImage; ``` ### Build Project @@ -199,17 +301,47 @@ community can help you solve it. ## Collaborators - [Konstantinos K.](https://github.com/mythodeia) - [Bogdan Poplauschi](https://github.com/bpoplauschi) +- [Chester Liu](https://github.com/skyline75489) +- [DreamPiggy](https://github.com/dreampiggy) +- [Wu Zhong](https://github.com/zhongwuzw) + +## Credits + +Thank you to all the people who have already contributed to SDWebImage. + +[![Contributors](https://opencollective.com/SDWebImage/contributors.svg?width=890)](https://github.com/SDWebImage/SDWebImage/graphs/contributors) ## Licenses -All source code is licensed under the [MIT License](https://raw.github.com/rs/SDWebImage/master/LICENSE). +All source code is licensed under the [MIT License](https://github.com/SDWebImage/SDWebImage/blob/master/LICENSE). ## Architecture +To learn about SDWebImage's architecture design for contribution, read [The Core of SDWebImage v5.6 Architecture](https://github.com/SDWebImage/SDWebImage/wiki/5.6-Code-Architecture-Analysis). Thanks @looseyi for the post and translation. + +#### High Level Diagram

- +

+#### Overall Class Diagram

- +

+ +#### Top Level API Diagram +

+ +

+ +#### Main Sequence Diagram +

+ +

+ +#### More detailed diagrams +- [Manager API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageManagerClassDiagram.png) +- [Coders API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageCodersClassDiagram.png) +- [Loader API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageLoaderClassDiagram.png) +- [Cache API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageCacheClassDiagram.png) + diff --git a/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h b/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h new file mode 100644 index 0000000..5b8035b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h @@ -0,0 +1,340 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +#import "SDWebImageManager.h" + +/** + * Integrates SDWebImage async downloading and caching of remote images with NSButton. + */ +@interface NSButton (WebCache) + +#pragma mark - Image + +/** + * Get the current image URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Alternate Image + +/** + * Get the current alternateImage URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentAlternateImageURL; + +/** + * Set the button `alternateImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @see sd_setAlternateImageWithURL:placeholderImage:options: + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `alternateImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `alternateImage` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `alternateImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while alternateImage is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `alternateImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while alternateImage is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Cancel + +/** + * Cancel the current image download + */ +- (void)sd_cancelCurrentImageLoad; + +/** + * Cancel the current alternateImage download + */ +- (void)sd_cancelCurrentAlternateImageLoad; + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m b/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m new file mode 100644 index 0000000..300e5a3 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m @@ -0,0 +1,172 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSButton+WebCache.h" + +#if SD_MAC + +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" +#import "SDInternalMacros.h" + +static NSString * const SDAlternateImageOperationKey = @"NSButtonAlternateImageOperation"; + +@implementation NSButton (WebCache) + +#pragma mark - Image + +- (void)sd_setImageWithURL:(nullable NSURL *)url { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + self.sd_currentImageURL = url; + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:context + setImageBlock:nil + progress:progressBlock + completed:^(NSImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Alternate Image + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url { + [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + self.sd_currentAlternateImageURL = url; + + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = SDAlternateImageOperationKey; + @weakify(self); + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + self.alternateImage = image; + } + progress:progressBlock + completed:^(NSImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Cancel + +- (void)sd_cancelCurrentImageLoad { + [self sd_cancelImageLoadOperationWithKey:NSStringFromClass([self class])]; +} + +- (void)sd_cancelCurrentAlternateImageLoad { + [self sd_cancelImageLoadOperationWithKey:SDAlternateImageOperationKey]; +} + +#pragma mar - Private + +- (NSURL *)sd_currentImageURL { + return objc_getAssociatedObject(self, @selector(sd_currentImageURL)); +} + +- (void)setSd_currentImageURL:(NSURL *)sd_currentImageURL { + objc_setAssociatedObject(self, @selector(sd_currentImageURL), sd_currentImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (NSURL *)sd_currentAlternateImageURL { + return objc_getAssociatedObject(self, @selector(sd_currentAlternateImageURL)); +} + +- (void)setSd_currentAlternateImageURL:(NSURL *)sd_currentAlternateImageURL { + objc_setAssociatedObject(self, @selector(sd_currentAlternateImageURL), sd_currentAlternateImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h b/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h new file mode 100644 index 0000000..a9921ea --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h @@ -0,0 +1,61 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Fabrice Aneche + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/** + You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value. + For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information. + */ +typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM; +static const SDImageFormat SDImageFormatUndefined = -1; +static const SDImageFormat SDImageFormatJPEG = 0; +static const SDImageFormat SDImageFormatPNG = 1; +static const SDImageFormat SDImageFormatGIF = 2; +static const SDImageFormat SDImageFormatTIFF = 3; +static const SDImageFormat SDImageFormatWebP = 4; +static const SDImageFormat SDImageFormatHEIC = 5; +static const SDImageFormat SDImageFormatHEIF = 6; +static const SDImageFormat SDImageFormatPDF = 7; +static const SDImageFormat SDImageFormatSVG = 8; + +/** + NSData category about the image content type and UTI. + */ +@interface NSData (ImageContentType) + +/** + * Return image format + * + * @param data the input image data + * + * @return the image format as `SDImageFormat` (enum) + */ ++ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; + +/** + * Convert SDImageFormat to UTType + * + * @param format Format as SDImageFormat + * @return The UTType as CFStringRef + * @note For unknown format, `kUTTypeImage` abstract type will return + */ ++ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:)); + +/** + * Convert UTType to SDImageFormat + * + * @param uttype The UTType as CFStringRef + * @return The Format as SDImageFormat + * @note For unknown type, `SDImageFormatUndefined` will return + */ ++ (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m b/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m new file mode 100644 index 0000000..35e27aa --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m @@ -0,0 +1,153 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Fabrice Aneche + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSData+ImageContentType.h" +#if SD_MAC +#import +#else +#import +#endif +#import "SDImageIOAnimatedCoderInternal.h" + +#define kSVGTagEnd @"" + +@implementation NSData (ImageContentType) + ++ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { + if (!data) { + return SDImageFormatUndefined; + } + + // File signatures table: http://www.garykessler.net/library/file_sigs.html + uint8_t c; + [data getBytes:&c length:1]; + switch (c) { + case 0xFF: + return SDImageFormatJPEG; + case 0x89: + return SDImageFormatPNG; + case 0x47: + return SDImageFormatGIF; + case 0x49: + case 0x4D: + return SDImageFormatTIFF; + case 0x52: { + if (data.length >= 12) { + //RIFF....WEBP + NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; + if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { + return SDImageFormatWebP; + } + } + break; + } + case 0x00: { + if (data.length >= 12) { + //....ftypheic ....ftypheix ....ftyphevc ....ftyphevx + NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(4, 8)] encoding:NSASCIIStringEncoding]; + if ([testString isEqualToString:@"ftypheic"] + || [testString isEqualToString:@"ftypheix"] + || [testString isEqualToString:@"ftyphevc"] + || [testString isEqualToString:@"ftyphevx"]) { + return SDImageFormatHEIC; + } + //....ftypmif1 ....ftypmsf1 + if ([testString isEqualToString:@"ftypmif1"] || [testString isEqualToString:@"ftypmsf1"]) { + return SDImageFormatHEIF; + } + } + break; + } + case 0x25: { + if (data.length >= 4) { + //%PDF + NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(1, 3)] encoding:NSASCIIStringEncoding]; + if ([testString isEqualToString:@"PDF"]) { + return SDImageFormatPDF; + } + } + } + case 0x3C: { + // Check end with SVG tag + if ([data rangeOfData:[kSVGTagEnd dataUsingEncoding:NSUTF8StringEncoding] options:NSDataSearchBackwards range: NSMakeRange(data.length - MIN(100, data.length), MIN(100, data.length))].location != NSNotFound) { + return SDImageFormatSVG; + } + } + } + return SDImageFormatUndefined; +} + ++ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format { + CFStringRef UTType; + switch (format) { + case SDImageFormatJPEG: + UTType = kUTTypeJPEG; + break; + case SDImageFormatPNG: + UTType = kUTTypePNG; + break; + case SDImageFormatGIF: + UTType = kUTTypeGIF; + break; + case SDImageFormatTIFF: + UTType = kUTTypeTIFF; + break; + case SDImageFormatWebP: + UTType = kSDUTTypeWebP; + break; + case SDImageFormatHEIC: + UTType = kSDUTTypeHEIC; + break; + case SDImageFormatHEIF: + UTType = kSDUTTypeHEIF; + break; + case SDImageFormatPDF: + UTType = kUTTypePDF; + break; + case SDImageFormatSVG: + UTType = kUTTypeScalableVectorGraphics; + break; + default: + // default is kUTTypeImage abstract type + UTType = kUTTypeImage; + break; + } + return UTType; +} + ++ (SDImageFormat)sd_imageFormatFromUTType:(CFStringRef)uttype { + if (!uttype) { + return SDImageFormatUndefined; + } + SDImageFormat imageFormat; + if (CFStringCompare(uttype, kUTTypeJPEG, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatJPEG; + } else if (CFStringCompare(uttype, kUTTypePNG, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatPNG; + } else if (CFStringCompare(uttype, kUTTypeGIF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatGIF; + } else if (CFStringCompare(uttype, kUTTypeTIFF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatTIFF; + } else if (CFStringCompare(uttype, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatWebP; + } else if (CFStringCompare(uttype, kSDUTTypeHEIC, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatHEIC; + } else if (CFStringCompare(uttype, kSDUTTypeHEIF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatHEIF; + } else if (CFStringCompare(uttype, kUTTypePDF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatPDF; + } else if (CFStringCompare(uttype, kUTTypeScalableVectorGraphics, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatSVG; + } else { + imageFormat = SDImageFormatUndefined; + } + return imageFormat; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h b/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h new file mode 100644 index 0000000..0a562cc --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h @@ -0,0 +1,67 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +/** + This category is provided to easily write cross-platform(AppKit/UIKit) code. For common usage, see `UIImage+Metadata.h`. + */ +@interface NSImage (Compatibility) + +/** +The underlying Core Graphics image object. This will actually use `CGImageForProposedRect` with the image size. + */ +@property (nonatomic, readonly, nullable) CGImageRef CGImage; +/** + The underlying Core Image data. This will actually use `bestRepresentationForRect` with the image size to find the `NSCIImageRep`. + */ +@property (nonatomic, readonly, nullable) CIImage *CIImage; +/** + The scale factor of the image. This wil actually use `bestRepresentationForRect` with image size and pixel size to calculate the scale factor. If failed, use the default value 1.0. Should be greater than or equal to 1.0. + */ +@property (nonatomic, readonly) CGFloat scale; + +// These are convenience methods to make AppKit's `NSImage` match UIKit's `UIImage` behavior. The scale factor should be greater than or equal to 1.0. + +/** + Returns an image object with the scale factor and orientation. The representation is created from the Core Graphics image object. + @note The difference between this and `initWithCGImage:size` is that `initWithCGImage:size` will actually create a `NSCGImageSnapshotRep` representation and always use `backingScaleFactor` as scale factor. So we should avoid it and use `NSBitmapImageRep` with `initWithCGImage:` instead. + @note The difference between this and UIKit's `UIImage` equivalent method is the way to process orientation. If the provided image orientation is not equal to Up orientation, this method will firstly rotate the CGImage to the correct orientation to work compatible with `NSImageView`. However, UIKit will not actually rotate CGImage and just store it as `imageOrientation` property. + + @param cgImage A Core Graphics image object + @param scale The image scale factor + @param orientation The orientation of the image data + @return The image object + */ +- (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation; + +/** + Initializes and returns an image object with the specified Core Image object. The representation is `NSCIImageRep`. + + @param ciImage A Core Image image object + @param scale The image scale factor + @param orientation The orientation of the image data + @return The image object + */ +- (nonnull instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation; + +/** + Returns an image object with the scale factor. The representation is created from the image data. + @note The difference between these this and `initWithData:` is that `initWithData:` will always use `backingScaleFactor` as scale factor. + + @param data The image data + @param scale The image scale factor + @return The image object + */ +- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale; + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m b/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m new file mode 100644 index 0000000..7de0c70 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m @@ -0,0 +1,120 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSImage+Compatibility.h" + +#if SD_MAC + +#import "SDImageCoderHelper.h" + +@implementation NSImage (Compatibility) + +- (nullable CGImageRef)CGImage { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:nil hints:nil]; + return cgImage; +} + +- (nullable CIImage *)CIImage { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + if (![imageRep isKindOfClass:NSCIImageRep.class]) { + return nil; + } + return ((NSCIImageRep *)imageRep).CIImage; +} + +- (CGFloat)scale { + CGFloat scale = 1; + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + CGFloat width = imageRep.size.width; + CGFloat height = imageRep.size.height; + NSUInteger pixelWidth = imageRep.pixelsWide; + NSUInteger pixelHeight = imageRep.pixelsHigh; + if (width > 0 && height > 0) { + CGFloat widthScale = pixelWidth / width; + CGFloat heightScale = pixelHeight / height; + if (widthScale == heightScale && widthScale >= 1) { + // Protect because there may be `NSImageRepMatchesDevice` (0) + scale = widthScale; + } + } + + return scale; +} + +- (instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation { + NSBitmapImageRep *imageRep; + if (orientation != kCGImagePropertyOrientationUp) { + // AppKit design is different from UIKit. Where CGImage based image rep does not respect to any orientation. Only data based image rep which contains the EXIF metadata can automatically detect orientation. + // This should be nonnull, until the memory is exhausted cause `CGBitmapContextCreate` failed. + CGImageRef rotatedCGImage = [SDImageCoderHelper CGImageCreateDecoded:cgImage orientation:orientation]; + imageRep = [[NSBitmapImageRep alloc] initWithCGImage:rotatedCGImage]; + CGImageRelease(rotatedCGImage); + } else { + imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; + } + if (scale < 1) { + scale = 1; + } + CGFloat pixelWidth = imageRep.pixelsWide; + CGFloat pixelHeight = imageRep.pixelsHigh; + NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); + self = [self initWithSize:size]; + if (self) { + imageRep.size = size; + [self addRepresentation:imageRep]; + } + return self; +} + +- (instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation { + NSCIImageRep *imageRep; + if (orientation != kCGImagePropertyOrientationUp) { + CIImage *rotatedCIImage = [ciImage imageByApplyingOrientation:orientation]; + imageRep = [[NSCIImageRep alloc] initWithCIImage:rotatedCIImage]; + } else { + imageRep = [[NSCIImageRep alloc] initWithCIImage:ciImage]; + } + if (scale < 1) { + scale = 1; + } + CGFloat pixelWidth = imageRep.pixelsWide; + CGFloat pixelHeight = imageRep.pixelsHigh; + NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); + self = [self initWithSize:size]; + if (self) { + imageRep.size = size; + [self addRepresentation:imageRep]; + } + return self; +} + +- (instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale { + NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithData:data]; + if (!imageRep) { + return nil; + } + if (scale < 1) { + scale = 1; + } + CGFloat pixelWidth = imageRep.pixelsWide; + CGFloat pixelHeight = imageRep.pixelsHigh; + NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); + self = [self initWithSize:size]; + if (self) { + imageRep.size = size; + [self addRepresentation:imageRep]; + } + return self; +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h new file mode 100644 index 0000000..2e208cd --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h @@ -0,0 +1,114 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDImageCoder.h" + + +/** + This is the protocol for SDAnimatedImage class only but not for SDAnimatedImageCoder. If you want to provide a custom animated image class with full advanced function, you can conform to this instead of the base protocol. + */ +@protocol SDAnimatedImage + +@required +/** + Initializes and returns the image object with the specified data, scale factor and possible animation decoding options. + @note We use this to create animated image instance for normal animation decoding. + + @param data The data object containing the image data. + @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property. + @param options A dictionary containing any animation decoding options. + @return An initialized object + */ +- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale options:(nullable SDImageCoderOptions *)options; + +/** + Initializes the image with an animated coder. You can use the coder to decode the image frame later. + @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding. + + @param animatedCoder An animated coder which conform `SDAnimatedImageCoder` protocol + @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property. + @return An initialized object + */ +- (nullable instancetype)initWithAnimatedCoder:(nonnull id)animatedCoder scale:(CGFloat)scale; + +@optional +// These methods are used for optional advanced feature, like image frame preloading. +/** + Pre-load all animated image frame into memory. Then later frame image request can directly return the frame for index without decoding. + This method may be called on background thread. + + @note If one image instance is shared by lots of imageViews, the CPU performance for large animated image will drop down because the request frame index will be random (not in order) and the decoder should take extra effort to keep it re-entrant. You can use this to reduce CPU usage if need. Attention this will consume more memory usage. + */ +- (void)preloadAllFrames; + +/** + Unload all animated image frame from memory if are already pre-loaded. Then later frame image request need decoding. You can use this to free up the memory usage if need. + */ +- (void)unloadAllFrames; + +/** + Returns a Boolean value indicating whether all animated image frames are already pre-loaded into memory. + */ +@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded; + +/** + Return the animated image coder if the image is created with `initWithAnimatedCoder:scale:` method. + @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding. + */ +@property (nonatomic, strong, readonly, nullable) id animatedCoder; + +@end + +/** + The image class which supports animating on `SDAnimatedImageView`. You can also use it on normal UIImageView/NSImageView. + */ +@interface SDAnimatedImage : UIImage + +// This class override these methods from UIImage(NSImage), and it supports NSSecureCoding. +// You should use these methods to create a new animated image. Use other methods just call super instead. +// Pay attention, when the animated image frame count <= 1, all the `SDAnimatedImageProvider` protocol methods will return nil or 0 value, you'd better check the frame count before usage and keep fallback. ++ (nullable instancetype)imageNamed:(nonnull NSString *)name; // Cache in memory, no Asset Catalog support +#if __has_include() ++ (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection; // Cache in memory, no Asset Catalog support +#else ++ (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle; // Cache in memory, no Asset Catalog support +#endif ++ (nullable instancetype)imageWithContentsOfFile:(nonnull NSString *)path; ++ (nullable instancetype)imageWithData:(nonnull NSData *)data; ++ (nullable instancetype)imageWithData:(nonnull NSData *)data scale:(CGFloat)scale; +- (nullable instancetype)initWithContentsOfFile:(nonnull NSString *)path; +- (nullable instancetype)initWithData:(nonnull NSData *)data; +- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale; + +/** + Current animated image format. + */ +@property (nonatomic, assign, readonly) SDImageFormat animatedImageFormat; + +/** + Current animated image data, you can use this to grab the compressed format data and create another animated image instance. + If this image instance is an animated image created by using animated image coder (which means using the API listed above or using `initWithAnimatedCoder:scale:`), this property is non-nil. + */ +@property (nonatomic, copy, readonly, nullable) NSData *animatedImageData; + +/** + The scale factor of the image. + + @note For UIKit, this just call super instead. + @note For AppKit, `NSImage` can contains multiple image representations with different scales. However, this class does not do that from the design. We process the scale like UIKit. This will actually be calculated from image size and pixel size. + */ +@property (nonatomic, readonly) CGFloat scale; + +// By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the description in `SDAnimatedImage` protocol. +// After preloaded, there is no huge difference on performance between this and UIImage's `animatedImageWithImages:duration:`. But UIImage's animation have some issues such like blanking and pausing during segue when using in `UIImageView`. It's recommend to use only if need. +- (void)preloadAllFrames; +- (void)unloadAllFrames; +@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m new file mode 100644 index 0000000..4ec753b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m @@ -0,0 +1,388 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImage.h" +#import "NSImage+Compatibility.h" +#import "SDImageCoder.h" +#import "SDImageCodersManager.h" +#import "SDImageFrame.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+Metadata.h" +#import "UIImage+MultiFormat.h" +#import "SDImageCoderHelper.h" +#import "SDImageAssetManager.h" +#import "objc/runtime.h" + +static CGFloat SDImageScaleFromPath(NSString *string) { + if (string.length == 0 || [string hasSuffix:@"/"]) return 1; + NSString *name = string.stringByDeletingPathExtension; + __block CGFloat scale = 1; + + NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@"@[0-9]+\\.?[0-9]*x$" options:NSRegularExpressionAnchorsMatchLines error:nil]; + [pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { + scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue; + }]; + + return scale; +} + +@interface SDAnimatedImage () + +@property (nonatomic, strong) id animatedCoder; +@property (nonatomic, assign, readwrite) SDImageFormat animatedImageFormat; +@property (atomic, copy) NSArray *loadedAnimatedImageFrames; // Mark as atomic to keep thread-safe +@property (nonatomic, assign, getter=isAllFramesLoaded) BOOL allFramesLoaded; + +@end + +@implementation SDAnimatedImage +@dynamic scale; // call super + +#pragma mark - UIImage override method ++ (instancetype)imageNamed:(NSString *)name { +#if __has_include() + return [self imageNamed:name inBundle:nil compatibleWithTraitCollection:nil]; +#else + return [self imageNamed:name inBundle:nil]; +#endif +} + +#if __has_include() ++ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle compatibleWithTraitCollection:(UITraitCollection *)traitCollection { + if (!traitCollection) { + traitCollection = UIScreen.mainScreen.traitCollection; + } + CGFloat scale = traitCollection.displayScale; + return [self imageNamed:name inBundle:bundle scale:scale]; +} +#else ++ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle { + return [self imageNamed:name inBundle:bundle scale:0]; +} +#endif + +// 0 scale means automatically check ++ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle scale:(CGFloat)scale { + if (!name) { + return nil; + } + if (!bundle) { + bundle = [NSBundle mainBundle]; + } + SDImageAssetManager *assetManager = [SDImageAssetManager sharedAssetManager]; + SDAnimatedImage *image = (SDAnimatedImage *)[assetManager imageForName:name]; + if ([image isKindOfClass:[SDAnimatedImage class]]) { + return image; + } + NSString *path = [assetManager getPathForName:name bundle:bundle preferredScale:&scale]; + if (!path) { + return image; + } + NSData *data = [NSData dataWithContentsOfFile:path]; + if (!data) { + return image; + } + image = [[self alloc] initWithData:data scale:scale]; + if (image) { + [assetManager storeImage:image forName:name]; + } + + return image; +} + ++ (instancetype)imageWithContentsOfFile:(NSString *)path { + return [[self alloc] initWithContentsOfFile:path]; +} + ++ (instancetype)imageWithData:(NSData *)data { + return [[self alloc] initWithData:data]; +} + ++ (instancetype)imageWithData:(NSData *)data scale:(CGFloat)scale { + return [[self alloc] initWithData:data scale:scale]; +} + +- (instancetype)initWithContentsOfFile:(NSString *)path { + NSData *data = [NSData dataWithContentsOfFile:path]; + return [self initWithData:data scale:SDImageScaleFromPath(path)]; +} + +- (instancetype)initWithData:(NSData *)data { + return [self initWithData:data scale:1]; +} + +- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale { + return [self initWithData:data scale:scale options:nil]; +} + +- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale options:(SDImageCoderOptions *)options { + if (!data || data.length == 0) { + return nil; + } + data = [data copy]; // avoid mutable data + id animatedCoder = nil; + for (idcoder in [SDImageCodersManager sharedManager].coders) { + if ([coder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) { + if ([coder canDecodeFromData:data]) { + if (!options) { + options = @{SDImageCoderDecodeScaleFactor : @(scale)}; + } + animatedCoder = [[[coder class] alloc] initWithAnimatedImageData:data options:options]; + break; + } + } + } + if (!animatedCoder) { + return nil; + } + return [self initWithAnimatedCoder:animatedCoder scale:scale]; +} + +- (instancetype)initWithAnimatedCoder:(id)animatedCoder scale:(CGFloat)scale { + if (!animatedCoder) { + return nil; + } + UIImage *image = [animatedCoder animatedImageFrameAtIndex:0]; + if (!image) { + return nil; + } +#if SD_MAC + self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:kCGImagePropertyOrientationUp]; +#else + self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation]; +#endif + if (self) { + // Only keep the animated coder if frame count > 1, save RAM usage for non-animated image format (APNG/WebP) + if (animatedCoder.animatedImageFrameCount > 1) { + _animatedCoder = animatedCoder; + } + NSData *data = [animatedCoder animatedImageData]; + SDImageFormat format = [NSData sd_imageFormatForImageData:data]; + _animatedImageFormat = format; + } + return self; +} + +#pragma mark - Preload +- (void)preloadAllFrames { + if (!_animatedCoder) { + return; + } + if (!self.isAllFramesLoaded) { + NSMutableArray *frames = [NSMutableArray arrayWithCapacity:self.animatedImageFrameCount]; + for (size_t i = 0; i < self.animatedImageFrameCount; i++) { + UIImage *image = [self animatedImageFrameAtIndex:i]; + NSTimeInterval duration = [self animatedImageDurationAtIndex:i]; + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; // through the image should be nonnull, used as nullable for `animatedImageFrameAtIndex:` + [frames addObject:frame]; + } + self.loadedAnimatedImageFrames = frames; + self.allFramesLoaded = YES; + } +} + +- (void)unloadAllFrames { + if (!_animatedCoder) { + return; + } + if (self.isAllFramesLoaded) { + self.loadedAnimatedImageFrames = nil; + self.allFramesLoaded = NO; + } +} + +#pragma mark - NSSecureCoding +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (self) { + _animatedImageFormat = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(animatedImageFormat))]; + NSData *animatedImageData = [aDecoder decodeObjectOfClass:[NSData class] forKey:NSStringFromSelector(@selector(animatedImageData))]; + if (!animatedImageData) { + return self; + } + CGFloat scale = self.scale; + id animatedCoder = nil; + for (idcoder in [SDImageCodersManager sharedManager].coders) { + if ([coder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) { + if ([coder canDecodeFromData:animatedImageData]) { + animatedCoder = [[[coder class] alloc] initWithAnimatedImageData:animatedImageData options:@{SDImageCoderDecodeScaleFactor : @(scale)}]; + break; + } + } + } + if (!animatedCoder) { + return self; + } + if (animatedCoder.animatedImageFrameCount > 1) { + _animatedCoder = animatedCoder; + } + } + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + [aCoder encodeInteger:self.animatedImageFormat forKey:NSStringFromSelector(@selector(animatedImageFormat))]; + NSData *animatedImageData = self.animatedImageData; + if (animatedImageData) { + [aCoder encodeObject:animatedImageData forKey:NSStringFromSelector(@selector(animatedImageData))]; + } +} + ++ (BOOL)supportsSecureCoding { + return YES; +} + +#pragma mark - SDAnimatedImageProvider + +- (NSData *)animatedImageData { + return [self.animatedCoder animatedImageData]; +} + +- (NSUInteger)animatedImageLoopCount { + return [self.animatedCoder animatedImageLoopCount]; +} + +- (NSUInteger)animatedImageFrameCount { + return [self.animatedCoder animatedImageFrameCount]; +} + +- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index { + if (index >= self.animatedImageFrameCount) { + return nil; + } + if (self.isAllFramesLoaded) { + SDImageFrame *frame = [self.loadedAnimatedImageFrames objectAtIndex:index]; + return frame.image; + } + return [self.animatedCoder animatedImageFrameAtIndex:index]; +} + +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index { + if (index >= self.animatedImageFrameCount) { + return 0; + } + if (self.isAllFramesLoaded) { + SDImageFrame *frame = [self.loadedAnimatedImageFrames objectAtIndex:index]; + return frame.duration; + } + return [self.animatedCoder animatedImageDurationAtIndex:index]; +} + +@end + +@implementation SDAnimatedImage (MemoryCacheCost) + +- (NSUInteger)sd_memoryCost { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost)); + if (value != nil) { + return value.unsignedIntegerValue; + } + + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return 0; + } + NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); + NSUInteger frameCount = 1; + if (self.isAllFramesLoaded) { + frameCount = self.animatedImageFrameCount; + } + frameCount = frameCount > 0 ? frameCount : 1; + NSUInteger cost = bytesPerFrame * frameCount; + return cost; +} + +@end + +@implementation SDAnimatedImage (Metadata) + +- (BOOL)sd_isAnimated { + return YES; +} + +- (NSUInteger)sd_imageLoopCount { + return self.animatedImageLoopCount; +} + +- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { + return; +} + +- (SDImageFormat)sd_imageFormat { + return self.animatedImageFormat; +} + +- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat { + return; +} + +- (BOOL)sd_isVector { + return NO; +} + +@end + +@implementation SDAnimatedImage (MultiFormat) + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { + return [self sd_imageWithData:data scale:1]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale { + return [self sd_imageWithData:data scale:scale firstFrameOnly:NO]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly { + if (!data) { + return nil; + } + return [[self alloc] initWithData:data scale:scale options:@{SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}]; +} + +- (nullable NSData *)sd_imageData { + NSData *imageData = self.animatedImageData; + if (imageData) { + return imageData; + } else { + return [self sd_imageDataAsFormat:self.animatedImageFormat]; + } +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:1]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly { + if (firstFrameOnly) { + // First frame, use super implementation + return [super sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly]; + } + NSUInteger frameCount = self.animatedImageFrameCount; + if (frameCount <= 1) { + // Static image, use super implementation + return [super sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly]; + } + // Keep animated image encoding, loop each frame. + NSMutableArray *frames = [NSMutableArray arrayWithCapacity:frameCount]; + for (size_t i = 0; i < frameCount; i++) { + UIImage *image = [self animatedImageFrameAtIndex:i]; + NSTimeInterval duration = [self animatedImageDurationAtIndex:i]; + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; + [frames addObject:frame]; + } + UIImage *animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames]; + NSData *imageData = [animatedImage sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly]; + return imageData; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h new file mode 100644 index 0000000..e27470a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h @@ -0,0 +1,90 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" +#import "SDImageCoder.h" + +/// A player to control the playback of animated image, which can be used to drive Animated ImageView or any rendering usage, like CALayer/WatchKit/SwiftUI rendering. +@interface SDAnimatedImagePlayer : NSObject + +/// Current playing frame image. This value is KVO Compliance. +@property (nonatomic, readonly, nullable) UIImage *currentFrame; + +/// Current frame index, zero based. This value is KVO Compliance. +@property (nonatomic, readonly) NSUInteger currentFrameIndex; + +/// Current loop count since its latest animating. This value is KVO Compliance. +@property (nonatomic, readonly) NSUInteger currentLoopCount; + +/// Total frame count for animated image rendering. Defaults is animated image's frame count. +/// @note For progressive animation, you can update this value when your provider receive more frames. +@property (nonatomic, assign) NSUInteger totalFrameCount; + +/// Total loop count for animated image rendering. Default is animated image's loop count. +@property (nonatomic, assign) NSUInteger totalLoopCount; + +/// The animation playback rate. Default is 1.0 +/// `1.0` means the normal speed. +/// `0.0` means stopping the animation. +/// `0.0-1.0` means the slow speed. +/// `> 1.0` means the fast speed. +/// `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future) +@property (nonatomic, assign) double playbackRate; + +/// Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0. +/// `0` means automatically adjust by calculating current memory usage. +/// `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) +/// `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory) +@property (nonatomic, assign) NSUInteger maxBufferSize; + +/// You can specify a runloop mode to let it rendering. +/// Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device +@property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode; + +/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil. +/// The provider can be any protocol implementation, like `SDAnimatedImage`, `SDImageGIFCoder`, etc. +/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself +/// @param provider The animated provider +- (nullable instancetype)initWithProvider:(nonnull id)provider; + +/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil. +/// The provider can be any protocol implementation, like `SDAnimatedImage` or `SDImageGIFCoder`, etc. +/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself +/// @param provider The animated provider ++ (nullable instancetype)playerWithProvider:(nonnull id)provider; + +/// The handler block when current frame and index changed. +@property (nonatomic, copy, nullable) void (^animationFrameHandler)(NSUInteger index, UIImage * _Nonnull frame); + +/// The handler block when one loop count finished. +@property (nonatomic, copy, nullable) void (^animationLoopHandler)(NSUInteger loopCount); + +/// Return the status whether animation is playing. +@property (nonatomic, readonly) BOOL isPlaying; + +/// Start the animation. Or resume the previously paused animation. +- (void)startPlaying; + +/// Pause the animation. Keep the current frame index and loop count. +- (void)pausePlaying; + +/// Stop the animation. Reset the current frame index and loop count. +- (void)stopPlaying; + +/// Seek to the desired frame index and loop count. +/// @note This can be used for advanced control like progressive loading, or skipping specify frames. +/// @param index The frame index +/// @param loopCount The loop count +- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount; + +/// Clear the frame cache buffer. The frame cache buffer size can be controlled by `maxBufferSize`. +/// By default, when stop or pause the animation, the frame buffer is still kept to ready for the next restart +- (void)clearFrameBuffer; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m new file mode 100644 index 0000000..db5f123 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m @@ -0,0 +1,391 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDAnimatedImagePlayer.h" +#import "NSImage+Compatibility.h" +#import "SDDisplayLink.h" +#import "SDDeviceHelper.h" +#import "SDInternalMacros.h" + +@interface SDAnimatedImagePlayer () { + NSRunLoopMode _runLoopMode; +} + +@property (nonatomic, strong, readwrite) UIImage *currentFrame; +@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex; +@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount; +@property (nonatomic, strong) id animatedProvider; +@property (nonatomic, strong) NSMutableDictionary *frameBuffer; +@property (nonatomic, assign) NSTimeInterval currentTime; +@property (nonatomic, assign) BOOL bufferMiss; +@property (nonatomic, assign) BOOL needsDisplayWhenImageBecomesAvailable; +@property (nonatomic, assign) NSUInteger maxBufferCount; +@property (nonatomic, strong) NSOperationQueue *fetchQueue; +@property (nonatomic, strong) dispatch_semaphore_t lock; +@property (nonatomic, strong) SDDisplayLink *displayLink; + +@end + +@implementation SDAnimatedImagePlayer + +- (instancetype)initWithProvider:(id)provider { + self = [super init]; + if (self) { + NSUInteger animatedImageFrameCount = provider.animatedImageFrameCount; + // Check the frame count + if (animatedImageFrameCount <= 1) { + return nil; + } + self.totalFrameCount = animatedImageFrameCount; + // Get the current frame and loop count. + self.totalLoopCount = provider.animatedImageLoopCount; + self.animatedProvider = provider; + self.playbackRate = 1.0; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + ++ (instancetype)playerWithProvider:(id)provider { + SDAnimatedImagePlayer *player = [[SDAnimatedImagePlayer alloc] initWithProvider:provider]; + return player; +} + +#pragma mark - Life Cycle + +- (void)dealloc { +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification { + [_fetchQueue cancelAllOperations]; + [_fetchQueue addOperationWithBlock:^{ + NSNumber *currentFrameIndex = @(self.currentFrameIndex); + SD_LOCK(self.lock); + NSArray *keys = self.frameBuffer.allKeys; + // only keep the next frame for later rendering + for (NSNumber * key in keys) { + if (![key isEqualToNumber:currentFrameIndex]) { + [self.frameBuffer removeObjectForKey:key]; + } + } + SD_UNLOCK(self.lock); + }]; +} + +#pragma mark - Private +- (NSOperationQueue *)fetchQueue { + if (!_fetchQueue) { + _fetchQueue = [[NSOperationQueue alloc] init]; + _fetchQueue.maxConcurrentOperationCount = 1; + } + return _fetchQueue; +} + +- (NSMutableDictionary *)frameBuffer { + if (!_frameBuffer) { + _frameBuffer = [NSMutableDictionary dictionary]; + } + return _frameBuffer; +} + +- (dispatch_semaphore_t)lock { + if (!_lock) { + _lock = dispatch_semaphore_create(1); + } + return _lock; +} + +- (SDDisplayLink *)displayLink { + if (!_displayLink) { + _displayLink = [SDDisplayLink displayLinkWithTarget:self selector:@selector(displayDidRefresh:)]; + [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.runLoopMode]; + [_displayLink stop]; + } + return _displayLink; +} + +- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode { + if ([_runLoopMode isEqual:runLoopMode]) { + return; + } + if (_displayLink) { + if (_runLoopMode) { + [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_runLoopMode]; + } + if (runLoopMode.length > 0) { + [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode]; + } + } + _runLoopMode = [runLoopMode copy]; +} + +- (NSRunLoopMode)runLoopMode { + if (!_runLoopMode) { + _runLoopMode = [[self class] defaultRunLoopMode]; + } + return _runLoopMode; +} + +#pragma mark - State Control + +- (void)setupCurrentFrame { + if (self.currentFrameIndex != 0) { + return; + } + if ([self.animatedProvider isKindOfClass:[UIImage class]]) { + UIImage *image = (UIImage *)self.animatedProvider; + // Use the poster image if available + #if SD_MAC + UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; + #else + UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; + #endif + if (posterFrame) { + self.currentFrame = posterFrame; + SD_LOCK(self.lock); + self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame; + SD_UNLOCK(self.lock); + [self handleFrameChange]; + } + } +} + +- (void)resetCurrentFrameIndex { + self.currentFrame = nil; + self.currentFrameIndex = 0; + self.currentLoopCount = 0; + self.currentTime = 0; + self.bufferMiss = NO; + self.needsDisplayWhenImageBecomesAvailable = NO; + [self handleFrameChange]; +} + +- (void)clearFrameBuffer { + SD_LOCK(self.lock); + [_frameBuffer removeAllObjects]; + SD_UNLOCK(self.lock); +} + +#pragma mark - Animation Control +- (void)startPlaying { + [self.displayLink start]; + // Setup frame + if (self.currentFrameIndex == 0 && !self.currentFrame) { + [self setupCurrentFrame]; + } + // Calculate max buffer size + [self calculateMaxBufferCount]; +} + +- (void)stopPlaying { + [_fetchQueue cancelAllOperations]; + // Using `_displayLink` here because when UIImageView dealloc, it may trigger `[self stopAnimating]`, we already release the display link in SDAnimatedImageView's dealloc method. + [_displayLink stop]; + [self resetCurrentFrameIndex]; +} + +- (void)pausePlaying { + [_fetchQueue cancelAllOperations]; + [_displayLink stop]; +} + +- (BOOL)isPlaying { + return _displayLink.isRunning; +} + +- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount { + if (index >= self.totalFrameCount) { + return; + } + self.currentFrameIndex = index; + self.currentLoopCount = loopCount; + self.currentFrame = [self.animatedProvider animatedImageFrameAtIndex:index]; + [self handleFrameChange]; +} + +#pragma mark - Core Render +- (void)displayDidRefresh:(SDDisplayLink *)displayLink { + // If for some reason a wild call makes it through when we shouldn't be animating, bail. + // Early return! + if (!self.isPlaying) { + return; + } + + NSUInteger totalFrameCount = self.totalFrameCount; + if (totalFrameCount <= 1) { + // Total frame count less than 1, wrong configuration and stop animating + [self stopPlaying]; + return; + } + + NSTimeInterval playbackRate = self.playbackRate; + if (playbackRate <= 0) { + // Does not support <= 0 play rate + [self stopPlaying]; + return; + } + + // Calculate refresh duration + NSTimeInterval duration = self.displayLink.duration; + + NSUInteger currentFrameIndex = self.currentFrameIndex; + NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount; + + // Check if we need to display new frame firstly + BOOL bufferFull = NO; + if (self.needsDisplayWhenImageBecomesAvailable) { + UIImage *currentFrame; + SD_LOCK(self.lock); + currentFrame = self.frameBuffer[@(currentFrameIndex)]; + SD_UNLOCK(self.lock); + + // Update the current frame + if (currentFrame) { + SD_LOCK(self.lock); + // Remove the frame buffer if need + if (self.frameBuffer.count > self.maxBufferCount) { + self.frameBuffer[@(currentFrameIndex)] = nil; + } + // Check whether we can stop fetch + if (self.frameBuffer.count == totalFrameCount) { + bufferFull = YES; + } + SD_UNLOCK(self.lock); + + // Update the current frame immediately + self.currentFrame = currentFrame; + [self handleFrameChange]; + + self.bufferMiss = NO; + self.needsDisplayWhenImageBecomesAvailable = NO; + } + else { + self.bufferMiss = YES; + } + } + + // Check if we have the frame buffer + if (!self.bufferMiss) { + // Then check if timestamp is reached + self.currentTime += duration; + NSTimeInterval currentDuration = [self.animatedProvider animatedImageDurationAtIndex:currentFrameIndex]; + currentDuration = currentDuration / playbackRate; + if (self.currentTime < currentDuration) { + // Current frame timestamp not reached, return + return; + } + + // Otherwise, we should be ready to display next frame + self.needsDisplayWhenImageBecomesAvailable = YES; + self.currentFrameIndex = nextFrameIndex; + self.currentTime -= currentDuration; + NSTimeInterval nextDuration = [self.animatedProvider animatedImageDurationAtIndex:nextFrameIndex]; + nextDuration = nextDuration / playbackRate; + if (self.currentTime > nextDuration) { + // Do not skip frame + self.currentTime = nextDuration; + } + + // Update the loop count when last frame rendered + if (nextFrameIndex == 0) { + // Update the loop count + self.currentLoopCount++; + [self handleLoopChange]; + + // if reached the max loop count, stop animating, 0 means loop indefinitely + NSUInteger maxLoopCount = self.totalLoopCount; + if (maxLoopCount != 0 && (self.currentLoopCount >= maxLoopCount)) { + [self stopPlaying]; + return; + } + } + } + + // Since we support handler, check animating state again + if (!self.isPlaying) { + return; + } + + // Check if we should prefetch next frame or current frame + // When buffer miss, means the decode speed is slower than render speed, we fetch current miss frame + // Or, most cases, the decode speed is faster than render speed, we fetch next frame + NSUInteger fetchFrameIndex = self.bufferMiss? currentFrameIndex : nextFrameIndex; + UIImage *fetchFrame; + SD_LOCK(self.lock); + fetchFrame = self.bufferMiss? nil : self.frameBuffer[@(nextFrameIndex)]; + SD_UNLOCK(self.lock); + + if (!fetchFrame && !bufferFull && self.fetchQueue.operationCount == 0) { + // Prefetch next frame in background queue + id animatedProvider = self.animatedProvider; + @weakify(self); + NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{ + @strongify(self); + if (!self) { + return; + } + UIImage *frame = [animatedProvider animatedImageFrameAtIndex:fetchFrameIndex]; + + BOOL isAnimating = self.displayLink.isRunning; + if (isAnimating) { + SD_LOCK(self.lock); + self.frameBuffer[@(fetchFrameIndex)] = frame; + SD_UNLOCK(self.lock); + } + }]; + [self.fetchQueue addOperation:operation]; + } +} + +- (void)handleFrameChange { + if (self.animationFrameHandler) { + self.animationFrameHandler(self.currentFrameIndex, self.currentFrame); + } +} + +- (void)handleLoopChange { + if (self.animationLoopHandler) { + self.animationLoopHandler(self.currentLoopCount); + } +} + +#pragma mark - Util +- (void)calculateMaxBufferCount { + NSUInteger bytes = CGImageGetBytesPerRow(self.currentFrame.CGImage) * CGImageGetHeight(self.currentFrame.CGImage); + if (bytes == 0) bytes = 1024; + + NSUInteger max = 0; + if (self.maxBufferSize > 0) { + max = self.maxBufferSize; + } else { + // Calculate based on current memory, these factors are by experience + NSUInteger total = [SDDeviceHelper totalMemory]; + NSUInteger free = [SDDeviceHelper freeMemory]; + max = MIN(total * 0.2, free * 0.6); + } + + NSUInteger maxBufferCount = (double)max / (double)bytes; + if (!maxBufferCount) { + // At least 1 frame + maxBufferCount = 1; + } + + self.maxBufferCount = maxBufferCount; +} + ++ (NSString *)defaultRunLoopMode { + // Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations. + return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h new file mode 100644 index 0000000..be52f8c --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +/** + A subclass of `NSBitmapImageRep` to fix that GIF duration issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`. + This also fix the GIF loop count issue, which will use the Netscape standard (See http://www6.uniovi.es/gifanim/gifabout.htm) to only place once when the `kCGImagePropertyGIFLoopCount` is nil. This is what modern browser's behavior. + Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image. + This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`. + */ +@interface SDAnimatedImageRep : NSBitmapImageRep + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m new file mode 100644 index 0000000..0831742 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m @@ -0,0 +1,127 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageRep.h" + +#if SD_MAC + +#import "SDImageIOAnimatedCoderInternal.h" +#import "SDImageGIFCoder.h" +#import "SDImageAPNGCoder.h" +#import "SDImageHEICCoder.h" +#import "SDImageAWebPCoder.h" + +@implementation SDAnimatedImageRep { + CGImageSourceRef _imageSource; +} + +- (void)dealloc { + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +} + +// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer ++ (instancetype)imageRepWithData:(NSData *)data { + SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; + return imageRep; +} + +// We should override init method for `NSBitmapImageRep` to do initialize about animated image format +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +- (instancetype)initWithData:(NSData *)data { + self = [super initWithData:data]; + if (self) { + CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef) data, NULL); + if (!imageSource) { + return self; + } + _imageSource = imageSource; + NSUInteger frameCount = CGImageSourceGetCount(imageSource); + if (frameCount <= 1) { + return self; + } + CFStringRef type = CGImageSourceGetType(imageSource); + if (!type) { + return self; + } + if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) { + // GIF + // Fix the `NSBitmapImageRep` GIF loop count calculation issue + // Which will use 0 when there are no loop count information metadata in GIF data + NSUInteger loopCount = [SDImageGIFCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } else if (CFStringCompare(type, kUTTypePNG, 0) == kCFCompareEqualTo) { + // APNG + // Do initialize about frame count, current frame/duration and loop count + [self setProperty:NSImageFrameCount withValue:@(frameCount)]; + [self setProperty:NSImageCurrentFrame withValue:@(0)]; + NSUInteger loopCount = [SDImageAPNGCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) { + // HEIC + // Do initialize about frame count, current frame/duration and loop count + [self setProperty:NSImageFrameCount withValue:@(frameCount)]; + [self setProperty:NSImageCurrentFrame withValue:@(0)]; + NSUInteger loopCount = [SDImageHEICCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { + // WebP + // Do initialize about frame count, current frame/duration and loop count + [self setProperty:NSImageFrameCount withValue:@(frameCount)]; + [self setProperty:NSImageCurrentFrame withValue:@(0)]; + NSUInteger loopCount = [SDImageAWebPCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } + } + return self; +} + +// `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need. +- (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value { + [super setProperty:property withValue:value]; + if ([property isEqualToString:NSImageCurrentFrame]) { + // Access the image source + CGImageSourceRef imageSource = _imageSource; + if (!imageSource) { + return; + } + // Check format type + CFStringRef type = CGImageSourceGetType(imageSource); + if (!type) { + return; + } + NSUInteger index = [value unsignedIntegerValue]; + NSTimeInterval frameDuration = 0; + if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) { + // GIF + frameDuration = [SDImageGIFCoder frameDurationAtIndex:index source:imageSource]; + } else if (CFStringCompare(type, kUTTypePNG, 0) == kCFCompareEqualTo) { + // APNG + frameDuration = [SDImageAPNGCoder frameDurationAtIndex:index source:imageSource]; + } else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) { + // HEIC + frameDuration = [SDImageHEICCoder frameDurationAtIndex:index source:imageSource]; + } else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { + // WebP + frameDuration = [SDImageAWebPCoder frameDurationAtIndex:index source:imageSource]; + } + if (!frameDuration) { + return; + } + // Reset super frame duration with the actual frame duration + [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)]; + } +} +#pragma clang diagnostic pop + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/UIButton+WebCache.h b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h similarity index 53% rename from Pods/SDWebImage/SDWebImage/UIButton+WebCache.h rename to Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h index c43b749..af46476 100644 --- a/Pods/SDWebImage/SDWebImage/UIButton+WebCache.h +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h @@ -6,41 +6,25 @@ * file that was distributed with this source code. */ -#import "SDWebImageCompat.h" +#import "SDAnimatedImageView.h" -#if SD_UIKIT +#if SD_UIKIT || SD_MAC #import "SDWebImageManager.h" /** - * Integrates SDWebImage async downloading and caching of remote images with UIButtonView. + Integrates SDWebImage async downloading and caching of remote images with SDAnimatedImageView. */ -@interface UIButton (WebCache) - -/** - * Get the current image URL. - */ -- (nullable NSURL *)sd_currentImageURL; - -#pragma mark - Image - -/** - * Get the image URL for a control state. - * - * @param state Which state you want to know the URL for. The values are described in UIControlState. - */ -- (nullable NSURL *)sd_imageURLForState:(UIControlState)state; +@interface SDAnimatedImageView (WebCache) /** * Set the imageView `image` with an `url`. * * The download is asynchronous and cached. * - * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. + * @param url The url for the image. */ -- (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state; +- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; /** * Set the imageView `image` with an `url` and a placeholder. @@ -48,13 +32,11 @@ * The download is asynchronous and cached. * * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. * @param placeholder The image to be set initially, until the image request finishes. * @see sd_setImageWithURL:placeholderImage:options: */ - (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder; + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; /** * Set the imageView `image` with an `url`, placeholder and custom options. @@ -62,14 +44,27 @@ * The download is asynchronous and cached. * * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. * @param placeholder The image to be set initially, until the image request finishes. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. */ - (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options; + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; /** * Set the imageView `image` with an `url`. @@ -77,7 +72,6 @@ * The download is asynchronous and cached. * * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. * @param completedBlock A block called when operation has been completed. This block has no return value * and takes the requested UIImage as first parameter. In case of error the image parameter * is nil and the second parameter may contain an NSError. The third parameter is a Boolean @@ -85,7 +79,6 @@ * The fourth parameter is the original image url. */ - (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock; /** @@ -94,7 +87,6 @@ * The download is asynchronous and cached. * * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. * @param placeholder The image to be set initially, until the image request finishes. * @param completedBlock A block called when operation has been completed. This block has no return value * and takes the requested UIImage as first parameter. In case of error the image parameter @@ -103,9 +95,8 @@ * The fourth parameter is the original image url. */ - (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder - completed:(nullable SDExternalCompletionBlock)completedBlock; + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; /** * Set the imageView `image` with an `url`, placeholder and custom options. @@ -113,7 +104,6 @@ * The download is asynchronous and cached. * * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. * @param placeholder The image to be set initially, until the image request finishes. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. * @param completedBlock A block called when operation has been completed. This block has no return value @@ -123,120 +113,55 @@ * The fourth parameter is the original image url. */ - (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock; -#pragma mark - Background image - -/** - * Set the backgroundImageView `image` with an `url`. - * - * The download is asynchronous and cached. - * - * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. - */ -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state; - /** - * Set the backgroundImageView `image` with an `url` and a placeholder. - * - * The download is asynchronous and cached. - * - * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. - * @param placeholder The image to be set initially, until the image request finishes. - * @see sd_setImageWithURL:placeholderImage:options: - */ -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder; - -/** - * Set the backgroundImageView `image` with an `url`, placeholder and custom options. - * - * The download is asynchronous and cached. - * - * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. - * @param placeholder The image to be set initially, until the image request finishes. - * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. - */ -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options; - -/** - * Set the backgroundImageView `image` with an `url`. - * - * The download is asynchronous and cached. - * - * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. - * @param completedBlock A block called when operation has been completed. This block has no return value - * and takes the requested UIImage as first parameter. In case of error the image parameter - * is nil and the second parameter may contain an NSError. The third parameter is a Boolean - * indicating if the image was retrieved from the local cache or from the network. - * The fourth parameter is the original image url. - */ -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - completed:(nullable SDExternalCompletionBlock)completedBlock; - -/** - * Set the backgroundImageView `image` with an `url`, placeholder. + * Set the imageView `image` with an `url`, placeholder and custom options. * * The download is asynchronous and cached. * * @param url The url for the image. - * @param state The state that uses the specified title. The values are described in UIControlState. * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue * @param completedBlock A block called when operation has been completed. This block has no return value * and takes the requested UIImage as first parameter. In case of error the image parameter * is nil and the second parameter may contain an NSError. The third parameter is a Boolean * indicating if the image was retrieved from the local cache or from the network. * The fourth parameter is the original image url. */ -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder - completed:(nullable SDExternalCompletionBlock)completedBlock; +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; /** - * Set the backgroundImageView `image` with an `url`, placeholder and custom options. + * Set the imageView `image` with an `url`, placeholder, custom options and context. * * The download is asynchronous and cached. * * @param url The url for the image. * @param placeholder The image to be set initially, until the image request finishes. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue * @param completedBlock A block called when operation has been completed. This block has no return value * and takes the requested UIImage as first parameter. In case of error the image parameter * is nil and the second parameter may contain an NSError. The third parameter is a Boolean * indicating if the image was retrieved from the local cache or from the network. * The fourth parameter is the original image url. */ -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - completed:(nullable SDExternalCompletionBlock)completedBlock; - -#pragma mark - Cancel - -/** - * Cancel the current image download - */ -- (void)sd_cancelImageLoadForState:(UIControlState)state; - -/** - * Cancel the current backgroundImage download - */ -- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state; +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; @end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m new file mode 100644 index 0000000..beb56b2 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m @@ -0,0 +1,79 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageView+WebCache.h" + +#if SD_UIKIT || SD_MAC + +#import "UIView+WebCache.h" +#import "SDAnimatedImage.h" + +@implementation SDAnimatedImageView (WebCache) + +- (void)sd_setImageWithURL:(nullable NSURL *)url { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + Class animatedImageClass = [SDAnimatedImage class]; + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextAnimatedImageClass] = animatedImageClass; + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:nil + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h new file mode 100644 index 0000000..5dc8ef2 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h @@ -0,0 +1,99 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT || SD_MAC + +#import "SDAnimatedImage.h" + +/** + A drop-in replacement for UIImageView/NSImageView, you can use this for animated image rendering. + Call `setImage:` with `UIImage(NSImage)` which conform to `SDAnimatedImage` protocol will start animated image rendering. Call with normal UIImage(NSImage) will back to normal UIImageView(NSImageView) rendering + For UIKit: use `-startAnimating`, `-stopAnimating` to control animating. `isAnimating` to check animation state. + For AppKit: use `-setAnimates:` to control animating, `animates` to check animation state. This view is layer-backed. + */ +@interface SDAnimatedImageView : UIImageView + +/** + Current display frame image. This value is KVO Compliance. + */ +@property (nonatomic, strong, readonly, nullable) UIImage *currentFrame; +/** + Current frame index, zero based. This value is KVO Compliance. + */ +@property (nonatomic, assign, readonly) NSUInteger currentFrameIndex; +/** + Current loop count since its latest animating. This value is KVO Compliance. + */ +@property (nonatomic, assign, readonly) NSUInteger currentLoopCount; +/** + YES to choose `animationRepeatCount` property for animation loop count. No to use animated image's `animatedImageLoopCount` instead. + Default is NO. + */ +@property (nonatomic, assign) BOOL shouldCustomLoopCount; +/** + Total loop count for animated image rendering. Default is animated image's loop count. + If you need to set custom loop count, set `shouldCustomLoopCount` to YES and change this value. + This class override UIImageView's `animationRepeatCount` property on iOS, use this property as well. + */ +@property (nonatomic, assign) NSInteger animationRepeatCount; +/** + The animation playback rate. Default is 1.0. + `1.0` means the normal speed. + `0.0` means stopping the animation. + `0.0-1.0` means the slow speed. + `> 1.0` means the fast speed. + `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future) + */ +@property (nonatomic, assign) double playbackRate; +/** + Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0. + `0` means automatically adjust by calculating current memory usage. + `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) + `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory) + */ +@property (nonatomic, assign) NSUInteger maxBufferSize; +/** + Whehter or not to enable incremental image load for animated image. This is for the animated image which `sd_isIncremental` is YES (See `UIImage+Metadata.h`). If enable, animated image rendering will stop at the last frame available currently, and continue when another `setImage:` trigger, where the new animated image's `animatedImageData` should be updated from the previous one. If the `sd_isIncremental` is NO. The incremental image load stop. + @note If you are confused about this description, open Chrome browser to view some large GIF images with low network speed to see the animation behavior. + @note The best practice to use incremental load is using `initWithAnimatedCoder:scale:` in `SDAnimatedImage` with animated coder which conform to `SDProgressiveImageCoder` as well. Then call incremental update and incremental decode method to produce the image. + Default is YES. Set to NO to only render the static poster for incremental animated image. + */ +@property (nonatomic, assign) BOOL shouldIncrementalLoad; + +/** + Whether or not to clear the frame buffer cache when animation stopped. See `maxBufferSize` + This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop) + Default is NO. + */ +@property (nonatomic, assign) BOOL clearBufferWhenStopped; + +/** + Whether or not to reset the current frame index when animation stopped. + For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index. + Default is NO. + */ +@property (nonatomic, assign) BOOL resetFrameIndexWhenStopped; + +/** + If the image has more than one frame, set this value to `YES` will automatically + play/stop the animation when the view become visible/invisible. + Default is YES. + */ +@property (nonatomic, assign) BOOL autoPlayAnimatedImage; + +/** + You can specify a runloop mode to let it rendering. + Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device + @note This is useful for some cases, for example, always specify NSDefaultRunLoopMode, if you want to pause the animation when user scroll (for Mac user, drag the mouse or touchpad) + */ +@property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode; +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m new file mode 100644 index 0000000..b68c4eb --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m @@ -0,0 +1,519 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageView.h" + +#if SD_UIKIT || SD_MAC + +#import "SDAnimatedImagePlayer.h" +#import "UIImage+Metadata.h" +#import "NSImage+Compatibility.h" +#import "SDInternalMacros.h" +#import "objc/runtime.h" + +@interface UIImageView () +@end + +@interface SDAnimatedImageView () { + BOOL _initFinished; // Extra flag to mark the `commonInit` is called + NSRunLoopMode _runLoopMode; + NSUInteger _maxBufferSize; + double _playbackRate; +} + +@property (nonatomic, strong, readwrite) UIImage *currentFrame; +@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex; +@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount; +@property (nonatomic, assign) BOOL shouldAnimate; +@property (nonatomic, assign) BOOL isProgressive; +@property (nonatomic,strong) SDAnimatedImagePlayer *player; // The animation player. +@property (nonatomic) CALayer *imageViewLayer; // The actual rendering layer. + +@end + +@implementation SDAnimatedImageView +#if SD_UIKIT +@dynamic animationRepeatCount; // we re-use this property from `UIImageView` super class on iOS. +#endif + +#pragma mark - Initializers + +#if SD_MAC ++ (instancetype)imageViewWithImage:(NSImage *)image +{ + NSRect frame = NSMakeRect(0, 0, image.size.width, image.size.height); + SDAnimatedImageView *imageView = [[SDAnimatedImageView alloc] initWithFrame:frame]; + [imageView setImage:image]; + return imageView; +} +#else +// -initWithImage: isn't documented as a designated initializer of UIImageView, but it actually seems to be. +// Using -initWithImage: doesn't call any of the other designated initializers. +- (instancetype)initWithImage:(UIImage *)image +{ + self = [super initWithImage:image]; + if (self) { + [self commonInit]; + } + return self; +} + +// -initWithImage:highlightedImage: also isn't documented as a designated initializer of UIImageView, but it doesn't call any other designated initializers. +- (instancetype)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage +{ + self = [super initWithImage:image highlightedImage:highlightedImage]; + if (self) { + [self commonInit]; + } + return self; +} +#endif + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self commonInit]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder +{ + self = [super initWithCoder:aDecoder]; + if (self) { + [self commonInit]; + } + return self; +} + +- (void)commonInit +{ + // Pay attention that UIKit's `initWithImage:` will trigger a `setImage:` during initialization before this `commonInit`. + // So the properties which rely on this order, should using lazy-evaluation or do extra check in `setImage:`. + self.autoPlayAnimatedImage = YES; + self.shouldCustomLoopCount = NO; + self.shouldIncrementalLoad = YES; + self.playbackRate = 1.0; +#if SD_MAC + self.wantsLayer = YES; +#endif + // Mark commonInit finished + _initFinished = YES; +} + +#pragma mark - Accessors +#pragma mark Public + +- (void)setImage:(UIImage *)image +{ + if (self.image == image) { + return; + } + + // Check Progressive rendering + [self updateIsProgressiveWithImage:image]; + + if (!self.isProgressive) { + // Stop animating + self.player = nil; + self.currentFrame = nil; + self.currentFrameIndex = 0; + self.currentLoopCount = 0; + } + + // We need call super method to keep function. This will impliedly call `setNeedsDisplay`. But we have no way to avoid this when using animated image. So we call `setNeedsDisplay` again at the end. + super.image = image; + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + if (!self.player) { + id provider; + // Check progressive loading + if (self.isProgressive) { + provider = [self progressiveAnimatedCoderForImage:image]; + } else { + provider = (id)image; + } + // Create animated player + self.player = [SDAnimatedImagePlayer playerWithProvider:provider]; + } else { + // Update Frame Count + self.player.totalFrameCount = [(id)image animatedImageFrameCount]; + } + + if (!self.player) { + // animated player nil means the image format is not supported, or frame count <= 1 + return; + } + + // Custom Loop Count + if (self.shouldCustomLoopCount) { + self.player.totalLoopCount = self.animationRepeatCount; + } + + // RunLoop Mode + self.player.runLoopMode = self.runLoopMode; + + // Max Buffer Size + self.player.maxBufferSize = self.maxBufferSize; + + // Play Rate + self.player.playbackRate = self.playbackRate; + + // Setup handler + @weakify(self); + self.player.animationFrameHandler = ^(NSUInteger index, UIImage * frame) { + @strongify(self); + self.currentFrameIndex = index; + self.currentFrame = frame; + [self.imageViewLayer setNeedsDisplay]; + }; + self.player.animationLoopHandler = ^(NSUInteger loopCount) { + @strongify(self); + // Progressive image reach the current last frame index. Keep the state and pause animating. Wait for later restart + if (self.isProgressive) { + NSUInteger lastFrameIndex = self.player.totalFrameCount - 1; + [self.player seekToFrameAtIndex:lastFrameIndex loopCount:0]; + [self.player pausePlaying]; + } else { + self.currentLoopCount = loopCount; + } + }; + + // Ensure disabled highlighting; it's not supported (see `-setHighlighted:`). + super.highlighted = NO; + + [self stopAnimating]; + [self checkPlay]; + + [self.imageViewLayer setNeedsDisplay]; + } +} + +#pragma mark - Configuration + +- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode +{ + _runLoopMode = [runLoopMode copy]; + self.player.runLoopMode = runLoopMode; +} + +- (NSRunLoopMode)runLoopMode +{ + if (!_runLoopMode) { + _runLoopMode = [[self class] defaultRunLoopMode]; + } + return _runLoopMode; +} + ++ (NSString *)defaultRunLoopMode { + // Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations. + return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode; +} + +- (void)setMaxBufferSize:(NSUInteger)maxBufferSize +{ + _maxBufferSize = maxBufferSize; + self.player.maxBufferSize = maxBufferSize; +} + +- (NSUInteger)maxBufferSize { + return _maxBufferSize; // Defaults to 0 +} + +- (void)setPlaybackRate:(double)playbackRate +{ + _playbackRate = playbackRate; + self.player.playbackRate = playbackRate; +} + +- (double)playbackRate +{ + if (!_initFinished) { + return 1.0; // Defaults to 1.0 + } + return _playbackRate; +} + +- (BOOL)shouldIncrementalLoad +{ + if (!_initFinished) { + return YES; // Defaults to YES + } + return _initFinished; +} + +#pragma mark - UIView Method Overrides +#pragma mark Observing View-Related Changes + +#if SD_MAC +- (void)viewDidMoveToSuperview +#else +- (void)didMoveToSuperview +#endif +{ +#if SD_MAC + [super viewDidMoveToSuperview]; +#else + [super didMoveToSuperview]; +#endif + + [self checkPlay]; +} + +#if SD_MAC +- (void)viewDidMoveToWindow +#else +- (void)didMoveToWindow +#endif +{ +#if SD_MAC + [super viewDidMoveToWindow]; +#else + [super didMoveToWindow]; +#endif + + [self checkPlay]; +} + +#if SD_MAC +- (void)setAlphaValue:(CGFloat)alphaValue +#else +- (void)setAlpha:(CGFloat)alpha +#endif +{ +#if SD_MAC + [super setAlphaValue:alphaValue]; +#else + [super setAlpha:alpha]; +#endif + + [self checkPlay]; +} + +- (void)setHidden:(BOOL)hidden +{ + [super setHidden:hidden]; + + [self checkPlay]; +} + +#pragma mark - UIImageView Method Overrides +#pragma mark Image Data + +- (void)setAnimationRepeatCount:(NSInteger)animationRepeatCount +{ +#if SD_UIKIT + [super setAnimationRepeatCount:animationRepeatCount]; +#else + _animationRepeatCount = animationRepeatCount; +#endif + + if (self.shouldCustomLoopCount) { + self.player.totalLoopCount = animationRepeatCount; + } +} + +- (void)startAnimating +{ + if (self.player) { + [self updateShouldAnimate]; + if (self.shouldAnimate) { + [self.player startPlaying]; + } + } else { +#if SD_UIKIT + [super startAnimating]; +#else + [super setAnimates:YES]; +#endif + } +} + +- (void)stopAnimating +{ + if (self.player) { + if (self.resetFrameIndexWhenStopped) { + [self.player stopPlaying]; + } else { + [self.player pausePlaying]; + } + if (self.clearBufferWhenStopped) { + [self.player clearFrameBuffer]; + } + } else { +#if SD_UIKIT + [super stopAnimating]; +#else + [super setAnimates:NO]; +#endif + } +} + +#if SD_UIKIT +- (BOOL)isAnimating +{ + if (self.player) { + return self.player.isPlaying; + } else { + return [super isAnimating]; + } +} +#endif + +#if SD_MAC +- (BOOL)animates +{ + if (self.player) { + return self.player.isPlaying; + } else { + return [super animates]; + } +} + +- (void)setAnimates:(BOOL)animates +{ + if (animates) { + [self startAnimating]; + } else { + [self stopAnimating]; + } +} +#endif + +#pragma mark Highlighted Image Unsupport + +- (void)setHighlighted:(BOOL)highlighted +{ + // Highlighted image is unsupported for animated images, but implementing it breaks the image view when embedded in a UICollectionViewCell. + if (!self.player) { + [super setHighlighted:highlighted]; + } +} + + +#pragma mark - Private Methods +#pragma mark Animation + +/// Check if it should be played +- (void)checkPlay +{ + if (self.autoPlayAnimatedImage) { + [self updateShouldAnimate]; + if (self.shouldAnimate) { + [self startAnimating]; + } else { + [self stopAnimating]; + } + } +} + +// Don't repeatedly check our window & superview in `-displayDidRefresh:` for performance reasons. +// Just update our cached value whenever the animated image or visibility (window, superview, hidden, alpha) is changed. +- (void)updateShouldAnimate +{ +#if SD_MAC + BOOL isVisible = self.window && self.superview && ![self isHidden] && self.alphaValue > 0.0; +#else + BOOL isVisible = self.window && self.superview && ![self isHidden] && self.alpha > 0.0; +#endif + self.shouldAnimate = self.player && isVisible; +} + +// Update progressive status only after `setImage:` call. +- (void)updateIsProgressiveWithImage:(UIImage *)image +{ + self.isProgressive = NO; + if (!self.shouldIncrementalLoad) { + // Early return + return; + } + // We must use `image.class conformsToProtocol:` instead of `image conformsToProtocol:` here + // Because UIKit on macOS, using internal hard-coded override method, which returns NO + id currentAnimatedCoder = [self progressiveAnimatedCoderForImage:image]; + if (currentAnimatedCoder) { + UIImage *previousImage = self.image; + if (!previousImage) { + // If current animated coder supports progressive, and no previous image to check, start progressive loading + self.isProgressive = YES; + } else { + id previousAnimatedCoder = [self progressiveAnimatedCoderForImage:previousImage]; + if (previousAnimatedCoder == currentAnimatedCoder) { + // If current animated coder is the same as previous, start progressive loading + self.isProgressive = YES; + } + } + } +} + +// Check if image can represent a `Progressive Animated Image` during loading +- (id)progressiveAnimatedCoderForImage:(UIImage *)image +{ + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)] && image.sd_isIncremental && [image respondsToSelector:@selector(animatedCoder)]) { + id animatedCoder = [(id)image animatedCoder]; + if ([animatedCoder conformsToProtocol:@protocol(SDProgressiveImageCoder)]) { + return (id)animatedCoder; + } + } + return nil; +} + + +#pragma mark Providing the Layer's Content +#pragma mark - CALayerDelegate + +- (void)displayLayer:(CALayer *)layer +{ + UIImage *currentFrame = self.currentFrame; + if (currentFrame) { + layer.contentsScale = currentFrame.scale; + layer.contents = (__bridge id)currentFrame.CGImage; + } else { + // If we have no animation frames, call super implementation. iOS 14+ UIImageView use this delegate method for rendering. + if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) { + [super displayLayer:layer]; + } + } +} + +#if SD_MAC +// NSImageView use a subview. We need this subview's layer for actual rendering. +// Why using this design may because of properties like `imageAlignment` and `imageScaling`, which it's not available for UIImageView.contentMode (it's impossible to align left and keep aspect ratio at the same time) +- (NSView *)imageView { + NSImageView *imageView = objc_getAssociatedObject(self, SD_SEL_SPI(imageView)); + if (!imageView) { + // macOS 10.14 + imageView = objc_getAssociatedObject(self, SD_SEL_SPI(imageSubview)); + } + return imageView; +} + +// on macOS, it's the imageView subview's layer (we use layer-hosting view to let CALayerDelegate works) +- (CALayer *)imageViewLayer { + NSView *imageView = self.imageView; + if (!imageView) { + return nil; + } + if (!_imageViewLayer) { + _imageViewLayer = [CALayer new]; + _imageViewLayer.delegate = self; + imageView.layer = _imageViewLayer; + imageView.wantsLayer = YES; + } + return _imageViewLayer; +} +#else +// on iOS, it's the imageView itself's layer +- (CALayer *)imageViewLayer { + return self.layer; +} + +#endif + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h b/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h new file mode 100644 index 0000000..dc5e1fa --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h @@ -0,0 +1,145 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@class SDImageCacheConfig; +/** + A protocol to allow custom disk cache used in SDImageCache. + */ +@protocol SDDiskCache + +// All of these method are called from the same global queue to avoid blocking on main queue and thread-safe problem. But it's also recommend to ensure thread-safe yourself using lock or other ways. +@required +/** + Create a new disk cache based on the specified path. You can check `maxDiskSize` and `maxDiskAge` used for disk cache. + + @param cachePath Full path of a directory in which the cache will write data. + Once initialized you should not read and write to this directory. + @param config The cache config to be used to create the cache. + + @return A new cache object, or nil if an error occurs. + */ +- (nullable instancetype)initWithCachePath:(nonnull NSString *)cachePath config:(nonnull SDImageCacheConfig *)config; + +/** + Returns a boolean value that indicates whether a given key is in cache. + This method may blocks the calling thread until file read finished. + + @param key A string identifying the data. If nil, just return NO. + @return Whether the key is in cache. + */ +- (BOOL)containsDataForKey:(nonnull NSString *)key; + +/** + Returns the data associated with a given key. + This method may blocks the calling thread until file read finished. + + @param key A string identifying the data. If nil, just return nil. + @return The value associated with key, or nil if no value is associated with key. + */ +- (nullable NSData *)dataForKey:(nonnull NSString *)key; + +/** + Sets the value of the specified key in the cache. + This method may blocks the calling thread until file write finished. + + @param data The data to be stored in the cache. + @param key The key with which to associate the value. If nil, this method has no effect. + */ +- (void)setData:(nullable NSData *)data forKey:(nonnull NSString *)key; + +/** + Returns the extended data associated with a given key. + This method may blocks the calling thread until file read finished. + + @param key A string identifying the data. If nil, just return nil. + @return The value associated with key, or nil if no value is associated with key. + */ +- (nullable NSData *)extendedDataForKey:(nonnull NSString *)key; + +/** + Set extended data with a given key. + + @discussion You can set any extended data to exist cache key. Without override the exist disk file data. + on UNIX, the common way for this is to use the Extended file attributes (xattr) + + @param extendedData The extended data (pass nil to remove). + @param key The key with which to associate the value. If nil, this method has no effect. +*/ +- (void)setExtendedData:(nullable NSData *)extendedData forKey:(nonnull NSString *)key; + +/** + Removes the value of the specified key in the cache. + This method may blocks the calling thread until file delete finished. + + @param key The key identifying the value to be removed. If nil, this method has no effect. + */ +- (void)removeDataForKey:(nonnull NSString *)key; + +/** + Empties the cache. + This method may blocks the calling thread until file delete finished. + */ +- (void)removeAllData; + +/** + Removes the expired data from the cache. You can choose the data to remove base on `ageLimit`, `countLimit` and `sizeLimit` options. + */ +- (void)removeExpiredData; + +/** + The cache path for key + + @param key A string identifying the value + @return The cache path for key. Or nil if the key can not associate to a path + */ +- (nullable NSString *)cachePathForKey:(nonnull NSString *)key; + +/** + Returns the number of data in this cache. + This method may blocks the calling thread until file read finished. + + @return The total data count. + */ +- (NSUInteger)totalCount; + +/** + Returns the total size (in bytes) of data in this cache. + This method may blocks the calling thread until file read finished. + + @return The total data size in bytes. + */ +- (NSUInteger)totalSize; + +@end + +/** + The built-in disk cache. + */ +@interface SDDiskCache : NSObject +/** + Cache Config object - storing all kind of settings. + */ +@property (nonatomic, strong, readonly, nonnull) SDImageCacheConfig *config; + +- (nonnull instancetype)init NS_UNAVAILABLE; + +/** + Move the cache directory from old location to new location, the old location will be removed after finish. + If the old location does not exist, does nothing. + If the new location does not exist, only do a movement of directory. + If the new location does exist, will move and merge the files from old location. + If the new location does exist, but is not a directory, will remove it and do a movement of directory. + + @param srcPath old location of cache directory + @param dstPath new location of cache directory + */ +- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m b/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m new file mode 100644 index 0000000..5f5d41a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m @@ -0,0 +1,326 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDDiskCache.h" +#import "SDImageCacheConfig.h" +#import "SDFileAttributeHelper.h" +#import + +static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDiskCache"; + +@interface SDDiskCache () + +@property (nonatomic, copy) NSString *diskCachePath; +@property (nonatomic, strong, nonnull) NSFileManager *fileManager; + +@end + +@implementation SDDiskCache + +- (instancetype)init { + NSAssert(NO, @"Use `initWithCachePath:` with the disk cache path"); + return nil; +} + +#pragma mark - SDcachePathForKeyDiskCache Protocol +- (instancetype)initWithCachePath:(NSString *)cachePath config:(nonnull SDImageCacheConfig *)config { + if (self = [super init]) { + _diskCachePath = cachePath; + _config = config; + [self commonInit]; + } + return self; +} + +- (void)commonInit { + if (self.config.fileManager) { + self.fileManager = self.config.fileManager; + } else { + self.fileManager = [NSFileManager new]; + } +} + +- (BOOL)containsDataForKey:(NSString *)key { + NSParameterAssert(key); + NSString *filePath = [self cachePathForKey:key]; + BOOL exists = [self.fileManager fileExistsAtPath:filePath]; + + // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name + // checking the key with and without the extension + if (!exists) { + exists = [self.fileManager fileExistsAtPath:filePath.stringByDeletingPathExtension]; + } + + return exists; +} + +- (NSData *)dataForKey:(NSString *)key { + NSParameterAssert(key); + NSString *filePath = [self cachePathForKey:key]; + NSData *data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil]; + if (data) { + return data; + } + + // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name + // checking the key with and without the extension + data = [NSData dataWithContentsOfFile:filePath.stringByDeletingPathExtension options:self.config.diskCacheReadingOptions error:nil]; + if (data) { + return data; + } + + return nil; +} + +- (void)setData:(NSData *)data forKey:(NSString *)key { + NSParameterAssert(data); + NSParameterAssert(key); + if (![self.fileManager fileExistsAtPath:self.diskCachePath]) { + [self.fileManager createDirectoryAtPath:self.diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL]; + } + + // get cache Path for image key + NSString *cachePathForKey = [self cachePathForKey:key]; + // transform to NSURL + NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey]; + + [data writeToURL:fileURL options:self.config.diskCacheWritingOptions error:nil]; + + // disable iCloud backup + if (self.config.shouldDisableiCloud) { + // ignore iCloud backup resource value error + [fileURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; + } +} + +- (NSData *)extendedDataForKey:(NSString *)key { + NSParameterAssert(key); + + // get cache Path for image key + NSString *cachePathForKey = [self cachePathForKey:key]; + + NSData *extendedData = [SDFileAttributeHelper extendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil]; + + return extendedData; +} + +- (void)setExtendedData:(NSData *)extendedData forKey:(NSString *)key { + NSParameterAssert(key); + // get cache Path for image key + NSString *cachePathForKey = [self cachePathForKey:key]; + + if (!extendedData) { + // Remove + [SDFileAttributeHelper removeExtendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil]; + } else { + // Override + [SDFileAttributeHelper setExtendedAttribute:SDDiskCacheExtendedAttributeName value:extendedData atPath:cachePathForKey traverseLink:NO overwrite:YES error:nil]; + } +} + +- (void)removeDataForKey:(NSString *)key { + NSParameterAssert(key); + NSString *filePath = [self cachePathForKey:key]; + [self.fileManager removeItemAtPath:filePath error:nil]; +} + +- (void)removeAllData { + [self.fileManager removeItemAtPath:self.diskCachePath error:nil]; + [self.fileManager createDirectoryAtPath:self.diskCachePath + withIntermediateDirectories:YES + attributes:nil + error:NULL]; +} + +- (void)removeExpiredData { + NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; + + // Compute content date key to be used for tests + NSURLResourceKey cacheContentDateKey = NSURLContentModificationDateKey; + switch (self.config.diskCacheExpireType) { + case SDImageCacheConfigExpireTypeAccessDate: + cacheContentDateKey = NSURLContentAccessDateKey; + break; + case SDImageCacheConfigExpireTypeModificationDate: + cacheContentDateKey = NSURLContentModificationDateKey; + break; + case SDImageCacheConfigExpireTypeCreationDate: + cacheContentDateKey = NSURLCreationDateKey; + break; + case SDImageCacheConfigExpireTypeChangeDate: + cacheContentDateKey = NSURLAttributeModificationDateKey; + break; + default: + break; + } + + NSArray *resourceKeys = @[NSURLIsDirectoryKey, cacheContentDateKey, NSURLTotalFileAllocatedSizeKey]; + + // This enumerator prefetches useful properties for our cache files. + NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtURL:diskCacheURL + includingPropertiesForKeys:resourceKeys + options:NSDirectoryEnumerationSkipsHiddenFiles + errorHandler:NULL]; + + NSDate *expirationDate = (self.config.maxDiskAge < 0) ? nil: [NSDate dateWithTimeIntervalSinceNow:-self.config.maxDiskAge]; + NSMutableDictionary *> *cacheFiles = [NSMutableDictionary dictionary]; + NSUInteger currentCacheSize = 0; + + // Enumerate all of the files in the cache directory. This loop has two purposes: + // + // 1. Removing files that are older than the expiration date. + // 2. Storing file attributes for the size-based cleanup pass. + NSMutableArray *urlsToDelete = [[NSMutableArray alloc] init]; + for (NSURL *fileURL in fileEnumerator) { + NSError *error; + NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error]; + + // Skip directories and errors. + if (error || !resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) { + continue; + } + + // Remove files that are older than the expiration date; + NSDate *modifiedDate = resourceValues[cacheContentDateKey]; + if (expirationDate && [[modifiedDate laterDate:expirationDate] isEqualToDate:expirationDate]) { + [urlsToDelete addObject:fileURL]; + continue; + } + + // Store a reference to this file and account for its total size. + NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; + currentCacheSize += totalAllocatedSize.unsignedIntegerValue; + cacheFiles[fileURL] = resourceValues; + } + + for (NSURL *fileURL in urlsToDelete) { + [self.fileManager removeItemAtURL:fileURL error:nil]; + } + + // If our remaining disk cache exceeds a configured maximum size, perform a second + // size-based cleanup pass. We delete the oldest files first. + NSUInteger maxDiskSize = self.config.maxDiskSize; + if (maxDiskSize > 0 && currentCacheSize > maxDiskSize) { + // Target half of our maximum cache size for this cleanup pass. + const NSUInteger desiredCacheSize = maxDiskSize / 2; + + // Sort the remaining cache files by their last modification time or last access time (oldest first). + NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent + usingComparator:^NSComparisonResult(id obj1, id obj2) { + return [obj1[cacheContentDateKey] compare:obj2[cacheContentDateKey]]; + }]; + + // Delete files until we fall below our desired cache size. + for (NSURL *fileURL in sortedFiles) { + if ([self.fileManager removeItemAtURL:fileURL error:nil]) { + NSDictionary *resourceValues = cacheFiles[fileURL]; + NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; + currentCacheSize -= totalAllocatedSize.unsignedIntegerValue; + + if (currentCacheSize < desiredCacheSize) { + break; + } + } + } + } +} + +- (nullable NSString *)cachePathForKey:(NSString *)key { + NSParameterAssert(key); + return [self cachePathForKey:key inPath:self.diskCachePath]; +} + +- (NSUInteger)totalSize { + NSUInteger size = 0; + NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath]; + for (NSString *fileName in fileEnumerator) { + NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName]; + NSDictionary *attrs = [self.fileManager attributesOfItemAtPath:filePath error:nil]; + size += [attrs fileSize]; + } + return size; +} + +- (NSUInteger)totalCount { + NSUInteger count = 0; + NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath]; + count = fileEnumerator.allObjects.count; + return count; +} + +#pragma mark - Cache paths + +- (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path { + NSString *filename = SDDiskCacheFileNameForKey(key); + return [path stringByAppendingPathComponent:filename]; +} + +- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath { + NSParameterAssert(srcPath); + NSParameterAssert(dstPath); + // Check if old path is equal to new path + if ([srcPath isEqualToString:dstPath]) { + return; + } + BOOL isDirectory; + // Check if old path is directory + if (![self.fileManager fileExistsAtPath:srcPath isDirectory:&isDirectory] || !isDirectory) { + return; + } + // Check if new path is directory + if (![self.fileManager fileExistsAtPath:dstPath isDirectory:&isDirectory] || !isDirectory) { + if (!isDirectory) { + // New path is not directory, remove file + [self.fileManager removeItemAtPath:dstPath error:nil]; + } + NSString *dstParentPath = [dstPath stringByDeletingLastPathComponent]; + // Creates any non-existent parent directories as part of creating the directory in path + if (![self.fileManager fileExistsAtPath:dstParentPath]) { + [self.fileManager createDirectoryAtPath:dstParentPath withIntermediateDirectories:YES attributes:nil error:NULL]; + } + // New directory does not exist, rename directory + [self.fileManager moveItemAtPath:srcPath toPath:dstPath error:nil]; + } else { + // New directory exist, merge the files + NSDirectoryEnumerator *dirEnumerator = [self.fileManager enumeratorAtPath:srcPath]; + NSString *file; + while ((file = [dirEnumerator nextObject])) { + [self.fileManager moveItemAtPath:[srcPath stringByAppendingPathComponent:file] toPath:[dstPath stringByAppendingPathComponent:file] error:nil]; + } + // Remove the old path + [self.fileManager removeItemAtPath:srcPath error:nil]; + } +} + +#pragma mark - Hash + +#define SD_MAX_FILE_EXTENSION_LENGTH (NAME_MAX - CC_MD5_DIGEST_LENGTH * 2 - 1) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +static inline NSString * _Nonnull SDDiskCacheFileNameForKey(NSString * _Nullable key) { + const char *str = key.UTF8String; + if (str == NULL) { + str = ""; + } + unsigned char r[CC_MD5_DIGEST_LENGTH]; + CC_MD5(str, (CC_LONG)strlen(str), r); + NSURL *keyURL = [NSURL URLWithString:key]; + NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension; + // File system has file name length limit, we need to check if ext is too long, we don't add it to the filename + if (ext.length > SD_MAX_FILE_EXTENSION_LENGTH) { + ext = nil; + } + NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%@", + r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], + r[11], r[12], r[13], r[14], r[15], ext.length == 0 ? @"" : [NSString stringWithFormat:@".%@", ext]]; + return filename; +} +#pragma clang diagnostic pop + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h b/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h new file mode 100644 index 0000000..900acd7 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h @@ -0,0 +1,73 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageCompat.h" + +/** + These following class are provided to use `UIGraphicsImageRenderer` with polyfill, which allows write cross-platform(AppKit/UIKit) code and avoid runtime version check. + Compared to `UIGraphicsBeginImageContext`, `UIGraphicsImageRenderer` use dynamic bitmap from your draw code to generate CGContext, not always use ARGB8888, which is more performant on RAM usage. + Which means, if you draw CGImage/CIImage which contains grayscale only, the underlaying bitmap context use grayscale, it's managed by system and not a fixed type. (actually, the `kCGContextTypeAutomatic`) + For usage, See more in Apple's documentation: https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer + For UIKit on iOS/tvOS 10+, these method just use the same `UIGraphicsImageRenderer` API. + For others (macOS/watchOS or iOS/tvOS 10-), these method use the `SDImageGraphics.h` to implements the same behavior (but without dynamic bitmap support) +*/ + +typedef void (^SDGraphicsImageDrawingActions)(CGContextRef _Nonnull context); +typedef NS_ENUM(NSInteger, SDGraphicsImageRendererFormatRange) { + SDGraphicsImageRendererFormatRangeUnspecified = -1, + SDGraphicsImageRendererFormatRangeAutomatic = 0, + SDGraphicsImageRendererFormatRangeExtended, + SDGraphicsImageRendererFormatRangeStandard +}; + +/// A set of drawing attributes that represent the configuration of an image renderer context. +@interface SDGraphicsImageRendererFormat : NSObject + +/// The display scale of the image renderer context. +/// The default value is equal to the scale of the main screen. +@property (nonatomic) CGFloat scale; + +/// A Boolean value indicating whether the underlying Core Graphics context has an alpha channel. +/// The default value is NO. +@property (nonatomic) BOOL opaque; + +/// Specifying whether the bitmap context should use extended color. +/// For iOS 12+, the value is from system `preferredRange` property +/// For iOS 10-11, the value is from system `prefersExtendedRange` property +/// For iOS 9-, the value is `.standard` +@property (nonatomic) SDGraphicsImageRendererFormatRange preferredRange; + +/// Init the default format. See each properties's default value. +- (nonnull instancetype)init; + +/// Returns a new format best suited for the main screen’s current configuration. ++ (nonnull instancetype)preferredFormat; + +@end + +/// A graphics renderer for creating Core Graphics-backed images. +@interface SDGraphicsImageRenderer : NSObject + +/// Creates an image renderer for drawing images of a given size. +/// @param size The size of images output from the renderer, specified in points. +/// @return An initialized image renderer. +- (nonnull instancetype)initWithSize:(CGSize)size; + +/// Creates a new image renderer with a given size and format. +/// @param size The size of images output from the renderer, specified in points. +/// @param format A SDGraphicsImageRendererFormat object that encapsulates the format used to create the renderer context. +/// @return An initialized image renderer. +- (nonnull instancetype)initWithSize:(CGSize)size format:(nonnull SDGraphicsImageRendererFormat *)format; + +/// Creates an image by following a set of drawing instructions. +/// @param actions A SDGraphicsImageDrawingActions block that, when invoked by the renderer, executes a set of drawing instructions to create the output image. +/// @note You should not retain or use the context outside the block, it's non-escaping. +/// @return A UIImage object created by the supplied drawing actions. +- (nonnull UIImage *)imageWithActions:(nonnull NS_NOESCAPE SDGraphicsImageDrawingActions)actions; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m b/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m new file mode 100644 index 0000000..03aef3a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m @@ -0,0 +1,244 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDGraphicsImageRenderer.h" +#import "SDImageGraphics.h" + +@interface SDGraphicsImageRendererFormat () +#if SD_UIKIT +@property (nonatomic, strong) UIGraphicsImageRendererFormat *uiformat API_AVAILABLE(ios(10.0), tvos(10.0)); +#endif +@end + +@implementation SDGraphicsImageRendererFormat +@synthesize scale = _scale; +@synthesize opaque = _opaque; +@synthesize preferredRange = _preferredRange; + +#pragma mark - Property +- (CGFloat)scale { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + return self.uiformat.scale; + } else { + return _scale; + } +#else + return _scale; +#endif +} + +- (void)setScale:(CGFloat)scale { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + self.uiformat.scale = scale; + } else { + _scale = scale; + } +#else + _scale = scale; +#endif +} + +- (BOOL)opaque { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + return self.uiformat.opaque; + } else { + return _opaque; + } +#else + return _opaque; +#endif +} + +- (void)setOpaque:(BOOL)opaque { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + self.uiformat.opaque = opaque; + } else { + _opaque = opaque; + } +#else + _opaque = opaque; +#endif +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (SDGraphicsImageRendererFormatRange)preferredRange { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + if (@available(iOS 12.0, tvOS 12.0, *)) { + return (SDGraphicsImageRendererFormatRange)self.uiformat.preferredRange; + } else { + BOOL prefersExtendedRange = self.uiformat.prefersExtendedRange; + if (prefersExtendedRange) { + return SDGraphicsImageRendererFormatRangeExtended; + } else { + return SDGraphicsImageRendererFormatRangeStandard; + } + } + } else { + return _preferredRange; + } +#else + return _preferredRange; +#endif +} + +- (void)setPreferredRange:(SDGraphicsImageRendererFormatRange)preferredRange { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + if (@available(iOS 12.0, tvOS 12.0, *)) { + self.uiformat.preferredRange = (UIGraphicsImageRendererFormatRange)preferredRange; + } else { + switch (preferredRange) { + case SDGraphicsImageRendererFormatRangeExtended: + self.uiformat.prefersExtendedRange = YES; + break; + case SDGraphicsImageRendererFormatRangeStandard: + self.uiformat.prefersExtendedRange = NO; + default: + // Automatic means default + break; + } + } + } else { + _preferredRange = preferredRange; + } +#else + _preferredRange = preferredRange; +#endif +} +#pragma clang diagnostic pop + +- (instancetype)init { + self = [super init]; + if (self) { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + UIGraphicsImageRendererFormat *uiformat = [[UIGraphicsImageRendererFormat alloc] init]; + self.uiformat = uiformat; + } else { +#endif +#if SD_WATCH + CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale; +#elif SD_UIKIT + CGFloat screenScale = [UIScreen mainScreen].scale; +#elif SD_MAC + CGFloat screenScale = [NSScreen mainScreen].backingScaleFactor; +#endif + self.scale = screenScale; + self.opaque = NO; + self.preferredRange = SDGraphicsImageRendererFormatRangeStandard; +#if SD_UIKIT + } +#endif + } + return self; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +- (instancetype)initForMainScreen { + self = [super init]; + if (self) { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.0, *)) { + UIGraphicsImageRendererFormat *uiformat; + // iOS 11.0.0 GM does have `preferredFormat`, but iOS 11 betas did not (argh!) + if ([UIGraphicsImageRenderer respondsToSelector:@selector(preferredFormat)]) { + uiformat = [UIGraphicsImageRendererFormat preferredFormat]; + } else { + uiformat = [UIGraphicsImageRendererFormat defaultFormat]; + } + self.uiformat = uiformat; + } else { +#endif +#if SD_WATCH + CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale; +#elif SD_UIKIT + CGFloat screenScale = [UIScreen mainScreen].scale; +#elif SD_MAC + CGFloat screenScale = [NSScreen mainScreen].backingScaleFactor; +#endif + self.scale = screenScale; + self.opaque = NO; + self.preferredRange = SDGraphicsImageRendererFormatRangeStandard; +#if SD_UIKIT + } +#endif + } + return self; +} +#pragma clang diagnostic pop + ++ (instancetype)preferredFormat { + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] initForMainScreen]; + return format; +} + +@end + +@interface SDGraphicsImageRenderer () +@property (nonatomic, assign) CGSize size; +@property (nonatomic, strong) SDGraphicsImageRendererFormat *format; +#if SD_UIKIT +@property (nonatomic, strong) UIGraphicsImageRenderer *uirenderer API_AVAILABLE(ios(10.0), tvos(10.0)); +#endif +@end + +@implementation SDGraphicsImageRenderer + +- (instancetype)initWithSize:(CGSize)size { + return [self initWithSize:size format:SDGraphicsImageRendererFormat.preferredFormat]; +} + +- (instancetype)initWithSize:(CGSize)size format:(SDGraphicsImageRendererFormat *)format { + NSParameterAssert(format); + self = [super init]; + if (self) { + self.size = size; + self.format = format; +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.0, *)) { + UIGraphicsImageRendererFormat *uiformat = format.uiformat; + self.uirenderer = [[UIGraphicsImageRenderer alloc] initWithSize:size format:uiformat]; + } +#endif + } + return self; +} + +- (UIImage *)imageWithActions:(NS_NOESCAPE SDGraphicsImageDrawingActions)actions { + NSParameterAssert(actions); +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.0, *)) { + UIGraphicsImageDrawingActions uiactions = ^(UIGraphicsImageRendererContext *rendererContext) { + if (actions) { + actions(rendererContext.CGContext); + } + }; + return [self.uirenderer imageWithActions:uiactions]; + } else { +#endif + SDGraphicsBeginImageContextWithOptions(self.size, self.format.opaque, self.format.scale); + CGContextRef context = SDGraphicsGetCurrentContext(); + if (actions) { + actions(context); + } + UIImage *image = SDGraphicsGetImageFromCurrentImageContext(); + SDGraphicsEndImageContext(); + return image; +#if SD_UIKIT + } +#endif +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h new file mode 100644 index 0000000..f73742c --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h @@ -0,0 +1,19 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + Built in coder using ImageIO that supports APNG encoding/decoding + */ +@interface SDImageAPNGCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m new file mode 100644 index 0000000..336879d --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m @@ -0,0 +1,65 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageAPNGCoder.h" +#if SD_MAC +#import +#else +#import +#endif + +// iOS 8 Image/IO framework binary does not contains these APNG constants, so we define them. Thanks Apple :) +// We can not use runtime @available check for this issue, because it's a global symbol and should be loaded during launch time by dyld. So hack if the min deployment target version < iOS 9.0, whatever it running on iOS 9+ or not. +#if (__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0) +const CFStringRef kCGImagePropertyAPNGLoopCount = (__bridge CFStringRef)@"LoopCount"; +const CFStringRef kCGImagePropertyAPNGDelayTime = (__bridge CFStringRef)@"DelayTime"; +const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef)@"UnclampedDelayTime"; +#endif + +@implementation SDImageAPNGCoder + ++ (instancetype)sharedCoder { + static SDImageAPNGCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageAPNGCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatPNG; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kUTTypePNG; +} + ++ (NSString *)dictionaryProperty { + return (__bridge NSString *)kCGImagePropertyPNGDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return (__bridge NSString *)kCGImagePropertyAPNGDelayTime; +} + ++ (NSString *)loopCountProperty { + return (__bridge NSString *)kCGImagePropertyAPNGLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 0; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h new file mode 100644 index 0000000..4b585a9 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + This coder is used for Google WebP and Animated WebP(AWebP) image format. + Image/IO provide the WebP decoding support in iOS 14/macOS 11/tvOS 14/watchOS 7+. + @note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below. + @note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder + */ +API_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0)) +@interface SDImageAWebPCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m new file mode 100644 index 0000000..e58bc21 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m @@ -0,0 +1,98 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDImageAWebPCoder.h" +#import "SDImageIOAnimatedCoderInternal.h" + +// These constants are available from iOS 14+ and Xcode 12. This raw value is used for toolchain and firmware compatibility +static NSString * kSDCGImagePropertyWebPDictionary = @"{WebP}"; +static NSString * kSDCGImagePropertyWebPLoopCount = @"LoopCount"; +static NSString * kSDCGImagePropertyWebPDelayTime = @"DelayTime"; +static NSString * kSDCGImagePropertyWebPUnclampedDelayTime = @"UnclampedDelayTime"; + +@implementation SDImageAWebPCoder + ++ (void)initialize { +#if __IPHONE_14_0 || __TVOS_14_0 || __MAC_11_0 || __WATCHOS_7_0 + // Xcode 12 + if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) { + // Use SDK instead of raw value + kSDCGImagePropertyWebPDictionary = (__bridge NSString *)kCGImagePropertyWebPDictionary; + kSDCGImagePropertyWebPLoopCount = (__bridge NSString *)kCGImagePropertyWebPLoopCount; + kSDCGImagePropertyWebPDelayTime = (__bridge NSString *)kCGImagePropertyWebPDelayTime; + kSDCGImagePropertyWebPUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyWebPUnclampedDelayTime; + } +#endif +} + ++ (instancetype)sharedCoder { + static SDImageAWebPCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageAWebPCoder alloc] init]; + }); + return coder; +} + +#pragma mark - SDImageCoder + +- (BOOL)canDecodeFromData:(nullable NSData *)data { + switch ([NSData sd_imageFormatForImageData:data]) { + case SDImageFormatWebP: + // Check WebP decoding compatibility + return [self.class canDecodeFromFormat:SDImageFormatWebP]; + default: + return NO; + } +} + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return [self canDecodeFromData:data]; +} + +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + switch (format) { + case SDImageFormatWebP: + // Check WebP encoding compatibility + return [self.class canEncodeToFormat:SDImageFormatWebP]; + default: + return NO; + } +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatWebP; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kSDUTTypeWebP; +} + ++ (NSString *)dictionaryProperty { + return kSDCGImagePropertyWebPDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return kSDCGImagePropertyWebPUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return kSDCGImagePropertyWebPDelayTime; +} + ++ (NSString *)loopCountProperty { + return kSDCGImagePropertyWebPLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 0; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h new file mode 100644 index 0000000..7523da4 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h @@ -0,0 +1,422 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDImageCacheConfig.h" +#import "SDImageCacheDefine.h" +#import "SDMemoryCache.h" +#import "SDDiskCache.h" + +/// Image Cache Options +typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { + /** + * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDImageCacheQueryMemoryDataSync` + */ + SDImageCacheQueryMemoryData = 1 << 0, + /** + * By default, when you only specify `SDImageCacheQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously. + */ + SDImageCacheQueryMemoryDataSync = 1 << 1, + /** + * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously. + @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page. + */ + SDImageCacheQueryDiskDataSync = 1 << 2, + /** + * By default, images are decoded respecting their original size. On iOS, this flag will scale down the + * images to a size compatible with the constrained memory of devices. + */ + SDImageCacheScaleDownLargeImages = 1 << 3, + /** + * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. + * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image. + */ + SDImageCacheAvoidDecodeImage = 1 << 4, + /** + * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image. + */ + SDImageCacheDecodeFirstFrameOnly = 1 << 5, + /** + * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from disk cache + */ + SDImageCachePreloadAllFrames = 1 << 6, + /** + * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution. + * Using this option, can ensure we always produce image with your provided class. If failed, an error with code `SDWebImageErrorBadImageData` will be used. + * Note this options is not compatible with `SDImageCacheDecodeFirstFrameOnly`, which always produce a UIImage/NSImage. + */ + SDImageCacheMatchAnimatedImageClass = 1 << 7, +}; + +/** + * SDImageCache maintains a memory cache and a disk cache. Disk cache write operations are performed + * asynchronous so it doesn’t add unnecessary latency to the UI. + */ +@interface SDImageCache : NSObject + +#pragma mark - Properties + +/** + * Cache Config object - storing all kind of settings. + * The property is copy so change of current config will not accidentally affect other cache's config. + */ +@property (nonatomic, copy, nonnull, readonly) SDImageCacheConfig *config; + +/** + * The memory cache implementation object used for current image cache. + * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method. + * @note To customize this class, check `SDImageCacheConfig.memoryCacheClass` property. + */ +@property (nonatomic, strong, readonly, nonnull) id memoryCache; + +/** + * The disk cache implementation object used for current image cache. + * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method. + * @note To customize this class, check `SDImageCacheConfig.diskCacheClass` property. + * @warning When calling method about read/write in disk cache, be sure to either make your disk cache implementation IO-safe or using the same access queue to avoid issues. + */ +@property (nonatomic, strong, readonly, nonnull) id diskCache; + +/** + * The disk cache's root path + */ +@property (nonatomic, copy, nonnull, readonly) NSString *diskCachePath; + +/** + * The additional disk cache path to check if the query from disk cache not exist; + * The `key` param is the image cache key. The returned file path will be used to load the disk cache. If return nil, ignore it. + * Useful if you want to bundle pre-loaded images with your app + */ +@property (nonatomic, copy, nullable) SDImageCacheAdditionalCachePathBlock additionalCachePathBlock; + +#pragma mark - Singleton and initialization + +/** + * Returns global shared cache instance + */ +@property (nonatomic, class, readonly, nonnull) SDImageCache *sharedImageCache; + +/** + * Control the default disk cache directory. This will effect all the SDImageCache instance created after modification, even for shared image cache. + * This can be used to share the same disk cache with the App and App Extension (Today/Notification Widget) using `- [NSFileManager.containerURLForSecurityApplicationGroupIdentifier:]`. + * @note If you pass nil, the value will be reset to `~/Library/Caches/com.hackemist.SDImageCache`. + * @note We still preserve the `namespace` arg, which means, if you change this property into `/path/to/use`, the `SDImageCache.sharedImageCache.diskCachePath` should be `/path/to/use/default` because shared image cache use `default` as namespace. + * Defaults to nil. + */ +@property (nonatomic, class, readwrite, null_resettable) NSString *defaultDiskCacheDirectory; + +/** + * Init a new cache store with a specific namespace + * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/) + * + * @param ns The namespace to use for this cache store + */ +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns; + +/** + * Init a new cache store with a specific namespace and directory. + * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/) + * + * @param ns The namespace to use for this cache store + * @param directory Directory to cache disk images in + */ +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory; + +/** + * Init a new cache store with a specific namespace, directory and config. + * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/) + * + * @param ns The namespace to use for this cache store + * @param directory Directory to cache disk images in + * @param config The cache config to be used to create the cache. You can provide custom memory cache or disk cache class in the cache config + */ +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory + config:(nullable SDImageCacheConfig *)config NS_DESIGNATED_INITIALIZER; + +#pragma mark - Cache paths + +/** + Get the cache path for a certain key + + @param key The unique image cache key + @return The cache path. You can check `lastPathComponent` to grab the file name. + */ +- (nullable NSString *)cachePathForKey:(nullable NSString *)key; + +#pragma mark - Store Ops + +/** + * Asynchronously store an image into memory and disk cache at the given key. + * + * @param image The image to store + * @param key The unique image cache key, usually it's image absolute URL + * @param completionBlock A block executed after the operation is finished + */ +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Asynchronously store an image into memory and disk cache at the given key. + * + * @param image The image to store + * @param key The unique image cache key, usually it's image absolute URL + * @param toDisk Store the image to disk cache if YES. If NO, the completion block is called synchronously + * @param completionBlock A block executed after the operation is finished + * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG. + */ +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Asynchronously store an image into memory and disk cache at the given key. + * + * @param image The image to store + * @param imageData The image data as returned by the server, this representation will be used for disk storage + * instead of converting the given image object into a storable/compressed image format in order + * to save quality and CPU + * @param key The unique image cache key, usually it's image absolute URL + * @param toDisk Store the image to disk cache if YES. If NO, the completion block is called synchronously + * @param completionBlock A block executed after the operation is finished + * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG. + */ +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Synchronously store image into memory cache at the given key. + * + * @param image The image to store + * @param key The unique image cache key, usually it's image absolute URL + */ +- (void)storeImageToMemory:(nullable UIImage*)image + forKey:(nullable NSString *)key; + +/** + * Synchronously store image data into disk cache at the given key. + * + * @param imageData The image data to store + * @param key The unique image cache key, usually it's image absolute URL + */ +- (void)storeImageDataToDisk:(nullable NSData *)imageData + forKey:(nullable NSString *)key; + + +#pragma mark - Contains and Check Ops + +/** + * Asynchronously check if image exists in disk cache already (does not load the image) + * + * @param key the key describing the url + * @param completionBlock the block to be executed when the check is done. + * @note the completion block will be always executed on the main queue + */ +- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock; + +/** + * Synchronously check if image data exists in disk cache already (does not load the image) + * + * @param key the key describing the url + */ +- (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key; + +#pragma mark - Query and Retrieve Ops + +/** + * Synchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded. + * + * @param key The unique key used to store the wanted image + * @return The image data for the given key, or nil if not found. + */ +- (nullable NSData *)diskImageDataForKey:(nullable NSString *)key; + +/** + * Asynchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded. + * + * @param key The unique key used to store the wanted image + * @param completionBlock the block to be executed when the query is done. + * @note the completion block will be always executed on the main queue + */ +- (void)diskImageDataQueryForKey:(nullable NSString *)key completion:(nullable SDImageCacheQueryDataCompletionBlock)completionBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a NSOperation instance containing the cache op + */ +- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param options A mask to specify options to use for this cache query + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a NSOperation instance containing the cache op + */ +- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a NSOperation instance containing the cache op + */ +- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param queryCacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately. + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a NSOperation instance containing the cache op + */ +- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Synchronously query the memory cache. + * + * @param key The unique key used to store the image + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key; + +/** + * Synchronously query the disk cache. + * + * @param key The unique key used to store the image + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key; + +/** + * Synchronously query the disk cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc) + * + * @param key The unique key used to store the image + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context; + +/** + * Synchronously query the cache (memory and or disk) after checking the memory cache. + * + * @param key The unique key used to store the image + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key; + +/** + * Synchronously query the cache (memory and or disk) after checking the memory cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc) + * + * @param key The unique key used to store the image + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context;; + +#pragma mark - Remove Ops + +/** + * Asynchronously remove the image from memory and disk cache + * + * @param key The unique image cache key + * @param completion A block that should be executed after the image has been removed (optional) + */ +- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion; + +/** + * Asynchronously remove the image from memory and optionally disk cache + * + * @param key The unique image cache key + * @param fromDisk Also remove cache entry from disk if YES. If NO, the completion block is called synchronously + * @param completion A block that should be executed after the image has been removed (optional) + */ +- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion; + +/** + Synchronously remove the image from memory cache. + + @param key The unique image cache key + */ +- (void)removeImageFromMemoryForKey:(nullable NSString *)key; + +/** + Synchronously remove the image from disk cache. + + @param key The unique image cache key + */ +- (void)removeImageFromDiskForKey:(nullable NSString *)key; + +#pragma mark - Cache clean Ops + +/** + * Synchronously Clear all memory cached images + */ +- (void)clearMemory; + +/** + * Asynchronously clear all disk cached images. Non-blocking method - returns immediately. + * @param completion A block that should be executed after cache expiration completes (optional) + */ +- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion; + +/** + * Asynchronously remove all expired cached image from disk. Non-blocking method - returns immediately. + * @param completionBlock A block that should be executed after cache expiration completes (optional) + */ +- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock; + +#pragma mark - Cache Info + +/** + * Get the total bytes size of images in the disk cache + */ +- (NSUInteger)totalDiskSize; + +/** + * Get the number of images in the disk cache + */ +- (NSUInteger)totalDiskCount; + +/** + * Asynchronously calculate the disk cache's size. + */ +- (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock; + +@end + +/** + * SDImageCache is the built-in image cache implementation for web image manager. It adopts `SDImageCache` protocol to provide the function for web image manager to use for image loading process. + */ +@interface SDImageCache (SDImageCache) + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m new file mode 100644 index 0000000..7b18b1a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m @@ -0,0 +1,888 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCache.h" +#import "NSImage+Compatibility.h" +#import "SDImageCodersManager.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImage.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+Metadata.h" +#import "UIImage+ExtendedCacheData.h" + +static NSString * _defaultDiskCacheDirectory; + +@interface SDImageCache () + +#pragma mark - Properties +@property (nonatomic, strong, readwrite, nonnull) id memoryCache; +@property (nonatomic, strong, readwrite, nonnull) id diskCache; +@property (nonatomic, copy, readwrite, nonnull) SDImageCacheConfig *config; +@property (nonatomic, copy, readwrite, nonnull) NSString *diskCachePath; +@property (nonatomic, strong, nullable) dispatch_queue_t ioQueue; + +@end + + +@implementation SDImageCache + +#pragma mark - Singleton, init, dealloc + ++ (nonnull instancetype)sharedImageCache { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + ++ (NSString *)defaultDiskCacheDirectory { + if (!_defaultDiskCacheDirectory) { + _defaultDiskCacheDirectory = [[self userCacheDirectory] stringByAppendingPathComponent:@"com.hackemist.SDImageCache"]; + } + return _defaultDiskCacheDirectory; +} + ++ (void)setDefaultDiskCacheDirectory:(NSString *)defaultDiskCacheDirectory { + _defaultDiskCacheDirectory = [defaultDiskCacheDirectory copy]; +} + +- (instancetype)init { + return [self initWithNamespace:@"default"]; +} + +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns { + return [self initWithNamespace:ns diskCacheDirectory:nil]; +} + +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory { + return [self initWithNamespace:ns diskCacheDirectory:directory config:SDImageCacheConfig.defaultCacheConfig]; +} + +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory + config:(nullable SDImageCacheConfig *)config { + if ((self = [super init])) { + NSAssert(ns, @"Cache namespace should not be nil"); + + // Create IO serial queue + _ioQueue = dispatch_queue_create("com.hackemist.SDImageCache", DISPATCH_QUEUE_SERIAL); + + if (!config) { + config = SDImageCacheConfig.defaultCacheConfig; + } + _config = [config copy]; + + // Init the memory cache + NSAssert([config.memoryCacheClass conformsToProtocol:@protocol(SDMemoryCache)], @"Custom memory cache class must conform to `SDMemoryCache` protocol"); + _memoryCache = [[config.memoryCacheClass alloc] initWithConfig:_config]; + + // Init the disk cache + if (!directory) { + // Use default disk cache directory + directory = [self.class defaultDiskCacheDirectory]; + } + _diskCachePath = [directory stringByAppendingPathComponent:ns]; + + NSAssert([config.diskCacheClass conformsToProtocol:@protocol(SDDiskCache)], @"Custom disk cache class must conform to `SDDiskCache` protocol"); + _diskCache = [[config.diskCacheClass alloc] initWithCachePath:_diskCachePath config:_config]; + + // Check and migrate disk cache directory if need + [self migrateDiskCacheDirectory]; + +#if SD_UIKIT + // Subscribe to app events + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillTerminate:) + name:UIApplicationWillTerminateNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationDidEnterBackground:) + name:UIApplicationDidEnterBackgroundNotification + object:nil]; +#endif +#if SD_MAC + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillTerminate:) + name:NSApplicationWillTerminateNotification + object:nil]; +#endif + } + + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - Cache paths + +- (nullable NSString *)cachePathForKey:(nullable NSString *)key { + if (!key) { + return nil; + } + return [self.diskCache cachePathForKey:key]; +} + ++ (nullable NSString *)userCacheDirectory { + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + return paths.firstObject; +} + +- (void)migrateDiskCacheDirectory { + if ([self.diskCache isKindOfClass:[SDDiskCache class]]) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + // ~/Library/Caches/com.hackemist.SDImageCache/default/ + NSString *newDefaultPath = [[[self.class userCacheDirectory] stringByAppendingPathComponent:@"com.hackemist.SDImageCache"] stringByAppendingPathComponent:@"default"]; + // ~/Library/Caches/default/com.hackemist.SDWebImageCache.default/ + NSString *oldDefaultPath = [[[self.class userCacheDirectory] stringByAppendingPathComponent:@"default"] stringByAppendingPathComponent:@"com.hackemist.SDWebImageCache.default"]; + dispatch_async(self.ioQueue, ^{ + [((SDDiskCache *)self.diskCache) moveCacheDirectoryFromPath:oldDefaultPath toPath:newDefaultPath]; + }); + }); + } +} + +#pragma mark - Store Ops + +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + [self storeImage:image imageData:nil forKey:key toDisk:YES completion:completionBlock]; +} + +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + [self storeImage:image imageData:nil forKey:key toDisk:toDisk completion:completionBlock]; +} + +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + return [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:toDisk completion:completionBlock]; +} + +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + toMemory:(BOOL)toMemory + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + if (!image || !key) { + if (completionBlock) { + completionBlock(); + } + return; + } + // if memory cache is enabled + if (toMemory && self.config.shouldCacheImagesInMemory) { + NSUInteger cost = image.sd_memoryCost; + [self.memoryCache setObject:image forKey:key cost:cost]; + } + + if (toDisk) { + dispatch_async(self.ioQueue, ^{ + @autoreleasepool { + NSData *data = imageData; + if (!data && [image conformsToProtocol:@protocol(SDAnimatedImage)]) { + // If image is custom animated image class, prefer its original animated data + data = [((id)image) animatedImageData]; + } + if (!data && image) { + // Check image's associated image format, may return .undefined + SDImageFormat format = image.sd_imageFormat; + if (format == SDImageFormatUndefined) { + // If image is animated, use GIF (APNG may be better, but has bugs before macOS 10.14) + if (image.sd_isAnimated) { + format = SDImageFormatGIF; + } else { + // If we do not have any data to detect image format, check whether it contains alpha channel to use PNG or JPEG format + if ([SDImageCoderHelper CGImageContainsAlpha:image.CGImage]) { + format = SDImageFormatPNG; + } else { + format = SDImageFormatJPEG; + } + } + } + data = [[SDImageCodersManager sharedManager] encodedDataWithImage:image format:format options:nil]; + } + [self _storeImageDataToDisk:data forKey:key]; + if (image) { + // Check extended data + id extendedObject = image.sd_extendedObject; + if ([extendedObject conformsToProtocol:@protocol(NSCoding)]) { + NSData *extendedData; + if (@available(iOS 11, tvOS 11, macOS 10.13, watchOS 4, *)) { + NSError *error; + extendedData = [NSKeyedArchiver archivedDataWithRootObject:extendedObject requiringSecureCoding:NO error:&error]; + if (error) { + NSLog(@"NSKeyedArchiver archive failed with error: %@", error); + } + } else { + @try { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + extendedData = [NSKeyedArchiver archivedDataWithRootObject:extendedObject]; +#pragma clang diagnostic pop + } @catch (NSException *exception) { + NSLog(@"NSKeyedArchiver archive failed with exception: %@", exception); + } + } + if (extendedData) { + [self.diskCache setExtendedData:extendedData forKey:key]; + } + } + } + } + + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(); + }); + } + }); + } else { + if (completionBlock) { + completionBlock(); + } + } +} + +- (void)storeImageToMemory:(UIImage *)image forKey:(NSString *)key { + if (!image || !key) { + return; + } + NSUInteger cost = image.sd_memoryCost; + [self.memoryCache setObject:image forKey:key cost:cost]; +} + +- (void)storeImageDataToDisk:(nullable NSData *)imageData + forKey:(nullable NSString *)key { + if (!imageData || !key) { + return; + } + + dispatch_sync(self.ioQueue, ^{ + [self _storeImageDataToDisk:imageData forKey:key]; + }); +} + +// Make sure to call from io queue by caller +- (void)_storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key { + if (!imageData || !key) { + return; + } + + [self.diskCache setData:imageData forKey:key]; +} + +#pragma mark - Query and Retrieve Ops + +- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + BOOL exists = [self _diskImageDataExistsWithKey:key]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(exists); + }); + } + }); +} + +- (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key { + if (!key) { + return NO; + } + + __block BOOL exists = NO; + dispatch_sync(self.ioQueue, ^{ + exists = [self _diskImageDataExistsWithKey:key]; + }); + + return exists; +} + +// Make sure to call from io queue by caller +- (BOOL)_diskImageDataExistsWithKey:(nullable NSString *)key { + if (!key) { + return NO; + } + + return [self.diskCache containsDataForKey:key]; +} + +- (void)diskImageDataQueryForKey:(NSString *)key completion:(SDImageCacheQueryDataCompletionBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + NSData *imageData = [self diskImageDataBySearchingAllPathsForKey:key]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(imageData); + }); + } + }); +} + +- (nullable NSData *)diskImageDataForKey:(nullable NSString *)key { + if (!key) { + return nil; + } + __block NSData *imageData = nil; + dispatch_sync(self.ioQueue, ^{ + imageData = [self diskImageDataBySearchingAllPathsForKey:key]; + }); + + return imageData; +} + +- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key { + return [self.memoryCache objectForKey:key]; +} + +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key { + return [self imageFromDiskCacheForKey:key options:0 context:nil]; +} + +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context { + NSData *data = [self diskImageDataForKey:key]; + UIImage *diskImage = [self diskImageForKey:key data:data options:options context:context]; + if (diskImage && self.config.shouldCacheImagesInMemory) { + NSUInteger cost = diskImage.sd_memoryCost; + [self.memoryCache setObject:diskImage forKey:key cost:cost]; + } + + return diskImage; +} + +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key { + return [self imageFromCacheForKey:key options:0 context:nil]; +} + +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context { + // First check the in-memory cache... + UIImage *image = [self imageFromMemoryCacheForKey:key]; + if (image) { + return image; + } + + // Second check the disk cache... + image = [self imageFromDiskCacheForKey:key options:options context:context]; + return image; +} + +- (nullable NSData *)diskImageDataBySearchingAllPathsForKey:(nullable NSString *)key { + if (!key) { + return nil; + } + + NSData *data = [self.diskCache dataForKey:key]; + if (data) { + return data; + } + + // Addtional cache path for custom pre-load cache + if (self.additionalCachePathBlock) { + NSString *filePath = self.additionalCachePathBlock(key); + if (filePath) { + data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil]; + } + } + + return data; +} + +- (nullable UIImage *)diskImageForKey:(nullable NSString *)key { + NSData *data = [self diskImageDataForKey:key]; + return [self diskImageForKey:key data:data]; +} + +- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data { + return [self diskImageForKey:key data:data options:0 context:nil]; +} + +- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data options:(SDImageCacheOptions)options context:(SDWebImageContext *)context { + if (data) { + UIImage *image = SDImageCacheDecodeImageData(data, key, [[self class] imageOptionsFromCacheOptions:options], context); + if (image) { + // Check extended data + NSData *extendedData = [self.diskCache extendedDataForKey:key]; + if (extendedData) { + id extendedObject; + if (@available(iOS 11, tvOS 11, macOS 10.13, watchOS 4, *)) { + NSError *error; + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:extendedData error:&error]; + unarchiver.requiresSecureCoding = NO; + extendedObject = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error]; + if (error) { + NSLog(@"NSKeyedUnarchiver unarchive failed with error: %@", error); + } + } else { + @try { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + extendedObject = [NSKeyedUnarchiver unarchiveObjectWithData:extendedData]; +#pragma clang diagnostic pop + } @catch (NSException *exception) { + NSLog(@"NSKeyedUnarchiver unarchive failed with exception: %@", exception); + } + } + image.sd_extendedObject = extendedObject; + } + } + return image; + } else { + return nil; + } +} + +- (nullable NSOperation *)queryCacheOperationForKey:(NSString *)key done:(SDImageCacheQueryCompletionBlock)doneBlock { + return [self queryCacheOperationForKey:key options:0 done:doneBlock]; +} + +- (nullable NSOperation *)queryCacheOperationForKey:(NSString *)key options:(SDImageCacheOptions)options done:(SDImageCacheQueryCompletionBlock)doneBlock { + return [self queryCacheOperationForKey:key options:options context:nil done:doneBlock]; +} + +- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock { + return [self queryCacheOperationForKey:key options:options context:context cacheType:SDImageCacheTypeAll done:doneBlock]; +} + +- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock { + if (!key) { + if (doneBlock) { + doneBlock(nil, nil, SDImageCacheTypeNone); + } + return nil; + } + // Invalid cache type + if (queryCacheType == SDImageCacheTypeNone) { + if (doneBlock) { + doneBlock(nil, nil, SDImageCacheTypeNone); + } + return nil; + } + + // First check the in-memory cache... + UIImage *image; + if (queryCacheType != SDImageCacheTypeDisk) { + image = [self imageFromMemoryCacheForKey:key]; + } + + if (image) { + if (options & SDImageCacheDecodeFirstFrameOnly) { + // Ensure static image + Class animatedImageClass = image.class; + if (image.sd_isAnimated || ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)])) { +#if SD_MAC + image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; +#endif + } + } else if (options & SDImageCacheMatchAnimatedImageClass) { + // Check image class matching + Class animatedImageClass = image.class; + Class desiredImageClass = context[SDWebImageContextAnimatedImageClass]; + if (desiredImageClass && ![animatedImageClass isSubclassOfClass:desiredImageClass]) { + image = nil; + } + } + } + + BOOL shouldQueryMemoryOnly = (queryCacheType == SDImageCacheTypeMemory) || (image && !(options & SDImageCacheQueryMemoryData)); + if (shouldQueryMemoryOnly) { + if (doneBlock) { + doneBlock(image, nil, SDImageCacheTypeMemory); + } + return nil; + } + + // Second check the disk cache... + NSOperation *operation = [NSOperation new]; + // Check whether we need to synchronously query disk + // 1. in-memory cache hit & memoryDataSync + // 2. in-memory cache miss & diskDataSync + BOOL shouldQueryDiskSync = ((image && options & SDImageCacheQueryMemoryDataSync) || + (!image && options & SDImageCacheQueryDiskDataSync)); + void(^queryDiskBlock)(void) = ^{ + if (operation.isCancelled) { + if (doneBlock) { + doneBlock(nil, nil, SDImageCacheTypeNone); + } + return; + } + + @autoreleasepool { + NSData *diskData = [self diskImageDataBySearchingAllPathsForKey:key]; + UIImage *diskImage; + if (image) { + // the image is from in-memory cache, but need image data + diskImage = image; + } else if (diskData) { + // decode image data only if in-memory cache missed + diskImage = [self diskImageForKey:key data:diskData options:options context:context]; + if (diskImage && self.config.shouldCacheImagesInMemory) { + NSUInteger cost = diskImage.sd_memoryCost; + [self.memoryCache setObject:diskImage forKey:key cost:cost]; + } + } + + if (doneBlock) { + if (shouldQueryDiskSync) { + doneBlock(diskImage, diskData, SDImageCacheTypeDisk); + } else { + dispatch_async(dispatch_get_main_queue(), ^{ + doneBlock(diskImage, diskData, SDImageCacheTypeDisk); + }); + } + } + } + }; + + // Query in ioQueue to keep IO-safe + if (shouldQueryDiskSync) { + dispatch_sync(self.ioQueue, queryDiskBlock); + } else { + dispatch_async(self.ioQueue, queryDiskBlock); + } + + return operation; +} + +#pragma mark - Remove Ops + +- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion { + [self removeImageForKey:key fromDisk:YES withCompletion:completion]; +} + +- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion { + [self removeImageForKey:key fromMemory:YES fromDisk:fromDisk withCompletion:completion]; +} + +- (void)removeImageForKey:(nullable NSString *)key fromMemory:(BOOL)fromMemory fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion { + if (key == nil) { + return; + } + + if (fromMemory && self.config.shouldCacheImagesInMemory) { + [self.memoryCache removeObjectForKey:key]; + } + + if (fromDisk) { + dispatch_async(self.ioQueue, ^{ + [self.diskCache removeDataForKey:key]; + + if (completion) { + dispatch_async(dispatch_get_main_queue(), ^{ + completion(); + }); + } + }); + } else if (completion) { + completion(); + } +} + +- (void)removeImageFromMemoryForKey:(NSString *)key { + if (!key) { + return; + } + + [self.memoryCache removeObjectForKey:key]; +} + +- (void)removeImageFromDiskForKey:(NSString *)key { + if (!key) { + return; + } + dispatch_sync(self.ioQueue, ^{ + [self _removeImageFromDiskForKey:key]; + }); +} + +// Make sure to call from io queue by caller +- (void)_removeImageFromDiskForKey:(NSString *)key { + if (!key) { + return; + } + + [self.diskCache removeDataForKey:key]; +} + +#pragma mark - Cache clean Ops + +- (void)clearMemory { + [self.memoryCache removeAllObjects]; +} + +- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion { + dispatch_async(self.ioQueue, ^{ + [self.diskCache removeAllData]; + if (completion) { + dispatch_async(dispatch_get_main_queue(), ^{ + completion(); + }); + } + }); +} + +- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + [self.diskCache removeExpiredData]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(); + }); + } + }); +} + +#pragma mark - UIApplicationWillTerminateNotification + +#if SD_UIKIT || SD_MAC +- (void)applicationWillTerminate:(NSNotification *)notification { + [self deleteOldFilesWithCompletionBlock:nil]; +} +#endif + +#pragma mark - UIApplicationDidEnterBackgroundNotification + +#if SD_UIKIT +- (void)applicationDidEnterBackground:(NSNotification *)notification { + if (!self.config.shouldRemoveExpiredDataWhenEnterBackground) { + return; + } + Class UIApplicationClass = NSClassFromString(@"UIApplication"); + if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { + return; + } + UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)]; + __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{ + // Clean up any unfinished task business by marking where you + // stopped or ending the task outright. + [application endBackgroundTask:bgTask]; + bgTask = UIBackgroundTaskInvalid; + }]; + + // Start the long-running task and return immediately. + [self deleteOldFilesWithCompletionBlock:^{ + [application endBackgroundTask:bgTask]; + bgTask = UIBackgroundTaskInvalid; + }]; +} +#endif + +#pragma mark - Cache Info + +- (NSUInteger)totalDiskSize { + __block NSUInteger size = 0; + dispatch_sync(self.ioQueue, ^{ + size = [self.diskCache totalSize]; + }); + return size; +} + +- (NSUInteger)totalDiskCount { + __block NSUInteger count = 0; + dispatch_sync(self.ioQueue, ^{ + count = [self.diskCache totalCount]; + }); + return count; +} + +- (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + NSUInteger fileCount = [self.diskCache totalCount]; + NSUInteger totalSize = [self.diskCache totalSize]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(fileCount, totalSize); + }); + } + }); +} + +#pragma mark - Helper ++ (SDWebImageOptions)imageOptionsFromCacheOptions:(SDImageCacheOptions)cacheOptions { + SDWebImageOptions options = 0; + if (cacheOptions & SDImageCacheScaleDownLargeImages) options |= SDWebImageScaleDownLargeImages; + if (cacheOptions & SDImageCacheDecodeFirstFrameOnly) options |= SDWebImageDecodeFirstFrameOnly; + if (cacheOptions & SDImageCachePreloadAllFrames) options |= SDWebImagePreloadAllFrames; + if (cacheOptions & SDImageCacheAvoidDecodeImage) options |= SDWebImageAvoidDecodeImage; + if (cacheOptions & SDImageCacheMatchAnimatedImageClass) options |= SDWebImageMatchAnimatedImageClass; + + return options; +} + +@end + +@implementation SDImageCache (SDImageCache) + +#pragma mark - SDImageCache + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock { + return [self queryImageForKey:key options:options context:context cacheType:SDImageCacheTypeAll completion:completionBlock]; +} + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)cacheType completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock { + SDImageCacheOptions cacheOptions = 0; + if (options & SDWebImageQueryMemoryData) cacheOptions |= SDImageCacheQueryMemoryData; + if (options & SDWebImageQueryMemoryDataSync) cacheOptions |= SDImageCacheQueryMemoryDataSync; + if (options & SDWebImageQueryDiskDataSync) cacheOptions |= SDImageCacheQueryDiskDataSync; + if (options & SDWebImageScaleDownLargeImages) cacheOptions |= SDImageCacheScaleDownLargeImages; + if (options & SDWebImageAvoidDecodeImage) cacheOptions |= SDImageCacheAvoidDecodeImage; + if (options & SDWebImageDecodeFirstFrameOnly) cacheOptions |= SDImageCacheDecodeFirstFrameOnly; + if (options & SDWebImagePreloadAllFrames) cacheOptions |= SDImageCachePreloadAllFrames; + if (options & SDWebImageMatchAnimatedImageClass) cacheOptions |= SDImageCacheMatchAnimatedImageClass; + + return [self queryCacheOperationForKey:key options:cacheOptions context:context cacheType:cacheType done:completionBlock]; +} + +- (void)storeImage:(UIImage *)image imageData:(NSData *)imageData forKey:(nullable NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDWebImageNoParamsBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + [self storeImage:image imageData:imageData forKey:key toMemory:NO toDisk:NO completion:completionBlock]; + } + break; + case SDImageCacheTypeMemory: { + [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:NO completion:completionBlock]; + } + break; + case SDImageCacheTypeDisk: { + [self storeImage:image imageData:imageData forKey:key toMemory:NO toDisk:YES completion:completionBlock]; + } + break; + case SDImageCacheTypeAll: { + [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:YES completion:completionBlock]; + } + break; + default: { + if (completionBlock) { + completionBlock(); + } + } + break; + } +} + +- (void)removeImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDWebImageNoParamsBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + [self removeImageForKey:key fromMemory:NO fromDisk:NO withCompletion:completionBlock]; + } + break; + case SDImageCacheTypeMemory: { + [self removeImageForKey:key fromMemory:YES fromDisk:NO withCompletion:completionBlock]; + } + break; + case SDImageCacheTypeDisk: { + [self removeImageForKey:key fromMemory:NO fromDisk:YES withCompletion:completionBlock]; + } + break; + case SDImageCacheTypeAll: { + [self removeImageForKey:key fromMemory:YES fromDisk:YES withCompletion:completionBlock]; + } + break; + default: { + if (completionBlock) { + completionBlock(); + } + } + break; + } +} + +- (void)containsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + } + break; + case SDImageCacheTypeMemory: { + BOOL isInMemoryCache = ([self imageFromMemoryCacheForKey:key] != nil); + if (completionBlock) { + completionBlock(isInMemoryCache ? SDImageCacheTypeMemory : SDImageCacheTypeNone); + } + } + break; + case SDImageCacheTypeDisk: { + [self diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) { + if (completionBlock) { + completionBlock(isInDiskCache ? SDImageCacheTypeDisk : SDImageCacheTypeNone); + } + }]; + } + break; + case SDImageCacheTypeAll: { + BOOL isInMemoryCache = ([self imageFromMemoryCacheForKey:key] != nil); + if (isInMemoryCache) { + if (completionBlock) { + completionBlock(SDImageCacheTypeMemory); + } + return; + } + [self diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) { + if (completionBlock) { + completionBlock(isInDiskCache ? SDImageCacheTypeDisk : SDImageCacheTypeNone); + } + }]; + } + break; + default: + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + break; + } +} + +- (void)clearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + if (completionBlock) { + completionBlock(); + } + } + break; + case SDImageCacheTypeMemory: { + [self clearMemory]; + if (completionBlock) { + completionBlock(); + } + } + break; + case SDImageCacheTypeDisk: { + [self clearDiskOnCompletion:completionBlock]; + } + break; + case SDImageCacheTypeAll: { + [self clearMemory]; + [self clearDiskOnCompletion:completionBlock]; + } + break; + default: { + if (completionBlock) { + completionBlock(); + } + } + break; + } +} + +@end + diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h new file mode 100644 index 0000000..4d6e79b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h @@ -0,0 +1,137 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// Image Cache Expire Type +typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) { + /** + * When the image cache is accessed it will update this value + */ + SDImageCacheConfigExpireTypeAccessDate, + /** + * When the image cache is created or modified it will update this value (Default) + */ + SDImageCacheConfigExpireTypeModificationDate, + /** + * When the image cache is created it will update this value + */ + SDImageCacheConfigExpireTypeCreationDate, + /** + * When the image cache is created, modified, renamed, file attribute updated (like permission, xattr) it will update this value + */ + SDImageCacheConfigExpireTypeChangeDate, +}; + +/** + The class contains all the config for image cache + @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well. + */ +@interface SDImageCacheConfig : NSObject + +/** + Gets the default cache config used for shared instance or initialization when it does not provide any cache config. Such as `SDImageCache.sharedImageCache`. + @note You can modify the property on default cache config, which can be used for later created cache instance. The already created cache instance does not get affected. + */ +@property (nonatomic, class, readonly, nonnull) SDImageCacheConfig *defaultCacheConfig; + +/** + * Whether or not to disable iCloud backup + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldDisableiCloud; + +/** + * Whether or not to use memory cache + * @note When the memory cache is disabled, the weak memory cache will also be disabled. + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldCacheImagesInMemory; + +/* + * The option to control weak memory cache for images. When enable, `SDImageCache`'s memory cache will use a weak maptable to store the image at the same time when it stored to memory, and get removed at the same time. + * However when memory warning is triggered, since the weak maptable does not hold a strong reference to image instance, even when the memory cache itself is purged, some images which are held strongly by UIImageViews or other live instances can be recovered again, to avoid later re-query from disk cache or network. This may be helpful for the case, for example, when app enter background and memory is purged, cause cell flashing after re-enter foreground. + * Defaults to YES. You can change this option dynamically. + */ +@property (assign, nonatomic) BOOL shouldUseWeakMemoryCache; + +/** + * Whether or not to remove the expired disk data when application entering the background. (Not works for macOS) + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldRemoveExpiredDataWhenEnterBackground; + +/** + * The reading options while reading cache from disk. + * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance. + */ +@property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions; + +/** + * The writing options while writing cache to disk. + * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file. + */ +@property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions; + +/** + * The maximum length of time to keep an image in the disk cache, in seconds. + * Setting this to a negative value means no expiring. + * Setting this to zero means that all cached files would be removed when do expiration check. + * Defaults to 1 week. + */ +@property (assign, nonatomic) NSTimeInterval maxDiskAge; + +/** + * The maximum size of the disk cache, in bytes. + * Defaults to 0. Which means there is no cache size limit. + */ +@property (assign, nonatomic) NSUInteger maxDiskSize; + +/** + * The maximum "total cost" of the in-memory image cache. The cost function is the bytes size held in memory. + * @note The memory cost is bytes size in memory, but not simple pixels count. For common ARGB8888 image, one pixel is 4 bytes (32 bits). + * Defaults to 0. Which means there is no memory cost limit. + */ +@property (assign, nonatomic) NSUInteger maxMemoryCost; + +/** + * The maximum number of objects in-memory image cache should hold. + * Defaults to 0. Which means there is no memory count limit. + */ +@property (assign, nonatomic) NSUInteger maxMemoryCount; + +/* + * The attribute which the clear cache will be checked against when clearing the disk cache + * Default is Modified Date + */ +@property (assign, nonatomic) SDImageCacheConfigExpireType diskCacheExpireType; + +/** + * The custom file manager for disk cache. Pass nil to let disk cache choose the proper file manager. + * Defaults to nil. + * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect. + * @note Since `NSFileManager` does not support `NSCopying`. We just pass this by reference during copying. So it's not recommend to set this value on `defaultCacheConfig`. + */ +@property (strong, nonatomic, nullable) NSFileManager *fileManager; + +/** + * The custom memory cache class. Provided class instance must conform to `SDMemoryCache` protocol to allow usage. + * Defaults to built-in `SDMemoryCache` class. + * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect. + */ +@property (assign, nonatomic, nonnull) Class memoryCacheClass; + +/** + * The custom disk cache class. Provided class instance must conform to `SDDiskCache` protocol to allow usage. + * Defaults to built-in `SDDiskCache` class. + * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect. + */ +@property (assign ,nonatomic, nonnull) Class diskCacheClass; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m new file mode 100644 index 0000000..40a5334 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m @@ -0,0 +1,63 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCacheConfig.h" +#import "SDMemoryCache.h" +#import "SDDiskCache.h" + +static SDImageCacheConfig *_defaultCacheConfig; +static const NSInteger kDefaultCacheMaxDiskAge = 60 * 60 * 24 * 7; // 1 week + +@implementation SDImageCacheConfig + ++ (SDImageCacheConfig *)defaultCacheConfig { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _defaultCacheConfig = [SDImageCacheConfig new]; + }); + return _defaultCacheConfig; +} + +- (instancetype)init { + if (self = [super init]) { + _shouldDisableiCloud = YES; + _shouldCacheImagesInMemory = YES; + _shouldUseWeakMemoryCache = YES; + _shouldRemoveExpiredDataWhenEnterBackground = YES; + _diskCacheReadingOptions = 0; + _diskCacheWritingOptions = NSDataWritingAtomic; + _maxDiskAge = kDefaultCacheMaxDiskAge; + _maxDiskSize = 0; + _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate; + _memoryCacheClass = [SDMemoryCache class]; + _diskCacheClass = [SDDiskCache class]; + } + return self; +} + +- (id)copyWithZone:(NSZone *)zone { + SDImageCacheConfig *config = [[[self class] allocWithZone:zone] init]; + config.shouldDisableiCloud = self.shouldDisableiCloud; + config.shouldCacheImagesInMemory = self.shouldCacheImagesInMemory; + config.shouldUseWeakMemoryCache = self.shouldUseWeakMemoryCache; + config.shouldRemoveExpiredDataWhenEnterBackground = self.shouldRemoveExpiredDataWhenEnterBackground; + config.diskCacheReadingOptions = self.diskCacheReadingOptions; + config.diskCacheWritingOptions = self.diskCacheWritingOptions; + config.maxDiskAge = self.maxDiskAge; + config.maxDiskSize = self.maxDiskSize; + config.maxMemoryCost = self.maxMemoryCost; + config.maxMemoryCount = self.maxMemoryCount; + config.diskCacheExpireType = self.diskCacheExpireType; + config.fileManager = self.fileManager; // NSFileManager does not conform to NSCopying, just pass the reference + config.memoryCacheClass = self.memoryCacheClass; + config.diskCacheClass = self.diskCacheClass; + + return config; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h new file mode 100644 index 0000000..48f7b5c --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h @@ -0,0 +1,143 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageOperation.h" +#import "SDWebImageDefine.h" + +/// Image Cache Type +typedef NS_ENUM(NSInteger, SDImageCacheType) { + /** + * For query and contains op in response, means the image isn't available in the image cache + * For op in request, this type is not available and take no effect. + */ + SDImageCacheTypeNone, + /** + * For query and contains op in response, means the image was obtained from the disk cache. + * For op in request, means process only disk cache. + */ + SDImageCacheTypeDisk, + /** + * For query and contains op in response, means the image was obtained from the memory cache. + * For op in request, means process only memory cache. + */ + SDImageCacheTypeMemory, + /** + * For query and contains op in response, this type is not available and take no effect. + * For op in request, means process both memory cache and disk cache. + */ + SDImageCacheTypeAll +}; + +typedef void(^SDImageCacheCheckCompletionBlock)(BOOL isInCache); +typedef void(^SDImageCacheQueryDataCompletionBlock)(NSData * _Nullable data); +typedef void(^SDImageCacheCalculateSizeBlock)(NSUInteger fileCount, NSUInteger totalSize); +typedef NSString * _Nullable (^SDImageCacheAdditionalCachePathBlock)(NSString * _Nonnull key); +typedef void(^SDImageCacheQueryCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); +typedef void(^SDImageCacheContainsCompletionBlock)(SDImageCacheType containsCacheType); + +/** + This is the built-in decoding process for image query from cache. + @note If you want to implement your custom loader with `queryImageForKey:options:context:completion:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image. + + @param imageData The image data from the cache. Should not be nil + @param cacheKey The image cache key from the input. Should not be nil + @param options The options arg from the input + @param context The context arg from the input + @return The decoded image for current image data query from cache + */ +FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/** + This is the image cache protocol to provide custom image cache for `SDWebImageManager`. + Though the best practice to custom image cache, is to write your own class which conform `SDMemoryCache` or `SDDiskCache` protocol for `SDImageCache` class (See more on `SDImageCacheConfig.memoryCacheClass & SDImageCacheConfig.diskCacheClass`). + However, if your own cache implementation contains more advanced feature beyond `SDImageCache` itself, you can consider to provide this instead. For example, you can even use a cache manager like `SDImageCachesManager` to register multiple caches. + */ +@protocol SDImageCache + +@required +/** + Query the cached image from image cache for given key. The operation can be used to cancel the query. + If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`) + + @param key The image cache key + @param options A mask to specify options to use for this query + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @param completionBlock The completion block. Will not get called if the operation is cancelled + @return The operation for this query + */ +- (nullable id)queryImageForKey:(nullable NSString *)key + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock; + +/** + Query the cached image from image cache for given key. The operation can be used to cancel the query. + If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`) + + @param key The image cache key + @param options A mask to specify options to use for this query + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @param cacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately. + @param completionBlock The completion block. Will not get called if the operation is cancelled + @return The operation for this query + */ +- (nullable id)queryImageForKey:(nullable NSString *)key + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock; + +/** + Store the image into image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously. + + @param image The image to store + @param imageData The image data to be used for disk storage + @param key The image cache key + @param cacheType The image store op cache type + @param completionBlock A block executed after the operation is finished + */ +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + Remove the image from image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously. + + @param key The image cache key + @param cacheType The image remove op cache type + @param completionBlock A block executed after the operation is finished + */ +- (void)removeImageForKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + Check if image cache contains the image for the given key (does not load the image). If image is cached in memory, completion is called synchronously, else asynchronously. + + @param key The image cache key + @param cacheType The image contains op cache type + @param completionBlock A block executed after the operation is finished. + */ +- (void)containsImageForKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock; + +/** + Clear all the cached images for image cache. If cache type is memory only, completion is called synchronously, else asynchronously. + + @param cacheType The image clear op cache type + @param completionBlock A block executed after the operation is finished + */ +- (void)clearWithCacheType:(SDImageCacheType)cacheType + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m new file mode 100644 index 0000000..19db161 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m @@ -0,0 +1,85 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCacheDefine.h" +#import "SDImageCodersManager.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImage.h" +#import "UIImage+Metadata.h" +#import "SDInternalMacros.h" + +UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + UIImage *image; + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; + CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + NSValue *thumbnailSizeValue; + BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages); + if (shouldScaleDown) { + CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4; + CGFloat dimension = ceil(sqrt(thumbnailPixels)); + thumbnailSizeValue = @(CGSizeMake(dimension, dimension)); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + } + + SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2]; + mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame); + mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale); + mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue; + mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue; + mutableCoderOptions[SDImageCoderWebImageContext] = context; + SDImageCoderOptions *coderOptions = [mutableCoderOptions copy]; + + // Grab the image coder + id imageCoder; + if ([context[SDWebImageContextImageCoder] conformsToProtocol:@protocol(SDImageCoder)]) { + imageCoder = context[SDWebImageContextImageCoder]; + } else { + imageCoder = [SDImageCodersManager sharedManager]; + } + + if (!decodeFirstFrame) { + Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; + // check whether we should use `SDAnimatedImage` + if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) { + image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions]; + if (image) { + // Preload frames if supported + if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) { + [((id)image) preloadAllFrames]; + } + } else { + // Check image class matching + if (options & SDWebImageMatchAnimatedImageClass) { + return nil; + } + } + } + } + if (!image) { + image = [imageCoder decodedImageWithData:imageData options:coderOptions]; + } + if (image) { + BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage); + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + // `SDAnimatedImage` do not decode + shouldDecode = NO; + } else if (image.sd_isAnimated) { + // animated image do not decode + shouldDecode = NO; + } + if (shouldDecode) { + image = [SDImageCoderHelper decodedImageWithImage:image]; + } + } + + return image; +} diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h new file mode 100644 index 0000000..ad85db8 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h @@ -0,0 +1,81 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageCacheDefine.h" + +/// Policy for cache operation +typedef NS_ENUM(NSUInteger, SDImageCachesManagerOperationPolicy) { + SDImageCachesManagerOperationPolicySerial, // process all caches serially (from the highest priority to the lowest priority cache by order) + SDImageCachesManagerOperationPolicyConcurrent, // process all caches concurrently + SDImageCachesManagerOperationPolicyHighestOnly, // process the highest priority cache only + SDImageCachesManagerOperationPolicyLowestOnly // process the lowest priority cache only +}; + +/** + A caches manager to manage multiple caches. + */ +@interface SDImageCachesManager : NSObject + +/** + Returns the global shared caches manager instance. By default we will set [`SDImageCache.sharedImageCache`] into the caches array. + */ +@property (nonatomic, class, readonly, nonnull) SDImageCachesManager *sharedManager; + +// These are op policy for cache manager. + +/** + Operation policy for query op. + Defaults to `Serial`, means query all caches serially (one completion called then next begin) until one cache query success (`image` != nil). + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy queryOperationPolicy; + +/** + Operation policy for store op. + Defaults to `HighestOnly`, means store to the highest priority cache only. + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy storeOperationPolicy; + +/** + Operation policy for remove op. + Defaults to `Concurrent`, means remove all caches concurrently. + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy removeOperationPolicy; + +/** + Operation policy for contains op. + Defaults to `Serial`, means check all caches serially (one completion called then next begin) until one cache check success (`containsCacheType` != None). + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy containsOperationPolicy; + +/** + Operation policy for clear op. + Defaults to `Concurrent`, means clear all caches concurrently. + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy clearOperationPolicy; + +/** + All caches in caches manager. The caches array is a priority queue, which means the later added cache will have the highest priority + */ +@property (nonatomic, copy, nullable) NSArray> *caches; + +/** + Add a new cache to the end of caches array. Which has the highest priority. + + @param cache cache + */ +- (void)addCache:(nonnull id)cache; + +/** + Remove a cache in the caches array. + + @param cache cache + */ +- (void)removeCache:(nonnull id)cache; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m new file mode 100644 index 0000000..b6b13c1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m @@ -0,0 +1,557 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCachesManager.h" +#import "SDImageCachesManagerOperation.h" +#import "SDImageCache.h" +#import "SDInternalMacros.h" + +@interface SDImageCachesManager () + +@property (nonatomic, strong, nonnull) dispatch_semaphore_t cachesLock; + +@end + +@implementation SDImageCachesManager +{ + NSMutableArray> *_imageCaches; +} + ++ (SDImageCachesManager *)sharedManager { + static dispatch_once_t onceToken; + static SDImageCachesManager *manager; + dispatch_once(&onceToken, ^{ + manager = [[SDImageCachesManager alloc] init]; + }); + return manager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + self.queryOperationPolicy = SDImageCachesManagerOperationPolicySerial; + self.storeOperationPolicy = SDImageCachesManagerOperationPolicyHighestOnly; + self.removeOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent; + self.containsOperationPolicy = SDImageCachesManagerOperationPolicySerial; + self.clearOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent; + // initialize with default image caches + _imageCaches = [NSMutableArray arrayWithObject:[SDImageCache sharedImageCache]]; + _cachesLock = dispatch_semaphore_create(1); + } + return self; +} + +- (NSArray> *)caches { + SD_LOCK(self.cachesLock); + NSArray> *caches = [_imageCaches copy]; + SD_UNLOCK(self.cachesLock); + return caches; +} + +- (void)setCaches:(NSArray> *)caches { + SD_LOCK(self.cachesLock); + [_imageCaches removeAllObjects]; + if (caches.count) { + [_imageCaches addObjectsFromArray:caches]; + } + SD_UNLOCK(self.cachesLock); +} + +#pragma mark - Cache IO operations + +- (void)addCache:(id)cache { + if (![cache conformsToProtocol:@protocol(SDImageCache)]) { + return; + } + SD_LOCK(self.cachesLock); + [_imageCaches addObject:cache]; + SD_UNLOCK(self.cachesLock); +} + +- (void)removeCache:(id)cache { + if (![cache conformsToProtocol:@protocol(SDImageCache)]) { + return; + } + SD_LOCK(self.cachesLock); + [_imageCaches removeObject:cache]; + SD_UNLOCK(self.cachesLock); +} + +#pragma mark - SDImageCache + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context completion:(SDImageCacheQueryCompletionBlock)completionBlock { + return [self queryImageForKey:key options:options context:context cacheType:SDImageCacheTypeAll completion:completionBlock]; +} + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock { + if (!key) { + return nil; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return nil; + } else if (count == 1) { + return [caches.firstObject queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock]; + } + switch (self.queryOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + return [cache queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + return [cache queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentQueryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + return operation; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self serialQueryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + return operation; + } + break; + default: + return nil; + break; + } +} + +- (void)storeImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + if (!key) { + return; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock]; + return; + } + switch (self.storeOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + [self serialStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator]; + } + break; + default: + break; + } +} + +- (void)removeImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + if (!key) { + return; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject removeImageForKey:key cacheType:cacheType completion:completionBlock]; + return; + } + switch (self.removeOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache removeImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache removeImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + [self serialRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator]; + } + break; + default: + break; + } +} + +- (void)containsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock { + if (!key) { + return; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject containsImageForKey:key cacheType:cacheType completion:completionBlock]; + return; + } + switch (self.clearOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache containsImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache containsImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self serialContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + default: + break; + } +} + +- (void)clearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject clearWithCacheType:cacheType completion:completionBlock]; + return; + } + switch (self.clearOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache clearWithCacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache clearWithCacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentClearWithCacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + [self serialClearWithCacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator]; + } + break; + default: + break; + } +} + +#pragma mark - Concurrent Operation + +- (void)concurrentQueryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (image) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(image, data, cacheType); + } + return; + } + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(nil, nil, SDImageCacheTypeNone); + } + } + }]; + } +} + +- (void)concurrentStoreImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:^{ + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(); + } + } + }]; + } +} + +- (void)concurrentRemoveImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache removeImageForKey:key cacheType:cacheType completion:^{ + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(); + } + } + }]; + } +} + +- (void)concurrentContainsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache containsImageForKey:key cacheType:cacheType completion:^(SDImageCacheType containsCacheType) { + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (containsCacheType != SDImageCacheTypeNone) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(containsCacheType); + } + return; + } + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + } + }]; + } +} + +- (void)concurrentClearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache clearWithCacheType:cacheType completion:^{ + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(); + } + } + }]; + } +} + +#pragma mark - Serial Operation + +- (void)serialQueryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(nil, nil, SDImageCacheTypeNone); + } + return; + } + @weakify(self); + [cache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { + @strongify(self); + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (image) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(image, data, cacheType); + } + return; + } + // Next + [self serialQueryImageForKey:key options:options context:context cacheType:queryCacheType completion:completionBlock enumerator:enumerator operation:operation]; + }]; +} + +- (void)serialStoreImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator { + NSParameterAssert(enumerator); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + if (completionBlock) { + completionBlock(); + } + return; + } + @weakify(self); + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:^{ + @strongify(self); + // Next + [self serialStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator]; + }]; +} + +- (void)serialRemoveImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator { + NSParameterAssert(enumerator); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + if (completionBlock) { + completionBlock(); + } + return; + } + @weakify(self); + [cache removeImageForKey:key cacheType:cacheType completion:^{ + @strongify(self); + // Next + [self serialRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator]; + }]; +} + +- (void)serialContainsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + return; + } + @weakify(self); + [cache containsImageForKey:key cacheType:cacheType completion:^(SDImageCacheType containsCacheType) { + @strongify(self); + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (containsCacheType != SDImageCacheTypeNone) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(containsCacheType); + } + return; + } + // Next + [self serialContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator operation:operation]; + }]; +} + +- (void)serialClearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator { + NSParameterAssert(enumerator); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + if (completionBlock) { + completionBlock(); + } + return; + } + @weakify(self); + [cache clearWithCacheType:cacheType completion:^{ + @strongify(self); + // Next + [self serialClearWithCacheType:cacheType completion:completionBlock enumerator:enumerator]; + }]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h new file mode 100644 index 0000000..f7f6383 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h @@ -0,0 +1,266 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "NSData+ImageContentType.h" + +typedef NSString * SDImageCoderOption NS_STRING_ENUM; +typedef NSDictionary SDImageCoderOptions; +typedef NSMutableDictionary SDImageCoderMutableOptions; + +#pragma mark - Coder Options +// These options are for image decoding +/** + A Boolean value indicating whether to decode the first frame only for animated image during decoding. (NSNumber). If not provide, decode animated image if need. + @note works for `SDImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeFirstFrameOnly; + +/** + A CGFloat value which is greater than or equal to 1.0. This value specify the image scale factor for decoding. If not provide, use 1.0. (NSNumber) + @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeScaleFactor; + +/** + A Boolean value indicating whether to keep the original aspect ratio when generating thumbnail images (or bitmap images from vector format). + Defaults to YES. + @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodePreserveAspectRatio; + +/** + A CGSize value indicating whether or not to generate the thumbnail images (or bitmap images from vector format). When this value is provided, the decoder will generate a thumbnail image which pixel size is smaller than or equal to (depends the `.preserveAspectRatio`) the value size. + Defaults to CGSizeZero, which means no thumbnail generation at all. + @note Supports for animated image as well. + @note When you pass `.preserveAspectRatio == NO`, the thumbnail image is stretched to match each dimension. When `.preserveAspectRatio == YES`, the thumbnail image's width is limited to pixel size's width, the thumbnail image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both. + @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeThumbnailPixelSize; + + +// These options are for image encoding +/** + A Boolean value indicating whether to encode the first frame only for animated image during encoding. (NSNumber). If not provide, encode animated image if need. + @note works for `SDImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeFirstFrameOnly; +/** + A double value between 0.0-1.0 indicating the encode compression quality to produce the image data. 1.0 resulting in no compression and 0.0 resulting in the maximum compression possible. If not provide, use 1.0. (NSNumber) + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeCompressionQuality; + +/** + A UIColor(NSColor) value to used for non-alpha image encoding when the input image has alpha channel, the background color will be used to compose the alpha one. If not provide, use white color. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeBackgroundColor; + +/** + A CGSize value indicating the max image resolution in pixels during encoding. For vector image, this also effect the output vector data information about width and height. The encoder will not generate the encoded image larger than this limit. Note it always use the aspect ratio of input image.. + Defaults to CGSizeZero, which means no max size limit at all. + @note Supports for animated image as well. + @note The output image's width is limited to pixel size's width, the output image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxPixelSize; + +/** + A NSUInteger value specify the max output data bytes size after encoding. Some lossy format like JPEG/HEIF supports the hint for codec to automatically reduce the quality and match the file size you want. Note this option will override the `SDImageCoderEncodeCompressionQuality`, because now the quality is decided by the encoder. (NSNumber) + @note This is a hint, no guarantee for output size because of compression algorithm limit. And this options does not works for vector images. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxFileSize; + +/** + A Boolean value indicating the encoding format should contains a thumbnail image into the output data. Only some of image format (like JPEG/HEIF/AVIF) support this behavior. The embed thumbnail will be used during next time thumbnail decoding (provided `.thumbnailPixelSize`), which is faster than full image thumbnail decoding. (NSNumber) + Defaults to NO, which does not embed any thumbnail. + @note The thumbnail image's pixel size is not defined, the encoder can choose the proper pixel size which is suitable for encoding quality. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeEmbedThumbnail; + +/** + A SDWebImageContext object which hold the original context options from top-level API. (SDWebImageContext) + This option is ignored for all built-in coders and take no effect. + But this may be useful for some custom coders, because some business logic may dependent on things other than image or image data information only. + See `SDWebImageContext` for more detailed information. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderWebImageContext API_DEPRECATED("The coder component will be seperated from Core subspec in the future. Update your code to not rely on this context option.", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));; + +#pragma mark - Coder +/** + This is the image coder protocol to provide custom image decoding/encoding. + These methods are all required to implement. + @note Pay attention that these methods are not called from main queue. + */ +@protocol SDImageCoder + +@required +#pragma mark - Decoding +/** + Returns YES if this coder can decode some data. Otherwise, the data should be passed to another coder. + + @param data The image data so we can look at it + @return YES if this coder can decode the data, NO otherwise + */ +- (BOOL)canDecodeFromData:(nullable NSData *)data; + +/** + Decode the image data to image. + @note This protocol may supports decode animated image frames. You can use `+[SDImageCoderHelper animatedImageWithFrames:]` to produce an animated image with frames. + + @param data The image data to be decoded + @param options A dictionary containing any decoding options. Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for image. Pass @{SDImageCoderDecodeFirstFrameOnly: @(YES)} to decode the first frame only. + @return The decoded image from data + */ +- (nullable UIImage *)decodedImageWithData:(nullable NSData *)data + options:(nullable SDImageCoderOptions *)options; + +#pragma mark - Encoding + +/** + Returns YES if this coder can encode some image. Otherwise, it should be passed to another coder. + For custom coder which introduce new image format, you'd better define a new `SDImageFormat` using like this. If you're creating public coder plugin for new image format, also update `https://github.com/rs/SDWebImage/wiki/Coder-Plugin-List` to avoid same value been defined twice. + * @code + static const SDImageFormat SDImageFormatHEIF = 10; + * @endcode + + @param format The image format + @return YES if this coder can encode the image, NO otherwise + */ +- (BOOL)canEncodeToFormat:(SDImageFormat)format NS_SWIFT_NAME(canEncode(to:)); + +/** + Encode the image to image data. + @note This protocol may supports encode animated image frames. You can use `+[SDImageCoderHelper framesFromAnimatedImage:]` to assemble an animated image with frames. + + @param image The image to be encoded + @param format The image format to encode, you should note `SDImageFormatUndefined` format is also possible + @param options A dictionary containing any encoding options. Pass @{SDImageCoderEncodeCompressionQuality: @(1)} to specify compression quality. + @return The encoded image data + */ +- (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image + format:(SDImageFormat)format + options:(nullable SDImageCoderOptions *)options; + +@end + +#pragma mark - Progressive Coder +/** + This is the image coder protocol to provide custom progressive image decoding. + These methods are all required to implement. + @note Pay attention that these methods are not called from main queue. + */ +@protocol SDProgressiveImageCoder + +@required +/** + Returns YES if this coder can incremental decode some data. Otherwise, it should be passed to another coder. + + @param data The image data so we can look at it + @return YES if this coder can decode the data, NO otherwise + */ +- (BOOL)canIncrementalDecodeFromData:(nullable NSData *)data; + +/** + Because incremental decoding need to keep the decoded context, we will alloc a new instance with the same class for each download operation to avoid conflicts + This init method should not return nil + + @param options A dictionary containing any progressive decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for progressive animated image (each frames should use the same scale). + @return A new instance to do incremental decoding for the specify image format + */ +- (nonnull instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options; + +/** + Update the incremental decoding when new image data available + + @param data The image data has been downloaded so far + @param finished Whether the download has finished + */ +- (void)updateIncrementalData:(nullable NSData *)data finished:(BOOL)finished; + +/** + Incremental decode the current image data to image. + @note Due to the performance issue for progressive decoding and the integration for image view. This method may only return the first frame image even if the image data is animated image. If you want progressive animated image decoding, conform to `SDAnimatedImageCoder` protocol as well and use `animatedImageFrameAtIndex:` instead. + + @param options A dictionary containing any progressive decoding options. Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for progressive image + @return The decoded image from current data + */ +- (nullable UIImage *)incrementalDecodedImageWithOptions:(nullable SDImageCoderOptions *)options; + +@end + +#pragma mark - Animated Image Provider +/** + This is the animated image protocol to provide the basic function for animated image rendering. It's adopted by `SDAnimatedImage` and `SDAnimatedImageCoder` + */ +@protocol SDAnimatedImageProvider + +@required +/** + The original animated image data for current image. If current image is not an animated format, return nil. + We may use this method to grab back the original image data if need, such as NSCoding or compare. + + @return The animated image data + */ +@property (nonatomic, copy, readonly, nullable) NSData *animatedImageData; + +/** + Total animated frame count. + If the frame count is less than 1, then the methods below will be ignored. + + @return Total animated frame count. + */ +@property (nonatomic, assign, readonly) NSUInteger animatedImageFrameCount; +/** + Animation loop count, 0 means infinite looping. + + @return Animation loop count + */ +@property (nonatomic, assign, readonly) NSUInteger animatedImageLoopCount; +/** + Returns the frame image from a specified index. + @note The index maybe randomly if one image was set to different imageViews, keep it re-entrant. (It's not recommend to store the images into array because it's memory consuming) + + @param index Frame index (zero based). + @return Frame's image + */ +- (nullable UIImage *)animatedImageFrameAtIndex:(NSUInteger)index; +/** + Returns the frames's duration from a specified index. + @note The index maybe randomly if one image was set to different imageViews, keep it re-entrant. (It's recommend to store the durations into array because it's not memory-consuming) + + @param index Frame index (zero based). + @return Frame's duration + */ +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index; + +@end + +#pragma mark - Animated Coder +/** + This is the animated image coder protocol for custom animated image class like `SDAnimatedImage`. Through it inherit from `SDImageCoder`. We currentlly only use the method `canDecodeFromData:` to detect the proper coder for specify animated image format. + */ +@protocol SDAnimatedImageCoder + +@required +/** + Because animated image coder should keep the original data, we will alloc a new instance with the same class for the specify animated image data + The init method should return nil if it can't decode the specify animated image data to produce any frame. + After the instance created, we may call methods in `SDAnimatedImageProvider` to produce animated image frame. + + @param data The animated image data to be decode + @param options A dictionary containing any animated decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for animated image (each frames should use the same scale). + @return A new instance to do animated decoding for specify image data + */ +- (nullable instancetype)initWithAnimatedImageData:(nullable NSData *)data options:(nullable SDImageCoderOptions *)options; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m new file mode 100644 index 0000000..0fda198 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCoder.h" + +SDImageCoderOption const SDImageCoderDecodeFirstFrameOnly = @"decodeFirstFrameOnly"; +SDImageCoderOption const SDImageCoderDecodeScaleFactor = @"decodeScaleFactor"; +SDImageCoderOption const SDImageCoderDecodePreserveAspectRatio = @"decodePreserveAspectRatio"; +SDImageCoderOption const SDImageCoderDecodeThumbnailPixelSize = @"decodeThumbnailPixelSize"; + +SDImageCoderOption const SDImageCoderEncodeFirstFrameOnly = @"encodeFirstFrameOnly"; +SDImageCoderOption const SDImageCoderEncodeCompressionQuality = @"encodeCompressionQuality"; +SDImageCoderOption const SDImageCoderEncodeBackgroundColor = @"encodeBackgroundColor"; +SDImageCoderOption const SDImageCoderEncodeMaxPixelSize = @"encodeMaxPixelSize"; +SDImageCoderOption const SDImageCoderEncodeMaxFileSize = @"encodeMaxFileSize"; +SDImageCoderOption const SDImageCoderEncodeEmbedThumbnail = @"encodeEmbedThumbnail"; + +SDImageCoderOption const SDImageCoderWebImageContext = @"webImageContext"; diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h new file mode 100644 index 0000000..77b9d77 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h @@ -0,0 +1,127 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDImageFrame.h" + +/** + Provide some common helper methods for building the image decoder/encoder. + */ +@interface SDImageCoderHelper : NSObject + +/** + Return an animated image with frames array. + For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work. + For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not) + + @param frames The frames array. If no frames or frames is empty, return nil + @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit) + */ ++ (UIImage * _Nullable)animatedImageWithFrames:(NSArray * _Nullable)frames; + +/** + Return frames array from an animated image. + For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage. + For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array. + + @param animatedImage A animated image. If it's not animated, return nil + @return The frames array + */ ++ (NSArray * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage NS_SWIFT_NAME(frames(from:)); + +/** + Return the shared device-dependent RGB color space. This follows The Get Rule. + On iOS, it's created with deviceRGB (if available, use sRGB). + On macOS, it's from the screen colorspace (if failed, use deviceRGB) + Because it's shared, you should not retain or release this object. + + @return The device-dependent RGB color space + */ ++ (CGColorSpaceRef _Nonnull)colorSpaceGetDeviceRGB CF_RETURNS_NOT_RETAINED; + +/** + Check whether CGImage contains alpha channel. + + @param cgImage The CGImage + @return Return YES if CGImage contains alpha channel, otherwise return NO + */ ++ (BOOL)CGImageContainsAlpha:(_Nonnull CGImageRef)cgImage; + +/** + Create a decoded CGImage by the provided CGImage. This follows The Create Rule and you are response to call release after usage. + It will detect whether image contains alpha channel, then create a new bitmap context with the same size of image, and draw it. This can ensure that the image do not need extra decoding after been set to the imageView. + @note This actually call `CGImageCreateDecoded:orientation:` with the Up orientation. + + @param cgImage The CGImage + @return A new created decoded image + */ ++ (CGImageRef _Nullable)CGImageCreateDecoded:(_Nonnull CGImageRef)cgImage CF_RETURNS_RETAINED; + +/** + Create a decoded CGImage by the provided CGImage and orientation. This follows The Create Rule and you are response to call release after usage. + It will detect whether image contains alpha channel, then create a new bitmap context with the same size of image, and draw it. This can ensure that the image do not need extra decoding after been set to the imageView. + + @param cgImage The CGImage + @param orientation The EXIF image orientation. + @return A new created decoded image + */ ++ (CGImageRef _Nullable)CGImageCreateDecoded:(_Nonnull CGImageRef)cgImage orientation:(CGImagePropertyOrientation)orientation CF_RETURNS_RETAINED; + +/** + Create a scaled CGImage by the provided CGImage and size. This follows The Create Rule and you are response to call release after usage. + It will detect whether the image size matching the scale size, if not, stretch the image to the target size. + + @param cgImage The CGImage + @param size The scale size in pixel. + @return A new created scaled image + */ ++ (CGImageRef _Nullable)CGImageCreateScaled:(_Nonnull CGImageRef)cgImage size:(CGSize)size CF_RETURNS_RETAINED; + +/** + Return the decoded image by the provided image. This one unlike `CGImageCreateDecoded:`, will not decode the image which contains alpha channel or animated image + @param image The image to be decoded + @return The decoded image + */ ++ (UIImage * _Nullable)decodedImageWithImage:(UIImage * _Nullable)image; + +/** + Return the decoded and probably scaled down image by the provided image. If the image pixels bytes size large than the limit bytes, will try to scale down. Or just works as `decodedImageWithImage:`, never scale up. + @warning You should not pass too small bytes, the suggestion value should be larger than 1MB. Even we use Tile Decoding to avoid OOM, however, small bytes will consume much more CPU time because we need to iterate more times to draw each tile. + + @param image The image to be decoded and scaled down + @param bytes The limit bytes size. Provide 0 to use the build-in limit. + @return The decoded and probably scaled down image + */ ++ (UIImage * _Nullable)decodedAndScaledDownImageWithImage:(UIImage * _Nullable)image limitBytes:(NSUInteger)bytes; + +/** + Control the default limit bytes to scale down largest images. + This value must be larger than 4 Bytes (at least 1x1 pixel). Defaults to 60MB on iOS/tvOS, 90MB on macOS, 30MB on watchOS. + */ +@property (class, readwrite) NSUInteger defaultScaleDownLimitBytes; + +#if SD_UIKIT || SD_WATCH +/** + Convert an EXIF image orientation to an iOS one. + + @param exifOrientation EXIF orientation + @return iOS orientation + */ ++ (UIImageOrientation)imageOrientationFromEXIFOrientation:(CGImagePropertyOrientation)exifOrientation NS_SWIFT_NAME(imageOrientation(from:)); + +/** + Convert an iOS orientation to an EXIF image orientation. + + @param imageOrientation iOS orientation + @return EXIF orientation + */ ++ (CGImagePropertyOrientation)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation; +#endif + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m new file mode 100644 index 0000000..4244a92 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m @@ -0,0 +1,686 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCoderHelper.h" +#import "SDImageFrame.h" +#import "NSImage+Compatibility.h" +#import "NSData+ImageContentType.h" +#import "SDAnimatedImageRep.h" +#import "UIImage+ForceDecode.h" +#import "SDAssociatedObject.h" +#import "UIImage+Metadata.h" +#import "SDInternalMacros.h" +#import + +static inline size_t SDByteAlign(size_t size, size_t alignment) { + return ((size + (alignment - 1)) / alignment) * alignment; +} + +static const size_t kBytesPerPixel = 4; +static const size_t kBitsPerComponent = 8; + +static const CGFloat kBytesPerMB = 1024.0f * 1024.0f; +/* + * Defines the maximum size in MB of the decoded image when the flag `SDWebImageScaleDownLargeImages` is set + * Suggested value for iPad1 and iPhone 3GS: 60. + * Suggested value for iPad2 and iPhone 4: 120. + * Suggested value for iPhone 3G and iPod 2 and earlier devices: 30. + */ +#if SD_MAC +static CGFloat kDestImageLimitBytes = 90.f * kBytesPerMB; +#elif SD_UIKIT +static CGFloat kDestImageLimitBytes = 60.f * kBytesPerMB; +#elif SD_WATCH +static CGFloat kDestImageLimitBytes = 30.f * kBytesPerMB; +#endif + +static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to overlap the seems where tiles meet. + +@implementation SDImageCoderHelper + ++ (UIImage *)animatedImageWithFrames:(NSArray *)frames { + NSUInteger frameCount = frames.count; + if (frameCount == 0) { + return nil; + } + + UIImage *animatedImage; + +#if SD_UIKIT || SD_WATCH + NSUInteger durations[frameCount]; + for (size_t i = 0; i < frameCount; i++) { + durations[i] = frames[i].duration * 1000; + } + NSUInteger const gcd = gcdArray(frameCount, durations); + __block NSUInteger totalDuration = 0; + NSMutableArray *animatedImages = [NSMutableArray arrayWithCapacity:frameCount]; + [frames enumerateObjectsUsingBlock:^(SDImageFrame * _Nonnull frame, NSUInteger idx, BOOL * _Nonnull stop) { + UIImage *image = frame.image; + NSUInteger duration = frame.duration * 1000; + totalDuration += duration; + NSUInteger repeatCount; + if (gcd) { + repeatCount = duration / gcd; + } else { + repeatCount = 1; + } + for (size_t i = 0; i < repeatCount; ++i) { + [animatedImages addObject:image]; + } + }]; + + animatedImage = [UIImage animatedImageWithImages:animatedImages duration:totalDuration / 1000.f]; + +#else + + NSMutableData *imageData = [NSMutableData data]; + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatGIF]; + // Create an image destination. GIF does not support EXIF image orientation + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frameCount, NULL); + if (!imageDestination) { + // Handle failure. + return nil; + } + + for (size_t i = 0; i < frameCount; i++) { + @autoreleasepool { + SDImageFrame *frame = frames[i]; + NSTimeInterval frameDuration = frame.duration; + CGImageRef frameImageRef = frame.image.CGImage; + NSDictionary *frameProperties = @{(__bridge NSString *)kCGImagePropertyGIFDictionary : @{(__bridge NSString *)kCGImagePropertyGIFDelayTime : @(frameDuration)}}; + CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)frameProperties); + } + } + // Finalize the destination. + if (CGImageDestinationFinalize(imageDestination) == NO) { + // Handle failure. + CFRelease(imageDestination); + return nil; + } + CFRelease(imageDestination); + CGFloat scale = MAX(frames.firstObject.image.scale, 1); + + SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:imageData]; + NSSize size = NSMakeSize(imageRep.pixelsWide / scale, imageRep.pixelsHigh / scale); + imageRep.size = size; + animatedImage = [[NSImage alloc] initWithSize:size]; + [animatedImage addRepresentation:imageRep]; +#endif + + return animatedImage; +} + ++ (NSArray *)framesFromAnimatedImage:(UIImage *)animatedImage { + if (!animatedImage) { + return nil; + } + + NSMutableArray *frames = [NSMutableArray array]; + NSUInteger frameCount = 0; + +#if SD_UIKIT || SD_WATCH + NSArray *animatedImages = animatedImage.images; + frameCount = animatedImages.count; + if (frameCount == 0) { + return nil; + } + + NSTimeInterval avgDuration = animatedImage.duration / frameCount; + if (avgDuration == 0) { + avgDuration = 0.1; // if it's a animated image but no duration, set it to default 100ms (this do not have that 10ms limit like GIF or WebP to allow custom coder provide the limit) + } + + __block NSUInteger index = 0; + __block NSUInteger repeatCount = 1; + __block UIImage *previousImage = animatedImages.firstObject; + [animatedImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) { + // ignore first + if (idx == 0) { + return; + } + if ([image isEqual:previousImage]) { + repeatCount++; + } else { + SDImageFrame *frame = [SDImageFrame frameWithImage:previousImage duration:avgDuration * repeatCount]; + [frames addObject:frame]; + repeatCount = 1; + index++; + } + previousImage = image; + // last one + if (idx == frameCount - 1) { + SDImageFrame *frame = [SDImageFrame frameWithImage:previousImage duration:avgDuration * repeatCount]; + [frames addObject:frame]; + } + }]; + +#else + + NSRect imageRect = NSMakeRect(0, 0, animatedImage.size.width, animatedImage.size.height); + NSImageRep *imageRep = [animatedImage bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (!bitmapImageRep) { + return nil; + } + frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; + if (frameCount == 0) { + return nil; + } + CGFloat scale = animatedImage.scale; + + for (size_t i = 0; i < frameCount; i++) { + @autoreleasepool { + // NSBitmapImageRep need to manually change frame. "Good taste" API + [bitmapImageRep setProperty:NSImageCurrentFrame withValue:@(i)]; + NSTimeInterval frameDuration = [[bitmapImageRep valueForProperty:NSImageCurrentFrameDuration] doubleValue]; + NSImage *frameImage = [[NSImage alloc] initWithCGImage:bitmapImageRep.CGImage scale:scale orientation:kCGImagePropertyOrientationUp]; + SDImageFrame *frame = [SDImageFrame frameWithImage:frameImage duration:frameDuration]; + [frames addObject:frame]; + } + } +#endif + + return frames; +} + ++ (CGColorSpaceRef)colorSpaceGetDeviceRGB { +#if SD_MAC + CGColorSpaceRef screenColorSpace = NSScreen.mainScreen.colorSpace.CGColorSpace; + if (screenColorSpace) { + return screenColorSpace; + } +#endif + static CGColorSpaceRef colorSpace; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ +#if SD_UIKIT + if (@available(iOS 9.0, tvOS 9.0, *)) { + colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + } else { + colorSpace = CGColorSpaceCreateDeviceRGB(); + } +#else + colorSpace = CGColorSpaceCreateDeviceRGB(); +#endif + }); + return colorSpace; +} + ++ (BOOL)CGImageContainsAlpha:(CGImageRef)cgImage { + if (!cgImage) { + return NO; + } + CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(cgImage); + BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || + alphaInfo == kCGImageAlphaNoneSkipFirst || + alphaInfo == kCGImageAlphaNoneSkipLast); + return hasAlpha; +} + ++ (CGImageRef)CGImageCreateDecoded:(CGImageRef)cgImage { + return [self CGImageCreateDecoded:cgImage orientation:kCGImagePropertyOrientationUp]; +} + ++ (CGImageRef)CGImageCreateDecoded:(CGImageRef)cgImage orientation:(CGImagePropertyOrientation)orientation { + if (!cgImage) { + return NULL; + } + size_t width = CGImageGetWidth(cgImage); + size_t height = CGImageGetHeight(cgImage); + if (width == 0 || height == 0) return NULL; + size_t newWidth; + size_t newHeight; + switch (orientation) { + case kCGImagePropertyOrientationLeft: + case kCGImagePropertyOrientationLeftMirrored: + case kCGImagePropertyOrientationRight: + case kCGImagePropertyOrientationRightMirrored: { + // These orientation should swap width & height + newWidth = height; + newHeight = width; + } + break; + default: { + newWidth = width; + newHeight = height; + } + break; + } + + BOOL hasAlpha = [self CGImageContainsAlpha:cgImage]; + // iOS prefer BGRA8888 (premultiplied) or BGRX8888 bitmapInfo for screen rendering, which is same as `UIGraphicsBeginImageContext()` or `- [CALayer drawInContext:]` + // Though you can use any supported bitmapInfo (see: https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html#//apple_ref/doc/uid/TP30001066-CH203-BCIBHHBB ) and let Core Graphics reorder it when you call `CGContextDrawImage` + // But since our build-in coders use this bitmapInfo, this can have a little performance benefit + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + CGContextRef context = CGBitmapContextCreate(NULL, newWidth, newHeight, 8, 0, [self colorSpaceGetDeviceRGB], bitmapInfo); + if (!context) { + return NULL; + } + + // Apply transform + CGAffineTransform transform = SDCGContextTransformFromOrientation(orientation, CGSizeMake(newWidth, newHeight)); + CGContextConcatCTM(context, transform); + CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage); // The rect is bounding box of CGImage, don't swap width & height + CGImageRef newImageRef = CGBitmapContextCreateImage(context); + CGContextRelease(context); + + return newImageRef; +} + ++ (CGImageRef)CGImageCreateScaled:(CGImageRef)cgImage size:(CGSize)size { + if (!cgImage) { + return NULL; + } + size_t width = CGImageGetWidth(cgImage); + size_t height = CGImageGetHeight(cgImage); + if (width == size.width && height == size.height) { + CGImageRetain(cgImage); + return cgImage; + } + + __block vImage_Buffer input_buffer = {}, output_buffer = {}; + @onExit { + if (input_buffer.data) free(input_buffer.data); + if (output_buffer.data) free(output_buffer.data); + }; + BOOL hasAlpha = [self CGImageContainsAlpha:cgImage]; + // iOS display alpha info (BGRA8888/BGRX8888) + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + vImage_CGImageFormat format = (vImage_CGImageFormat) { + .bitsPerComponent = 8, + .bitsPerPixel = 32, + .colorSpace = NULL, + .bitmapInfo = bitmapInfo, + .version = 0, + .decode = NULL, + .renderingIntent = kCGRenderingIntentDefault, + }; + + vImage_Error a_ret = vImageBuffer_InitWithCGImage(&input_buffer, &format, NULL, cgImage, kvImageNoFlags); + if (a_ret != kvImageNoError) return NULL; + output_buffer.width = MAX(size.width, 0); + output_buffer.height = MAX(size.height, 0); + output_buffer.rowBytes = SDByteAlign(output_buffer.width * 4, 64); + output_buffer.data = malloc(output_buffer.rowBytes * output_buffer.height); + if (!output_buffer.data) return NULL; + + vImage_Error ret = vImageScale_ARGB8888(&input_buffer, &output_buffer, NULL, kvImageHighQualityResampling); + if (ret != kvImageNoError) return NULL; + + CGImageRef outputImage = vImageCreateCGImageFromBuffer(&output_buffer, &format, NULL, NULL, kvImageNoFlags, &ret); + if (ret != kvImageNoError) { + CGImageRelease(outputImage); + return NULL; + } + + return outputImage; +} + ++ (UIImage *)decodedImageWithImage:(UIImage *)image { + if (![self shouldDecodeImage:image]) { + return image; + } + + CGImageRef imageRef = [self CGImageCreateDecoded:image.CGImage]; + if (!imageRef) { + return image; + } +#if SD_MAC + UIImage *decodedImage = [[UIImage alloc] initWithCGImage:imageRef scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + UIImage *decodedImage = [[UIImage alloc] initWithCGImage:imageRef scale:image.scale orientation:image.imageOrientation]; +#endif + CGImageRelease(imageRef); + SDImageCopyAssociatedObject(image, decodedImage); + decodedImage.sd_isDecoded = YES; + return decodedImage; +} + ++ (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image limitBytes:(NSUInteger)bytes { + if (![self shouldDecodeImage:image]) { + return image; + } + + if (![self shouldScaleDownImage:image limitBytes:bytes]) { + return [self decodedImageWithImage:image]; + } + + CGFloat destTotalPixels; + CGFloat tileTotalPixels; + if (bytes == 0) { + bytes = kDestImageLimitBytes; + } + destTotalPixels = bytes / kBytesPerPixel; + tileTotalPixels = destTotalPixels / 3; + CGContextRef destContext; + + // autorelease the bitmap context and all vars to help system to free memory when there are memory warning. + // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory]; + @autoreleasepool { + CGImageRef sourceImageRef = image.CGImage; + + CGSize sourceResolution = CGSizeZero; + sourceResolution.width = CGImageGetWidth(sourceImageRef); + sourceResolution.height = CGImageGetHeight(sourceImageRef); + CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height; + // Determine the scale ratio to apply to the input image + // that results in an output image of the defined size. + // see kDestImageSizeMB, and how it relates to destTotalPixels. + CGFloat imageScale = sqrt(destTotalPixels / sourceTotalPixels); + CGSize destResolution = CGSizeZero; + destResolution.width = MAX(1, (int)(sourceResolution.width * imageScale)); + destResolution.height = MAX(1, (int)(sourceResolution.height * imageScale)); + + // device color space + CGColorSpaceRef colorspaceRef = [self colorSpaceGetDeviceRGB]; + BOOL hasAlpha = [self CGImageContainsAlpha:sourceImageRef]; + // iOS display alpha info (BGRA8888/BGRX8888) + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + + // kCGImageAlphaNone is not supported in CGBitmapContextCreate. + // Since the original image here has no alpha info, use kCGImageAlphaNoneSkipFirst + // to create bitmap graphics contexts without alpha info. + destContext = CGBitmapContextCreate(NULL, + destResolution.width, + destResolution.height, + kBitsPerComponent, + 0, + colorspaceRef, + bitmapInfo); + + if (destContext == NULL) { + return image; + } + CGContextSetInterpolationQuality(destContext, kCGInterpolationHigh); + + // Now define the size of the rectangle to be used for the + // incremental bits from the input image to the output image. + // we use a source tile width equal to the width of the source + // image due to the way that iOS retrieves image data from disk. + // iOS must decode an image from disk in full width 'bands', even + // if current graphics context is clipped to a subrect within that + // band. Therefore we fully utilize all of the pixel data that results + // from a decoding operation by anchoring our tile size to the full + // width of the input image. + CGRect sourceTile = CGRectZero; + sourceTile.size.width = sourceResolution.width; + // The source tile height is dynamic. Since we specified the size + // of the source tile in MB, see how many rows of pixels high it + // can be given the input image width. + sourceTile.size.height = MAX(1, (int)(tileTotalPixels / sourceTile.size.width)); + sourceTile.origin.x = 0.0f; + // The output tile is the same proportions as the input tile, but + // scaled to image scale. + CGRect destTile; + destTile.size.width = destResolution.width; + destTile.size.height = sourceTile.size.height * imageScale; + destTile.origin.x = 0.0f; + // The source seem overlap is proportionate to the destination seem overlap. + // this is the amount of pixels to overlap each tile as we assemble the output image. + float sourceSeemOverlap = (int)((kDestSeemOverlap/destResolution.height)*sourceResolution.height); + CGImageRef sourceTileImageRef; + // calculate the number of read/write operations required to assemble the + // output image. + int iterations = (int)( sourceResolution.height / sourceTile.size.height ); + // If tile height doesn't divide the image height evenly, add another iteration + // to account for the remaining pixels. + int remainder = (int)sourceResolution.height % (int)sourceTile.size.height; + if(remainder) { + iterations++; + } + // Add seem overlaps to the tiles, but save the original tile height for y coordinate calculations. + float sourceTileHeightMinusOverlap = sourceTile.size.height; + sourceTile.size.height += sourceSeemOverlap; + destTile.size.height += kDestSeemOverlap; + for( int y = 0; y < iterations; ++y ) { + @autoreleasepool { + sourceTile.origin.y = y * sourceTileHeightMinusOverlap + sourceSeemOverlap; + destTile.origin.y = destResolution.height - (( y + 1 ) * sourceTileHeightMinusOverlap * imageScale + kDestSeemOverlap); + sourceTileImageRef = CGImageCreateWithImageInRect( sourceImageRef, sourceTile ); + if( y == iterations - 1 && remainder ) { + float dify = destTile.size.height; + destTile.size.height = CGImageGetHeight( sourceTileImageRef ) * imageScale; + dify -= destTile.size.height; + destTile.origin.y += dify; + } + CGContextDrawImage( destContext, destTile, sourceTileImageRef ); + CGImageRelease( sourceTileImageRef ); + } + } + + CGImageRef destImageRef = CGBitmapContextCreateImage(destContext); + CGContextRelease(destContext); + if (destImageRef == NULL) { + return image; + } +#if SD_MAC + UIImage *destImage = [[UIImage alloc] initWithCGImage:destImageRef scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + UIImage *destImage = [[UIImage alloc] initWithCGImage:destImageRef scale:image.scale orientation:image.imageOrientation]; +#endif + CGImageRelease(destImageRef); + if (destImage == nil) { + return image; + } + SDImageCopyAssociatedObject(image, destImage); + destImage.sd_isDecoded = YES; + return destImage; + } +} + ++ (NSUInteger)defaultScaleDownLimitBytes { + return kDestImageLimitBytes; +} + ++ (void)setDefaultScaleDownLimitBytes:(NSUInteger)defaultScaleDownLimitBytes { + if (defaultScaleDownLimitBytes < kBytesPerPixel) { + return; + } + kDestImageLimitBytes = defaultScaleDownLimitBytes; +} + +#if SD_UIKIT || SD_WATCH +// Convert an EXIF image orientation to an iOS one. ++ (UIImageOrientation)imageOrientationFromEXIFOrientation:(CGImagePropertyOrientation)exifOrientation { + UIImageOrientation imageOrientation = UIImageOrientationUp; + switch (exifOrientation) { + case kCGImagePropertyOrientationUp: + imageOrientation = UIImageOrientationUp; + break; + case kCGImagePropertyOrientationDown: + imageOrientation = UIImageOrientationDown; + break; + case kCGImagePropertyOrientationLeft: + imageOrientation = UIImageOrientationLeft; + break; + case kCGImagePropertyOrientationRight: + imageOrientation = UIImageOrientationRight; + break; + case kCGImagePropertyOrientationUpMirrored: + imageOrientation = UIImageOrientationUpMirrored; + break; + case kCGImagePropertyOrientationDownMirrored: + imageOrientation = UIImageOrientationDownMirrored; + break; + case kCGImagePropertyOrientationLeftMirrored: + imageOrientation = UIImageOrientationLeftMirrored; + break; + case kCGImagePropertyOrientationRightMirrored: + imageOrientation = UIImageOrientationRightMirrored; + break; + default: + break; + } + return imageOrientation; +} + +// Convert an iOS orientation to an EXIF image orientation. ++ (CGImagePropertyOrientation)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation { + CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp; + switch (imageOrientation) { + case UIImageOrientationUp: + exifOrientation = kCGImagePropertyOrientationUp; + break; + case UIImageOrientationDown: + exifOrientation = kCGImagePropertyOrientationDown; + break; + case UIImageOrientationLeft: + exifOrientation = kCGImagePropertyOrientationLeft; + break; + case UIImageOrientationRight: + exifOrientation = kCGImagePropertyOrientationRight; + break; + case UIImageOrientationUpMirrored: + exifOrientation = kCGImagePropertyOrientationUpMirrored; + break; + case UIImageOrientationDownMirrored: + exifOrientation = kCGImagePropertyOrientationDownMirrored; + break; + case UIImageOrientationLeftMirrored: + exifOrientation = kCGImagePropertyOrientationLeftMirrored; + break; + case UIImageOrientationRightMirrored: + exifOrientation = kCGImagePropertyOrientationRightMirrored; + break; + default: + break; + } + return exifOrientation; +} +#endif + +#pragma mark - Helper Function ++ (BOOL)shouldDecodeImage:(nullable UIImage *)image { + // Prevent "CGBitmapContextCreateImage: invalid context 0x0" error + if (image == nil) { + return NO; + } + // Avoid extra decode + if (image.sd_isDecoded) { + return NO; + } + // do not decode animated images + if (image.sd_isAnimated) { + return NO; + } + // do not decode vector images + if (image.sd_isVector) { + return NO; + } + + return YES; +} + ++ (BOOL)shouldScaleDownImage:(nonnull UIImage *)image limitBytes:(NSUInteger)bytes { + BOOL shouldScaleDown = YES; + + CGImageRef sourceImageRef = image.CGImage; + CGSize sourceResolution = CGSizeZero; + sourceResolution.width = CGImageGetWidth(sourceImageRef); + sourceResolution.height = CGImageGetHeight(sourceImageRef); + float sourceTotalPixels = sourceResolution.width * sourceResolution.height; + if (sourceTotalPixels <= 0) { + return NO; + } + CGFloat destTotalPixels; + if (bytes == 0) { + bytes = [self defaultScaleDownLimitBytes]; + } + bytes = MAX(bytes, kBytesPerPixel); + destTotalPixels = bytes / kBytesPerPixel; + float imageScale = destTotalPixels / sourceTotalPixels; + if (imageScale < 1) { + shouldScaleDown = YES; + } else { + shouldScaleDown = NO; + } + + return shouldScaleDown; +} + +static inline CGAffineTransform SDCGContextTransformFromOrientation(CGImagePropertyOrientation orientation, CGSize size) { + // Inspiration from @libfeihu + // We need to calculate the proper transformation to make the image upright. + // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored. + CGAffineTransform transform = CGAffineTransformIdentity; + + switch (orientation) { + case kCGImagePropertyOrientationDown: + case kCGImagePropertyOrientationDownMirrored: + transform = CGAffineTransformTranslate(transform, size.width, size.height); + transform = CGAffineTransformRotate(transform, M_PI); + break; + + case kCGImagePropertyOrientationLeft: + case kCGImagePropertyOrientationLeftMirrored: + transform = CGAffineTransformTranslate(transform, size.width, 0); + transform = CGAffineTransformRotate(transform, M_PI_2); + break; + + case kCGImagePropertyOrientationRight: + case kCGImagePropertyOrientationRightMirrored: + transform = CGAffineTransformTranslate(transform, 0, size.height); + transform = CGAffineTransformRotate(transform, -M_PI_2); + break; + case kCGImagePropertyOrientationUp: + case kCGImagePropertyOrientationUpMirrored: + break; + } + + switch (orientation) { + case kCGImagePropertyOrientationUpMirrored: + case kCGImagePropertyOrientationDownMirrored: + transform = CGAffineTransformTranslate(transform, size.width, 0); + transform = CGAffineTransformScale(transform, -1, 1); + break; + + case kCGImagePropertyOrientationLeftMirrored: + case kCGImagePropertyOrientationRightMirrored: + transform = CGAffineTransformTranslate(transform, size.height, 0); + transform = CGAffineTransformScale(transform, -1, 1); + break; + case kCGImagePropertyOrientationUp: + case kCGImagePropertyOrientationDown: + case kCGImagePropertyOrientationLeft: + case kCGImagePropertyOrientationRight: + break; + } + + return transform; +} + +#if SD_UIKIT || SD_WATCH +static NSUInteger gcd(NSUInteger a, NSUInteger b) { + NSUInteger c; + while (a != 0) { + c = a; + a = b % a; + b = c; + } + return b; +} + +static NSUInteger gcdArray(size_t const count, NSUInteger const * const values) { + if (count == 0) { + return 0; + } + NSUInteger result = values[0]; + for (size_t i = 1; i < count; ++i) { + result = gcd(values[i], result); + } + return result; +} +#endif + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h b/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h new file mode 100644 index 0000000..14b655d --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h @@ -0,0 +1,58 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageCoder.h" + +/** + Global object holding the array of coders, so that we avoid passing them from object to object. + Uses a priority queue behind scenes, which means the latest added coders have the highest priority. + This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data. + That way, users can add their custom coders while preserving our existing prebuilt ones + + Note: the `coders` getter will return the coders in their reversed order + Example: + - by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder` + - calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]` + - call `[addCoder:[MyCrazyCoder new]]` + - calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]` + + Coders + ------ + A coder must conform to the `SDImageCoder` protocol or even to `SDProgressiveImageCoder` if it supports progressive decoding + Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat` + Those methods are called on each coder in the array (using the priority order) until one of them returns YES. + That means that coder can decode that data / encode to that format + */ +@interface SDImageCodersManager : NSObject + +/** + Returns the global shared coders manager instance. + */ +@property (nonatomic, class, readonly, nonnull) SDImageCodersManager *sharedManager; + +/** + All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority + */ +@property (nonatomic, copy, nullable) NSArray> *coders; + +/** + Add a new coder to the end of coders array. Which has the highest priority. + + @param coder coder + */ +- (void)addCoder:(nonnull id)coder; + +/** + Remove a coder in the coders array. + + @param coder coder + */ +- (void)removeCoder:(nonnull id)coder; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m b/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m new file mode 100644 index 0000000..c49b5e7 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m @@ -0,0 +1,133 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCodersManager.h" +#import "SDImageIOCoder.h" +#import "SDImageGIFCoder.h" +#import "SDImageAPNGCoder.h" +#import "SDImageHEICCoder.h" +#import "SDInternalMacros.h" + +@interface SDImageCodersManager () + +@property (nonatomic, strong, nonnull) dispatch_semaphore_t codersLock; + +@end + +@implementation SDImageCodersManager +{ + NSMutableArray> *_imageCoders; +} + ++ (nonnull instancetype)sharedManager { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (instancetype)init { + if (self = [super init]) { + // initialize with default coders + _imageCoders = [NSMutableArray arrayWithArray:@[[SDImageIOCoder sharedCoder], [SDImageGIFCoder sharedCoder], [SDImageAPNGCoder sharedCoder]]]; + _codersLock = dispatch_semaphore_create(1); + } + return self; +} + +- (NSArray> *)coders +{ + SD_LOCK(self.codersLock); + NSArray> *coders = [_imageCoders copy]; + SD_UNLOCK(self.codersLock); + return coders; +} + +- (void)setCoders:(NSArray> *)coders +{ + SD_LOCK(self.codersLock); + [_imageCoders removeAllObjects]; + if (coders.count) { + [_imageCoders addObjectsFromArray:coders]; + } + SD_UNLOCK(self.codersLock); +} + +#pragma mark - Coder IO operations + +- (void)addCoder:(nonnull id)coder { + if (![coder conformsToProtocol:@protocol(SDImageCoder)]) { + return; + } + SD_LOCK(self.codersLock); + [_imageCoders addObject:coder]; + SD_UNLOCK(self.codersLock); +} + +- (void)removeCoder:(nonnull id)coder { + if (![coder conformsToProtocol:@protocol(SDImageCoder)]) { + return; + } + SD_LOCK(self.codersLock); + [_imageCoders removeObject:coder]; + SD_UNLOCK(self.codersLock); +} + +#pragma mark - SDImageCoder +- (BOOL)canDecodeFromData:(NSData *)data { + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canDecodeFromData:data]) { + return YES; + } + } + return NO; +} + +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canEncodeToFormat:format]) { + return YES; + } + } + return NO; +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + UIImage *image; + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canDecodeFromData:data]) { + image = [coder decodedImageWithData:data options:options]; + break; + } + } + + return image; +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canEncodeToFormat:format]) { + return [coder encodedDataWithImage:image format:format options:options]; + } + } + return nil; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h b/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h new file mode 100644 index 0000000..a93fd9c --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h @@ -0,0 +1,36 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/** + This class is used for creating animated images via `animatedImageWithFrames` in `SDImageCoderHelper`. + @note If you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+Metadata.h`. + */ +@interface SDImageFrame : NSObject + +/** + The image of current frame. You should not set an animated image. + */ +@property (nonatomic, strong, readonly, nonnull) UIImage *image; +/** + The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero. + */ +@property (nonatomic, readonly, assign) NSTimeInterval duration; + +/** + Create a frame instance with specify image and duration + + @param image current frame's image + @param duration current frame's duration + @return frame instance + */ ++ (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m b/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m new file mode 100644 index 0000000..f035af5 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m @@ -0,0 +1,28 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageFrame.h" + +@interface SDImageFrame () + +@property (nonatomic, strong, readwrite, nonnull) UIImage *image; +@property (nonatomic, readwrite, assign) NSTimeInterval duration; + +@end + +@implementation SDImageFrame + ++ (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration { + SDImageFrame *frame = [[SDImageFrame alloc] init]; + frame.image = image; + frame.duration = duration; + + return frame; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h new file mode 100644 index 0000000..5ef67ac --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h @@ -0,0 +1,22 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + Built in coder using ImageIO that supports animated GIF encoding/decoding + @note `SDImageIOCoder` supports GIF but only as static (will use the 1st frame). + @note Use `SDImageGIFCoder` for fully animated GIFs. For `UIImageView`, it will produce animated `UIImage`(`NSImage` on macOS) for rendering. For `SDAnimatedImageView`, it will use `SDAnimatedImage` for rendering. + @note The recommended approach for animated GIFs is using `SDAnimatedImage` with `SDAnimatedImageView`. It's more performant than `UIImageView` for GIF displaying(especially on memory usage) + */ +@interface SDImageGIFCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageGIFCoder *sharedCoder; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m new file mode 100644 index 0000000..e4aaa5d --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m @@ -0,0 +1,57 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageGIFCoder.h" +#if SD_MAC +#import +#else +#import +#endif + +@implementation SDImageGIFCoder + ++ (instancetype)sharedCoder { + static SDImageGIFCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageGIFCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatGIF; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kUTTypeGIF; +} + ++ (NSString *)dictionaryProperty { + return (__bridge NSString *)kCGImagePropertyGIFDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return (__bridge NSString *)kCGImagePropertyGIFUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return (__bridge NSString *)kCGImagePropertyGIFDelayTime; +} + ++ (NSString *)loopCountProperty { + return (__bridge NSString *)kCGImagePropertyGIFLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 1; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h b/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h new file mode 100644 index 0000000..131d685 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h @@ -0,0 +1,28 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import + +/** + These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code. + For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage. + For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit. + @note If you don't care bitmap format (ARGB8888) and just draw image, use `SDGraphicsImageRenderer` instead. It's more performant on RAM usage.` + */ + +/// Returns the current graphics context. +FOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED; +/// Creates a bitmap-based graphics context and makes it the current context. +FOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size); +/// Creates a bitmap-based graphics context with the specified options. +FOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); +/// Removes the current bitmap-based graphics context from the top of the stack. +FOUNDATION_EXPORT void SDGraphicsEndImageContext(void); +/// Returns an image based on the contents of the current bitmap-based graphics context. +FOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void); diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m b/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m new file mode 100644 index 0000000..e7c4ed4 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m @@ -0,0 +1,105 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageGraphics.h" +#import "NSImage+Compatibility.h" +#import "objc/runtime.h" + +#if SD_MAC +static void *kNSGraphicsContextScaleFactorKey; + +static CGContextRef SDCGContextCreateBitmapContext(CGSize size, BOOL opaque, CGFloat scale) { + if (scale == 0) { + // Match `UIGraphicsBeginImageContextWithOptions`, reset to the scale factor of the device’s main screen if scale is 0. + scale = [NSScreen mainScreen].backingScaleFactor; + } + size_t width = ceil(size.width * scale); + size_t height = ceil(size.height * scale); + if (width < 1 || height < 1) return NULL; + + //pre-multiplied BGRA for non-opaque, BGRX for opaque, 8-bits per component, as Apple's doc + CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); + CGImageAlphaInfo alphaInfo = kCGBitmapByteOrder32Host | (opaque ? kCGImageAlphaNoneSkipFirst : kCGImageAlphaPremultipliedFirst); + CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, space, kCGBitmapByteOrderDefault | alphaInfo); + CGColorSpaceRelease(space); + if (!context) { + return NULL; + } + CGContextScaleCTM(context, scale, scale); + + return context; +} +#endif + +CGContextRef SDGraphicsGetCurrentContext(void) { +#if SD_UIKIT || SD_WATCH + return UIGraphicsGetCurrentContext(); +#else + return NSGraphicsContext.currentContext.CGContext; +#endif +} + +void SDGraphicsBeginImageContext(CGSize size) { +#if SD_UIKIT || SD_WATCH + UIGraphicsBeginImageContext(size); +#else + SDGraphicsBeginImageContextWithOptions(size, NO, 1.0); +#endif +} + +void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { +#if SD_UIKIT || SD_WATCH + UIGraphicsBeginImageContextWithOptions(size, opaque, scale); +#else + CGContextRef context = SDCGContextCreateBitmapContext(size, opaque, scale); + if (!context) { + return; + } + NSGraphicsContext *graphicsContext = [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO]; + objc_setAssociatedObject(graphicsContext, &kNSGraphicsContextScaleFactorKey, @(scale), OBJC_ASSOCIATION_RETAIN); + CGContextRelease(context); + [NSGraphicsContext saveGraphicsState]; + NSGraphicsContext.currentContext = graphicsContext; +#endif +} + +void SDGraphicsEndImageContext(void) { +#if SD_UIKIT || SD_WATCH + UIGraphicsEndImageContext(); +#else + [NSGraphicsContext restoreGraphicsState]; +#endif +} + +UIImage * SDGraphicsGetImageFromCurrentImageContext(void) { +#if SD_UIKIT || SD_WATCH + return UIGraphicsGetImageFromCurrentImageContext(); +#else + NSGraphicsContext *context = NSGraphicsContext.currentContext; + CGContextRef contextRef = context.CGContext; + if (!contextRef) { + return nil; + } + CGImageRef imageRef = CGBitmapContextCreateImage(contextRef); + if (!imageRef) { + return nil; + } + CGFloat scale = 0; + NSNumber *scaleFactor = objc_getAssociatedObject(context, &kNSGraphicsContextScaleFactorKey); + if ([scaleFactor isKindOfClass:[NSNumber class]]) { + scale = scaleFactor.doubleValue; + } + if (!scale) { + // reset to the scale factor of the device’s main screen if scale is 0. + scale = [NSScreen mainScreen].backingScaleFactor; + } + NSImage *image = [[NSImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp]; + CGImageRelease(imageRef); + return image; +#endif +} diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h new file mode 100644 index 0000000..f7dd661 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h @@ -0,0 +1,25 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + This coder is used for HEIC (HEIF with HEVC container codec) image format. + Image/IO provide the static HEIC (.heic) support in iOS 11/macOS 10.13/tvOS 11/watchOS 4+. + Image/IO provide the animated HEIC (.heics) support in iOS 13/macOS 10.15/tvOS 13/watchOS 6+. + See https://nokiatech.github.io/heif/technical.html for the standard. + @note This coder is not in the default coder list for now, since HEIC animated image is really rare, and Apple's implementation still contains performance issues. You can enable if you need this. + @note If you need to support lower firmware version for HEIF, you can have a try at https://github.com/SDWebImage/SDWebImageHEIFCoder + */ +API_AVAILABLE(ios(13.0), tvos(13.0), macos(10.15), watchos(6.0)) +@interface SDImageHEICCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageHEICCoder *sharedCoder; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m new file mode 100644 index 0000000..4f6802a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m @@ -0,0 +1,104 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDImageHEICCoder.h" +#import "SDImageIOAnimatedCoderInternal.h" + +// These constants are available from iOS 13+ and Xcode 11. This raw value is used for toolchain and firmware compatibility +static NSString * kSDCGImagePropertyHEICSDictionary = @"{HEICS}"; +static NSString * kSDCGImagePropertyHEICSLoopCount = @"LoopCount"; +static NSString * kSDCGImagePropertyHEICSDelayTime = @"DelayTime"; +static NSString * kSDCGImagePropertyHEICSUnclampedDelayTime = @"UnclampedDelayTime"; + +@implementation SDImageHEICCoder + ++ (void)initialize { +#if __IPHONE_13_0 || __TVOS_13_0 || __MAC_10_15 || __WATCHOS_6_0 + // Xcode 11 + if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) { + // Use SDK instead of raw value + kSDCGImagePropertyHEICSDictionary = (__bridge NSString *)kCGImagePropertyHEICSDictionary; + kSDCGImagePropertyHEICSLoopCount = (__bridge NSString *)kCGImagePropertyHEICSLoopCount; + kSDCGImagePropertyHEICSDelayTime = (__bridge NSString *)kCGImagePropertyHEICSDelayTime; + kSDCGImagePropertyHEICSUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyHEICSUnclampedDelayTime; + } +#endif +} + ++ (instancetype)sharedCoder { + static SDImageHEICCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageHEICCoder alloc] init]; + }); + return coder; +} + +#pragma mark - SDImageCoder + +- (BOOL)canDecodeFromData:(nullable NSData *)data { + switch ([NSData sd_imageFormatForImageData:data]) { + case SDImageFormatHEIC: + // Check HEIC decoding compatibility + return [self.class canDecodeFromFormat:SDImageFormatHEIC]; + case SDImageFormatHEIF: + // Check HEIF decoding compatibility + return [self.class canDecodeFromFormat:SDImageFormatHEIF]; + default: + return NO; + } +} + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return [self canDecodeFromData:data]; +} + +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + switch (format) { + case SDImageFormatHEIC: + // Check HEIC encoding compatibility + return [self.class canEncodeToFormat:SDImageFormatHEIC]; + case SDImageFormatHEIF: + // Check HEIF encoding compatibility + return [self.class canEncodeToFormat:SDImageFormatHEIF]; + default: + return NO; + } +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatHEIC; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kSDUTTypeHEIC; +} + ++ (NSString *)dictionaryProperty { + return kSDCGImagePropertyHEICSDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return kSDCGImagePropertyHEICSUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return kSDCGImagePropertyHEICSDelayTime; +} + ++ (NSString *)loopCountProperty { + return kSDCGImagePropertyHEICSLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 0; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h new file mode 100644 index 0000000..3f4149a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h @@ -0,0 +1,59 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import +#import "SDImageCoder.h" + +/** + This is the abstract class for all animated coder, which use the Image/IO API. You can not use this directly as real coders. A exception will be raised if you use this class. + All of the properties need the subclass to implement and works as expected. + For Image/IO, See Apple's documentation: https://developer.apple.com/documentation/imageio + */ +@interface SDImageIOAnimatedCoder : NSObject + +#pragma mark - Subclass Override +/** + The supported animated image format. Such as `SDImageFormatGIF`. + @note Subclass override. + */ +@property (class, readonly) SDImageFormat imageFormat; +/** + The supported image format UTI Type. Such as `kUTTypeGIF`. + This can be used for cases when we can not detect `SDImageFormat. Such as progressive decoding's hint format `kCGImageSourceTypeIdentifierHint`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *imageUTType; +/** + The image container property key used in Image/IO API. Such as `kCGImagePropertyGIFDictionary`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *dictionaryProperty; +/** + The image unclamped delay time property key used in Image/IO API. Such as `kCGImagePropertyGIFUnclampedDelayTime` + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *unclampedDelayTimeProperty; +/** + The image delay time property key used in Image/IO API. Such as `kCGImagePropertyGIFDelayTime`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *delayTimeProperty; +/** + The image loop count property key used in Image/IO API. Such as `kCGImagePropertyGIFLoopCount`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *loopCountProperty; +/** + The default loop count when there are no any loop count information inside image container metadata. + For example, for GIF format, the standard use 1 (play once). For APNG format, the standard use 0 (infinity loop). + @note Subclass override. + */ +@property (class, readonly) NSUInteger defaultLoopCount; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m new file mode 100644 index 0000000..6fba3a6 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m @@ -0,0 +1,663 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDImageIOAnimatedCoder.h" +#import "NSImage+Compatibility.h" +#import "UIImage+Metadata.h" +#import "NSData+ImageContentType.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImageRep.h" +#import "UIImage+ForceDecode.h" + +// Specify DPI for vector format in CGImageSource, like PDF +static NSString * kSDCGImageSourceRasterizationDPI = @"kCGImageSourceRasterizationDPI"; +// Specify File Size for lossy format encoding, like JPEG +static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestinationRequestedFileSize"; + +@interface SDImageIOCoderFrame : NSObject + +@property (nonatomic, assign) NSUInteger index; // Frame index (zero based) +@property (nonatomic, assign) NSTimeInterval duration; // Frame duration in seconds + +@end + +@implementation SDImageIOCoderFrame +@end + +@implementation SDImageIOAnimatedCoder { + size_t _width, _height; + CGImageSourceRef _imageSource; + NSData *_imageData; + CGFloat _scale; + NSUInteger _loopCount; + NSUInteger _frameCount; + NSArray *_frames; + BOOL _finished; + BOOL _preserveAspectRatio; + CGSize _thumbnailSize; +} + +- (void)dealloc +{ + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification +{ + if (_imageSource) { + for (size_t i = 0; i < _frameCount; i++) { + CGImageSourceRemoveCacheAtIndex(_imageSource, i); + } + } +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)imageUTType { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)dictionaryProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)unclampedDelayTimeProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)delayTimeProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)loopCountProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSUInteger)defaultLoopCount { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + +#pragma mark - Utils + ++ (BOOL)canDecodeFromFormat:(SDImageFormat)format { + static dispatch_once_t onceToken; + static NSSet *imageUTTypeSet; + dispatch_once(&onceToken, ^{ + NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageSourceCopyTypeIdentifiers(); + imageUTTypeSet = [NSSet setWithArray:imageUTTypes]; + }); + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + if ([imageUTTypeSet containsObject:(__bridge NSString *)(imageUTType)]) { + // Can decode from target format + return YES; + } + return NO; +} + ++ (BOOL)canEncodeToFormat:(SDImageFormat)format { + static dispatch_once_t onceToken; + static NSSet *imageUTTypeSet; + dispatch_once(&onceToken, ^{ + NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageDestinationCopyTypeIdentifiers(); + imageUTTypeSet = [NSSet setWithArray:imageUTTypes]; + }); + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + if ([imageUTTypeSet containsObject:(__bridge NSString *)(imageUTType)]) { + // Can encode to target format + return YES; + } + return NO; +} + ++ (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source { + NSUInteger loopCount = self.defaultLoopCount; + NSDictionary *imageProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(source, NULL); + NSDictionary *containerProperties = imageProperties[self.dictionaryProperty]; + if (containerProperties) { + NSNumber *containerLoopCount = containerProperties[self.loopCountProperty]; + if (containerLoopCount != nil) { + loopCount = containerLoopCount.unsignedIntegerValue; + } + } + return loopCount; +} + ++ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { + NSDictionary *options = @{ + (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), + (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage + }; + NSTimeInterval frameDuration = 0.1; + CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options); + if (!cfFrameProperties) { + return frameDuration; + } + NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; + NSDictionary *containerProperties = frameProperties[self.dictionaryProperty]; + + NSNumber *delayTimeUnclampedProp = containerProperties[self.unclampedDelayTimeProperty]; + if (delayTimeUnclampedProp != nil) { + frameDuration = [delayTimeUnclampedProp doubleValue]; + } else { + NSNumber *delayTimeProp = containerProperties[self.delayTimeProperty]; + if (delayTimeProp != nil) { + frameDuration = [delayTimeProp doubleValue]; + } + } + + // Many annoying ads specify a 0 duration to make an image flash as quickly as possible. + // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify + // a duration of <= 10 ms. See and + // for more information. + + if (frameDuration < 0.011) { + frameDuration = 0.1; + } + + CFRelease(cfFrameProperties); + return frameDuration; +} + ++ (UIImage *)createFrameAtIndex:(NSUInteger)index source:(CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(NSDictionary *)options { + // Some options need to pass to `CGImageSourceCopyPropertiesAtIndex` before `CGImageSourceCreateImageAtIndex`, or ImageIO will ignore them because they parse once :) + // Parse the image properties + NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options); + NSUInteger pixelWidth = [properties[(__bridge NSString *)kCGImagePropertyPixelWidth] unsignedIntegerValue]; + NSUInteger pixelHeight = [properties[(__bridge NSString *)kCGImagePropertyPixelHeight] unsignedIntegerValue]; + CGImagePropertyOrientation exifOrientation = (CGImagePropertyOrientation)[properties[(__bridge NSString *)kCGImagePropertyOrientation] unsignedIntegerValue]; + if (!exifOrientation) { + exifOrientation = kCGImagePropertyOrientationUp; + } + + CFStringRef uttype = CGImageSourceGetType(source); + // Check vector format + BOOL isVector = NO; + if ([NSData sd_imageFormatFromUTType:uttype] == SDImageFormatPDF) { + isVector = YES; + } + + NSMutableDictionary *decodingOptions; + if (options) { + decodingOptions = [NSMutableDictionary dictionaryWithDictionary:options]; + } else { + decodingOptions = [NSMutableDictionary dictionary]; + } + CGImageRef imageRef; + BOOL createFullImage = thumbnailSize.width == 0 || thumbnailSize.height == 0 || pixelWidth == 0 || pixelHeight == 0 || (pixelWidth <= thumbnailSize.width && pixelHeight <= thumbnailSize.height); + if (createFullImage) { + if (isVector) { + if (thumbnailSize.width == 0 || thumbnailSize.height == 0) { + // Provide the default pixel count for vector images, simply just use the screen size +#if SD_WATCH + thumbnailSize = WKInterfaceDevice.currentDevice.screenBounds.size; +#elif SD_UIKIT + thumbnailSize = UIScreen.mainScreen.bounds.size; +#elif SD_MAC + thumbnailSize = NSScreen.mainScreen.frame.size; +#endif + } + CGFloat maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.height); + NSUInteger DPIPerPixel = 2; + NSUInteger rasterizationDPI = maxPixelSize * DPIPerPixel; + decodingOptions[kSDCGImageSourceRasterizationDPI] = @(rasterizationDPI); + } + imageRef = CGImageSourceCreateImageAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]); + } else { + decodingOptions[(__bridge NSString *)kCGImageSourceCreateThumbnailWithTransform] = @(preserveAspectRatio); + CGFloat maxPixelSize; + if (preserveAspectRatio) { + CGFloat pixelRatio = pixelWidth / pixelHeight; + CGFloat thumbnailRatio = thumbnailSize.width / thumbnailSize.height; + if (pixelRatio > thumbnailRatio) { + maxPixelSize = thumbnailSize.width; + } else { + maxPixelSize = thumbnailSize.height; + } + } else { + maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.height); + } + decodingOptions[(__bridge NSString *)kCGImageSourceThumbnailMaxPixelSize] = @(maxPixelSize); + decodingOptions[(__bridge NSString *)kCGImageSourceCreateThumbnailFromImageAlways] = @(YES); + imageRef = CGImageSourceCreateThumbnailAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]); + } + if (!imageRef) { + return nil; + } + // Thumbnail image post-process + if (!createFullImage) { + if (preserveAspectRatio) { + // kCGImageSourceCreateThumbnailWithTransform will apply EXIF transform as well, we should not apply twice + exifOrientation = kCGImagePropertyOrientationUp; + } else { + // `CGImageSourceCreateThumbnailAtIndex` take only pixel dimension, if not `preserveAspectRatio`, we should manual scale to the target size + CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:imageRef size:thumbnailSize]; + CGImageRelease(imageRef); + imageRef = scaledImageRef; + } + } + +#if SD_UIKIT || SD_WATCH + UIImageOrientation imageOrientation = [SDImageCoderHelper imageOrientationFromEXIFOrientation:exifOrientation]; + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:exifOrientation]; +#endif + CGImageRelease(imageRef); + return image; +} + +#pragma mark - Decode +- (BOOL)canDecodeFromData:(nullable NSData *)data { + return ([NSData sd_imageFormatForImageData:data] == self.class.imageFormat); +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + } + + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + +#if SD_MAC + // If don't use thumbnail, prefers the built-in generation of frames (GIF/APNG) + // Which decode frames in time and reduce memory usage + if (thumbnailSize.width == 0 || thumbnailSize.height == 0) { + SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; + NSSize size = NSMakeSize(imageRep.pixelsWide / scale, imageRep.pixelsHigh / scale); + imageRep.size = size; + NSImage *animatedImage = [[NSImage alloc] initWithSize:size]; + [animatedImage addRepresentation:imageRep]; + return animatedImage; + } +#endif + + CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!source) { + return nil; + } + size_t count = CGImageSourceGetCount(source); + UIImage *animatedImage; + + BOOL decodeFirstFrame = [options[SDImageCoderDecodeFirstFrameOnly] boolValue]; + if (decodeFirstFrame || count <= 1) { + animatedImage = [self.class createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil]; + } else { + NSMutableArray *frames = [NSMutableArray array]; + + for (size_t i = 0; i < count; i++) { + UIImage *image = [self.class createFrameAtIndex:i source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil]; + if (!image) { + continue; + } + + NSTimeInterval duration = [self.class frameDurationAtIndex:i source:source]; + + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; + [frames addObject:frame]; + } + + NSUInteger loopCount = [self.class imageLoopCountWithSource:source]; + + animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames]; + animatedImage.sd_imageLoopCount = loopCount; + } + animatedImage.sd_imageFormat = self.class.imageFormat; + CFRelease(source); + + return animatedImage; +} + +#pragma mark - Progressive Decode + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return ([NSData sd_imageFormatForImageData:data] == self.class.imageFormat); +} + +- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options { + self = [super init]; + if (self) { + NSString *imageUTType = self.class.imageUTType; + _imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : imageUTType}); + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished { + if (_finished) { + return; + } + _imageData = data; + _finished = finished; + + // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ + // Thanks to the author @Nyx0uf + + // Update the data source, we must pass ALL the data, not just the new bytes + CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished); + + if (_width + _height == 0) { + NSDictionary *options = @{ + (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), + (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage + }; + CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, (__bridge CFDictionaryRef)options); + if (properties) { + CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_height); + val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_width); + CFRelease(properties); + } + } + + // For animated image progressive decoding because the frame count and duration may be changed. + [self scanAndCheckFramesValidWithImageSource:_imageSource]; +} + +- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options { + UIImage *image; + + if (_width + _height > 0) { + // Create the image + CGFloat scale = _scale; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + image = [self.class createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil]; + if (image) { + image.sd_imageFormat = self.class.imageFormat; + } + } + + return image; +} + +#pragma mark - Encode +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + return (format == self.class.imageFormat); +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + // Earily return, supports CGImage only + return nil; + } + + if (format != self.class.imageFormat) { + return nil; + } + + NSMutableData *imageData = [NSMutableData data]; + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + NSArray *frames = [SDImageCoderHelper framesFromAnimatedImage:image]; + + // Create an image destination. Animated Image does not support EXIF image orientation TODO + // The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead. + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL); + if (!imageDestination) { + // Handle failure. + return nil; + } + NSMutableDictionary *properties = [NSMutableDictionary dictionary]; + // Encoding Options + double compressionQuality = 1; + if (options[SDImageCoderEncodeCompressionQuality]) { + compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue]; + } + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality); + CGColorRef backgroundColor = [options[SDImageCoderEncodeBackgroundColor] CGColor]; + if (backgroundColor) { + properties[(__bridge NSString *)kCGImageDestinationBackgroundColor] = (__bridge id)(backgroundColor); + } + CGSize maxPixelSize = CGSizeZero; + NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize]; + if (maxPixelSizeValue != nil) { +#if SD_MAC + maxPixelSize = maxPixelSizeValue.sizeValue; +#else + maxPixelSize = maxPixelSizeValue.CGSizeValue; +#endif + } + NSUInteger pixelWidth = CGImageGetWidth(imageRef); + NSUInteger pixelHeight = CGImageGetHeight(imageRef); + CGFloat finalPixelSize = 0; + if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > maxPixelSize.width && pixelHeight > maxPixelSize.height) { + CGFloat pixelRatio = pixelWidth / pixelHeight; + CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height; + if (pixelRatio > maxPixelSizeRatio) { + finalPixelSize = maxPixelSize.width; + } else { + finalPixelSize = maxPixelSize.height; + } + properties[(__bridge NSString *)kCGImageDestinationImageMaxPixelSize] = @(finalPixelSize); + } + NSUInteger maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue]; + if (maxFileSize > 0) { + properties[kSDCGImageDestinationRequestedFileSize] = @(maxFileSize); + // Remove the quality if we have file size limit + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = nil; + } + BOOL embedThumbnail = NO; + if (options[SDImageCoderEncodeEmbedThumbnail]) { + embedThumbnail = [options[SDImageCoderEncodeEmbedThumbnail] boolValue]; + } + properties[(__bridge NSString *)kCGImageDestinationEmbedThumbnail] = @(embedThumbnail); + + BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue]; + if (encodeFirstFrame || frames.count == 0) { + // for static single images + CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties); + } else { + // for animated images + NSUInteger loopCount = image.sd_imageLoopCount; + NSDictionary *containerProperties = @{ + self.class.dictionaryProperty: @{self.class.loopCountProperty : @(loopCount)} + }; + // container level properties (applies for `CGImageDestinationSetProperties`, not individual frames) + CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)containerProperties); + + for (size_t i = 0; i < frames.count; i++) { + SDImageFrame *frame = frames[i]; + NSTimeInterval frameDuration = frame.duration; + CGImageRef frameImageRef = frame.image.CGImage; + properties[self.class.dictionaryProperty] = @{self.class.delayTimeProperty : @(frameDuration)}; + CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)properties); + } + } + // Finalize the destination. + if (CGImageDestinationFinalize(imageDestination) == NO) { + // Handle failure. + imageData = nil; + } + + CFRelease(imageDestination); + + return [imageData copy]; +} + +#pragma mark - SDAnimatedImageCoder +- (nullable instancetype)initWithAnimatedImageData:(nullable NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + self = [super init]; + if (self) { + CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!imageSource) { + return nil; + } + BOOL framesValid = [self scanAndCheckFramesValidWithImageSource:imageSource]; + if (!framesValid) { + CFRelease(imageSource); + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; + _imageSource = imageSource; + _imageData = data; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (BOOL)scanAndCheckFramesValidWithImageSource:(CGImageSourceRef)imageSource { + if (!imageSource) { + return NO; + } + NSUInteger frameCount = CGImageSourceGetCount(imageSource); + NSUInteger loopCount = [self.class imageLoopCountWithSource:imageSource]; + NSMutableArray *frames = [NSMutableArray array]; + + for (size_t i = 0; i < frameCount; i++) { + SDImageIOCoderFrame *frame = [[SDImageIOCoderFrame alloc] init]; + frame.index = i; + frame.duration = [self.class frameDurationAtIndex:i source:imageSource]; + [frames addObject:frame]; + } + + _frameCount = frameCount; + _loopCount = loopCount; + _frames = [frames copy]; + + return YES; +} + +- (NSData *)animatedImageData { + return _imageData; +} + +- (NSUInteger)animatedImageLoopCount { + return _loopCount; +} + +- (NSUInteger)animatedImageFrameCount { + return _frameCount; +} + +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index { + if (index >= _frameCount) { + return 0; + } + return _frames[index].duration; +} + +- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index { + if (index >= _frameCount) { + return nil; + } + // Animated Image should not use the CGContext solution to force decode. Prefers to use Image/IO built in method, which is safer and memory friendly, see https://github.com/SDWebImage/SDWebImage/issues/2961 + NSDictionary *options = @{ + (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), + (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage + }; + UIImage *image = [self.class createFrameAtIndex:index source:_imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:options]; + if (!image) { + return nil; + } + image.sd_imageFormat = self.class.imageFormat; + image.sd_isDecoded = YES;; + return image; +} + +@end + diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h b/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h new file mode 100644 index 0000000..98682ed --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h @@ -0,0 +1,30 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageCoder.h" + +/** + Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding. + + GIF + Also supports static GIF (meaning will only handle the 1st frame). + For a full GIF support, we recommend `SDAnimatedImageView` to keep both CPU and memory balanced. + + HEIC + This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf + Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13) + Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU)) + Encode(Software): macOS 10.13 + Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU)) + */ +@interface SDImageIOCoder : NSObject + +@property (nonatomic, class, readonly, nonnull) SDImageIOCoder *sharedCoder; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m b/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m new file mode 100644 index 0000000..d858125 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m @@ -0,0 +1,292 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageIOCoder.h" +#import "SDImageCoderHelper.h" +#import "NSImage+Compatibility.h" +#import +#import "UIImage+Metadata.h" +#import "SDImageIOAnimatedCoderInternal.h" + +// Specify File Size for lossy format encoding, like JPEG +static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestinationRequestedFileSize"; + +@implementation SDImageIOCoder { + size_t _width, _height; + CGImagePropertyOrientation _orientation; + CGImageSourceRef _imageSource; + CGFloat _scale; + BOOL _finished; + BOOL _preserveAspectRatio; + CGSize _thumbnailSize; +} + +- (void)dealloc { + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification +{ + if (_imageSource) { + CGImageSourceRemoveCacheAtIndex(_imageSource, 0); + } +} + ++ (instancetype)sharedCoder { + static SDImageIOCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageIOCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Decode +- (BOOL)canDecodeFromData:(nullable NSData *)data { + return YES; +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1) ; + } + + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + } + + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + + CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!source) { + return nil; + } + + UIImage *image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil]; + CFRelease(source); + if (!image) { + return nil; + } + + image.sd_imageFormat = [NSData sd_imageFormatForImageData:data]; + return image; +} + +#pragma mark - Progressive Decode + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return [self canDecodeFromData:data]; +} + +- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options { + self = [super init]; + if (self) { + _imageSource = CGImageSourceCreateIncremental(NULL); + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished { + if (_finished) { + return; + } + _finished = finished; + + // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ + // Thanks to the author @Nyx0uf + + // Update the data source, we must pass ALL the data, not just the new bytes + CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished); + + if (_width + _height == 0) { + CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, NULL); + if (properties) { + NSInteger orientationValue = 1; + CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_height); + val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_width); + val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); + if (val) CFNumberGetValue(val, kCFNumberNSIntegerType, &orientationValue); + CFRelease(properties); + + // When we draw to Core Graphics, we lose orientation information, + // which means the image below born of initWithCGIImage will be + // oriented incorrectly sometimes. (Unlike the image born of initWithData + // in didCompleteWithError.) So save it here and pass it on later. + _orientation = (CGImagePropertyOrientation)orientationValue; + } + } +} + +- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options { + UIImage *image; + + if (_width + _height > 0) { + // Create the image + CGFloat scale = _scale; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil]; + if (image) { + CFStringRef uttype = CGImageSourceGetType(_imageSource); + image.sd_imageFormat = [NSData sd_imageFormatFromUTType:uttype]; + } + } + + return image; +} + +#pragma mark - Encode +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + return YES; +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + // Earily return, supports CGImage only + return nil; + } + + if (format == SDImageFormatUndefined) { + BOOL hasAlpha = [SDImageCoderHelper CGImageContainsAlpha:imageRef]; + if (hasAlpha) { + format = SDImageFormatPNG; + } else { + format = SDImageFormatJPEG; + } + } + + NSMutableData *imageData = [NSMutableData data]; + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + + // Create an image destination. + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL); + if (!imageDestination) { + // Handle failure. + return nil; + } + + NSMutableDictionary *properties = [NSMutableDictionary dictionary]; +#if SD_UIKIT || SD_WATCH + CGImagePropertyOrientation exifOrientation = [SDImageCoderHelper exifOrientationFromImageOrientation:image.imageOrientation]; +#else + CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp; +#endif + properties[(__bridge NSString *)kCGImagePropertyOrientation] = @(exifOrientation); + // Encoding Options + double compressionQuality = 1; + if (options[SDImageCoderEncodeCompressionQuality]) { + compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue]; + } + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality); + CGColorRef backgroundColor = [options[SDImageCoderEncodeBackgroundColor] CGColor]; + if (backgroundColor) { + properties[(__bridge NSString *)kCGImageDestinationBackgroundColor] = (__bridge id)(backgroundColor); + } + CGSize maxPixelSize = CGSizeZero; + NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize]; + if (maxPixelSizeValue != nil) { +#if SD_MAC + maxPixelSize = maxPixelSizeValue.sizeValue; +#else + maxPixelSize = maxPixelSizeValue.CGSizeValue; +#endif + } + NSUInteger pixelWidth = CGImageGetWidth(imageRef); + NSUInteger pixelHeight = CGImageGetHeight(imageRef); + if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > maxPixelSize.width && pixelHeight > maxPixelSize.height) { + CGFloat pixelRatio = pixelWidth / pixelHeight; + CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height; + CGFloat finalPixelSize; + if (pixelRatio > maxPixelSizeRatio) { + finalPixelSize = maxPixelSize.width; + } else { + finalPixelSize = maxPixelSize.height; + } + properties[(__bridge NSString *)kCGImageDestinationImageMaxPixelSize] = @(finalPixelSize); + } + NSUInteger maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue]; + if (maxFileSize > 0) { + properties[kSDCGImageDestinationRequestedFileSize] = @(maxFileSize); + // Remove the quality if we have file size limit + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = nil; + } + BOOL embedThumbnail = NO; + if (options[SDImageCoderEncodeEmbedThumbnail]) { + embedThumbnail = [options[SDImageCoderEncodeEmbedThumbnail] boolValue]; + } + properties[(__bridge NSString *)kCGImageDestinationEmbedThumbnail] = @(embedThumbnail); + + // Add your image to the destination. + CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties); + + // Finalize the destination. + if (CGImageDestinationFinalize(imageDestination) == NO) { + // Handle failure. + imageData = nil; + } + + CFRelease(imageDestination); + + return [imageData copy]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h b/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h new file mode 100644 index 0000000..9f1c952 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h @@ -0,0 +1,101 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageOperation.h" + +typedef void(^SDImageLoaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL); +typedef void(^SDImageLoaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished); + +#pragma mark - Context Options + +/** + A `UIImage` instance from `SDWebImageManager` when you specify `SDWebImageRefreshCached` and image cache hit. + This can be a hint for image loader to load the image from network and refresh the image from remote location if needed. If the image from remote location does not change, you should call the completion with `SDWebImageErrorCacheNotModified` error. (UIImage) + @note If you don't implement `SDWebImageRefreshCached` support, you do not need to care about this context option. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextLoaderCachedImage; + +#pragma mark - Helper method + +/** + This is the built-in decoding process for image download from network or local file. + @note If you want to implement your custom loader with `requestImageWithURL:options:context:progress:completed:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image. + + @param imageData The image data from the network. Should not be nil + @param imageURL The image URL from the input. Should not be nil + @param options The options arg from the input + @param context The context arg from the input + @return The decoded image for current image data load from the network + */ +FOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/** + This is the built-in decoding process for image progressive download from network. It's used when `SDWebImageProgressiveLoad` option is set. (It's not required when your loader does not support progressive image loading) + @note If you want to implement your custom loader with `requestImageWithURL:options:context:progress:completed:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image. + + @param imageData The image data from the network so far. Should not be nil + @param imageURL The image URL from the input. Should not be nil + @param finished Pass NO to specify the download process has not finished. Pass YES when all image data has finished. + @param operation The loader operation associated with current progressive download. Why to provide this is because progressive decoding need to store the partial decoded context for each operation to avoid conflict. You should provide the operation from `loadImageWithURL:` method return value. + @param options The options arg from the input + @param context The context arg from the input + @return The decoded progressive image for current image data load from the network + */ +FOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, BOOL finished, id _Nonnull operation, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +#pragma mark - SDImageLoader + +/** + This is the protocol to specify custom image load process. You can create your own class to conform this protocol and use as a image loader to load image from network or any available remote resources defined by yourself. + If you want to implement custom loader for image download from network or local file, you just need to concentrate on image data download only. After the download finish, call `SDImageLoaderDecodeImageData` or `SDImageLoaderDecodeProgressiveImageData` to use the built-in decoding process and produce image (Remember to call in the global queue). And finally callback the completion block. + If you directly get the image instance using some third-party SDKs, such as image directly from Photos framework. You can process the image data and image instance by yourself without that built-in decoding process. And finally callback the completion block. + @note It's your responsibility to load the image in the desired global queue(to avoid block main queue). We do not dispatch these method call in a global queue but just from the call queue (For `SDWebImageManager`, it typically call from the main queue). +*/ +@protocol SDImageLoader + +/** + Whether current image loader supports to load the provide image URL. + This will be checked every time a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`. + + @param url The image URL to be loaded. + @return YES to continue download, NO to stop download. + */ +- (BOOL)canRequestImageForURL:(nullable NSURL *)url; + +/** + Load the image and image data with the given URL and return the image data. You're responsible for producing the image instance. + + @param url The URL represent the image. Note this may not be a HTTP URL + @param options A mask to specify options to use for this request + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + @param completedBlock A block called when operation has been completed. + @return An operation which allow the user to cancel the current request. + */ +- (nullable id)requestImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDImageLoaderCompletedBlock)completedBlock; + + +/** + Whether the error from image loader should be marked indeed un-recoverable or not. + If this return YES, failed URL which does not using `SDWebImageRetryFailed` will be blocked into black list. Else not. + + @param url The URL represent the image. Note this may not be a HTTP URL + @param error The URL's loading error, from previous `requestImageWithURL:options:context:progress:completed:` completedBlock's error. + @return Whether to block this url or not. Return YES to mark this URL as failed. + */ +- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url + error:(nonnull NSError *)error; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m b/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m new file mode 100644 index 0000000..c529954 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m @@ -0,0 +1,200 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageLoader.h" +#import "SDWebImageCacheKeyFilter.h" +#import "SDImageCodersManager.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImage.h" +#import "UIImage+Metadata.h" +#import "SDInternalMacros.h" +#import "objc/runtime.h" + +static void * SDImageLoaderProgressiveCoderKey = &SDImageLoaderProgressiveCoderKey; + +UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + NSCParameterAssert(imageData); + NSCParameterAssert(imageURL); + + UIImage *image; + id cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + NSString *cacheKey; + if (cacheKeyFilter) { + cacheKey = [cacheKeyFilter cacheKeyForURL:imageURL]; + } else { + cacheKey = imageURL.absoluteString; + } + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; + CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + NSValue *thumbnailSizeValue; + BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages); + if (shouldScaleDown) { + CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4; + CGFloat dimension = ceil(sqrt(thumbnailPixels)); + thumbnailSizeValue = @(CGSizeMake(dimension, dimension)); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + } + + SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2]; + mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame); + mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale); + mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue; + mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue; + mutableCoderOptions[SDImageCoderWebImageContext] = context; + SDImageCoderOptions *coderOptions = [mutableCoderOptions copy]; + + // Grab the image coder + id imageCoder; + if ([context[SDWebImageContextImageCoder] conformsToProtocol:@protocol(SDImageCoder)]) { + imageCoder = context[SDWebImageContextImageCoder]; + } else { + imageCoder = [SDImageCodersManager sharedManager]; + } + + if (!decodeFirstFrame) { + // check whether we should use `SDAnimatedImage` + Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; + if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) { + image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions]; + if (image) { + // Preload frames if supported + if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) { + [((id)image) preloadAllFrames]; + } + } else { + // Check image class matching + if (options & SDWebImageMatchAnimatedImageClass) { + return nil; + } + } + } + } + if (!image) { + image = [imageCoder decodedImageWithData:imageData options:coderOptions]; + } + if (image) { + BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage); + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + // `SDAnimatedImage` do not decode + shouldDecode = NO; + } else if (image.sd_isAnimated) { + // animated image do not decode + shouldDecode = NO; + } + + if (shouldDecode) { + image = [SDImageCoderHelper decodedImageWithImage:image]; + } + } + + return image; +} + +UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, BOOL finished, id _Nonnull operation, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + NSCParameterAssert(imageData); + NSCParameterAssert(imageURL); + NSCParameterAssert(operation); + + UIImage *image; + id cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + NSString *cacheKey; + if (cacheKeyFilter) { + cacheKey = [cacheKeyFilter cacheKeyForURL:imageURL]; + } else { + cacheKey = imageURL.absoluteString; + } + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; + CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + NSValue *thumbnailSizeValue; + BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages); + if (shouldScaleDown) { + CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4; + CGFloat dimension = ceil(sqrt(thumbnailPixels)); + thumbnailSizeValue = @(CGSizeMake(dimension, dimension)); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + } + + SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2]; + mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame); + mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale); + mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue; + mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue; + mutableCoderOptions[SDImageCoderWebImageContext] = context; + SDImageCoderOptions *coderOptions = [mutableCoderOptions copy]; + + // Grab the progressive image coder + id progressiveCoder = objc_getAssociatedObject(operation, SDImageLoaderProgressiveCoderKey); + if (!progressiveCoder) { + id imageCoder = context[SDWebImageContextImageCoder]; + // Check the progressive coder if provided + if ([imageCoder conformsToProtocol:@protocol(SDProgressiveImageCoder)]) { + progressiveCoder = [[[imageCoder class] alloc] initIncrementalWithOptions:coderOptions]; + } else { + // We need to create a new instance for progressive decoding to avoid conflicts + for (id coder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) { + if ([coder conformsToProtocol:@protocol(SDProgressiveImageCoder)] && + [((id)coder) canIncrementalDecodeFromData:imageData]) { + progressiveCoder = [[[coder class] alloc] initIncrementalWithOptions:coderOptions]; + break; + } + } + } + objc_setAssociatedObject(operation, SDImageLoaderProgressiveCoderKey, progressiveCoder, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + // If we can't find any progressive coder, disable progressive download + if (!progressiveCoder) { + return nil; + } + + [progressiveCoder updateIncrementalData:imageData finished:finished]; + if (!decodeFirstFrame) { + // check whether we should use `SDAnimatedImage` + Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; + if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)] && [progressiveCoder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) { + image = [[animatedImageClass alloc] initWithAnimatedCoder:(id)progressiveCoder scale:scale]; + if (image) { + // Progressive decoding does not preload frames + } else { + // Check image class matching + if (options & SDWebImageMatchAnimatedImageClass) { + return nil; + } + } + } + } + if (!image) { + image = [progressiveCoder incrementalDecodedImageWithOptions:coderOptions]; + } + if (image) { + BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage); + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + // `SDAnimatedImage` do not decode + shouldDecode = NO; + } else if (image.sd_isAnimated) { + // animated image do not decode + shouldDecode = NO; + } + if (shouldDecode) { + image = [SDImageCoderHelper decodedImageWithImage:image]; + } + // mark the image as progressive (completionBlock one are not mark as progressive) + image.sd_isIncremental = YES; + } + + return image; +} + +SDWebImageContextOption const SDWebImageContextLoaderCachedImage = @"loaderCachedImage"; diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h b/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h new file mode 100644 index 0000000..9886f45 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h @@ -0,0 +1,40 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageLoader.h" + +/** + A loaders manager to manage multiple loaders + */ +@interface SDImageLoadersManager : NSObject + +/** + Returns the global shared loaders manager instance. By default we will set [`SDWebImageDownloader.sharedDownloader`] into the loaders array. + */ +@property (nonatomic, class, readonly, nonnull) SDImageLoadersManager *sharedManager; + +/** + All image loaders in manager. The loaders array is a priority queue, which means the later added loader will have the highest priority + */ +@property (nonatomic, copy, nullable) NSArray>* loaders; + +/** + Add a new image loader to the end of loaders array. Which has the highest priority. + + @param loader loader + */ +- (void)addLoader:(nonnull id)loader; + +/** + Remove an image loader in the loaders array. + + @param loader loader + */ +- (void)removeLoader:(nonnull id)loader; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m b/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m new file mode 100644 index 0000000..0c48e21 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m @@ -0,0 +1,114 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageLoadersManager.h" +#import "SDWebImageDownloader.h" +#import "SDInternalMacros.h" + +@interface SDImageLoadersManager () + +@property (nonatomic, strong, nonnull) dispatch_semaphore_t loadersLock; + +@end + +@implementation SDImageLoadersManager +{ + NSMutableArray>* _imageLoaders; +} + ++ (SDImageLoadersManager *)sharedManager { + static dispatch_once_t onceToken; + static SDImageLoadersManager *manager; + dispatch_once(&onceToken, ^{ + manager = [[SDImageLoadersManager alloc] init]; + }); + return manager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize with default image loaders + _imageLoaders = [NSMutableArray arrayWithObject:[SDWebImageDownloader sharedDownloader]]; + _loadersLock = dispatch_semaphore_create(1); + } + return self; +} + +- (NSArray> *)loaders { + SD_LOCK(self.loadersLock); + NSArray>* loaders = [_imageLoaders copy]; + SD_UNLOCK(self.loadersLock); + return loaders; +} + +- (void)setLoaders:(NSArray> *)loaders { + SD_LOCK(self.loadersLock); + [_imageLoaders removeAllObjects]; + if (loaders.count) { + [_imageLoaders addObjectsFromArray:loaders]; + } + SD_UNLOCK(self.loadersLock); +} + +#pragma mark - Loader Property + +- (void)addLoader:(id)loader { + if (![loader conformsToProtocol:@protocol(SDImageLoader)]) { + return; + } + SD_LOCK(self.loadersLock); + [_imageLoaders addObject:loader]; + SD_UNLOCK(self.loadersLock); +} + +- (void)removeLoader:(id)loader { + if (![loader conformsToProtocol:@protocol(SDImageLoader)]) { + return; + } + SD_LOCK(self.loadersLock); + [_imageLoaders removeObject:loader]; + SD_UNLOCK(self.loadersLock); +} + +#pragma mark - SDImageLoader + +- (BOOL)canRequestImageForURL:(nullable NSURL *)url { + NSArray> *loaders = self.loaders; + for (id loader in loaders.reverseObjectEnumerator) { + if ([loader canRequestImageForURL:url]) { + return YES; + } + } + return NO; +} + +- (id)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock { + if (!url) { + return nil; + } + NSArray> *loaders = self.loaders; + for (id loader in loaders.reverseObjectEnumerator) { + if ([loader canRequestImageForURL:url]) { + return [loader requestImageWithURL:url options:options context:context progress:progressBlock completed:completedBlock]; + } + } + return nil; +} + +- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error { + NSArray> *loaders = self.loaders; + for (id loader in loaders.reverseObjectEnumerator) { + if ([loader canRequestImageForURL:url]) { + return [loader shouldBlockFailedURLWithURL:url error:error]; + } + } + return NO; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h b/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h new file mode 100644 index 0000000..3031bfe --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h @@ -0,0 +1,241 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "UIImage+Transform.h" + +/** + Return the transformed cache key which applied with specify transformerKey. + + @param key The original cache key + @param transformerKey The transformer key from the transformer + @return The transformed cache key + */ +FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey); + +/** + Return the thumbnailed cache key which applied with specify thumbnailSize and preserveAspectRatio control. + @param key The original cache key + @param thumbnailPixelSize The thumbnail pixel size + @param preserveAspectRatio The preserve aspect ratio option + @return The thumbnailed cache key + @note If you have both transformer and thumbnail applied for image, call `SDThumbnailedKeyForKey` firstly and then with `SDTransformedKeyForKey`.` + */ +FOUNDATION_EXPORT NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio); + +/** + A transformer protocol to transform the image load from cache or from download. + You can provide transformer to cache and manager (Through the `transformer` property or context option `SDWebImageContextImageTransformer`). + + @note The transform process is called from a global queue in order to not to block the main queue. + */ +@protocol SDImageTransformer + +@required +/** + For each transformer, it must contains its cache key to used to store the image cache or query from the cache. This key will be appened after the original cache key generated by URL or from user. + + @return The cache key to appended after the original cache key. Should not be nil. + */ +@property (nonatomic, copy, readonly, nonnull) NSString *transformerKey; + +/** + Transform the image to another image. + + @param image The image to be transformed + @param key The cache key associated to the image. This arg is a hint for image source, not always useful and should be nullable. In the future we will remove this arg. + @return The transformed image, or nil if transform failed + */ +- (nullable UIImage *)transformedImageWithImage:(nonnull UIImage *)image forKey:(nonnull NSString *)key API_DEPRECATED("The key arg will be removed in the future. Update your code and don't rely on that.", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +@end + +#pragma mark - Pipeline + +/** + Pipeline transformer. Which you can bind multiple transformers together to let the image to be transformed one by one in order and generate the final image. + @note Because transformers are lightweight, if you want to append or arrange transformers, create another pipeline transformer instead. This class is considered as immutable. + */ +@interface SDImagePipelineTransformer : NSObject + +/** + All transformers in pipeline + */ +@property (nonatomic, copy, readonly, nonnull) NSArray> *transformers; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithTransformers:(nonnull NSArray> *)transformers; + +@end + +// There are some built-in transformers based on the `UIImage+Transformer` category to provide the common image geometry, image blending and image effect process. Those transform are useful for static image only but you can create your own to support animated image as well. +// Because transformers are lightweight, these class are considered as immutable. +#pragma mark - Image Geometry + +/** + Image round corner transformer + */ +@interface SDImageRoundCornerTransformer: NSObject + +/** + The radius of each corner oval. Values larger than half the + rectangle's width or height are clamped appropriately to + half the width or height. + */ +@property (nonatomic, assign, readonly) CGFloat cornerRadius; + +/** + A bitmask value that identifies the corners that you want + rounded. You can use this parameter to round only a subset + of the corners of the rectangle. + */ +@property (nonatomic, assign, readonly) SDRectCorner corners; + +/** + The inset border line width. Values larger than half the rectangle's + width or height are clamped appropriately to half the width + or height. + */ +@property (nonatomic, assign, readonly) CGFloat borderWidth; + +/** + The border stroke color. nil means clear color. + */ +@property (nonatomic, strong, readonly, nullable) UIColor *borderColor; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor; + +@end + +/** + Image resizing transformer + */ +@interface SDImageResizingTransformer : NSObject + +/** + The new size to be resized, values should be positive. + */ +@property (nonatomic, assign, readonly) CGSize size; + +/** + The scale mode for image content. + */ +@property (nonatomic, assign, readonly) SDImageScaleMode scaleMode; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode; + +@end + +/** + Image cropping transformer + */ +@interface SDImageCroppingTransformer : NSObject + +/** + Image's inner rect. + */ +@property (nonatomic, assign, readonly) CGRect rect; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithRect:(CGRect)rect; + +@end + +/** + Image flipping transformer + */ +@interface SDImageFlippingTransformer : NSObject + +/** + YES to flip the image horizontally. ⇋ + */ +@property (nonatomic, assign, readonly) BOOL horizontal; + +/** + YES to flip the image vertically. ⥯ + */ +@property (nonatomic, assign, readonly) BOOL vertical; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical; + +@end + +/** + Image rotation transformer + */ +@interface SDImageRotationTransformer : NSObject + +/** + Rotated radians in counterclockwise.⟲ + */ +@property (nonatomic, assign, readonly) CGFloat angle; + +/** + YES: new image's size is extend to fit all content. + NO: image's size will not change, content may be clipped. + */ +@property (nonatomic, assign, readonly) BOOL fitSize; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize; + +@end + +#pragma mark - Image Blending + +/** + Image tint color transformer + */ +@interface SDImageTintTransformer : NSObject + +/** + The tint color. + */ +@property (nonatomic, strong, readonly, nonnull) UIColor *tintColor; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithColor:(nonnull UIColor *)tintColor; + +@end + +#pragma mark - Image Effect + +/** + Image blur effect transformer + */ +@interface SDImageBlurTransformer : NSObject + +/** + The radius of the blur in points, 0 means no blur effect. + */ +@property (nonatomic, assign, readonly) CGFloat blurRadius; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithRadius:(CGFloat)blurRadius; + +@end + +#if SD_UIKIT || SD_MAC +/** + Core Image filter transformer + */ +@interface SDImageFilterTransformer: NSObject + +/** + The CIFilter to be applied to the image. + */ +@property (nonatomic, strong, readonly, nonnull) CIFilter *filter; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithFilter:(nonnull CIFilter *)filter; + +@end +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m b/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m new file mode 100644 index 0000000..8e7a3e2 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m @@ -0,0 +1,331 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageTransformer.h" +#import "UIColor+SDHexString.h" +#if SD_UIKIT || SD_MAC +#import +#endif + +// Separator for different transformerKey, for example, `image.png` |> flip(YES,NO) |> rotate(pi/4,YES) => 'image-SDImageFlippingTransformer(1,0)-SDImageRotationTransformer(0.78539816339,1).png' +static NSString * const SDImageTransformerKeySeparator = @"-"; + +NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey) { + if (!key || !transformerKey) { + return nil; + } + // Find the file extension + NSURL *keyURL = [NSURL URLWithString:key]; + NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension; + if (ext.length > 0) { + // For non-file URL + if (keyURL && !keyURL.isFileURL) { + // keep anything except path (like URL query) + NSURLComponents *component = [NSURLComponents componentsWithURL:keyURL resolvingAgainstBaseURL:NO]; + component.path = [[[component.path.stringByDeletingPathExtension stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey] stringByAppendingPathExtension:ext]; + return component.URL.absoluteString; + } else { + // file URL + return [[[key.stringByDeletingPathExtension stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey] stringByAppendingPathExtension:ext]; + } + } else { + return [[key stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey]; + } +} + +NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio) { + NSString *thumbnailKey = [NSString stringWithFormat:@"Thumbnail({%f,%f},%d)", thumbnailPixelSize.width, thumbnailPixelSize.height, preserveAspectRatio]; + return SDTransformedKeyForKey(key, thumbnailKey); +} + +@interface SDImagePipelineTransformer () + +@property (nonatomic, copy, readwrite, nonnull) NSArray> *transformers; +@property (nonatomic, copy, readwrite) NSString *transformerKey; + +@end + +@implementation SDImagePipelineTransformer + ++ (instancetype)transformerWithTransformers:(NSArray> *)transformers { + SDImagePipelineTransformer *transformer = [SDImagePipelineTransformer new]; + transformer.transformers = transformers; + transformer.transformerKey = [[self class] cacheKeyForTransformers:transformers]; + + return transformer; +} + ++ (NSString *)cacheKeyForTransformers:(NSArray> *)transformers { + if (transformers.count == 0) { + return @""; + } + NSMutableArray *cacheKeys = [NSMutableArray arrayWithCapacity:transformers.count]; + [transformers enumerateObjectsUsingBlock:^(id _Nonnull transformer, NSUInteger idx, BOOL * _Nonnull stop) { + NSString *cacheKey = transformer.transformerKey; + [cacheKeys addObject:cacheKey]; + }]; + + return [cacheKeys componentsJoinedByString:SDImageTransformerKeySeparator]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + UIImage *transformedImage = image; + for (id transformer in self.transformers) { + transformedImage = [transformer transformedImageWithImage:transformedImage forKey:key]; + } + return transformedImage; +} + +@end + +@interface SDImageRoundCornerTransformer () + +@property (nonatomic, assign) CGFloat cornerRadius; +@property (nonatomic, assign) SDRectCorner corners; +@property (nonatomic, assign) CGFloat borderWidth; +@property (nonatomic, strong, nullable) UIColor *borderColor; + +@end + +@implementation SDImageRoundCornerTransformer + ++ (instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor { + SDImageRoundCornerTransformer *transformer = [SDImageRoundCornerTransformer new]; + transformer.cornerRadius = cornerRadius; + transformer.corners = corners; + transformer.borderWidth = borderWidth; + transformer.borderColor = borderColor; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageRoundCornerTransformer(%f,%lu,%f,%@)", self.cornerRadius, (unsigned long)self.corners, self.borderWidth, self.borderColor.sd_hexString]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_roundedCornerImageWithRadius:self.cornerRadius corners:self.corners borderWidth:self.borderWidth borderColor:self.borderColor]; +} + +@end + +@interface SDImageResizingTransformer () + +@property (nonatomic, assign) CGSize size; +@property (nonatomic, assign) SDImageScaleMode scaleMode; + +@end + +@implementation SDImageResizingTransformer + ++ (instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode { + SDImageResizingTransformer *transformer = [SDImageResizingTransformer new]; + transformer.size = size; + transformer.scaleMode = scaleMode; + + return transformer; +} + +- (NSString *)transformerKey { + CGSize size = self.size; + return [NSString stringWithFormat:@"SDImageResizingTransformer({%f,%f},%lu)", size.width, size.height, (unsigned long)self.scaleMode]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_resizedImageWithSize:self.size scaleMode:self.scaleMode]; +} + +@end + +@interface SDImageCroppingTransformer () + +@property (nonatomic, assign) CGRect rect; + +@end + +@implementation SDImageCroppingTransformer + ++ (instancetype)transformerWithRect:(CGRect)rect { + SDImageCroppingTransformer *transformer = [SDImageCroppingTransformer new]; + transformer.rect = rect; + + return transformer; +} + +- (NSString *)transformerKey { + CGRect rect = self.rect; + return [NSString stringWithFormat:@"SDImageCroppingTransformer({%f,%f,%f,%f})", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_croppedImageWithRect:self.rect]; +} + +@end + +@interface SDImageFlippingTransformer () + +@property (nonatomic, assign) BOOL horizontal; +@property (nonatomic, assign) BOOL vertical; + +@end + +@implementation SDImageFlippingTransformer + ++ (instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical { + SDImageFlippingTransformer *transformer = [SDImageFlippingTransformer new]; + transformer.horizontal = horizontal; + transformer.vertical = vertical; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageFlippingTransformer(%d,%d)", self.horizontal, self.vertical]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_flippedImageWithHorizontal:self.horizontal vertical:self.vertical]; +} + +@end + +@interface SDImageRotationTransformer () + +@property (nonatomic, assign) CGFloat angle; +@property (nonatomic, assign) BOOL fitSize; + +@end + +@implementation SDImageRotationTransformer + ++ (instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize { + SDImageRotationTransformer *transformer = [SDImageRotationTransformer new]; + transformer.angle = angle; + transformer.fitSize = fitSize; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageRotationTransformer(%f,%d)", self.angle, self.fitSize]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_rotatedImageWithAngle:self.angle fitSize:self.fitSize]; +} + +@end + +#pragma mark - Image Blending + +@interface SDImageTintTransformer () + +@property (nonatomic, strong, nonnull) UIColor *tintColor; + +@end + +@implementation SDImageTintTransformer + ++ (instancetype)transformerWithColor:(UIColor *)tintColor { + SDImageTintTransformer *transformer = [SDImageTintTransformer new]; + transformer.tintColor = tintColor; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageTintTransformer(%@)", self.tintColor.sd_hexString]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_tintedImageWithColor:self.tintColor]; +} + +@end + +#pragma mark - Image Effect + +@interface SDImageBlurTransformer () + +@property (nonatomic, assign) CGFloat blurRadius; + +@end + +@implementation SDImageBlurTransformer + ++ (instancetype)transformerWithRadius:(CGFloat)blurRadius { + SDImageBlurTransformer *transformer = [SDImageBlurTransformer new]; + transformer.blurRadius = blurRadius; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageBlurTransformer(%f)", self.blurRadius]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_blurredImageWithRadius:self.blurRadius]; +} + +@end + +#if SD_UIKIT || SD_MAC +@interface SDImageFilterTransformer () + +@property (nonatomic, strong, nonnull) CIFilter *filter; + +@end + +@implementation SDImageFilterTransformer + ++ (instancetype)transformerWithFilter:(CIFilter *)filter { + SDImageFilterTransformer *transformer = [SDImageFilterTransformer new]; + transformer.filter = filter; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageFilterTransformer(%@)", self.filter.name]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_filteredImageWithFilter:self.filter]; +} + +@end +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h b/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h new file mode 100644 index 0000000..43c39e8 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h @@ -0,0 +1,78 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@class SDImageCacheConfig; +/** + A protocol to allow custom memory cache used in SDImageCache. + */ +@protocol SDMemoryCache + +@required + +/** + Create a new memory cache instance with the specify cache config. You can check `maxMemoryCost` and `maxMemoryCount` used for memory cache. + + @param config The cache config to be used to create the cache. + @return The new memory cache instance. + */ +- (nonnull instancetype)initWithConfig:(nonnull SDImageCacheConfig *)config; + +/** + Returns the value associated with a given key. + + @param key An object identifying the value. If nil, just return nil. + @return The value associated with key, or nil if no value is associated with key. + */ +- (nullable id)objectForKey:(nonnull id)key; + +/** + Sets the value of the specified key in the cache (0 cost). + + @param object The object to be stored in the cache. If nil, it calls `removeObjectForKey:`. + @param key The key with which to associate the value. If nil, this method has no effect. + @discussion Unlike an NSMutableDictionary object, a cache does not copy the key + objects that are put into it. + */ +- (void)setObject:(nullable id)object forKey:(nonnull id)key; + +/** + Sets the value of the specified key in the cache, and associates the key-value + pair with the specified cost. + + @param object The object to store in the cache. If nil, it calls `removeObjectForKey`. + @param key The key with which to associate the value. If nil, this method has no effect. + @param cost The cost with which to associate the key-value pair. + @discussion Unlike an NSMutableDictionary object, a cache does not copy the key + objects that are put into it. + */ +- (void)setObject:(nullable id)object forKey:(nonnull id)key cost:(NSUInteger)cost; + +/** + Removes the value of the specified key in the cache. + + @param key The key identifying the value to be removed. If nil, this method has no effect. + */ +- (void)removeObjectForKey:(nonnull id)key; + +/** + Empties the cache immediately. + */ +- (void)removeAllObjects; + +@end + +/** + A memory cache which auto purge the cache on memory warning and support weak cache. + */ +@interface SDMemoryCache : NSCache + +@property (nonatomic, strong, nonnull, readonly) SDImageCacheConfig *config; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m b/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m new file mode 100644 index 0000000..b354b49 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m @@ -0,0 +1,155 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDMemoryCache.h" +#import "SDImageCacheConfig.h" +#import "UIImage+MemoryCacheCost.h" +#import "SDInternalMacros.h" + +static void * SDMemoryCacheContext = &SDMemoryCacheContext; + +@interface SDMemoryCache () + +@property (nonatomic, strong, nullable) SDImageCacheConfig *config; +#if SD_UIKIT +@property (nonatomic, strong, nonnull) NSMapTable *weakCache; // strong-weak cache +@property (nonatomic, strong, nonnull) dispatch_semaphore_t weakCacheLock; // a lock to keep the access to `weakCache` thread-safe +#endif +@end + +@implementation SDMemoryCache + +- (void)dealloc { + [_config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCost)) context:SDMemoryCacheContext]; + [_config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCount)) context:SDMemoryCacheContext]; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + self.delegate = nil; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _config = [[SDImageCacheConfig alloc] init]; + [self commonInit]; + } + return self; +} + +- (instancetype)initWithConfig:(SDImageCacheConfig *)config { + self = [super init]; + if (self) { + _config = config; + [self commonInit]; + } + return self; +} + +- (void)commonInit { + SDImageCacheConfig *config = self.config; + self.totalCostLimit = config.maxMemoryCost; + self.countLimit = config.maxMemoryCount; + + [config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCost)) options:0 context:SDMemoryCacheContext]; + [config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCount)) options:0 context:SDMemoryCacheContext]; + +#if SD_UIKIT + self.weakCache = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0]; + self.weakCacheLock = dispatch_semaphore_create(1); + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(didReceiveMemoryWarning:) + name:UIApplicationDidReceiveMemoryWarningNotification + object:nil]; +#endif +} + +// Current this seems no use on macOS (macOS use virtual memory and do not clear cache when memory warning). So we only override on iOS/tvOS platform. +#if SD_UIKIT +- (void)didReceiveMemoryWarning:(NSNotification *)notification { + // Only remove cache, but keep weak cache + [super removeAllObjects]; +} + +// `setObject:forKey:` just call this with 0 cost. Override this is enough +- (void)setObject:(id)obj forKey:(id)key cost:(NSUInteger)g { + [super setObject:obj forKey:key cost:g]; + if (!self.config.shouldUseWeakMemoryCache) { + return; + } + if (key && obj) { + // Store weak cache + SD_LOCK(self.weakCacheLock); + [self.weakCache setObject:obj forKey:key]; + SD_UNLOCK(self.weakCacheLock); + } +} + +- (id)objectForKey:(id)key { + id obj = [super objectForKey:key]; + if (!self.config.shouldUseWeakMemoryCache) { + return obj; + } + if (key && !obj) { + // Check weak cache + SD_LOCK(self.weakCacheLock); + obj = [self.weakCache objectForKey:key]; + SD_UNLOCK(self.weakCacheLock); + if (obj) { + // Sync cache + NSUInteger cost = 0; + if ([obj isKindOfClass:[UIImage class]]) { + cost = [(UIImage *)obj sd_memoryCost]; + } + [super setObject:obj forKey:key cost:cost]; + } + } + return obj; +} + +- (void)removeObjectForKey:(id)key { + [super removeObjectForKey:key]; + if (!self.config.shouldUseWeakMemoryCache) { + return; + } + if (key) { + // Remove weak cache + SD_LOCK(self.weakCacheLock); + [self.weakCache removeObjectForKey:key]; + SD_UNLOCK(self.weakCacheLock); + } +} + +- (void)removeAllObjects { + [super removeAllObjects]; + if (!self.config.shouldUseWeakMemoryCache) { + return; + } + // Manually remove should also remove weak cache + SD_LOCK(self.weakCacheLock); + [self.weakCache removeAllObjects]; + SD_UNLOCK(self.weakCacheLock); +} +#endif + +#pragma mark - KVO + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if (context == SDMemoryCacheContext) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxMemoryCost))]) { + self.totalCostLimit = self.config.maxMemoryCost; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxMemoryCount))]) { + self.countLimit = self.config.maxMemoryCount; + } + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h new file mode 100644 index 0000000..4f54dd8 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h @@ -0,0 +1,32 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url); + +/** + This is the protocol for cache key filter. + We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageCacheKeyFilter + +- (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url; + +@end + +/** + A cache key filter class with block. + */ +@interface SDWebImageCacheKeyFilter : NSObject + +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; ++ (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m new file mode 100644 index 0000000..b4ebb8b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m @@ -0,0 +1,39 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCacheKeyFilter.h" + +@interface SDWebImageCacheKeyFilter () + +@property (nonatomic, copy, nonnull) SDWebImageCacheKeyFilterBlock block; + +@end + +@implementation SDWebImageCacheKeyFilter + +- (instancetype)initWithBlock:(SDWebImageCacheKeyFilterBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)cacheKeyFilterWithBlock:(SDWebImageCacheKeyFilterBlock)block { + SDWebImageCacheKeyFilter *cacheKeyFilter = [[SDWebImageCacheKeyFilter alloc] initWithBlock:block]; + return cacheKeyFilter; +} + +- (NSString *)cacheKeyForURL:(NSURL *)url { + if (!self.block) { + return nil; + } + return self.block(url); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h new file mode 100644 index 0000000..3c271b1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h @@ -0,0 +1,36 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL); + +/** + This is the protocol for cache serializer. + We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageCacheSerializer + +/// Provide the image data associated to the image and store to disk cache +/// @param image The loaded image +/// @param data The original loaded image data +/// @param imageURL The image URL +- (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL; + +@end + +/** + A cache serializer class with block. + */ +@interface SDWebImageCacheSerializer : NSObject + +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; ++ (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m new file mode 100644 index 0000000..51528e6 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m @@ -0,0 +1,39 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCacheSerializer.h" + +@interface SDWebImageCacheSerializer () + +@property (nonatomic, copy, nonnull) SDWebImageCacheSerializerBlock block; + +@end + +@implementation SDWebImageCacheSerializer + +- (instancetype)initWithBlock:(SDWebImageCacheSerializerBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)cacheSerializerWithBlock:(SDWebImageCacheSerializerBlock)block { + SDWebImageCacheSerializer *cacheSerializer = [[SDWebImageCacheSerializer alloc] initWithBlock:block]; + return cacheSerializer; +} + +- (NSData *)cacheDataWithImage:(UIImage *)image originalData:(NSData *)data imageURL:(nullable NSURL *)imageURL { + if (!self.block) { + return nil; + } + return self.block(image, data, imageURL); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageCompat.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h similarity index 59% rename from Pods/SDWebImage/SDWebImage/SDWebImageCompat.h rename to Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h index f555c27..f47a248 100644 --- a/Pods/SDWebImage/SDWebImage/SDWebImageCompat.h +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h @@ -13,10 +13,9 @@ #error SDWebImage does not support Objective-C Garbage Collection #endif -// Apple's defines from TargetConditionals.h are a bit weird. // Seems like TARGET_OS_MAC is always defined (on all platforms). -// To determine if we are running on OSX, we can only relly on TARGET_OS_IPHONE=0 and all the other platforms -#if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH +// To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8 +#if TARGET_OS_OSX #define SD_MAC 1 #else #define SD_MAC 0 @@ -60,16 +59,21 @@ #ifndef UIView #define UIView NSView #endif -#else - #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 - #error SDWebImage doesn't support Deployment Target version < 5.0 + #ifndef UIColor + #define UIColor NSColor #endif - +#else #if SD_UIKIT #import #endif #if SD_WATCH #import + #ifndef UIView + #define UIView WKInterfaceObject + #endif + #ifndef UIImageView + #define UIImageView WKInterfaceImage + #endif #endif #endif @@ -81,31 +85,11 @@ #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type #endif -#if OS_OBJECT_USE_OBJC - #undef SDDispatchQueueRelease - #undef SDDispatchQueueSetterSementics - #define SDDispatchQueueRelease(q) - #define SDDispatchQueueSetterSementics strong -#else - #undef SDDispatchQueueRelease - #undef SDDispatchQueueSetterSementics - #define SDDispatchQueueRelease(q) (dispatch_release(q)) - #define SDDispatchQueueSetterSementics assign -#endif - -extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image); - -typedef void(^SDWebImageNoParamsBlock)(); - -extern NSString *const SDWebImageErrorDomain; - #ifndef dispatch_main_async_safe #define dispatch_main_async_safe(block)\ - if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) {\ + if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ block();\ } else {\ dispatch_async(dispatch_get_main_queue(), block);\ } #endif - -static int64_t kAsyncTestTimeout = 5; diff --git a/Pods/SDWebImage/SDWebImage/NSImage+WebCache.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m similarity index 56% rename from Pods/SDWebImage/SDWebImage/NSImage+WebCache.h rename to Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m index 7515d40..1297401 100644 --- a/Pods/SDWebImage/SDWebImage/NSImage+WebCache.h +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m @@ -8,16 +8,10 @@ #import "SDWebImageCompat.h" -#if SD_MAC - -#import - -@interface NSImage (WebCache) - -- (CGImageRef)CGImage; -- (NSArray *)images; -- (BOOL)isGIF; - -@end +#if !__has_feature(objc_arc) + #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag +#endif +#if !OS_OBJECT_USE_OBJC + #error SDWebImage need ARC for dispatch object #endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h new file mode 100644 index 0000000..43df046 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h @@ -0,0 +1,319 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +typedef void(^SDWebImageNoParamsBlock)(void); +typedef NSString * SDWebImageContextOption NS_EXTENSIBLE_STRING_ENUM; +typedef NSDictionary SDWebImageContext; +typedef NSMutableDictionary SDWebImageMutableContext; + +#pragma mark - Image scale + +/** + Return the image scale factor for the specify key, supports file name and url key. + This is the built-in way to check the scale factor when we have no context about it. Because scale factor is not stored in image data (It's typically from filename). + However, you can also provide custom scale factor as well, see `SDWebImageContextImageScaleFactor`. + + @param key The image cache key + @return The scale factor for image + */ +FOUNDATION_EXPORT CGFloat SDImageScaleFactorForKey(NSString * _Nullable key); + +/** + Scale the image with the scale factor for the specify key. If no need to scale, return the original image. + This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`. + @note This is actually a convenience function, which firstly call `SDImageScaleFactorForKey` and then call `SDScaledImageForScaleFactor`, kept for backward compatibility. + + @param key The image cache key + @param image The image + @return The scaled image + */ +FOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image); + +/** + Scale the image with the scale factor. If no need to scale, return the original image. + This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`. + + @param scale The image scale factor + @param image The image + @return The scaled image + */ +FOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage * _Nullable image); + +#pragma mark - WebCache Options + +/// WebCache options +typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { + /** + * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. + * This flag disable this blacklisting. + */ + SDWebImageRetryFailed = 1 << 0, + + /** + * By default, image downloads are started during UI interactions, this flags disable this feature, + * leading to delayed download on UIScrollView deceleration for instance. + */ + SDWebImageLowPriority = 1 << 1, + + /** + * This flag enables progressive download, the image is displayed progressively during download as a browser would do. + * By default, the image is only displayed once completely downloaded. + */ + SDWebImageProgressiveLoad = 1 << 2, + + /** + * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed. + * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation. + * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics. + * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image. + * + * Use this flag only if you can't make your URLs static with embedded cache busting parameter. + */ + SDWebImageRefreshCached = 1 << 3, + + /** + * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for + * extra time in background to let the request finish. If the background task expires the operation will be cancelled. + */ + SDWebImageContinueInBackground = 1 << 4, + + /** + * Handles cookies stored in NSHTTPCookieStore by setting + * NSMutableURLRequest.HTTPShouldHandleCookies = YES; + */ + SDWebImageHandleCookies = 1 << 5, + + /** + * Enable to allow untrusted SSL certificates. + * Useful for testing purposes. Use with caution in production. + */ + SDWebImageAllowInvalidSSLCertificates = 1 << 6, + + /** + * By default, images are loaded in the order in which they were queued. This flag moves them to + * the front of the queue. + */ + SDWebImageHighPriority = 1 << 7, + + /** + * By default, placeholder images are loaded while the image is loading. This flag will delay the loading + * of the placeholder image until after the image has finished loading. + */ + SDWebImageDelayPlaceholder = 1 << 8, + + /** + * We usually don't apply transform on animated images as most transformers could not manage animated images. + * Use this flag to transform them anyway. + */ + SDWebImageTransformAnimatedImage = 1 << 9, + + /** + * By default, image is added to the imageView after download. But in some cases, we want to + * have the hand before setting the image (apply a filter or add it with cross-fade animation for instance) + * Use this flag if you want to manually set the image in the completion when success + */ + SDWebImageAvoidAutoSetImage = 1 << 10, + + /** + * By default, images are decoded respecting their original size. + * This flag will scale down the images to a size compatible with the constrained memory of devices. + * To control the limit memory bytes, check `SDImageCoderHelper.defaultScaleDownLimitBytes` (Defaults to 60MB on iOS) + * This will actually translate to use context option `.imageThumbnailPixelSize` from v5.5.0 (Defaults to (3966, 3966) on iOS). Previously does not. + * This flags effect the progressive and animated images as well from v5.5.0. Previously does not. + * @note If you need detail controls, it's better to use context option `imageThumbnailPixelSize` and `imagePreserveAspectRatio` instead. + */ + SDWebImageScaleDownLargeImages = 1 << 11, + + /** + * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDWebImageQueryMemoryDataSync` + */ + SDWebImageQueryMemoryData = 1 << 12, + + /** + * By default, when you only specify `SDWebImageQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously. + * @note Query data synchronously is not recommend, unless you want to ensure the image is loaded in the same runloop to avoid flashing during cell reusing. + */ + SDWebImageQueryMemoryDataSync = 1 << 13, + + /** + * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously. + * @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page. + * @note Query data synchronously is not recommend, unless you want to ensure the image is loaded in the same runloop to avoid flashing during cell reusing. + */ + SDWebImageQueryDiskDataSync = 1 << 14, + + /** + * By default, when the cache missed, the image is load from the loader. This flag can prevent this to load from cache only. + */ + SDWebImageFromCacheOnly = 1 << 15, + + /** + * By default, we query the cache before the image is load from the loader. This flag can prevent this to load from loader only. + */ + SDWebImageFromLoaderOnly = 1 << 16, + + /** + * By default, when you use `SDWebImageTransition` to do some view transition after the image load finished, this transition is only applied for image when the callback from manager is asynchronous (from network, or disk cache query) + * This mask can force to apply view transition for any cases, like memory cache query, or sync disk cache query. + */ + SDWebImageForceTransition = 1 << 17, + + /** + * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. + * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image. + */ + SDWebImageAvoidDecodeImage = 1 << 18, + + /** + * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image. + */ + SDWebImageDecodeFirstFrameOnly = 1 << 19, + + /** + * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. However, you can specify to preload all frames into memory to reduce CPU usage when the animated image is shared by lots of imageViews. + * This will actually trigger `preloadAllAnimatedImageFrames` in the background queue(Disk Cache & Download only). + */ + SDWebImagePreloadAllFrames = 1 << 20, + + /** + * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available to produce one exactlly matching your custom class as a fallback solution. + * Using this option, can ensure we always callback image with your provided class. If failed to produce one, a error with code `SDWebImageErrorBadImageData` will been used. + * Note this options is not compatible with `SDWebImageDecodeFirstFrameOnly`, which always produce a UIImage/NSImage. + */ + SDWebImageMatchAnimatedImageClass = 1 << 21, + + /** + * By default, when we load the image from network, the image will be written to the cache (memory and disk, controlled by your `storeCacheType` context option) + * This maybe an asynchronously operation and the final `SDInternalCompletionBlock` callback does not guarantee the disk cache written is finished and may cause logic error. (For example, you modify the disk data just in completion block, however, the disk cache is not ready) + * If you need to process with the disk cache in the completion block, you should use this option to ensure the disk cache already been written when callback. + * Note if you use this when using the custom cache serializer, or using the transformer, we will also wait until the output image data written is finished. + */ + SDWebImageWaitStoreCache = 1 << 22, + + /** + * We usually don't apply transform on vector images, because vector images supports dynamically changing to any size, rasterize to a fixed size will loss details. To modify vector images, you can process the vector data at runtime (such as modifying PDF tag / SVG element). + * Use this flag to transform them anyway. + */ + SDWebImageTransformVectorImage = 1 << 23 +}; + + +#pragma mark - Context Options + +/** + A String to be used as the operation key for view category to store the image load operation. This is used for view instance which supports different image loading process. If nil, will use the class name as operation key. (NSString *) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextSetImageOperationKey; + +/** + A SDWebImageManager instance to control the image download and cache process using in UIImageView+WebCache category and likes. If not provided, use the shared manager (SDWebImageManager *) + @deprecated Deprecated in the future. This context options can be replaced by other context option control like `.imageCache`, `.imageLoader`, `.imageTransformer` (See below), which already matches all the properties in SDWebImageManager. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager API_DEPRECATED("Use individual context option like .imageCache, .imageLoader and .imageTransformer instead", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +/** + A id instance which conforms to `SDImageCache` protocol. It's used to override the image manager's cache during the image loading pipeline. + In other word, if you just want to specify a custom cache during image loading, you don't need to re-create a dummy SDWebImageManager instance with the cache. If not provided, use the image manager's cache (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCache; + +/** + A id instance which conforms to `SDImageLoader` protocol. It's used to override the image manager's loader during the image loading pipeline. + In other word, if you just want to specify a custom loader during image loading, you don't need to re-create a dummy SDWebImageManager instance with the loader. If not provided, use the image manager's cache (id) +*/ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageLoader; + +/** + A id instance which conforms to `SDImageCoder` protocol. It's used to override the default image coder for image decoding(including progressive) and encoding during the image loading process. + If you use this context option, we will not always use `SDImageCodersManager.shared` to loop through all registered coders and find the suitable one. Instead, we will arbitrarily use the exact provided coder without extra checking (We may not call `canDecodeFromData:`). + @note This is only useful for cases which you can ensure the loading url matches your coder, or you find it's too hard to write a common coder which can used for generic usage. This will bind the loading url with the coder logic, which is not always a good design, but possible. (id) +*/ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCoder; + +/** + A id instance which conforms `SDImageTransformer` protocol. It's used for image transform after the image load finished and store the transformed image to cache. If you provide one, it will ignore the `transformer` in manager and use provided one instead. If you pass NSNull, the transformer feature will be disabled. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageTransformer; + +/** + A CGFloat raw value which specify the image scale factor. The number should be greater than or equal to 1.0. If not provide or the number is invalid, we will use the cache key to specify the scale factor. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageScaleFactor; + +/** + A Boolean value indicating whether to keep the original aspect ratio when generating thumbnail images (or bitmap images from vector format). + Defaults to YES. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImagePreserveAspectRatio; + +/** + A CGSize raw value indicating whether or not to generate the thumbnail images (or bitmap images from vector format). When this value is provided, the decoder will generate a thumbnail image which pixel size is smaller than or equal to (depends the `.imagePreserveAspectRatio`) the value size. + @note When you pass `.preserveAspectRatio == NO`, the thumbnail image is stretched to match each dimension. When `.preserveAspectRatio == YES`, the thumbnail image's width is limited to pixel size's width, the thumbnail image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both. + Defaults to CGSizeZero, which means no thumbnail generation at all. (NSValue) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageThumbnailPixelSize; + +/** + A SDImageCacheType raw value which specify the source of cache to query. Specify `SDImageCacheTypeDisk` to query from disk cache only; `SDImageCacheTypeMemory` to query from memory only. And `SDImageCacheTypeAll` to query from both memory cache and disk cache. Specify `SDImageCacheTypeNone` is invalid and totally ignore the cache query. + If not provide or the value is invalid, we will use `SDImageCacheTypeAll`. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextQueryCacheType; + +/** + A SDImageCacheType raw value which specify the store cache type when the image has just been downloaded and will be stored to the cache. Specify `SDImageCacheTypeNone` to disable cache storage; `SDImageCacheTypeDisk` to store in disk cache only; `SDImageCacheTypeMemory` to store in memory only. And `SDImageCacheTypeAll` to store in both memory cache and disk cache. + If you use image transformer feature, this actually apply for the transformed image, but not the original image itself. Use `SDWebImageContextOriginalStoreCacheType` if you want to control the original image's store cache type at the same time. + If not provide or the value is invalid, we will use `SDImageCacheTypeAll`. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextStoreCacheType; + +/** + The same behavior like `SDWebImageContextQueryCacheType`, but control the query cache type for the original image when you use image transformer feature. This allows the detail control of cache query for these two images. For example, if you want to query the transformed image from both memory/disk cache, query the original image from disk cache only, use `[.queryCacheType : .all, .originalQueryCacheType : .disk]` + If not provide or the value is invalid, we will use `SDImageCacheTypeNone`, which does not query the original image from cache. (NSNumber) + @note Which means, if you set this value to not be `.none`, we will query the original image from cache, then do transform with transformer, instead of actual downloading, which can save bandwidth usage. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalQueryCacheType; + +/** + The same behavior like `SDWebImageContextStoreCacheType`, but control the store cache type for the original image when you use image transformer feature. This allows the detail control of cache storage for these two images. For example, if you want to store the transformed image into both memory/disk cache, store the original image into disk cache only, use `[.storeCacheType : .all, .originalStoreCacheType : .disk]` + If not provide or the value is invalid, we will use `SDImageCacheTypeNone`, which does not store the original image into cache. (NSNumber) + @note This only store the original image, if you want to use the original image without downloading in next query, specify `SDWebImageContextOriginalQueryCacheType` as well. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalStoreCacheType; + +/** + A Class object which the instance is a `UIImage/NSImage` subclass and adopt `SDAnimatedImage` protocol. We will call `initWithData:scale:options:` to create the instance (or `initWithAnimatedCoder:scale:` when using progressive download) . If the instance create failed, fallback to normal `UIImage/NSImage`. + This can be used to improve animated images rendering performance (especially memory usage on big animated images) with `SDAnimatedImageView` (Class). + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextAnimatedImageClass; + +/** + A id instance to modify the image download request. It's used for downloader to modify the original request from URL and options. If you provide one, it will ignore the `requestModifier` in downloader and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadRequestModifier; + +/** + A id instance to modify the image download response. It's used for downloader to modify the original response from URL and options. If you provide one, it will ignore the `responseModifier` in downloader and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadResponseModifier; + +/** + A id instance to decrypt the image download data. This can be used for image data decryption, such as Base64 encoded image. If you provide one, it will ignore the `decryptor` in downloader and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadDecryptor; + +/** + A id instance to convert an URL into a cache key. It's used when manager need cache key to use image cache. If you provide one, it will ignore the `cacheKeyFilter` in manager and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCacheKeyFilter; + +/** + A id instance to convert the decoded image, the source downloaded data, to the actual data. It's used for manager to store image to the disk cache. If you provide one, it will ignore the `cacheSerializer` in manager and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCacheSerializer; diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m new file mode 100644 index 0000000..4c58061 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m @@ -0,0 +1,139 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDefine.h" +#import "UIImage+Metadata.h" +#import "NSImage+Compatibility.h" +#import "SDAssociatedObject.h" + +#pragma mark - Image scale + +static inline NSArray * _Nonnull SDImageScaleFactors() { + return @[@2, @3]; +} + +inline CGFloat SDImageScaleFactorForKey(NSString * _Nullable key) { + CGFloat scale = 1; + if (!key) { + return scale; + } + // Check if target OS support scale +#if SD_WATCH + if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) +#elif SD_UIKIT + if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) +#elif SD_MAC + if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) +#endif + { + // a@2x.png -> 8 + if (key.length >= 8) { + // Fast check + BOOL isURL = [key hasPrefix:@"http://"] || [key hasPrefix:@"https://"]; + for (NSNumber *scaleFactor in SDImageScaleFactors()) { + // @2x. for file name and normal url + NSString *fileScale = [NSString stringWithFormat:@"@%@x.", scaleFactor]; + if ([key containsString:fileScale]) { + scale = scaleFactor.doubleValue; + return scale; + } + if (isURL) { + // %402x. for url encode + NSString *urlScale = [NSString stringWithFormat:@"%%40%@x.", scaleFactor]; + if ([key containsString:urlScale]) { + scale = scaleFactor.doubleValue; + return scale; + } + } + } + } + } + return scale; +} + +inline UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { + if (!image) { + return nil; + } + CGFloat scale = SDImageScaleFactorForKey(key); + return SDScaledImageForScaleFactor(scale, image); +} + +inline UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage * _Nullable image) { + if (!image) { + return nil; + } + if (scale <= 1) { + return image; + } + if (scale == image.scale) { + return image; + } + UIImage *scaledImage; + if (image.sd_isAnimated) { + UIImage *animatedImage; +#if SD_UIKIT || SD_WATCH + // `UIAnimatedImage` images share the same size and scale. + NSMutableArray *scaledImages = [NSMutableArray array]; + + for (UIImage *tempImage in image.images) { + UIImage *tempScaledImage = [[UIImage alloc] initWithCGImage:tempImage.CGImage scale:scale orientation:tempImage.imageOrientation]; + [scaledImages addObject:tempScaledImage]; + } + + animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; + animatedImage.sd_imageLoopCount = image.sd_imageLoopCount; +#else + // Animated GIF for `NSImage` need to grab `NSBitmapImageRep`; + NSRect imageRect = NSMakeRect(0, 0, image.size.width, image.size.height); + NSImageRep *imageRep = [image bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + NSSize size = NSMakeSize(image.size.width / scale, image.size.height / scale); + animatedImage = [[NSImage alloc] initWithSize:size]; + bitmapImageRep.size = size; + [animatedImage addRepresentation:bitmapImageRep]; + } +#endif + scaledImage = animatedImage; + } else { +#if SD_UIKIT || SD_WATCH + scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; +#else + scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:kCGImagePropertyOrientationUp]; +#endif + } + SDImageCopyAssociatedObject(image, scaledImage); + + return scaledImage; +} + +#pragma mark - Context option + +SDWebImageContextOption const SDWebImageContextSetImageOperationKey = @"setImageOperationKey"; +SDWebImageContextOption const SDWebImageContextCustomManager = @"customManager"; +SDWebImageContextOption const SDWebImageContextImageCache = @"imageCache"; +SDWebImageContextOption const SDWebImageContextImageLoader = @"imageLoader"; +SDWebImageContextOption const SDWebImageContextImageCoder = @"imageCoder"; +SDWebImageContextOption const SDWebImageContextImageTransformer = @"imageTransformer"; +SDWebImageContextOption const SDWebImageContextImageScaleFactor = @"imageScaleFactor"; +SDWebImageContextOption const SDWebImageContextImagePreserveAspectRatio = @"imagePreserveAspectRatio"; +SDWebImageContextOption const SDWebImageContextImageThumbnailPixelSize = @"imageThumbnailPixelSize"; +SDWebImageContextOption const SDWebImageContextQueryCacheType = @"queryCacheType"; +SDWebImageContextOption const SDWebImageContextStoreCacheType = @"storeCacheType"; +SDWebImageContextOption const SDWebImageContextOriginalQueryCacheType = @"originalQueryCacheType"; +SDWebImageContextOption const SDWebImageContextOriginalStoreCacheType = @"originalStoreCacheType"; +SDWebImageContextOption const SDWebImageContextAnimatedImageClass = @"animatedImageClass"; +SDWebImageContextOption const SDWebImageContextDownloadRequestModifier = @"downloadRequestModifier"; +SDWebImageContextOption const SDWebImageContextDownloadResponseModifier = @"downloadResponseModifier"; +SDWebImageContextOption const SDWebImageContextDownloadDecryptor = @"downloadDecryptor"; +SDWebImageContextOption const SDWebImageContextCacheKeyFilter = @"cacheKeyFilter"; +SDWebImageContextOption const SDWebImageContextCacheSerializer = @"cacheSerializer"; diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h new file mode 100644 index 0000000..49ecd5d --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h @@ -0,0 +1,314 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageOperation.h" +#import "SDWebImageDownloaderConfig.h" +#import "SDWebImageDownloaderRequestModifier.h" +#import "SDWebImageDownloaderResponseModifier.h" +#import "SDWebImageDownloaderDecryptor.h" +#import "SDImageLoader.h" + +/// Downloader options +typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) { + /** + * Put the download in the low queue priority and task priority. + */ + SDWebImageDownloaderLowPriority = 1 << 0, + + /** + * This flag enables progressive download, the image is displayed progressively during download as a browser would do. + */ + SDWebImageDownloaderProgressiveLoad = 1 << 1, + + /** + * By default, request prevent the use of NSURLCache. With this flag, NSURLCache + * is used with default policies. + */ + SDWebImageDownloaderUseNSURLCache = 1 << 2, + + /** + * Call completion block with nil image/imageData if the image was read from NSURLCache + * And the error code is `SDWebImageErrorCacheNotModified` + * This flag should be combined with `SDWebImageDownloaderUseNSURLCache`. + */ + SDWebImageDownloaderIgnoreCachedResponse = 1 << 3, + + /** + * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for + * extra time in background to let the request finish. If the background task expires the operation will be cancelled. + */ + SDWebImageDownloaderContinueInBackground = 1 << 4, + + /** + * Handles cookies stored in NSHTTPCookieStore by setting + * NSMutableURLRequest.HTTPShouldHandleCookies = YES; + */ + SDWebImageDownloaderHandleCookies = 1 << 5, + + /** + * Enable to allow untrusted SSL certificates. + * Useful for testing purposes. Use with caution in production. + */ + SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6, + + /** + * Put the download in the high queue priority and task priority. + */ + SDWebImageDownloaderHighPriority = 1 << 7, + + /** + * By default, images are decoded respecting their original size. On iOS, this flag will scale down the + * images to a size compatible with the constrained memory of devices. + * This flag take no effect if `SDWebImageDownloaderAvoidDecodeImage` is set. And it will be ignored if `SDWebImageDownloaderProgressiveLoad` is set. + */ + SDWebImageDownloaderScaleDownLargeImages = 1 << 8, + + /** + * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. + * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image. + */ + SDWebImageDownloaderAvoidDecodeImage = 1 << 9, + + /** + * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image. + */ + SDWebImageDownloaderDecodeFirstFrameOnly = 1 << 10, + + /** + * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from network + */ + SDWebImageDownloaderPreloadAllFrames = 1 << 11, + + /** + * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution. + * Using this option, can ensure we always produce image with your provided class. If failed, a error with code `SDWebImageErrorBadImageData` will been used. + * Note this options is not compatible with `SDWebImageDownloaderDecodeFirstFrameOnly`, which always produce a UIImage/NSImage. + */ + SDWebImageDownloaderMatchAnimatedImageClass = 1 << 12, +}; + +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStartNotification; +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadReceiveResponseNotification; +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStopNotification; +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadFinishNotification; + +typedef SDImageLoaderProgressBlock SDWebImageDownloaderProgressBlock; +typedef SDImageLoaderCompletedBlock SDWebImageDownloaderCompletedBlock; + +/** + * A token associated with each download. Can be used to cancel a download + */ +@interface SDWebImageDownloadToken : NSObject + +/** + Cancel the current download. + */ +- (void)cancel; + +/** + The download's URL. + */ +@property (nonatomic, strong, nullable, readonly) NSURL *url; + +/** + The download's request. + */ +@property (nonatomic, strong, nullable, readonly) NSURLRequest *request; + +/** + The download's response. + */ +@property (nonatomic, strong, nullable, readonly) NSURLResponse *response; + +/** + The download's metrics. This will be nil if download operation does not support metrics. + */ +@property (nonatomic, strong, nullable, readonly) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@end + + +/** + * Asynchronous downloader dedicated and optimized for image loading. + */ +@interface SDWebImageDownloader : NSObject + +/** + * Downloader Config object - storing all kind of settings. + * Most config properties support dynamic changes during download, except something like `sessionConfiguration`, see `SDWebImageDownloaderConfig` for more detail. + */ +@property (nonatomic, copy, readonly, nonnull) SDWebImageDownloaderConfig *config; + +/** + * Set the request modifier to modify the original download request before image load. + * This request modifier method will be called for each downloading image request. Return the original request means no modification. Return nil will cancel the download request. + * Defaults to nil, means does not modify the original download request. + * @note If you want to modify single request, consider using `SDWebImageContextDownloadRequestModifier` context option. + */ +@property (nonatomic, strong, nullable) id requestModifier; + +/** + * Set the response modifier to modify the original download response during image load. + * This request modifier method will be called for each downloading image response. Return the original response means no modification. Return nil will mark current download as cancelled. + * Defaults to nil, means does not modify the original download response. + * @note If you want to modify single response, consider using `SDWebImageContextDownloadResponseModifier` context option. + */ +@property (nonatomic, strong, nullable) id responseModifier; + +/** + * Set the decryptor to decrypt the original download data before image decoding. This can be used for encrypted image data, like Base64. + * This decryptor method will be called for each downloading image data. Return the original data means no modification. Return nil will mark this download failed. + * Defaults to nil, means does not modify the original download data. + * @note When using decryptor, progressive decoding will be disabled, to avoid data corrupt issue. + * @note If you want to decrypt single download data, consider using `SDWebImageContextDownloadDecryptor` context option. + */ +@property (nonatomic, strong, nullable) id decryptor; + +/** + * The configuration in use by the internal NSURLSession. If you want to provide a custom sessionConfiguration, use `SDWebImageDownloaderConfig.sessionConfiguration` and create a new downloader instance. + @note This is immutable according to NSURLSession's documentation. Mutating this object directly has no effect. + */ +@property (nonatomic, readonly, nonnull) NSURLSessionConfiguration *sessionConfiguration; + +/** + * Gets/Sets the download queue suspension state. + */ +@property (nonatomic, assign, getter=isSuspended) BOOL suspended; + +/** + * Shows the current amount of downloads that still need to be downloaded + */ +@property (nonatomic, assign, readonly) NSUInteger currentDownloadCount; + +/** + * Returns the global shared downloader instance. Which use the `SDWebImageDownloaderConfig.defaultDownloaderConfig` config. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImageDownloader *sharedDownloader; + +/** + Creates an instance of a downloader with specified downloader config. + You can specify session configuration, timeout or operation class through downloader config. + + @param config The downloader config. If you specify nil, the `defaultDownloaderConfig` will be used. + @return new instance of downloader class + */ +- (nonnull instancetype)initWithConfig:(nullable SDWebImageDownloaderConfig *)config NS_DESIGNATED_INITIALIZER; + +/** + * Set a value for a HTTP header to be appended to each download HTTP request. + * + * @param value The value for the header field. Use `nil` value to remove the header field. + * @param field The name of the header field to set. + */ +- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field; + +/** + * Returns the value of the specified HTTP header field. + * + * @return The value associated with the header field field, or `nil` if there is no corresponding header field. + */ +- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field; + +/** + * Creates a SDWebImageDownloader async downloader instance with a given URL + * + * The delegate will be informed when the image is finish downloaded or an error has happen. + * + * @see SDWebImageDownloaderDelegate + * + * @param url The URL to the image to download + * @param completedBlock A block called once the download is completed. + * If the download succeeded, the image parameter is set, in case of error, + * error parameter is set with the error. The last parameter is always YES + * if SDWebImageDownloaderProgressiveDownload isn't use. With the + * SDWebImageDownloaderProgressiveDownload option, this block is called + * repeatedly with the partial image object and the finished argument set to NO + * before to be called a last time with the full image and finished argument + * set to YES. In case of error, the finished argument is always YES. + * + * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation + */ +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Creates a SDWebImageDownloader async downloader instance with a given URL + * + * The delegate will be informed when the image is finish downloaded or an error has happen. + * + * @see SDWebImageDownloaderDelegate + * + * @param url The URL to the image to download + * @param options The options to be used for this download + * @param progressBlock A block called repeatedly while the image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called once the download is completed. + * If the download succeeded, the image parameter is set, in case of error, + * error parameter is set with the error. The last parameter is always YES + * if SDWebImageDownloaderProgressiveLoad isn't use. With the + * SDWebImageDownloaderProgressiveLoad option, this block is called + * repeatedly with the partial image object and the finished argument set to NO + * before to be called a last time with the full image and finished argument + * set to YES. In case of error, the finished argument is always YES. + * + * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation + */ +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + options:(SDWebImageDownloaderOptions)options + progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Creates a SDWebImageDownloader async downloader instance with a given URL + * + * The delegate will be informed when the image is finish downloaded or an error has happen. + * + * @see SDWebImageDownloaderDelegate + * + * @param url The URL to the image to download + * @param options The options to be used for this download + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called repeatedly while the image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called once the download is completed. + * + * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation + */ +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Cancels all download operations in the queue + */ +- (void)cancelAllDownloads; + +/** + * Invalidates the managed session, optionally canceling pending operations. + * @note If you use custom downloader instead of the shared downloader, you need call this method when you do not use it to avoid memory leak + * @param cancelPendingOperations Whether or not to cancel pending operations. + * @note Calling this method on the shared downloader has no effect. + */ +- (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations; + +@end + + +/** + SDWebImageDownloader is the built-in image loader conform to `SDImageLoader`. Which provide the HTTP/HTTPS/FTP download, or local file URL using NSURLSession. + However, this downloader class itself also support customization for advanced users. You can specify `operationClass` in download config to custom download operation, See `SDWebImageDownloaderOperation`. + If you want to provide some image loader which beyond network or local file, consider to create your own custom class conform to `SDImageLoader`. + */ +@interface SDWebImageDownloader (SDImageLoader) + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m new file mode 100644 index 0000000..3d354ad --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m @@ -0,0 +1,619 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloader.h" +#import "SDWebImageDownloaderConfig.h" +#import "SDWebImageDownloaderOperation.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" + +NSNotificationName const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification"; +NSNotificationName const SDWebImageDownloadReceiveResponseNotification = @"SDWebImageDownloadReceiveResponseNotification"; +NSNotificationName const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNotification"; +NSNotificationName const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinishNotification"; + +static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext; + +@interface SDWebImageDownloadToken () + +@property (nonatomic, strong, nullable, readwrite) NSURL *url; +@property (nonatomic, strong, nullable, readwrite) NSURLRequest *request; +@property (nonatomic, strong, nullable, readwrite) NSURLResponse *response; +@property (nonatomic, strong, nullable, readwrite) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); +@property (nonatomic, weak, nullable, readwrite) id downloadOperationCancelToken; +@property (nonatomic, weak, nullable) NSOperation *downloadOperation; +@property (nonatomic, assign, getter=isCancelled) BOOL cancelled; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)new NS_UNAVAILABLE; +- (nonnull instancetype)initWithDownloadOperation:(nullable NSOperation *)downloadOperation; + +@end + +@interface SDWebImageDownloader () + +@property (strong, nonatomic, nonnull) NSOperationQueue *downloadQueue; +@property (strong, nonatomic, nonnull) NSMutableDictionary *> *URLOperations; +@property (strong, nonatomic, nullable) NSMutableDictionary *HTTPHeaders; +@property (strong, nonatomic, nonnull) dispatch_semaphore_t HTTPHeadersLock; // A lock to keep the access to `HTTPHeaders` thread-safe +@property (strong, nonatomic, nonnull) dispatch_semaphore_t operationsLock; // A lock to keep the access to `URLOperations` thread-safe + +// The session in which data tasks will run +@property (strong, nonatomic) NSURLSession *session; + +@end + +@implementation SDWebImageDownloader + ++ (void)initialize { + // Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator ) + // To use it, just add #import "SDNetworkActivityIndicator.h" in addition to the SDWebImage import + if (NSClassFromString(@"SDNetworkActivityIndicator")) { + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + id activityIndicator = [NSClassFromString(@"SDNetworkActivityIndicator") performSelector:NSSelectorFromString(@"sharedActivityIndicator")]; +#pragma clang diagnostic pop + + // Remove observer in case it was previously added. + [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStartNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStopNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:activityIndicator + selector:NSSelectorFromString(@"startActivity") + name:SDWebImageDownloadStartNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:activityIndicator + selector:NSSelectorFromString(@"stopActivity") + name:SDWebImageDownloadStopNotification object:nil]; + } +} + ++ (nonnull instancetype)sharedDownloader { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (nonnull instancetype)init { + return [self initWithConfig:SDWebImageDownloaderConfig.defaultDownloaderConfig]; +} + +- (instancetype)initWithConfig:(SDWebImageDownloaderConfig *)config { + self = [super init]; + if (self) { + if (!config) { + config = SDWebImageDownloaderConfig.defaultDownloaderConfig; + } + _config = [config copy]; + [_config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxConcurrentDownloads)) options:0 context:SDWebImageDownloaderContext]; + _downloadQueue = [NSOperationQueue new]; + _downloadQueue.maxConcurrentOperationCount = _config.maxConcurrentDownloads; + _downloadQueue.name = @"com.hackemist.SDWebImageDownloader"; + _URLOperations = [NSMutableDictionary new]; + NSMutableDictionary *headerDictionary = [NSMutableDictionary dictionary]; + NSString *userAgent = nil; +#if SD_UIKIT + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; +#elif SD_WATCH + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]]; +#elif SD_MAC + userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]; +#endif + if (userAgent) { + if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) { + NSMutableString *mutableUserAgent = [userAgent mutableCopy]; + if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) { + userAgent = mutableUserAgent; + } + } + headerDictionary[@"User-Agent"] = userAgent; + } + headerDictionary[@"Accept"] = @"image/*,*/*;q=0.8"; + _HTTPHeaders = headerDictionary; + _HTTPHeadersLock = dispatch_semaphore_create(1); + _operationsLock = dispatch_semaphore_create(1); + NSURLSessionConfiguration *sessionConfiguration = _config.sessionConfiguration; + if (!sessionConfiguration) { + sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; + } + /** + * Create the session for this task + * We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate + * method calls and completion handler calls. + */ + _session = [NSURLSession sessionWithConfiguration:sessionConfiguration + delegate:self + delegateQueue:nil]; + } + return self; +} + +- (void)dealloc { + [self.session invalidateAndCancel]; + self.session = nil; + + [self.downloadQueue cancelAllOperations]; + [self.config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxConcurrentDownloads)) context:SDWebImageDownloaderContext]; +} + +- (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations { + if (self == [SDWebImageDownloader sharedDownloader]) { + return; + } + if (cancelPendingOperations) { + [self.session invalidateAndCancel]; + } else { + [self.session finishTasksAndInvalidate]; + } +} + +- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field { + if (!field) { + return; + } + SD_LOCK(self.HTTPHeadersLock); + [self.HTTPHeaders setValue:value forKey:field]; + SD_UNLOCK(self.HTTPHeadersLock); +} + +- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field { + if (!field) { + return nil; + } + SD_LOCK(self.HTTPHeadersLock); + NSString *value = [self.HTTPHeaders objectForKey:field]; + SD_UNLOCK(self.HTTPHeadersLock); + return value; +} + +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url + completed:(SDWebImageDownloaderCompletedBlock)completedBlock { + return [self downloadImageWithURL:url options:0 progress:nil completed:completedBlock]; +} + +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url + options:(SDWebImageDownloaderOptions)options + progress:(SDWebImageDownloaderProgressBlock)progressBlock + completed:(SDWebImageDownloaderCompletedBlock)completedBlock { + return [self downloadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { + // The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data. + if (url == nil) { + if (completedBlock) { + NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @"Image url is nil"}]; + completedBlock(nil, nil, error, YES); + } + return nil; + } + + SD_LOCK(self.operationsLock); + id downloadOperationCancelToken; + NSOperation *operation = [self.URLOperations objectForKey:url]; + // There is a case that the operation may be marked as finished or cancelled, but not been removed from `self.URLOperations`. + if (!operation || operation.isFinished || operation.isCancelled) { + operation = [self createDownloaderOperationWithUrl:url options:options context:context]; + if (!operation) { + SD_UNLOCK(self.operationsLock); + if (completedBlock) { + NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @"Downloader operation is nil"}]; + completedBlock(nil, nil, error, YES); + } + return nil; + } + @weakify(self); + operation.completionBlock = ^{ + @strongify(self); + if (!self) { + return; + } + SD_LOCK(self.operationsLock); + [self.URLOperations removeObjectForKey:url]; + SD_UNLOCK(self.operationsLock); + }; + self.URLOperations[url] = operation; + // Add the handlers before submitting to operation queue, avoid the race condition that operation finished before setting handlers. + downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; + // Add operation to operation queue only after all configuration done according to Apple's doc. + // `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock. + [self.downloadQueue addOperation:operation]; + } else { + // When we reuse the download operation to attach more callbacks, there may be thread safe issue because the getter of callbacks may in another queue (decoding queue or delegate queue) + // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes. + @synchronized (operation) { + downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; + } + if (!operation.isExecuting) { + if (options & SDWebImageDownloaderHighPriority) { + operation.queuePriority = NSOperationQueuePriorityHigh; + } else if (options & SDWebImageDownloaderLowPriority) { + operation.queuePriority = NSOperationQueuePriorityLow; + } else { + operation.queuePriority = NSOperationQueuePriorityNormal; + } + } + } + SD_UNLOCK(self.operationsLock); + + SDWebImageDownloadToken *token = [[SDWebImageDownloadToken alloc] initWithDownloadOperation:operation]; + token.url = url; + token.request = operation.request; + token.downloadOperationCancelToken = downloadOperationCancelToken; + + return token; +} + +- (nullable NSOperation *)createDownloaderOperationWithUrl:(nonnull NSURL *)url + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context { + NSTimeInterval timeoutInterval = self.config.downloadTimeout; + if (timeoutInterval == 0.0) { + timeoutInterval = 15.0; + } + + // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise + NSURLRequestCachePolicy cachePolicy = options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData; + NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval]; + mutableRequest.HTTPShouldHandleCookies = SD_OPTIONS_CONTAINS(options, SDWebImageDownloaderHandleCookies); + mutableRequest.HTTPShouldUsePipelining = YES; + SD_LOCK(self.HTTPHeadersLock); + mutableRequest.allHTTPHeaderFields = self.HTTPHeaders; + SD_UNLOCK(self.HTTPHeadersLock); + + // Context Option + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + + // Request Modifier + id requestModifier; + if ([context valueForKey:SDWebImageContextDownloadRequestModifier]) { + requestModifier = [context valueForKey:SDWebImageContextDownloadRequestModifier]; + } else { + requestModifier = self.requestModifier; + } + + NSURLRequest *request; + if (requestModifier) { + NSURLRequest *modifiedRequest = [requestModifier modifiedRequestWithRequest:[mutableRequest copy]]; + // If modified request is nil, early return + if (!modifiedRequest) { + return nil; + } else { + request = [modifiedRequest copy]; + } + } else { + request = [mutableRequest copy]; + } + // Response Modifier + id responseModifier; + if ([context valueForKey:SDWebImageContextDownloadResponseModifier]) { + responseModifier = [context valueForKey:SDWebImageContextDownloadResponseModifier]; + } else { + responseModifier = self.responseModifier; + } + if (responseModifier) { + mutableContext[SDWebImageContextDownloadResponseModifier] = responseModifier; + } + // Decryptor + id decryptor; + if ([context valueForKey:SDWebImageContextDownloadDecryptor]) { + decryptor = [context valueForKey:SDWebImageContextDownloadDecryptor]; + } else { + decryptor = self.decryptor; + } + if (decryptor) { + mutableContext[SDWebImageContextDownloadDecryptor] = decryptor; + } + + context = [mutableContext copy]; + + // Operation Class + Class operationClass = self.config.operationClass; + if (operationClass && [operationClass isSubclassOfClass:[NSOperation class]] && [operationClass conformsToProtocol:@protocol(SDWebImageDownloaderOperation)]) { + // Custom operation class + } else { + operationClass = [SDWebImageDownloaderOperation class]; + } + NSOperation *operation = [[operationClass alloc] initWithRequest:request inSession:self.session options:options context:context]; + + if ([operation respondsToSelector:@selector(setCredential:)]) { + if (self.config.urlCredential) { + operation.credential = self.config.urlCredential; + } else if (self.config.username && self.config.password) { + operation.credential = [NSURLCredential credentialWithUser:self.config.username password:self.config.password persistence:NSURLCredentialPersistenceForSession]; + } + } + + if ([operation respondsToSelector:@selector(setMinimumProgressInterval:)]) { + operation.minimumProgressInterval = MIN(MAX(self.config.minimumProgressInterval, 0), 1); + } + + if (options & SDWebImageDownloaderHighPriority) { + operation.queuePriority = NSOperationQueuePriorityHigh; + } else if (options & SDWebImageDownloaderLowPriority) { + operation.queuePriority = NSOperationQueuePriorityLow; + } + + if (self.config.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) { + // Emulate LIFO execution order by systematically, each previous adding operation can dependency the new operation + // This can gurantee the new operation to be execulated firstly, even if when some operations finished, meanwhile you appending new operations + // Just make last added operation dependents new operation can not solve this problem. See test case #test15DownloaderLIFOExecutionOrder + for (NSOperation *pendingOperation in self.downloadQueue.operations) { + [pendingOperation addDependency:operation]; + } + } + + return operation; +} + +- (void)cancelAllDownloads { + [self.downloadQueue cancelAllOperations]; +} + +#pragma mark - Properties + +- (BOOL)isSuspended { + return self.downloadQueue.isSuspended; +} + +- (void)setSuspended:(BOOL)suspended { + self.downloadQueue.suspended = suspended; +} + +- (NSUInteger)currentDownloadCount { + return self.downloadQueue.operationCount; +} + +- (NSURLSessionConfiguration *)sessionConfiguration { + return self.session.configuration; +} + +#pragma mark - KVO + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if (context == SDWebImageDownloaderContext) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxConcurrentDownloads))]) { + self.downloadQueue.maxConcurrentOperationCount = self.config.maxConcurrentDownloads; + } + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +#pragma mark Helper methods + +- (NSOperation *)operationWithTask:(NSURLSessionTask *)task { + NSOperation *returnOperation = nil; + for (NSOperation *operation in self.downloadQueue.operations) { + if ([operation respondsToSelector:@selector(dataTask)]) { + // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes. + NSURLSessionTask *operationTask; + @synchronized (operation) { + operationTask = operation.dataTask; + } + if (operationTask.taskIdentifier == task.taskIdentifier) { + returnOperation = operation; + break; + } + } + } + return returnOperation; +} + +#pragma mark NSURLSessionDataDelegate + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:dataTask]; + if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:didReceiveResponse:completionHandler:)]) { + [dataOperation URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(NSURLSessionResponseAllow); + } + } +} + +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:dataTask]; + if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:didReceiveData:)]) { + [dataOperation URLSession:session dataTask:dataTask didReceiveData:data]; + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + willCacheResponse:(NSCachedURLResponse *)proposedResponse + completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:dataTask]; + if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:willCacheResponse:completionHandler:)]) { + [dataOperation URLSession:session dataTask:dataTask willCacheResponse:proposedResponse completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(proposedResponse); + } + } +} + +#pragma mark NSURLSessionTaskDelegate + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:didCompleteWithError:)]) { + [dataOperation URLSession:session task:task didCompleteWithError:error]; + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)]) { + [dataOperation URLSession:session task:task willPerformHTTPRedirection:response newRequest:request completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(request); + } + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:didReceiveChallenge:completionHandler:)]) { + [dataOperation URLSession:session task:task didReceiveChallenge:challenge completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); + } + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:didFinishCollectingMetrics:)]) { + [dataOperation URLSession:session task:task didFinishCollectingMetrics:metrics]; + } +} + +@end + +@implementation SDWebImageDownloadToken + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadStopNotification object:nil]; +} + +- (instancetype)initWithDownloadOperation:(NSOperation *)downloadOperation { + self = [super init]; + if (self) { + _downloadOperation = downloadOperation; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidReceiveResponse:) name:SDWebImageDownloadReceiveResponseNotification object:downloadOperation]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidStop:) name:SDWebImageDownloadStopNotification object:downloadOperation]; + } + return self; +} + +- (void)downloadDidReceiveResponse:(NSNotification *)notification { + NSOperation *downloadOperation = notification.object; + if (downloadOperation && downloadOperation == self.downloadOperation) { + self.response = downloadOperation.response; + } +} + +- (void)downloadDidStop:(NSNotification *)notification { + NSOperation *downloadOperation = notification.object; + if (downloadOperation && downloadOperation == self.downloadOperation) { + if ([downloadOperation respondsToSelector:@selector(metrics)]) { + if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, watchOS 3.0, *)) { + self.metrics = downloadOperation.metrics; + } + } + } +} + +- (void)cancel { + @synchronized (self) { + if (self.isCancelled) { + return; + } + self.cancelled = YES; + [self.downloadOperation cancel:self.downloadOperationCancelToken]; + self.downloadOperationCancelToken = nil; + } +} + +@end + +@implementation SDWebImageDownloader (SDImageLoader) + +- (BOOL)canRequestImageForURL:(NSURL *)url { + if (!url) { + return NO; + } + // Always pass YES to let URLSession or custom download operation to determine + return YES; +} + +- (id)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock { + UIImage *cachedImage = context[SDWebImageContextLoaderCachedImage]; + + SDWebImageDownloaderOptions downloaderOptions = 0; + if (options & SDWebImageLowPriority) downloaderOptions |= SDWebImageDownloaderLowPriority; + if (options & SDWebImageProgressiveLoad) downloaderOptions |= SDWebImageDownloaderProgressiveLoad; + if (options & SDWebImageRefreshCached) downloaderOptions |= SDWebImageDownloaderUseNSURLCache; + if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground; + if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies; + if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates; + if (options & SDWebImageHighPriority) downloaderOptions |= SDWebImageDownloaderHighPriority; + if (options & SDWebImageScaleDownLargeImages) downloaderOptions |= SDWebImageDownloaderScaleDownLargeImages; + if (options & SDWebImageAvoidDecodeImage) downloaderOptions |= SDWebImageDownloaderAvoidDecodeImage; + if (options & SDWebImageDecodeFirstFrameOnly) downloaderOptions |= SDWebImageDownloaderDecodeFirstFrameOnly; + if (options & SDWebImagePreloadAllFrames) downloaderOptions |= SDWebImageDownloaderPreloadAllFrames; + if (options & SDWebImageMatchAnimatedImageClass) downloaderOptions |= SDWebImageDownloaderMatchAnimatedImageClass; + + if (cachedImage && options & SDWebImageRefreshCached) { + // force progressive off if image already cached but forced refreshing + downloaderOptions &= ~SDWebImageDownloaderProgressiveLoad; + // ignore image read from NSURLCache if image if cached but force refreshing + downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse; + } + + return [self downloadImageWithURL:url options:downloaderOptions context:context progress:progressBlock completed:completedBlock]; +} + +- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error { + BOOL shouldBlockFailedURL; + // Filter the error domain and check error codes + if ([error.domain isEqualToString:SDWebImageErrorDomain]) { + shouldBlockFailedURL = ( error.code == SDWebImageErrorInvalidURL + || error.code == SDWebImageErrorBadImageData); + } else if ([error.domain isEqualToString:NSURLErrorDomain]) { + shouldBlockFailedURL = ( error.code != NSURLErrorNotConnectedToInternet + && error.code != NSURLErrorCancelled + && error.code != NSURLErrorTimedOut + && error.code != NSURLErrorInternationalRoamingOff + && error.code != NSURLErrorDataNotAllowed + && error.code != NSURLErrorCannotFindHost + && error.code != NSURLErrorCannotConnectToHost + && error.code != NSURLErrorNetworkConnectionLost); + } else { + shouldBlockFailedURL = NO; + } + return shouldBlockFailedURL; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h new file mode 100644 index 0000000..5a8cf58 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h @@ -0,0 +1,98 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// Operation execution order +typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { + /** + * Default value. All download operations will execute in queue style (first-in-first-out). + */ + SDWebImageDownloaderFIFOExecutionOrder, + + /** + * All download operations will execute in stack style (last-in-first-out). + */ + SDWebImageDownloaderLIFOExecutionOrder +}; + +/** + The class contains all the config for image downloader + @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well. + */ +@interface SDWebImageDownloaderConfig : NSObject + +/** + Gets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`. + @note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig; + +/** + * The maximum number of concurrent downloads. + * Defaults to 6. + */ +@property (nonatomic, assign) NSInteger maxConcurrentDownloads; + +/** + * The timeout value (in seconds) for each download operation. + * Defaults to 15.0. + */ +@property (nonatomic, assign) NSTimeInterval downloadTimeout; + +/** + * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected. + * The value should be 0.0-1.0. + * @note If you're using progressive decoding feature, this will also effect the image refresh rate. + * @note This value may enhance the performance if you don't want progress callback too frequently. + * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately. + */ +@property (nonatomic, assign) double minimumProgressInterval; + +/** + * The custom session configuration in use by NSURLSession. If you don't provide one, we will use `defaultSessionConfiguration` instead. + * Defatuls to nil. + * @note This property does not support dynamic changes, means it's immutable after the downloader instance initialized. + */ +@property (nonatomic, strong, nullable) NSURLSessionConfiguration *sessionConfiguration; + +/** + * Gets/Sets a subclass of `SDWebImageDownloaderOperation` as the default + * `NSOperation` to be used each time SDWebImage constructs a request + * operation to download an image. + * Defaults to nil. + * @note Passing `NSOperation` to set as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. + */ +@property (nonatomic, assign, nullable) Class operationClass; + +/** + * Changes download operations execution order. + * Defaults to `SDWebImageDownloaderFIFOExecutionOrder`. + */ +@property (nonatomic, assign) SDWebImageDownloaderExecutionOrder executionOrder; + +/** + * Set the default URL credential to be set for request operations. + * Defaults to nil. + */ +@property (nonatomic, copy, nullable) NSURLCredential *urlCredential; + +/** + * Set username using for HTTP Basic authentication. + * Defaults to nil. + */ +@property (nonatomic, copy, nullable) NSString *username; + +/** + * Set password using for HTTP Basic authentication. + * Defaults to nil. + */ +@property (nonatomic, copy, nullable) NSString *password; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m new file mode 100644 index 0000000..1fc9330 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m @@ -0,0 +1,49 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloaderConfig.h" + +static SDWebImageDownloaderConfig * _defaultDownloaderConfig; + +@implementation SDWebImageDownloaderConfig + ++ (SDWebImageDownloaderConfig *)defaultDownloaderConfig { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _defaultDownloaderConfig = [SDWebImageDownloaderConfig new]; + }); + return _defaultDownloaderConfig; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _maxConcurrentDownloads = 6; + _downloadTimeout = 15.0; + _executionOrder = SDWebImageDownloaderFIFOExecutionOrder; + } + return self; +} + +- (id)copyWithZone:(NSZone *)zone { + SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init]; + config.maxConcurrentDownloads = self.maxConcurrentDownloads; + config.downloadTimeout = self.downloadTimeout; + config.minimumProgressInterval = self.minimumProgressInterval; + config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone]; + config.operationClass = self.operationClass; + config.executionOrder = self.executionOrder; + config.urlCredential = self.urlCredential; + config.username = self.username; + config.password = self.password; + + return config; +} + + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h new file mode 100644 index 0000000..0923f29 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h @@ -0,0 +1,49 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +typedef NSData * _Nullable (^SDWebImageDownloaderDecryptorBlock)(NSData * _Nonnull data, NSURLResponse * _Nullable response); + +/** +This is the protocol for downloader decryptor. Which decrypt the original encrypted data before decoding. Note progressive decoding is not compatible for decryptor. +We can use a block to specify the downloader decryptor. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. +*/ +@protocol SDWebImageDownloaderDecryptor + +/// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm. +/// @param data The original download data +/// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable. +/// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData` +- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response; + +@end + +/** +A downloader response modifier class with block. +*/ +@interface SDWebImageDownloaderDecryptor : NSObject + +/// Create the data decryptor with block +/// @param block A block to control decrypt logic +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; + +/// Create the data decryptor with block +/// @param block A block to control decrypt logic ++ (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; + +@end + +/// Convenience way to create decryptor for common data encryption. +@interface SDWebImageDownloaderDecryptor (Conveniences) + +/// Base64 Encoded image data decryptor +@property (class, readonly, nonnull) SDWebImageDownloaderDecryptor *base64Decryptor; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m new file mode 100644 index 0000000..a3b75b2 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m @@ -0,0 +1,55 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageDownloaderDecryptor.h" + +@interface SDWebImageDownloaderDecryptor () + +@property (nonatomic, copy, nonnull) SDWebImageDownloaderDecryptorBlock block; + +@end + +@implementation SDWebImageDownloaderDecryptor + +- (instancetype)initWithBlock:(SDWebImageDownloaderDecryptorBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)decryptorWithBlock:(SDWebImageDownloaderDecryptorBlock)block { + SDWebImageDownloaderDecryptor *decryptor = [[SDWebImageDownloaderDecryptor alloc] initWithBlock:block]; + return decryptor; +} + +- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response { + if (!self.block) { + return nil; + } + return self.block(data, response); +} + +@end + +@implementation SDWebImageDownloaderDecryptor (Conveniences) + ++ (SDWebImageDownloaderDecryptor *)base64Decryptor { + static SDWebImageDownloaderDecryptor *decryptor; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + decryptor = [SDWebImageDownloaderDecryptor decryptorWithBlock:^NSData * _Nullable(NSData * _Nonnull data, NSURLResponse * _Nullable response) { + NSData *modifiedData = [[NSData alloc] initWithBase64EncodedData:data options:NSDataBase64DecodingIgnoreUnknownCharacters]; + return modifiedData; + }]; + }); + return decryptor; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h new file mode 100644 index 0000000..7f073b7 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h @@ -0,0 +1,153 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageDownloader.h" +#import "SDWebImageOperation.h" + +/** + Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol + For the description about these methods, see `SDWebImageDownloaderOperation` + @note If your custom operation class does not use `NSURLSession` at all, do not implement the optional methods and session delegate methods. + */ +@protocol SDWebImageDownloaderOperation +@required +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options; + +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context; + +- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +- (BOOL)cancel:(nullable id)token; + +@property (strong, nonatomic, readonly, nullable) NSURLRequest *request; +@property (strong, nonatomic, readonly, nullable) NSURLResponse *response; + +@optional +@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; +@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); +@property (strong, nonatomic, nullable) NSURLCredential *credential; +@property (assign, nonatomic) double minimumProgressInterval; + +@end + + +/** + The download operation class for SDWebImageDownloader. + */ +@interface SDWebImageDownloaderOperation : NSOperation + +/** + * The request used by the operation's task. + */ +@property (strong, nonatomic, readonly, nullable) NSURLRequest *request; + +/** + * The response returned by the operation's task. + */ +@property (strong, nonatomic, readonly, nullable) NSURLResponse *response; + +/** + * The operation's task + */ +@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; + +/** + * The collected metrics from `-URLSession:task:didFinishCollectingMetrics:`. + * This can be used to collect the network metrics like download duration, DNS lookup duration, SSL handshake duration, etc. See Apple's documentation: https://developer.apple.com/documentation/foundation/urlsessiontaskmetrics + */ +@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +/** + * The credential used for authentication challenges in `-URLSession:task:didReceiveChallenge:completionHandler:`. + * + * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. + */ +@property (strong, nonatomic, nullable) NSURLCredential *credential; + +/** + * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected. + * The value should be 0.0-1.0. + * @note If you're using progressive decoding feature, this will also effect the image refresh rate. + * @note This value may enhance the performance if you don't want progress callback too frequently. + * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately. + */ +@property (assign, nonatomic) double minimumProgressInterval; + +/** + * The options for the receiver. + */ +@property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; + +/** + * The context for the receiver. + */ +@property (copy, nonatomic, readonly, nullable) SDWebImageContext *context; + +/** + * Initializes a `SDWebImageDownloaderOperation` object + * + * @see SDWebImageDownloaderOperation + * + * @param request the URL request + * @param session the URL session in which this operation will run + * @param options downloader options + * + * @return the initialized instance + */ +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options; + +/** + * Initializes a `SDWebImageDownloaderOperation` object + * + * @see SDWebImageDownloaderOperation + * + * @param request the URL request + * @param session the URL session in which this operation will run + * @param options downloader options + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * + * @return the initialized instance + */ +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context NS_DESIGNATED_INITIALIZER; + +/** + * Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of + * callbacks. + * + * @param progressBlock the block executed when a new chunk of data arrives. + * @note the progress block is executed on a background queue + * @param completedBlock the block executed when the download is done. + * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue + * + * @return the token to use to cancel this set of handlers + */ +- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. + * + * @param token the token representing a set of callbacks to cancel + * + * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. + */ +- (BOOL)cancel:(nullable id)token; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m new file mode 100644 index 0000000..8d25f3b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m @@ -0,0 +1,561 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloaderOperation.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" +#import "SDWebImageDownloaderResponseModifier.h" +#import "SDWebImageDownloaderDecryptor.h" + +// iOS 8 Foundation.framework extern these symbol but the define is in CFNetwork.framework. We just fix this without import CFNetwork.framework +#if ((__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0) || (__MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11)) +const float NSURLSessionTaskPriorityHigh = 0.75; +const float NSURLSessionTaskPriorityDefault = 0.5; +const float NSURLSessionTaskPriorityLow = 0.25; +#endif + +static NSString *const kProgressCallbackKey = @"progress"; +static NSString *const kCompletedCallbackKey = @"completed"; + +typedef NSMutableDictionary SDCallbacksDictionary; + +@interface SDWebImageDownloaderOperation () + +@property (strong, nonatomic, nonnull) NSMutableArray *callbackBlocks; + +@property (assign, nonatomic, readwrite) SDWebImageDownloaderOptions options; +@property (copy, nonatomic, readwrite, nullable) SDWebImageContext *context; + +@property (assign, nonatomic, getter = isExecuting) BOOL executing; +@property (assign, nonatomic, getter = isFinished) BOOL finished; +@property (strong, nonatomic, nullable) NSMutableData *imageData; +@property (copy, nonatomic, nullable) NSData *cachedData; // for `SDWebImageDownloaderIgnoreCachedResponse` +@property (assign, nonatomic) NSUInteger expectedSize; // may be 0 +@property (assign, nonatomic) NSUInteger receivedSize; +@property (strong, nonatomic, nullable, readwrite) NSURLResponse *response; +@property (strong, nonatomic, nullable) NSError *responseError; +@property (assign, nonatomic) double previousProgress; // previous progress percent + +@property (strong, nonatomic, nullable) id responseModifier; // modify original URLResponse +@property (strong, nonatomic, nullable) id decryptor; // decrypt image data + +// This is weak because it is injected by whoever manages this session. If this gets nil-ed out, we won't be able to run +// the task associated with this operation +@property (weak, nonatomic, nullable) NSURLSession *unownedSession; +// This is set if we're using not using an injected NSURLSession. We're responsible of invalidating this one +@property (strong, nonatomic, nullable) NSURLSession *ownedSession; + +@property (strong, nonatomic, readwrite, nullable) NSURLSessionTask *dataTask; + +@property (strong, nonatomic, readwrite, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@property (strong, nonatomic, nonnull) NSOperationQueue *coderQueue; // the serial operation queue to do image decoding +#if SD_UIKIT +@property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId; +#endif + +@end + +@implementation SDWebImageDownloaderOperation + +@synthesize executing = _executing; +@synthesize finished = _finished; + +- (nonnull instancetype)init { + return [self initWithRequest:nil inSession:nil options:0]; +} + +- (instancetype)initWithRequest:(NSURLRequest *)request inSession:(NSURLSession *)session options:(SDWebImageDownloaderOptions)options { + return [self initWithRequest:request inSession:session options:options context:nil]; +} + +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context { + if ((self = [super init])) { + _request = [request copy]; + _options = options; + _context = [context copy]; + _callbackBlocks = [NSMutableArray new]; + _responseModifier = context[SDWebImageContextDownloadResponseModifier]; + _decryptor = context[SDWebImageContextDownloadDecryptor]; + _executing = NO; + _finished = NO; + _expectedSize = 0; + _unownedSession = session; + _coderQueue = [NSOperationQueue new]; + _coderQueue.maxConcurrentOperationCount = 1; +#if SD_UIKIT + _backgroundTaskId = UIBackgroundTaskInvalid; +#endif + } + return self; +} + +- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { + SDCallbacksDictionary *callbacks = [NSMutableDictionary new]; + if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy]; + if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy]; + @synchronized (self) { + [self.callbackBlocks addObject:callbacks]; + } + return callbacks; +} + +- (nullable NSArray *)callbacksForKey:(NSString *)key { + NSMutableArray *callbacks; + @synchronized (self) { + callbacks = [[self.callbackBlocks valueForKey:key] mutableCopy]; + } + // We need to remove [NSNull null] because there might not always be a progress block for each callback + [callbacks removeObjectIdenticalTo:[NSNull null]]; + return [callbacks copy]; // strip mutability here +} + +- (BOOL)cancel:(nullable id)token { + if (!token) return NO; + + BOOL shouldCancel = NO; + @synchronized (self) { + NSMutableArray *tempCallbackBlocks = [self.callbackBlocks mutableCopy]; + [tempCallbackBlocks removeObjectIdenticalTo:token]; + if (tempCallbackBlocks.count == 0) { + shouldCancel = YES; + } + } + if (shouldCancel) { + // Cancel operation running and callback last token's completion block + [self cancel]; + } else { + // Only callback this token's completion block + @synchronized (self) { + [self.callbackBlocks removeObjectIdenticalTo:token]; + } + SDWebImageDownloaderCompletedBlock completedBlock = [token valueForKey:kCompletedCallbackKey]; + dispatch_main_async_safe(^{ + if (completedBlock) { + completedBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}], YES); + } + }); + } + return shouldCancel; +} + +- (void)start { + @synchronized (self) { + if (self.isCancelled) { + self.finished = YES; + // Operation cancelled by user before sending the request + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user before sending the request"}]]; + [self reset]; + return; + } + +#if SD_UIKIT + Class UIApplicationClass = NSClassFromString(@"UIApplication"); + BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)]; + if (hasApplication && [self shouldContinueWhenAppEntersBackground]) { + __weak typeof(self) wself = self; + UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)]; + self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{ + [wself cancel]; + }]; + } +#endif + NSURLSession *session = self.unownedSession; + if (!session) { + NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; + sessionConfig.timeoutIntervalForRequest = 15; + + /** + * Create the session for this task + * We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate + * method calls and completion handler calls. + */ + session = [NSURLSession sessionWithConfiguration:sessionConfig + delegate:self + delegateQueue:nil]; + self.ownedSession = session; + } + + if (self.options & SDWebImageDownloaderIgnoreCachedResponse) { + // Grab the cached data for later check + NSURLCache *URLCache = session.configuration.URLCache; + if (!URLCache) { + URLCache = [NSURLCache sharedURLCache]; + } + NSCachedURLResponse *cachedResponse; + // NSURLCache's `cachedResponseForRequest:` is not thread-safe, see https://developer.apple.com/documentation/foundation/nsurlcache#2317483 + @synchronized (URLCache) { + cachedResponse = [URLCache cachedResponseForRequest:self.request]; + } + if (cachedResponse) { + self.cachedData = cachedResponse.data; + } + } + + self.dataTask = [session dataTaskWithRequest:self.request]; + self.executing = YES; + } + + if (self.dataTask) { + if (self.options & SDWebImageDownloaderHighPriority) { + self.dataTask.priority = NSURLSessionTaskPriorityHigh; + self.coderQueue.qualityOfService = NSQualityOfServiceUserInteractive; + } else if (self.options & SDWebImageDownloaderLowPriority) { + self.dataTask.priority = NSURLSessionTaskPriorityLow; + self.coderQueue.qualityOfService = NSQualityOfServiceBackground; + } else { + self.dataTask.priority = NSURLSessionTaskPriorityDefault; + self.coderQueue.qualityOfService = NSQualityOfServiceDefault; + } + [self.dataTask resume]; + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(0, NSURLResponseUnknownLength, self.request.URL); + } + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:strongSelf]; + }); + } else { + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @"Task can't be initialized"}]]; + [self done]; + } +} + +- (void)cancel { + @synchronized (self) { + [self cancelInternal]; + } +} + +- (void)cancelInternal { + if (self.isFinished) return; + [super cancel]; + + if (self.dataTask) { + [self.dataTask cancel]; + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf]; + }); + + // As we cancelled the task, its callback won't be called and thus won't + // maintain the isFinished and isExecuting flags. + if (self.isExecuting) self.executing = NO; + if (!self.isFinished) self.finished = YES; + } else { + // Operation cancelled by user during sending the request + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}]]; + } + + [self reset]; +} + +- (void)done { + self.finished = YES; + self.executing = NO; + [self reset]; +} + +- (void)reset { + @synchronized (self) { + [self.callbackBlocks removeAllObjects]; + self.dataTask = nil; + + if (self.ownedSession) { + [self.ownedSession invalidateAndCancel]; + self.ownedSession = nil; + } + +#if SD_UIKIT + if (self.backgroundTaskId != UIBackgroundTaskInvalid) { + // If backgroundTaskId != UIBackgroundTaskInvalid, sharedApplication is always exist + UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)]; + [app endBackgroundTask:self.backgroundTaskId]; + self.backgroundTaskId = UIBackgroundTaskInvalid; + } +#endif + } +} + +- (void)setFinished:(BOOL)finished { + [self willChangeValueForKey:@"isFinished"]; + _finished = finished; + [self didChangeValueForKey:@"isFinished"]; +} + +- (void)setExecuting:(BOOL)executing { + [self willChangeValueForKey:@"isExecuting"]; + _executing = executing; + [self didChangeValueForKey:@"isExecuting"]; +} + +- (BOOL)isConcurrent { + return YES; +} + +#pragma mark NSURLSessionDataDelegate + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { + NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow; + + // Check response modifier, if return nil, will marked as cancelled. + BOOL valid = YES; + if (self.responseModifier && response) { + response = [self.responseModifier modifiedResponseWithResponse:response]; + if (!response) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadResponse userInfo:@{NSLocalizedDescriptionKey : @"Download marked as failed because response is nil"}]; + } + } + + NSInteger expected = (NSInteger)response.expectedContentLength; + expected = expected > 0 ? expected : 0; + self.expectedSize = expected; + self.response = response; + + NSInteger statusCode = [response respondsToSelector:@selector(statusCode)] ? ((NSHTTPURLResponse *)response).statusCode : 200; + // Status code should between [200,400) + BOOL statusCodeValid = statusCode >= 200 && statusCode < 400; + if (!statusCodeValid) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadStatusCode userInfo:@{NSLocalizedDescriptionKey : @"Download marked as failed because response status code is not in 200-400", SDWebImageErrorDownloadStatusCodeKey : @(statusCode)}]; + } + //'304 Not Modified' is an exceptional one + //URLSession current behavior will return 200 status code when the server respond 304 and URLCache hit. But this is not a standard behavior and we just add a check + if (statusCode == 304 && !self.cachedData) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCacheNotModified userInfo:@{NSLocalizedDescriptionKey : @"Download response status code is 304 not modified and ignored"}]; + } + + if (valid) { + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(0, expected, self.request.URL); + } + } else { + // Status code invalid and marked as cancelled. Do not call `[self.dataTask cancel]` which may mass up URLSession life cycle + disposition = NSURLSessionResponseCancel; + } + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:strongSelf]; + }); + + if (completionHandler) { + completionHandler(disposition); + } +} + +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { + if (!self.imageData) { + self.imageData = [[NSMutableData alloc] initWithCapacity:self.expectedSize]; + } + [self.imageData appendData:data]; + + self.receivedSize = self.imageData.length; + if (self.expectedSize == 0) { + // Unknown expectedSize, immediately call progressBlock and return + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(self.receivedSize, self.expectedSize, self.request.URL); + } + return; + } + + // Get the finish status + BOOL finished = (self.receivedSize >= self.expectedSize); + // Get the current progress + double currentProgress = (double)self.receivedSize / (double)self.expectedSize; + double previousProgress = self.previousProgress; + double progressInterval = currentProgress - previousProgress; + // Check if we need callback progress + if (!finished && (progressInterval < self.minimumProgressInterval)) { + return; + } + self.previousProgress = currentProgress; + + // Using data decryptor will disable the progressive decoding, since there are no support for progressive decrypt + BOOL supportProgressive = (self.options & SDWebImageDownloaderProgressiveLoad) && !self.decryptor; + if (supportProgressive) { + // Get the image data + NSData *imageData = [self.imageData copy]; + + // keep maximum one progressive decode process during download + if (self.coderQueue.operationCount == 0) { + // NSOperation have autoreleasepool, don't need to create extra one + [self.coderQueue addOperationWithBlock:^{ + UIImage *image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, finished, self, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context); + if (image) { + // We do not keep the progressive decoding image even when `finished`=YES. Because they are for view rendering but not take full function from downloader options. And some coders implementation may not keep consistent between progressive decoding and normal decoding. + + [self callCompletionBlocksWithImage:image imageData:nil error:nil finished:NO]; + } + }]; + } + } + + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(self.receivedSize, self.expectedSize, self.request.URL); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + willCacheResponse:(NSCachedURLResponse *)proposedResponse + completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { + + NSCachedURLResponse *cachedResponse = proposedResponse; + + if (!(self.options & SDWebImageDownloaderUseNSURLCache)) { + // Prevents caching of responses + cachedResponse = nil; + } + if (completionHandler) { + completionHandler(cachedResponse); + } +} + +#pragma mark NSURLSessionTaskDelegate + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { + // If we already cancel the operation or anything mark the operation finished, don't callback twice + if (self.isFinished) return; + + @synchronized(self) { + self.dataTask = nil; + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf]; + if (!error) { + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:strongSelf]; + } + }); + } + + // make sure to call `[self done]` to mark operation as finished + if (error) { + // custom error instead of URLSession error + if (self.responseError) { + error = self.responseError; + } + [self callCompletionBlocksWithError:error]; + [self done]; + } else { + if ([self callbacksForKey:kCompletedCallbackKey].count > 0) { + NSData *imageData = [self.imageData copy]; + self.imageData = nil; + // data decryptor + if (imageData && self.decryptor) { + imageData = [self.decryptor decryptedDataWithData:imageData response:self.response]; + } + if (imageData) { + /** if you specified to only use cached data via `SDWebImageDownloaderIgnoreCachedResponse`, + * then we should check if the cached data is equal to image data + */ + if (self.options & SDWebImageDownloaderIgnoreCachedResponse && [self.cachedData isEqualToData:imageData]) { + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCacheNotModified userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image is not modified and ignored"}]; + // call completion block with not modified error + [self callCompletionBlocksWithError:self.responseError]; + [self done]; + } else { + // decode the image in coder queue, cancel all previous decoding process + [self.coderQueue cancelAllOperations]; + [self.coderQueue addOperationWithBlock:^{ + UIImage *image = SDImageLoaderDecodeImageData(imageData, self.request.URL, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context); + CGSize imageSize = image.size; + if (imageSize.width == 0 || imageSize.height == 0) { + NSString *description = image == nil ? @"Downloaded image decode failed" : @"Downloaded image has 0 pixels"; + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : description}]]; + } else { + [self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES]; + } + [self done]; + }]; + } + } else { + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}]]; + [self done]; + } + } else { + [self done]; + } + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { + + NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; + __block NSURLCredential *credential = nil; + + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if (!(self.options & SDWebImageDownloaderAllowInvalidSSLCertificates)) { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } else { + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + disposition = NSURLSessionAuthChallengeUseCredential; + } + } else { + if (challenge.previousFailureCount == 0) { + if (self.credential) { + credential = self.credential; + disposition = NSURLSessionAuthChallengeUseCredential; + } else { + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; + } + } else { + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; + } + } + + if (completionHandler) { + completionHandler(disposition, credential); + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) { + self.metrics = metrics; +} + +#pragma mark Helper methods ++ (SDWebImageOptions)imageOptionsFromDownloaderOptions:(SDWebImageDownloaderOptions)downloadOptions { + SDWebImageOptions options = 0; + if (downloadOptions & SDWebImageDownloaderScaleDownLargeImages) options |= SDWebImageScaleDownLargeImages; + if (downloadOptions & SDWebImageDownloaderDecodeFirstFrameOnly) options |= SDWebImageDecodeFirstFrameOnly; + if (downloadOptions & SDWebImageDownloaderPreloadAllFrames) options |= SDWebImagePreloadAllFrames; + if (downloadOptions & SDWebImageDownloaderAvoidDecodeImage) options |= SDWebImageAvoidDecodeImage; + if (downloadOptions & SDWebImageDownloaderMatchAnimatedImageClass) options |= SDWebImageMatchAnimatedImageClass; + + return options; +} + +- (BOOL)shouldContinueWhenAppEntersBackground { + return SD_OPTIONS_CONTAINS(self.options, SDWebImageDownloaderContinueInBackground); +} + +- (void)callCompletionBlocksWithError:(nullable NSError *)error { + [self callCompletionBlocksWithImage:nil imageData:nil error:error finished:YES]; +} + +- (void)callCompletionBlocksWithImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + error:(nullable NSError *)error + finished:(BOOL)finished { + NSArray *completionBlocks = [self callbacksForKey:kCompletedCallbackKey]; + dispatch_main_async_safe(^{ + for (SDWebImageDownloaderCompletedBlock completedBlock in completionBlocks) { + completedBlock(image, imageData, error, finished); + } + }); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h new file mode 100644 index 0000000..42c8a40 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h @@ -0,0 +1,69 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSURLRequest * _Nonnull request); + +/** + This is the protocol for downloader request modifier. + We can use a block to specify the downloader request modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageDownloaderRequestModifier + +/// Modify the original URL request and return a new one instead. You can modify the HTTP header, cachePolicy, etc for this URL. +/// @param request The original URL request for image loading +/// @note If return nil, the URL request will be cancelled. +- (nullable NSURLRequest *)modifiedRequestWithRequest:(nonnull NSURLRequest *)request; + +@end + +/** + A downloader request modifier class with block. + */ +@interface SDWebImageDownloaderRequestModifier : NSObject + +/// Create the request modifier with block +/// @param block A block to control modifier logic +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; + +/// Create the request modifier with block +/// @param block A block to control modifier logic ++ (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; + +@end + +/** +A convenient request modifier to provide the HTTP request including HTTP Method, Headers and Body. +*/ +@interface SDWebImageDownloaderRequestModifier (Conveniences) + +/// Create the request modifier with HTTP Method. +/// @param method HTTP Method, nil means to GET. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithMethod:(nullable NSString *)method; + +/// Create the request modifier with HTTP Headers. +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithHeaders:(nullable NSDictionary *)headers; + +/// Create the request modifier with HTTP Body. +/// @param body HTTP Body. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithBody:(nullable NSData *)body; + +/// Create the request modifier with HTTP Method, Headers and Body. +/// @param method HTTP Method, nil means to GET. +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request. +/// @param body HTTP Body. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary *)headers body:(nullable NSData *)body; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m new file mode 100644 index 0000000..c12c84f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m @@ -0,0 +1,71 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloaderRequestModifier.h" + +@interface SDWebImageDownloaderRequestModifier () + +@property (nonatomic, copy, nonnull) SDWebImageDownloaderRequestModifierBlock block; + +@end + +@implementation SDWebImageDownloaderRequestModifier + +- (instancetype)initWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)requestModifierWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { + SDWebImageDownloaderRequestModifier *requestModifier = [[SDWebImageDownloaderRequestModifier alloc] initWithBlock:block]; + return requestModifier; +} + +- (NSURLRequest *)modifiedRequestWithRequest:(NSURLRequest *)request { + if (!self.block) { + return nil; + } + return self.block(request); +} + +@end + +@implementation SDWebImageDownloaderRequestModifier (Conveniences) + +- (instancetype)initWithMethod:(NSString *)method { + return [self initWithMethod:method headers:nil body:nil]; +} + +- (instancetype)initWithHeaders:(NSDictionary *)headers { + return [self initWithMethod:nil headers:headers body:nil]; +} + +- (instancetype)initWithBody:(NSData *)body { + return [self initWithMethod:nil headers:nil body:body]; +} + +- (instancetype)initWithMethod:(NSString *)method headers:(NSDictionary *)headers body:(NSData *)body { + method = method ? [method copy] : @"GET"; + headers = [headers copy]; + body = [body copy]; + return [self initWithBlock:^NSURLRequest * _Nullable(NSURLRequest * _Nonnull request) { + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + mutableRequest.HTTPMethod = method; + mutableRequest.HTTPBody = body; + for (NSString *header in headers) { + NSString *value = headers[header]; + [mutableRequest setValue:value forHTTPHeaderField:header]; + } + return [mutableRequest copy]; + }]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h new file mode 100644 index 0000000..63c1456 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h @@ -0,0 +1,69 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSURLResponse * _Nullable (^SDWebImageDownloaderResponseModifierBlock)(NSURLResponse * _Nonnull response); + +/** + This is the protocol for downloader response modifier. + We can use a block to specify the downloader response modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageDownloaderResponseModifier + +/// Modify the original URL response and return a new response. You can use this to check MIME-Type, mock server response, etc. +/// @param response The original URL response, note for HTTP request it's actually a `NSHTTPURLResponse` instance +/// @note If nil is returned, the image download will marked as cancelled with error `SDWebImageErrorInvalidDownloadResponse` +- (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response; + +@end + +/** + A downloader response modifier class with block. + */ +@interface SDWebImageDownloaderResponseModifier : NSObject + +/// Create the response modifier with block +/// @param block A block to control modifier logic +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block; + +/// Create the response modifier with block +/// @param block A block to control modifier logic ++ (nonnull instancetype)responseModifierWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block; + +@end + +/** +A convenient response modifier to provide the HTTP response including HTTP Status Code, Version and Headers. +*/ +@interface SDWebImageDownloaderResponseModifier (Conveniences) + +/// Create the response modifier with HTTP Status code. +/// @param statusCode HTTP Status Code. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode; + +/// Create the response modifier with HTTP Version. Status code defaults to 200. +/// @param version HTTP Version, nil means "HTTP/1.1". +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithVersion:(nullable NSString *)version; + +/// Create the response modifier with HTTP Headers. Status code defaults to 200. +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithHeaders:(nullable NSDictionary *)headers; + +/// Create the response modifier with HTTP Status Code, Version and Headers. +/// @param statusCode HTTP Status Code. +/// @param version HTTP Version, nil means "HTTP/1.1". +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode version:(nullable NSString *)version headers:(nullable NSDictionary *)headers; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m new file mode 100644 index 0000000..6acf02a --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m @@ -0,0 +1,73 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + + +#import "SDWebImageDownloaderResponseModifier.h" + +@interface SDWebImageDownloaderResponseModifier () + +@property (nonatomic, copy, nonnull) SDWebImageDownloaderResponseModifierBlock block; + +@end + +@implementation SDWebImageDownloaderResponseModifier + +- (instancetype)initWithBlock:(SDWebImageDownloaderResponseModifierBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)responseModifierWithBlock:(SDWebImageDownloaderResponseModifierBlock)block { + SDWebImageDownloaderResponseModifier *responseModifier = [[SDWebImageDownloaderResponseModifier alloc] initWithBlock:block]; + return responseModifier; +} + +- (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response { + if (!self.block) { + return nil; + } + return self.block(response); +} + +@end + +@implementation SDWebImageDownloaderResponseModifier (Conveniences) + +- (instancetype)initWithStatusCode:(NSInteger)statusCode { + return [self initWithStatusCode:statusCode version:nil headers:nil]; +} + +- (instancetype)initWithVersion:(NSString *)version { + return [self initWithStatusCode:200 version:version headers:nil]; +} + +- (instancetype)initWithHeaders:(NSDictionary *)headers { + return [self initWithStatusCode:200 version:nil headers:headers]; +} + +- (instancetype)initWithStatusCode:(NSInteger)statusCode version:(NSString *)version headers:(NSDictionary *)headers { + version = version ? [version copy] : @"HTTP/1.1"; + headers = [headers copy]; + return [self initWithBlock:^NSURLResponse * _Nullable(NSURLResponse * _Nonnull response) { + if (![response isKindOfClass:NSHTTPURLResponse.class]) { + return response; + } + NSMutableDictionary *mutableHeaders = [((NSHTTPURLResponse *)response).allHeaderFields mutableCopy]; + for (NSString *header in headers) { + NSString *value = headers[header]; + mutableHeaders[header] = value; + } + NSHTTPURLResponse *httpResponse = [[NSHTTPURLResponse alloc] initWithURL:response.URL statusCode:statusCode HTTPVersion:version headerFields:[mutableHeaders copy]]; + return httpResponse; + }]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h new file mode 100644 index 0000000..2b41201 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h @@ -0,0 +1,27 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Jamie Pinkham + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain; + +/// The HTTP status code for invalid download response (NSNumber *) +FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey; + +/// SDWebImage error domain and codes +typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) { + SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL + SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty + SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached` + SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this + SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized + SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey` + SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code. + SDWebImageErrorInvalidDownloadResponse = 2003, // When using response modifier, the modified download response is nil and marked as failed. +}; diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m new file mode 100644 index 0000000..6d17476 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m @@ -0,0 +1,13 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Jamie Pinkham + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageError.h" + +NSErrorDomain const _Nonnull SDWebImageErrorDomain = @"SDWebImageErrorDomain"; +NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey = @"SDWebImageErrorDownloadStatusCodeKey"; diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h new file mode 100644 index 0000000..e1165c1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h @@ -0,0 +1,115 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT || SD_MAC + +/** + A protocol to custom the indicator during the image loading. + All of these methods are called from main queue. + */ +@protocol SDWebImageIndicator + +@required +/** + The view associate to the indicator. + + @return The indicator view + */ +@property (nonatomic, strong, readonly, nonnull) UIView *indicatorView; + +/** + Start the animating for indicator. + */ +- (void)startAnimatingIndicator; + +/** + Stop the animating for indicator. + */ +- (void)stopAnimatingIndicator; + +@optional +/** + Update the loading progress (0-1.0) for indicator. Optional + + @param progress The progress, value between 0 and 1.0 + */ +- (void)updateIndicatorProgress:(double)progress; + +@end + +#pragma mark - Activity Indicator + +/** + Activity indicator class. + for UIKit(macOS), it use a `UIActivityIndicatorView`. + for AppKit(macOS), it use a `NSProgressIndicator` with the spinning style. + */ +@interface SDWebImageActivityIndicator : NSObject + +#if SD_UIKIT +@property (nonatomic, strong, readonly, nonnull) UIActivityIndicatorView *indicatorView; +#else +@property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +/** + Convenience way to use activity indicator. + */ +@interface SDWebImageActivityIndicator (Conveniences) + +/// These indicator use the fixed color without dark mode support +/// gray-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayIndicator; +/// large gray-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayLargeIndicator; +/// white-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteIndicator; +/// large white-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteLargeIndicator; +/// These indicator use the system style, supports dark mode if available (iOS 13+/macOS 10.14+) +/// large activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *largeIndicator; +/// medium activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *mediumIndicator; + +@end + +#pragma mark - Progress Indicator + +/** + Progress indicator class. + for UIKit(macOS), it use a `UIProgressView`. + for AppKit(macOS), it use a `NSProgressIndicator` with the bar style. + */ +@interface SDWebImageProgressIndicator : NSObject + +#if SD_UIKIT +@property (nonatomic, strong, readonly, nonnull) UIProgressView *indicatorView; +#else +@property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +/** + Convenience way to create progress indicator. Remember to specify the indicator width or use layout constraint if need. + */ +@interface SDWebImageProgressIndicator (Conveniences) + +/// default-style progress indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator; +/// bar-style progress indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(macos, tvos); + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m new file mode 100644 index 0000000..49e6099 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m @@ -0,0 +1,284 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageIndicator.h" + +#if SD_UIKIT || SD_MAC + +#if SD_MAC +#import +#endif + +#if SD_UIKIT +#if __IPHONE_13_0 || __TVOS_13_0 || __MAC_10_15 +// Xcode 11 +#else +// Supports Xcode 10 users, for those users, define these enum +static NSInteger UIActivityIndicatorViewStyleMedium = 100; +static NSInteger UIActivityIndicatorViewStyleLarge = 101; +#endif +#endif + +#pragma mark - Activity Indicator + +@interface SDWebImageActivityIndicator () + +#if SD_UIKIT +@property (nonatomic, strong, readwrite, nonnull) UIActivityIndicatorView *indicatorView; +#else +@property (nonatomic, strong, readwrite, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +@implementation SDWebImageActivityIndicator + +- (instancetype)init { + self = [super init]; + if (self) { + [self commonInit]; + } + return self; +} + +#if SD_UIKIT +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (void)commonInit { + self.indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; + self.indicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; +} +#pragma clang diagnostic pop +#endif + +#if SD_MAC +- (void)commonInit { + self.indicatorView = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect]; + self.indicatorView.style = NSProgressIndicatorStyleSpinning; + self.indicatorView.controlSize = NSControlSizeSmall; + [self.indicatorView sizeToFit]; + self.indicatorView.autoresizingMask = NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin; +} +#endif + +- (void)startAnimatingIndicator { +#if SD_UIKIT + [self.indicatorView startAnimating]; +#else + [self.indicatorView startAnimation:nil]; +#endif + self.indicatorView.hidden = NO; +} + +- (void)stopAnimatingIndicator { +#if SD_UIKIT + [self.indicatorView stopAnimating]; +#else + [self.indicatorView stopAnimation:nil]; +#endif + self.indicatorView.hidden = YES; +} + +@end + +@implementation SDWebImageActivityIndicator (Conveniences) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ++ (SDWebImageActivityIndicator *)grayIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT +#if SD_IOS + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; +#else + indicator.indicatorView.color = [UIColor colorWithWhite:0 alpha:0.45]; // Color from `UIActivityIndicatorViewStyleGray` +#endif +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)grayLargeIndicator { + SDWebImageActivityIndicator *indicator = SDWebImageActivityIndicator.grayIndicator; +#if SD_UIKIT + UIColor *grayColor = indicator.indicatorView.color; + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + indicator.indicatorView.color = grayColor; +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support + indicator.indicatorView.controlSize = NSControlSizeRegular; +#endif + [indicator.indicatorView sizeToFit]; + return indicator; +} + ++ (SDWebImageActivityIndicator *)whiteIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support + CIFilter *lighten = [CIFilter filterWithName:@"CIColorControls"]; + [lighten setDefaults]; + [lighten setValue:@(1) forKey:kCIInputBrightnessKey]; + indicator.indicatorView.contentFilters = @[lighten]; +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)whiteLargeIndicator { + SDWebImageActivityIndicator *indicator = SDWebImageActivityIndicator.whiteIndicator; +#if SD_UIKIT + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support + indicator.indicatorView.controlSize = NSControlSizeRegular; + [indicator.indicatorView sizeToFit]; +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)largeIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT + if (@available(iOS 13.0, tvOS 13.0, *)) { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge; + } else { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + } +#else + indicator.indicatorView.controlSize = NSControlSizeRegular; + [indicator.indicatorView sizeToFit]; +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)mediumIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT + if (@available(iOS 13.0, tvOS 13.0, *)) { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium; + } else { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; + } +#else + indicator.indicatorView.controlSize = NSControlSizeSmall; + [indicator.indicatorView sizeToFit]; +#endif + return indicator; +} +#pragma clang diagnostic pop + +@end + +#pragma mark - Progress Indicator + +@interface SDWebImageProgressIndicator () + +#if SD_UIKIT +@property (nonatomic, strong, readwrite, nonnull) UIProgressView *indicatorView; +#else +@property (nonatomic, strong, readwrite, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +@implementation SDWebImageProgressIndicator + +- (instancetype)init { + self = [super init]; + if (self) { + [self commonInit]; + } + return self; +} + +#if SD_UIKIT +- (void)commonInit { + self.indicatorView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; + self.indicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; +} +#endif + +#if SD_MAC +- (void)commonInit { + self.indicatorView = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 160, 0)]; // Width from `UIProgressView` default width + self.indicatorView.style = NSProgressIndicatorStyleBar; + self.indicatorView.controlSize = NSControlSizeSmall; + [self.indicatorView sizeToFit]; + self.indicatorView.autoresizingMask = NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin; +} +#endif + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +- (void)startAnimatingIndicator { + self.indicatorView.hidden = NO; +#if SD_UIKIT + if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) { + // Ignore NSProgress + } else { + self.indicatorView.progress = 0; + } +#else + self.indicatorView.indeterminate = YES; + self.indicatorView.doubleValue = 0; + [self.indicatorView startAnimation:nil]; +#endif +} + +- (void)stopAnimatingIndicator { + self.indicatorView.hidden = YES; +#if SD_UIKIT + if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) { + // Ignore NSProgress + } else { + self.indicatorView.progress = 1; + } +#else + self.indicatorView.indeterminate = NO; + self.indicatorView.doubleValue = 100; + [self.indicatorView stopAnimation:nil]; +#endif +} + +- (void)updateIndicatorProgress:(double)progress { +#if SD_UIKIT + if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) { + // Ignore NSProgress + } else { + [self.indicatorView setProgress:progress animated:YES]; + } +#else + self.indicatorView.indeterminate = progress > 0 ? NO : YES; + self.indicatorView.doubleValue = progress * 100; +#endif +} +#pragma clang diagnostic pop + +@end + +@implementation SDWebImageProgressIndicator (Conveniences) + ++ (SDWebImageProgressIndicator *)defaultIndicator { + SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new]; + return indicator; +} + +#if SD_IOS ++ (SDWebImageProgressIndicator *)barIndicator { + SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new]; + indicator.indicatorView.progressViewStyle = UIProgressViewStyleBar; + return indicator; +} +#endif + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h new file mode 100644 index 0000000..ee90724 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h @@ -0,0 +1,287 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageOperation.h" +#import "SDImageCacheDefine.h" +#import "SDImageLoader.h" +#import "SDImageTransformer.h" +#import "SDWebImageCacheKeyFilter.h" +#import "SDWebImageCacheSerializer.h" +#import "SDWebImageOptionsProcessor.h" + +typedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL); + +typedef void(^SDInternalCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL); + +/** + A combined operation representing the cache and loader operation. You can use it to cancel the load process. + */ +@interface SDWebImageCombinedOperation : NSObject + +/** + Cancel the current operation, including cache and loader process + */ +- (void)cancel; + +/** + The cache operation from the image cache query + */ +@property (strong, nonatomic, nullable, readonly) id cacheOperation; + +/** + The loader operation from the image loader (such as download operation) + */ +@property (strong, nonatomic, nullable, readonly) id loaderOperation; + +@end + + +@class SDWebImageManager; + +/** + The manager delegate protocol. + */ +@protocol SDWebImageManagerDelegate + +@optional + +/** + * Controls which image should be downloaded when the image is not found in the cache. + * + * @param imageManager The current `SDWebImageManager` + * @param imageURL The url of the image to be downloaded + * + * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied. + */ +- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldDownloadImageForURL:(nonnull NSURL *)imageURL; + +/** + * Controls the complicated logic to mark as failed URLs when download error occur. + * If the delegate implement this method, we will not use the built-in way to mark URL as failed based on error code; + @param imageManager The current `SDWebImageManager` + @param imageURL The url of the image + @param error The download error for the url + @return Whether to block this url or not. Return YES to mark this URL as failed. + */ +- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldBlockFailedURL:(nonnull NSURL *)imageURL withError:(nonnull NSError *)error; + +@end + +/** + * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes. + * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache). + * You can use this class directly to benefit from web image downloading with caching in another context than + * a UIView. + * + * Here is a simple example of how to use SDWebImageManager: + * + * @code + +SDWebImageManager *manager = [SDWebImageManager sharedManager]; +[manager loadImageWithURL:imageURL + options:0 + progress:nil + completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { + if (image) { + // do something with image + } + }]; + + * @endcode + */ +@interface SDWebImageManager : NSObject + +/** + * The delegate for manager. Defaults to nil. + */ +@property (weak, nonatomic, nullable) id delegate; + +/** + * The image cache used by manager to query image cache. + */ +@property (strong, nonatomic, readonly, nonnull) id imageCache; + +/** + * The image loader used by manager to load image. + */ +@property (strong, nonatomic, readonly, nonnull) id imageLoader; + +/** + The image transformer for manager. It's used for image transform after the image load finished and store the transformed image to cache, see `SDImageTransformer`. + Defaults to nil, which means no transform is applied. + @note This will affect all the load requests for this manager if you provide. However, you can pass `SDWebImageContextImageTransformer` in context arg to explicitly use that transformer instead. + */ +@property (strong, nonatomic, nullable) id transformer; + +/** + * The cache filter is used to convert an URL into a cache key each time SDWebImageManager need cache key to use image cache. + * + * The following example sets a filter in the application delegate that will remove any query-string from the + * URL before to use it as a cache key: + * + * @code + SDWebImageManager.sharedManager.cacheKeyFilter =[SDWebImageCacheKeyFilter cacheKeyFilterWithBlock:^NSString * _Nullable(NSURL * _Nonnull url) { + url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; + return [url absoluteString]; + }]; + * @endcode + */ +@property (nonatomic, strong, nullable) id cacheKeyFilter; + +/** + * The cache serializer is used to convert the decoded image, the source downloaded data, to the actual data used for storing to the disk cache. If you return nil, means to generate the data from the image instance, see `SDImageCache`. + * For example, if you are using WebP images and facing the slow decoding time issue when later retrieving from disk cache again. You can try to encode the decoded image to JPEG/PNG format to disk cache instead of source downloaded data. + * @note The `image` arg is nonnull, but when you also provide an image transformer and the image is transformed, the `data` arg may be nil, take attention to this case. + * @note This method is called from a global queue in order to not to block the main thread. + * @code + SDWebImageManager.sharedManager.cacheSerializer = [SDWebImageCacheSerializer cacheSerializerWithBlock:^NSData * _Nullable(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL) { + SDImageFormat format = [NSData sd_imageFormatForImageData:data]; + switch (format) { + case SDImageFormatWebP: + return image.images ? data : nil; + default: + return data; + } +}]; + * @endcode + * The default value is nil. Means we just store the source downloaded data to disk cache. + */ +@property (nonatomic, strong, nullable) id cacheSerializer; + +/** + The options processor is used, to have a global control for all the image request options and context option for current manager. + @note If you use `transformer`, `cacheKeyFilter` or `cacheSerializer` property of manager, the input context option already apply those properties before passed. This options processor is a better replacement for those property in common usage. + For example, you can control the global options, based on the URL or original context option like the below code. + + @code + SDWebImageManager.sharedManager.optionsProcessor = [SDWebImageOptionsProcessor optionsProcessorWithBlock:^SDWebImageOptionsResult * _Nullable(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + // Only do animation on `SDAnimatedImageView` + if (!context[SDWebImageContextAnimatedImageClass]) { + options |= SDWebImageDecodeFirstFrameOnly; + } + // Do not force decode for png url + if ([url.lastPathComponent isEqualToString:@"png"]) { + options |= SDWebImageAvoidDecodeImage; + } + // Always use screen scale factor + SDWebImageMutableContext *mutableContext = [NSDictionary dictionaryWithDictionary:context]; + mutableContext[SDWebImageContextImageScaleFactor] = @(UIScreen.mainScreen.scale); + context = [mutableContext copy]; + + return [[SDWebImageOptionsResult alloc] initWithOptions:options context:context]; + }]; + @endcode + */ +@property (nonatomic, strong, nullable) id optionsProcessor; + +/** + * Check one or more operations running + */ +@property (nonatomic, assign, readonly, getter=isRunning) BOOL running; + +/** + The default image cache when the manager which is created with no arguments. Such as shared manager or init. + Defaults to nil. Means using `SDImageCache.sharedImageCache` + */ +@property (nonatomic, class, nullable) id defaultImageCache; + +/** + The default image loader for manager which is created with no arguments. Such as shared manager or init. + Defaults to nil. Means using `SDWebImageDownloader.sharedDownloader` + */ +@property (nonatomic, class, nullable) id defaultImageLoader; + +/** + * Returns global shared manager instance. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImageManager *sharedManager; + +/** + * Allows to specify instance of cache and image loader used with image manager. + * @return new instance of `SDWebImageManager` with specified cache and loader. + */ +- (nonnull instancetype)initWithCache:(nonnull id)cache loader:(nonnull id)loader NS_DESIGNATED_INITIALIZER; + +/** + * Downloads the image at the given URL if not present in cache or return the cached version otherwise. + * + * @param url The URL to the image + * @param options A mask to specify options to use for this request + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. + * + * This parameter is required. + * + * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. + * In case of error the image parameter is nil and the third parameter may contain an NSError. + * + * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache + * or from the memory cache or from the network. + * + * The fifth parameter is set to NO when the SDWebImageProgressiveLoad option is used and the image is + * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the + * block is called a last time with the full image and the last parameter set to YES. + * + * The last parameter is the original image URL + * + * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process. + */ +- (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nonnull SDInternalCompletionBlock)completedBlock; + +/** + * Downloads the image at the given URL if not present in cache or return the cached version otherwise. + * + * @param url The URL to the image + * @param options A mask to specify options to use for this request + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. + * + * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process. + */ +- (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nonnull SDInternalCompletionBlock)completedBlock; + +/** + * Cancel all current operations + */ +- (void)cancelAll; + +/** + * Remove the specify URL from failed black list. + * @param url The failed URL. + */ +- (void)removeFailedURL:(nonnull NSURL *)url; + +/** + * Remove all the URL from failed black list. + */ +- (void)removeAllFailedURLs; + +/** + * Return the cache key for a given URL, does not considerate transformer or thumbnail. + * @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key. + */ +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url; + +/** + * Return the cache key for a given URL and context option. + * @note The context option like `.thumbnailPixelSize` and `.imageTransformer` will effect the generated cache key, using this if you have those context associated. +*/ +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m new file mode 100644 index 0000000..f59dda1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m @@ -0,0 +1,702 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageManager.h" +#import "SDImageCache.h" +#import "SDWebImageDownloader.h" +#import "UIImage+Metadata.h" +#import "SDAssociatedObject.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" + +static id _defaultImageCache; +static id _defaultImageLoader; + +@interface SDWebImageCombinedOperation () + +@property (assign, nonatomic, getter = isCancelled) BOOL cancelled; +@property (strong, nonatomic, readwrite, nullable) id loaderOperation; +@property (strong, nonatomic, readwrite, nullable) id cacheOperation; +@property (weak, nonatomic, nullable) SDWebImageManager *manager; + +@end + +@interface SDWebImageManager () + +@property (strong, nonatomic, readwrite, nonnull) SDImageCache *imageCache; +@property (strong, nonatomic, readwrite, nonnull) id imageLoader; +@property (strong, nonatomic, nonnull) NSMutableSet *failedURLs; +@property (strong, nonatomic, nonnull) dispatch_semaphore_t failedURLsLock; // a lock to keep the access to `failedURLs` thread-safe +@property (strong, nonatomic, nonnull) NSMutableSet *runningOperations; +@property (strong, nonatomic, nonnull) dispatch_semaphore_t runningOperationsLock; // a lock to keep the access to `runningOperations` thread-safe + +@end + +@implementation SDWebImageManager + ++ (id)defaultImageCache { + return _defaultImageCache; +} + ++ (void)setDefaultImageCache:(id)defaultImageCache { + if (defaultImageCache && ![defaultImageCache conformsToProtocol:@protocol(SDImageCache)]) { + return; + } + _defaultImageCache = defaultImageCache; +} + ++ (id)defaultImageLoader { + return _defaultImageLoader; +} + ++ (void)setDefaultImageLoader:(id)defaultImageLoader { + if (defaultImageLoader && ![defaultImageLoader conformsToProtocol:@protocol(SDImageLoader)]) { + return; + } + _defaultImageLoader = defaultImageLoader; +} + ++ (nonnull instancetype)sharedManager { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (nonnull instancetype)init { + id cache = [[self class] defaultImageCache]; + if (!cache) { + cache = [SDImageCache sharedImageCache]; + } + id loader = [[self class] defaultImageLoader]; + if (!loader) { + loader = [SDWebImageDownloader sharedDownloader]; + } + return [self initWithCache:cache loader:loader]; +} + +- (nonnull instancetype)initWithCache:(nonnull id)cache loader:(nonnull id)loader { + if ((self = [super init])) { + _imageCache = cache; + _imageLoader = loader; + _failedURLs = [NSMutableSet new]; + _failedURLsLock = dispatch_semaphore_create(1); + _runningOperations = [NSMutableSet new]; + _runningOperationsLock = dispatch_semaphore_create(1); + } + return self; +} + +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url { + if (!url) { + return @""; + } + + NSString *key; + // Cache Key Filter + id cacheKeyFilter = self.cacheKeyFilter; + if (cacheKeyFilter) { + key = [cacheKeyFilter cacheKeyForURL:url]; + } else { + key = url.absoluteString; + } + + return key; +} + +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context { + if (!url) { + return @""; + } + + NSString *key; + // Cache Key Filter + id cacheKeyFilter = self.cacheKeyFilter; + if (context[SDWebImageContextCacheKeyFilter]) { + cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + } + if (cacheKeyFilter) { + key = [cacheKeyFilter cacheKeyForURL:url]; + } else { + key = url.absoluteString; + } + + // Thumbnail Key Appending + NSValue *thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + CGSize thumbnailSize = CGSizeZero; +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + key = SDThumbnailedKeyForKey(key, thumbnailSize, preserveAspectRatio); + } + + // Transformer Key Appending + id transformer = self.transformer; + if (context[SDWebImageContextImageTransformer]) { + transformer = context[SDWebImageContextImageTransformer]; + if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) { + transformer = nil; + } + } + if (transformer) { + key = SDTransformedKeyForKey(key, transformer.transformerKey); + } + + return key; +} + +- (SDWebImageCombinedOperation *)loadImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDInternalCompletionBlock)completedBlock { + return [self loadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nonnull SDInternalCompletionBlock)completedBlock { + // Invoking this method without a completedBlock is pointless + NSAssert(completedBlock != nil, @"If you mean to prefetch the image, use -[SDWebImagePrefetcher prefetchURLs] instead"); + + // Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, Xcode won't + // throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString. + if ([url isKindOfClass:NSString.class]) { + url = [NSURL URLWithString:(NSString *)url]; + } + + // Prevents app crashing on argument type error like sending NSNull instead of NSURL + if (![url isKindOfClass:NSURL.class]) { + url = nil; + } + + SDWebImageCombinedOperation *operation = [SDWebImageCombinedOperation new]; + operation.manager = self; + + BOOL isFailedUrl = NO; + if (url) { + SD_LOCK(self.failedURLsLock); + isFailedUrl = [self.failedURLs containsObject:url]; + SD_UNLOCK(self.failedURLsLock); + } + + if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) { + NSString *description = isFailedUrl ? @"Image url is blacklisted" : @"Image url is nil"; + NSInteger code = isFailedUrl ? SDWebImageErrorBlackListed : SDWebImageErrorInvalidURL; + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : description}] url:url]; + return operation; + } + + SD_LOCK(self.runningOperationsLock); + [self.runningOperations addObject:operation]; + SD_UNLOCK(self.runningOperationsLock); + + // Preprocess the options and context arg to decide the final the result for manager + SDWebImageOptionsResult *result = [self processedResultForURL:url options:options context:context]; + + // Start the entry to load image from cache + [self callCacheProcessForOperation:operation url:url options:result.options context:result.context progress:progressBlock completed:completedBlock]; + + return operation; +} + +- (void)cancelAll { + SD_LOCK(self.runningOperationsLock); + NSSet *copiedOperations = [self.runningOperations copy]; + SD_UNLOCK(self.runningOperationsLock); + [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array +} + +- (BOOL)isRunning { + BOOL isRunning = NO; + SD_LOCK(self.runningOperationsLock); + isRunning = (self.runningOperations.count > 0); + SD_UNLOCK(self.runningOperationsLock); + return isRunning; +} + +- (void)removeFailedURL:(NSURL *)url { + if (!url) { + return; + } + SD_LOCK(self.failedURLsLock); + [self.failedURLs removeObject:url]; + SD_UNLOCK(self.failedURLsLock); +} + +- (void)removeAllFailedURLs { + SD_LOCK(self.failedURLsLock); + [self.failedURLs removeAllObjects]; + SD_UNLOCK(self.failedURLsLock); +} + +#pragma mark - Private + +// Query normal cache process +- (void)callCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image cache to use + id imageCache; + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + + // Get the query cache type + SDImageCacheType queryCacheType = SDImageCacheTypeAll; + if (context[SDWebImageContextQueryCacheType]) { + queryCacheType = [context[SDWebImageContextQueryCacheType] integerValue]; + } + + // Check whether we should query cache + BOOL shouldQueryCache = !SD_OPTIONS_CONTAINS(options, SDWebImageFromLoaderOnly); + if (shouldQueryCache) { + NSString *key = [self cacheKeyForURL:url context:context]; + @weakify(operation); + operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) { + @strongify(operation); + if (!operation || operation.isCancelled) { + // Image combined operation cancelled by user + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during querying the cache"}] url:url]; + [self safelyRemoveOperationFromRunning:operation]; + return; + } else if (context[SDWebImageContextImageTransformer] && !cachedImage) { + // Have a chance to query original cache instead of downloading + [self callOriginalCacheProcessForOperation:operation url:url options:options context:context progress:progressBlock completed:completedBlock]; + return; + } + + // Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:cachedImage cachedData:cachedData cacheType:cacheType progress:progressBlock completed:completedBlock]; + }]; + } else { + // Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock]; + } +} + +// Query original cache process +- (void)callOriginalCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image cache to use + id imageCache; + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + + // Get the original query cache type + SDImageCacheType originalQueryCacheType = SDImageCacheTypeNone; + if (context[SDWebImageContextOriginalQueryCacheType]) { + originalQueryCacheType = [context[SDWebImageContextOriginalQueryCacheType] integerValue]; + } + + // Check whether we should query original cache + BOOL shouldQueryOriginalCache = (originalQueryCacheType != SDImageCacheTypeNone); + if (shouldQueryOriginalCache) { + // Change originContext to mutable + SDWebImageMutableContext * __block originContext; + if (context) { + originContext = [context mutableCopy]; + } else { + originContext = [NSMutableDictionary dictionary]; + } + + // Disable transformer for cache key generation + id transformer = originContext[SDWebImageContextImageTransformer]; + originContext[SDWebImageContextImageTransformer] = [NSNull null]; + + NSString *key = [self cacheKeyForURL:url context:originContext]; + @weakify(operation); + operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:originalQueryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) { + @strongify(operation); + if (!operation || operation.isCancelled) { + // Image combined operation cancelled by user + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during querying the cache"}] url:url]; + [self safelyRemoveOperationFromRunning:operation]; + return; + } + + // Add original transformer + if (transformer) { + originContext[SDWebImageContextImageTransformer] = transformer; + } + + // Use the store cache process instead of downloading, and ignore .refreshCached option for now + [self callStoreCacheProcessForOperation:operation url:url options:options context:context downloadedImage:cachedImage downloadedData:cachedData finished:YES progress:progressBlock completed:completedBlock]; + + [self safelyRemoveOperationFromRunning:operation]; + }]; + } else { + // Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:originalQueryCacheType progress:progressBlock completed:completedBlock]; + } +} + +// Download process +- (void)callDownloadProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + cachedImage:(nullable UIImage *)cachedImage + cachedData:(nullable NSData *)cachedData + cacheType:(SDImageCacheType)cacheType + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image loader to use + id imageLoader; + if ([context[SDWebImageContextImageLoader] conformsToProtocol:@protocol(SDImageLoader)]) { + imageLoader = context[SDWebImageContextImageLoader]; + } else { + imageLoader = self.imageLoader; + } + + // Check whether we should download image from network + BOOL shouldDownload = !SD_OPTIONS_CONTAINS(options, SDWebImageFromCacheOnly); + shouldDownload &= (!cachedImage || options & SDWebImageRefreshCached); + shouldDownload &= (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url]); + shouldDownload &= [imageLoader canRequestImageForURL:url]; + if (shouldDownload) { + if (cachedImage && options & SDWebImageRefreshCached) { + // If image was found in the cache but SDWebImageRefreshCached is provided, notify about the cached image + // AND try to re-download it in order to let a chance to NSURLCache to refresh it from server. + [self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url]; + // Pass the cached image to the image loader. The image loader should check whether the remote image is equal to the cached image. + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextLoaderCachedImage] = cachedImage; + context = [mutableContext copy]; + } + + @weakify(operation); + operation.loaderOperation = [imageLoader requestImageWithURL:url options:options context:context progress:progressBlock completed:^(UIImage *downloadedImage, NSData *downloadedData, NSError *error, BOOL finished) { + @strongify(operation); + if (!operation || operation.isCancelled) { + // Image combined operation cancelled by user + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}] url:url]; + } else if (cachedImage && options & SDWebImageRefreshCached && [error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCacheNotModified) { + // Image refresh hit the NSURLCache cache, do not call the completion block + } else if ([error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCancelled) { + // Download operation cancelled by user before sending the request, don't block failed URL + [self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url]; + } else if (error) { + [self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url]; + BOOL shouldBlockFailedURL = [self shouldBlockFailedURLWithURL:url error:error options:options context:context]; + + if (shouldBlockFailedURL) { + SD_LOCK(self.failedURLsLock); + [self.failedURLs addObject:url]; + SD_UNLOCK(self.failedURLsLock); + } + } else { + if ((options & SDWebImageRetryFailed)) { + SD_LOCK(self.failedURLsLock); + [self.failedURLs removeObject:url]; + SD_UNLOCK(self.failedURLsLock); + } + // Continue store cache process + [self callStoreCacheProcessForOperation:operation url:url options:options context:context downloadedImage:downloadedImage downloadedData:downloadedData finished:finished progress:progressBlock completed:completedBlock]; + } + + if (finished) { + [self safelyRemoveOperationFromRunning:operation]; + } + }]; + } else if (cachedImage) { + [self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url]; + [self safelyRemoveOperationFromRunning:operation]; + } else { + // Image not in cache and download disallowed by delegate + [self callCompletionBlockForOperation:operation completion:completedBlock image:nil data:nil error:nil cacheType:SDImageCacheTypeNone finished:YES url:url]; + [self safelyRemoveOperationFromRunning:operation]; + } +} + +// Store cache process +- (void)callStoreCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + downloadedImage:(nullable UIImage *)downloadedImage + downloadedData:(nullable NSData *)downloadedData + finished:(BOOL)finished + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // the target image store cache type + SDImageCacheType storeCacheType = SDImageCacheTypeAll; + if (context[SDWebImageContextStoreCacheType]) { + storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue]; + } + // the original store image cache type + SDImageCacheType originalStoreCacheType = SDImageCacheTypeNone; + if (context[SDWebImageContextOriginalStoreCacheType]) { + originalStoreCacheType = [context[SDWebImageContextOriginalStoreCacheType] integerValue]; + } + // origin cache key + SDWebImageMutableContext *originContext = [context mutableCopy]; + // disable transformer for cache key generation + originContext[SDWebImageContextImageTransformer] = [NSNull null]; + NSString *key = [self cacheKeyForURL:url context:originContext]; + id transformer = context[SDWebImageContextImageTransformer]; + if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) { + transformer = nil; + } + id cacheSerializer = context[SDWebImageContextCacheSerializer]; + + BOOL shouldTransformImage = downloadedImage && transformer; + shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)); + shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isVector || (options & SDWebImageTransformVectorImage)); + BOOL shouldCacheOriginal = downloadedImage && finished; + + // if available, store original image to cache + if (shouldCacheOriginal) { + // normally use the store cache type, but if target image is transformed, use original store cache type instead + SDImageCacheType targetStoreCacheType = shouldTransformImage ? originalStoreCacheType : storeCacheType; + if (cacheSerializer && (targetStoreCacheType == SDImageCacheTypeDisk || targetStoreCacheType == SDImageCacheTypeAll)) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ + @autoreleasepool { + NSData *cacheData = [cacheSerializer cacheDataWithImage:downloadedImage originalData:downloadedData imageURL:url]; + [self storeImage:downloadedImage imageData:cacheData forKey:key cacheType:targetStoreCacheType options:options context:context completion:^{ + // Continue transform process + [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData finished:finished progress:progressBlock completed:completedBlock]; + }]; + } + }); + } else { + [self storeImage:downloadedImage imageData:downloadedData forKey:key cacheType:targetStoreCacheType options:options context:context completion:^{ + // Continue transform process + [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData finished:finished progress:progressBlock completed:completedBlock]; + }]; + } + } else { + // Continue transform process + [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData finished:finished progress:progressBlock completed:completedBlock]; + } +} + +// Transform process +- (void)callTransformProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + originalImage:(nullable UIImage *)originalImage + originalData:(nullable NSData *)originalData + finished:(BOOL)finished + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // the target image store cache type + SDImageCacheType storeCacheType = SDImageCacheTypeAll; + if (context[SDWebImageContextStoreCacheType]) { + storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue]; + } + // transformed cache key + NSString *key = [self cacheKeyForURL:url context:context]; + id transformer = context[SDWebImageContextImageTransformer]; + if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) { + transformer = nil; + } + id cacheSerializer = context[SDWebImageContextCacheSerializer]; + + BOOL shouldTransformImage = originalImage && transformer; + shouldTransformImage = shouldTransformImage && (!originalImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)); + shouldTransformImage = shouldTransformImage && (!originalImage.sd_isVector || (options & SDWebImageTransformVectorImage)); + // if available, store transformed image to cache + if (shouldTransformImage) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ + @autoreleasepool { + UIImage *transformedImage = [transformer transformedImageWithImage:originalImage forKey:key]; + if (transformedImage && finished) { + BOOL imageWasTransformed = ![transformedImage isEqual:originalImage]; + NSData *cacheData; + // pass nil if the image was transformed, so we can recalculate the data from the image + if (cacheSerializer && (storeCacheType == SDImageCacheTypeDisk || storeCacheType == SDImageCacheTypeAll)) { + cacheData = [cacheSerializer cacheDataWithImage:transformedImage originalData:(imageWasTransformed ? nil : originalData) imageURL:url]; + } else { + cacheData = (imageWasTransformed ? nil : originalData); + } + [self storeImage:transformedImage imageData:cacheData forKey:key cacheType:storeCacheType options:options context:context completion:^{ + [self callCompletionBlockForOperation:operation completion:completedBlock image:transformedImage data:originalData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url]; + }]; + } else { + [self callCompletionBlockForOperation:operation completion:completedBlock image:transformedImage data:originalData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url]; + } + } + }); + } else { + [self callCompletionBlockForOperation:operation completion:completedBlock image:originalImage data:originalData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url]; + } +} + +#pragma mark - Helper + +- (void)safelyRemoveOperationFromRunning:(nullable SDWebImageCombinedOperation*)operation { + if (!operation) { + return; + } + SD_LOCK(self.runningOperationsLock); + [self.runningOperations removeObject:operation]; + SD_UNLOCK(self.runningOperationsLock); +} + +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)data + forKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + completion:(nullable SDWebImageNoParamsBlock)completion { + id imageCache; + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache); + // Check whether we should wait the store cache finished. If not, callback immediately + [imageCache storeImage:image imageData:data forKey:key cacheType:cacheType completion:^{ + if (waitStoreCache) { + if (completion) { + completion(); + } + } + }]; + if (!waitStoreCache) { + if (completion) { + completion(); + } + } +} + +- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation + completion:(nullable SDInternalCompletionBlock)completionBlock + error:(nullable NSError *)error + url:(nullable NSURL *)url { + [self callCompletionBlockForOperation:operation completion:completionBlock image:nil data:nil error:error cacheType:SDImageCacheTypeNone finished:YES url:url]; +} + +- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation + completion:(nullable SDInternalCompletionBlock)completionBlock + image:(nullable UIImage *)image + data:(nullable NSData *)data + error:(nullable NSError *)error + cacheType:(SDImageCacheType)cacheType + finished:(BOOL)finished + url:(nullable NSURL *)url { + dispatch_main_async_safe(^{ + if (completionBlock) { + completionBlock(image, data, error, cacheType, finished, url); + } + }); +} + +- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url + error:(nonnull NSError *)error + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context { + id imageLoader; + if ([context[SDWebImageContextImageLoader] conformsToProtocol:@protocol(SDImageLoader)]) { + imageLoader = context[SDWebImageContextImageLoader]; + } else { + imageLoader = self.imageLoader; + } + // Check whether we should block failed url + BOOL shouldBlockFailedURL; + if ([self.delegate respondsToSelector:@selector(imageManager:shouldBlockFailedURL:withError:)]) { + shouldBlockFailedURL = [self.delegate imageManager:self shouldBlockFailedURL:url withError:error]; + } else { + shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error]; + } + + return shouldBlockFailedURL; +} + +- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + SDWebImageOptionsResult *result; + SDWebImageMutableContext *mutableContext = [SDWebImageMutableContext dictionary]; + + // Image Transformer from manager + if (!context[SDWebImageContextImageTransformer]) { + id transformer = self.transformer; + [mutableContext setValue:transformer forKey:SDWebImageContextImageTransformer]; + } + // Cache key filter from manager + if (!context[SDWebImageContextCacheKeyFilter]) { + id cacheKeyFilter = self.cacheKeyFilter; + [mutableContext setValue:cacheKeyFilter forKey:SDWebImageContextCacheKeyFilter]; + } + // Cache serializer from manager + if (!context[SDWebImageContextCacheSerializer]) { + id cacheSerializer = self.cacheSerializer; + [mutableContext setValue:cacheSerializer forKey:SDWebImageContextCacheSerializer]; + } + + if (mutableContext.count > 0) { + if (context) { + [mutableContext addEntriesFromDictionary:context]; + } + context = [mutableContext copy]; + } + + // Apply options processor + if (self.optionsProcessor) { + result = [self.optionsProcessor processedResultForURL:url options:options context:context]; + } + if (!result) { + // Use default options result + result = [[SDWebImageOptionsResult alloc] initWithOptions:options context:context]; + } + + return result; +} + +@end + + +@implementation SDWebImageCombinedOperation + +- (void)cancel { + @synchronized(self) { + if (self.isCancelled) { + return; + } + self.cancelled = YES; + if (self.cacheOperation) { + [self.cacheOperation cancel]; + self.cacheOperation = nil; + } + if (self.loaderOperation) { + [self.loaderOperation cancel]; + self.loaderOperation = nil; + } + [self.manager safelyRemoveOperationFromRunning:self]; + } +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h new file mode 100644 index 0000000..50266db --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h @@ -0,0 +1,21 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +/// A protocol represents cancelable operation. +@protocol SDWebImageOperation + +- (void)cancel; + +@end + +/// NSOperation conform to `SDWebImageOperation`. +@interface NSOperation (SDWebImageOperation) + +@end diff --git a/Pods/SDWebImage/SDWebImage/UIImage+WebP.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m similarity index 61% rename from Pods/SDWebImage/SDWebImage/UIImage+WebP.h rename to Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m index cd9f27b..0d6e880 100644 --- a/Pods/SDWebImage/SDWebImage/UIImage+WebP.h +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m @@ -6,14 +6,9 @@ * file that was distributed with this source code. */ -#ifdef SD_WEBP +#import "SDWebImageOperation.h" -#import "SDWebImageCompat.h" - -@interface UIImage (WebP) - -+ (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data; +/// NSOperation conform to `SDWebImageOperation`. +@implementation NSOperation (SDWebImageOperation) @end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h new file mode 100644 index 0000000..31ef153 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h @@ -0,0 +1,72 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" + +@class SDWebImageOptionsResult; + +typedef SDWebImageOptionsResult * _Nullable(^SDWebImageOptionsProcessorBlock)(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/** + The options result contains both options and context. + */ +@interface SDWebImageOptionsResult : NSObject + +/** + WebCache options. + */ +@property (nonatomic, assign, readonly) SDWebImageOptions options; + +/** + Context options. + */ +@property (nonatomic, copy, readonly, nullable) SDWebImageContext *context; + +/** + Create a new options result. + + @param options options + @param context context + @return The options result contains both options and context. + */ +- (nonnull instancetype)initWithOptions:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context; + +@end + +/** + This is the protocol for options processor. + Options processor can be used, to control the final result for individual image request's `SDWebImageOptions` and `SDWebImageContext` + Implements the protocol to have a global control for each indivadual image request's option. + */ +@protocol SDWebImageOptionsProcessor + +/** + Return the processed options result for specify image URL, with its options and context + + @param url The URL to the image + @param options A mask to specify options to use for this request + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @return The processed result, contains both options and context + */ +- (nullable SDWebImageOptionsResult *)processedResultForURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +@end + +/** + A options processor class with block. + */ +@interface SDWebImageOptionsProcessor : NSObject + +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageOptionsProcessorBlock)block; ++ (nonnull instancetype)optionsProcessorWithBlock:(nonnull SDWebImageOptionsProcessorBlock)block; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m new file mode 100644 index 0000000..8e7bc35 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m @@ -0,0 +1,59 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageOptionsProcessor.h" + +@interface SDWebImageOptionsResult () + +@property (nonatomic, assign) SDWebImageOptions options; +@property (nonatomic, copy, nullable) SDWebImageContext *context; + +@end + +@implementation SDWebImageOptionsResult + +- (instancetype)initWithOptions:(SDWebImageOptions)options context:(SDWebImageContext *)context { + self = [super init]; + if (self) { + self.options = options; + self.context = context; + } + return self; +} + +@end + +@interface SDWebImageOptionsProcessor () + +@property (nonatomic, copy, nonnull) SDWebImageOptionsProcessorBlock block; + +@end + +@implementation SDWebImageOptionsProcessor + +- (instancetype)initWithBlock:(SDWebImageOptionsProcessorBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)optionsProcessorWithBlock:(SDWebImageOptionsProcessorBlock)block { + SDWebImageOptionsProcessor *optionsProcessor = [[SDWebImageOptionsProcessor alloc] initWithBlock:block]; + return optionsProcessor; +} + +- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + if (!self.block) { + return nil; + } + return self.block(url, options, context); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h new file mode 100644 index 0000000..a9b2c1f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h @@ -0,0 +1,143 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageManager.h" + +@class SDWebImagePrefetcher; + +/** + A token represents a list of URLs, can be used to cancel the download. + */ +@interface SDWebImagePrefetchToken : NSObject + +/** + * Cancel the current prefetching. + */ +- (void)cancel; + +/** + list of URLs of current prefetching. + */ +@property (nonatomic, copy, readonly, nullable) NSArray *urls; + +@end + +/** + The prefetcher delegate protocol + */ +@protocol SDWebImagePrefetcherDelegate + +@optional + +/** + * Called when an image was prefetched. Which means it's called when one URL from any of prefetching finished. + * + * @param imagePrefetcher The current image prefetcher + * @param imageURL The image url that was prefetched + * @param finishedCount The total number of images that were prefetched (successful or not) + * @param totalCount The total number of images that were to be prefetched + */ +- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; + +/** + * Called when all images are prefetched. Which means it's called when all URLs from all of prefetching finished. + * @param imagePrefetcher The current image prefetcher + * @param totalCount The total number of images that were prefetched (whether successful or not) + * @param skippedCount The total number of images that were skipped + */ +- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; + +@end + +typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); +typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); + +/** + * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. + */ +@interface SDWebImagePrefetcher : NSObject + +/** + * The web image manager used by prefetcher to prefetch images. + * @note You can specify a standalone manager and downloader with custom configuration suitable for image prefetching. Such as `currentDownloadCount` or `downloadTimeout`. + */ +@property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; + +/** + * Maximum number of URLs to prefetch at the same time. Defaults to 3. + */ +@property (nonatomic, assign) NSUInteger maxConcurrentPrefetchCount; + +/** + * The options for prefetcher. Defaults to SDWebImageLowPriority. + */ +@property (nonatomic, assign) SDWebImageOptions options; + +/** + * The context for prefetcher. Defaults to nil. + */ +@property (nonatomic, copy, nullable) SDWebImageContext *context; + +/** + * Queue options for prefetcher when call the progressBlock, completionBlock and delegate methods. Defaults to Main Queue. + * @note The call is asynchronously to avoid blocking target queue. + * @note The delegate queue should be set before any prefetching start and may not be changed during prefetching to avoid thread-safe problem. + */ +@property (strong, nonatomic, nonnull) dispatch_queue_t delegateQueue; + +/** + * The delegate for the prefetcher. Defaults to nil. + */ +@property (weak, nonatomic, nullable) id delegate; + +/** + * Returns the global shared image prefetcher instance. It use a standalone manager which is different from shared manager. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImagePrefetcher *sharedImagePrefetcher; + +/** + * Allows you to instantiate a prefetcher with any arbitrary image manager. + */ +- (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; + +/** + * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property. + * Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls. + * Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch. + * + * @param urls list of URLs to prefetch + * @return the token to cancel the current prefetching. + */ +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls; + +/** + * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property. + * Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls. + * Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch. + * + * @param urls list of URLs to prefetch + * @param progressBlock block to be called when progress updates; + * first parameter is the number of completed (successful or not) requests, + * second parameter is the total number of images originally requested to be prefetched + * @param completionBlock block to be called when the current prefetching is completed + * first param is the number of completed (successful or not) requests, + * second parameter is the number of skipped requests + * @return the token to cancel the current prefetching. + */ +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls + progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock + completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; + +/** + * Remove and cancel all the prefeching for the prefetcher. + */ +- (void)cancelPrefetching; + + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m new file mode 100644 index 0000000..5c0f37f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m @@ -0,0 +1,305 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImagePrefetcher.h" +#import "SDAsyncBlockOperation.h" +#import "SDInternalMacros.h" +#import + +@interface SDWebImagePrefetchToken () { + @public + // Though current implementation, `SDWebImageManager` completion block is always on main queue. But however, there is no guarantee in docs. And we may introduce config to specify custom queue in the future. + // These value are just used as incrementing counter, keep thread-safe using memory_order_relaxed for performance. + atomic_ulong _skippedCount; + atomic_ulong _finishedCount; + atomic_flag _isAllFinished; + + unsigned long _totalCount; + + // Used to ensure NSPointerArray thread safe + dispatch_semaphore_t _prefetchOperationsLock; + dispatch_semaphore_t _loadOperationsLock; +} + +@property (nonatomic, copy, readwrite) NSArray *urls; +@property (nonatomic, strong) NSPointerArray *loadOperations; +@property (nonatomic, strong) NSPointerArray *prefetchOperations; +@property (nonatomic, weak) SDWebImagePrefetcher *prefetcher; +@property (nonatomic, copy, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; +@property (nonatomic, copy, nullable) SDWebImagePrefetcherProgressBlock progressBlock; + +@end + +@interface SDWebImagePrefetcher () + +@property (strong, nonatomic, nonnull) SDWebImageManager *manager; +@property (strong, atomic, nonnull) NSMutableSet *runningTokens; +@property (strong, nonatomic, nonnull) NSOperationQueue *prefetchQueue; + +@end + +@implementation SDWebImagePrefetcher + ++ (nonnull instancetype)sharedImagePrefetcher { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (nonnull instancetype)init { + return [self initWithImageManager:[SDWebImageManager new]]; +} + +- (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { + if ((self = [super init])) { + _manager = manager; + _runningTokens = [NSMutableSet set]; + _options = SDWebImageLowPriority; + _delegateQueue = dispatch_get_main_queue(); + _prefetchQueue = [NSOperationQueue new]; + self.maxConcurrentPrefetchCount = 3; + } + return self; +} + +- (void)setMaxConcurrentPrefetchCount:(NSUInteger)maxConcurrentPrefetchCount { + self.prefetchQueue.maxConcurrentOperationCount = maxConcurrentPrefetchCount; +} + +- (NSUInteger)maxConcurrentPrefetchCount { + return self.prefetchQueue.maxConcurrentOperationCount; +} + +#pragma mark - Prefetch +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls { + return [self prefetchURLs:urls progress:nil completed:nil]; +} + +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls + progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock + completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { + if (!urls || urls.count == 0) { + if (completionBlock) { + completionBlock(0, 0); + } + return nil; + } + SDWebImagePrefetchToken *token = [SDWebImagePrefetchToken new]; + token.prefetcher = self; + token.urls = urls; + token->_skippedCount = 0; + token->_finishedCount = 0; + token->_totalCount = token.urls.count; + atomic_flag_clear(&(token->_isAllFinished)); + token.loadOperations = [NSPointerArray weakObjectsPointerArray]; + token.prefetchOperations = [NSPointerArray weakObjectsPointerArray]; + token.progressBlock = progressBlock; + token.completionBlock = completionBlock; + [self addRunningToken:token]; + [self startPrefetchWithToken:token]; + + return token; +} + +- (void)startPrefetchWithToken:(SDWebImagePrefetchToken * _Nonnull)token { + for (NSURL *url in token.urls) { + @autoreleasepool { + @weakify(self); + SDAsyncBlockOperation *prefetchOperation = [SDAsyncBlockOperation blockOperationWithBlock:^(SDAsyncBlockOperation * _Nonnull asyncOperation) { + @strongify(self); + if (!self || asyncOperation.isCancelled) { + return; + } + id operation = [self.manager loadImageWithURL:url options:self.options context:self.context progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + @strongify(self); + if (!self) { + return; + } + if (!finished) { + return; + } + atomic_fetch_add_explicit(&(token->_finishedCount), 1, memory_order_relaxed); + if (error) { + // Add last failed + atomic_fetch_add_explicit(&(token->_skippedCount), 1, memory_order_relaxed); + } + + // Current operation finished + [self callProgressBlockForToken:token imageURL:imageURL]; + + if (atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed) == token->_totalCount) { + // All finished + if (!atomic_flag_test_and_set_explicit(&(token->_isAllFinished), memory_order_relaxed)) { + [self callCompletionBlockForToken:token]; + [self removeRunningToken:token]; + } + } + [asyncOperation complete]; + }]; + NSAssert(operation != nil, @"Operation should not be nil, [SDWebImageManager loadImageWithURL:options:context:progress:completed:] break prefetch logic"); + SD_LOCK(token->_loadOperationsLock); + [token.loadOperations addPointer:(__bridge void *)operation]; + SD_UNLOCK(token->_loadOperationsLock); + }]; + SD_LOCK(token->_prefetchOperationsLock); + [token.prefetchOperations addPointer:(__bridge void *)prefetchOperation]; + SD_UNLOCK(token->_prefetchOperationsLock); + [self.prefetchQueue addOperation:prefetchOperation]; + } + } +} + +#pragma mark - Cancel +- (void)cancelPrefetching { + @synchronized(self.runningTokens) { + NSSet *copiedTokens = [self.runningTokens copy]; + [copiedTokens makeObjectsPerformSelector:@selector(cancel)]; + [self.runningTokens removeAllObjects]; + } +} + +- (void)callProgressBlockForToken:(SDWebImagePrefetchToken *)token imageURL:(NSURL *)url { + if (!token) { + return; + } + BOOL shouldCallDelegate = [self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]; + NSUInteger tokenFinishedCount = [self tokenFinishedCount]; + NSUInteger tokenTotalCount = [self tokenTotalCount]; + NSUInteger finishedCount = atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed); + NSUInteger totalCount = token->_totalCount; + dispatch_async(self.delegateQueue, ^{ + if (shouldCallDelegate) { + [self.delegate imagePrefetcher:self didPrefetchURL:url finishedCount:tokenFinishedCount totalCount:tokenTotalCount]; + } + if (token.progressBlock) { + token.progressBlock(finishedCount, totalCount); + } + }); +} + +- (void)callCompletionBlockForToken:(SDWebImagePrefetchToken *)token { + if (!token) { + return; + } + BOOL shoulCallDelegate = [self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)] && ([self countOfRunningTokens] == 1); // last one + NSUInteger tokenTotalCount = [self tokenTotalCount]; + NSUInteger tokenSkippedCount = [self tokenSkippedCount]; + NSUInteger finishedCount = atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed); + NSUInteger skippedCount = atomic_load_explicit(&(token->_skippedCount), memory_order_relaxed); + dispatch_async(self.delegateQueue, ^{ + if (shoulCallDelegate) { + [self.delegate imagePrefetcher:self didFinishWithTotalCount:tokenTotalCount skippedCount:tokenSkippedCount]; + } + if (token.completionBlock) { + token.completionBlock(finishedCount, skippedCount); + } + }); +} + +#pragma mark - Helper +- (NSUInteger)tokenTotalCount { + NSUInteger tokenTotalCount = 0; + @synchronized (self.runningTokens) { + for (SDWebImagePrefetchToken *token in self.runningTokens) { + tokenTotalCount += token->_totalCount; + } + } + return tokenTotalCount; +} + +- (NSUInteger)tokenSkippedCount { + NSUInteger tokenSkippedCount = 0; + @synchronized (self.runningTokens) { + for (SDWebImagePrefetchToken *token in self.runningTokens) { + tokenSkippedCount += atomic_load_explicit(&(token->_skippedCount), memory_order_relaxed); + } + } + return tokenSkippedCount; +} + +- (NSUInteger)tokenFinishedCount { + NSUInteger tokenFinishedCount = 0; + @synchronized (self.runningTokens) { + for (SDWebImagePrefetchToken *token in self.runningTokens) { + tokenFinishedCount += atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed); + } + } + return tokenFinishedCount; +} + +- (void)addRunningToken:(SDWebImagePrefetchToken *)token { + if (!token) { + return; + } + @synchronized (self.runningTokens) { + [self.runningTokens addObject:token]; + } +} + +- (void)removeRunningToken:(SDWebImagePrefetchToken *)token { + if (!token) { + return; + } + @synchronized (self.runningTokens) { + [self.runningTokens removeObject:token]; + } +} + +- (NSUInteger)countOfRunningTokens { + NSUInteger count = 0; + @synchronized (self.runningTokens) { + count = self.runningTokens.count; + } + return count; +} + +@end + +@implementation SDWebImagePrefetchToken + +- (instancetype)init { + self = [super init]; + if (self) { + _prefetchOperationsLock = dispatch_semaphore_create(1); + _loadOperationsLock = dispatch_semaphore_create(1); + } + return self; +} + +- (void)cancel { + SD_LOCK(_prefetchOperationsLock); + [self.prefetchOperations compact]; + for (id operation in self.prefetchOperations) { + id strongOperation = operation; + if (strongOperation) { + [strongOperation cancel]; + } + } + self.prefetchOperations.count = 0; + SD_UNLOCK(_prefetchOperationsLock); + + SD_LOCK(_loadOperationsLock); + [self.loadOperations compact]; + for (id operation in self.loadOperations) { + id strongOperation = operation; + if (strongOperation) { + [strongOperation cancel]; + } + } + self.loadOperations.count = 0; + SD_UNLOCK(_loadOperationsLock); + + self.completionBlock = nil; + self.progressBlock = nil; + [self.prefetcher removeRunningToken:self]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h b/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h new file mode 100644 index 0000000..889372e --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h @@ -0,0 +1,131 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT || SD_MAC +#import "SDImageCache.h" + +#if SD_UIKIT +typedef UIViewAnimationOptions SDWebImageAnimationOptions; +#else +typedef NS_OPTIONS(NSUInteger, SDWebImageAnimationOptions) { + SDWebImageAnimationOptionAllowsImplicitAnimation = 1 << 0, // specify `allowsImplicitAnimation` for the `NSAnimationContext` + + SDWebImageAnimationOptionCurveEaseInOut = 0 << 16, // default + SDWebImageAnimationOptionCurveEaseIn = 1 << 16, + SDWebImageAnimationOptionCurveEaseOut = 2 << 16, + SDWebImageAnimationOptionCurveLinear = 3 << 16, + + SDWebImageAnimationOptionTransitionNone = 0 << 20, // default + SDWebImageAnimationOptionTransitionFlipFromLeft = 1 << 20, + SDWebImageAnimationOptionTransitionFlipFromRight = 2 << 20, + SDWebImageAnimationOptionTransitionCurlUp = 3 << 20, + SDWebImageAnimationOptionTransitionCurlDown = 4 << 20, + SDWebImageAnimationOptionTransitionCrossDissolve = 5 << 20, + SDWebImageAnimationOptionTransitionFlipFromTop = 6 << 20, + SDWebImageAnimationOptionTransitionFlipFromBottom = 7 << 20, +}; +#endif + +typedef void (^SDWebImageTransitionPreparesBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL); +typedef void (^SDWebImageTransitionAnimationsBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image); +typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished); + +/** + This class is used to provide a transition animation after the view category load image finished. Use this on `sd_imageTransition` in UIView+WebCache.h + for UIKit(iOS & tvOS), we use `+[UIView transitionWithView:duration:options:animations:completion]` for transition animation. + for AppKit(macOS), we use `+[NSAnimationContext runAnimationGroup:completionHandler:]` for transition animation. You can call `+[NSAnimationContext currentContext]` to grab the context during animations block. + @note These transition are provided for basic usage. If you need complicated animation, consider to directly use Core Animation or use `SDWebImageAvoidAutoSetImage` and implement your own after image load finished. + */ +@interface SDWebImageTransition : NSObject + +/** + By default, we set the image to the view at the beginning of the animations. You can disable this and provide custom set image process + */ +@property (nonatomic, assign) BOOL avoidAutoSetImage; +/** + The duration of the transition animation, measured in seconds. Defaults to 0.5. + */ +@property (nonatomic, assign) NSTimeInterval duration; +/** + The timing function used for all animations within this transition animation (macOS). + */ +@property (nonatomic, strong, nullable) CAMediaTimingFunction *timingFunction API_UNAVAILABLE(ios, tvos, watchos) API_DEPRECATED("Use SDWebImageAnimationOptions instead, or grab NSAnimationContext.currentContext and modify the timingFunction", macos(10.10, 10.10)); +/** + A mask of options indicating how you want to perform the animations. + */ +@property (nonatomic, assign) SDWebImageAnimationOptions animationOptions; +/** + A block object to be executed before the animation sequence starts. + */ +@property (nonatomic, copy, nullable) SDWebImageTransitionPreparesBlock prepares; +/** + A block object that contains the changes you want to make to the specified view. + */ +@property (nonatomic, copy, nullable) SDWebImageTransitionAnimationsBlock animations; +/** + A block object to be executed when the animation sequence ends. + */ +@property (nonatomic, copy, nullable) SDWebImageTransitionCompletionBlock completion; + +@end + +/** + Convenience way to create transition. Remember to specify the duration if needed. + for UIKit, these transition just use the correspond `animationOptions`. By default we enable `UIViewAnimationOptionAllowUserInteraction` to allow user interaction during transition. + for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it. + */ +@interface SDWebImageTransition (Conveniences) + +/// Fade-in transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition; +/// Flip from left transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition; +/// Flip from right transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromRightTransition; +/// Flip from top transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromTopTransition; +/// Flip from bottom transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromBottomTransition; +/// Curl up transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlUpTransition; +/// Curl down transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition; + +/// Fade-in transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)fadeTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(fade(duration:)); + +/// Flip from left transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromLeft(duration:)); + +/// Flip from right transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromRightTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromRight(duration:)); + +/// Flip from top transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromTopTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromTop(duration:)); + +/// Flip from bottom transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromBottom(duration:)); + +/// Curl up transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)curlUpTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlUp(duration:)); + +/// Curl down transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)curlDownTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlDown(duration:)); + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m b/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m new file mode 100644 index 0000000..93c83ec --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m @@ -0,0 +1,187 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageTransition.h" + +#if SD_UIKIT || SD_MAC + +#if SD_MAC +#import "SDWebImageTransitionInternal.h" +#import "SDInternalMacros.h" + +CAMediaTimingFunction * SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options) { + if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveLinear, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; + } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseIn, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; + } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseOut, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; + } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseInOut, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + } else { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]; + } +} + +CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options) { + if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCrossDissolve)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionFade; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromLeft)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromLeft; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromRight)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromRight; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromTop)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromTop; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromBottom)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromBottom; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCurlUp)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionReveal; + trans.subtype = kCATransitionFromTop; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCurlDown)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionReveal; + trans.subtype = kCATransitionFromBottom; + return trans; + } else { + return nil; + } +} +#endif + +@implementation SDWebImageTransition + +- (instancetype)init { + self = [super init]; + if (self) { + self.duration = 0.5; + } + return self; +} + +@end + +@implementation SDWebImageTransition (Conveniences) + ++ (SDWebImageTransition *)fadeTransition { + return [self fadeTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)fadeTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionCrossDissolve; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromLeftTransition { + return [self flipFromLeftTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromLeft; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromRightTransition { + return [self flipFromRightTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromRightTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromRight; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromTopTransition { + return [self flipFromTopTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromTopTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromTop; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromBottomTransition { + return [self flipFromBottomTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromBottom; +#endif + return transition; +} + ++ (SDWebImageTransition *)curlUpTransition { + return [self curlUpTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)curlUpTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionCurlUp; +#endif + return transition; +} + ++ (SDWebImageTransition *)curlDownTransition { + return [self curlDownTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)curlDownTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionCurlDown; +#endif + transition.duration = duration; + return transition; +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h b/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h new file mode 100644 index 0000000..89d94b4 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h @@ -0,0 +1,387 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT + +#import "SDWebImageManager.h" + +/** + * Integrates SDWebImage async downloading and caching of remote images with UIButton. + */ +@interface UIButton (WebCache) + +#pragma mark - Image + +/** + * Get the current image URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL; + +/** + * Get the image URL for a control state. + * + * @param state Which state you want to know the URL for. The values are described in UIControlState. + */ +- (nullable NSURL *)sd_imageURLForState:(UIControlState)state; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Background Image + +/** + * Get the current background image URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentBackgroundImageURL; + +/** + * Get the background image URL for a control state. + * + * @param state Which state you want to know the URL for. The values are described in UIControlState. + */ +- (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state; + +/** + * Set the button `backgroundImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `backgroundImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `backgroundImage` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `backgroundImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `backgroundImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Cancel + +/** + * Cancel the current image download + */ +- (void)sd_cancelImageLoadForState:(UIControlState)state; + +/** + * Cancel the current backgroundImage download + */ +- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state; + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m b/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m new file mode 100644 index 0000000..4ccd029 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m @@ -0,0 +1,234 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIButton+WebCache.h" + +#if SD_UIKIT + +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" +#import "SDInternalMacros.h" + +static char imageURLStorageKey; + +typedef NSMutableDictionary SDStateImageURLDictionary; + +static inline NSString * imageURLKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"image_%lu", (unsigned long)state]; +} + +static inline NSString * backgroundImageURLKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"backgroundImage_%lu", (unsigned long)state]; +} + +static inline NSString * imageOperationKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"UIButtonImageOperation%lu", (unsigned long)state]; +} + +static inline NSString * backgroundImageOperationKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"UIButtonBackgroundImageOperation%lu", (unsigned long)state]; +} + +@implementation UIButton (WebCache) + +#pragma mark - Image + +- (nullable NSURL *)sd_currentImageURL { + NSURL *url = self.sd_imageURLStorage[imageURLKeyForState(self.state)]; + + if (!url) { + url = self.sd_imageURLStorage[imageURLKeyForState(UIControlStateNormal)]; + } + + return url; +} + +- (nullable NSURL *)sd_imageURLForState:(UIControlState)state { + return self.sd_imageURLStorage[imageURLKeyForState(state)]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { + [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + if (!url) { + [self.sd_imageURLStorage removeObjectForKey:imageURLKeyForState(state)]; + } else { + self.sd_imageURLStorage[imageURLKeyForState(state)] = url; + } + + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = imageOperationKeyForState(state); + @weakify(self); + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + [self setImage:image forState:state]; + } + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Background Image + +- (nullable NSURL *)sd_currentBackgroundImageURL { + NSURL *url = self.sd_imageURLStorage[backgroundImageURLKeyForState(self.state)]; + + if (!url) { + url = self.sd_imageURLStorage[backgroundImageURLKeyForState(UIControlStateNormal)]; + } + + return url; +} + +- (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state { + return self.sd_imageURLStorage[backgroundImageURLKeyForState(state)]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + if (!url) { + [self.sd_imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)]; + } else { + self.sd_imageURLStorage[backgroundImageURLKeyForState(state)] = url; + } + + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = backgroundImageOperationKeyForState(state); + @weakify(self); + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + [self setBackgroundImage:image forState:state]; + } + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Cancel + +- (void)sd_cancelImageLoadForState:(UIControlState)state { + [self sd_cancelImageLoadOperationWithKey:imageOperationKeyForState(state)]; +} + +- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { + [self sd_cancelImageLoadOperationWithKey:backgroundImageOperationKeyForState(state)]; +} + +#pragma mark - Private + +- (SDStateImageURLDictionary *)sd_imageURLStorage { + SDStateImageURLDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey); + if (!storage) { + storage = [NSMutableDictionary dictionary]; + objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + + return storage; +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h new file mode 100644 index 0000000..482c8c4 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h @@ -0,0 +1,24 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* (c) Fabrice Aneche +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +@interface UIImage (ExtendedCacheData) + +/** + Read and Write the extended object and bind it to the image. Which can hold some extra metadata like Image's scale factor, URL rich link, date, etc. + The extended object should conforms to NSCoding, which we use `NSKeyedArchiver` and `NSKeyedUnarchiver` to archive it to data, and write to disk cache. + @note The disk cache preserve both of the data and extended data with the same cache key. For manual query, use the `SDDiskCache` protocol method `extendedDataForKey:` instead. + @note You can specify arbitrary object conforms to NSCoding (NSObject protocol here is used to support object using `NS_ROOT_CLASS`, which is not NSObject subclass). If you load image from disk cache, you should check the extended object class to avoid corrupted data. + @warning This object don't need to implements NSSecureCoding (but it's recommended), because we allows arbitrary class. + */ +@property (nonatomic, strong, nullable) id sd_extendedObject; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m new file mode 100644 index 0000000..05d29cf --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m @@ -0,0 +1,23 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* (c) Fabrice Aneche +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "UIImage+ExtendedCacheData.h" +#import + +@implementation UIImage (ExtendedCacheData) + +- (id)sd_extendedObject { + return objc_getAssociatedObject(self, @selector(sd_extendedObject)); +} + +- (void)setSd_extendedObject:(id)sd_extendedObject { + objc_setAssociatedObject(self, @selector(sd_extendedObject), sd_extendedObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h new file mode 100644 index 0000000..f368746 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h @@ -0,0 +1,46 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +/** + UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior). + */ +@interface UIImage (ForceDecode) + +/** + A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode. + */ +@property (nonatomic, assign) BOOL sd_isDecoded; + +/** + Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance. + + @param image The image to be decoded + @return The decoded image + */ ++ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image; + +/** + Decode and scale down the provided image + + @param image The image to be decoded + @return The decoded and scaled down image + */ ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image; + +/** + Decode and scale down the provided image with limit bytes + + @param image The image to be decoded + @param bytes The limit bytes size. Provide 0 to use the build-in limit. + @return The decoded and scaled down image + */ ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m new file mode 100644 index 0000000..1b20bbd --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m @@ -0,0 +1,42 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+ForceDecode.h" +#import "SDImageCoderHelper.h" +#import "objc/runtime.h" + +@implementation UIImage (ForceDecode) + +- (BOOL)sd_isDecoded { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isDecoded)); + return value.boolValue; +} + +- (void)setSd_isDecoded:(BOOL)sd_isDecoded { + objc_setAssociatedObject(self, @selector(sd_isDecoded), @(sd_isDecoded), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + ++ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image { + if (!image) { + return nil; + } + return [SDImageCoderHelper decodedImageWithImage:image]; +} + ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image { + return [self sd_decodedAndScaledDownImageWithImage:image limitBytes:0]; +} + ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes { + if (!image) { + return nil; + } + return [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h new file mode 100644 index 0000000..5da8e19 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h @@ -0,0 +1,26 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Laurin Brandner + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +/** + This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directly use `SDImageCoder`. + */ +@interface UIImage (GIF) + +/** + Creates an animated UIImage from an NSData. + This will create animated image if the data is Animated GIF. And will create a static image is the data is Static GIF. + + @param data The GIF data + @return The created image + */ ++ (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m new file mode 100644 index 0000000..7158cf3 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m @@ -0,0 +1,22 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Laurin Brandner + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+GIF.h" +#import "SDImageGIFCoder.h" + +@implementation UIImage (GIF) + ++ (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data { + if (!data) { + return nil; + } + return [[SDImageGIFCoder sharedCoder] decodedImageWithData:data options:0]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h new file mode 100644 index 0000000..0ff2f2f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h @@ -0,0 +1,27 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +/** + UIImage category for memory cache cost. + */ +@interface UIImage (MemoryCacheCost) + +/** + The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory. + If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost. + + For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Return full frame bytes size when `image.images` is not nil for animated image. + For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory. + @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods. + @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes. + */ +@property (assign, nonatomic) NSUInteger sd_memoryCost; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m new file mode 100644 index 0000000..b0883b1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m @@ -0,0 +1,46 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+MemoryCacheCost.h" +#import "objc/runtime.h" +#import "NSImage+Compatibility.h" + +FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) { + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + return 0; + } + NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); + NSUInteger frameCount; +#if SD_MAC + frameCount = 1; +#elif SD_UIKIT || SD_WATCH + frameCount = image.images.count > 0 ? image.images.count : 1; +#endif + NSUInteger cost = bytesPerFrame * frameCount; + return cost; +} + +@implementation UIImage (MemoryCacheCost) + +- (NSUInteger)sd_memoryCost { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost)); + NSUInteger memoryCost; + if (value != nil) { + memoryCost = [value unsignedIntegerValue]; + } else { + memoryCost = SDMemoryCacheCostForImage(self); + } + return memoryCost; +} + +- (void)setSd_memoryCost:(NSUInteger)sd_memoryCost { + objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h new file mode 100644 index 0000000..8328c26 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h @@ -0,0 +1,57 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "NSData+ImageContentType.h" + +/** + UIImage category for image metadata, including animation, loop count, format, incremental, etc. + */ +@interface UIImage (Metadata) + +/** + * UIKit: + * For static image format, this value is always 0. + * For animated image format, 0 means infinite looping. + * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. + * AppKit: + * NSImage currently only support animated via GIF imageRep unlike UIImage. + * The getter of this property will get the loop count from GIF imageRep + * The setter of this property will set the loop count from GIF imageRep + */ +@property (nonatomic, assign) NSUInteger sd_imageLoopCount; + +/** + * UIKit: + * Check the `images` array property. + * AppKit: + * NSImage currently only support animated via GIF imageRep unlike UIImage. It will check the imageRep's frame count. + */ +@property (nonatomic, assign, readonly) BOOL sd_isAnimated; + +/** + * UIKit: + * Check the `isSymbolImage` property. Also check the system PDF(iOS 11+) && SVG(iOS 13+) support. + * AppKit: + * NSImage supports PDF && SVG && EPS imageRep, check the imageRep class. + */ +@property (nonatomic, assign, readonly) BOOL sd_isVector; + +/** + * The image format represent the original compressed image data format. + * If you don't manually specify a format, this information is retrieve from CGImage using `CGImageGetUTType`, which may return nil for non-CG based image. At this time it will return `SDImageFormatUndefined` as default value. + * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. + */ +@property (nonatomic, assign) SDImageFormat sd_imageFormat; + +/** + A bool value indicating whether the image is during incremental decoding and may not contains full pixels. + */ +@property (nonatomic, assign) BOOL sd_isIncremental; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m new file mode 100644 index 0000000..0972423 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m @@ -0,0 +1,150 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+Metadata.h" +#import "NSImage+Compatibility.h" +#import "SDInternalMacros.h" +#import "objc/runtime.h" + +@implementation UIImage (Metadata) + +#if SD_UIKIT || SD_WATCH + +- (NSUInteger)sd_imageLoopCount { + NSUInteger imageLoopCount = 0; + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount)); + if ([value isKindOfClass:[NSNumber class]]) { + imageLoopCount = value.unsignedIntegerValue; + } + return imageLoopCount; +} + +- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { + NSNumber *value = @(sd_imageLoopCount); + objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)sd_isAnimated { + return (self.images != nil); +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" +- (BOOL)sd_isVector { + if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + // Xcode 11 supports symbol image, keep Xcode 10 compatible currently + SEL SymbolSelector = NSSelectorFromString(@"isSymbolImage"); + if ([self respondsToSelector:SymbolSelector] && [self performSelector:SymbolSelector]) { + return YES; + } + // SVG + SEL SVGSelector = SD_SEL_SPI(CGSVGDocument); + if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector]) { + return YES; + } + } + if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) { + // PDF + SEL PDFSelector = SD_SEL_SPI(CGPDFPage); + if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector]) { + return YES; + } + } + return NO; +} +#pragma clang diagnostic pop + +#else + +- (NSUInteger)sd_imageLoopCount { + NSUInteger imageLoopCount = 0; + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + imageLoopCount = [[bitmapImageRep valueForProperty:NSImageLoopCount] unsignedIntegerValue]; + } + return imageLoopCount; +} + +- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + [bitmapImageRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)]; + } +} + +- (BOOL)sd_isAnimated { + BOOL isAnimated = NO; + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + NSUInteger frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; + isAnimated = frameCount > 1 ? YES : NO; + } + return isAnimated; +} + +- (BOOL)sd_isVector { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + if ([imageRep isKindOfClass:[NSPDFImageRep class]]) { + return YES; + } + if ([imageRep isKindOfClass:[NSEPSImageRep class]]) { + return YES; + } + if ([NSStringFromClass(imageRep.class) hasSuffix:@"NSSVGImageRep"]) { + return YES; + } + return NO; +} + +#endif + +- (SDImageFormat)sd_imageFormat { + SDImageFormat imageFormat = SDImageFormatUndefined; + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFormat)); + if ([value isKindOfClass:[NSNumber class]]) { + imageFormat = value.integerValue; + return imageFormat; + } + // Check CGImage's UTType, may return nil for non-Image/IO based image + if (@available(iOS 9.0, tvOS 9.0, macOS 10.11, watchOS 2.0, *)) { + CFStringRef uttype = CGImageGetUTType(self.CGImage); + imageFormat = [NSData sd_imageFormatFromUTType:uttype]; + } + return imageFormat; +} + +- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat { + objc_setAssociatedObject(self, @selector(sd_imageFormat), @(sd_imageFormat), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (void)setSd_isIncremental:(BOOL)sd_isIncremental { + objc_setAssociatedObject(self, @selector(sd_isIncremental), @(sd_isIncremental), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)sd_isIncremental { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isIncremental)); + return value.boolValue; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h new file mode 100644 index 0000000..a0935b5 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h @@ -0,0 +1,80 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "NSData+ImageContentType.h" + +/** + UIImage category for convenient image format decoding/encoding. + */ +@interface UIImage (MultiFormat) +#pragma mark - Decode +/** + Create and decode a image with the specify image data + + @param data The image data + @return The created image + */ ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; + +/** + Create and decode a image with the specify image data and scale + + @param data The image data + @param scale The image scale factor. Should be greater than or equal to 1.0. + @return The created image + */ ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale; + +/** + Create and decode a image with the specify image data and scale, allow specify animate/static control + + @param data The image data + @param scale The image scale factor. Should be greater than or equal to 1.0. + @param firstFrameOnly Even if the image data is animated image format, decode the first frame only as static image. + @return The created image + */ ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly; + +#pragma mark - Encode +/** + Encode the current image to the data, the image format is unspecified + + @note If the receiver is `SDAnimatedImage`, this will return the animated image data if available. No more extra encoding process. + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageData; + +/** + Encode the current image to data with the specify image format + + @param imageFormat The specify image format + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat NS_SWIFT_NAME(sd_imageData(as:)); + +/** + Encode the current image to data with the specify image format and compression quality + + @param imageFormat The specify image format + @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality. + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality NS_SWIFT_NAME(sd_imageData(as:compressionQuality:)); + +/** + Encode the current image to data with the specify image format and compression quality, allow specify animate/static control + + @param imageFormat The specify image format + @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality. + @param firstFrameOnly Even if the image is animated image, encode the first frame only as static image. + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly NS_SWIFT_NAME(sd_imageData(as:compressionQuality:firstFrameOnly:)); + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m new file mode 100644 index 0000000..04d08c5 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m @@ -0,0 +1,47 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+MultiFormat.h" +#import "SDImageCodersManager.h" + +@implementation UIImage (MultiFormat) + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { + return [self sd_imageWithData:data scale:1]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale { + return [self sd_imageWithData:data scale:scale firstFrameOnly:NO]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly { + if (!data) { + return nil; + } + SDImageCoderOptions *options = @{SDImageCoderDecodeScaleFactor : @(MAX(scale, 1)), SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}; + return [[SDImageCodersManager sharedManager] decodedImageWithData:data options:options]; +} + +- (nullable NSData *)sd_imageData { + return [self sd_imageDataAsFormat:SDImageFormatUndefined]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:1]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly { + SDImageCoderOptions *options = @{SDImageCoderEncodeCompressionQuality : @(compressionQuality), SDImageCoderEncodeFirstFrameOnly : @(firstFrameOnly)}; + return [[SDImageCodersManager sharedManager] encodedDataWithImage:self format:imageFormat options:options]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h b/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h new file mode 100644 index 0000000..06cb66d --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h @@ -0,0 +1,146 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +typedef NS_ENUM(NSUInteger, SDImageScaleMode) { + SDImageScaleModeFill = 0, + SDImageScaleModeAspectFit = 1, + SDImageScaleModeAspectFill = 2 +}; + +#if SD_UIKIT || SD_WATCH +typedef UIRectCorner SDRectCorner; +#else +typedef NS_OPTIONS(NSUInteger, SDRectCorner) { + SDRectCornerTopLeft = 1 << 0, + SDRectCornerTopRight = 1 << 1, + SDRectCornerBottomLeft = 1 << 2, + SDRectCornerBottomRight = 1 << 3, + SDRectCornerAllCorners = ~0UL +}; +#endif + +/** + Provide some common method for `UIImage`. + Image process is based on Core Graphics and vImage. + */ +@interface UIImage (Transform) + +#pragma mark - Image Geometry + +/** + Returns a new image which is resized from this image. + You can specify a larger or smaller size than the image size. The image content will be changed with the scale mode. + + @param size The new size to be resized, values should be positive. + @param scaleMode The scale mode for image content. + @return The new image with the given size. + */ +- (nullable UIImage *)sd_resizedImageWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode; + +/** + Returns a new image which is cropped from this image. + + @param rect Image's inner rect. + @return The new image with the cropping rect. + */ +- (nullable UIImage *)sd_croppedImageWithRect:(CGRect)rect; + +/** + Rounds a new image with a given corner radius and corners. + + @param cornerRadius The radius of each corner oval. Values larger than half the + rectangle's width or height are clamped appropriately to + half the width or height. + @param corners A bitmask value that identifies the corners that you want + rounded. You can use this parameter to round only a subset + of the corners of the rectangle. + @param borderWidth The inset border line width. Values larger than half the rectangle's + width or height are clamped appropriately to half the width + or height. + @param borderColor The border stroke color. nil means clear color. + @return The new image with the round corner. + */ +- (nullable UIImage *)sd_roundedCornerImageWithRadius:(CGFloat)cornerRadius + corners:(SDRectCorner)corners + borderWidth:(CGFloat)borderWidth + borderColor:(nullable UIColor *)borderColor; + +/** + Returns a new rotated image (relative to the center). + + @param angle Rotated radians in counterclockwise.⟲ + @param fitSize YES: new image's size is extend to fit all content. + NO: image's size will not change, content may be clipped. + @return The new image with the rotation. + */ +- (nullable UIImage *)sd_rotatedImageWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize; + +/** + Returns a new horizontally(vertically) flipped image. + + @param horizontal YES to flip the image horizontally. ⇋ + @param vertical YES to flip the image vertically. ⥯ + @return The new image with the flipping. + */ +- (nullable UIImage *)sd_flippedImageWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical; + +#pragma mark - Image Blending + +/** + Return a tinted image with the given color. This actually use alpha blending of current image and the tint color. + + @param tintColor The tint color. + @return The new image with the tint color. + */ +- (nullable UIImage *)sd_tintedImageWithColor:(nonnull UIColor *)tintColor; + +/** + Return the pixel color at specify position. The point is from the top-left to the bottom-right and 0-based. The returned the color is always be RGBA format. The image must be CG-based. + @note The point's x/y should not be smaller than 0, or greater than or equal to width/height. + @note The overhead of object creation means this method is best suited for infrequent color sampling. For heavy image processing, grab the raw bitmap data and process yourself. + + @param point The position of pixel + @return The color for specify pixel, or nil if any error occur + */ +- (nullable UIColor *)sd_colorAtPoint:(CGPoint)point; + +/** + Return the pixel color array with specify rectangle. The rect is from the top-left to the bottom-right and 0-based. The returned the color is always be RGBA format. The image must be CG-based. + @note The rect's width/height should not be smaller than or equal to 0. The minX/minY should not be smaller than 0. The maxX/maxY should not be greater than width/height. Attention this limit is different from `sd_colorAtPoint:` (point: (0, 0) like rect: (0, 0, 1, 1)) + @note The overhead of object creation means this method is best suited for infrequent color sampling. For heavy image processing, grab the raw bitmap data and process yourself. + + @param rect The rectangle of pixels + @return The color array for specify pixels, or nil if any error occur + */ +- (nullable NSArray *)sd_colorsWithRect:(CGRect)rect; + +#pragma mark - Image Effect + +/** + Return a new image applied a blur effect. + + @param blurRadius The radius of the blur in points, 0 means no blur effect. + + @return The new image with blur effect, or nil if an error occurs (e.g. no enough memory). + */ +- (nullable UIImage *)sd_blurredImageWithRadius:(CGFloat)blurRadius; + +#if SD_UIKIT || SD_MAC +/** + Return a new image applied a CIFilter. + + @param filter The CIFilter to be applied to the image. + @return The new image with the CIFilter, or nil if an error occurs (e.g. no + enough memory). + */ +- (nullable UIImage *)sd_filteredImageWithFilter:(nonnull CIFilter *)filter; +#endif + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m b/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m new file mode 100644 index 0000000..b27b3a9 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m @@ -0,0 +1,711 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+Transform.h" +#import "NSImage+Compatibility.h" +#import "SDImageGraphics.h" +#import "SDGraphicsImageRenderer.h" +#import "NSBezierPath+SDRoundedCorners.h" +#import +#if SD_UIKIT || SD_MAC +#import +#endif + +static inline CGRect SDCGRectFitWithScaleMode(CGRect rect, CGSize size, SDImageScaleMode scaleMode) { + rect = CGRectStandardize(rect); + size.width = size.width < 0 ? -size.width : size.width; + size.height = size.height < 0 ? -size.height : size.height; + CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); + switch (scaleMode) { + case SDImageScaleModeAspectFit: + case SDImageScaleModeAspectFill: { + if (rect.size.width < 0.01 || rect.size.height < 0.01 || + size.width < 0.01 || size.height < 0.01) { + rect.origin = center; + rect.size = CGSizeZero; + } else { + CGFloat scale; + if (scaleMode == SDImageScaleModeAspectFit) { + if (size.width / size.height < rect.size.width / rect.size.height) { + scale = rect.size.height / size.height; + } else { + scale = rect.size.width / size.width; + } + } else { + if (size.width / size.height < rect.size.width / rect.size.height) { + scale = rect.size.width / size.width; + } else { + scale = rect.size.height / size.height; + } + } + size.width *= scale; + size.height *= scale; + rect.size = size; + rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5); + } + } break; + case SDImageScaleModeFill: + default: { + rect = rect; + } + } + return rect; +} + +static inline UIColor * SDGetColorFromPixel(Pixel_8888 pixel, CGBitmapInfo bitmapInfo) { + // Get alpha info, byteOrder info + CGImageAlphaInfo alphaInfo = bitmapInfo & kCGBitmapAlphaInfoMask; + CGBitmapInfo byteOrderInfo = bitmapInfo & kCGBitmapByteOrderMask; + CGFloat r = 0, g = 0, b = 0, a = 1; + + BOOL byteOrderNormal = NO; + switch (byteOrderInfo) { + case kCGBitmapByteOrderDefault: { + byteOrderNormal = YES; + } break; + case kCGBitmapByteOrder32Little: { + } break; + case kCGBitmapByteOrder32Big: { + byteOrderNormal = YES; + } break; + default: break; + } + switch (alphaInfo) { + case kCGImageAlphaPremultipliedFirst: + case kCGImageAlphaFirst: { + if (byteOrderNormal) { + // ARGB8888 + a = pixel[0] / 255.0; + r = pixel[1] / 255.0; + g = pixel[2] / 255.0; + b = pixel[3] / 255.0; + } else { + // BGRA8888 + b = pixel[0] / 255.0; + g = pixel[1] / 255.0; + r = pixel[2] / 255.0; + a = pixel[3] / 255.0; + } + } + break; + case kCGImageAlphaPremultipliedLast: + case kCGImageAlphaLast: { + if (byteOrderNormal) { + // RGBA8888 + r = pixel[0] / 255.0; + g = pixel[1] / 255.0; + b = pixel[2] / 255.0; + a = pixel[3] / 255.0; + } else { + // ABGR8888 + a = pixel[0] / 255.0; + b = pixel[1] / 255.0; + g = pixel[2] / 255.0; + r = pixel[3] / 255.0; + } + } + break; + case kCGImageAlphaNone: { + if (byteOrderNormal) { + // RGB + r = pixel[0] / 255.0; + g = pixel[1] / 255.0; + b = pixel[2] / 255.0; + } else { + // BGR + b = pixel[0] / 255.0; + g = pixel[1] / 255.0; + r = pixel[2] / 255.0; + } + } + break; + case kCGImageAlphaNoneSkipLast: { + if (byteOrderNormal) { + // RGBX + r = pixel[0] / 255.0; + g = pixel[1] / 255.0; + b = pixel[2] / 255.0; + } else { + // XBGR + b = pixel[1] / 255.0; + g = pixel[2] / 255.0; + r = pixel[3] / 255.0; + } + } + break; + case kCGImageAlphaNoneSkipFirst: { + if (byteOrderNormal) { + // XRGB + r = pixel[1] / 255.0; + g = pixel[2] / 255.0; + b = pixel[3] / 255.0; + } else { + // BGRX + b = pixel[0] / 255.0; + g = pixel[1] / 255.0; + r = pixel[2] / 255.0; + } + } + break; + case kCGImageAlphaOnly: { + // A + a = pixel[0] / 255.0; + } + break; + default: + break; + } + + return [UIColor colorWithRed:r green:g blue:b alpha:a]; +} + +#if SD_UIKIT || SD_MAC +// Create-Rule, caller should call CGImageRelease +static inline CGImageRef _Nullable SDCreateCGImageFromCIImage(CIImage * _Nonnull ciImage) { + CGImageRef imageRef = NULL; + if (@available(iOS 10, macOS 10.12, tvOS 10, *)) { + imageRef = ciImage.CGImage; + } + if (!imageRef) { + CIContext *context = [CIContext context]; + imageRef = [context createCGImage:ciImage fromRect:ciImage.extent]; + } else { + CGImageRetain(imageRef); + } + return imageRef; +} +#endif + +@implementation UIImage (Transform) + +- (void)sd_drawInRect:(CGRect)rect context:(CGContextRef)context scaleMode:(SDImageScaleMode)scaleMode clipsToBounds:(BOOL)clips { + CGRect drawRect = SDCGRectFitWithScaleMode(rect, self.size, scaleMode); + if (drawRect.size.width == 0 || drawRect.size.height == 0) return; + if (clips) { + if (context) { + CGContextSaveGState(context); + CGContextAddRect(context, rect); + CGContextClip(context); + [self drawInRect:drawRect]; + CGContextRestoreGState(context); + } + } else { + [self drawInRect:drawRect]; + } +} + +- (nullable UIImage *)sd_resizedImageWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode { + if (size.width <= 0 || size.height <= 0) return nil; + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + [self sd_drawInRect:CGRectMake(0, 0, size.width, size.height) context:context scaleMode:scaleMode clipsToBounds:NO]; + }]; + return image; +} + +- (nullable UIImage *)sd_croppedImageWithRect:(CGRect)rect { + rect.origin.x *= self.scale; + rect.origin.y *= self.scale; + rect.size.width *= self.scale; + rect.size.height *= self.scale; + if (rect.size.width <= 0 || rect.size.height <= 0) return nil; + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CGRect croppingRect = CGRectMake(rect.origin.x, self.size.height - CGRectGetMaxY(rect), rect.size.width, rect.size.height); + CIImage *ciImage = [self.CIImage imageByCroppingToRect:croppingRect]; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return nil; + } + + CGImageRef croppedImageRef = CGImageCreateWithImageInRect(imageRef, rect); + if (!croppedImageRef) { + return nil; + } +#if SD_UIKIT || SD_WATCH + UIImage *image = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:croppedImageRef scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(croppedImageRef); + return image; +} + +- (nullable UIImage *)sd_roundedCornerImageWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor { + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:self.size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height); + + CGFloat minSize = MIN(self.size.width, self.size.height); + if (borderWidth < minSize / 2) { +#if SD_UIKIT || SD_WATCH + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)]; +#else + NSBezierPath *path = [NSBezierPath sd_bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadius:cornerRadius]; +#endif + [path closePath]; + + CGContextSaveGState(context); + [path addClip]; + [self drawInRect:rect]; + CGContextRestoreGState(context); + } + + if (borderColor && borderWidth < minSize / 2 && borderWidth > 0) { + CGFloat strokeInset = (floor(borderWidth * self.scale) + 0.5) / self.scale; + CGRect strokeRect = CGRectInset(rect, strokeInset, strokeInset); + CGFloat strokeRadius = cornerRadius > self.scale / 2 ? cornerRadius - self.scale / 2 : 0; +#if SD_UIKIT || SD_WATCH + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadii:CGSizeMake(strokeRadius, strokeRadius)]; +#else + NSBezierPath *path = [NSBezierPath sd_bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadius:strokeRadius]; +#endif + [path closePath]; + + path.lineWidth = borderWidth; + [borderColor setStroke]; + [path stroke]; + } + }]; + return image; +} + +- (nullable UIImage *)sd_rotatedImageWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize { + size_t width = self.size.width; + size_t height = self.size.height; + CGRect newRect = CGRectApplyAffineTransform(CGRectMake(0, 0, width, height), + fitSize ? CGAffineTransformMakeRotation(angle) : CGAffineTransformIdentity); + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CIImage *ciImage = self.CIImage; + if (fitSize) { + CGAffineTransform transform = CGAffineTransformMakeRotation(angle); + ciImage = [ciImage imageByApplyingTransform:transform]; + } else { + CIFilter *filter = [CIFilter filterWithName:@"CIStraightenFilter"]; + [filter setValue:ciImage forKey:kCIInputImageKey]; + [filter setValue:@(angle) forKey:kCIInputAngleKey]; + ciImage = filter.outputImage; + } +#if SD_UIKIT || SD_WATCH + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:newRect.size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + CGContextSetShouldAntialias(context, true); + CGContextSetAllowsAntialiasing(context, true); + CGContextSetInterpolationQuality(context, kCGInterpolationHigh); + CGContextTranslateCTM(context, +(newRect.size.width * 0.5), +(newRect.size.height * 0.5)); +#if SD_UIKIT || SD_WATCH + // Use UIKit coordinate system counterclockwise (⟲) + CGContextRotateCTM(context, -angle); +#else + CGContextRotateCTM(context, angle); +#endif + + [self drawInRect:CGRectMake(-(width * 0.5), -(height * 0.5), width, height)]; + }]; + return image; +} + +- (nullable UIImage *)sd_flippedImageWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical { + size_t width = self.size.width; + size_t height = self.size.height; + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CGAffineTransform transform = CGAffineTransformIdentity; + // Use UIKit coordinate system + if (horizontal) { + CGAffineTransform flipHorizontal = CGAffineTransformMake(-1, 0, 0, 1, width, 0); + transform = CGAffineTransformConcat(transform, flipHorizontal); + } + if (vertical) { + CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height); + transform = CGAffineTransformConcat(transform, flipVertical); + } + CIImage *ciImage = [self.CIImage imageByApplyingTransform:transform]; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:self.size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + // Use UIKit coordinate system + if (horizontal) { + CGAffineTransform flipHorizontal = CGAffineTransformMake(-1, 0, 0, 1, width, 0); + CGContextConcatCTM(context, flipHorizontal); + } + if (vertical) { + CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height); + CGContextConcatCTM(context, flipVertical); + } + [self drawInRect:CGRectMake(0, 0, width, height)]; + }]; + return image; +} + +#pragma mark - Image Blending + +- (nullable UIImage *)sd_tintedImageWithColor:(nonnull UIColor *)tintColor { + BOOL hasTint = CGColorGetAlpha(tintColor.CGColor) > __FLT_EPSILON__; + if (!hasTint) { + return self; + } + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CIImage *ciImage = self.CIImage; + CIImage *colorImage = [CIImage imageWithColor:[[CIColor alloc] initWithColor:tintColor]]; + colorImage = [colorImage imageByCroppingToRect:ciImage.extent]; + CIFilter *filter = [CIFilter filterWithName:@"CISourceAtopCompositing"]; + [filter setValue:colorImage forKey:kCIInputImageKey]; + [filter setValue:ciImage forKey:kCIInputBackgroundImageKey]; + ciImage = filter.outputImage; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + CGSize size = self.size; + CGRect rect = { CGPointZero, size }; + CGFloat scale = self.scale; + + // blend mode, see https://en.wikipedia.org/wiki/Alpha_compositing + CGBlendMode blendMode = kCGBlendModeSourceAtop; + + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + [self drawInRect:rect]; + CGContextSetBlendMode(context, blendMode); + CGContextSetFillColorWithColor(context, tintColor.CGColor); + CGContextFillRect(context, rect); + }]; + return image; +} + +- (nullable UIColor *)sd_colorAtPoint:(CGPoint)point { + CGImageRef imageRef = NULL; + // CIImage compatible +#if SD_UIKIT || SD_MAC + if (self.CIImage) { + imageRef = SDCreateCGImageFromCIImage(self.CIImage); + } +#endif + if (!imageRef) { + imageRef = self.CGImage; + CGImageRetain(imageRef); + } + if (!imageRef) { + return nil; + } + + // Check point + CGFloat width = CGImageGetWidth(imageRef); + CGFloat height = CGImageGetHeight(imageRef); + if (point.x < 0 || point.y < 0 || point.x >= width || point.y >= height) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixels + CGDataProviderRef provider = CGImageGetDataProvider(imageRef); + if (!provider) { + CGImageRelease(imageRef); + return nil; + } + CFDataRef data = CGDataProviderCopyData(provider); + if (!data) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixel at point + size_t bytesPerRow = CGImageGetBytesPerRow(imageRef); + size_t components = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + + CFRange range = CFRangeMake(bytesPerRow * point.y + components * point.x, 4); + if (CFDataGetLength(data) < range.location + range.length) { + CFRelease(data); + CGImageRelease(imageRef); + return nil; + } + Pixel_8888 pixel = {0}; + CFDataGetBytes(data, range, pixel); + CFRelease(data); + CGImageRelease(imageRef); + // Convert to color + return SDGetColorFromPixel(pixel, bitmapInfo); +} + +- (nullable NSArray *)sd_colorsWithRect:(CGRect)rect { + CGImageRef imageRef = NULL; + // CIImage compatible +#if SD_UIKIT || SD_MAC + if (self.CIImage) { + imageRef = SDCreateCGImageFromCIImage(self.CIImage); + } +#endif + if (!imageRef) { + imageRef = self.CGImage; + CGImageRetain(imageRef); + } + if (!imageRef) { + return nil; + } + + // Check rect + CGFloat width = CGImageGetWidth(imageRef); + CGFloat height = CGImageGetHeight(imageRef); + if (CGRectGetWidth(rect) <= 0 || CGRectGetHeight(rect) <= 0 || CGRectGetMinX(rect) < 0 || CGRectGetMinY(rect) < 0 || CGRectGetMaxX(rect) > width || CGRectGetMaxY(rect) > height) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixels + CGDataProviderRef provider = CGImageGetDataProvider(imageRef); + if (!provider) { + CGImageRelease(imageRef); + return nil; + } + CFDataRef data = CGDataProviderCopyData(provider); + if (!data) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixels with rect + size_t bytesPerRow = CGImageGetBytesPerRow(imageRef); + size_t components = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef); + + size_t start = bytesPerRow * CGRectGetMinY(rect) + components * CGRectGetMinX(rect); + size_t end = bytesPerRow * (CGRectGetMaxY(rect) - 1) + components * CGRectGetMaxX(rect); + if (CFDataGetLength(data) < (CFIndex)end) { + CFRelease(data); + CGImageRelease(imageRef); + return nil; + } + + const UInt8 *pixels = CFDataGetBytePtr(data); + size_t row = CGRectGetMinY(rect); + size_t col = CGRectGetMaxX(rect); + + // Convert to color + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + NSMutableArray *colors = [NSMutableArray arrayWithCapacity:CGRectGetWidth(rect) * CGRectGetHeight(rect)]; + for (size_t index = start; index < end; index += 4) { + if (index >= row * bytesPerRow + col * components) { + // Index beyond the end of current row, go next row + row++; + index = row * bytesPerRow + CGRectGetMinX(rect) * components; + index -= 4; + continue; + } + Pixel_8888 pixel = {pixels[index], pixels[index+1], pixels[index+2], pixels[index+3]}; + UIColor *color = SDGetColorFromPixel(pixel, bitmapInfo); + [colors addObject:color]; + } + CFRelease(data); + CGImageRelease(imageRef); + + return [colors copy]; +} + +#pragma mark - Image Effect + +// We use vImage to do box convolve for performance and support for watchOS. However, you can just use `CIFilter.CIGaussianBlur`. For other blur effect, use any filter in `CICategoryBlur` +- (nullable UIImage *)sd_blurredImageWithRadius:(CGFloat)blurRadius { + if (self.size.width < 1 || self.size.height < 1) { + return nil; + } + BOOL hasBlur = blurRadius > __FLT_EPSILON__; + if (!hasBlur) { + return self; + } + + CGFloat scale = self.scale; + CGFloat inputRadius = blurRadius * scale; +#if SD_UIKIT || SD_MAC + if (self.CIImage) { + CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"]; + [filter setValue:self.CIImage forKey:kCIInputImageKey]; + [filter setValue:@(inputRadius) forKey:kCIInputRadiusKey]; + CIImage *ciImage = filter.outputImage; + ciImage = [ciImage imageByCroppingToRect:CGRectMake(0, 0, self.size.width, self.size.height)]; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + CGImageRef imageRef = self.CGImage; + + //convert to BGRA if it isn't + if (CGImageGetBitsPerPixel(imageRef) != 32 || + CGImageGetBitsPerComponent(imageRef) != 8 || + !((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask))) { + SDGraphicsBeginImageContextWithOptions(self.size, NO, self.scale); + [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)]; + imageRef = SDGraphicsGetImageFromCurrentImageContext().CGImage; + SDGraphicsEndImageContext(); + } + + vImage_Buffer effect = {}, scratch = {}; + vImage_Buffer *input = NULL, *output = NULL; + + vImage_CGImageFormat format = { + .bitsPerComponent = 8, + .bitsPerPixel = 32, + .colorSpace = NULL, + .bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, //requests a BGRA buffer. + .version = 0, + .decode = NULL, + .renderingIntent = kCGRenderingIntentDefault + }; + + vImage_Error err; + err = vImageBuffer_InitWithCGImage(&effect, &format, NULL, imageRef, kvImageNoFlags); + if (err != kvImageNoError) { + NSLog(@"UIImage+Transform error: vImageBuffer_InitWithCGImage returned error code %zi for inputImage: %@", err, self); + return nil; + } + err = vImageBuffer_Init(&scratch, effect.height, effect.width, format.bitsPerPixel, kvImageNoFlags); + if (err != kvImageNoError) { + NSLog(@"UIImage+Transform error: vImageBuffer_Init returned error code %zi for inputImage: %@", err, self); + return nil; + } + + input = &effect; + output = &scratch; + + if (hasBlur) { + // A description of how to compute the box kernel width from the Gaussian + // radius (aka standard deviation) appears in the SVG spec: + // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement + // + // For larger values of 's' (s >= 2.0), an approximation can be used: Three + // successive box-blurs build a piece-wise quadratic convolution kernel, which + // approximates the Gaussian kernel to within roughly 3%. + // + // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) + // + // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. + // + if (inputRadius - 2.0 < __FLT_EPSILON__) inputRadius = 2.0; + uint32_t radius = floor(inputRadius * 3.0 * sqrt(2 * M_PI) / 4 + 0.5); + radius |= 1; // force radius to be odd so that the three box-blur methodology works. + int iterations; + if (blurRadius * scale < 0.5) iterations = 1; + else if (blurRadius * scale < 1.5) iterations = 2; + else iterations = 3; + NSInteger tempSize = vImageBoxConvolve_ARGB8888(input, output, NULL, 0, 0, radius, radius, NULL, kvImageGetTempBufferSize | kvImageEdgeExtend); + void *temp = malloc(tempSize); + for (int i = 0; i < iterations; i++) { + vImageBoxConvolve_ARGB8888(input, output, temp, 0, 0, radius, radius, NULL, kvImageEdgeExtend); + vImage_Buffer *tmp = input; + input = output; + output = tmp; + } + free(temp); + } + + CGImageRef effectCGImage = NULL; + effectCGImage = vImageCreateCGImageFromBuffer(input, &format, NULL, NULL, kvImageNoAllocate, NULL); + if (effectCGImage == NULL) { + effectCGImage = vImageCreateCGImageFromBuffer(input, &format, NULL, NULL, kvImageNoFlags, NULL); + free(input->data); + } + free(output->data); +#if SD_UIKIT || SD_WATCH + UIImage *outputImage = [UIImage imageWithCGImage:effectCGImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *outputImage = [[UIImage alloc] initWithCGImage:effectCGImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(effectCGImage); + + return outputImage; +} + +#if SD_UIKIT || SD_MAC +- (nullable UIImage *)sd_filteredImageWithFilter:(nonnull CIFilter *)filter { + CIImage *inputImage; + if (self.CIImage) { + inputImage = self.CIImage; + } else { + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return nil; + } + inputImage = [CIImage imageWithCGImage:imageRef]; + } + if (!inputImage) return nil; + + CIContext *context = [CIContext context]; + [filter setValue:inputImage forKey:kCIInputImageKey]; + CIImage *outputImage = filter.outputImage; + if (!outputImage) return nil; + + CGImageRef imageRef = [context createCGImage:outputImage fromRect:outputImage.extent]; + if (!imageRef) return nil; + +#if SD_UIKIT + UIImage *image = [UIImage imageWithCGImage:imageRef scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(imageRef); + + return image; +} +#endif + +@end diff --git a/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h b/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h similarity index 62% rename from Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h rename to Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h index ceb71c2..6cd3ba6 100644 --- a/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h +++ b/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h @@ -24,7 +24,7 @@ * * @param url The url for the image. */ -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url; +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; /** * Set the imageView `highlightedImage` with an `url` and custom options. @@ -35,7 +35,20 @@ * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. */ - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url - options:(SDWebImageOptions)options; + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `highlightedImage` with an `url`, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; /** * Set the imageView `highlightedImage` with an `url`. @@ -50,7 +63,7 @@ * The fourth parameter is the original image url. */ - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url - completed:(nullable SDExternalCompletionBlock)completedBlock; + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; /** * Set the imageView `highlightedImage` with an `url` and custom options. @@ -86,7 +99,29 @@ */ - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `highlightedImage` with an `url`, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock; @end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m b/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m new file mode 100644 index 0000000..96c09c1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m @@ -0,0 +1,76 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImageView+HighlightedWebCache.h" + +#if SD_UIKIT + +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" +#import "SDInternalMacros.h" + +static NSString * const SDHighlightedImageOperationKey = @"UIImageViewImageOperationHighlighted"; + +@implementation UIImageView (HighlightedWebCache) + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { + [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { + [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setHighlightedImageWithURL:url options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setHighlightedImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + @weakify(self); + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = SDHighlightedImageOperationKey; + [self sd_internalSetImageWithURL:url + placeholderImage:nil + options:options + context:mutableContext + setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + self.highlightedImage = image; + } + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.h b/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h similarity index 78% rename from Pods/SDWebImage/SDWebImage/UIImageView+WebCache.h rename to Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h index b1d954f..626de9d 100644 --- a/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.h +++ b/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h @@ -7,14 +7,9 @@ */ #import "SDWebImageCompat.h" - -#if SD_UIKIT || SD_MAC - #import "SDWebImageManager.h" /** - * Integrates SDWebImage async downloading and caching of remote images with UIImageView. - * * Usage with a UITableViewCell sub-class: * * @code @@ -30,11 +25,10 @@ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] - autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]; } - // Here we use the provided sd_setImageWithURL: method to load the web image + // Here we use the provided sd_setImageWithURL:placeholderImage: method to load the web image // Ensure you use a placeholder image otherwise cells will be initialized with no image [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder"]]; @@ -45,6 +39,10 @@ * @endcode */ + +/** + * Integrates SDWebImage async downloading and caching of remote images with UIImageView. + */ @interface UIImageView (WebCache) /** @@ -54,7 +52,7 @@ * * @param url The url for the image. */ -- (void)sd_setImageWithURL:(nullable NSURL *)url; +- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; /** * Set the imageView `image` with an `url` and a placeholder. @@ -66,7 +64,7 @@ * @see sd_setImageWithURL:placeholderImage:options: */ - (void)sd_setImageWithURL:(nullable NSURL *)url - placeholderImage:(nullable UIImage *)placeholder; + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; /** * Set the imageView `image` with an `url`, placeholder and custom options. @@ -79,7 +77,22 @@ */ - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options; + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; /** * Set the imageView `image` with an `url`. @@ -111,7 +124,7 @@ */ - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder - completed:(nullable SDExternalCompletionBlock)completedBlock; + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; /** * Set the imageView `image` with an `url`, placeholder and custom options. @@ -151,17 +164,18 @@ - (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock; /** - * Set the imageView `image` with an `url` and optionally a placeholder image. + * Set the imageView `image` with an `url`, placeholder, custom options and context. * * The download is asynchronous and cached. * * @param url The url for the image. * @param placeholder The image to be set initially, until the image request finishes. * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. * @param progressBlock A block called while image is downloading * @note the progress block is executed on a background queue * @param completedBlock A block called when operation has been completed. This block has no return value @@ -170,27 +184,11 @@ * indicating if the image was retrieved from the local cache or from the network. * The fourth parameter is the original image url. */ -- (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDExternalCompletionBlock)completedBlock; - -#if SD_UIKIT - -#pragma mark - Animation of multiple images - -/** - * Download an array of images and starts them in an animation loop - * - * @param arrayOfURLs An array of NSURL - */ -- (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs; - -- (void)sd_cancelCurrentAnimationImagesLoad; - -#endif +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; @end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m b/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m new file mode 100644 index 0000000..9d7f18e --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m @@ -0,0 +1,67 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImageView+WebCache.h" +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" + +@implementation UIImageView (WebCache) + +- (void)sd_setImageWithURL:(nullable NSURL *)url { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:context + setImageBlock:nil + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h new file mode 100644 index 0000000..ee9f761 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h @@ -0,0 +1,109 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageManager.h" +#import "SDWebImageTransition.h" +#import "SDWebImageIndicator.h" + +/** + The value specify that the image progress unit count cannot be determined because the progressBlock is not been called. + */ +FOUNDATION_EXPORT const int64_t SDWebImageProgressUnitCountUnknown; /* 1LL */ + +typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL); + +/** + Integrates SDWebImage async downloading and caching of remote images with UIView subclass. + */ +@interface UIView (WebCache) + +/** + * Get the current image URL. + * + * @note Note that because of the limitations of categories this property can get out of sync if you use setImage: directly. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_imageURL; + +/** + * Get the current image operation key. Operation key is used to identify the different queries for one view instance (like UIButton). + * See more about this in `SDWebImageContextSetImageOperationKey`. + * If you cancel current image load, the key will be set to nil. + * @note You can use method `UIView+WebCacheOperation` to investigate different queries' operation. + */ +@property (nonatomic, strong, readonly, nullable) NSString *sd_latestOperationKey; + +/** + * The current image loading progress associated to the view. The unit count is the received size and excepted size of download. + * The `totalUnitCount` and `completedUnitCount` will be reset to 0 after a new image loading start (change from current queue). And they will be set to `SDWebImageProgressUnitCountUnknown` if the progressBlock not been called but the image loading success to mark the progress finished (change from main queue). + * @note You can use Key-Value Observing on the progress, but you should take care that the change to progress is from a background queue during download(the same as progressBlock). If you want to using KVO and update the UI, make sure to dispatch on the main queue. And it's recommend to use some KVO libs like KVOController because it's more safe and easy to use. + * @note The getter will create a progress instance if the value is nil. But by default, we don't create one. If you need to use Key-Value Observing, you must trigger the getter or set a custom progress instance before the loading start. The default value is nil. + * @note Note that because of the limitations of categories this property can get out of sync if you update the progress directly. + */ +@property (nonatomic, strong, null_resettable) NSProgress *sd_imageProgress; + +/** + * Set the imageView `image` with an `url` and optionally a placeholder image. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param setImageBlock Block used for custom set image code. If not provide, use the built-in set image code (supports `UIImageView/NSImageView` and `UIButton/NSButton` currently) + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. + * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. + * In case of error the image parameter is nil and the third parameter may contain an NSError. + * + * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache + * or from the memory cache or from the network. + * + * The fifth parameter normally is always YES. However, if you provide SDWebImageAvoidAutoSetImage with SDWebImageProgressiveLoad options to enable progressive downloading and set the image yourself. This block is thus called repeatedly with a partial image. When image is fully downloaded, the + * block is called a last time with the full image and the last parameter set to YES. + * + * The last parameter is the original image URL + */ +- (void)sd_internalSetImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + setImageBlock:(nullable SDSetImageBlock)setImageBlock + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock; + +/** + * Cancel the current image load + */ +- (void)sd_cancelCurrentImageLoad; + +#if SD_UIKIT || SD_MAC + +#pragma mark - Image Transition + +/** + The image transition when image load finished. See `SDWebImageTransition`. + If you specify nil, do not do transition. Defaults to nil. + */ +@property (nonatomic, strong, nullable) SDWebImageTransition *sd_imageTransition; + +#pragma mark - Image Indicator + +/** + The image indicator during the image loading. If you do not need indicator, specify nil. Defaults to nil + The setter will remove the old indicator view and add new indicator view to current view's subview. + @note Because this is UI related, you should access only from the main queue. + */ +@property (nonatomic, strong, nullable) id sd_imageIndicator; + +#endif + +@end diff --git a/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m new file mode 100644 index 0000000..befff48 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m @@ -0,0 +1,427 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIView+WebCache.h" +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" +#import "SDWebImageTransitionInternal.h" + +const int64_t SDWebImageProgressUnitCountUnknown = 1LL; + +@implementation UIView (WebCache) + +- (nullable NSURL *)sd_imageURL { + return objc_getAssociatedObject(self, @selector(sd_imageURL)); +} + +- (void)setSd_imageURL:(NSURL * _Nullable)sd_imageURL { + objc_setAssociatedObject(self, @selector(sd_imageURL), sd_imageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (nullable NSString *)sd_latestOperationKey { + return objc_getAssociatedObject(self, @selector(sd_latestOperationKey)); +} + +- (void)setSd_latestOperationKey:(NSString * _Nullable)sd_latestOperationKey { + objc_setAssociatedObject(self, @selector(sd_latestOperationKey), sd_latestOperationKey, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (NSProgress *)sd_imageProgress { + NSProgress *progress = objc_getAssociatedObject(self, @selector(sd_imageProgress)); + if (!progress) { + progress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; + self.sd_imageProgress = progress; + } + return progress; +} + +- (void)setSd_imageProgress:(NSProgress *)sd_imageProgress { + objc_setAssociatedObject(self, @selector(sd_imageProgress), sd_imageProgress, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (void)sd_internalSetImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + setImageBlock:(nullable SDSetImageBlock)setImageBlock + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + if (context) { + // copy to avoid mutable object + context = [context copy]; + } else { + context = [NSDictionary dictionary]; + } + NSString *validOperationKey = context[SDWebImageContextSetImageOperationKey]; + if (!validOperationKey) { + // pass through the operation key to downstream, which can used for tracing operation or image view class + validOperationKey = NSStringFromClass([self class]); + SDWebImageMutableContext *mutableContext = [context mutableCopy]; + mutableContext[SDWebImageContextSetImageOperationKey] = validOperationKey; + context = [mutableContext copy]; + } + self.sd_latestOperationKey = validOperationKey; + [self sd_cancelImageLoadOperationWithKey:validOperationKey]; + self.sd_imageURL = url; + + if (!(options & SDWebImageDelayPlaceholder)) { + dispatch_main_async_safe(^{ + [self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:SDImageCacheTypeNone imageURL:url]; + }); + } + + if (url) { + // reset the progress + NSProgress *imageProgress = objc_getAssociatedObject(self, @selector(sd_imageProgress)); + if (imageProgress) { + imageProgress.totalUnitCount = 0; + imageProgress.completedUnitCount = 0; + } + +#if SD_UIKIT || SD_MAC + // check and start image indicator + [self sd_startImageIndicator]; + id imageIndicator = self.sd_imageIndicator; +#endif + SDWebImageManager *manager = context[SDWebImageContextCustomManager]; + if (!manager) { + manager = [SDWebImageManager sharedManager]; + } else { + // remove this manager to avoid retain cycle (manger -> loader -> operation -> context -> manager) + SDWebImageMutableContext *mutableContext = [context mutableCopy]; + mutableContext[SDWebImageContextCustomManager] = nil; + context = [mutableContext copy]; + } + + SDImageLoaderProgressBlock combinedProgressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { + if (imageProgress) { + imageProgress.totalUnitCount = expectedSize; + imageProgress.completedUnitCount = receivedSize; + } +#if SD_UIKIT || SD_MAC + if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) { + double progress = 0; + if (expectedSize != 0) { + progress = (double)receivedSize / expectedSize; + } + progress = MAX(MIN(progress, 1), 0); // 0.0 - 1.0 + dispatch_async(dispatch_get_main_queue(), ^{ + [imageIndicator updateIndicatorProgress:progress]; + }); + } +#endif + if (progressBlock) { + progressBlock(receivedSize, expectedSize, targetURL); + } + }; + @weakify(self); + id operation = [manager loadImageWithURL:url options:options context:context progress:combinedProgressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { + @strongify(self); + if (!self) { return; } + // if the progress not been updated, mark it to complete state + if (imageProgress && finished && !error && imageProgress.totalUnitCount == 0 && imageProgress.completedUnitCount == 0) { + imageProgress.totalUnitCount = SDWebImageProgressUnitCountUnknown; + imageProgress.completedUnitCount = SDWebImageProgressUnitCountUnknown; + } + +#if SD_UIKIT || SD_MAC + // check and stop image indicator + if (finished) { + [self sd_stopImageIndicator]; + } +#endif + + BOOL shouldCallCompletedBlock = finished || (options & SDWebImageAvoidAutoSetImage); + BOOL shouldNotSetImage = ((image && (options & SDWebImageAvoidAutoSetImage)) || + (!image && !(options & SDWebImageDelayPlaceholder))); + SDWebImageNoParamsBlock callCompletedBlockClojure = ^{ + if (!self) { return; } + if (!shouldNotSetImage) { + [self sd_setNeedsLayout]; + } + if (completedBlock && shouldCallCompletedBlock) { + completedBlock(image, data, error, cacheType, finished, url); + } + }; + + // case 1a: we got an image, but the SDWebImageAvoidAutoSetImage flag is set + // OR + // case 1b: we got no image and the SDWebImageDelayPlaceholder is not set + if (shouldNotSetImage) { + dispatch_main_async_safe(callCompletedBlockClojure); + return; + } + + UIImage *targetImage = nil; + NSData *targetData = nil; + if (image) { + // case 2a: we got an image and the SDWebImageAvoidAutoSetImage is not set + targetImage = image; + targetData = data; + } else if (options & SDWebImageDelayPlaceholder) { + // case 2b: we got no image and the SDWebImageDelayPlaceholder flag is set + targetImage = placeholder; + targetData = nil; + } + +#if SD_UIKIT || SD_MAC + // check whether we should use the image transition + SDWebImageTransition *transition = nil; + BOOL shouldUseTransition = NO; + if (options & SDWebImageForceTransition) { + // Always + shouldUseTransition = YES; + } else if (cacheType == SDImageCacheTypeNone) { + // From network + shouldUseTransition = YES; + } else { + // From disk (and, user don't use sync query) + if (cacheType == SDImageCacheTypeMemory) { + shouldUseTransition = NO; + } else if (cacheType == SDImageCacheTypeDisk) { + if (options & SDWebImageQueryMemoryDataSync || options & SDWebImageQueryDiskDataSync) { + shouldUseTransition = NO; + } else { + shouldUseTransition = YES; + } + } else { + // Not valid cache type, fallback + shouldUseTransition = NO; + } + } + if (finished && shouldUseTransition) { + transition = self.sd_imageTransition; + } +#endif + dispatch_main_async_safe(^{ +#if SD_UIKIT || SD_MAC + [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:transition cacheType:cacheType imageURL:imageURL]; +#else + [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:cacheType imageURL:imageURL]; +#endif + callCompletedBlockClojure(); + }); + }]; + [self sd_setImageLoadOperation:operation forKey:validOperationKey]; + } else { +#if SD_UIKIT || SD_MAC + [self sd_stopImageIndicator]; +#endif + dispatch_main_async_safe(^{ + if (completedBlock) { + NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @"Image url is nil"}]; + completedBlock(nil, nil, error, SDImageCacheTypeNone, YES, url); + } + }); + } +} + +- (void)sd_cancelCurrentImageLoad { + [self sd_cancelImageLoadOperationWithKey:self.sd_latestOperationKey]; + self.sd_latestOperationKey = nil; +} + +- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL { +#if SD_UIKIT || SD_MAC + [self sd_setImage:image imageData:imageData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:nil cacheType:cacheType imageURL:imageURL]; +#else + // watchOS does not support view transition. Simplify the logic + if (setImageBlock) { + setImageBlock(image, imageData, cacheType, imageURL); + } else if ([self isKindOfClass:[UIImageView class]]) { + UIImageView *imageView = (UIImageView *)self; + [imageView setImage:image]; + } +#endif +} + +#if SD_UIKIT || SD_MAC +- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock transition:(SDWebImageTransition *)transition cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL { + UIView *view = self; + SDSetImageBlock finalSetImageBlock; + if (setImageBlock) { + finalSetImageBlock = setImageBlock; + } else if ([view isKindOfClass:[UIImageView class]]) { + UIImageView *imageView = (UIImageView *)view; + finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { + imageView.image = setImage; + }; + } +#if SD_UIKIT + else if ([view isKindOfClass:[UIButton class]]) { + UIButton *button = (UIButton *)view; + finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { + [button setImage:setImage forState:UIControlStateNormal]; + }; + } +#endif +#if SD_MAC + else if ([view isKindOfClass:[NSButton class]]) { + NSButton *button = (NSButton *)view; + finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { + button.image = setImage; + }; + } +#endif + + if (transition) { +#if SD_UIKIT + [UIView transitionWithView:view duration:0 options:0 animations:^{ + if (!view.sd_latestOperationKey) { + return; + } + // 0 duration to let UIKit render placeholder and prepares block + if (transition.prepares) { + transition.prepares(view, image, imageData, cacheType, imageURL); + } + } completion:^(BOOL finished) { + [UIView transitionWithView:view duration:transition.duration options:transition.animationOptions animations:^{ + if (!view.sd_latestOperationKey) { + return; + } + if (finalSetImageBlock && !transition.avoidAutoSetImage) { + finalSetImageBlock(image, imageData, cacheType, imageURL); + } + if (transition.animations) { + transition.animations(view, image); + } + } completion:^(BOOL finished) { + if (!view.sd_latestOperationKey) { + return; + } + if (transition.completion) { + transition.completion(finished); + } + }]; + }]; +#elif SD_MAC + [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull prepareContext) { + if (!view.sd_latestOperationKey) { + return; + } + // 0 duration to let AppKit render placeholder and prepares block + prepareContext.duration = 0; + if (transition.prepares) { + transition.prepares(view, image, imageData, cacheType, imageURL); + } + } completionHandler:^{ + [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { + if (!view.sd_latestOperationKey) { + return; + } + context.duration = transition.duration; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + CAMediaTimingFunction *timingFunction = transition.timingFunction; +#pragma clang diagnostic pop + if (!timingFunction) { + timingFunction = SDTimingFunctionFromAnimationOptions(transition.animationOptions); + } + context.timingFunction = timingFunction; + context.allowsImplicitAnimation = SD_OPTIONS_CONTAINS(transition.animationOptions, SDWebImageAnimationOptionAllowsImplicitAnimation); + if (finalSetImageBlock && !transition.avoidAutoSetImage) { + finalSetImageBlock(image, imageData, cacheType, imageURL); + } + CATransition *trans = SDTransitionFromAnimationOptions(transition.animationOptions); + if (trans) { + [view.layer addAnimation:trans forKey:kCATransition]; + } + if (transition.animations) { + transition.animations(view, image); + } + } completionHandler:^{ + if (!view.sd_latestOperationKey) { + return; + } + if (transition.completion) { + transition.completion(YES); + } + }]; + }]; +#endif + } else { + if (finalSetImageBlock) { + finalSetImageBlock(image, imageData, cacheType, imageURL); + } + } +} +#endif + +- (void)sd_setNeedsLayout { +#if SD_UIKIT + [self setNeedsLayout]; +#elif SD_MAC + [self setNeedsLayout:YES]; +#elif SD_WATCH + // Do nothing because WatchKit automatically layout the view after property change +#endif +} + +#if SD_UIKIT || SD_MAC + +#pragma mark - Image Transition +- (SDWebImageTransition *)sd_imageTransition { + return objc_getAssociatedObject(self, @selector(sd_imageTransition)); +} + +- (void)setSd_imageTransition:(SDWebImageTransition *)sd_imageTransition { + objc_setAssociatedObject(self, @selector(sd_imageTransition), sd_imageTransition, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - Indicator +- (id)sd_imageIndicator { + return objc_getAssociatedObject(self, @selector(sd_imageIndicator)); +} + +- (void)setSd_imageIndicator:(id)sd_imageIndicator { + // Remove the old indicator view + id previousIndicator = self.sd_imageIndicator; + [previousIndicator.indicatorView removeFromSuperview]; + + objc_setAssociatedObject(self, @selector(sd_imageIndicator), sd_imageIndicator, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // Add the new indicator view + UIView *view = sd_imageIndicator.indicatorView; + if (CGRectEqualToRect(view.frame, CGRectZero)) { + view.frame = self.bounds; + } + // Center the indicator view +#if SD_MAC + [view setFrameOrigin:CGPointMake(round((NSWidth(self.bounds) - NSWidth(view.frame)) / 2), round((NSHeight(self.bounds) - NSHeight(view.frame)) / 2))]; +#else + view.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); +#endif + view.hidden = NO; + [self addSubview:view]; +} + +- (void)sd_startImageIndicator { + id imageIndicator = self.sd_imageIndicator; + if (!imageIndicator) { + return; + } + dispatch_main_async_safe(^{ + [imageIndicator startAnimatingIndicator]; + }); +} + +- (void)sd_stopImageIndicator { + id imageIndicator = self.sd_imageIndicator; + if (!imageIndicator) { + return; + } + dispatch_main_async_safe(^{ + [imageIndicator stopAnimatingIndicator]; + }); +} + +#endif + +@end diff --git a/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h similarity index 51% rename from Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h rename to Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h index f5e95fa..53a7045 100644 --- a/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h +++ b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h @@ -7,20 +7,29 @@ */ #import "SDWebImageCompat.h" +#import "SDWebImageOperation.h" -#if SD_UIKIT || SD_MAC - -#import "SDWebImageManager.h" - +/** + These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external. + All the stored operations are weak, so it will be dealloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them. + */ @interface UIView (WebCacheOperation) /** - * Set the image load operation (storage in a UIView based dictionary) + * Get the image load operation for key + * + * @param key key for identifying the operations + * @return the image load operation + */ +- (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key; + +/** + * Set the image load operation (storage in a UIView based weak map table) * * @param operation the operation * @param key key for storing the operation */ -- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; +- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; /** * Cancel all operations for the current UIView and key @@ -37,5 +46,3 @@ - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; @end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m new file mode 100644 index 0000000..adb2c10 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m @@ -0,0 +1,84 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIView+WebCacheOperation.h" +#import "objc/runtime.h" + +static char loadOperationKey; + +// key is strong, value is weak because operation instance is retained by SDWebImageManager's runningOperations property +// we should use lock to keep thread-safe because these method may not be accessed from main queue +typedef NSMapTable> SDOperationsDictionary; + +@implementation UIView (WebCacheOperation) + +- (SDOperationsDictionary *)sd_operationDictionary { + @synchronized(self) { + SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); + if (operations) { + return operations; + } + operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0]; + objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + return operations; + } +} + +- (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key { + id operation; + if (key) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + operation = [operationDictionary objectForKey:key]; + } + } + return operation; +} + +- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { + if (key) { + [self sd_cancelImageLoadOperationWithKey:key]; + if (operation) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + [operationDictionary setObject:operation forKey:key]; + } + } + } +} + +- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { + if (key) { + // Cancel in progress downloader from queue + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + id operation; + + @synchronized (self) { + operation = [operationDictionary objectForKey:key]; + } + if (operation) { + if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { + [operation cancel]; + } + @synchronized (self) { + [operationDictionary removeObjectForKey:key]; + } + } + } +} + +- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { + if (key) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + [operationDictionary removeObjectForKey:key]; + } + } +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h b/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h deleted file mode 100644 index b23b0bd..0000000 --- a/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * (c) Fabrice Aneche - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import -#import "SDWebImageCompat.h" - -typedef NS_ENUM(NSInteger, SDImageFormat) { - SDImageFormatUndefined = -1, - SDImageFormatJPEG = 0, - SDImageFormatPNG, - SDImageFormatGIF, - SDImageFormatTIFF, - SDImageFormatWebP -}; - -@interface NSData (ImageContentType) - -/** - * Return image format - * - * @param data the input image data - * - * @return the image format as `SDImageFormat` (enum) - */ -+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; - -@end diff --git a/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m b/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m deleted file mode 100644 index 7364715..0000000 --- a/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * (c) Fabrice Aneche - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "NSData+ImageContentType.h" - - -@implementation NSData (ImageContentType) - -+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { - if (!data) { - return SDImageFormatUndefined; - } - - uint8_t c; - [data getBytes:&c length:1]; - switch (c) { - case 0xFF: - return SDImageFormatJPEG; - case 0x89: - return SDImageFormatPNG; - case 0x47: - return SDImageFormatGIF; - case 0x49: - case 0x4D: - return SDImageFormatTIFF; - case 0x52: - // R as RIFF for WEBP - if (data.length < 12) { - return SDImageFormatUndefined; - } - - NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; - if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { - return SDImageFormatWebP; - } - } - return SDImageFormatUndefined; -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m b/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m deleted file mode 100644 index 518b498..0000000 --- a/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "NSImage+WebCache.h" - -#if SD_MAC - -@implementation NSImage (WebCache) - -- (CGImageRef)CGImage { - NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); - CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; - return cgImage; -} - -- (NSArray *)images { - return nil; -} - -- (BOOL)isGIF { - return NO; -} - -@end - -#endif - diff --git a/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h b/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h new file mode 100644 index 0000000..dfec18b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h @@ -0,0 +1,24 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +#import "UIImage+Transform.h" + +@interface NSBezierPath (SDRoundedCorners) + +/** + Convenience way to create a bezier path with the specify rounding corners on macOS. Same as the one on `UIBezierPath`. + */ ++ (nonnull instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius; + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m b/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m new file mode 100644 index 0000000..b6f7a01 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m @@ -0,0 +1,42 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSBezierPath+SDRoundedCorners.h" + +#if SD_MAC + +@implementation NSBezierPath (SDRoundedCorners) + ++ (instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius { + NSBezierPath *path = [NSBezierPath bezierPath]; + + CGFloat maxCorner = MIN(NSWidth(rect), NSHeight(rect)) / 2; + + CGFloat topLeftRadius = MIN(maxCorner, (corners & SDRectCornerTopLeft) ? cornerRadius : 0); + CGFloat topRightRadius = MIN(maxCorner, (corners & SDRectCornerTopRight) ? cornerRadius : 0); + CGFloat bottomLeftRadius = MIN(maxCorner, (corners & SDRectCornerBottomLeft) ? cornerRadius : 0); + CGFloat bottomRightRadius = MIN(maxCorner, (corners & SDRectCornerBottomRight) ? cornerRadius : 0); + + NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); + NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); + NSPoint bottomLeft = NSMakePoint(NSMinX(rect), NSMinY(rect)); + NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect)); + + [path moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))]; + [path appendBezierPathWithArcFromPoint:topLeft toPoint:bottomLeft radius:topLeftRadius]; + [path appendBezierPathWithArcFromPoint:bottomLeft toPoint:bottomRight radius:bottomLeftRadius]; + [path appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:bottomRightRadius]; + [path appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:topRightRadius]; + [path closePath]; + + return path; +} + +@end + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h b/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h new file mode 100644 index 0000000..199cf4f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h @@ -0,0 +1,14 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageCompat.h" + +/// Copy the associated object from source image to target image. The associated object including all the category read/write properties. +/// @param source source +/// @param target target +FOUNDATION_EXPORT void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target); diff --git a/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m b/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m new file mode 100644 index 0000000..a7c7076 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m @@ -0,0 +1,27 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDAssociatedObject.h" +#import "UIImage+Metadata.h" +#import "UIImage+ExtendedCacheData.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+ForceDecode.h" + +void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target) { + if (!source || !target) { + return; + } + // Image Metadata + target.sd_isIncremental = source.sd_isIncremental; + target.sd_imageLoopCount = source.sd_imageLoopCount; + target.sd_imageFormat = source.sd_imageFormat; + // Force Decode + target.sd_isDecoded = source.sd_isDecoded; + // Extended Cache Data + target.sd_extendedObject = source.sd_extendedObject; +} diff --git a/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h b/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h new file mode 100644 index 0000000..a3480de --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h @@ -0,0 +1,21 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@class SDAsyncBlockOperation; +typedef void (^SDAsyncBlock)(SDAsyncBlockOperation * __nonnull asyncOperation); + +/// A async block operation, success after you call `completer` (not like `NSBlockOperation` which is for sync block, success on return) +@interface SDAsyncBlockOperation : NSOperation + +- (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block; ++ (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block; +- (void)complete; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m b/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m new file mode 100644 index 0000000..0b2fefe --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m @@ -0,0 +1,92 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAsyncBlockOperation.h" + +@interface SDAsyncBlockOperation () + +@property (assign, nonatomic, getter = isExecuting) BOOL executing; +@property (assign, nonatomic, getter = isFinished) BOOL finished; +@property (nonatomic, copy, nonnull) SDAsyncBlock executionBlock; + +@end + +@implementation SDAsyncBlockOperation + +@synthesize executing = _executing; +@synthesize finished = _finished; + +- (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block { + self = [super init]; + if (self) { + self.executionBlock = block; + } + return self; +} + ++ (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block { + SDAsyncBlockOperation *operation = [[SDAsyncBlockOperation alloc] initWithBlock:block]; + return operation; +} + +- (void)start { + @synchronized (self) { + if (self.isCancelled) { + self.finished = YES; + return; + } + + self.finished = NO; + self.executing = YES; + + if (self.executionBlock) { + self.executionBlock(self); + } else { + self.executing = NO; + self.finished = YES; + } + } +} + +- (void)cancel { + @synchronized (self) { + [super cancel]; + if (self.isExecuting) { + self.executing = NO; + self.finished = YES; + } + } +} + + +- (void)complete { + @synchronized (self) { + if (self.isExecuting) { + self.finished = YES; + self.executing = NO; + } + } + } + +- (void)setFinished:(BOOL)finished { + [self willChangeValueForKey:@"isFinished"]; + _finished = finished; + [self didChangeValueForKey:@"isFinished"]; +} + +- (void)setExecuting:(BOOL)executing { + [self willChangeValueForKey:@"isExecuting"]; + _executing = executing; + [self didChangeValueForKey:@"isExecuting"]; +} + +- (BOOL)isConcurrent { + return YES; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h b/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h new file mode 100644 index 0000000..5d5676b --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h @@ -0,0 +1,18 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +/// Device information helper methods +@interface SDDeviceHelper : NSObject + ++ (NSUInteger)totalMemory; ++ (NSUInteger)freeMemory; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m b/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m new file mode 100644 index 0000000..83d0229 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m @@ -0,0 +1,32 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDDeviceHelper.h" +#import + +@implementation SDDeviceHelper + ++ (NSUInteger)totalMemory { + return (NSUInteger)[[NSProcessInfo processInfo] physicalMemory]; +} + ++ (NSUInteger)freeMemory { + mach_port_t host_port = mach_host_self(); + mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); + vm_size_t page_size; + vm_statistics_data_t vm_stat; + kern_return_t kern; + + kern = host_page_size(host_port, &page_size); + if (kern != KERN_SUCCESS) return 0; + kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size); + if (kern != KERN_SUCCESS) return 0; + return vm_stat.free_count * page_size; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h b/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h new file mode 100644 index 0000000..3ee8c6f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h @@ -0,0 +1,29 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +/// Cross-platform display link wrapper. Do not retain the target +/// Use `CADisplayLink` on iOS/tvOS, `CVDisplayLink` on macOS, `NSTimer` on watchOS +@interface SDDisplayLink : NSObject + +@property (readonly, nonatomic, weak, nullable) id target; +@property (readonly, nonatomic, assign, nonnull) SEL selector; +@property (readonly, nonatomic) CFTimeInterval duration; +@property (readonly, nonatomic) BOOL isRunning; + ++ (nonnull instancetype)displayLinkWithTarget:(nonnull id)target selector:(nonnull SEL)sel; + +- (void)addToRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode; +- (void)removeFromRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode; + +- (void)start; +- (void)stop; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m b/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m new file mode 100644 index 0000000..8ff0fc1 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m @@ -0,0 +1,222 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDDisplayLink.h" +#import "SDWeakProxy.h" +#if SD_MAC +#import +#elif SD_IOS || SD_TV +#import +#endif + +#if SD_MAC +static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext); +#endif + +#define kSDDisplayLinkInterval 1.0 / 60 + +@interface SDDisplayLink () + +#if SD_MAC +@property (nonatomic, assign) CVDisplayLinkRef displayLink; +@property (nonatomic, assign) CVTimeStamp outputTime; +@property (nonatomic, copy) NSRunLoopMode runloopMode; +#elif SD_IOS || SD_TV +@property (nonatomic, strong) CADisplayLink *displayLink; +#else +@property (nonatomic, strong) NSTimer *displayLink; +@property (nonatomic, strong) NSRunLoop *runloop; +@property (nonatomic, copy) NSRunLoopMode runloopMode; +@property (nonatomic, assign) NSTimeInterval currentFireDate; +#endif + +@end + +@implementation SDDisplayLink + +- (void)dealloc { +#if SD_MAC + if (_displayLink) { + CVDisplayLinkRelease(_displayLink); + _displayLink = NULL; + } +#elif SD_IOS || SD_TV + [_displayLink invalidate]; + _displayLink = nil; +#else + [_displayLink invalidate]; + _displayLink = nil; +#endif +} + +- (instancetype)initWithTarget:(id)target selector:(SEL)sel { + self = [super init]; + if (self) { + _target = target; + _selector = sel; +#if SD_MAC + CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink); + CVDisplayLinkSetOutputCallback(_displayLink, DisplayLinkCallback, (__bridge void *)self); +#elif SD_IOS || SD_TV + SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self]; + _displayLink = [CADisplayLink displayLinkWithTarget:weakProxy selector:@selector(displayLinkDidRefresh:)]; +#else + SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self]; + _displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES]; +#endif + } + return self; +} + ++ (instancetype)displayLinkWithTarget:(id)target selector:(SEL)sel { + SDDisplayLink *displayLink = [[SDDisplayLink alloc] initWithTarget:target selector:sel]; + return displayLink; +} + +- (CFTimeInterval)duration { +#if SD_MAC + CVTimeStamp outputTime = self.outputTime; + NSTimeInterval duration = 0; + double periodPerSecond = (double)outputTime.videoTimeScale * outputTime.rateScalar; + if (periodPerSecond > 0) { + duration = (double)outputTime.videoRefreshPeriod / periodPerSecond; + } +#elif SD_IOS || SD_TV +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + NSTimeInterval duration = self.displayLink.duration * self.displayLink.frameInterval; +#pragma clang diagnostic pop +#else + NSTimeInterval duration = 0; + if (self.displayLink.isValid && self.currentFireDate != 0) { + NSTimeInterval nextFireDate = CFRunLoopTimerGetNextFireDate((__bridge CFRunLoopTimerRef)self.displayLink); + duration = nextFireDate - self.currentFireDate; + } +#endif + if (duration == 0) { + duration = kSDDisplayLinkInterval; + } + return duration; +} + +- (BOOL)isRunning { +#if SD_MAC + return CVDisplayLinkIsRunning(self.displayLink); +#elif SD_IOS || SD_TV + return !self.displayLink.isPaused; +#else + return self.displayLink.isValid; +#endif +} + +- (void)addToRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode { + if (!runloop || !mode) { + return; + } +#if SD_MAC + self.runloopMode = mode; +#elif SD_IOS || SD_TV + [self.displayLink addToRunLoop:runloop forMode:mode]; +#else + self.runloop = runloop; + self.runloopMode = mode; + CFRunLoopMode cfMode; + if ([mode isEqualToString:NSDefaultRunLoopMode]) { + cfMode = kCFRunLoopDefaultMode; + } else if ([mode isEqualToString:NSRunLoopCommonModes]) { + cfMode = kCFRunLoopCommonModes; + } else { + cfMode = (__bridge CFStringRef)mode; + } + CFRunLoopAddTimer(runloop.getCFRunLoop, (__bridge CFRunLoopTimerRef)self.displayLink, cfMode); +#endif +} + +- (void)removeFromRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode { + if (!runloop || !mode) { + return; + } +#if SD_MAC + self.runloopMode = nil; +#elif SD_IOS || SD_TV + [self.displayLink removeFromRunLoop:runloop forMode:mode]; +#else + self.runloop = nil; + self.runloopMode = nil; + CFRunLoopMode cfMode; + if ([mode isEqualToString:NSDefaultRunLoopMode]) { + cfMode = kCFRunLoopDefaultMode; + } else if ([mode isEqualToString:NSRunLoopCommonModes]) { + cfMode = kCFRunLoopCommonModes; + } else { + cfMode = (__bridge CFStringRef)mode; + } + CFRunLoopRemoveTimer(runloop.getCFRunLoop, (__bridge CFRunLoopTimerRef)self.displayLink, cfMode); +#endif +} + +- (void)start { +#if SD_MAC + CVDisplayLinkStart(self.displayLink); +#elif SD_IOS || SD_TV + self.displayLink.paused = NO; +#else + if (self.displayLink.isValid) { + [self.displayLink fire]; + } else { + SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self]; + self.displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES]; + [self addToRunLoop:self.runloop forMode:self.runloopMode]; + } +#endif +} + +- (void)stop { +#if SD_MAC + CVDisplayLinkStop(self.displayLink); +#elif SD_IOS || SD_TV + self.displayLink.paused = YES; +#else + [self.displayLink invalidate]; +#endif +} + +- (void)displayLinkDidRefresh:(id)displayLink { +#if SD_MAC + // CVDisplayLink does not use runloop, but we can provide similar behavior for modes + // May use `default` runloop to avoid extra callback when in `eventTracking` (mouse drag, scroll) or `modalPanel` (modal panel) + NSString *runloopMode = self.runloopMode; + if (![runloopMode isEqualToString:NSRunLoopCommonModes] && ![runloopMode isEqualToString:NSRunLoop.mainRunLoop.currentMode]) { + return; + } +#endif +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [_target performSelector:_selector withObject:self]; +#pragma clang diagnostic pop +#if SD_WATCH + self.currentFireDate = CFRunLoopTimerGetNextFireDate((__bridge CFRunLoopTimerRef)self.displayLink); +#endif +} + +@end + +#if SD_MAC +static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext) { + // CVDisplayLink callback is not on main queue + SDDisplayLink *object = (__bridge SDDisplayLink *)displayLinkContext; + if (inOutputTime) { + object.outputTime = *inOutputTime; + } + __weak SDDisplayLink *weakObject = object; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakObject displayLinkDidRefresh:(__bridge id)(displayLink)]; + }); + return kCVReturnSuccess; +} +#endif diff --git a/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h b/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h new file mode 100644 index 0000000..3ce6bad --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h @@ -0,0 +1,19 @@ +// +// This file is from https://gist.github.com/zydeco/6292773 +// +// Created by Jesús A. Álvarez on 2008-12-17. +// Copyright 2008-2009 namedfork.net. All rights reserved. +// + +#import + +/// File Extended Attribute (xattr) helper methods +@interface SDFileAttributeHelper : NSObject + ++ (nullable NSArray *)extendedAttributeNamesAtPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; ++ (BOOL)hasExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; ++ (nullable NSData *)extendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; ++ (BOOL)setExtendedAttribute:(nonnull NSString *)name value:(nonnull NSData *)value atPath:(nonnull NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError * _Nullable * _Nullable)err; ++ (BOOL)removeExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m b/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m new file mode 100644 index 0000000..5122089 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m @@ -0,0 +1,127 @@ +// +// This file is from https://gist.github.com/zydeco/6292773 +// +// Created by Jesús A. Álvarez on 2008-12-17. +// Copyright 2008-2009 namedfork.net. All rights reserved. +// + +#import "SDFileAttributeHelper.h" +#import + +@implementation SDFileAttributeHelper + ++ (NSArray*)extendedAttributeNamesAtPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = follow? 0 : XATTR_NOFOLLOW; + + // get size of name list + ssize_t nameBuffLen = listxattr([path fileSystemRepresentation], NULL, 0, flags); + if (nameBuffLen == -1) { + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"listxattr", + @":path": path, + @":traverseLink": @(follow) + } + ]; + return nil; + } else if (nameBuffLen == 0) return @[]; + + // get name list + NSMutableData *nameBuff = [NSMutableData dataWithLength:nameBuffLen]; + listxattr([path fileSystemRepresentation], [nameBuff mutableBytes], nameBuffLen, flags); + + // convert to array + NSMutableArray * names = [NSMutableArray arrayWithCapacity:5]; + char *nextName, *endOfNames = [nameBuff mutableBytes] + nameBuffLen; + for(nextName = [nameBuff mutableBytes]; nextName < endOfNames; nextName += 1+strlen(nextName)) + [names addObject:[NSString stringWithUTF8String:nextName]]; + return names.copy; +} + ++ (BOOL)hasExtendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = follow? 0 : XATTR_NOFOLLOW; + + // get size of name list + ssize_t nameBuffLen = listxattr([path fileSystemRepresentation], NULL, 0, flags); + if (nameBuffLen == -1) { + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"listxattr", + @":path": path, + @":traverseLink": @(follow) + } + ]; + return NO; + } else if (nameBuffLen == 0) return NO; + + // get name list + NSMutableData *nameBuff = [NSMutableData dataWithLength:nameBuffLen]; + listxattr([path fileSystemRepresentation], [nameBuff mutableBytes], nameBuffLen, flags); + + // find our name + char *nextName, *endOfNames = [nameBuff mutableBytes] + nameBuffLen; + for(nextName = [nameBuff mutableBytes]; nextName < endOfNames; nextName += 1+strlen(nextName)) + if (strcmp(nextName, [name UTF8String]) == 0) return YES; + return NO; +} + ++ (NSData *)extendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = follow? 0 : XATTR_NOFOLLOW; + // get length + ssize_t attrLen = getxattr([path fileSystemRepresentation], [name UTF8String], NULL, 0, 0, flags); + if (attrLen == -1) { + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"getxattr", + @":name": name, + @":path": path, + @":traverseLink": @(follow) + } + ]; + return nil; + } + + // get attribute data + NSMutableData *attrData = [NSMutableData dataWithLength:attrLen]; + getxattr([path fileSystemRepresentation], [name UTF8String], [attrData mutableBytes], attrLen, 0, flags); + return attrData; +} + ++ (BOOL)setExtendedAttribute:(NSString *)name value:(NSData *)value atPath:(NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError **)err { + int flags = (follow? 0 : XATTR_NOFOLLOW) | (overwrite? 0 : XATTR_CREATE); + if (0 == setxattr([path fileSystemRepresentation], [name UTF8String], [value bytes], [value length], 0, flags)) return YES; + // error + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"setxattr", + @":name": name, + @":value.length": @(value.length), + @":path": path, + @":traverseLink": @(follow), + @":overwrite": @(overwrite) + } + ]; + return NO; +} + ++ (BOOL)removeExtendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = (follow? 0 : XATTR_NOFOLLOW); + if (0 == removexattr([path fileSystemRepresentation], [name UTF8String], flags)) return YES; + // error + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"removexattr", + @":name": name, + @":path": path, + @":traverseLink": @(follow) + } + ]; + return NO; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h b/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h new file mode 100644 index 0000000..88dee48 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// A Image-Asset manager to work like UIKit/AppKit's image cache behavior +/// Apple parse the Asset Catalog compiled file(`Assets.car`) by CoreUI.framework, however it's a private framework and there are no other ways to directly get the data. So we just process the normal bundle files :) +@interface SDImageAssetManager : NSObject + +@property (nonatomic, strong, nonnull) NSMapTable *imageTable; + ++ (nonnull instancetype)sharedAssetManager; +- (nullable NSString *)getPathForName:(nonnull NSString *)name bundle:(nonnull NSBundle *)bundle preferredScale:(nonnull CGFloat *)scale; +- (nullable UIImage *)imageForName:(nonnull NSString *)name; +- (void)storeImage:(nonnull UIImage *)image forName:(nonnull NSString *)name; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m b/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m new file mode 100644 index 0000000..fa92e74 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m @@ -0,0 +1,158 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageAssetManager.h" +#import "SDInternalMacros.h" + +static NSArray *SDBundlePreferredScales() { + static NSArray *scales; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ +#if SD_WATCH + CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale; +#elif SD_UIKIT + CGFloat screenScale = [UIScreen mainScreen].scale; +#elif SD_MAC + CGFloat screenScale = [NSScreen mainScreen].backingScaleFactor; +#endif + if (screenScale <= 1) { + scales = @[@1,@2,@3]; + } else if (screenScale <= 2) { + scales = @[@2,@3,@1]; + } else { + scales = @[@3,@2,@1]; + } + }); + return scales; +} + +@implementation SDImageAssetManager { + dispatch_semaphore_t _lock; +} + ++ (instancetype)sharedAssetManager { + static dispatch_once_t onceToken; + static SDImageAssetManager *assetManager; + dispatch_once(&onceToken, ^{ + assetManager = [[SDImageAssetManager alloc] init]; + }); + return assetManager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + NSPointerFunctionsOptions valueOptions; +#if SD_MAC + // Apple says that NSImage use a weak reference to value + valueOptions = NSPointerFunctionsWeakMemory; +#else + // Apple says that UIImage use a strong reference to value + valueOptions = NSPointerFunctionsStrongMemory; +#endif + _imageTable = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsCopyIn valueOptions:valueOptions]; + _lock = dispatch_semaphore_create(1); +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (void)dealloc { +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification { + SD_LOCK(_lock); + [self.imageTable removeAllObjects]; + SD_UNLOCK(_lock); +} + +- (NSString *)getPathForName:(NSString *)name bundle:(NSBundle *)bundle preferredScale:(CGFloat *)scale { + NSParameterAssert(name); + NSParameterAssert(bundle); + NSString *path; + if (name.length == 0) { + return path; + } + if ([name hasSuffix:@"/"]) { + return path; + } + NSString *extension = name.pathExtension; + if (extension.length == 0) { + // If no extension, follow Apple's doc, check PNG format + extension = @"png"; + } + name = [name stringByDeletingPathExtension]; + + CGFloat providedScale = *scale; + NSArray *scales = SDBundlePreferredScales(); + + // Check if file name contains scale + for (size_t i = 0; i < scales.count; i++) { + NSNumber *scaleValue = scales[i]; + if ([name hasSuffix:[NSString stringWithFormat:@"@%@x", scaleValue]]) { + path = [bundle pathForResource:name ofType:extension]; + if (path) { + *scale = scaleValue.doubleValue; // override + return path; + } + } + } + + // Search with provided scale first + if (providedScale != 0) { + NSString *scaledName = [name stringByAppendingFormat:@"@%@x", @(providedScale)]; + path = [bundle pathForResource:scaledName ofType:extension]; + if (path) { + return path; + } + } + + // Search with preferred scale + for (size_t i = 0; i < scales.count; i++) { + NSNumber *scaleValue = scales[i]; + if (scaleValue.doubleValue == providedScale) { + // Ignore provided scale + continue; + } + NSString *scaledName = [name stringByAppendingFormat:@"@%@x", scaleValue]; + path = [bundle pathForResource:scaledName ofType:extension]; + if (path) { + *scale = scaleValue.doubleValue; // override + return path; + } + } + + // Search without scale + path = [bundle pathForResource:name ofType:extension]; + + return path; +} + +- (UIImage *)imageForName:(NSString *)name { + NSParameterAssert(name); + UIImage *image; + SD_LOCK(_lock); + image = [self.imageTable objectForKey:name]; + SD_UNLOCK(_lock); + return image; +} + +- (void)storeImage:(UIImage *)image forName:(NSString *)name { + NSParameterAssert(image); + NSParameterAssert(name); + SD_LOCK(_lock); + [self.imageTable setObject:image forKey:name]; + SD_UNLOCK(_lock); +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h b/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h new file mode 100644 index 0000000..0debe6c --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h @@ -0,0 +1,21 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// This is used for operation management, but not for operation queue execute +@interface SDImageCachesManagerOperation : NSOperation + +@property (nonatomic, assign, readonly) NSUInteger pendingCount; + +- (void)beginWithTotalCount:(NSUInteger)totalCount; +- (void)completeOne; +- (void)done; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m b/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m new file mode 100644 index 0000000..1a1ae69 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m @@ -0,0 +1,84 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCachesManagerOperation.h" +#import "SDInternalMacros.h" + +@implementation SDImageCachesManagerOperation +{ + dispatch_semaphore_t _pendingCountLock; +} + +@synthesize executing = _executing; +@synthesize finished = _finished; +@synthesize cancelled = _cancelled; +@synthesize pendingCount = _pendingCount; + +- (instancetype)init { + if (self = [super init]) { + _pendingCountLock = dispatch_semaphore_create(1); + _pendingCount = 0; + } + return self; +} + +- (void)beginWithTotalCount:(NSUInteger)totalCount { + self.executing = YES; + self.finished = NO; + _pendingCount = totalCount; +} + +- (NSUInteger)pendingCount { + SD_LOCK(_pendingCountLock); + NSUInteger pendingCount = _pendingCount; + SD_UNLOCK(_pendingCountLock); + return pendingCount; +} + +- (void)completeOne { + SD_LOCK(_pendingCountLock); + _pendingCount = _pendingCount > 0 ? _pendingCount - 1 : 0; + SD_UNLOCK(_pendingCountLock); +} + +- (void)cancel { + self.cancelled = YES; + [self reset]; +} + +- (void)done { + self.finished = YES; + self.executing = NO; + [self reset]; +} + +- (void)reset { + SD_LOCK(_pendingCountLock); + _pendingCount = 0; + SD_UNLOCK(_pendingCountLock); +} + +- (void)setFinished:(BOOL)finished { + [self willChangeValueForKey:@"isFinished"]; + _finished = finished; + [self didChangeValueForKey:@"isFinished"]; +} + +- (void)setExecuting:(BOOL)executing { + [self willChangeValueForKey:@"isExecuting"]; + _executing = executing; + [self didChangeValueForKey:@"isExecuting"]; +} + +- (void)setCancelled:(BOOL)cancelled { + [self willChangeValueForKey:@"isCancelled"]; + _cancelled = cancelled; + [self didChangeValueForKey:@"isCancelled"]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h b/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h new file mode 100644 index 0000000..022cf7d --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h @@ -0,0 +1,28 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDImageIOAnimatedCoder.h" + +// AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation +#define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic") +#define kSDUTTypeHEIF ((__bridge CFStringRef)@"public.heif") +// HEIC Sequence (Animated Image) +#define kSDUTTypeHEICS ((__bridge CFStringRef)@"public.heics") +// kUTTypeWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :) +#define kSDUTTypeWebP ((__bridge CFStringRef)@"org.webmproject.webp") + +@interface SDImageIOAnimatedCoder () + ++ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source; ++ (NSUInteger)imageLoopCountWithSource:(nonnull CGImageSourceRef)source; ++ (nullable UIImage *)createFrameAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(nullable NSDictionary *)options; ++ (BOOL)canEncodeToFormat:(SDImageFormat)format; ++ (BOOL)canDecodeFromFormat:(SDImageFormat)format; + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h b/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h new file mode 100644 index 0000000..aad700f --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h @@ -0,0 +1,77 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDmetamacros.h" + +#ifndef SD_LOCK +#define SD_LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); +#endif + +#ifndef SD_UNLOCK +#define SD_UNLOCK(lock) dispatch_semaphore_signal(lock); +#endif + +#ifndef SD_OPTIONS_CONTAINS +#define SD_OPTIONS_CONTAINS(options, value) (((options) & (value)) == (value)) +#endif + +#ifndef SD_CSTRING +#define SD_CSTRING(str) #str +#endif + +#ifndef SD_NSSTRING +#define SD_NSSTRING(str) @(SD_CSTRING(str)) +#endif + +#ifndef SD_SEL_SPI +#define SD_SEL_SPI(name) NSSelectorFromString([NSString stringWithFormat:@"_%@", SD_NSSTRING(name)]) +#endif + +#ifndef weakify +#define weakify(...) \ +sd_keywordify \ +metamacro_foreach_cxt(sd_weakify_,, __weak, __VA_ARGS__) +#endif + +#ifndef strongify +#define strongify(...) \ +sd_keywordify \ +_Pragma("clang diagnostic push") \ +_Pragma("clang diagnostic ignored \"-Wshadow\"") \ +metamacro_foreach(sd_strongify_,, __VA_ARGS__) \ +_Pragma("clang diagnostic pop") +#endif + +#define sd_weakify_(INDEX, CONTEXT, VAR) \ +CONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR); + +#define sd_strongify_(INDEX, VAR) \ +__strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_); + +#if DEBUG +#define sd_keywordify autoreleasepool {} +#else +#define sd_keywordify try {} @catch (...) {} +#endif + +#ifndef onExit +#define onExit \ +sd_keywordify \ +__strong sd_cleanupBlock_t metamacro_concat(sd_exitBlock_, __LINE__) __attribute__((cleanup(sd_executeCleanupBlock), unused)) = ^ +#endif + +typedef void (^sd_cleanupBlock_t)(void); + +#if defined(__cplusplus) +extern "C" { +#endif + void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block); +#if defined(__cplusplus) +} +#endif diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h b/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m similarity index 67% rename from Pods/SDWebImage/SDWebImage/SDWebImageOperation.h rename to Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m index 71094ee..e4981af 100644 --- a/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h +++ b/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m @@ -6,10 +6,8 @@ * file that was distributed with this source code. */ -#import +#import "SDInternalMacros.h" -@protocol SDWebImageOperation - -- (void)cancel; - -@end +void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block) { + (*block)(); +} diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h b/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h similarity index 52% rename from Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h rename to Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h index 8f8df86..d92c682 100644 --- a/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h +++ b/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h @@ -1,7 +1,6 @@ /* * This file is part of the SDWebImage package. * (c) Olivier Poitrey - * (c) james * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -10,10 +9,12 @@ #import #import "SDWebImageCompat.h" -@interface UIImage (ForceDecode) +/// A weak proxy which forward all the message to the target +@interface SDWeakProxy : NSProxy -+ (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; +@property (nonatomic, weak, readonly, nullable) id target; -+ (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; +- (nonnull instancetype)initWithTarget:(nonnull id)target; ++ (nonnull instancetype)proxyWithTarget:(nonnull id)target; @end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m b/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m new file mode 100644 index 0000000..19a4593 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m @@ -0,0 +1,79 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWeakProxy.h" + +@implementation SDWeakProxy + +- (instancetype)initWithTarget:(id)target { + _target = target; + return self; +} + ++ (instancetype)proxyWithTarget:(id)target { + return [[SDWeakProxy alloc] initWithTarget:target]; +} + +- (id)forwardingTargetForSelector:(SEL)selector { + return _target; +} + +- (void)forwardInvocation:(NSInvocation *)invocation { + void *null = NULL; + [invocation setReturnValue:&null]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { + return [NSObject instanceMethodSignatureForSelector:@selector(init)]; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [_target respondsToSelector:aSelector]; +} + +- (BOOL)isEqual:(id)object { + return [_target isEqual:object]; +} + +- (NSUInteger)hash { + return [_target hash]; +} + +- (Class)superclass { + return [_target superclass]; +} + +- (Class)class { + return [_target class]; +} + +- (BOOL)isKindOfClass:(Class)aClass { + return [_target isKindOfClass:aClass]; +} + +- (BOOL)isMemberOfClass:(Class)aClass { + return [_target isMemberOfClass:aClass]; +} + +- (BOOL)conformsToProtocol:(Protocol *)aProtocol { + return [_target conformsToProtocol:aProtocol]; +} + +- (BOOL)isProxy { + return YES; +} + +- (NSString *)description { + return [_target description]; +} + +- (NSString *)debugDescription { + return [_target debugDescription]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h b/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h new file mode 100644 index 0000000..1b70649 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h @@ -0,0 +1,19 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +#import + +/// Helper method for Core Animation transition +FOUNDATION_EXPORT CAMediaTimingFunction * _Nullable SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options); +FOUNDATION_EXPORT CATransition * _Nullable SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options); + +#endif diff --git a/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h b/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h new file mode 100644 index 0000000..dd90d99 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h @@ -0,0 +1,667 @@ +/** + * Macros for metaprogramming + * ExtendedC + * + * Copyright (C) 2012 Justin Spahr-Summers + * Released under the MIT license + */ + +#ifndef EXTC_METAMACROS_H +#define EXTC_METAMACROS_H + + +/** + * Executes one or more expressions (which may have a void type, such as a call + * to a function that returns no value) and always returns true. + */ +#define metamacro_exprify(...) \ + ((__VA_ARGS__), true) + +/** + * Returns a string representation of VALUE after full macro expansion. + */ +#define metamacro_stringify(VALUE) \ + metamacro_stringify_(VALUE) + +/** + * Returns A and B concatenated after full macro expansion. + */ +#define metamacro_concat(A, B) \ + metamacro_concat_(A, B) + +/** + * Returns the Nth variadic argument (starting from zero). At least + * N + 1 variadic arguments must be given. N must be between zero and twenty, + * inclusive. + */ +#define metamacro_at(N, ...) \ + metamacro_concat(metamacro_at, N)(__VA_ARGS__) + +/** + * Returns the number of arguments (up to twenty) provided to the macro. At + * least one argument must be provided. + * + * Inspired by P99: http://p99.gforge.inria.fr + */ +#define metamacro_argcount(...) \ + metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) + +/** + * Identical to #metamacro_foreach_cxt, except that no CONTEXT argument is + * given. Only the index and current argument will thus be passed to MACRO. + */ +#define metamacro_foreach(MACRO, SEP, ...) \ + metamacro_foreach_cxt(metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__) + +/** + * For each consecutive variadic argument (up to twenty), MACRO is passed the + * zero-based index of the current argument, CONTEXT, and then the argument + * itself. The results of adjoining invocations of MACRO are then separated by + * SEP. + * + * Inspired by P99: http://p99.gforge.inria.fr + */ +#define metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \ + metamacro_concat(metamacro_foreach_cxt, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) + +/** + * Identical to #metamacro_foreach_cxt. This can be used when the former would + * fail due to recursive macro expansion. + */ +#define metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \ + metamacro_concat(metamacro_foreach_cxt_recursive, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) + +/** + * In consecutive order, appends each variadic argument (up to twenty) onto + * BASE. The resulting concatenations are then separated by SEP. + * + * This is primarily useful to manipulate a list of macro invocations into instead + * invoking a different, possibly related macro. + */ +#define metamacro_foreach_concat(BASE, SEP, ...) \ + metamacro_foreach_cxt(metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__) + +/** + * Iterates COUNT times, each time invoking MACRO with the current index + * (starting at zero) and CONTEXT. The results of adjoining invocations of MACRO + * are then separated by SEP. + * + * COUNT must be an integer between zero and twenty, inclusive. + */ +#define metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \ + metamacro_concat(metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT) + +/** + * Returns the first argument given. At least one argument must be provided. + * + * This is useful when implementing a variadic macro, where you may have only + * one variadic argument, but no way to retrieve it (for example, because \c ... + * always needs to match at least one argument). + * + * @code + +#define varmacro(...) \ + metamacro_head(__VA_ARGS__) + + * @endcode + */ +#define metamacro_head(...) \ + metamacro_head_(__VA_ARGS__, 0) + +/** + * Returns every argument except the first. At least two arguments must be + * provided. + */ +#define metamacro_tail(...) \ + metamacro_tail_(__VA_ARGS__) + +/** + * Returns the first N (up to twenty) variadic arguments as a new argument list. + * At least N variadic arguments must be provided. + */ +#define metamacro_take(N, ...) \ + metamacro_concat(metamacro_take, N)(__VA_ARGS__) + +/** + * Removes the first N (up to twenty) variadic arguments from the given argument + * list. At least N variadic arguments must be provided. + */ +#define metamacro_drop(N, ...) \ + metamacro_concat(metamacro_drop, N)(__VA_ARGS__) + +/** + * Decrements VAL, which must be a number between zero and twenty, inclusive. + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_dec(VAL) \ + metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) + +/** + * Increments VAL, which must be a number between zero and twenty, inclusive. + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_inc(VAL) \ + metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21) + +/** + * If A is equal to B, the next argument list is expanded; otherwise, the + * argument list after that is expanded. A and B must be numbers between zero + * and twenty, inclusive. Additionally, B must be greater than or equal to A. + * + * @code + +// expands to true +metamacro_if_eq(0, 0)(true)(false) + +// expands to false +metamacro_if_eq(0, 1)(true)(false) + + * @endcode + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_if_eq(A, B) \ + metamacro_concat(metamacro_if_eq, A)(B) + +/** + * Identical to #metamacro_if_eq. This can be used when the former would fail + * due to recursive macro expansion. + */ +#define metamacro_if_eq_recursive(A, B) \ + metamacro_concat(metamacro_if_eq_recursive, A)(B) + +/** + * Returns 1 if N is an even number, or 0 otherwise. N must be between zero and + * twenty, inclusive. + * + * For the purposes of this test, zero is considered even. + */ +#define metamacro_is_even(N) \ + metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) + +/** + * Returns the logical NOT of B, which must be the number zero or one. + */ +#define metamacro_not(B) \ + metamacro_at(B, 1, 0) + +// IMPLEMENTATION DETAILS FOLLOW! +// Do not write code that depends on anything below this line. +#define metamacro_stringify_(VALUE) # VALUE +#define metamacro_concat_(A, B) A ## B +#define metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG) +#define metamacro_head_(FIRST, ...) FIRST +#define metamacro_tail_(FIRST, ...) __VA_ARGS__ +#define metamacro_consume_(...) +#define metamacro_expand_(...) __VA_ARGS__ + +// implemented from scratch so that metamacro_concat() doesn't end up nesting +#define metamacro_foreach_concat_iter(INDEX, BASE, ARG) metamacro_foreach_concat_iter_(BASE, ARG) +#define metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG + +// metamacro_at expansions +#define metamacro_at0(...) metamacro_head(__VA_ARGS__) +#define metamacro_at1(_0, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at2(_0, _1, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at3(_0, _1, _2, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at4(_0, _1, _2, _3, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at5(_0, _1, _2, _3, _4, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at6(_0, _1, _2, _3, _4, _5, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) metamacro_head(__VA_ARGS__) + +// metamacro_foreach_cxt expansions +#define metamacro_foreach_cxt0(MACRO, SEP, CONTEXT) +#define metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) + +#define metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ + metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \ + SEP \ + MACRO(1, CONTEXT, _1) + +#define metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ + SEP \ + MACRO(2, CONTEXT, _2) + +#define metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + SEP \ + MACRO(3, CONTEXT, _3) + +#define metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + SEP \ + MACRO(4, CONTEXT, _4) + +#define metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + SEP \ + MACRO(5, CONTEXT, _5) + +#define metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + SEP \ + MACRO(6, CONTEXT, _6) + +#define metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + SEP \ + MACRO(7, CONTEXT, _7) + +#define metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + SEP \ + MACRO(8, CONTEXT, _8) + +#define metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + SEP \ + MACRO(9, CONTEXT, _9) + +#define metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + SEP \ + MACRO(10, CONTEXT, _10) + +#define metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + SEP \ + MACRO(11, CONTEXT, _11) + +#define metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + SEP \ + MACRO(12, CONTEXT, _12) + +#define metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + SEP \ + MACRO(13, CONTEXT, _13) + +#define metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + SEP \ + MACRO(14, CONTEXT, _14) + +#define metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + SEP \ + MACRO(15, CONTEXT, _15) + +#define metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + SEP \ + MACRO(16, CONTEXT, _16) + +#define metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + SEP \ + MACRO(17, CONTEXT, _17) + +#define metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + SEP \ + MACRO(18, CONTEXT, _18) + +#define metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + SEP \ + MACRO(19, CONTEXT, _19) + +// metamacro_foreach_cxt_recursive expansions +#define metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT) +#define metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) + +#define metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ + metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \ + SEP \ + MACRO(1, CONTEXT, _1) + +#define metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ + SEP \ + MACRO(2, CONTEXT, _2) + +#define metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + SEP \ + MACRO(3, CONTEXT, _3) + +#define metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + SEP \ + MACRO(4, CONTEXT, _4) + +#define metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + SEP \ + MACRO(5, CONTEXT, _5) + +#define metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + SEP \ + MACRO(6, CONTEXT, _6) + +#define metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + SEP \ + MACRO(7, CONTEXT, _7) + +#define metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + SEP \ + MACRO(8, CONTEXT, _8) + +#define metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + SEP \ + MACRO(9, CONTEXT, _9) + +#define metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + SEP \ + MACRO(10, CONTEXT, _10) + +#define metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + SEP \ + MACRO(11, CONTEXT, _11) + +#define metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + SEP \ + MACRO(12, CONTEXT, _12) + +#define metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + SEP \ + MACRO(13, CONTEXT, _13) + +#define metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + SEP \ + MACRO(14, CONTEXT, _14) + +#define metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + SEP \ + MACRO(15, CONTEXT, _15) + +#define metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + SEP \ + MACRO(16, CONTEXT, _16) + +#define metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + SEP \ + MACRO(17, CONTEXT, _17) + +#define metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + SEP \ + MACRO(18, CONTEXT, _18) + +#define metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + SEP \ + MACRO(19, CONTEXT, _19) + +// metamacro_for_cxt expansions +#define metamacro_for_cxt0(MACRO, SEP, CONTEXT) +#define metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT) + +#define metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt1(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(1, CONTEXT) + +#define metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(2, CONTEXT) + +#define metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(3, CONTEXT) + +#define metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(4, CONTEXT) + +#define metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(5, CONTEXT) + +#define metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(6, CONTEXT) + +#define metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(7, CONTEXT) + +#define metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(8, CONTEXT) + +#define metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(9, CONTEXT) + +#define metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(10, CONTEXT) + +#define metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(11, CONTEXT) + +#define metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(12, CONTEXT) + +#define metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(13, CONTEXT) + +#define metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(14, CONTEXT) + +#define metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(15, CONTEXT) + +#define metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(16, CONTEXT) + +#define metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(17, CONTEXT) + +#define metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(18, CONTEXT) + +#define metamacro_for_cxt20(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(19, CONTEXT) + +// metamacro_if_eq expansions +#define metamacro_if_eq0(VALUE) \ + metamacro_concat(metamacro_if_eq0_, VALUE) + +#define metamacro_if_eq0_0(...) __VA_ARGS__ metamacro_consume_ +#define metamacro_if_eq0_1(...) metamacro_expand_ +#define metamacro_if_eq0_2(...) metamacro_expand_ +#define metamacro_if_eq0_3(...) metamacro_expand_ +#define metamacro_if_eq0_4(...) metamacro_expand_ +#define metamacro_if_eq0_5(...) metamacro_expand_ +#define metamacro_if_eq0_6(...) metamacro_expand_ +#define metamacro_if_eq0_7(...) metamacro_expand_ +#define metamacro_if_eq0_8(...) metamacro_expand_ +#define metamacro_if_eq0_9(...) metamacro_expand_ +#define metamacro_if_eq0_10(...) metamacro_expand_ +#define metamacro_if_eq0_11(...) metamacro_expand_ +#define metamacro_if_eq0_12(...) metamacro_expand_ +#define metamacro_if_eq0_13(...) metamacro_expand_ +#define metamacro_if_eq0_14(...) metamacro_expand_ +#define metamacro_if_eq0_15(...) metamacro_expand_ +#define metamacro_if_eq0_16(...) metamacro_expand_ +#define metamacro_if_eq0_17(...) metamacro_expand_ +#define metamacro_if_eq0_18(...) metamacro_expand_ +#define metamacro_if_eq0_19(...) metamacro_expand_ +#define metamacro_if_eq0_20(...) metamacro_expand_ + +#define metamacro_if_eq1(VALUE) metamacro_if_eq0(metamacro_dec(VALUE)) +#define metamacro_if_eq2(VALUE) metamacro_if_eq1(metamacro_dec(VALUE)) +#define metamacro_if_eq3(VALUE) metamacro_if_eq2(metamacro_dec(VALUE)) +#define metamacro_if_eq4(VALUE) metamacro_if_eq3(metamacro_dec(VALUE)) +#define metamacro_if_eq5(VALUE) metamacro_if_eq4(metamacro_dec(VALUE)) +#define metamacro_if_eq6(VALUE) metamacro_if_eq5(metamacro_dec(VALUE)) +#define metamacro_if_eq7(VALUE) metamacro_if_eq6(metamacro_dec(VALUE)) +#define metamacro_if_eq8(VALUE) metamacro_if_eq7(metamacro_dec(VALUE)) +#define metamacro_if_eq9(VALUE) metamacro_if_eq8(metamacro_dec(VALUE)) +#define metamacro_if_eq10(VALUE) metamacro_if_eq9(metamacro_dec(VALUE)) +#define metamacro_if_eq11(VALUE) metamacro_if_eq10(metamacro_dec(VALUE)) +#define metamacro_if_eq12(VALUE) metamacro_if_eq11(metamacro_dec(VALUE)) +#define metamacro_if_eq13(VALUE) metamacro_if_eq12(metamacro_dec(VALUE)) +#define metamacro_if_eq14(VALUE) metamacro_if_eq13(metamacro_dec(VALUE)) +#define metamacro_if_eq15(VALUE) metamacro_if_eq14(metamacro_dec(VALUE)) +#define metamacro_if_eq16(VALUE) metamacro_if_eq15(metamacro_dec(VALUE)) +#define metamacro_if_eq17(VALUE) metamacro_if_eq16(metamacro_dec(VALUE)) +#define metamacro_if_eq18(VALUE) metamacro_if_eq17(metamacro_dec(VALUE)) +#define metamacro_if_eq19(VALUE) metamacro_if_eq18(metamacro_dec(VALUE)) +#define metamacro_if_eq20(VALUE) metamacro_if_eq19(metamacro_dec(VALUE)) + +// metamacro_if_eq_recursive expansions +#define metamacro_if_eq_recursive0(VALUE) \ + metamacro_concat(metamacro_if_eq_recursive0_, VALUE) + +#define metamacro_if_eq_recursive0_0(...) __VA_ARGS__ metamacro_consume_ +#define metamacro_if_eq_recursive0_1(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_2(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_3(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_4(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_5(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_6(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_7(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_8(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_9(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_10(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_11(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_12(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_13(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_14(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_15(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_16(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_17(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_18(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_19(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_20(...) metamacro_expand_ + +#define metamacro_if_eq_recursive1(VALUE) metamacro_if_eq_recursive0(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive2(VALUE) metamacro_if_eq_recursive1(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive3(VALUE) metamacro_if_eq_recursive2(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive4(VALUE) metamacro_if_eq_recursive3(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive5(VALUE) metamacro_if_eq_recursive4(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive6(VALUE) metamacro_if_eq_recursive5(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive7(VALUE) metamacro_if_eq_recursive6(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive8(VALUE) metamacro_if_eq_recursive7(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive9(VALUE) metamacro_if_eq_recursive8(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive10(VALUE) metamacro_if_eq_recursive9(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive11(VALUE) metamacro_if_eq_recursive10(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive12(VALUE) metamacro_if_eq_recursive11(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive13(VALUE) metamacro_if_eq_recursive12(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive14(VALUE) metamacro_if_eq_recursive13(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive15(VALUE) metamacro_if_eq_recursive14(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive16(VALUE) metamacro_if_eq_recursive15(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive17(VALUE) metamacro_if_eq_recursive16(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive18(VALUE) metamacro_if_eq_recursive17(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive19(VALUE) metamacro_if_eq_recursive18(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive20(VALUE) metamacro_if_eq_recursive19(metamacro_dec(VALUE)) + +// metamacro_take expansions +#define metamacro_take0(...) +#define metamacro_take1(...) metamacro_head(__VA_ARGS__) +#define metamacro_take2(...) metamacro_head(__VA_ARGS__), metamacro_take1(metamacro_tail(__VA_ARGS__)) +#define metamacro_take3(...) metamacro_head(__VA_ARGS__), metamacro_take2(metamacro_tail(__VA_ARGS__)) +#define metamacro_take4(...) metamacro_head(__VA_ARGS__), metamacro_take3(metamacro_tail(__VA_ARGS__)) +#define metamacro_take5(...) metamacro_head(__VA_ARGS__), metamacro_take4(metamacro_tail(__VA_ARGS__)) +#define metamacro_take6(...) metamacro_head(__VA_ARGS__), metamacro_take5(metamacro_tail(__VA_ARGS__)) +#define metamacro_take7(...) metamacro_head(__VA_ARGS__), metamacro_take6(metamacro_tail(__VA_ARGS__)) +#define metamacro_take8(...) metamacro_head(__VA_ARGS__), metamacro_take7(metamacro_tail(__VA_ARGS__)) +#define metamacro_take9(...) metamacro_head(__VA_ARGS__), metamacro_take8(metamacro_tail(__VA_ARGS__)) +#define metamacro_take10(...) metamacro_head(__VA_ARGS__), metamacro_take9(metamacro_tail(__VA_ARGS__)) +#define metamacro_take11(...) metamacro_head(__VA_ARGS__), metamacro_take10(metamacro_tail(__VA_ARGS__)) +#define metamacro_take12(...) metamacro_head(__VA_ARGS__), metamacro_take11(metamacro_tail(__VA_ARGS__)) +#define metamacro_take13(...) metamacro_head(__VA_ARGS__), metamacro_take12(metamacro_tail(__VA_ARGS__)) +#define metamacro_take14(...) metamacro_head(__VA_ARGS__), metamacro_take13(metamacro_tail(__VA_ARGS__)) +#define metamacro_take15(...) metamacro_head(__VA_ARGS__), metamacro_take14(metamacro_tail(__VA_ARGS__)) +#define metamacro_take16(...) metamacro_head(__VA_ARGS__), metamacro_take15(metamacro_tail(__VA_ARGS__)) +#define metamacro_take17(...) metamacro_head(__VA_ARGS__), metamacro_take16(metamacro_tail(__VA_ARGS__)) +#define metamacro_take18(...) metamacro_head(__VA_ARGS__), metamacro_take17(metamacro_tail(__VA_ARGS__)) +#define metamacro_take19(...) metamacro_head(__VA_ARGS__), metamacro_take18(metamacro_tail(__VA_ARGS__)) +#define metamacro_take20(...) metamacro_head(__VA_ARGS__), metamacro_take19(metamacro_tail(__VA_ARGS__)) + +// metamacro_drop expansions +#define metamacro_drop0(...) __VA_ARGS__ +#define metamacro_drop1(...) metamacro_tail(__VA_ARGS__) +#define metamacro_drop2(...) metamacro_drop1(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop3(...) metamacro_drop2(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop4(...) metamacro_drop3(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop5(...) metamacro_drop4(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop6(...) metamacro_drop5(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop7(...) metamacro_drop6(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop8(...) metamacro_drop7(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop9(...) metamacro_drop8(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop10(...) metamacro_drop9(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop11(...) metamacro_drop10(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop12(...) metamacro_drop11(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop13(...) metamacro_drop12(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop14(...) metamacro_drop13(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop15(...) metamacro_drop14(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop16(...) metamacro_drop15(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop17(...) metamacro_drop16(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop18(...) metamacro_drop17(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__)) + +#endif diff --git a/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h b/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h similarity index 52% rename from Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h rename to Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h index bec411e..cf67186 100644 --- a/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h +++ b/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h @@ -7,12 +7,12 @@ */ #import "SDWebImageCompat.h" -#import "NSData+ImageContentType.h" -@interface UIImage (MultiFormat) +@interface UIColor (SDHexString) -+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; -- (nullable NSData *)sd_imageData; -- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; +/** + Convenience way to get hex string from color. The output should always be 32-bit RGBA hex string like `#00000000`. + */ +@property (nonatomic, copy, readonly, nonnull) NSString *sd_hexString; @end diff --git a/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m b/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m new file mode 100644 index 0000000..7b43c41 --- /dev/null +++ b/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m @@ -0,0 +1,42 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIColor+SDHexString.h" + +@implementation UIColor (SDHexString) + +- (NSString *)sd_hexString { + CGFloat red, green, blue, alpha; +#if SD_UIKIT + if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) { + [self getWhite:&red alpha:&alpha]; + green = red; + blue = red; + } +#else + @try { + [self getRed:&red green:&green blue:&blue alpha:&alpha]; + } + @catch (NSException *exception) { + [self getWhite:&red alpha:&alpha]; + green = red; + blue = red; + } +#endif + + red = roundf(red * 255.f); + green = roundf(green * 255.f); + blue = roundf(blue * 255.f); + alpha = roundf(alpha * 255.f); + + uint hex = ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue); + + return [NSString stringWithFormat:@"#%08x", hex]; +} + +@end diff --git a/Pods/SDWebImage/SDWebImage/SDImageCache.h b/Pods/SDWebImage/SDWebImage/SDImageCache.h deleted file mode 100644 index 9ae2eb4..0000000 --- a/Pods/SDWebImage/SDWebImage/SDImageCache.h +++ /dev/null @@ -1,267 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import -#import "SDWebImageCompat.h" - -@class SDImageCacheConfig; - -typedef NS_ENUM(NSInteger, SDImageCacheType) { - /** - * The image wasn't available the SDWebImage caches, but was downloaded from the web. - */ - SDImageCacheTypeNone, - /** - * The image was obtained from the disk cache. - */ - SDImageCacheTypeDisk, - /** - * The image was obtained from the memory cache. - */ - SDImageCacheTypeMemory -}; - -typedef void(^SDCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); - -typedef void(^SDWebImageCheckCacheCompletionBlock)(BOOL isInCache); - -typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger totalSize); - - -/** - * SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed - * asynchronous so it doesn’t add unnecessary latency to the UI. - */ -@interface SDImageCache : NSObject - -#pragma mark - Properties - -/** - * Cache Config object - storing all kind of settings - */ -@property (nonatomic, nonnull, readonly) SDImageCacheConfig *config; - -/** - * The maximum "total cost" of the in-memory image cache. The cost function is the number of pixels held in memory. - */ -@property (assign, nonatomic) NSUInteger maxMemoryCost; - -/** - * The maximum number of objects the cache should hold. - */ -@property (assign, nonatomic) NSUInteger maxMemoryCountLimit; - -#pragma mark - Singleton and initialization - -/** - * Returns global shared cache instance - * - * @return SDImageCache global instance - */ -+ (nonnull instancetype)sharedImageCache; - -/** - * Init a new cache store with a specific namespace - * - * @param ns The namespace to use for this cache store - */ -- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns; - -/** - * Init a new cache store with a specific namespace and directory - * - * @param ns The namespace to use for this cache store - * @param directory Directory to cache disk images in - */ -- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns - diskCacheDirectory:(nonnull NSString *)directory NS_DESIGNATED_INITIALIZER; - -#pragma mark - Cache paths - -- (nullable NSString *)makeDiskCachePath:(nonnull NSString*)fullNamespace; - -/** - * Add a read-only cache path to search for images pre-cached by SDImageCache - * Useful if you want to bundle pre-loaded images with your app - * - * @param path The path to use for this read-only cache path - */ -- (void)addReadOnlyCachePath:(nonnull NSString *)path; - -#pragma mark - Store Ops - -/** - * Asynchronously store an image into memory and disk cache at the given key. - * - * @param image The image to store - * @param key The unique image cache key, usually it's image absolute URL - * @param completionBlock A block executed after the operation is finished - */ -- (void)storeImage:(nullable UIImage *)image - forKey:(nullable NSString *)key - completion:(nullable SDWebImageNoParamsBlock)completionBlock; - -/** - * Asynchronously store an image into memory and disk cache at the given key. - * - * @param image The image to store - * @param key The unique image cache key, usually it's image absolute URL - * @param toDisk Store the image to disk cache if YES - * @param completionBlock A block executed after the operation is finished - */ -- (void)storeImage:(nullable UIImage *)image - forKey:(nullable NSString *)key - toDisk:(BOOL)toDisk - completion:(nullable SDWebImageNoParamsBlock)completionBlock; - -/** - * Asynchronously store an image into memory and disk cache at the given key. - * - * @param image The image to store - * @param imageData The image data as returned by the server, this representation will be used for disk storage - * instead of converting the given image object into a storable/compressed image format in order - * to save quality and CPU - * @param key The unique image cache key, usually it's image absolute URL - * @param toDisk Store the image to disk cache if YES - * @param completionBlock A block executed after the operation is finished - */ -- (void)storeImage:(nullable UIImage *)image - imageData:(nullable NSData *)imageData - forKey:(nullable NSString *)key - toDisk:(BOOL)toDisk - completion:(nullable SDWebImageNoParamsBlock)completionBlock; - -/** - * Synchronously store image NSData into disk cache at the given key. - * - * @warning This method is synchronous, make sure to call it from the ioQueue - * - * @param imageData The image data to store - * @param key The unique image cache key, usually it's image absolute URL - */ -- (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key; - -#pragma mark - Query and Retrieve Ops - -/** - * Async check if image exists in disk cache already (does not load the image) - * - * @param key the key describing the url - * @param completionBlock the block to be executed when the check is done. - * @note the completion block will be always executed on the main queue - */ -- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; - -/** - * Operation that queries the cache asynchronously and call the completion when done. - * - * @param key The unique key used to store the wanted image - * @param doneBlock The completion block. Will not get called if the operation is cancelled - * - * @return a NSOperation instance containing the cache op - */ -- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDCacheQueryCompletedBlock)doneBlock; - -/** - * Query the memory cache synchronously. - * - * @param key The unique key used to store the image - */ -- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key; - -/** - * Query the disk cache synchronously. - * - * @param key The unique key used to store the image - */ -- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key; - -/** - * Query the cache (memory and or disk) synchronously after checking the memory cache. - * - * @param key The unique key used to store the image - */ -- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key; - -#pragma mark - Remove Ops - -/** - * Remove the image from memory and disk cache asynchronously - * - * @param key The unique image cache key - * @param completion A block that should be executed after the image has been removed (optional) - */ -- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion; - -/** - * Remove the image from memory and optionally disk cache asynchronously - * - * @param key The unique image cache key - * @param fromDisk Also remove cache entry from disk if YES - * @param completion A block that should be executed after the image has been removed (optional) - */ -- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion; - -#pragma mark - Cache clean Ops - -/** - * Clear all memory cached images - */ -- (void)clearMemory; - -/** - * Async clear all disk cached images. Non-blocking method - returns immediately. - * @param completion A block that should be executed after cache expiration completes (optional) - */ -- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion; - -/** - * Async remove all expired cached image from disk. Non-blocking method - returns immediately. - * @param completionBlock A block that should be executed after cache expiration completes (optional) - */ -- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock; - -#pragma mark - Cache Info - -/** - * Get the size used by the disk cache - */ -- (NSUInteger)getSize; - -/** - * Get the number of images in the disk cache - */ -- (NSUInteger)getDiskCount; - -/** - * Asynchronously calculate the disk cache's size. - */ -- (void)calculateSizeWithCompletionBlock:(nullable SDWebImageCalculateSizeBlock)completionBlock; - -#pragma mark - Cache Paths - -/** - * Get the cache path for a certain key (needs the cache path root folder) - * - * @param key the key (can be obtained from url using cacheKeyForURL) - * @param path the cache path root folder - * - * @return the cache path - */ -- (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path; - -/** - * Get the default cache path for a certain key - * - * @param key the key (can be obtained from url using cacheKeyForURL) - * - * @return the default cache path - */ -- (nullable NSString *)defaultCachePathForKey:(nullable NSString *)key; - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDImageCache.m b/Pods/SDWebImage/SDWebImage/SDImageCache.m deleted file mode 100644 index acd5ee6..0000000 --- a/Pods/SDWebImage/SDWebImage/SDImageCache.m +++ /dev/null @@ -1,639 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDImageCache.h" -#import "SDWebImageDecoder.h" -#import "UIImage+MultiFormat.h" -#import -#import "UIImage+GIF.h" -#import "NSData+ImageContentType.h" -#import "NSImage+WebCache.h" -#import "SDImageCacheConfig.h" - -// See https://github.com/rs/SDWebImage/pull/1141 for discussion -@interface AutoPurgeCache : NSCache -@end - -@implementation AutoPurgeCache - -- (nonnull instancetype)init { - self = [super init]; - if (self) { -#if SD_UIKIT - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeAllObjects) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif - } - return self; -} - -- (void)dealloc { -#if SD_UIKIT - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif -} - -@end - - -FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { -#if SD_MAC - return image.size.height * image.size.width; -#elif SD_UIKIT || SD_WATCH - return image.size.height * image.size.width * image.scale * image.scale; -#endif -} - -@interface SDImageCache () - -#pragma mark - Properties -@property (strong, nonatomic, nonnull) NSCache *memCache; -@property (strong, nonatomic, nonnull) NSString *diskCachePath; -@property (strong, nonatomic, nullable) NSMutableArray *customPaths; -@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t ioQueue; - -@end - - -@implementation SDImageCache { - NSFileManager *_fileManager; -} - -#pragma mark - Singleton, init, dealloc - -+ (nonnull instancetype)sharedImageCache { - static dispatch_once_t once; - static id instance; - dispatch_once(&once, ^{ - instance = [self new]; - }); - return instance; -} - -- (instancetype)init { - return [self initWithNamespace:@"default"]; -} - -- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns { - NSString *path = [self makeDiskCachePath:ns]; - return [self initWithNamespace:ns diskCacheDirectory:path]; -} - -- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns - diskCacheDirectory:(nonnull NSString *)directory { - if ((self = [super init])) { - NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns]; - - // Create IO serial queue - _ioQueue = dispatch_queue_create("com.hackemist.SDWebImageCache", DISPATCH_QUEUE_SERIAL); - - _config = [[SDImageCacheConfig alloc] init]; - - // Init the memory cache - _memCache = [[AutoPurgeCache alloc] init]; - _memCache.name = fullNamespace; - - // Init the disk cache - if (directory != nil) { - _diskCachePath = [directory stringByAppendingPathComponent:fullNamespace]; - } else { - NSString *path = [self makeDiskCachePath:ns]; - _diskCachePath = path; - } - - dispatch_sync(_ioQueue, ^{ - _fileManager = [NSFileManager new]; - }); - -#if SD_UIKIT - // Subscribe to app events - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(clearMemory) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(deleteOldFiles) - name:UIApplicationWillTerminateNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(backgroundDeleteOldFiles) - name:UIApplicationDidEnterBackgroundNotification - object:nil]; -#endif - } - - return self; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - SDDispatchQueueRelease(_ioQueue); -} - -- (void)checkIfQueueIsIOQueue { - const char *currentQueueLabel = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL); - const char *ioQueueLabel = dispatch_queue_get_label(self.ioQueue); - if (strcmp(currentQueueLabel, ioQueueLabel) != 0) { - NSLog(@"This method should be called from the ioQueue"); - } -} - -#pragma mark - Cache paths - -- (void)addReadOnlyCachePath:(nonnull NSString *)path { - if (!self.customPaths) { - self.customPaths = [NSMutableArray new]; - } - - if (![self.customPaths containsObject:path]) { - [self.customPaths addObject:path]; - } -} - -- (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path { - NSString *filename = [self cachedFileNameForKey:key]; - return [path stringByAppendingPathComponent:filename]; -} - -- (nullable NSString *)defaultCachePathForKey:(nullable NSString *)key { - return [self cachePathForKey:key inPath:self.diskCachePath]; -} - -- (nullable NSString *)cachedFileNameForKey:(nullable NSString *)key { - const char *str = key.UTF8String; - if (str == NULL) { - str = ""; - } - unsigned char r[CC_MD5_DIGEST_LENGTH]; - CC_MD5(str, (CC_LONG)strlen(str), r); - NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%@", - r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], - r[11], r[12], r[13], r[14], r[15], [key.pathExtension isEqualToString:@""] ? @"" : [NSString stringWithFormat:@".%@", key.pathExtension]]; - - return filename; -} - -- (nullable NSString *)makeDiskCachePath:(nonnull NSString*)fullNamespace { - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); - return [paths[0] stringByAppendingPathComponent:fullNamespace]; -} - -#pragma mark - Store Ops - -- (void)storeImage:(nullable UIImage *)image - forKey:(nullable NSString *)key - completion:(nullable SDWebImageNoParamsBlock)completionBlock { - [self storeImage:image imageData:nil forKey:key toDisk:YES completion:completionBlock]; -} - -- (void)storeImage:(nullable UIImage *)image - forKey:(nullable NSString *)key - toDisk:(BOOL)toDisk - completion:(nullable SDWebImageNoParamsBlock)completionBlock { - [self storeImage:image imageData:nil forKey:key toDisk:toDisk completion:completionBlock]; -} - -- (void)storeImage:(nullable UIImage *)image - imageData:(nullable NSData *)imageData - forKey:(nullable NSString *)key - toDisk:(BOOL)toDisk - completion:(nullable SDWebImageNoParamsBlock)completionBlock { - if (!image || !key) { - if (completionBlock) { - completionBlock(); - } - return; - } - // if memory cache is enabled - if (self.config.shouldCacheImagesInMemory) { - NSUInteger cost = SDCacheCostForImage(image); - [self.memCache setObject:image forKey:key cost:cost]; - } - - if (toDisk) { - dispatch_async(self.ioQueue, ^{ - NSData *data = imageData; - - if (!data && image) { - SDImageFormat imageFormatFromData = [NSData sd_imageFormatForImageData:data]; - data = [image sd_imageDataAsFormat:imageFormatFromData]; - } - - [self storeImageDataToDisk:data forKey:key]; - if (completionBlock) { - dispatch_async(dispatch_get_main_queue(), ^{ - completionBlock(); - }); - } - }); - } else { - if (completionBlock) { - completionBlock(); - } - } -} - -- (void)storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key { - if (!imageData || !key) { - return; - } - - [self checkIfQueueIsIOQueue]; - - if (![_fileManager fileExistsAtPath:_diskCachePath]) { - [_fileManager createDirectoryAtPath:_diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL]; - } - - // get cache Path for image key - NSString *cachePathForKey = [self defaultCachePathForKey:key]; - // transform to NSUrl - NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey]; - - [_fileManager createFileAtPath:cachePathForKey contents:imageData attributes:nil]; - - // disable iCloud backup - if (self.config.shouldDisableiCloud) { - [fileURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; - } -} - -#pragma mark - Query and Retrieve Ops - -- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock { - dispatch_async(_ioQueue, ^{ - BOOL exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key]]; - - // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name - // checking the key with and without the extension - if (!exists) { - exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key].stringByDeletingPathExtension]; - } - - if (completionBlock) { - dispatch_async(dispatch_get_main_queue(), ^{ - completionBlock(exists); - }); - } - }); -} - -- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key { - return [self.memCache objectForKey:key]; -} - -- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key { - UIImage *diskImage = [self diskImageForKey:key]; - if (diskImage && self.config.shouldCacheImagesInMemory) { - NSUInteger cost = SDCacheCostForImage(diskImage); - [self.memCache setObject:diskImage forKey:key cost:cost]; - } - - return diskImage; -} - -- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key { - // First check the in-memory cache... - UIImage *image = [self imageFromMemoryCacheForKey:key]; - if (image) { - return image; - } - - // Second check the disk cache... - image = [self imageFromDiskCacheForKey:key]; - return image; -} - -- (nullable NSData *)diskImageDataBySearchingAllPathsForKey:(nullable NSString *)key { - NSString *defaultPath = [self defaultCachePathForKey:key]; - NSData *data = [NSData dataWithContentsOfFile:defaultPath]; - if (data) { - return data; - } - - // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name - // checking the key with and without the extension - data = [NSData dataWithContentsOfFile:defaultPath.stringByDeletingPathExtension]; - if (data) { - return data; - } - - NSArray *customPaths = [self.customPaths copy]; - for (NSString *path in customPaths) { - NSString *filePath = [self cachePathForKey:key inPath:path]; - NSData *imageData = [NSData dataWithContentsOfFile:filePath]; - if (imageData) { - return imageData; - } - - // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name - // checking the key with and without the extension - imageData = [NSData dataWithContentsOfFile:filePath.stringByDeletingPathExtension]; - if (imageData) { - return imageData; - } - } - - return nil; -} - -- (nullable UIImage *)diskImageForKey:(nullable NSString *)key { - NSData *data = [self diskImageDataBySearchingAllPathsForKey:key]; - if (data) { - UIImage *image = [UIImage sd_imageWithData:data]; - image = [self scaledImageForKey:key image:image]; - if (self.config.shouldDecompressImages) { - image = [UIImage decodedImageWithImage:image]; - } - return image; - } - else { - return nil; - } -} - -- (nullable UIImage *)scaledImageForKey:(nullable NSString *)key image:(nullable UIImage *)image { - return SDScaledImageForKey(key, image); -} - -- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDCacheQueryCompletedBlock)doneBlock { - if (!key) { - if (doneBlock) { - doneBlock(nil, nil, SDImageCacheTypeNone); - } - return nil; - } - - // First check the in-memory cache... - UIImage *image = [self imageFromMemoryCacheForKey:key]; - if (image) { - NSData *diskData = nil; - if ([image isGIF]) { - diskData = [self diskImageDataBySearchingAllPathsForKey:key]; - } - if (doneBlock) { - doneBlock(image, diskData, SDImageCacheTypeMemory); - } - return nil; - } - - NSOperation *operation = [NSOperation new]; - dispatch_async(self.ioQueue, ^{ - if (operation.isCancelled) { - // do not call the completion if cancelled - return; - } - - @autoreleasepool { - NSData *diskData = [self diskImageDataBySearchingAllPathsForKey:key]; - UIImage *diskImage = [self diskImageForKey:key]; - if (diskImage && self.config.shouldCacheImagesInMemory) { - NSUInteger cost = SDCacheCostForImage(diskImage); - [self.memCache setObject:diskImage forKey:key cost:cost]; - } - - if (doneBlock) { - dispatch_async(dispatch_get_main_queue(), ^{ - doneBlock(diskImage, diskData, SDImageCacheTypeDisk); - }); - } - } - }); - - return operation; -} - -#pragma mark - Remove Ops - -- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion { - [self removeImageForKey:key fromDisk:YES withCompletion:completion]; -} - -- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion { - if (key == nil) { - return; - } - - if (self.config.shouldCacheImagesInMemory) { - [self.memCache removeObjectForKey:key]; - } - - if (fromDisk) { - dispatch_async(self.ioQueue, ^{ - [_fileManager removeItemAtPath:[self defaultCachePathForKey:key] error:nil]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(); - }); - } - }); - } else if (completion){ - completion(); - } - -} - -# pragma mark - Mem Cache settings - -- (void)setMaxMemoryCost:(NSUInteger)maxMemoryCost { - self.memCache.totalCostLimit = maxMemoryCost; -} - -- (NSUInteger)maxMemoryCost { - return self.memCache.totalCostLimit; -} - -- (NSUInteger)maxMemoryCountLimit { - return self.memCache.countLimit; -} - -- (void)setMaxMemoryCountLimit:(NSUInteger)maxCountLimit { - self.memCache.countLimit = maxCountLimit; -} - -#pragma mark - Cache clean Ops - -- (void)clearMemory { - [self.memCache removeAllObjects]; -} - -- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion { - dispatch_async(self.ioQueue, ^{ - [_fileManager removeItemAtPath:self.diskCachePath error:nil]; - [_fileManager createDirectoryAtPath:self.diskCachePath - withIntermediateDirectories:YES - attributes:nil - error:NULL]; - - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(); - }); - } - }); -} - -- (void)deleteOldFiles { - [self deleteOldFilesWithCompletionBlock:nil]; -} - -- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock { - dispatch_async(self.ioQueue, ^{ - NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; - NSArray *resourceKeys = @[NSURLIsDirectoryKey, NSURLContentModificationDateKey, NSURLTotalFileAllocatedSizeKey]; - - // This enumerator prefetches useful properties for our cache files. - NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtURL:diskCacheURL - includingPropertiesForKeys:resourceKeys - options:NSDirectoryEnumerationSkipsHiddenFiles - errorHandler:NULL]; - - NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-self.config.maxCacheAge]; - NSMutableDictionary *> *cacheFiles = [NSMutableDictionary dictionary]; - NSUInteger currentCacheSize = 0; - - // Enumerate all of the files in the cache directory. This loop has two purposes: - // - // 1. Removing files that are older than the expiration date. - // 2. Storing file attributes for the size-based cleanup pass. - NSMutableArray *urlsToDelete = [[NSMutableArray alloc] init]; - for (NSURL *fileURL in fileEnumerator) { - NSError *error; - NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error]; - - // Skip directories and errors. - if (error || !resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) { - continue; - } - - // Remove files that are older than the expiration date; - NSDate *modificationDate = resourceValues[NSURLContentModificationDateKey]; - if ([[modificationDate laterDate:expirationDate] isEqualToDate:expirationDate]) { - [urlsToDelete addObject:fileURL]; - continue; - } - - // Store a reference to this file and account for its total size. - NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; - currentCacheSize += totalAllocatedSize.unsignedIntegerValue; - cacheFiles[fileURL] = resourceValues; - } - - for (NSURL *fileURL in urlsToDelete) { - [_fileManager removeItemAtURL:fileURL error:nil]; - } - - // If our remaining disk cache exceeds a configured maximum size, perform a second - // size-based cleanup pass. We delete the oldest files first. - if (self.config.maxCacheSize > 0 && currentCacheSize > self.config.maxCacheSize) { - // Target half of our maximum cache size for this cleanup pass. - const NSUInteger desiredCacheSize = self.config.maxCacheSize / 2; - - // Sort the remaining cache files by their last modification time (oldest first). - NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent - usingComparator:^NSComparisonResult(id obj1, id obj2) { - return [obj1[NSURLContentModificationDateKey] compare:obj2[NSURLContentModificationDateKey]]; - }]; - - // Delete files until we fall below our desired cache size. - for (NSURL *fileURL in sortedFiles) { - if ([_fileManager removeItemAtURL:fileURL error:nil]) { - NSDictionary *resourceValues = cacheFiles[fileURL]; - NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; - currentCacheSize -= totalAllocatedSize.unsignedIntegerValue; - - if (currentCacheSize < desiredCacheSize) { - break; - } - } - } - } - if (completionBlock) { - dispatch_async(dispatch_get_main_queue(), ^{ - completionBlock(); - }); - } - }); -} - -#if SD_UIKIT -- (void)backgroundDeleteOldFiles { - Class UIApplicationClass = NSClassFromString(@"UIApplication"); - if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { - return; - } - UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)]; - __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{ - // Clean up any unfinished task business by marking where you - // stopped or ending the task outright. - [application endBackgroundTask:bgTask]; - bgTask = UIBackgroundTaskInvalid; - }]; - - // Start the long-running task and return immediately. - [self deleteOldFilesWithCompletionBlock:^{ - [application endBackgroundTask:bgTask]; - bgTask = UIBackgroundTaskInvalid; - }]; -} -#endif - -#pragma mark - Cache Info - -- (NSUInteger)getSize { - __block NSUInteger size = 0; - dispatch_sync(self.ioQueue, ^{ - NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtPath:self.diskCachePath]; - for (NSString *fileName in fileEnumerator) { - NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName]; - NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil]; - size += [attrs fileSize]; - } - }); - return size; -} - -- (NSUInteger)getDiskCount { - __block NSUInteger count = 0; - dispatch_sync(self.ioQueue, ^{ - NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtPath:self.diskCachePath]; - count = fileEnumerator.allObjects.count; - }); - return count; -} - -- (void)calculateSizeWithCompletionBlock:(nullable SDWebImageCalculateSizeBlock)completionBlock { - NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; - - dispatch_async(self.ioQueue, ^{ - NSUInteger fileCount = 0; - NSUInteger totalSize = 0; - - NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtURL:diskCacheURL - includingPropertiesForKeys:@[NSFileSize] - options:NSDirectoryEnumerationSkipsHiddenFiles - errorHandler:NULL]; - - for (NSURL *fileURL in fileEnumerator) { - NSNumber *fileSize; - [fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL]; - totalSize += fileSize.unsignedIntegerValue; - fileCount += 1; - } - - if (completionBlock) { - dispatch_async(dispatch_get_main_queue(), ^{ - completionBlock(fileCount, totalSize); - }); - } - }); -} - -@end - diff --git a/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h b/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h deleted file mode 100644 index fd83527..0000000 --- a/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// SDImageCacheConfig.h -// SDWebImage -// -// Created by Bogdan on 09/09/16. -// Copyright © 2016 Dailymotion. All rights reserved. -// - -#import -#import "SDWebImageCompat.h" - -@interface SDImageCacheConfig : NSObject - -/** - * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. - * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. - */ -@property (assign, nonatomic) BOOL shouldDecompressImages; - -/** - * disable iCloud backup [defaults to YES] - */ -@property (assign, nonatomic) BOOL shouldDisableiCloud; - -/** - * use memory cache [defaults to YES] - */ -@property (assign, nonatomic) BOOL shouldCacheImagesInMemory; - -/** - * The maximum length of time to keep an image in the cache, in seconds - */ -@property (assign, nonatomic) NSInteger maxCacheAge; - -/** - * The maximum size of the cache, in bytes. - */ -@property (assign, nonatomic) NSUInteger maxCacheSize; - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m b/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m deleted file mode 100644 index c154265..0000000 --- a/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m +++ /dev/null @@ -1,26 +0,0 @@ -// -// SDImageCacheConfig.m -// SDWebImage -// -// Created by Bogdan on 09/09/16. -// Copyright © 2016 Dailymotion. All rights reserved. -// - -#import "SDImageCacheConfig.h" - -static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week - -@implementation SDImageCacheConfig - -- (instancetype)init { - if (self = [super init]) { - _shouldDecompressImages = YES; - _shouldDisableiCloud = YES; - _shouldCacheImagesInMemory = YES; - _maxCacheAge = kDefaultCacheMaxCacheAge; - _maxCacheSize = 0; - } - return self; -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m b/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m deleted file mode 100644 index ade04be..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageCompat.h" - -#if !__has_feature(objc_arc) -#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag -#endif - -inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { - if (!image) { - return nil; - } - -#if SD_MAC - return image; -#elif SD_UIKIT || SD_WATCH - if ((image.images).count > 0) { - NSMutableArray *scaledImages = [NSMutableArray array]; - - for (UIImage *tempImage in image.images) { - [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; - } - - return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; - } - else { -#if SD_WATCH - if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { -#elif SD_UIKIT - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { -#endif - CGFloat scale = 1; - if (key.length >= 8) { - NSRange range = [key rangeOfString:@"@2x."]; - if (range.location != NSNotFound) { - scale = 2.0; - } - - range = [key rangeOfString:@"@3x."]; - if (range.location != NSNotFound) { - scale = 3.0; - } - } - - UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; - image = scaledImage; - } - return image; - } -#endif -} - -NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m b/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m deleted file mode 100644 index cf5e676..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m +++ /dev/null @@ -1,279 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * (c) james - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageDecoder.h" - -@implementation UIImage (ForceDecode) - -#if SD_UIKIT || SD_WATCH -static const size_t kBytesPerPixel = 4; -static const size_t kBitsPerComponent = 8; - -+ (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image { - if (![UIImage shouldDecodeImage:image]) { - return image; - } - - // autorelease the bitmap context and all vars to help system to free memory when there are memory warning. - // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory]; - @autoreleasepool{ - - CGImageRef imageRef = image.CGImage; - CGColorSpaceRef colorspaceRef = [UIImage colorSpaceForImageRef:imageRef]; - - size_t width = CGImageGetWidth(imageRef); - size_t height = CGImageGetHeight(imageRef); - size_t bytesPerRow = kBytesPerPixel * width; - - // kCGImageAlphaNone is not supported in CGBitmapContextCreate. - // Since the original image here has no alpha info, use kCGImageAlphaNoneSkipLast - // to create bitmap graphics contexts without alpha info. - CGContextRef context = CGBitmapContextCreate(NULL, - width, - height, - kBitsPerComponent, - bytesPerRow, - colorspaceRef, - kCGBitmapByteOrderDefault|kCGImageAlphaNoneSkipLast); - if (context == NULL) { - return image; - } - - // Draw the image into the context and retrieve the new bitmap image without alpha - CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); - CGImageRef imageRefWithoutAlpha = CGBitmapContextCreateImage(context); - UIImage *imageWithoutAlpha = [UIImage imageWithCGImage:imageRefWithoutAlpha - scale:image.scale - orientation:image.imageOrientation]; - - CGContextRelease(context); - CGImageRelease(imageRefWithoutAlpha); - - return imageWithoutAlpha; - } -} - -/* - * Defines the maximum size in MB of the decoded image when the flag `SDWebImageScaleDownLargeImages` is set - * Suggested value for iPad1 and iPhone 3GS: 60. - * Suggested value for iPad2 and iPhone 4: 120. - * Suggested value for iPhone 3G and iPod 2 and earlier devices: 30. - */ -static const CGFloat kDestImageSizeMB = 60.0f; - -/* - * Defines the maximum size in MB of a tile used to decode image when the flag `SDWebImageScaleDownLargeImages` is set - * Suggested value for iPad1 and iPhone 3GS: 20. - * Suggested value for iPad2 and iPhone 4: 40. - * Suggested value for iPhone 3G and iPod 2 and earlier devices: 10. - */ -static const CGFloat kSourceImageTileSizeMB = 20.0f; - -static const CGFloat kBytesPerMB = 1024.0f * 1024.0f; -static const CGFloat kPixelsPerMB = kBytesPerMB / kBytesPerPixel; -static const CGFloat kDestTotalPixels = kDestImageSizeMB * kPixelsPerMB; -static const CGFloat kTileTotalPixels = kSourceImageTileSizeMB * kPixelsPerMB; - -static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to overlap the seems where tiles meet. - -+ (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image { - if (![UIImage shouldDecodeImage:image]) { - return image; - } - - if (![UIImage shouldScaleDownImage:image]) { - return [UIImage decodedImageWithImage:image]; - } - - CGContextRef destContext; - - // autorelease the bitmap context and all vars to help system to free memory when there are memory warning. - // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory]; - @autoreleasepool { - CGImageRef sourceImageRef = image.CGImage; - - CGSize sourceResolution = CGSizeZero; - sourceResolution.width = CGImageGetWidth(sourceImageRef); - sourceResolution.height = CGImageGetHeight(sourceImageRef); - float sourceTotalPixels = sourceResolution.width * sourceResolution.height; - // Determine the scale ratio to apply to the input image - // that results in an output image of the defined size. - // see kDestImageSizeMB, and how it relates to destTotalPixels. - float imageScale = kDestTotalPixels / sourceTotalPixels; - CGSize destResolution = CGSizeZero; - destResolution.width = (int)(sourceResolution.width*imageScale); - destResolution.height = (int)(sourceResolution.height*imageScale); - - // current color space - CGColorSpaceRef colorspaceRef = [UIImage colorSpaceForImageRef:sourceImageRef]; - - size_t bytesPerRow = kBytesPerPixel * destResolution.width; - - // Allocate enough pixel data to hold the output image. - void* destBitmapData = malloc( bytesPerRow * destResolution.height ); - if (destBitmapData == NULL) { - return image; - } - - // kCGImageAlphaNone is not supported in CGBitmapContextCreate. - // Since the original image here has no alpha info, use kCGImageAlphaNoneSkipLast - // to create bitmap graphics contexts without alpha info. - destContext = CGBitmapContextCreate(destBitmapData, - destResolution.width, - destResolution.height, - kBitsPerComponent, - bytesPerRow, - colorspaceRef, - kCGBitmapByteOrderDefault|kCGImageAlphaNoneSkipLast); - - if (destContext == NULL) { - free(destBitmapData); - return image; - } - CGContextSetInterpolationQuality(destContext, kCGInterpolationHigh); - - // Now define the size of the rectangle to be used for the - // incremental blits from the input image to the output image. - // we use a source tile width equal to the width of the source - // image due to the way that iOS retrieves image data from disk. - // iOS must decode an image from disk in full width 'bands', even - // if current graphics context is clipped to a subrect within that - // band. Therefore we fully utilize all of the pixel data that results - // from a decoding opertion by achnoring our tile size to the full - // width of the input image. - CGRect sourceTile = CGRectZero; - sourceTile.size.width = sourceResolution.width; - // The source tile height is dynamic. Since we specified the size - // of the source tile in MB, see how many rows of pixels high it - // can be given the input image width. - sourceTile.size.height = (int)(kTileTotalPixels / sourceTile.size.width ); - sourceTile.origin.x = 0.0f; - // The output tile is the same proportions as the input tile, but - // scaled to image scale. - CGRect destTile; - destTile.size.width = destResolution.width; - destTile.size.height = sourceTile.size.height * imageScale; - destTile.origin.x = 0.0f; - // The source seem overlap is proportionate to the destination seem overlap. - // this is the amount of pixels to overlap each tile as we assemble the ouput image. - float sourceSeemOverlap = (int)((kDestSeemOverlap/destResolution.height)*sourceResolution.height); - CGImageRef sourceTileImageRef; - // calculate the number of read/write operations required to assemble the - // output image. - int iterations = (int)( sourceResolution.height / sourceTile.size.height ); - // If tile height doesn't divide the image height evenly, add another iteration - // to account for the remaining pixels. - int remainder = (int)sourceResolution.height % (int)sourceTile.size.height; - if(remainder) { - iterations++; - } - // Add seem overlaps to the tiles, but save the original tile height for y coordinate calculations. - float sourceTileHeightMinusOverlap = sourceTile.size.height; - sourceTile.size.height += sourceSeemOverlap; - destTile.size.height += kDestSeemOverlap; - for( int y = 0; y < iterations; ++y ) { - @autoreleasepool { - sourceTile.origin.y = y * sourceTileHeightMinusOverlap + sourceSeemOverlap; - destTile.origin.y = destResolution.height - (( y + 1 ) * sourceTileHeightMinusOverlap * imageScale + kDestSeemOverlap); - sourceTileImageRef = CGImageCreateWithImageInRect( sourceImageRef, sourceTile ); - if( y == iterations - 1 && remainder ) { - float dify = destTile.size.height; - destTile.size.height = CGImageGetHeight( sourceTileImageRef ) * imageScale; - dify -= destTile.size.height; - destTile.origin.y += dify; - } - CGContextDrawImage( destContext, destTile, sourceTileImageRef ); - CGImageRelease( sourceTileImageRef ); - } - } - - CGImageRef destImageRef = CGBitmapContextCreateImage(destContext); - CGContextRelease(destContext); - if (destImageRef == NULL) { - return image; - } - UIImage *destImage = [UIImage imageWithCGImage:destImageRef scale:image.scale orientation:image.imageOrientation]; - CGImageRelease(destImageRef); - if (destImage == nil) { - return image; - } - return destImage; - } -} - -+ (BOOL)shouldDecodeImage:(nullable UIImage *)image { - // Prevent "CGBitmapContextCreateImage: invalid context 0x0" error - if (image == nil) { - return NO; - } - - // do not decode animated images - if (image.images != nil) { - return NO; - } - - CGImageRef imageRef = image.CGImage; - - CGImageAlphaInfo alpha = CGImageGetAlphaInfo(imageRef); - BOOL anyAlpha = (alpha == kCGImageAlphaFirst || - alpha == kCGImageAlphaLast || - alpha == kCGImageAlphaPremultipliedFirst || - alpha == kCGImageAlphaPremultipliedLast); - // do not decode images with alpha - if (anyAlpha) { - return NO; - } - - return YES; -} - -+ (BOOL)shouldScaleDownImage:(nonnull UIImage *)image { - BOOL shouldScaleDown = YES; - - CGImageRef sourceImageRef = image.CGImage; - CGSize sourceResolution = CGSizeZero; - sourceResolution.width = CGImageGetWidth(sourceImageRef); - sourceResolution.height = CGImageGetHeight(sourceImageRef); - float sourceTotalPixels = sourceResolution.width * sourceResolution.height; - float imageScale = kDestTotalPixels / sourceTotalPixels; - if (imageScale < 1) { - shouldScaleDown = YES; - } else { - shouldScaleDown = NO; - } - - return shouldScaleDown; -} - -+ (CGColorSpaceRef)colorSpaceForImageRef:(CGImageRef)imageRef { - // current - CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(CGImageGetColorSpace(imageRef)); - CGColorSpaceRef colorspaceRef = CGImageGetColorSpace(imageRef); - - BOOL unsupportedColorSpace = (imageColorSpaceModel == kCGColorSpaceModelUnknown || - imageColorSpaceModel == kCGColorSpaceModelMonochrome || - imageColorSpaceModel == kCGColorSpaceModelCMYK || - imageColorSpaceModel == kCGColorSpaceModelIndexed); - if (unsupportedColorSpace) { - colorspaceRef = CGColorSpaceCreateDeviceRGB(); - CFAutorelease(colorspaceRef); - } - return colorspaceRef; -} -#elif SD_MAC -+ (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image { - return image; -} - -+ (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image { - return image; -} -#endif - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageDownloader.h b/Pods/SDWebImage/SDWebImage/SDWebImageDownloader.h deleted file mode 100644 index 94bc76e..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageDownloader.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import -#import "SDWebImageCompat.h" -#import "SDWebImageOperation.h" - -typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) { - SDWebImageDownloaderLowPriority = 1 << 0, - SDWebImageDownloaderProgressiveDownload = 1 << 1, - - /** - * By default, request prevent the use of NSURLCache. With this flag, NSURLCache - * is used with default policies. - */ - SDWebImageDownloaderUseNSURLCache = 1 << 2, - - /** - * Call completion block with nil image/imageData if the image was read from NSURLCache - * (to be combined with `SDWebImageDownloaderUseNSURLCache`). - */ - - SDWebImageDownloaderIgnoreCachedResponse = 1 << 3, - /** - * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for - * extra time in background to let the request finish. If the background task expires the operation will be cancelled. - */ - - SDWebImageDownloaderContinueInBackground = 1 << 4, - - /** - * Handles cookies stored in NSHTTPCookieStore by setting - * NSMutableURLRequest.HTTPShouldHandleCookies = YES; - */ - SDWebImageDownloaderHandleCookies = 1 << 5, - - /** - * Enable to allow untrusted SSL certificates. - * Useful for testing purposes. Use with caution in production. - */ - SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6, - - /** - * Put the image in the high priority queue. - */ - SDWebImageDownloaderHighPriority = 1 << 7, - - /** - * Scale down the image - */ - SDWebImageDownloaderScaleDownLargeImages = 1 << 8, -}; - -typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { - /** - * Default value. All download operations will execute in queue style (first-in-first-out). - */ - SDWebImageDownloaderFIFOExecutionOrder, - - /** - * All download operations will execute in stack style (last-in-first-out). - */ - SDWebImageDownloaderLIFOExecutionOrder -}; - -extern NSString * _Nonnull const SDWebImageDownloadStartNotification; -extern NSString * _Nonnull const SDWebImageDownloadStopNotification; - -typedef void(^SDWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL); - -typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished); - -typedef NSDictionary SDHTTPHeadersDictionary; -typedef NSMutableDictionary SDHTTPHeadersMutableDictionary; - -typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterBlock)(NSURL * _Nullable url, SDHTTPHeadersDictionary * _Nullable headers); - -/** - * A token associated with each download. Can be used to cancel a download - */ -@interface SDWebImageDownloadToken : NSObject - -@property (nonatomic, strong, nullable) NSURL *url; -@property (nonatomic, strong, nullable) id downloadOperationCancelToken; - -@end - - -/** - * Asynchronous downloader dedicated and optimized for image loading. - */ -@interface SDWebImageDownloader : NSObject - -/** - * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. - * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. - */ -@property (assign, nonatomic) BOOL shouldDecompressImages; - -/** - * The maximum number of concurrent downloads - */ -@property (assign, nonatomic) NSInteger maxConcurrentDownloads; - -/** - * Shows the current amount of downloads that still need to be downloaded - */ -@property (readonly, nonatomic) NSUInteger currentDownloadCount; - - -/** - * The timeout value (in seconds) for the download operation. Default: 15.0. - */ -@property (assign, nonatomic) NSTimeInterval downloadTimeout; - - -/** - * Changes download operations execution order. Default value is `SDWebImageDownloaderFIFOExecutionOrder`. - */ -@property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder; - -/** - * Singleton method, returns the shared instance - * - * @return global shared instance of downloader class - */ -+ (nonnull instancetype)sharedDownloader; - -/** - * Set the default URL credential to be set for request operations. - */ -@property (strong, nonatomic, nullable) NSURLCredential *urlCredential; - -/** - * Set username - */ -@property (strong, nonatomic, nullable) NSString *username; - -/** - * Set password - */ -@property (strong, nonatomic, nullable) NSString *password; - -/** - * Set filter to pick headers for downloading image HTTP request. - * - * This block will be invoked for each downloading image request, returned - * NSDictionary will be used as headers in corresponding HTTP request. - */ -@property (nonatomic, copy, nullable) SDWebImageDownloaderHeadersFilterBlock headersFilter; - -/** - * Creates an instance of a downloader with specified session configuration. - * *Note*: `timeoutIntervalForRequest` is going to be overwritten. - * @return new instance of downloader class - */ -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration NS_DESIGNATED_INITIALIZER; - -/** - * Set a value for a HTTP header to be appended to each download HTTP request. - * - * @param value The value for the header field. Use `nil` value to remove the header. - * @param field The name of the header field to set. - */ -- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field; - -/** - * Returns the value of the specified HTTP header field. - * - * @return The value associated with the header field field, or `nil` if there is no corresponding header field. - */ -- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field; - -/** - * Sets a subclass of `SDWebImageDownloaderOperation` as the default - * `NSOperation` to be used each time SDWebImage constructs a request - * operation to download an image. - * - * @param operationClass The subclass of `SDWebImageDownloaderOperation` to set - * as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. - */ -- (void)setOperationClass:(nullable Class)operationClass; - -/** - * Creates a SDWebImageDownloader async downloader instance with a given URL - * - * The delegate will be informed when the image is finish downloaded or an error has happen. - * - * @see SDWebImageDownloaderDelegate - * - * @param url The URL to the image to download - * @param options The options to be used for this download - * @param progressBlock A block called repeatedly while the image is downloading - * @note the progress block is executed on a background queue - * @param completedBlock A block called once the download is completed. - * If the download succeeded, the image parameter is set, in case of error, - * error parameter is set with the error. The last parameter is always YES - * if SDWebImageDownloaderProgressiveDownload isn't use. With the - * SDWebImageDownloaderProgressiveDownload option, this block is called - * repeatedly with the partial image object and the finished argument set to NO - * before to be called a last time with the full image and finished argument - * set to YES. In case of error, the finished argument is always YES. - * - * @return A token (SDWebImageDownloadToken) that can be passed to -cancel: to cancel this operation - */ -- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url - options:(SDWebImageDownloaderOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; - -/** - * Cancels a download that was previously queued using -downloadImageWithURL:options:progress:completed: - * - * @param token The token received from -downloadImageWithURL:options:progress:completed: that should be canceled. - */ -- (void)cancel:(nullable SDWebImageDownloadToken *)token; - -/** - * Sets the download queue suspension state - */ -- (void)setSuspended:(BOOL)suspended; - -/** - * Cancels all download operations in the queue - */ -- (void)cancelAllDownloads; - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageDownloader.m b/Pods/SDWebImage/SDWebImage/SDWebImageDownloader.m deleted file mode 100644 index 189d163..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageDownloader.m +++ /dev/null @@ -1,315 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageDownloader.h" -#import "SDWebImageDownloaderOperation.h" -#import - -@implementation SDWebImageDownloadToken -@end - - -@interface SDWebImageDownloader () - -@property (strong, nonatomic, nonnull) NSOperationQueue *downloadQueue; -@property (weak, nonatomic, nullable) NSOperation *lastAddedOperation; -@property (assign, nonatomic, nullable) Class operationClass; -@property (strong, nonatomic, nonnull) NSMutableDictionary *URLOperations; -@property (strong, nonatomic, nullable) SDHTTPHeadersMutableDictionary *HTTPHeaders; -// This queue is used to serialize the handling of the network responses of all the download operation in a single queue -@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t barrierQueue; - -// The session in which data tasks will run -@property (strong, nonatomic) NSURLSession *session; - -@end - -@implementation SDWebImageDownloader - -+ (void)initialize { - // Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator ) - // To use it, just add #import "SDNetworkActivityIndicator.h" in addition to the SDWebImage import - if (NSClassFromString(@"SDNetworkActivityIndicator")) { - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - id activityIndicator = [NSClassFromString(@"SDNetworkActivityIndicator") performSelector:NSSelectorFromString(@"sharedActivityIndicator")]; -#pragma clang diagnostic pop - - // Remove observer in case it was previously added. - [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStartNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStopNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:activityIndicator - selector:NSSelectorFromString(@"startActivity") - name:SDWebImageDownloadStartNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:activityIndicator - selector:NSSelectorFromString(@"stopActivity") - name:SDWebImageDownloadStopNotification object:nil]; - } -} - -+ (nonnull instancetype)sharedDownloader { - static dispatch_once_t once; - static id instance; - dispatch_once(&once, ^{ - instance = [self new]; - }); - return instance; -} - -- (nonnull instancetype)init { - return [self initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; -} - -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration { - if ((self = [super init])) { - _operationClass = [SDWebImageDownloaderOperation class]; - _shouldDecompressImages = YES; - _executionOrder = SDWebImageDownloaderFIFOExecutionOrder; - _downloadQueue = [NSOperationQueue new]; - _downloadQueue.maxConcurrentOperationCount = 6; - _downloadQueue.name = @"com.hackemist.SDWebImageDownloader"; - _URLOperations = [NSMutableDictionary new]; -#ifdef SD_WEBP - _HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy]; -#else - _HTTPHeaders = [@{@"Accept": @"image/*;q=0.8"} mutableCopy]; -#endif - _barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT); - _downloadTimeout = 15.0; - - sessionConfiguration.timeoutIntervalForRequest = _downloadTimeout; - - /** - * Create the session for this task - * We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate - * method calls and completion handler calls. - */ - self.session = [NSURLSession sessionWithConfiguration:sessionConfiguration - delegate:self - delegateQueue:nil]; - } - return self; -} - -- (void)dealloc { - [self.session invalidateAndCancel]; - self.session = nil; - - [self.downloadQueue cancelAllOperations]; - SDDispatchQueueRelease(_barrierQueue); -} - -- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field { - if (value) { - self.HTTPHeaders[field] = value; - } - else { - [self.HTTPHeaders removeObjectForKey:field]; - } -} - -- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field { - return self.HTTPHeaders[field]; -} - -- (void)setMaxConcurrentDownloads:(NSInteger)maxConcurrentDownloads { - _downloadQueue.maxConcurrentOperationCount = maxConcurrentDownloads; -} - -- (NSUInteger)currentDownloadCount { - return _downloadQueue.operationCount; -} - -- (NSInteger)maxConcurrentDownloads { - return _downloadQueue.maxConcurrentOperationCount; -} - -- (void)setOperationClass:(nullable Class)operationClass { - if (operationClass && [operationClass isSubclassOfClass:[NSOperation class]] && [operationClass conformsToProtocol:@protocol(SDWebImageDownloaderOperationInterface)]) { - _operationClass = operationClass; - } else { - _operationClass = [SDWebImageDownloaderOperation class]; - } -} - -- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url - options:(SDWebImageDownloaderOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { - __weak SDWebImageDownloader *wself = self; - - return [self addProgressCallback:progressBlock completedBlock:completedBlock forURL:url createCallback:^SDWebImageDownloaderOperation *{ - __strong __typeof (wself) sself = wself; - NSTimeInterval timeoutInterval = sself.downloadTimeout; - if (timeoutInterval == 0.0) { - timeoutInterval = 15.0; - } - - // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise - NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:(options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData) timeoutInterval:timeoutInterval]; - request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies); - request.HTTPShouldUsePipelining = YES; - if (sself.headersFilter) { - request.allHTTPHeaderFields = sself.headersFilter(url, [sself.HTTPHeaders copy]); - } - else { - request.allHTTPHeaderFields = sself.HTTPHeaders; - } - SDWebImageDownloaderOperation *operation = [[sself.operationClass alloc] initWithRequest:request inSession:sself.session options:options]; - operation.shouldDecompressImages = sself.shouldDecompressImages; - - if (sself.urlCredential) { - operation.credential = sself.urlCredential; - } else if (sself.username && sself.password) { - operation.credential = [NSURLCredential credentialWithUser:sself.username password:sself.password persistence:NSURLCredentialPersistenceForSession]; - } - - if (options & SDWebImageDownloaderHighPriority) { - operation.queuePriority = NSOperationQueuePriorityHigh; - } else if (options & SDWebImageDownloaderLowPriority) { - operation.queuePriority = NSOperationQueuePriorityLow; - } - - [sself.downloadQueue addOperation:operation]; - if (sself.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) { - // Emulate LIFO execution order by systematically adding new operations as last operation's dependency - [sself.lastAddedOperation addDependency:operation]; - sself.lastAddedOperation = operation; - } - - return operation; - }]; -} - -- (void)cancel:(nullable SDWebImageDownloadToken *)token { - dispatch_barrier_async(self.barrierQueue, ^{ - SDWebImageDownloaderOperation *operation = self.URLOperations[token.url]; - BOOL canceled = [operation cancel:token.downloadOperationCancelToken]; - if (canceled) { - [self.URLOperations removeObjectForKey:token.url]; - } - }); -} - -- (nullable SDWebImageDownloadToken *)addProgressCallback:(SDWebImageDownloaderProgressBlock)progressBlock - completedBlock:(SDWebImageDownloaderCompletedBlock)completedBlock - forURL:(nullable NSURL *)url - createCallback:(SDWebImageDownloaderOperation *(^)())createCallback { - // The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data. - if (url == nil) { - if (completedBlock != nil) { - completedBlock(nil, nil, nil, NO); - } - return nil; - } - - __block SDWebImageDownloadToken *token = nil; - - dispatch_barrier_sync(self.barrierQueue, ^{ - SDWebImageDownloaderOperation *operation = self.URLOperations[url]; - if (!operation) { - operation = createCallback(); - self.URLOperations[url] = operation; - - __weak SDWebImageDownloaderOperation *woperation = operation; - operation.completionBlock = ^{ - SDWebImageDownloaderOperation *soperation = woperation; - if (!soperation) return; - if (self.URLOperations[url] == soperation) { - [self.URLOperations removeObjectForKey:url]; - }; - }; - } - id downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; - - token = [SDWebImageDownloadToken new]; - token.url = url; - token.downloadOperationCancelToken = downloadOperationCancelToken; - }); - - return token; -} - -- (void)setSuspended:(BOOL)suspended { - (self.downloadQueue).suspended = suspended; -} - -- (void)cancelAllDownloads { - [self.downloadQueue cancelAllOperations]; -} - -#pragma mark Helper methods - -- (SDWebImageDownloaderOperation *)operationWithTask:(NSURLSessionTask *)task { - SDWebImageDownloaderOperation *returnOperation = nil; - for (SDWebImageDownloaderOperation *operation in self.downloadQueue.operations) { - if (operation.dataTask.taskIdentifier == task.taskIdentifier) { - returnOperation = operation; - break; - } - } - return returnOperation; -} - -#pragma mark NSURLSessionDataDelegate - -- (void)URLSession:(NSURLSession *)session - dataTask:(NSURLSessionDataTask *)dataTask -didReceiveResponse:(NSURLResponse *)response - completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { - - // Identify the operation that runs this task and pass it the delegate method - SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask]; - - [dataOperation URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler]; -} - -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { - - // Identify the operation that runs this task and pass it the delegate method - SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask]; - - [dataOperation URLSession:session dataTask:dataTask didReceiveData:data]; -} - -- (void)URLSession:(NSURLSession *)session - dataTask:(NSURLSessionDataTask *)dataTask - willCacheResponse:(NSCachedURLResponse *)proposedResponse - completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { - - // Identify the operation that runs this task and pass it the delegate method - SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask]; - - [dataOperation URLSession:session dataTask:dataTask willCacheResponse:proposedResponse completionHandler:completionHandler]; -} - -#pragma mark NSURLSessionTaskDelegate - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { - // Identify the operation that runs this task and pass it the delegate method - SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:task]; - - [dataOperation URLSession:session task:task didCompleteWithError:error]; -} - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler { - - completionHandler(request); -} - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { - - // Identify the operation that runs this task and pass it the delegate method - SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:task]; - - [dataOperation URLSession:session task:task didReceiveChallenge:challenge completionHandler:completionHandler]; -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h b/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h deleted file mode 100644 index b190855..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import -#import "SDWebImageDownloader.h" -#import "SDWebImageOperation.h" - -extern NSString * _Nonnull const SDWebImageDownloadStartNotification; -extern NSString * _Nonnull const SDWebImageDownloadReceiveResponseNotification; -extern NSString * _Nonnull const SDWebImageDownloadStopNotification; -extern NSString * _Nonnull const SDWebImageDownloadFinishNotification; - - - -/** - Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol - */ -@protocol SDWebImageDownloaderOperationInterface - -- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request - inSession:(nullable NSURLSession *)session - options:(SDWebImageDownloaderOptions)options; - -- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; - -- (BOOL)shouldDecompressImages; -- (void)setShouldDecompressImages:(BOOL)value; - -- (nullable NSURLCredential *)credential; -- (void)setCredential:(nullable NSURLCredential *)value; - -@end - - -@interface SDWebImageDownloaderOperation : NSOperation - -/** - * The request used by the operation's task. - */ -@property (strong, nonatomic, readonly, nullable) NSURLRequest *request; - -/** - * The operation's task - */ -@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; - - -@property (assign, nonatomic) BOOL shouldDecompressImages; - -/** - * Was used to determine whether the URL connection should consult the credential storage for authenticating the connection. - * @deprecated Not used for a couple of versions - */ -@property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility"); - -/** - * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. - * - * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. - */ -@property (nonatomic, strong, nullable) NSURLCredential *credential; - -/** - * The SDWebImageDownloaderOptions for the receiver. - */ -@property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; - -/** - * The expected size of data. - */ -@property (assign, nonatomic) NSInteger expectedSize; - -/** - * The response returned by the operation's connection. - */ -@property (strong, nonatomic, nullable) NSURLResponse *response; - -/** - * Initializes a `SDWebImageDownloaderOperation` object - * - * @see SDWebImageDownloaderOperation - * - * @param request the URL request - * @param session the URL session in which this operation will run - * @param options downloader options - * - * @return the initialized instance - */ -- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request - inSession:(nullable NSURLSession *)session - options:(SDWebImageDownloaderOptions)options NS_DESIGNATED_INITIALIZER; - -/** - * Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of - * callbacks. - * - * @param progressBlock the block executed when a new chunk of data arrives. - * @note the progress block is executed on a background queue - * @param completedBlock the block executed when the download is done. - * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue - * - * @return the token to use to cancel this set of handlers - */ -- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; - -/** - * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. - * - * @param token the token representing a set of callbacks to cancel - * - * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. - */ -- (BOOL)cancel:(nullable id)token; - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.m b/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.m deleted file mode 100644 index 63df1af..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.m +++ /dev/null @@ -1,540 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageDownloaderOperation.h" -#import "SDWebImageDecoder.h" -#import "UIImage+MultiFormat.h" -#import -#import "SDWebImageManager.h" -#import "NSImage+WebCache.h" - -NSString *const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification"; -NSString *const SDWebImageDownloadReceiveResponseNotification = @"SDWebImageDownloadReceiveResponseNotification"; -NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNotification"; -NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinishNotification"; - -static NSString *const kProgressCallbackKey = @"progress"; -static NSString *const kCompletedCallbackKey = @"completed"; - -typedef NSMutableDictionary SDCallbacksDictionary; - -@interface SDWebImageDownloaderOperation () - -@property (strong, nonatomic, nonnull) NSMutableArray *callbackBlocks; - -@property (assign, nonatomic, getter = isExecuting) BOOL executing; -@property (assign, nonatomic, getter = isFinished) BOOL finished; -@property (strong, nonatomic, nullable) NSMutableData *imageData; - -// This is weak because it is injected by whoever manages this session. If this gets nil-ed out, we won't be able to run -// the task associated with this operation -@property (weak, nonatomic, nullable) NSURLSession *unownedSession; -// This is set if we're using not using an injected NSURLSession. We're responsible of invalidating this one -@property (strong, nonatomic, nullable) NSURLSession *ownedSession; - -@property (strong, nonatomic, readwrite, nullable) NSURLSessionTask *dataTask; - -@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t barrierQueue; - -#if SD_UIKIT -@property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId; -#endif - -@end - -@implementation SDWebImageDownloaderOperation { - size_t width, height; -#if SD_UIKIT || SD_WATCH - UIImageOrientation orientation; -#endif - BOOL responseFromCached; -} - -@synthesize executing = _executing; -@synthesize finished = _finished; - -- (nonnull instancetype)init { - return [self initWithRequest:nil inSession:nil options:0]; -} - -- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request - inSession:(nullable NSURLSession *)session - options:(SDWebImageDownloaderOptions)options { - if ((self = [super init])) { - _request = [request copy]; - _shouldDecompressImages = YES; - _options = options; - _callbackBlocks = [NSMutableArray new]; - _executing = NO; - _finished = NO; - _expectedSize = 0; - _unownedSession = session; - responseFromCached = YES; // Initially wrong until `- URLSession:dataTask:willCacheResponse:completionHandler: is called or not called - _barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderOperationBarrierQueue", DISPATCH_QUEUE_CONCURRENT); - } - return self; -} - -- (void)dealloc { - SDDispatchQueueRelease(_barrierQueue); -} - -- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { - SDCallbacksDictionary *callbacks = [NSMutableDictionary new]; - if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy]; - if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy]; - dispatch_barrier_async(self.barrierQueue, ^{ - [self.callbackBlocks addObject:callbacks]; - }); - return callbacks; -} - -- (nullable NSArray *)callbacksForKey:(NSString *)key { - __block NSMutableArray *callbacks = nil; - dispatch_sync(self.barrierQueue, ^{ - // We need to remove [NSNull null] because there might not always be a progress block for each callback - callbacks = [[self.callbackBlocks valueForKey:key] mutableCopy]; - [callbacks removeObjectIdenticalTo:[NSNull null]]; - }); - return [callbacks copy]; // strip mutability here -} - -- (BOOL)cancel:(nullable id)token { - __block BOOL shouldCancel = NO; - dispatch_barrier_sync(self.barrierQueue, ^{ - [self.callbackBlocks removeObjectIdenticalTo:token]; - if (self.callbackBlocks.count == 0) { - shouldCancel = YES; - } - }); - if (shouldCancel) { - [self cancel]; - } - return shouldCancel; -} - -- (void)start { - @synchronized (self) { - if (self.isCancelled) { - self.finished = YES; - [self reset]; - return; - } - -#if SD_UIKIT - Class UIApplicationClass = NSClassFromString(@"UIApplication"); - BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)]; - if (hasApplication && [self shouldContinueWhenAppEntersBackground]) { - __weak __typeof__ (self) wself = self; - UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)]; - self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{ - __strong __typeof (wself) sself = wself; - - if (sself) { - [sself cancel]; - - [app endBackgroundTask:sself.backgroundTaskId]; - sself.backgroundTaskId = UIBackgroundTaskInvalid; - } - }]; - } -#endif - NSURLSession *session = self.unownedSession; - if (!self.unownedSession) { - NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; - sessionConfig.timeoutIntervalForRequest = 15; - - /** - * Create the session for this task - * We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate - * method calls and completion handler calls. - */ - self.ownedSession = [NSURLSession sessionWithConfiguration:sessionConfig - delegate:self - delegateQueue:nil]; - session = self.ownedSession; - } - - self.dataTask = [session dataTaskWithRequest:self.request]; - self.executing = YES; - } - - [self.dataTask resume]; - - if (self.dataTask) { - for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { - progressBlock(0, NSURLResponseUnknownLength, self.request.URL); - } - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:self]; - }); - } else { - [self callCompletionBlocksWithError:[NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Connection can't be initialized"}]]; - } - -#if SD_UIKIT - Class UIApplicationClass = NSClassFromString(@"UIApplication"); - if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { - return; - } - if (self.backgroundTaskId != UIBackgroundTaskInvalid) { - UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)]; - [app endBackgroundTask:self.backgroundTaskId]; - self.backgroundTaskId = UIBackgroundTaskInvalid; - } -#endif -} - -- (void)cancel { - @synchronized (self) { - [self cancelInternal]; - } -} - -- (void)cancelInternal { - if (self.isFinished) return; - [super cancel]; - - if (self.dataTask) { - [self.dataTask cancel]; - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self]; - }); - - // As we cancelled the connection, its callback won't be called and thus won't - // maintain the isFinished and isExecuting flags. - if (self.isExecuting) self.executing = NO; - if (!self.isFinished) self.finished = YES; - } - - [self reset]; -} - -- (void)done { - self.finished = YES; - self.executing = NO; - [self reset]; -} - -- (void)reset { - dispatch_barrier_async(self.barrierQueue, ^{ - [self.callbackBlocks removeAllObjects]; - }); - self.dataTask = nil; - self.imageData = nil; - if (self.ownedSession) { - [self.ownedSession invalidateAndCancel]; - self.ownedSession = nil; - } -} - -- (void)setFinished:(BOOL)finished { - [self willChangeValueForKey:@"isFinished"]; - _finished = finished; - [self didChangeValueForKey:@"isFinished"]; -} - -- (void)setExecuting:(BOOL)executing { - [self willChangeValueForKey:@"isExecuting"]; - _executing = executing; - [self didChangeValueForKey:@"isExecuting"]; -} - -- (BOOL)isConcurrent { - return YES; -} - -#pragma mark NSURLSessionDataDelegate - -- (void)URLSession:(NSURLSession *)session - dataTask:(NSURLSessionDataTask *)dataTask -didReceiveResponse:(NSURLResponse *)response - completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { - - //'304 Not Modified' is an exceptional one - if (![response respondsToSelector:@selector(statusCode)] || (((NSHTTPURLResponse *)response).statusCode < 400 && ((NSHTTPURLResponse *)response).statusCode != 304)) { - NSInteger expected = response.expectedContentLength > 0 ? (NSInteger)response.expectedContentLength : 0; - self.expectedSize = expected; - for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { - progressBlock(0, expected, self.request.URL); - } - - self.imageData = [[NSMutableData alloc] initWithCapacity:expected]; - self.response = response; - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:self]; - }); - } - else { - NSUInteger code = ((NSHTTPURLResponse *)response).statusCode; - - //This is the case when server returns '304 Not Modified'. It means that remote image is not changed. - //In case of 304 we need just cancel the operation and return cached image from the cache. - if (code == 304) { - [self cancelInternal]; - } else { - [self.dataTask cancel]; - } - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self]; - }); - - [self callCompletionBlocksWithError:[NSError errorWithDomain:NSURLErrorDomain code:((NSHTTPURLResponse *)response).statusCode userInfo:nil]]; - - [self done]; - } - - if (completionHandler) { - completionHandler(NSURLSessionResponseAllow); - } -} - -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { - [self.imageData appendData:data]; - - if ((self.options & SDWebImageDownloaderProgressiveDownload) && self.expectedSize > 0) { - // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ - // Thanks to the author @Nyx0uf - - // Get the total bytes downloaded - const NSInteger totalSize = self.imageData.length; - - // Update the data source, we must pass ALL the data, not just the new bytes - CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)self.imageData, NULL); - - if (width + height == 0) { - CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); - if (properties) { - NSInteger orientationValue = -1; - CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight); - if (val) CFNumberGetValue(val, kCFNumberLongType, &height); - val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth); - if (val) CFNumberGetValue(val, kCFNumberLongType, &width); - val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); - if (val) CFNumberGetValue(val, kCFNumberNSIntegerType, &orientationValue); - CFRelease(properties); - - // When we draw to Core Graphics, we lose orientation information, - // which means the image below born of initWithCGIImage will be - // oriented incorrectly sometimes. (Unlike the image born of initWithData - // in didCompleteWithError.) So save it here and pass it on later. -#if SD_UIKIT || SD_WATCH - orientation = [[self class] orientationFromPropertyValue:(orientationValue == -1 ? 1 : orientationValue)]; -#endif - } - } - - if (width + height > 0 && totalSize < self.expectedSize) { - // Create the image - CGImageRef partialImageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); - -#if SD_UIKIT || SD_WATCH - // Workaround for iOS anamorphic image - if (partialImageRef) { - const size_t partialHeight = CGImageGetHeight(partialImageRef); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef bmContext = CGBitmapContextCreate(NULL, width, height, 8, width * 4, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst); - CGColorSpaceRelease(colorSpace); - if (bmContext) { - CGContextDrawImage(bmContext, (CGRect){.origin.x = 0.0f, .origin.y = 0.0f, .size.width = width, .size.height = partialHeight}, partialImageRef); - CGImageRelease(partialImageRef); - partialImageRef = CGBitmapContextCreateImage(bmContext); - CGContextRelease(bmContext); - } - else { - CGImageRelease(partialImageRef); - partialImageRef = nil; - } - } -#endif - - if (partialImageRef) { -#if SD_UIKIT || SD_WATCH - UIImage *image = [UIImage imageWithCGImage:partialImageRef scale:1 orientation:orientation]; -#elif SD_MAC - UIImage *image = [[UIImage alloc] initWithCGImage:partialImageRef size:NSZeroSize]; -#endif - NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL]; - UIImage *scaledImage = [self scaledImageForKey:key image:image]; - if (self.shouldDecompressImages) { - image = [UIImage decodedImageWithImage:scaledImage]; - } - else { - image = scaledImage; - } - CGImageRelease(partialImageRef); - - [self callCompletionBlocksWithImage:image imageData:nil error:nil finished:NO]; - } - } - - CFRelease(imageSource); - } - - for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { - progressBlock(self.imageData.length, self.expectedSize, self.request.URL); - } -} - -- (void)URLSession:(NSURLSession *)session - dataTask:(NSURLSessionDataTask *)dataTask - willCacheResponse:(NSCachedURLResponse *)proposedResponse - completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { - - responseFromCached = NO; // If this method is called, it means the response wasn't read from cache - NSCachedURLResponse *cachedResponse = proposedResponse; - - if (self.request.cachePolicy == NSURLRequestReloadIgnoringLocalCacheData) { - // Prevents caching of responses - cachedResponse = nil; - } - if (completionHandler) { - completionHandler(cachedResponse); - } -} - -#pragma mark NSURLSessionTaskDelegate - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { - @synchronized(self) { - self.dataTask = nil; - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:self]; - if (!error) { - [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:self]; - } - }); - } - - if (error) { - [self callCompletionBlocksWithError:error]; - } else { - if ([self callbacksForKey:kCompletedCallbackKey].count > 0) { - /** - * See #1608 and #1623 - apparently, there is a race condition on `NSURLCache` that causes a crash - * Limited the calls to `cachedResponseForRequest:` only for cases where we should ignore the cached response - * and images for which responseFromCached is YES (only the ones that cannot be cached). - * Note: responseFromCached is set to NO inside `willCacheResponse:`. This method doesn't get called for large images or images behind authentication - */ - if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached && [[NSURLCache sharedURLCache] cachedResponseForRequest:self.request]) { - // hack - [self callCompletionBlocksWithImage:nil imageData:nil error:nil finished:YES]; - } else if (self.imageData) { - UIImage *image = [UIImage sd_imageWithData:self.imageData]; - NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL]; - image = [self scaledImageForKey:key image:image]; - - // Do not force decoding animated GIFs - if (!image.images) { - if (self.shouldDecompressImages) { - if (self.options & SDWebImageDownloaderScaleDownLargeImages) { -#if SD_UIKIT || SD_WATCH - image = [UIImage decodedAndScaledDownImageWithImage:image]; - [self.imageData setData:UIImagePNGRepresentation(image)]; -#endif - } else { - image = [UIImage decodedImageWithImage:image]; - } - } - } - if (CGSizeEqualToSize(image.size, CGSizeZero)) { - [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}]]; - } else { - [self callCompletionBlocksWithImage:image imageData:self.imageData error:nil finished:YES]; - } - } else { - [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}]]; - } - } - } - [self done]; -} - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { - - NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; - __block NSURLCredential *credential = nil; - - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - if (!(self.options & SDWebImageDownloaderAllowInvalidSSLCertificates)) { - disposition = NSURLSessionAuthChallengePerformDefaultHandling; - } else { - credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; - disposition = NSURLSessionAuthChallengeUseCredential; - } - } else { - if (challenge.previousFailureCount == 0) { - if (self.credential) { - credential = self.credential; - disposition = NSURLSessionAuthChallengeUseCredential; - } else { - disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; - } - } else { - disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; - } - } - - if (completionHandler) { - completionHandler(disposition, credential); - } -} - -#pragma mark Helper methods - -#if SD_UIKIT || SD_WATCH -+ (UIImageOrientation)orientationFromPropertyValue:(NSInteger)value { - switch (value) { - case 1: - return UIImageOrientationUp; - case 3: - return UIImageOrientationDown; - case 8: - return UIImageOrientationLeft; - case 6: - return UIImageOrientationRight; - case 2: - return UIImageOrientationUpMirrored; - case 4: - return UIImageOrientationDownMirrored; - case 5: - return UIImageOrientationLeftMirrored; - case 7: - return UIImageOrientationRightMirrored; - default: - return UIImageOrientationUp; - } -} -#endif - -- (nullable UIImage *)scaledImageForKey:(nullable NSString *)key image:(nullable UIImage *)image { - return SDScaledImageForKey(key, image); -} - -- (BOOL)shouldContinueWhenAppEntersBackground { - return self.options & SDWebImageDownloaderContinueInBackground; -} - -- (void)callCompletionBlocksWithError:(nullable NSError *)error { - [self callCompletionBlocksWithImage:nil imageData:nil error:error finished:YES]; -} - -- (void)callCompletionBlocksWithImage:(nullable UIImage *)image - imageData:(nullable NSData *)imageData - error:(nullable NSError *)error - finished:(BOOL)finished { - NSArray *completionBlocks = [self callbacksForKey:kCompletedCallbackKey]; - dispatch_main_async_safe(^{ - for (SDWebImageDownloaderCompletedBlock completedBlock in completionBlocks) { - completedBlock(image, imageData, error, finished); - } - }); -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageManager.h b/Pods/SDWebImage/SDWebImage/SDWebImageManager.h deleted file mode 100644 index ba8b755..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageManager.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageCompat.h" -#import "SDWebImageOperation.h" -#import "SDWebImageDownloader.h" -#import "SDImageCache.h" - -typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { - /** - * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. - * This flag disable this blacklisting. - */ - SDWebImageRetryFailed = 1 << 0, - - /** - * By default, image downloads are started during UI interactions, this flags disable this feature, - * leading to delayed download on UIScrollView deceleration for instance. - */ - SDWebImageLowPriority = 1 << 1, - - /** - * This flag disables on-disk caching - */ - SDWebImageCacheMemoryOnly = 1 << 2, - - /** - * This flag enables progressive download, the image is displayed progressively during download as a browser would do. - * By default, the image is only displayed once completely downloaded. - */ - SDWebImageProgressiveDownload = 1 << 3, - - /** - * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed. - * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation. - * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics. - * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image. - * - * Use this flag only if you can't make your URLs static with embedded cache busting parameter. - */ - SDWebImageRefreshCached = 1 << 4, - - /** - * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for - * extra time in background to let the request finish. If the background task expires the operation will be cancelled. - */ - SDWebImageContinueInBackground = 1 << 5, - - /** - * Handles cookies stored in NSHTTPCookieStore by setting - * NSMutableURLRequest.HTTPShouldHandleCookies = YES; - */ - SDWebImageHandleCookies = 1 << 6, - - /** - * Enable to allow untrusted SSL certificates. - * Useful for testing purposes. Use with caution in production. - */ - SDWebImageAllowInvalidSSLCertificates = 1 << 7, - - /** - * By default, images are loaded in the order in which they were queued. This flag moves them to - * the front of the queue. - */ - SDWebImageHighPriority = 1 << 8, - - /** - * By default, placeholder images are loaded while the image is loading. This flag will delay the loading - * of the placeholder image until after the image has finished loading. - */ - SDWebImageDelayPlaceholder = 1 << 9, - - /** - * We usually don't call transformDownloadedImage delegate method on animated images, - * as most transformation code would mangle it. - * Use this flag to transform them anyway. - */ - SDWebImageTransformAnimatedImage = 1 << 10, - - /** - * By default, image is added to the imageView after download. But in some cases, we want to - * have the hand before setting the image (apply a filter or add it with cross-fade animation for instance) - * Use this flag if you want to manually set the image in the completion when success - */ - SDWebImageAvoidAutoSetImage = 1 << 11, - - /** - * By default, images are decoded respecting their original size. On iOS, this flag will scale down the - * images to a size compatible with the constrained memory of devices. - * If `SDWebImageProgressiveDownload` flag is set the scale down is deactivated. - */ - SDWebImageScaleDownLargeImages = 1 << 12 -}; - -typedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL); - -typedef void(^SDInternalCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL); - -typedef NSString * _Nullable (^SDWebImageCacheKeyFilterBlock)(NSURL * _Nullable url); - - -@class SDWebImageManager; - -@protocol SDWebImageManagerDelegate - -@optional - -/** - * Controls which image should be downloaded when the image is not found in the cache. - * - * @param imageManager The current `SDWebImageManager` - * @param imageURL The url of the image to be downloaded - * - * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied. - */ -- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldDownloadImageForURL:(nullable NSURL *)imageURL; - -/** - * Allows to transform the image immediately after it has been downloaded and just before to cache it on disk and memory. - * NOTE: This method is called from a global queue in order to not to block the main thread. - * - * @param imageManager The current `SDWebImageManager` - * @param image The image to transform - * @param imageURL The url of the image to transform - * - * @return The transformed image object. - */ -- (nullable UIImage *)imageManager:(nonnull SDWebImageManager *)imageManager transformDownloadedImage:(nullable UIImage *)image withURL:(nullable NSURL *)imageURL; - -@end - -/** - * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes. - * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache). - * You can use this class directly to benefit from web image downloading with caching in another context than - * a UIView. - * - * Here is a simple example of how to use SDWebImageManager: - * - * @code - -SDWebImageManager *manager = [SDWebImageManager sharedManager]; -[manager loadImageWithURL:imageURL - options:0 - progress:nil - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - if (image) { - // do something with image - } - }]; - - * @endcode - */ -@interface SDWebImageManager : NSObject - -@property (weak, nonatomic, nullable) id delegate; - -@property (strong, nonatomic, readonly, nullable) SDImageCache *imageCache; -@property (strong, nonatomic, readonly, nullable) SDWebImageDownloader *imageDownloader; - -/** - * The cache filter is a block used each time SDWebImageManager need to convert an URL into a cache key. This can - * be used to remove dynamic part of an image URL. - * - * The following example sets a filter in the application delegate that will remove any query-string from the - * URL before to use it as a cache key: - * - * @code - -[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) { - url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; - return [url absoluteString]; -}]; - - * @endcode - */ -@property (nonatomic, copy, nullable) SDWebImageCacheKeyFilterBlock cacheKeyFilter; - -/** - * Returns global SDWebImageManager instance. - * - * @return SDWebImageManager shared instance - */ -+ (nonnull instancetype)sharedManager; - -/** - * Allows to specify instance of cache and image downloader used with image manager. - * @return new instance of `SDWebImageManager` with specified cache and downloader. - */ -- (nonnull instancetype)initWithCache:(nonnull SDImageCache *)cache downloader:(nonnull SDWebImageDownloader *)downloader NS_DESIGNATED_INITIALIZER; - -/** - * Downloads the image at the given URL if not present in cache or return the cached version otherwise. - * - * @param url The URL to the image - * @param options A mask to specify options to use for this request - * @param progressBlock A block called while image is downloading - * @note the progress block is executed on a background queue - * @param completedBlock A block called when operation has been completed. - * - * This parameter is required. - * - * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. - * In case of error the image parameter is nil and the third parameter may contain an NSError. - * - * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache - * or from the memory cache or from the network. - * - * The fith parameter is set to NO when the SDWebImageProgressiveDownload option is used and the image is - * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the - * block is called a last time with the full image and the last parameter set to YES. - * - * The last parameter is the original image URL - * - * @return Returns an NSObject conforming to SDWebImageOperation. Should be an instance of SDWebImageDownloaderOperation - */ -- (nullable id )loadImageWithURL:(nullable NSURL *)url - options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDInternalCompletionBlock)completedBlock; - -/** - * Saves image to cache for given URL - * - * @param image The image to cache - * @param url The URL to the image - * - */ - -- (void)saveImageToCache:(nullable UIImage *)image forURL:(nullable NSURL *)url; - -/** - * Cancel all current operations - */ -- (void)cancelAll; - -/** - * Check one or more operations running - */ -- (BOOL)isRunning; - -/** - * Async check if image has already been cached - * - * @param url image url - * @param completionBlock the block to be executed when the check is finished - * - * @note the completion block is always executed on the main queue - */ -- (void)cachedImageExistsForURL:(nullable NSURL *)url - completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; - -/** - * Async check if image has already been cached on disk only - * - * @param url image url - * @param completionBlock the block to be executed when the check is finished - * - * @note the completion block is always executed on the main queue - */ -- (void)diskImageExistsForURL:(nullable NSURL *)url - completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; - - -/** - *Return the cache key for a given URL - */ -- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url; - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImageManager.m b/Pods/SDWebImage/SDWebImage/SDWebImageManager.m deleted file mode 100644 index d7d6865..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImageManager.m +++ /dev/null @@ -1,336 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageManager.h" -#import -#import "NSImage+WebCache.h" - -@interface SDWebImageCombinedOperation : NSObject - -@property (assign, nonatomic, getter = isCancelled) BOOL cancelled; -@property (copy, nonatomic, nullable) SDWebImageNoParamsBlock cancelBlock; -@property (strong, nonatomic, nullable) NSOperation *cacheOperation; - -@end - -@interface SDWebImageManager () - -@property (strong, nonatomic, readwrite, nonnull) SDImageCache *imageCache; -@property (strong, nonatomic, readwrite, nonnull) SDWebImageDownloader *imageDownloader; -@property (strong, nonatomic, nonnull) NSMutableSet *failedURLs; -@property (strong, nonatomic, nonnull) NSMutableArray *runningOperations; - -@end - -@implementation SDWebImageManager - -+ (nonnull instancetype)sharedManager { - static dispatch_once_t once; - static id instance; - dispatch_once(&once, ^{ - instance = [self new]; - }); - return instance; -} - -- (nonnull instancetype)init { - SDImageCache *cache = [SDImageCache sharedImageCache]; - SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader]; - return [self initWithCache:cache downloader:downloader]; -} - -- (nonnull instancetype)initWithCache:(nonnull SDImageCache *)cache downloader:(nonnull SDWebImageDownloader *)downloader { - if ((self = [super init])) { - _imageCache = cache; - _imageDownloader = downloader; - _failedURLs = [NSMutableSet new]; - _runningOperations = [NSMutableArray new]; - } - return self; -} - -- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url { - if (!url) { - return @""; - } - - if (self.cacheKeyFilter) { - return self.cacheKeyFilter(url); - } else { - return url.absoluteString; - } -} - -- (void)cachedImageExistsForURL:(nullable NSURL *)url - completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock { - NSString *key = [self cacheKeyForURL:url]; - - BOOL isInMemoryCache = ([self.imageCache imageFromMemoryCacheForKey:key] != nil); - - if (isInMemoryCache) { - // making sure we call the completion block on the main queue - dispatch_async(dispatch_get_main_queue(), ^{ - if (completionBlock) { - completionBlock(YES); - } - }); - return; - } - - [self.imageCache diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) { - // the completion block of checkDiskCacheForImageWithKey:completion: is always called on the main queue, no need to further dispatch - if (completionBlock) { - completionBlock(isInDiskCache); - } - }]; -} - -- (void)diskImageExistsForURL:(nullable NSURL *)url - completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock { - NSString *key = [self cacheKeyForURL:url]; - - [self.imageCache diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) { - // the completion block of checkDiskCacheForImageWithKey:completion: is always called on the main queue, no need to further dispatch - if (completionBlock) { - completionBlock(isInDiskCache); - } - }]; -} - -- (id )loadImageWithURL:(nullable NSURL *)url - options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDInternalCompletionBlock)completedBlock { - // Invoking this method without a completedBlock is pointless - NSAssert(completedBlock != nil, @"If you mean to prefetch the image, use -[SDWebImagePrefetcher prefetchURLs] instead"); - - // Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, Xcode won't - // throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString. - if ([url isKindOfClass:NSString.class]) { - url = [NSURL URLWithString:(NSString *)url]; - } - - // Prevents app crashing on argument type error like sending NSNull instead of NSURL - if (![url isKindOfClass:NSURL.class]) { - url = nil; - } - - __block SDWebImageCombinedOperation *operation = [SDWebImageCombinedOperation new]; - __weak SDWebImageCombinedOperation *weakOperation = operation; - - BOOL isFailedUrl = NO; - if (url) { - @synchronized (self.failedURLs) { - isFailedUrl = [self.failedURLs containsObject:url]; - } - } - - if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) { - [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil] url:url]; - return operation; - } - - @synchronized (self.runningOperations) { - [self.runningOperations addObject:operation]; - } - NSString *key = [self cacheKeyForURL:url]; - - operation.cacheOperation = [self.imageCache queryCacheOperationForKey:key done:^(UIImage *cachedImage, NSData *cachedData, SDImageCacheType cacheType) { - if (operation.isCancelled) { - [self safelyRemoveOperationFromRunning:operation]; - return; - } - - if ((!cachedImage || options & SDWebImageRefreshCached) && (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url])) { - if (cachedImage && options & SDWebImageRefreshCached) { - // If image was found in the cache but SDWebImageRefreshCached is provided, notify about the cached image - // AND try to re-download it in order to let a chance to NSURLCache to refresh it from server. - [self callCompletionBlockForOperation:weakOperation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url]; - } - - // download if no image or requested to refresh anyway, and download allowed by delegate - SDWebImageDownloaderOptions downloaderOptions = 0; - if (options & SDWebImageLowPriority) downloaderOptions |= SDWebImageDownloaderLowPriority; - if (options & SDWebImageProgressiveDownload) downloaderOptions |= SDWebImageDownloaderProgressiveDownload; - if (options & SDWebImageRefreshCached) downloaderOptions |= SDWebImageDownloaderUseNSURLCache; - if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground; - if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies; - if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates; - if (options & SDWebImageHighPriority) downloaderOptions |= SDWebImageDownloaderHighPriority; - if (options & SDWebImageScaleDownLargeImages) downloaderOptions |= SDWebImageDownloaderScaleDownLargeImages; - - if (cachedImage && options & SDWebImageRefreshCached) { - // force progressive off if image already cached but forced refreshing - downloaderOptions &= ~SDWebImageDownloaderProgressiveDownload; - // ignore image read from NSURLCache if image if cached but force refreshing - downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse; - } - - SDWebImageDownloadToken *subOperationToken = [self.imageDownloader downloadImageWithURL:url options:downloaderOptions progress:progressBlock completed:^(UIImage *downloadedImage, NSData *downloadedData, NSError *error, BOOL finished) { - __strong __typeof(weakOperation) strongOperation = weakOperation; - if (!strongOperation || strongOperation.isCancelled) { - // Do nothing if the operation was cancelled - // See #699 for more details - // if we would call the completedBlock, there could be a race condition between this block and another completedBlock for the same object, so if this one is called second, we will overwrite the new data - } else if (error) { - [self callCompletionBlockForOperation:strongOperation completion:completedBlock error:error url:url]; - - if ( error.code != NSURLErrorNotConnectedToInternet - && error.code != NSURLErrorCancelled - && error.code != NSURLErrorTimedOut - && error.code != NSURLErrorInternationalRoamingOff - && error.code != NSURLErrorDataNotAllowed - && error.code != NSURLErrorCannotFindHost - && error.code != NSURLErrorCannotConnectToHost) { - @synchronized (self.failedURLs) { - [self.failedURLs addObject:url]; - } - } - } - else { - if ((options & SDWebImageRetryFailed)) { - @synchronized (self.failedURLs) { - [self.failedURLs removeObject:url]; - } - } - - BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly); - - if (options & SDWebImageRefreshCached && cachedImage && !downloadedImage) { - // Image refresh hit the NSURLCache cache, do not call the completion block - } else if (downloadedImage && (!downloadedImage.images || (options & SDWebImageTransformAnimatedImage)) && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)]) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ - UIImage *transformedImage = [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url]; - - if (transformedImage && finished) { - BOOL imageWasTransformed = ![transformedImage isEqual:downloadedImage]; - // pass nil if the image was transformed, so we can recalculate the data from the image - [self.imageCache storeImage:transformedImage imageData:(imageWasTransformed ? nil : downloadedData) forKey:key toDisk:cacheOnDisk completion:nil]; - } - - [self callCompletionBlockForOperation:strongOperation completion:completedBlock image:transformedImage data:downloadedData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url]; - }); - } else { - if (downloadedImage && finished) { - [self.imageCache storeImage:downloadedImage imageData:downloadedData forKey:key toDisk:cacheOnDisk completion:nil]; - } - [self callCompletionBlockForOperation:strongOperation completion:completedBlock image:downloadedImage data:downloadedData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url]; - } - } - - if (finished) { - [self safelyRemoveOperationFromRunning:strongOperation]; - } - }]; - operation.cancelBlock = ^{ - [self.imageDownloader cancel:subOperationToken]; - __strong __typeof(weakOperation) strongOperation = weakOperation; - [self safelyRemoveOperationFromRunning:strongOperation]; - }; - } else if (cachedImage) { - __strong __typeof(weakOperation) strongOperation = weakOperation; - [self callCompletionBlockForOperation:strongOperation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url]; - [self safelyRemoveOperationFromRunning:operation]; - } else { - // Image not in cache and download disallowed by delegate - __strong __typeof(weakOperation) strongOperation = weakOperation; - [self callCompletionBlockForOperation:strongOperation completion:completedBlock image:nil data:nil error:nil cacheType:SDImageCacheTypeNone finished:YES url:url]; - [self safelyRemoveOperationFromRunning:operation]; - } - }]; - - return operation; -} - -- (void)saveImageToCache:(nullable UIImage *)image forURL:(nullable NSURL *)url { - if (image && url) { - NSString *key = [self cacheKeyForURL:url]; - [self.imageCache storeImage:image forKey:key toDisk:YES completion:nil]; - } -} - -- (void)cancelAll { - @synchronized (self.runningOperations) { - NSArray *copiedOperations = [self.runningOperations copy]; - [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; - [self.runningOperations removeObjectsInArray:copiedOperations]; - } -} - -- (BOOL)isRunning { - BOOL isRunning = NO; - @synchronized (self.runningOperations) { - isRunning = (self.runningOperations.count > 0); - } - return isRunning; -} - -- (void)safelyRemoveOperationFromRunning:(nullable SDWebImageCombinedOperation*)operation { - @synchronized (self.runningOperations) { - if (operation) { - [self.runningOperations removeObject:operation]; - } - } -} - -- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation - completion:(nullable SDInternalCompletionBlock)completionBlock - error:(nullable NSError *)error - url:(nullable NSURL *)url { - [self callCompletionBlockForOperation:operation completion:completionBlock image:nil data:nil error:error cacheType:SDImageCacheTypeNone finished:YES url:url]; -} - -- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation - completion:(nullable SDInternalCompletionBlock)completionBlock - image:(nullable UIImage *)image - data:(nullable NSData *)data - error:(nullable NSError *)error - cacheType:(SDImageCacheType)cacheType - finished:(BOOL)finished - url:(nullable NSURL *)url { - dispatch_main_async_safe(^{ - if (operation && !operation.isCancelled && completionBlock) { - completionBlock(image, data, error, cacheType, finished, url); - } - }); -} - -@end - - -@implementation SDWebImageCombinedOperation - -- (void)setCancelBlock:(nullable SDWebImageNoParamsBlock)cancelBlock { - // check if the operation is already cancelled, then we just call the cancelBlock - if (self.isCancelled) { - if (cancelBlock) { - cancelBlock(); - } - _cancelBlock = nil; // don't forget to nil the cancelBlock, otherwise we will get crashes - } else { - _cancelBlock = [cancelBlock copy]; - } -} - -- (void)cancel { - self.cancelled = YES; - if (self.cacheOperation) { - [self.cacheOperation cancel]; - self.cacheOperation = nil; - } - if (self.cancelBlock) { - self.cancelBlock(); - - // TODO: this is a temporary fix to #809. - // Until we can figure the exact cause of the crash, going with the ivar instead of the setter -// self.cancelBlock = nil; - _cancelBlock = nil; - } -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h b/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h deleted file mode 100644 index d0a91ed..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import -#import "SDWebImageManager.h" - -@class SDWebImagePrefetcher; - -@protocol SDWebImagePrefetcherDelegate - -@optional - -/** - * Called when an image was prefetched. - * - * @param imagePrefetcher The current image prefetcher - * @param imageURL The image url that was prefetched - * @param finishedCount The total number of images that were prefetched (successful or not) - * @param totalCount The total number of images that were to be prefetched - */ -- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; - -/** - * Called when all images are prefetched. - * @param imagePrefetcher The current image prefetcher - * @param totalCount The total number of images that were prefetched (whether successful or not) - * @param skippedCount The total number of images that were skipped - */ -- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; - -@end - -typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); -typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); - -/** - * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. - */ -@interface SDWebImagePrefetcher : NSObject - -/** - * The web image manager - */ -@property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; - -/** - * Maximum number of URLs to prefetch at the same time. Defaults to 3. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentDownloads; - -/** - * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. - */ -@property (nonatomic, assign) SDWebImageOptions options; - -/** - * Queue options for Prefetcher. Defaults to Main Queue. - */ -@property (nonatomic, assign, nonnull) dispatch_queue_t prefetcherQueue; - -@property (weak, nonatomic, nullable) id delegate; - -/** - * Return the global image prefetcher instance. - */ -+ (nonnull instancetype)sharedImagePrefetcher; - -/** - * Allows you to instantiate a prefetcher with any arbitrary image manager. - */ -- (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; - -/** - * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, - * currently one image is downloaded at a time, - * and skips images for failed downloads and proceed to the next image in the list. - * Any previously-running prefetch operations are canceled. - * - * @param urls list of URLs to prefetch - */ -- (void)prefetchURLs:(nullable NSArray *)urls; - -/** - * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, - * currently one image is downloaded at a time, - * and skips images for failed downloads and proceed to the next image in the list. - * Any previously-running prefetch operations are canceled. - * - * @param urls list of URLs to prefetch - * @param progressBlock block to be called when progress updates; - * first parameter is the number of completed (successful or not) requests, - * second parameter is the total number of images originally requested to be prefetched - * @param completionBlock block to be called when prefetching is completed - * first param is the number of completed (successful or not) requests, - * second parameter is the number of skipped requests - */ -- (void)prefetchURLs:(nullable NSArray *)urls - progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock - completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; - -/** - * Remove and cancel queued list - */ -- (void)cancelPrefetching; - - -@end diff --git a/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m b/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m deleted file mode 100644 index b66357f..0000000 --- a/Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m +++ /dev/null @@ -1,142 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImagePrefetcher.h" - -@interface SDWebImagePrefetcher () - -@property (strong, nonatomic, nonnull) SDWebImageManager *manager; -@property (strong, nonatomic, nullable) NSArray *prefetchURLs; -@property (assign, nonatomic) NSUInteger requestedCount; -@property (assign, nonatomic) NSUInteger skippedCount; -@property (assign, nonatomic) NSUInteger finishedCount; -@property (assign, nonatomic) NSTimeInterval startedTime; -@property (copy, nonatomic, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; -@property (copy, nonatomic, nullable) SDWebImagePrefetcherProgressBlock progressBlock; - -@end - -@implementation SDWebImagePrefetcher - -+ (nonnull instancetype)sharedImagePrefetcher { - static dispatch_once_t once; - static id instance; - dispatch_once(&once, ^{ - instance = [self new]; - }); - return instance; -} - -- (nonnull instancetype)init { - return [self initWithImageManager:[SDWebImageManager new]]; -} - -- (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { - if ((self = [super init])) { - _manager = manager; - _options = SDWebImageLowPriority; - _prefetcherQueue = dispatch_get_main_queue(); - self.maxConcurrentDownloads = 3; - } - return self; -} - -- (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { - self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; -} - -- (NSUInteger)maxConcurrentDownloads { - return self.manager.imageDownloader.maxConcurrentDownloads; -} - -- (void)startPrefetchingAtIndex:(NSUInteger)index { - if (index >= self.prefetchURLs.count) return; - self.requestedCount++; - [self.manager loadImageWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - if (!finished) return; - self.finishedCount++; - - if (image) { - if (self.progressBlock) { - self.progressBlock(self.finishedCount,(self.prefetchURLs).count); - } - } - else { - if (self.progressBlock) { - self.progressBlock(self.finishedCount,(self.prefetchURLs).count); - } - // Add last failed - self.skippedCount++; - } - if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { - [self.delegate imagePrefetcher:self - didPrefetchURL:self.prefetchURLs[index] - finishedCount:self.finishedCount - totalCount:self.prefetchURLs.count - ]; - } - if (self.prefetchURLs.count > self.requestedCount) { - dispatch_async(self.prefetcherQueue, ^{ - [self startPrefetchingAtIndex:self.requestedCount]; - }); - } else if (self.finishedCount == self.requestedCount) { - [self reportStatus]; - if (self.completionBlock) { - self.completionBlock(self.finishedCount, self.skippedCount); - self.completionBlock = nil; - } - self.progressBlock = nil; - } - }]; -} - -- (void)reportStatus { - NSUInteger total = (self.prefetchURLs).count; - if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { - [self.delegate imagePrefetcher:self - didFinishWithTotalCount:(total - self.skippedCount) - skippedCount:self.skippedCount - ]; - } -} - -- (void)prefetchURLs:(nullable NSArray *)urls { - [self prefetchURLs:urls progress:nil completed:nil]; -} - -- (void)prefetchURLs:(nullable NSArray *)urls - progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock - completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { - [self cancelPrefetching]; // Prevent duplicate prefetch request - self.startedTime = CFAbsoluteTimeGetCurrent(); - self.prefetchURLs = urls; - self.completionBlock = completionBlock; - self.progressBlock = progressBlock; - - if (urls.count == 0) { - if (completionBlock) { - completionBlock(0,0); - } - } else { - // Starts prefetching from the very first image on the list with the max allowed concurrency - NSUInteger listCount = self.prefetchURLs.count; - for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { - [self startPrefetchingAtIndex:i]; - } - } -} - -- (void)cancelPrefetching { - self.prefetchURLs = nil; - self.skippedCount = 0; - self.requestedCount = 0; - self.finishedCount = 0; - [self.manager cancelAll]; -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/UIButton+WebCache.m b/Pods/SDWebImage/SDWebImage/UIButton+WebCache.m deleted file mode 100644 index 63f75e4..0000000 --- a/Pods/SDWebImage/SDWebImage/UIButton+WebCache.m +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIButton+WebCache.h" - -#if SD_UIKIT - -#import "objc/runtime.h" -#import "UIView+WebCacheOperation.h" -#import "UIView+WebCache.h" - -static char imageURLStorageKey; - -typedef NSMutableDictionary SDStateImageURLDictionary; - -@implementation UIButton (WebCache) - -- (nullable NSURL *)sd_currentImageURL { - NSURL *url = self.imageURLStorage[@(self.state)]; - - if (!url) { - url = self.imageURLStorage[@(UIControlStateNormal)]; - } - - return url; -} - -- (nullable NSURL *)sd_imageURLForState:(UIControlState)state { - return self.imageURLStorage[@(state)]; -} - -#pragma mark - Image - -- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { - [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { - [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { - [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - completed:(nullable SDExternalCompletionBlock)completedBlock { - if (!url) { - [self.imageURLStorage removeObjectForKey:@(state)]; - return; - } - - self.imageURLStorage[@(state)] = url; - - __weak typeof(self)weakSelf = self; - [self sd_internalSetImageWithURL:url - placeholderImage:placeholder - options:options - operationKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)] - setImageBlock:^(UIImage *image, NSData *imageData) { - [weakSelf setImage:image forState:state]; - } - progress:nil - completed:completedBlock]; -} - -#pragma mark - Background image - -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { - [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; -} - -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { - [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; -} - -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { - [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options completed:nil]; -} - -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; -} - -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; -} - -- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url - forState:(UIControlState)state - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - completed:(nullable SDExternalCompletionBlock)completedBlock { - if (!url) { - [self.imageURLStorage removeObjectForKey:@(state)]; - return; - } - - self.imageURLStorage[@(state)] = url; - - __weak typeof(self)weakSelf = self; - [self sd_internalSetImageWithURL:url - placeholderImage:placeholder - options:options - operationKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)] - setImageBlock:^(UIImage *image, NSData *imageData) { - [weakSelf setBackgroundImage:image forState:state]; - } - progress:nil - completed:completedBlock]; -} - -- (void)sd_setImageLoadOperation:(id)operation forState:(UIControlState)state { - [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; -} - -- (void)sd_cancelImageLoadForState:(UIControlState)state { - [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonImageOperation%@", @(state)]]; -} - -- (void)sd_setBackgroundImageLoadOperation:(id)operation forState:(UIControlState)state { - [self sd_setImageLoadOperation:operation forKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; -} - -- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { - [self sd_cancelImageLoadOperationWithKey:[NSString stringWithFormat:@"UIButtonBackgroundImageOperation%@", @(state)]]; -} - -- (SDStateImageURLDictionary *)imageURLStorage { - SDStateImageURLDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey); - if (!storage) { - storage = [NSMutableDictionary dictionary]; - objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - - return storage; -} - -@end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/UIImage+GIF.h b/Pods/SDWebImage/SDWebImage/UIImage+GIF.h deleted file mode 100755 index 479d572..0000000 --- a/Pods/SDWebImage/SDWebImage/UIImage+GIF.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * (c) Laurin Brandner - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageCompat.h" - -@interface UIImage (GIF) - -/** - * Compatibility method - creates an animated UIImage from an NSData, it will only contain the 1st frame image - */ -+ (UIImage *)sd_animatedGIFWithData:(NSData *)data; - -/** - * Checks if an UIImage instance is a GIF. Will use the `images` array - */ -- (BOOL)isGIF; - -@end diff --git a/Pods/SDWebImage/SDWebImage/UIImage+GIF.m b/Pods/SDWebImage/SDWebImage/UIImage+GIF.m deleted file mode 100755 index 9301777..0000000 --- a/Pods/SDWebImage/SDWebImage/UIImage+GIF.m +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * (c) Laurin Brandner - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIImage+GIF.h" -#import -#import "objc/runtime.h" -#import "NSImage+WebCache.h" - -@implementation UIImage (GIF) - -+ (UIImage *)sd_animatedGIFWithData:(NSData *)data { - if (!data) { - return nil; - } - - CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); - - size_t count = CGImageSourceGetCount(source); - - UIImage *staticImage; - - if (count <= 1) { - staticImage = [[UIImage alloc] initWithData:data]; - } else { - // we will only retrieve the 1st frame. the full GIF support is available via the FLAnimatedImageView category. - // this here is only code to allow drawing animated images as static ones -#if SD_WATCH - CGFloat scale = 1; - scale = [WKInterfaceDevice currentDevice].screenScale; -#elif SD_UIKIT - CGFloat scale = 1; - scale = [UIScreen mainScreen].scale; -#endif - - CGImageRef CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); -#if SD_UIKIT || SD_WATCH - UIImage *frameImage = [UIImage imageWithCGImage:CGImage scale:scale orientation:UIImageOrientationUp]; - staticImage = [UIImage animatedImageWithImages:@[frameImage] duration:0.0f]; -#elif SD_MAC - staticImage = [[UIImage alloc] initWithCGImage:CGImage size:NSZeroSize]; -#endif - CGImageRelease(CGImage); - } - - CFRelease(source); - - return staticImage; -} - -- (BOOL)isGIF { - return (self.images != nil); -} - -@end diff --git a/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m b/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m deleted file mode 100644 index 378f389..0000000 --- a/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m +++ /dev/null @@ -1,161 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIImage+MultiFormat.h" -#import "UIImage+GIF.h" -#import "NSData+ImageContentType.h" -#import - -#ifdef SD_WEBP -#import "UIImage+WebP.h" -#endif - -@implementation UIImage (MultiFormat) - -+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { - if (!data) { - return nil; - } - - UIImage *image; - SDImageFormat imageFormat = [NSData sd_imageFormatForImageData:data]; - if (imageFormat == SDImageFormatGIF) { - image = [UIImage sd_animatedGIFWithData:data]; - } -#ifdef SD_WEBP - else if (imageFormat == SDImageFormatWebP) - { - image = [UIImage sd_imageWithWebPData:data]; - } -#endif - else { - image = [[UIImage alloc] initWithData:data]; -#if SD_UIKIT || SD_WATCH - UIImageOrientation orientation = [self sd_imageOrientationFromImageData:data]; - if (orientation != UIImageOrientationUp) { - image = [UIImage imageWithCGImage:image.CGImage - scale:image.scale - orientation:orientation]; - } -#endif - } - - - return image; -} - -#if SD_UIKIT || SD_WATCH -+(UIImageOrientation)sd_imageOrientationFromImageData:(nonnull NSData *)imageData { - UIImageOrientation result = UIImageOrientationUp; - CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); - if (imageSource) { - CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); - if (properties) { - CFTypeRef val; - int exifOrientation; - val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); - if (val) { - CFNumberGetValue(val, kCFNumberIntType, &exifOrientation); - result = [self sd_exifOrientationToiOSOrientation:exifOrientation]; - } // else - if it's not set it remains at up - CFRelease((CFTypeRef) properties); - } else { - //NSLog(@"NO PROPERTIES, FAIL"); - } - CFRelease(imageSource); - } - return result; -} - -#pragma mark EXIF orientation tag converter -// Convert an EXIF image orientation to an iOS one. -// reference see here: http://sylvana.net/jpegcrop/exif_orientation.html -+ (UIImageOrientation) sd_exifOrientationToiOSOrientation:(int)exifOrientation { - UIImageOrientation orientation = UIImageOrientationUp; - switch (exifOrientation) { - case 1: - orientation = UIImageOrientationUp; - break; - - case 3: - orientation = UIImageOrientationDown; - break; - - case 8: - orientation = UIImageOrientationLeft; - break; - - case 6: - orientation = UIImageOrientationRight; - break; - - case 2: - orientation = UIImageOrientationUpMirrored; - break; - - case 4: - orientation = UIImageOrientationDownMirrored; - break; - - case 5: - orientation = UIImageOrientationLeftMirrored; - break; - - case 7: - orientation = UIImageOrientationRightMirrored; - break; - default: - break; - } - return orientation; -} -#endif - -- (nullable NSData *)sd_imageData { - return [self sd_imageDataAsFormat:SDImageFormatUndefined]; -} - -- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { - NSData *imageData = nil; - if (self) { -#if SD_UIKIT || SD_WATCH - int alphaInfo = CGImageGetAlphaInfo(self.CGImage); - BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || - alphaInfo == kCGImageAlphaNoneSkipFirst || - alphaInfo == kCGImageAlphaNoneSkipLast); - - BOOL usePNG = hasAlpha; - - // the imageFormat param has priority here. But if the format is undefined, we relly on the alpha channel - if (imageFormat != SDImageFormatUndefined) { - usePNG = (imageFormat == SDImageFormatPNG); - } - - if (usePNG) { - imageData = UIImagePNGRepresentation(self); - } else { - imageData = UIImageJPEGRepresentation(self, (CGFloat)1.0); - } -#else - NSBitmapImageFileType imageFileType = NSJPEGFileType; - if (imageFormat == SDImageFormatGIF) { - imageFileType = NSGIFFileType; - } else if (imageFormat == SDImageFormatPNG) { - imageFileType = NSPNGFileType; - } - - imageData = [NSBitmapImageRep representationOfImageRepsInArray:self.representations - usingType:imageFileType - properties:@{}]; -#endif - } - return imageData; -} - - -@end diff --git a/Pods/SDWebImage/SDWebImage/UIImage+WebP.m b/Pods/SDWebImage/SDWebImage/UIImage+WebP.m deleted file mode 100644 index bd6b9e1..0000000 --- a/Pods/SDWebImage/SDWebImage/UIImage+WebP.m +++ /dev/null @@ -1,172 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifdef SD_WEBP - -#import "UIImage+WebP.h" -#import "webp/decode.h" -#import "webp/mux_types.h" -#import "webp/demux.h" -#import "NSImage+WebCache.h" - -// Callback for CGDataProviderRelease -static void FreeImageData(void *info, const void *data, size_t size) { - free((void *)data); -} - -@implementation UIImage (WebP) - -+ (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data { - if (!data) { - return nil; - } - - WebPData webpData; - WebPDataInit(&webpData); - webpData.bytes = data.bytes; - webpData.size = data.length; - WebPDemuxer *demuxer = WebPDemux(&webpData); - if (!demuxer) { - return nil; - } - - uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS); - if (!(flags & ANIMATION_FLAG)) { - // for static single webp image - UIImage *staticImage = [self sd_rawWepImageWithData:webpData]; - WebPDemuxDelete(demuxer); - return staticImage; - } - - WebPIterator iter; - if (!WebPDemuxGetFrame(demuxer, 1, &iter)) { - WebPDemuxReleaseIterator(&iter); - WebPDemuxDelete(demuxer); - return nil; - } - - NSMutableArray *images = [NSMutableArray array]; - NSTimeInterval duration = 0; - - do { - UIImage *image; - if (iter.blend_method == WEBP_MUX_BLEND) { - image = [self sd_blendWebpImageWithOriginImage:[images lastObject] iterator:iter]; - } else { - image = [self sd_rawWepImageWithData:iter.fragment]; - } - - if (!image) { - continue; - } - - [images addObject:image]; - duration += iter.duration / 1000.0f; - - } while (WebPDemuxNextFrame(&iter)); - - WebPDemuxReleaseIterator(&iter); - WebPDemuxDelete(demuxer); - - UIImage *finalImage = nil; -#if SD_UIKIT || SD_WATCH - finalImage = [UIImage animatedImageWithImages:images duration:duration]; -#elif SD_MAC - if ([images count] > 0) { - finalImage = images[0]; - } -#endif - return finalImage; -} - - -+ (nullable UIImage *)sd_blendWebpImageWithOriginImage:(nullable UIImage *)originImage iterator:(WebPIterator)iter { - if (!originImage) { - return nil; - } - - CGSize size = originImage.size; - CGFloat tmpX = iter.x_offset; - CGFloat tmpY = size.height - iter.height - iter.y_offset; - CGRect imageRect = CGRectMake(tmpX, tmpY, iter.width, iter.height); - - UIImage *image = [self sd_rawWepImageWithData:iter.fragment]; - if (!image) { - return nil; - } - - CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - uint32_t bitmapInfo = iter.has_alpha ? kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast : 0; - CGContextRef blendCanvas = CGBitmapContextCreate(NULL, size.width, size.height, 8, 0, colorSpaceRef, bitmapInfo); - CGContextDrawImage(blendCanvas, CGRectMake(0, 0, size.width, size.height), originImage.CGImage); - CGContextDrawImage(blendCanvas, imageRect, image.CGImage); - CGImageRef newImageRef = CGBitmapContextCreateImage(blendCanvas); - -#if SD_UIKIT || SD_WATCH - image = [UIImage imageWithCGImage:newImageRef]; -#elif SD_MAC - image = [[UIImage alloc] initWithCGImage:newImageRef size:NSZeroSize]; -#endif - - CGImageRelease(newImageRef); - CGContextRelease(blendCanvas); - CGColorSpaceRelease(colorSpaceRef); - - return image; -} - -+ (nullable UIImage *)sd_rawWepImageWithData:(WebPData)webpData { - WebPDecoderConfig config; - if (!WebPInitDecoderConfig(&config)) { - return nil; - } - - if (WebPGetFeatures(webpData.bytes, webpData.size, &config.input) != VP8_STATUS_OK) { - return nil; - } - - config.output.colorspace = config.input.has_alpha ? MODE_rgbA : MODE_RGB; - config.options.use_threads = 1; - - // Decode the WebP image data into a RGBA value array. - if (WebPDecode(webpData.bytes, webpData.size, &config) != VP8_STATUS_OK) { - return nil; - } - - int width = config.input.width; - int height = config.input.height; - if (config.options.use_scaling) { - width = config.options.scaled_width; - height = config.options.scaled_height; - } - - // Construct a UIImage from the decoded RGBA value array. - CGDataProviderRef provider = - CGDataProviderCreateWithData(NULL, config.output.u.RGBA.rgba, config.output.u.RGBA.size, FreeImageData); - CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - CGBitmapInfo bitmapInfo = config.input.has_alpha ? kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast : 0; - size_t components = config.input.has_alpha ? 4 : 3; - CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; - CGImageRef imageRef = CGImageCreate(width, height, 8, components * 8, components * width, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent); - - CGColorSpaceRelease(colorSpaceRef); - CGDataProviderRelease(provider); - -#if SD_UIKIT || SD_WATCH - UIImage *image = [[UIImage alloc] initWithCGImage:imageRef]; -#else - UIImage *image = [[UIImage alloc] initWithCGImage:imageRef size:NSZeroSize]; -#endif - CGImageRelease(imageRef); - - return image; -} - -@end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m b/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m deleted file mode 100644 index fb13bd8..0000000 --- a/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIImageView+HighlightedWebCache.h" - -#if SD_UIKIT - -#import "UIView+WebCacheOperation.h" -#import "UIView+WebCache.h" - -@implementation UIImageView (HighlightedWebCache) - -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { - [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; -} - -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { - [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; -} - -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; -} - -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; -} - -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url - options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDExternalCompletionBlock)completedBlock { - __weak typeof(self)weakSelf = self; - [self sd_internalSetImageWithURL:url - placeholderImage:nil - options:options - operationKey:@"UIImageViewImageOperationHighlighted" - setImageBlock:^(UIImage *image, NSData *imageData) { - weakSelf.highlightedImage = image; - } - progress:progressBlock - completed:completedBlock]; -} - -@end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m b/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m deleted file mode 100644 index 81f687e..0000000 --- a/Pods/SDWebImage/SDWebImage/UIImageView+WebCache.m +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIImageView+WebCache.h" - -#if SD_UIKIT || SD_MAC - -#import "objc/runtime.h" -#import "UIView+WebCacheOperation.h" -#import "UIView+WebCache.h" - -@implementation UIImageView (WebCache) - -- (void)sd_setImageWithURL:(nullable NSURL *)url { - [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { - [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { - [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; -} - -- (void)sd_setImageWithURL:(nullable NSURL *)url - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDExternalCompletionBlock)completedBlock { - [self sd_internalSetImageWithURL:url - placeholderImage:placeholder - options:options - operationKey:nil - setImageBlock:nil - progress:progressBlock - completed:completedBlock]; -} - -- (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDExternalCompletionBlock)completedBlock { - NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url]; - UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromCacheForKey:key]; - - [self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock]; -} - -#if SD_UIKIT - -#pragma mark - Animation of multiple images - -- (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs { - [self sd_cancelCurrentAnimationImagesLoad]; - __weak __typeof(self)wself = self; - - NSMutableArray> *operationsArray = [[NSMutableArray alloc] init]; - - for (NSURL *logoImageURL in arrayOfURLs) { - id operation = [SDWebImageManager.sharedManager loadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - if (!wself) return; - dispatch_main_async_safe(^{ - __strong UIImageView *sself = wself; - [sself stopAnimating]; - if (sself && image) { - NSMutableArray *currentImages = [[sself animationImages] mutableCopy]; - if (!currentImages) { - currentImages = [[NSMutableArray alloc] init]; - } - [currentImages addObject:image]; - - sself.animationImages = currentImages; - [sself setNeedsLayout]; - } - [sself startAnimating]; - }); - }]; - [operationsArray addObject:operation]; - } - - [self sd_setImageLoadOperation:[operationsArray copy] forKey:@"UIImageViewAnimationImages"]; -} - -- (void)sd_cancelCurrentAnimationImagesLoad { - [self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"]; -} -#endif - -@end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/UIView+WebCache.h b/Pods/SDWebImage/SDWebImage/UIView+WebCache.h deleted file mode 100644 index 4c57519..0000000 --- a/Pods/SDWebImage/SDWebImage/UIView+WebCache.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "SDWebImageCompat.h" - -#if SD_UIKIT || SD_MAC - -#import "SDWebImageManager.h" - -typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData); - -@interface UIView (WebCache) - -/** - * Get the current image URL. - * - * Note that because of the limitations of categories this property can get out of sync - * if you use setImage: directly. - */ -- (nullable NSURL *)sd_imageURL; - -/** - * Set the imageView `image` with an `url` and optionally a placeholder image. - * - * The download is asynchronous and cached. - * - * @param url The url for the image. - * @param placeholder The image to be set initially, until the image request finishes. - * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. - * @param operationKey A string to be used as the operation key. If nil, will use the class name - * @param setImageBlock Block used for custom set image code - * @param progressBlock A block called while image is downloading - * @note the progress block is executed on a background queue - * @param completedBlock A block called when operation has been completed. This block has no return value - * and takes the requested UIImage as first parameter. In case of error the image parameter - * is nil and the second parameter may contain an NSError. The third parameter is a Boolean - * indicating if the image was retrieved from the local cache or from the network. - * The fourth parameter is the original image url. - */ -- (void)sd_internalSetImageWithURL:(nullable NSURL *)url - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - operationKey:(nullable NSString *)operationKey - setImageBlock:(nullable SDSetImageBlock)setImageBlock - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDExternalCompletionBlock)completedBlock; - -/** - * Cancel the current download - */ -- (void)sd_cancelCurrentImageLoad; - -#if SD_UIKIT - -#pragma mark - Activity indicator - -/** - * Show activity UIActivityIndicatorView - */ -- (void)sd_setShowActivityIndicatorView:(BOOL)show; - -/** - * set desired UIActivityIndicatorViewStyle - * - * @param style The style of the UIActivityIndicatorView - */ -- (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style; - -- (BOOL)sd_showActivityIndicatorView; -- (void)sd_addActivityIndicator; -- (void)sd_removeActivityIndicator; - -#endif - -@end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/UIView+WebCache.m b/Pods/SDWebImage/SDWebImage/UIView+WebCache.m deleted file mode 100644 index ad2b54c..0000000 --- a/Pods/SDWebImage/SDWebImage/UIView+WebCache.m +++ /dev/null @@ -1,200 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIView+WebCache.h" - -#if SD_UIKIT || SD_MAC - -#import "objc/runtime.h" -#import "UIView+WebCacheOperation.h" - -static char imageURLKey; - -#if SD_UIKIT -static char TAG_ACTIVITY_INDICATOR; -static char TAG_ACTIVITY_STYLE; -#endif -static char TAG_ACTIVITY_SHOW; - -@implementation UIView (WebCache) - -- (nullable NSURL *)sd_imageURL { - return objc_getAssociatedObject(self, &imageURLKey); -} - -- (void)sd_internalSetImageWithURL:(nullable NSURL *)url - placeholderImage:(nullable UIImage *)placeholder - options:(SDWebImageOptions)options - operationKey:(nullable NSString *)operationKey - setImageBlock:(nullable SDSetImageBlock)setImageBlock - progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - completed:(nullable SDExternalCompletionBlock)completedBlock { - NSString *validOperationKey = operationKey ?: NSStringFromClass([self class]); - [self sd_cancelImageLoadOperationWithKey:validOperationKey]; - objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - - if (!(options & SDWebImageDelayPlaceholder)) { - dispatch_main_async_safe(^{ - [self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock]; - }); - } - - if (url) { - // check if activityView is enabled or not - if ([self sd_showActivityIndicatorView]) { - [self sd_addActivityIndicator]; - } - - __weak __typeof(self)wself = self; - id operation = [SDWebImageManager.sharedManager loadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - __strong __typeof (wself) sself = wself; - [sself sd_removeActivityIndicator]; - if (!sself) { - return; - } - dispatch_main_async_safe(^{ - if (!sself) { - return; - } - if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) { - completedBlock(image, error, cacheType, url); - return; - } else if (image) { - [sself sd_setImage:image imageData:data basedOnClassOrViaCustomSetImageBlock:setImageBlock]; - [sself sd_setNeedsLayout]; - } else { - if ((options & SDWebImageDelayPlaceholder)) { - [sself sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock]; - [sself sd_setNeedsLayout]; - } - } - if (completedBlock && finished) { - completedBlock(image, error, cacheType, url); - } - }); - }]; - [self sd_setImageLoadOperation:operation forKey:validOperationKey]; - } else { - dispatch_main_async_safe(^{ - [self sd_removeActivityIndicator]; - if (completedBlock) { - NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; - completedBlock(nil, error, SDImageCacheTypeNone, url); - } - }); - } -} - -- (void)sd_cancelCurrentImageLoad { - [self sd_cancelImageLoadOperationWithKey:NSStringFromClass([self class])]; -} - -- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock { - if (setImageBlock) { - setImageBlock(image, imageData); - return; - } - -#if SD_UIKIT || SD_MAC - if ([self isKindOfClass:[UIImageView class]]) { - UIImageView *imageView = (UIImageView *)self; - imageView.image = image; - } -#endif - -#if SD_UIKIT - if ([self isKindOfClass:[UIButton class]]) { - UIButton *button = (UIButton *)self; - [button setImage:image forState:UIControlStateNormal]; - } -#endif -} - -- (void)sd_setNeedsLayout { -#if SD_UIKIT - [self setNeedsLayout]; -#elif SD_MAC - [self setNeedsLayout:YES]; -#endif -} - -#pragma mark - Activity indicator - -#pragma mark - -#if SD_UIKIT -- (UIActivityIndicatorView *)activityIndicator { - return (UIActivityIndicatorView *)objc_getAssociatedObject(self, &TAG_ACTIVITY_INDICATOR); -} - -- (void)setActivityIndicator:(UIActivityIndicatorView *)activityIndicator { - objc_setAssociatedObject(self, &TAG_ACTIVITY_INDICATOR, activityIndicator, OBJC_ASSOCIATION_RETAIN); -} -#endif - -- (void)sd_setShowActivityIndicatorView:(BOOL)show { - objc_setAssociatedObject(self, &TAG_ACTIVITY_SHOW, @(show), OBJC_ASSOCIATION_RETAIN); -} - -- (BOOL)sd_showActivityIndicatorView { - return [objc_getAssociatedObject(self, &TAG_ACTIVITY_SHOW) boolValue]; -} - -#if SD_UIKIT -- (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style{ - objc_setAssociatedObject(self, &TAG_ACTIVITY_STYLE, [NSNumber numberWithInt:style], OBJC_ASSOCIATION_RETAIN); -} - -- (int)sd_getIndicatorStyle{ - return [objc_getAssociatedObject(self, &TAG_ACTIVITY_STYLE) intValue]; -} -#endif - -- (void)sd_addActivityIndicator { -#if SD_UIKIT - if (!self.activityIndicator) { - self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]]; - self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; - - dispatch_main_async_safe(^{ - [self addSubview:self.activityIndicator]; - - [self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator - attribute:NSLayoutAttributeCenterX - relatedBy:NSLayoutRelationEqual - toItem:self - attribute:NSLayoutAttributeCenterX - multiplier:1.0 - constant:0.0]]; - [self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator - attribute:NSLayoutAttributeCenterY - relatedBy:NSLayoutRelationEqual - toItem:self - attribute:NSLayoutAttributeCenterY - multiplier:1.0 - constant:0.0]]; - }); - } - - dispatch_main_async_safe(^{ - [self.activityIndicator startAnimating]; - }); -#endif -} - -- (void)sd_removeActivityIndicator { -#if SD_UIKIT - if (self.activityIndicator) { - [self.activityIndicator removeFromSuperview]; - self.activityIndicator = nil; - } -#endif -} - -@end - -#endif diff --git a/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m b/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m deleted file mode 100644 index a515a74..0000000 --- a/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of the SDWebImage package. - * (c) Olivier Poitrey - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#import "UIView+WebCacheOperation.h" - -#if SD_UIKIT || SD_MAC - -#import "objc/runtime.h" - -static char loadOperationKey; - -typedef NSMutableDictionary SDOperationsDictionary; - -@implementation UIView (WebCacheOperation) - -- (SDOperationsDictionary *)operationDictionary { - SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); - if (operations) { - return operations; - } - operations = [NSMutableDictionary dictionary]; - objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - return operations; -} - -- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { - if (key) { - [self sd_cancelImageLoadOperationWithKey:key]; - if (operation) { - SDOperationsDictionary *operationDictionary = [self operationDictionary]; - operationDictionary[key] = operation; - } - } -} - -- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { - // Cancel in progress downloader from queue - SDOperationsDictionary *operationDictionary = [self operationDictionary]; - id operations = operationDictionary[key]; - if (operations) { - if ([operations isKindOfClass:[NSArray class]]) { - for (id operation in operations) { - if (operation) { - [operation cancel]; - } - } - } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){ - [(id) operations cancel]; - } - [operationDictionary removeObjectForKey:key]; - } -} - -- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { - if (key) { - SDOperationsDictionary *operationDictionary = [self operationDictionary]; - [operationDictionary removeObjectForKey:key]; - } -} - -@end - -#endif diff --git a/Pods/SDWebImage/WebImage/SDWebImage.h b/Pods/SDWebImage/WebImage/SDWebImage.h new file mode 100644 index 0000000..0e56800 --- /dev/null +++ b/Pods/SDWebImage/WebImage/SDWebImage.h @@ -0,0 +1,89 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Florent Vilmart + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +//! Project version number for SDWebImage. +FOUNDATION_EXPORT double SDWebImageVersionNumber; + +//! Project version string for SDWebImage. +FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +// Mac +#if __has_include() +#import +#endif +#if __has_include() +#import +#endif +#if __has_include() +#import +#endif + +// MapKit +#if __has_include() +#import +#endif diff --git a/Pods/SDWebImageWebPCoder/LICENSE b/Pods/SDWebImageWebPCoder/LICENSE new file mode 100644 index 0000000..2e8432d --- /dev/null +++ b/Pods/SDWebImageWebPCoder/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 Bogdan Poplauschi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Pods/SDWebImageWebPCoder/README.md b/Pods/SDWebImageWebPCoder/README.md new file mode 100644 index 0000000..70927b9 --- /dev/null +++ b/Pods/SDWebImageWebPCoder/README.md @@ -0,0 +1,218 @@ +# SDWebImageWebPCoder + +[![CI Status](http://img.shields.io/travis/SDWebImage/SDWebImageWebPCoder.svg?style=flat)](https://travis-ci.org/SDWebImage/SDWebImageWebPCoder) +[![Version](https://img.shields.io/cocoapods/v/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder) +[![License](https://img.shields.io/cocoapods/l/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder) +[![Platform](https://img.shields.io/cocoapods/p/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder) +[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/SDWebImageWebPCoder) +[![codecov](https://codecov.io/gh/SDWebImage/SDWebImageWebPCoder/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImageWebPCoder) + +Starting with the SDWebImage 5.0 version, we moved the WebP support code and [libwebp](https://github.com/webmproject/libwebp) from the Core Repo to this stand-alone repo. + +SDWebImageWebPCoder supports both WebP decoding and encoding, for Static WebP or Animated WebP as well. + +## Requirements + ++ iOS 8 ++ macOS 10.10 ++ tvOS 9.0 ++ watchOS 2.0 + +## Installation + +#### CocoaPods + +SDWebImageWebPCoder is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: + +```ruby +pod 'SDWebImageWebPCoder' +``` + +#### Carthage + +SDWebImageWebPCoder is available through [Carthage](https://github.com/Carthage/Carthage). + +``` +github "SDWebImage/SDWebImageWebPCoder" +``` + +#### Swift Package Manager (Xcode 11+) + +SDWebImageWebPCoder is available through [Swift Package Manager](https://swift.org/package-manager). + +```swift +let package = Package( + dependencies: [ + .package(url: "https://github.com/SDWebImage/SDWebImageWebPCoder.git", from: "0.3.0") + ] +) +``` + +## Usage + +### Add Coder + +Before using SDWebImage to load WebP images, you need to register the WebP Coder to your coders manager. This step is recommended to be done after your App launch (like AppDelegate method). + ++ Objective-C + +```objective-c +// Add coder +SDImageWebPCoder *webPCoder = [SDImageWebPCoder sharedCoder]; +[[SDImageCodersManager sharedManager] addCoder:webPCoder]; +``` + ++ Swift + +```swift +// Add coder +let WebPCoder = SDImageWebPCoder.shared +SDImageCodersManager.shared.addCoder(WebPCoder) +``` + +### Modify HTTP Accept Header + +Some of image server provider may try to detect the client supported format, by default, SDWebImage use `image/*,*/*;q=0.8` for [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept). You can modify it with the `image/webp` as well. + ++ Objective-C + +```objective-c +[[SDWebImageDownloader sharedDownloader] setValue:@"image/webp,image/*,*/*;q=0.8" forHTTPHeaderField:@"Accept"]; +``` + ++ Swift + +```swift +SDWebImageDownloader.shared.setValue("image/webp,image/*,*/*;q=0.8", forHTTPHeaderField:"Accept") +``` + +### Loading + ++ Objective-C + +```objective-c +// WebP online image loading +NSURL *webpURL; +UIImageView *imageView; +[imageView sd_setImageWithURL:webpURL]; +``` + ++ Swift + +```swift +// WebP online image loading +let webpURL: URL +let imageView: UIImageView +imageView.sd_setImage(with: webpURL) +``` + +### Progressive Animation Loading (0.5.0+) + ++ Objective-C + +```objective-c +// WebP progressive loading for animated image +NSURL *webpURL; +SDAnimatedImageView *imageView; +imageView.shouldIncrementalLoad = YES; +[imageView sd_setImageWithURL:webpURL placeholderImage:nil options:SDWebImageProgressiveLoad]; +``` + ++ Swift + +```swift +// WebP progressive loading for animated image +let webpURL: URL +let imageView: SDAnimatedImageView +imageView.shouldIncrementalLoad = true +imageView.sd_setImage(with: webpURL, placeholderImage: nil, options: [.progressiveLoad]) +``` + +### Decoding + ++ Objective-C + +```objective-c +// WebP image decoding +NSData *webpData; +UIImage *image = [[SDImageWebPCoder sharedCoder] decodedImageWithData:webpData options:nil]; +``` + ++ Swift + +```swift +// WebP image decoding +let webpData: Data +let image = SDImageWebPCoder.shared.decodedImage(with: data, options: nil) +``` + +### Thumbnail Decoding (0.4.0+) + ++ Objective-C + +```objective-c +// WebP thumbnail image decoding +NSData *webpData; +CGSize thumbnailSize = CGSizeMake(300, 300); +UIImage *thumbnailImage = [[SDImageWebPCoder sharedCoder] decodedImageWithData:webpData options:@{SDImageCoderDecodeThumbnailPixelSize : @(thumbnailSize}]; +``` + ++ Swift + +```swift +// WebP thumbnail image decoding +let webpData: Data +let thumbnailSize = CGSize(width: 300, height: 300) +let image = SDImageWebPCoder.shared.decodedImage(with: data, options: [.decodeThumbnailPixelSize: thumbnailSize]) +``` + +### Encoding + ++ Objective-c + +```objective-c +// WebP image encoding +UIImage *image; +NSData *webpData = [[SDImageWebPCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatWebP options:nil]; +// Encode Quality +NSData *lossyWebpData = [[SDImageWebPCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatWebP options:@{SDImageCoderEncodeCompressionQuality : @(0.1)}]; // [0, 1] compression quality +NSData *limitedWebpData = [[SDImageWebPCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatWebP options:@{SDImageCoderEncodeMaxFileSize : @(1024 * 10)}]; // v0.6.0 feature, limit output file size <= 10KB +NSData *thumbnailWebpData = [[SDImageWebPCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatWebP options:@{SDImageCoderEncodeMaxPixelSize : @(CGSizeMake(200, 200)}]; // v0.6.1 feature, encoding max pixel size +``` + ++ Swift + +```swift +// WebP image encoding +let image: UIImage +let webpData = SDImageWebPCoder.shared.encodedData(with: image, format: .webP, options: nil) +let lossyWebpData = SDImageWebPCoder.shared.encodedData(with: image, format: .webP, options: [.encodeCompressionQuality: 0.1]) // [0, 1] compression quality +let limitedWebpData = SDImageWebPCoder.shared.encodedData(with: image, format: .webP, options: [.encodeMaxFileSize: 1024 * 10]) // v0.6.0 feature, limit output file size <= 10KB +let thumbnailWebpData = SDImageWebPCoder.shared.encodedData(with: image, format: .webP, options: [.encodeMaxPixelSize: CGSize(width: 200, height: 200)]) // v0.6.1 feature, encoding max pixel size +``` + +See more documentation in [SDWebImage Wiki - Coders](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-coder-420) + +## Example + +To run the example project, clone the repo, and run `pod install` from the root directory first. Then open `SDWebImageWebPCoder.xcworkspace`. + +This is a demo to show how to use `WebP` and animated `WebP` images via `SDWebImageWebPCoderExample` target. + +## Screenshot + + + +These WebP images are from [WebP Gallery](https://developers.google.com/speed/webp/gallery1) and [GIF vs APNG vs WebP](http://littlesvr.ca/apng/gif_apng_webp.html) + +## Author + +[Bogdan Poplauschi](https://github.com/bpoplauschi) +[DreamPiggy](https://github.com/dreampiggy) + +## License + +SDWebImageWebPCoder is available under the MIT license. See [the LICENSE file](https://github.com/SDWebImage/SDWebImageWebPCoder/blob/master/LICENSE) for more info. + + diff --git a/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h new file mode 100644 index 0000000..7629ded --- /dev/null +++ b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h @@ -0,0 +1,22 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#if __has_include() +#import +#else +@import SDWebImage; +#endif + +/** + Built in coder that supports WebP and animated WebP + */ +@interface SDImageWebPCoder : NSObject + +@property (nonatomic, class, readonly, nonnull) SDImageWebPCoder *sharedCoder; + +@end diff --git a/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m new file mode 100644 index 0000000..9aaa45a --- /dev/null +++ b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m @@ -0,0 +1,1125 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageWebPCoder.h" + +#if __has_include("webp/decode.h") && __has_include("webp/encode.h") && __has_include("webp/demux.h") && __has_include("webp/mux.h") +#import "webp/decode.h" +#import "webp/encode.h" +#import "webp/demux.h" +#import "webp/mux.h" +#elif __has_include() && __has_include() && __has_include() && __has_include() +#import +#import +#import +#import +#else +@import libwebp; +#endif + +#import + +/// Calculate the actual thumnail pixel size +static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio, CGSize thumbnailSize) { + CGFloat width = fullSize.width; + CGFloat height = fullSize.height; + CGFloat resultWidth; + CGFloat resultHeight; + + if (width == 0 || height == 0 || thumbnailSize.width == 0 || thumbnailSize.height == 0 || (width <= thumbnailSize.width && height <= thumbnailSize.height)) { + // Full Pixel + resultWidth = width; + resultHeight = height; + } else { + // Thumbnail + if (preserveAspectRatio) { + CGFloat pixelRatio = width / height; + CGFloat thumbnailRatio = thumbnailSize.width / thumbnailSize.height; + if (pixelRatio > thumbnailRatio) { + resultWidth = thumbnailSize.width; + resultHeight = ceil(thumbnailSize.width / pixelRatio); + } else { + resultHeight = thumbnailSize.height; + resultWidth = ceil(thumbnailSize.height * pixelRatio); + } + } else { + resultWidth = thumbnailSize.width; + resultHeight = thumbnailSize.height; + } + } + + return CGSizeMake(resultWidth, resultHeight); +} + +#ifndef SD_LOCK +#define SD_LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); +#endif + +#ifndef SD_UNLOCK +#define SD_UNLOCK(lock) dispatch_semaphore_signal(lock); +#endif + +@interface SDWebPCoderFrame : NSObject + +@property (nonatomic, assign) NSUInteger index; // Frame index (zero based) +@property (nonatomic, assign) NSTimeInterval duration; // Frame duration in seconds +@property (nonatomic, assign) NSUInteger width; // Frame width +@property (nonatomic, assign) NSUInteger height; // Frame height +@property (nonatomic, assign) NSUInteger offsetX; // Frame origin.x in canvas (left-bottom based) +@property (nonatomic, assign) NSUInteger offsetY; // Frame origin.y in canvas (left-bottom based) +@property (nonatomic, assign) BOOL hasAlpha; // Whether frame contains alpha +@property (nonatomic, assign) BOOL isFullSize; // Whether frame size is equal to canvas size +@property (nonatomic, assign) BOOL shouldBlend; // Frame dispose method +@property (nonatomic, assign) BOOL shouldDispose; // Frame blend operation +@property (nonatomic, assign) NSUInteger blendFromIndex; // The nearest previous frame index which blend mode is WEBP_MUX_BLEND + +@end + +@implementation SDWebPCoderFrame +@end + +@implementation SDImageWebPCoder { + WebPIDecoder *_idec; + WebPDemuxer *_demux; + NSData *_imageData; + CGFloat _scale; + NSUInteger _loopCount; + NSUInteger _frameCount; + NSArray *_frames; + CGContextRef _canvas; + CGColorSpaceRef _colorSpace; + BOOL _hasAnimation; + BOOL _hasAlpha; + BOOL _finished; + CGFloat _canvasWidth; + CGFloat _canvasHeight; + dispatch_semaphore_t _lock; + NSUInteger _currentBlendIndex; + BOOL _preserveAspectRatio; + CGSize _thumbnailSize; +} + +- (void)dealloc { + if (_idec) { + WebPIDelete(_idec); + _idec = NULL; + } + if (_demux) { + WebPDemuxDelete(_demux); + _demux = NULL; + } + if (_canvas) { + CGContextRelease(_canvas); + _canvas = NULL; + } + if (_colorSpace) { + CGColorSpaceRelease(_colorSpace); + _colorSpace = NULL; + } +} + ++ (instancetype)sharedCoder { + static SDImageWebPCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageWebPCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Decode +- (BOOL)canDecodeFromData:(nullable NSData *)data { + return ([NSData sd_imageFormatForImageData:data] == SDImageFormatWebP); +} + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return ([NSData sd_imageFormatForImageData:data] == SDImageFormatWebP); +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + + WebPData webpData; + WebPDataInit(&webpData); + webpData.bytes = data.bytes; + webpData.size = data.length; + WebPDemuxer *demuxer = WebPDemux(&webpData); + if (!demuxer) { + return nil; + } + + uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS); + BOOL hasAnimation = flags & ANIMATION_FLAG; + BOOL decodeFirstFrame = [options[SDImageCoderDecodeFirstFrameOnly] boolValue]; + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = [scaleFactor doubleValue]; + if (scale < 1) { + scale = 1; + } + } + + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + } + + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + + // for animated webp image + WebPIterator iter; + // libwebp's index start with 1 + if (!WebPDemuxGetFrame(demuxer, 1, &iter)) { + WebPDemuxReleaseIterator(&iter); + WebPDemuxDelete(demuxer); + return nil; + } + CGColorSpaceRef colorSpace = [self sd_createColorSpaceWithDemuxer:demuxer]; + int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH); + int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT); + // Check whether we need to use thumbnail + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(canvasWidth, canvasHeight), preserveAspectRatio, thumbnailSize); + + if (!hasAnimation || decodeFirstFrame) { + // first frame for animated webp image + CGImageRef imageRef = [self sd_createWebpImageWithData:iter.fragment colorSpace:colorSpace scaledSize:scaledSize]; + CGColorSpaceRelease(colorSpace); +#if SD_UIKIT || SD_WATCH + UIImage *firstFrameImage = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp]; +#else + UIImage *firstFrameImage = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp]; +#endif + firstFrameImage.sd_imageFormat = SDImageFormatWebP; + CGImageRelease(imageRef); + WebPDemuxReleaseIterator(&iter); + WebPDemuxDelete(demuxer); + return firstFrameImage; + } + + BOOL hasAlpha = flags & ALPHA_FLAG; + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + CGContextRef canvas = CGBitmapContextCreate(NULL, canvasWidth, canvasHeight, 8, 0, [SDImageCoderHelper colorSpaceGetDeviceRGB], bitmapInfo); + if (!canvas) { + WebPDemuxDelete(demuxer); + CGColorSpaceRelease(colorSpace); + return nil; + } + + int loopCount = WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT); + NSMutableArray *frames = [NSMutableArray array]; + + do { + @autoreleasepool { + CGImageRef imageRef = [self sd_drawnWebpImageWithCanvas:canvas iterator:iter colorSpace:colorSpace scaledSize:scaledSize]; + if (!imageRef) { + continue; + } + +#if SD_UIKIT || SD_WATCH + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(imageRef); + + NSTimeInterval duration = [self sd_frameDurationWithIterator:iter]; + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; + [frames addObject:frame]; + } + + } while (WebPDemuxNextFrame(&iter)); + + WebPDemuxReleaseIterator(&iter); + WebPDemuxDelete(demuxer); + CGContextRelease(canvas); + CGColorSpaceRelease(colorSpace); + + UIImage *animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames]; + animatedImage.sd_imageLoopCount = loopCount; + animatedImage.sd_imageFormat = SDImageFormatWebP; + + return animatedImage; +} + +#pragma mark - Progressive Decode +- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options { + self = [super init]; + if (self) { + // Progressive images need transparent, so always use premultiplied BGRA + _idec = WebPINewRGB(MODE_bgrA, NULL, 0, 0); + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = [scaleFactor doubleValue]; + if (scale < 1) { + scale = 1; + } + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; + _currentBlendIndex = NSNotFound; + _lock = dispatch_semaphore_create(1); + } + return self; +} + +- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished { + if (_finished) { + return; + } + _finished = finished; + // check whether we can detect Animated WebP or Static WebP, they need different codec (Demuxer or IDecoder) + if (!_hasAnimation) { + _imageData = [data copy]; + VP8StatusCode status = WebPIUpdate(_idec, _imageData.bytes, _imageData.length); + // For Static WebP, all things done. + // For Animated WebP (currently use `VP8_STATUS_UNSUPPORTED_FEATURE` to check), continue to create demuxer + if (status != VP8_STATUS_UNSUPPORTED_FEATURE) { + return; + } + _hasAnimation = YES; + } + // libwebp current have no API to update demuxer, so we always delete and recreate demuxer + // Use lock to avoid progressive animation decoding thread safe issue + SD_LOCK(_lock); + if (_demux) { + // next line `_imageData = nil` ARC will release the raw buffer, but need release the demuxer firstly because libwebp don't use retain/release rule + WebPDemuxDelete(_demux); + _demux = NULL; + } + _imageData = [data copy]; + WebPData webpData; + WebPDataInit(&webpData); + webpData.bytes = _imageData.bytes; + webpData.size = _imageData.length; + WebPDemuxState state; + _demux = WebPDemuxPartial(&webpData, &state); + SD_UNLOCK(_lock); + + if (_demux && state != WEBP_DEMUX_PARSE_ERROR) { + [self scanAndCheckFramesValidWithDemuxer:_demux]; + } +} + +- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options { + UIImage *image; + + // For Animated WebP Images, progressive decoding only return the first frame. + // If you want progressive animation, use the SDAniamtedCoder protocol method instead. + if (_demux) { + SD_LOCK(_lock); + image = [self safeStaticImageFrame]; + SD_UNLOCK(_lock); + image.sd_imageFormat = SDImageFormatWebP; + image.sd_isDecoded = YES; + return image; + } + + // For Static WebP images + int width = 0; + int height = 0; + int last_y = 0; + int stride = 0; + uint8_t *rgba = WebPIDecGetRGB(_idec, &last_y, &width, &height, &stride); + // last_y may be 0, means no enough bitmap data to decode, ignore this + if (width + height > 0 && last_y > 0 && height >= last_y) { + // Construct a UIImage from the decoded RGBA value array + size_t rgbaSize = last_y * stride; + CGDataProviderRef provider = + CGDataProviderCreateWithData(NULL, rgba, rgbaSize, NULL); + CGColorSpaceRef colorSpaceRef = [SDImageCoderHelper colorSpaceGetDeviceRGB]; + + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; + size_t components = 4; + CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; + // Why to use last_y for image height is because of libwebp's bug (https://bugs.chromium.org/p/webp/issues/detail?id=362) + // It will not keep memory barrier safe on x86 architechure (macOS & iPhone simulator) but on ARM architecture (iPhone & iPad & tv & watch) it works great + // If different threads use WebPIDecGetRGB to grab rgba bitmap, it will contain the previous decoded bitmap data + // So this will cause our drawed image looks strange(above is the current part but below is the previous part) + // We only grab the last_y height and draw the last_y height instead of total height image + // Besides fix, this can enhance performance since we do not need to create extra bitmap + CGImageRef imageRef = CGImageCreate(width, last_y, 8, components * 8, components * width, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent); + + CGDataProviderRelease(provider); + + if (!imageRef) { + return nil; + } + + CGContextRef canvas = CGBitmapContextCreate(NULL, width, height, 8, 0, [SDImageCoderHelper colorSpaceGetDeviceRGB], bitmapInfo); + if (!canvas) { + CGImageRelease(imageRef); + return nil; + } + + // Only draw the last_y image height, keep remains transparent, in Core Graphics coordinate system + CGContextDrawImage(canvas, CGRectMake(0, height - last_y, width, last_y), imageRef); + CGImageRef newImageRef = CGBitmapContextCreateImage(canvas); + CGImageRelease(imageRef); + if (!newImageRef) { + CGContextRelease(canvas); + return nil; + } + CGFloat scale = _scale; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = [scaleFactor doubleValue]; + if (scale < 1) { + scale = 1; + } + } + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(width, height), _preserveAspectRatio, _thumbnailSize); + // Check whether we need to use thumbnail + if (!CGSizeEqualToSize(CGSizeMake(width, height), scaledSize)) { + CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:newImageRef size:scaledSize]; + CGImageRelease(newImageRef); + newImageRef = scaledImageRef; + } + +#if SD_UIKIT || SD_WATCH + image = [[UIImage alloc] initWithCGImage:newImageRef scale:scale orientation:UIImageOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:newImageRef scale:scale orientation:kCGImagePropertyOrientationUp]; +#endif + image.sd_isDecoded = YES; // Already drawn on bitmap context above + image.sd_imageFormat = SDImageFormatWebP; + CGImageRelease(newImageRef); + CGContextRelease(canvas); + } + + return image; +} + +- (void)sd_blendWebpImageWithCanvas:(CGContextRef)canvas iterator:(WebPIterator)iter colorSpace:(nonnull CGColorSpaceRef)colorSpaceRef { + size_t canvasHeight = CGBitmapContextGetHeight(canvas); + CGFloat tmpX = iter.x_offset; + CGFloat tmpY = canvasHeight - iter.height - iter.y_offset; + CGRect imageRect = CGRectMake(tmpX, tmpY, iter.width, iter.height); + + if (iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) { + CGContextClearRect(canvas, imageRect); + } else { + CGImageRef imageRef = [self sd_createWebpImageWithData:iter.fragment colorSpace:colorSpaceRef scaledSize:CGSizeZero]; + if (!imageRef) { + return; + } + BOOL shouldBlend = iter.blend_method == WEBP_MUX_BLEND; + // If not blend, cover the target image rect. (firstly clear then draw) + if (!shouldBlend) { + CGContextClearRect(canvas, imageRect); + } + CGContextDrawImage(canvas, imageRect, imageRef); + CGImageRelease(imageRef); + } +} + +- (nullable CGImageRef)sd_drawnWebpImageWithCanvas:(CGContextRef)canvas iterator:(WebPIterator)iter colorSpace:(nonnull CGColorSpaceRef)colorSpaceRef scaledSize:(CGSize)scaledSize CF_RETURNS_RETAINED { + CGImageRef imageRef = [self sd_createWebpImageWithData:iter.fragment colorSpace:colorSpaceRef scaledSize:CGSizeZero]; + if (!imageRef) { + return nil; + } + + size_t canvasWidth = CGBitmapContextGetWidth(canvas); + size_t canvasHeight = CGBitmapContextGetHeight(canvas); + CGFloat tmpX = iter.x_offset; + CGFloat tmpY = canvasHeight - iter.height - iter.y_offset; + CGRect imageRect = CGRectMake(tmpX, tmpY, iter.width, iter.height); + + BOOL shouldBlend = iter.blend_method == WEBP_MUX_BLEND; + + // If not blend, cover the target image rect. (firstly clear then draw) + if (!shouldBlend) { + CGContextClearRect(canvas, imageRect); + } + CGContextDrawImage(canvas, imageRect, imageRef); + CGImageRef newImageRef = CGBitmapContextCreateImage(canvas); + + CGImageRelease(imageRef); + + if (iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) { + CGContextClearRect(canvas, imageRect); + } + + // Check whether we need to use thumbnail + if (!CGSizeEqualToSize(CGSizeMake(canvasWidth, canvasHeight), scaledSize)) { + // Important: For Animated WebP thumbnail generation, we can not just use a scaled small canvas and draw each thumbnail frame + // This works **On Theory**. However, image scale down loss details. Animated WebP use the partial pixels with blend mode / dispose method with offset, to cover previous canvas status + // Because of this reason, even each frame contains small zigzag, the final animation contains visible glitch, this is not we want. + // So, always create the full pixels canvas (even though this consume more RAM), after drawn on the canvas, re-scale again with the final size + CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:newImageRef size:scaledSize]; + CGImageRelease(newImageRef); + newImageRef = scaledImageRef; + } + + return newImageRef; +} + +- (nullable CGImageRef)sd_createWebpImageWithData:(WebPData)webpData colorSpace:(nonnull CGColorSpaceRef)colorSpaceRef scaledSize:(CGSize)scaledSize CF_RETURNS_RETAINED { + WebPDecoderConfig config; + if (!WebPInitDecoderConfig(&config)) { + return nil; + } + + if (WebPGetFeatures(webpData.bytes, webpData.size, &config.input) != VP8_STATUS_OK) { + return nil; + } + + BOOL hasAlpha = config.input.has_alpha; + // iOS prefer BGRA8888 (premultiplied) or BGRX8888 bitmapInfo for screen rendering, which is same as `UIGraphicsBeginImageContext()` or `- [CALayer drawInContext:]` + // use this bitmapInfo, combined with right colorspace, even without decode, can still avoid extra CA::Render::copy_image(which marked `Color Copied Images` from Instruments) + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + config.options.use_threads = 1; + config.output.colorspace = MODE_bgrA; + + // Use scaling for thumbnail + if (scaledSize.width != 0 && scaledSize.height != 0) { + config.options.use_scaling = 1; + config.options.scaled_width = scaledSize.width; + config.options.scaled_height = scaledSize.height; + } + + // Decode the WebP image data into a RGBA value array + if (WebPDecode(webpData.bytes, webpData.size, &config) != VP8_STATUS_OK) { + return nil; + } + + // Construct a UIImage from the decoded RGBA value array + CGDataProviderRef provider = + CGDataProviderCreateWithData(NULL, config.output.u.RGBA.rgba, config.output.u.RGBA.size, FreeImageData); + size_t bitsPerComponent = 8; + size_t bitsPerPixel = 32; + size_t bytesPerRow = config.output.u.RGBA.stride; + size_t width = config.output.width; + size_t height = config.output.height; + CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; + CGImageRef imageRef = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent); + + CGDataProviderRelease(provider); + + return imageRef; +} + +- (NSTimeInterval)sd_frameDurationWithIterator:(WebPIterator)iter { + int duration = iter.duration; + if (duration <= 10) { + // WebP standard says 0 duration is used for canvas updating but not showing image, but actually Chrome and other implementations set it to 100ms if duration is lower or equal than 10ms + // Some animated WebP images also created without duration, we should keep compatibility + duration = 100; + } + return duration / 1000.0; +} + +// Create and return the correct colorspace by checking the ICC Profile +- (nonnull CGColorSpaceRef)sd_createColorSpaceWithDemuxer:(nonnull WebPDemuxer *)demuxer CF_RETURNS_RETAINED { + // WebP contains ICC Profile should use the desired colorspace, instead of default device colorspace + // See: https://developers.google.com/speed/webp/docs/riff_container#color_profile + + CGColorSpaceRef colorSpaceRef = NULL; + uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS); + + if (flags & ICCP_FLAG) { + WebPChunkIterator chunk_iter; + int result = WebPDemuxGetChunk(demuxer, "ICCP", 1, &chunk_iter); + if (result) { + // See #2618, the `CGColorSpaceCreateWithICCProfile` does not copy ICC Profile data, it only retain `CFDataRef`. + // When the libwebp `WebPDemuxer` dealloc, all chunks will be freed. So we must copy the ICC data (really cheap, less than 10KB) + NSData *profileData = [NSData dataWithBytes:chunk_iter.chunk.bytes length:chunk_iter.chunk.size]; + if (@available(iOS 10, tvOS 10, macOS 10.12, watchOS 3, *)) { + colorSpaceRef = CGColorSpaceCreateWithICCData((__bridge CFDataRef)profileData); + } else { + colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData); + } + WebPDemuxReleaseChunkIterator(&chunk_iter); + if (colorSpaceRef) { + // We use RGB color model to decode WebP images currently, so we must filter out other colorSpace + CGColorSpaceModel model = CGColorSpaceGetModel(colorSpaceRef); + if (model != kCGColorSpaceModelRGB) { + CGColorSpaceRelease(colorSpaceRef); + colorSpaceRef = NULL; + } + } + } + } + + if (!colorSpaceRef) { + colorSpaceRef = [SDImageCoderHelper colorSpaceGetDeviceRGB]; + CGColorSpaceRetain(colorSpaceRef); + } + + return colorSpaceRef; +} + +#pragma mark - Encode +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + return (format == SDImageFormatWebP); +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + + NSData *data; + + double compressionQuality = 1; + if (options[SDImageCoderEncodeCompressionQuality]) { + compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue]; + } + CGSize maxPixelSize = CGSizeZero; + NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize]; + if (maxPixelSizeValue != nil) { +#if SD_MAC + maxPixelSize = maxPixelSizeValue.sizeValue; +#else + maxPixelSize = maxPixelSizeValue.CGSizeValue; +#endif + } + NSUInteger maxFileSize = 0; + if (options[SDImageCoderEncodeMaxFileSize]) { + maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue]; + } + NSArray *frames = [SDImageCoderHelper framesFromAnimatedImage:image]; + + BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue]; + if (encodeFirstFrame || frames.count == 0) { + // for static single webp image + data = [self sd_encodedWebpDataWithImage:image.CGImage quality:compressionQuality maxPixelSize:maxPixelSize maxFileSize:maxFileSize]; + } else { + // for animated webp image + WebPMux *mux = WebPMuxNew(); + if (!mux) { + return nil; + } + for (size_t i = 0; i < frames.count; i++) { + SDImageFrame *currentFrame = frames[i]; + NSData *webpData = [self sd_encodedWebpDataWithImage:currentFrame.image.CGImage quality:compressionQuality maxPixelSize:maxPixelSize maxFileSize:maxFileSize]; + int duration = currentFrame.duration * 1000; + WebPMuxFrameInfo frame = { .bitstream.bytes = webpData.bytes, + .bitstream.size = webpData.length, + .duration = duration, + .id = WEBP_CHUNK_ANMF, + .dispose_method = WEBP_MUX_DISPOSE_BACKGROUND, // each frame will clear canvas + .blend_method = WEBP_MUX_NO_BLEND + }; + if (WebPMuxPushFrame(mux, &frame, 0) != WEBP_MUX_OK) { + WebPMuxDelete(mux); + return nil; + } + } + + int loopCount = (int)image.sd_imageLoopCount; + WebPMuxAnimParams params = { .bgcolor = 0, + .loop_count = loopCount + }; + if (WebPMuxSetAnimationParams(mux, ¶ms) != WEBP_MUX_OK) { + WebPMuxDelete(mux); + return nil; + } + + WebPData outputData; + WebPMuxError error = WebPMuxAssemble(mux, &outputData); + WebPMuxDelete(mux); + if (error != WEBP_MUX_OK) { + return nil; + } + data = [NSData dataWithBytes:outputData.bytes length:outputData.size]; + WebPDataClear(&outputData); + } + + return data; +} + +- (nullable NSData *)sd_encodedWebpDataWithImage:(nullable CGImageRef)imageRef quality:(double)quality maxPixelSize:(CGSize)maxPixelSize maxFileSize:(NSUInteger)maxFileSize { + NSData *webpData; + if (!imageRef) { + return nil; + } + + size_t width = CGImageGetWidth(imageRef); + size_t height = CGImageGetHeight(imageRef); + if (width == 0 || width > WEBP_MAX_DIMENSION) { + return nil; + } + if (height == 0 || height > WEBP_MAX_DIMENSION) { + return nil; + } + + size_t bytesPerRow = CGImageGetBytesPerRow(imageRef); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + CGImageAlphaInfo alphaInfo = bitmapInfo & kCGBitmapAlphaInfoMask; + CGBitmapInfo byteOrderInfo = bitmapInfo & kCGBitmapByteOrderMask; + BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || + alphaInfo == kCGImageAlphaNoneSkipFirst || + alphaInfo == kCGImageAlphaNoneSkipLast); + BOOL byteOrderNormal = NO; + switch (byteOrderInfo) { + case kCGBitmapByteOrderDefault: { + byteOrderNormal = YES; + } break; + case kCGBitmapByteOrder32Little: { + } break; + case kCGBitmapByteOrder32Big: { + byteOrderNormal = YES; + } break; + default: break; + } + // If we can not get bitmap buffer, early return + CGDataProviderRef dataProvider = CGImageGetDataProvider(imageRef); + if (!dataProvider) { + return nil; + } + CFDataRef dataRef = CGDataProviderCopyData(dataProvider); + if (!dataRef) { + return nil; + } + + uint8_t *rgba = NULL; // RGBA Buffer managed by CFData, don't call `free` on it, instead call `CFRelease` on `dataRef` + // We could not assume that input CGImage's color mode is always RGB888/RGBA8888. Convert all other cases to target color mode using vImage + if (byteOrderNormal && ((alphaInfo == kCGImageAlphaNone) || (alphaInfo == kCGImageAlphaLast))) { + // If the input CGImage is already RGB888/RGBA8888 + rgba = (uint8_t *)CFDataGetBytePtr(dataRef); + } else { + // Convert all other cases to target color mode using vImage + vImageConverterRef convertor = NULL; + vImage_Error error = kvImageNoError; + + vImage_CGImageFormat srcFormat = { + .bitsPerComponent = (uint32_t)CGImageGetBitsPerComponent(imageRef), + .bitsPerPixel = (uint32_t)CGImageGetBitsPerPixel(imageRef), + .colorSpace = CGImageGetColorSpace(imageRef), + .bitmapInfo = bitmapInfo + }; + vImage_CGImageFormat destFormat = { + .bitsPerComponent = 8, + .bitsPerPixel = hasAlpha ? 32 : 24, + .colorSpace = [SDImageCoderHelper colorSpaceGetDeviceRGB], + .bitmapInfo = hasAlpha ? kCGImageAlphaLast | kCGBitmapByteOrderDefault : kCGImageAlphaNone | kCGBitmapByteOrderDefault // RGB888/RGBA8888 (Non-premultiplied to works for libwebp) + }; + + convertor = vImageConverter_CreateWithCGImageFormat(&srcFormat, &destFormat, NULL, kvImageNoFlags, &error); + if (error != kvImageNoError) { + CFRelease(dataRef); + return nil; + } + + vImage_Buffer src = { + .data = (uint8_t *)CFDataGetBytePtr(dataRef), + .width = width, + .height = height, + .rowBytes = bytesPerRow + }; + vImage_Buffer dest; + + error = vImageBuffer_Init(&dest, height, width, destFormat.bitsPerPixel, kvImageNoFlags); + if (error != kvImageNoError) { + vImageConverter_Release(convertor); + CFRelease(dataRef); + return nil; + } + + // Convert input color mode to RGB888/RGBA8888 + error = vImageConvert_AnyToAny(convertor, &src, &dest, NULL, kvImageNoFlags); + vImageConverter_Release(convertor); + if (error != kvImageNoError) { + CFRelease(dataRef); + return nil; + } + + rgba = dest.data; // Converted buffer + bytesPerRow = dest.rowBytes; // Converted bytePerRow + CFRelease(dataRef); // Use CFData to manage bytes for free, the same code path for error handling + dataRef = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, rgba, bytesPerRow * height, kCFAllocatorDefault); + } + + float qualityFactor = quality * 100; // WebP quality is 0-100 + // Encode RGB888/RGBA8888 buffer to WebP data + // Using the libwebp advanced API: https://developers.google.com/speed/webp/docs/api#advanced_encoding_api + WebPConfig config; + WebPPicture picture; + WebPMemoryWriter writer; + + if (!WebPConfigPreset(&config, WEBP_PRESET_DEFAULT, qualityFactor) || + !WebPPictureInit(&picture)) { + // shouldn't happen, except if system installation is broken + CFRelease(dataRef); + return nil; + } + + config.target_size = (int)maxFileSize; // Max filesize for output, 0 means use quality instead + config.pass = maxFileSize > 0 ? 6 : 1; // Use 6 passes for file size limited encoding, which is the default value of `cwebp` command line + config.thread_level = 1; // Thread encoding for fast + config.lossless = 0; // Disable lossless encoding (If we need, can add new Encoding Options in future version) + picture.use_argb = 0; // Lossy encoding use YUV for internel bitstream + picture.width = (int)width; + picture.height = (int)height; + picture.writer = WebPMemoryWrite; // Output in memory data buffer + picture.custom_ptr = &writer; + WebPMemoryWriterInit(&writer); + + int result; + if (hasAlpha) { + result = WebPPictureImportRGBA(&picture, rgba, (int)bytesPerRow); + } else { + result = WebPPictureImportRGB(&picture, rgba, (int)bytesPerRow); + } + if (!result) { + WebPMemoryWriterClear(&writer); + CFRelease(dataRef); + return nil; + } + + // Check if need to scale pixel size + if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && width > maxPixelSize.width && height > maxPixelSize.height) { + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(width, height), YES, maxPixelSize); + result = WebPPictureRescale(&picture, scaledSize.width, scaledSize.height); + if (!result) { + WebPMemoryWriterClear(&writer); + WebPPictureFree(&picture); + CFRelease(dataRef); + return nil; + } + } + + result = WebPEncode(&config, &picture); + WebPPictureFree(&picture); + CFRelease(dataRef); // Free bitmap buffer + + if (result) { + // success + webpData = [NSData dataWithBytes:writer.mem length:writer.size]; + } else { + // failed + webpData = nil; + } + WebPMemoryWriterClear(&writer); + + return webpData; +} + +static void FreeImageData(void *info, const void *data, size_t size) { + free((void *)data); +} + +#pragma mark - SDAnimatedImageCoder +- (instancetype)initWithAnimatedImageData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + if (self) { + WebPData webpData; + WebPDataInit(&webpData); + webpData.bytes = data.bytes; + webpData.size = data.length; + WebPDemuxer *demuxer = WebPDemux(&webpData); + if (!demuxer) { + return nil; + } + BOOL framesValid = [self scanAndCheckFramesValidWithDemuxer:demuxer]; + if (!framesValid) { + WebPDemuxDelete(demuxer); + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = [scaleFactor doubleValue]; + if (scale < 1) { + scale = 1; + } + } + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; + _scale = scale; + _demux = demuxer; + _imageData = data; + _currentBlendIndex = NSNotFound; + _lock = dispatch_semaphore_create(1); + } + return self; +} + +- (BOOL)scanAndCheckFramesValidWithDemuxer:(WebPDemuxer *)demuxer { + if (!demuxer) { + return NO; + } + WebPIterator iter; + if (!WebPDemuxGetFrame(demuxer, 1, &iter)) { + WebPDemuxReleaseIterator(&iter); + return NO; + } + + uint32_t iterIndex = 0; + uint32_t lastBlendIndex = 0; + uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS); + BOOL hasAnimation = flags & ANIMATION_FLAG; + BOOL hasAlpha = flags & ALPHA_FLAG; + int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH); + int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT); + uint32_t frameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT); + uint32_t loopCount = WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT); + NSMutableArray *frames = [NSMutableArray array]; + + _hasAnimation = hasAnimation; + _hasAlpha = hasAlpha; + _canvasWidth = canvasWidth; + _canvasHeight = canvasHeight; + _frameCount = frameCount; + _loopCount = loopCount; + + // If static WebP, does not need to parse the frame blend index + if (frameCount <= 1) { + return YES; + } + + // We should loop all the frames and scan each frames' blendFromIndex for later decoding, this can also ensure all frames is valid + do { + if (!iter.complete) { + // Skip partial frame + continue; + } + SDWebPCoderFrame *frame = [[SDWebPCoderFrame alloc] init]; + frame.index = iterIndex; + frame.duration = [self sd_frameDurationWithIterator:iter]; + frame.width = iter.width; + frame.height = iter.height; + frame.hasAlpha = iter.has_alpha; + frame.shouldDispose = iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND; + frame.shouldBlend = iter.blend_method == WEBP_MUX_BLEND; + frame.offsetX = iter.x_offset; + frame.offsetY = canvasHeight - iter.y_offset - iter.height; + + BOOL sizeEqualsToCanvas = (iter.width == canvasWidth && iter.height == canvasHeight); + BOOL offsetIsZero = (iter.x_offset == 0 && iter.y_offset == 0); + frame.isFullSize = (sizeEqualsToCanvas && offsetIsZero); + + if ((!frame.shouldBlend || !frame.hasAlpha) && frame.isFullSize) { + lastBlendIndex = iterIndex; + frame.blendFromIndex = iterIndex; + } else { + if (frame.shouldDispose && frame.isFullSize) { + frame.blendFromIndex = lastBlendIndex; + lastBlendIndex = iterIndex + 1; + } else { + frame.blendFromIndex = lastBlendIndex; + } + } + iterIndex++; + [frames addObject:frame]; + } while (WebPDemuxNextFrame(&iter)); + WebPDemuxReleaseIterator(&iter); + + if (frames.count != frameCount) { + return NO; + } + _frames = [frames copy]; + + return YES; +} + +- (NSData *)animatedImageData { + return _imageData; +} + +- (NSUInteger)animatedImageLoopCount { + return _loopCount; +} + +- (NSUInteger)animatedImageFrameCount { + return _frameCount; +} + +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index { + if (index >= _frameCount) { + return 0; + } + if (_frameCount <= 1) { + return 0; + } + return _frames[index].duration; +} + +- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index { + UIImage *image; + if (index >= _frameCount) { + return nil; + } + SD_LOCK(_lock); + if (_frameCount <= 1) { + image = [self safeStaticImageFrame]; + } else { + image = [self safeAnimatedImageFrameAtIndex:index]; + } + SD_UNLOCK(_lock); + return image; +} + +- (UIImage *)safeStaticImageFrame { + UIImage *image; + // Static WebP image + WebPIterator iter; + if (!WebPDemuxGetFrame(_demux, 1, &iter)) { + WebPDemuxReleaseIterator(&iter); + return nil; + } + if (!_colorSpace) { + _colorSpace = [self sd_createColorSpaceWithDemuxer:_demux]; + } + // Check whether we need to use thumbnail + CGImageRef imageRef; + if (_hasAnimation) { + // If have animation, we still need to allocate a CGContext, because the poster frame may be smaller than canvas + if (!_canvas) { + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= _hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + CGContextRef canvas = CGBitmapContextCreate(NULL, _canvasWidth, _canvasHeight, 8, 0, [SDImageCoderHelper colorSpaceGetDeviceRGB], bitmapInfo); + if (!canvas) { + return nil; + } + _canvas = canvas; + } + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(_canvasWidth, _canvasHeight), _preserveAspectRatio, _thumbnailSize); + imageRef = [self sd_drawnWebpImageWithCanvas:_canvas iterator:iter colorSpace:_colorSpace scaledSize:scaledSize]; + } else { + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(iter.width, iter.height), _preserveAspectRatio, _thumbnailSize); + imageRef = [self sd_createWebpImageWithData:iter.fragment colorSpace:_colorSpace scaledSize:scaledSize]; + } + if (!imageRef) { + return nil; + } +#if SD_UIKIT || SD_WATCH + image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:UIImageOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(imageRef); + WebPDemuxReleaseIterator(&iter); + return image; +} + +- (UIImage *)safeAnimatedImageFrameAtIndex:(NSUInteger)index { + if (!_canvas) { + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= _hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; + CGContextRef canvas = CGBitmapContextCreate(NULL, _canvasWidth, _canvasHeight, 8, 0, [SDImageCoderHelper colorSpaceGetDeviceRGB], bitmapInfo); + if (!canvas) { + return nil; + } + _canvas = canvas; + } + if (!_colorSpace) { + _colorSpace = [self sd_createColorSpaceWithDemuxer:_demux]; + } + + SDWebPCoderFrame *frame = _frames[index]; + UIImage *image; + WebPIterator iter; + + // Because Animated WebP supports dispose method, which means frames can based on previous canvas context. However, if we clear canvas and loop from the 0 index until the request index, it's harm for performance. + // But when one frame's dispose method is `WEBP_MUX_DISPOSE_BACKGROUND`, the canvas is cleared after the frame decoded. And subsequent frames are not effected by that frame. + // So, we calculate each frame's `blendFromIndex`. Then directly draw canvas from that index, instead of always from 0 index. + + if (_currentBlendIndex != NSNotFound && _currentBlendIndex + 1 == index) { + // If the request index is subsequence of current blend index, it does not matter what dispose method is. The canvas is always ready. + // libwebp's index start with 1 + if (!WebPDemuxGetFrame(_demux, (int)(index + 1), &iter)) { + WebPDemuxReleaseIterator(&iter); + return nil; + } + } else { + // Else, this can happen when one image set to different imageViews or one loop end. So we should clear the canvas. Then draw until the canvas is ready. + if (_currentBlendIndex != NSNotFound) { + CGContextClearRect(_canvas, CGRectMake(0, 0, _canvasWidth, _canvasHeight)); + } + + // Then, loop from the blend from index, draw each of previous frames on the canvas. + // We use do while loop to call `WebPDemuxNextFrame`(fast), until the endIndex meet. + size_t startIndex = frame.blendFromIndex; + size_t endIndex = frame.index; + // libwebp's index start with 1 + if (!WebPDemuxGetFrame(_demux, (int)(startIndex + 1), &iter)) { + WebPDemuxReleaseIterator(&iter); + return nil; + } + // Draw from range: [startIndex, endIndex) + if (endIndex > startIndex) { + do { + @autoreleasepool { + [self sd_blendWebpImageWithCanvas:_canvas iterator:iter colorSpace:_colorSpace]; + } + } while ((size_t)iter.frame_num < endIndex && WebPDemuxNextFrame(&iter)); + } + // libwebp's index start with 1 + if (!WebPDemuxGetFrame(_demux, (int)(index + 1), &iter)) { + WebPDemuxReleaseIterator(&iter); + return nil; + } + } + _currentBlendIndex = index; + + // Now the canvas is ready, which respects of dispose method behavior. Just do normal decoding and produce image. + // Check whether we need to use thumbnail + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(_canvasWidth, _canvasHeight), _preserveAspectRatio, _thumbnailSize); + CGImageRef imageRef = [self sd_drawnWebpImageWithCanvas:_canvas iterator:iter colorSpace:_colorSpace scaledSize:scaledSize]; + if (!imageRef) { + return nil; + } +#if SD_UIKIT || SD_WATCH + image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:UIImageOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(imageRef); + + WebPDemuxReleaseIterator(&iter); + return image; +} + +@end diff --git a/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.h b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.h new file mode 100644 index 0000000..068b305 --- /dev/null +++ b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.h @@ -0,0 +1,27 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#if __has_include() +#import +#else +@import SDWebImage; +#endif + +// This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder` +@interface UIImage (WebP) + +/** + Create a image from the WebP data. + This will create animated image if the data is Animated WebP. And will create a static image is the data is Static WebP. + + @param data The WebP data + @return The created image + */ ++ (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data; + +@end diff --git a/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.m b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.m new file mode 100644 index 0000000..e0ab8f8 --- /dev/null +++ b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Classes/UIImage+WebP.m @@ -0,0 +1,21 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+WebP.h" +#import "SDImageWebPCoder.h" + +@implementation UIImage (WebP) + ++ (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data { + if (!data) { + return nil; + } + return [[SDImageWebPCoder sharedCoder] decodedImageWithData:data options:0]; +} + +@end diff --git a/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h new file mode 100644 index 0000000..d0c0797 --- /dev/null +++ b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.h @@ -0,0 +1,15 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +FOUNDATION_EXPORT double SDWebImageWebPCoderVersionNumber; +FOUNDATION_EXPORT const unsigned char SDWebImageWebPCoderVersionString[]; + +#import +#import diff --git a/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.modulemap b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.modulemap new file mode 100644 index 0000000..13d57d4 --- /dev/null +++ b/Pods/SDWebImageWebPCoder/SDWebImageWebPCoder/Module/SDWebImageWebPCoder.modulemap @@ -0,0 +1,6 @@ +framework module SDWebImageWebPCoder { + umbrella header "SDWebImageWebPCoder.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.markdown b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.markdown index 41217bb..65a46ac 100644 --- a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.markdown +++ b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.markdown @@ -3,7 +3,7 @@ This application makes use of the following third party libraries: ## SDWebImage -Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com +Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -25,6 +25,29 @@ THE SOFTWARE. +## SDWebImageWebPCoder + +Copyright (c) 2018 Bogdan Poplauschi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + ## libwebp Copyright (c) 2010, Google Inc. All rights reserved. diff --git a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.plist b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.plist index 2129f17..dd231b5 100644 --- a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.plist +++ b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-acknowledgements.plist @@ -14,7 +14,7 @@ FooterText - Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com + Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -35,11 +35,42 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + License + MIT Title SDWebImage Type PSGroupSpecifier + + FooterText + Copyright (c) 2018 Bogdan Poplauschi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + License + MIT + Title + SDWebImageWebPCoder + Type + PSGroupSpecifier + FooterText Copyright (c) 2010, Google Inc. All rights reserved. @@ -73,6 +104,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + License + BSD Title libwebp Type diff --git a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.debug.xcconfig b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.debug.xcconfig index a8f862b..5d6ebff 100644 --- a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.debug.xcconfig +++ b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.debug.xcconfig @@ -1,9 +1,10 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) SD_WEBP=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/libwebp" -LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" "$PODS_CONFIGURATION_BUILD_DIR/libwebp" -OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/libwebp" -OTHER_LDFLAGS = $(inherited) -ObjC -l"SDWebImage" -l"libwebp" -framework "ImageIO" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SDWebImageWebPCoder" "${PODS_ROOT}/Headers/Public/libwebp" +LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageWebPCoder" "${PODS_CONFIGURATION_BUILD_DIR}/libwebp" +OTHER_LDFLAGS = $(inherited) -ObjC -l"SDWebImage" -l"SDWebImageWebPCoder" -l"libwebp" -framework "ImageIO" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/libwebp/src +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.release.xcconfig b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.release.xcconfig index a8f862b..5d6ebff 100644 --- a/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.release.xcconfig +++ b/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP.release.xcconfig @@ -1,9 +1,10 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) SD_WEBP=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/libwebp" -LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" "$PODS_CONFIGURATION_BUILD_DIR/libwebp" -OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/libwebp" -OTHER_LDFLAGS = $(inherited) -ObjC -l"SDWebImage" -l"libwebp" -framework "ImageIO" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SDWebImageWebPCoder" "${PODS_ROOT}/Headers/Public/libwebp" +LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageWebPCoder" "${PODS_CONFIGURATION_BUILD_DIR}/libwebp" +OTHER_LDFLAGS = $(inherited) -ObjC -l"SDWebImage" -l"SDWebImageWebPCoder" -l"libwebp" -framework "ImageIO" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/libwebp/src +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch b/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch index aa992a4..beb2a24 100644 --- a/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch +++ b/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch @@ -1,4 +1,12 @@ #ifdef __OBJC__ #import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif #endif diff --git a/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig b/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig new file mode 100644 index 0000000..864e1b7 --- /dev/null +++ b/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig @@ -0,0 +1,12 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +SUPPORTS_MACCATALYST = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig b/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig new file mode 100644 index 0000000..864e1b7 --- /dev/null +++ b/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig @@ -0,0 +1,12 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +SUPPORTS_MACCATALYST = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-dummy.m b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-dummy.m new file mode 100644 index 0000000..46650d1 --- /dev/null +++ b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SDWebImageWebPCoder : NSObject +@end +@implementation PodsDummy_SDWebImageWebPCoder +@end diff --git a/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-prefix.pch b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.debug.xcconfig b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.debug.xcconfig new file mode 100644 index 0000000..ea75684 --- /dev/null +++ b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.debug.xcconfig @@ -0,0 +1,11 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageWebPCoder +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) SD_WEBP=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImageWebPCoder" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SDWebImageWebPCoder" "${PODS_ROOT}/Headers/Public/libwebp" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImageWebPCoder +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/libwebp/src +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.release.xcconfig b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.release.xcconfig new file mode 100644 index 0000000..ea75684 --- /dev/null +++ b/Pods/Target Support Files/SDWebImageWebPCoder/SDWebImageWebPCoder.release.xcconfig @@ -0,0 +1,11 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageWebPCoder +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) SD_WEBP=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImageWebPCoder" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SDWebImageWebPCoder" "${PODS_ROOT}/Headers/Public/libwebp" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImageWebPCoder +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/libwebp/src +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/libwebp/libwebp-prefix.pch b/Pods/Target Support Files/libwebp/libwebp-prefix.pch index aa992a4..beb2a24 100644 --- a/Pods/Target Support Files/libwebp/libwebp-prefix.pch +++ b/Pods/Target Support Files/libwebp/libwebp-prefix.pch @@ -1,4 +1,12 @@ #ifdef __OBJC__ #import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif #endif diff --git a/Pods/Target Support Files/libwebp/libwebp.debug.xcconfig b/Pods/Target Support Files/libwebp/libwebp.debug.xcconfig new file mode 100644 index 0000000..3d5bdfe --- /dev/null +++ b/Pods/Target Support Files/libwebp/libwebp.debug.xcconfig @@ -0,0 +1,11 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/libwebp +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/libwebp" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/libwebp" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/libwebp +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USER_HEADER_SEARCH_PATHS = $(inherited) ${PODS_ROOT}/libwebp/ ${PODS_TARGET_SRCROOT}/ +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/libwebp/libwebp.release.xcconfig b/Pods/Target Support Files/libwebp/libwebp.release.xcconfig new file mode 100644 index 0000000..3d5bdfe --- /dev/null +++ b/Pods/Target Support Files/libwebp/libwebp.release.xcconfig @@ -0,0 +1,11 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/libwebp +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/libwebp" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/libwebp" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/libwebp +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USER_HEADER_SEARCH_PATHS = $(inherited) ${PODS_ROOT}/libwebp/ ${PODS_TARGET_SRCROOT}/ +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/libwebp/README b/Pods/libwebp/README index 4c15c4a..0592727 100644 --- a/Pods/libwebp/README +++ b/Pods/libwebp/README @@ -4,7 +4,7 @@ \__\__/\____/\_____/__/ ____ ___ / _/ / \ \ / _ \/ _/ / \_/ / / \ \ __/ \__ - \____/____/\_____/_____/____/v0.6.0 + \____/____/\_____/_____/____/v1.1.0 Description: ============ @@ -113,8 +113,8 @@ make install CMake: ------ -The support for CMake is minimal: it only helps you compile libwebp, cwebp and -dwebp. +With CMake, you can compile libwebp, cwebp, dwebp, gif2web, img2webp, webpinfo +and the JS bindings. Prerequisites: A compiler (e.g., gcc with autotools) and CMake. @@ -123,18 +123,27 @@ minimal build: $ sudo apt-get install build-essential cmake When building from git sources, you will need to run cmake to generate the -configure script. +makefiles. mkdir build && cd build && cmake ../ make make install -If you also want cwebp or dwebp, you will need to enable them through CMake: +If you also want any of the executables, you will need to enable them through +CMake, e.g.: cmake -DWEBP_BUILD_CWEBP=ON -DWEBP_BUILD_DWEBP=ON ../ or through your favorite interface (like ccmake or cmake-qt-gui). +Use option -DWEBP_UNICODE=ON for Unicode support on Windows (with chcp 65001). + +Finally, once installed, you can also use WebP in your CMake project by doing: + +find_package(WebP) + +which will define the CMake variables WebP_INCLUDE_DIRS and WebP_LIBRARIES. + Gradle: ------- The support for Gradle is minimal: it only helps you compile libwebp, cwebp and @@ -360,6 +369,23 @@ Use following options to convert into alternate image formats: -quiet ....... quiet mode, don't print anything -noasm ....... disable all assembly optimizations +WebP file analysis tool: +======================== + +'webpinfo' can be used to print out the chunk level structure and bitstream +header information of WebP files. It can also check if the files are of valid +WebP format. + +Usage: webpinfo [options] in_files +Note: there could be multiple input files; + options must come before input files. +Options: + -version ........... Print version number and exit. + -quiet ............. Do not show chunk parsing information. + -diag .............. Show parsing error diagnosis. + -summary ........... Show chunk stats summary. + -bitstream_info .... Parse bitstream header. + Visualization tool: =================== @@ -378,12 +404,14 @@ Options are: -nofilter .... disable in-loop filtering -dither dithering strength (0..100), default=50 -noalphadither disable alpha plane dithering + -usebgcolor .. display background color -mt .......... use multi-threading -info ........ print info -h ........... this help message Keyboard shortcuts: 'c' ................ toggle use of color profile + 'b' ................ toggle background color display 'i' ................ overlay file information 'd' ................ disable blending & disposal (debug) 'q' / 'Q' / ESC .... quit @@ -434,6 +462,7 @@ File-level options (only used at the start of compression): -mixed ............... use mixed lossy/lossless automatic mode -v ................... verbose mode -h ................... this help + -version ............. print version number and exit Per-frame options (only used for subsequent images input): -d ............. frame duration in ms (default: 100) @@ -445,6 +474,9 @@ Per-frame options (only used for subsequent images input): example: img2webp -loop 2 in0.png -lossy in1.jpg -d 80 in2.tiff -o out.webp +Note: if a single file name is passed as the argument, the arguments will be +tokenized from this file. The file name must not start with the character '-'. + Animated GIF conversion: ======================== Animated GIF files can be converted to WebP files with animation using the @@ -470,6 +502,8 @@ Options: -metadata ..... comma separated list of metadata to copy from the input to the output if present Valid values: all, none, icc, xmp (default) + -loop_compatibility .... use compatibility mode for Chrome + version prior to M62 (inclusive) -mt .................... use multi-threading if available -version ............... print version number and exit @@ -498,6 +532,11 @@ Options: -min_psnr ... minimum per-frame PSNR -raw_comparison ..... if this flag is not used, RGB is premultiplied before comparison + -max_diff ..... maximum allowed difference per channel + between corresponding pixels in subsequent + frames + -h .................. this help + -version ............ print version number and exit Building: --------- @@ -558,7 +597,7 @@ The encoding flow looks like: // Setup a config, starting form a preset and tuning some additional // parameters WebPConfig config; - if (!WebPConfigPreset(&config, WEBP_PRESET_PHOTO, quality_factor)) + if (!WebPConfigPreset(&config, WEBP_PRESET_PHOTO, quality_factor)) { return 0; // version error } // ... additional tuning diff --git a/Pods/libwebp/README.mux b/Pods/libwebp/README.mux index 04fedd1..22560fe 100644 --- a/Pods/libwebp/README.mux +++ b/Pods/libwebp/README.mux @@ -1,7 +1,7 @@  __ __ ____ ____ ____ __ __ _ __ __ / \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\ \ / __/ _ \ __/ / / (_/ /__ - \__\__/\_____/_____/__/ \__//_/\_____/__/___/v0.4.0 + \__\__/\_____/_____/__/ \__//_/\_____/__/___/v1.1.0 Description: @@ -33,6 +33,7 @@ Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT webpmux -info INPUT webpmux [-h|-help] webpmux -version + webpmux argument_file_name GET_OPTIONS: Extract relevant data: @@ -92,6 +93,9 @@ INPUT & OUTPUT are in WebP format. Note: The nature of EXIF, XMP and ICC data is not checked and is assumed to be valid. +Note: if a single file name is passed as the argument, the arguments will be +tokenized from this file. The file name must not start with the character '-'. + Visualization tool: =================== @@ -207,6 +211,35 @@ Code example: For a detailed AnimEncoder API reference, please refer to the header file (src/webp/mux.h). +AnimDecoder API: +================ +This AnimDecoder API allows decoding (possibly) animated WebP images. + +Code Example: + + WebPAnimDecoderOptions dec_options; + WebPAnimDecoderOptionsInit(&dec_options); + // Tune 'dec_options' as needed. + WebPAnimDecoder* dec = WebPAnimDecoderNew(webp_data, &dec_options); + WebPAnimInfo anim_info; + WebPAnimDecoderGetInfo(dec, &anim_info); + for (uint32_t i = 0; i < anim_info.loop_count; ++i) { + while (WebPAnimDecoderHasMoreFrames(dec)) { + uint8_t* buf; + int timestamp; + WebPAnimDecoderGetNext(dec, &buf, ×tamp); + // ... (Render 'buf' based on 'timestamp'). + // ... (Do NOT free 'buf', as it is owned by 'dec'). + } + WebPAnimDecoderReset(dec); + } + const WebPDemuxer* demuxer = WebPAnimDecoderGetDemuxer(dec); + // ... (Do something using 'demuxer'; e.g. get EXIF/XMP/ICC data). + WebPAnimDecoderDelete(dec); + +For a detailed AnimDecoder API reference, please refer to the header file +(src/webp/demux.h). + Bugs: ===== diff --git a/Pods/libwebp/README.webp_js b/Pods/libwebp/README.webp_js new file mode 100644 index 0000000..e78360c --- /dev/null +++ b/Pods/libwebp/README.webp_js @@ -0,0 +1,80 @@ + __ __ ____ ____ ____ __ ____ + / \\/ \ _ \ _ \ _ \ (__)/ __\ + \ / __/ _ \ __/ _) \_ \ + \__\__/_____/____/_/ /____/____/ + +Description: +============ + +This file describes the compilation of libwebp into a JavaScript decoder +using Emscripten and CMake. + + - install the Emscripten SDK following the procedure described at: + https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html + After installation, you should have some global variable positioned to the + location of the SDK. In particular, $EMSCRIPTEN should point to the + top-level directory containing Emscripten tools. + + - make sure the file $EMSCRIPTEN/cmake/Modules/Platform/Emscripten.cmake is + accessible. This is the toolchain file used by CMake to invoke Emscripten. + If $EMSCRIPTEN is unset search for Emscripten.cmake under $EMSDK and set + $EMSCRIPTEN accordingly, for example: + unix-like environments: export EMSCRIPTEN=$EMSDK/fastcomp/emscripten + windows: set EMSCRIPTEN=%EMSDK%\fastcomp\emscripten + + - configure the project 'WEBP_JS' with CMake using: + + cd webp_js && \ + cmake -DWEBP_BUILD_WEBP_JS=ON \ + -DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1 \ + -DCMAKE_TOOLCHAIN_FILE=$EMSCRIPTEN/cmake/Modules/Platform/Emscripten.cmake \ + ../ + + - compile webp.js using 'make'. + + - that's it! Upon completion, you should have the webp.js and + webp.js.mem files generated. + +The callable JavaScript function is WebPToSDL(), which decodes a raw WebP +bitstream into a canvas. See webp_js/index.html for a simple usage sample +(see below for instructions). + +Demo HTML page: +=============== + + The HTML page webp_js/index.html requires an HTTP server to serve the WebP + image example. It's easy to just use Python for that. + +cd webp_js && python -m SimpleHTTPServer 8080 + +and then navigate to http://localhost:8080 in your favorite browser. + + +Web-Assembly (WASM) version: +============================ + + CMakeLists.txt is configured to build the WASM version when using + the option WEBP_BUILD_WEBP_JS=ON. The compilation step will assemble + the files 'webp_wasm.js', 'webp_wasm.wasm' in the webp_js/ directory. + See webp_js/index_wasm.html for a simple demo page using the WASM version + of the library. + + You will need a fairly recent version of Emscripten (at least 1.37.8) and of + your WASM-enabled browser to run this version. Consider it very experimental! + +Caveat: +======= + + - First decoding using the library is usually slower, due to just-in-time + compilation. + + - Some versions of llvm produce the following compile error when SSE2 is + enabled. + +"Unsupported: %516 = bitcast <8 x i16> %481 to i128 + LLVM ERROR: BitCast Instruction not yet supported for integer types larger than 64 bits" + + The corresponding Emscripten bug is at: + https://github.com/kripken/emscripten/issues/3788 + + Therefore, SSE2 optimization is currently disabled in CMakeLists.txt. diff --git a/Pods/libwebp/src/Makefile.am b/Pods/libwebp/src/Makefile.am new file mode 100644 index 0000000..bcebf73 --- /dev/null +++ b/Pods/libwebp/src/Makefile.am @@ -0,0 +1,55 @@ +# The mux and demux libraries depend on libwebp, thus the '.' to force +# the build order so it's available to them. +SUBDIRS = dec enc dsp utils . +if BUILD_MUX + SUBDIRS += mux +endif +if BUILD_DEMUX + SUBDIRS += demux +endif + +lib_LTLIBRARIES = libwebp.la + +if BUILD_LIBWEBPDECODER + lib_LTLIBRARIES += libwebpdecoder.la +endif + +common_HEADERS = +common_HEADERS += webp/decode.h +common_HEADERS += webp/types.h +commondir = $(includedir)/webp + +libwebp_la_SOURCES = +libwebpinclude_HEADERS = +libwebpinclude_HEADERS += webp/encode.h + +noinst_HEADERS = +noinst_HEADERS += webp/format_constants.h + +libwebp_la_LIBADD = +libwebp_la_LIBADD += dec/libwebpdecode.la +libwebp_la_LIBADD += dsp/libwebpdsp.la +libwebp_la_LIBADD += enc/libwebpencode.la +libwebp_la_LIBADD += utils/libwebputils.la + +# Use '-no-undefined' to declare that libwebp does not depend on any libraries +# other than the ones listed on the command line, i.e., after linking, it will +# not have unresolved symbols. Some platforms (Windows among them) require all +# symbols in shared libraries to be resolved at library creation. +libwebp_la_LDFLAGS = -no-undefined -version-info 8:0:1 +libwebpincludedir = $(includedir)/webp +pkgconfig_DATA = libwebp.pc + +if BUILD_LIBWEBPDECODER + libwebpdecoder_la_SOURCES = + + libwebpdecoder_la_LIBADD = + libwebpdecoder_la_LIBADD += dec/libwebpdecode.la + libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la + libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la + + libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:0:1 + pkgconfig_DATA += libwebpdecoder.pc +endif + +${pkgconfig_DATA}: ${top_builddir}/config.status diff --git a/Pods/libwebp/src/dec/Makefile.am b/Pods/libwebp/src/dec/Makefile.am new file mode 100644 index 0000000..f8c6398 --- /dev/null +++ b/Pods/libwebp/src/dec/Makefile.am @@ -0,0 +1,29 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +noinst_LTLIBRARIES = libwebpdecode.la + +libwebpdecode_la_SOURCES = +libwebpdecode_la_SOURCES += alpha_dec.c +libwebpdecode_la_SOURCES += alphai_dec.h +libwebpdecode_la_SOURCES += buffer_dec.c +libwebpdecode_la_SOURCES += common_dec.h +libwebpdecode_la_SOURCES += vp8_dec.h +libwebpdecode_la_SOURCES += frame_dec.c +libwebpdecode_la_SOURCES += idec_dec.c +libwebpdecode_la_SOURCES += io_dec.c +libwebpdecode_la_SOURCES += quant_dec.c +libwebpdecode_la_SOURCES += tree_dec.c +libwebpdecode_la_SOURCES += vp8_dec.c +libwebpdecode_la_SOURCES += vp8i_dec.h +libwebpdecode_la_SOURCES += vp8l_dec.c +libwebpdecode_la_SOURCES += vp8li_dec.h +libwebpdecode_la_SOURCES += webp_dec.c +libwebpdecode_la_SOURCES += webpi_dec.h + +libwebpdecodeinclude_HEADERS = +libwebpdecodeinclude_HEADERS += ../webp/decode.h +libwebpdecodeinclude_HEADERS += ../webp/types.h +noinst_HEADERS = +noinst_HEADERS += ../webp/format_constants.h + +libwebpdecode_la_CPPFLAGS = $(AM_CPPFLAGS) +libwebpdecodeincludedir = $(includedir)/webp diff --git a/Pods/libwebp/src/dec/alpha_dec.c b/Pods/libwebp/src/dec/alpha_dec.c index 83ffd4b..bce735b 100644 --- a/Pods/libwebp/src/dec/alpha_dec.c +++ b/Pods/libwebp/src/dec/alpha_dec.c @@ -12,13 +12,13 @@ // Author: Skal (pascal.massimino@gmail.com) #include -#include "./alphai_dec.h" -#include "./vp8i_dec.h" -#include "./vp8li_dec.h" -#include "../dsp/dsp.h" -#include "../utils/quant_levels_dec_utils.h" -#include "../utils/utils.h" -#include "../webp/format_constants.h" +#include "src/dec/alphai_dec.h" +#include "src/dec/vp8i_dec.h" +#include "src/dec/vp8li_dec.h" +#include "src/dsp/dsp.h" +#include "src/utils/quant_levels_dec_utils.h" +#include "src/utils/utils.h" +#include "src/webp/format_constants.h" //------------------------------------------------------------------------------ // ALPHDecoder object. diff --git a/Pods/libwebp/src/dec/alphai_dec.h b/Pods/libwebp/src/dec/alphai_dec.h index 561e815..a64104a 100644 --- a/Pods/libwebp/src/dec/alphai_dec.h +++ b/Pods/libwebp/src/dec/alphai_dec.h @@ -11,11 +11,11 @@ // // Author: Urvang (urvang@google.com) -#ifndef WEBP_DEC_ALPHAI_H_ -#define WEBP_DEC_ALPHAI_H_ +#ifndef WEBP_DEC_ALPHAI_DEC_H_ +#define WEBP_DEC_ALPHAI_DEC_H_ -#include "./webpi_dec.h" -#include "../utils/filters_utils.h" +#include "src/dec/webpi_dec.h" +#include "src/utils/filters_utils.h" #ifdef __cplusplus extern "C" { @@ -51,4 +51,4 @@ void WebPDeallocateAlphaMemory(VP8Decoder* const dec); } // extern "C" #endif -#endif /* WEBP_DEC_ALPHAI_H_ */ +#endif // WEBP_DEC_ALPHAI_DEC_H_ diff --git a/Pods/libwebp/src/dec/buffer_dec.c b/Pods/libwebp/src/dec/buffer_dec.c index c685fd5..3cd94eb 100644 --- a/Pods/libwebp/src/dec/buffer_dec.c +++ b/Pods/libwebp/src/dec/buffer_dec.c @@ -13,15 +13,15 @@ #include -#include "./vp8i_dec.h" -#include "./webpi_dec.h" -#include "../utils/utils.h" +#include "src/dec/vp8i_dec.h" +#include "src/dec/webpi_dec.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // WebPDecBuffer // Number of bytes per pixel for the different color-spaces. -static const int kModeBpp[MODE_LAST] = { +static const uint8_t kModeBpp[MODE_LAST] = { 3, 4, 3, 4, 4, 2, 2, 4, 4, 4, 2, // pre-multiplied modes 1, 1 }; @@ -36,7 +36,7 @@ static int IsValidColorspace(int webp_csp_mode) { // strictly speaking, the very last (or first, if flipped) row // doesn't require padding. #define MIN_BUFFER_SIZE(WIDTH, HEIGHT, STRIDE) \ - (uint64_t)(STRIDE) * ((HEIGHT) - 1) + (WIDTH) + ((uint64_t)(STRIDE) * ((HEIGHT) - 1) + (WIDTH)) static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) { int ok = 1; @@ -74,7 +74,8 @@ static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) { } else { // RGB checks const WebPRGBABuffer* const buf = &buffer->u.RGBA; const int stride = abs(buf->stride); - const uint64_t size = MIN_BUFFER_SIZE(width, height, stride); + const uint64_t size = + MIN_BUFFER_SIZE(width * kModeBpp[mode], height, stride); ok &= (size <= buf->size); ok &= (stride >= width * kModeBpp[mode]); ok &= (buf->rgba != NULL); @@ -98,9 +99,14 @@ static VP8StatusCode AllocateBuffer(WebPDecBuffer* const buffer) { uint64_t uv_size = 0, a_size = 0, total_size; // We need memory and it hasn't been allocated yet. // => initialize output buffer, now that dimensions are known. - const int stride = w * kModeBpp[mode]; - const uint64_t size = (uint64_t)stride * h; + int stride; + uint64_t size; + if ((uint64_t)w * kModeBpp[mode] >= (1ull << 32)) { + return VP8_STATUS_INVALID_PARAM; + } + stride = w * kModeBpp[mode]; + size = (uint64_t)stride * h; if (!WebPIsRGBMode(mode)) { uv_stride = (w + 1) / 2; uv_size = (uint64_t)uv_stride * ((h + 1) / 2); @@ -169,11 +175,11 @@ VP8StatusCode WebPFlipBuffer(WebPDecBuffer* const buffer) { return VP8_STATUS_OK; } -VP8StatusCode WebPAllocateDecBuffer(int w, int h, +VP8StatusCode WebPAllocateDecBuffer(int width, int height, const WebPDecoderOptions* const options, - WebPDecBuffer* const out) { + WebPDecBuffer* const buffer) { VP8StatusCode status; - if (out == NULL || w <= 0 || h <= 0) { + if (buffer == NULL || width <= 0 || height <= 0) { return VP8_STATUS_INVALID_PARAM; } if (options != NULL) { // First, apply options if there is any. @@ -182,33 +188,39 @@ VP8StatusCode WebPAllocateDecBuffer(int w, int h, const int ch = options->crop_height; const int x = options->crop_left & ~1; const int y = options->crop_top & ~1; - if (x < 0 || y < 0 || cw <= 0 || ch <= 0 || x + cw > w || y + ch > h) { + if (x < 0 || y < 0 || cw <= 0 || ch <= 0 || + x + cw > width || y + ch > height) { return VP8_STATUS_INVALID_PARAM; // out of frame boundary. } - w = cw; - h = ch; + width = cw; + height = ch; } + if (options->use_scaling) { +#if !defined(WEBP_REDUCE_SIZE) int scaled_width = options->scaled_width; int scaled_height = options->scaled_height; if (!WebPRescalerGetScaledDimensions( - w, h, &scaled_width, &scaled_height)) { + width, height, &scaled_width, &scaled_height)) { return VP8_STATUS_INVALID_PARAM; } - w = scaled_width; - h = scaled_height; + width = scaled_width; + height = scaled_height; +#else + return VP8_STATUS_INVALID_PARAM; // rescaling not supported +#endif } } - out->width = w; - out->height = h; + buffer->width = width; + buffer->height = height; // Then, allocate buffer for real. - status = AllocateBuffer(out); + status = AllocateBuffer(buffer); if (status != VP8_STATUS_OK) return status; // Use the stride trick if vertical flip is needed. if (options != NULL && options->flip) { - status = WebPFlipBuffer(out); + status = WebPFlipBuffer(buffer); } return status; } diff --git a/Pods/libwebp/src/dec/common_dec.h b/Pods/libwebp/src/dec/common_dec.h index 6961e22..b158550 100644 --- a/Pods/libwebp/src/dec/common_dec.h +++ b/Pods/libwebp/src/dec/common_dec.h @@ -11,8 +11,8 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_DEC_COMMON_H_ -#define WEBP_DEC_COMMON_H_ +#ifndef WEBP_DEC_COMMON_DEC_H_ +#define WEBP_DEC_COMMON_DEC_H_ // intra prediction modes enum { B_DC_PRED = 0, // 4x4 modes @@ -51,4 +51,4 @@ enum { MB_FEATURE_TREE_PROBS = 3, NUM_PROBAS = 11 }; -#endif // WEBP_DEC_COMMON_H_ +#endif // WEBP_DEC_COMMON_DEC_H_ diff --git a/Pods/libwebp/src/dec/frame_dec.c b/Pods/libwebp/src/dec/frame_dec.c index f91e27f..04609a8 100644 --- a/Pods/libwebp/src/dec/frame_dec.c +++ b/Pods/libwebp/src/dec/frame_dec.c @@ -12,13 +12,13 @@ // Author: Skal (pascal.massimino@gmail.com) #include -#include "./vp8i_dec.h" -#include "../utils/utils.h" +#include "src/dec/vp8i_dec.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // Main reconstruction function. -static const int kScan[16] = { +static const uint16_t kScan[16] = { 0 + 0 * BPS, 4 + 0 * BPS, 8 + 0 * BPS, 12 + 0 * BPS, 0 + 4 * BPS, 4 + 4 * BPS, 8 + 4 * BPS, 12 + 4 * BPS, 0 + 8 * BPS, 4 + 8 * BPS, 8 + 8 * BPS, 12 + 8 * BPS, @@ -320,7 +320,7 @@ static void PrecomputeFilterStrengths(VP8Decoder* const dec) { #define MIN_DITHER_AMP 4 #define DITHER_AMP_TAB_SIZE 12 -static const int kQuantToDitherAmp[DITHER_AMP_TAB_SIZE] = { +static const uint8_t kQuantToDitherAmp[DITHER_AMP_TAB_SIZE] = { // roughly, it's dqm->uv_mat_[1] 8, 7, 6, 4, 4, 2, 2, 2, 1, 1, 1, 1 }; @@ -338,7 +338,6 @@ void VP8InitDithering(const WebPDecoderOptions* const options, for (s = 0; s < NUM_MB_SEGMENTS; ++s) { VP8QuantMatrix* const dqm = &dec->dqm_[s]; if (dqm->uv_quant_ < DITHER_AMP_TAB_SIZE) { - // TODO(skal): should we specially dither more for uv_quant_ < 0? const int idx = (dqm->uv_quant_ < 0) ? 0 : dqm->uv_quant_; dqm->dither_ = (f * kQuantToDitherAmp[idx]) >> 3; } @@ -400,7 +399,9 @@ static void DitherRow(VP8Decoder* const dec) { #define MACROBLOCK_VPOS(mb_y) ((mb_y) * 16) // vertical position of a MB // Finalize and transmit a complete row. Return false in case of user-abort. -static int FinishRow(VP8Decoder* const dec, VP8Io* const io) { +static int FinishRow(void* arg1, void* arg2) { + VP8Decoder* const dec = (VP8Decoder*)arg1; + VP8Io* const io = (VP8Io*)arg2; int ok = 1; const VP8ThreadContext* const ctx = &dec->thread_ctx_; const int cache_id = ctx->id_; @@ -448,10 +449,9 @@ static int FinishRow(VP8Decoder* const dec, VP8Io* const io) { if (y_end > io->crop_bottom) { y_end = io->crop_bottom; // make sure we don't overflow on last row. } + // If dec->alpha_data_ is not NULL, we have some alpha plane present. io->a = NULL; if (dec->alpha_data_ != NULL && y_start < y_end) { - // TODO(skal): testing presence of alpha with dec->alpha_data_ is not a - // good idea. io->a = VP8DecompressAlphaRows(dec, io, y_start, y_end - y_start); if (io->a == NULL) { return VP8SetError(dec, VP8_STATUS_BITSTREAM_ERROR, @@ -558,7 +558,6 @@ VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) { if (io->bypass_filtering) { dec->filter_type_ = 0; } - // TODO(skal): filter type / strength / sharpness forcing // Define the area where we can skip in-loop filtering, in case of cropping. // @@ -569,8 +568,6 @@ VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) { // Means: there's a dependency chain that goes all the way up to the // top-left corner of the picture (MB #0). We must filter all the previous // macroblocks. - // TODO(skal): add an 'approximate_decoding' option, that won't produce - // a 1:1 bit-exactness for complex filtering? { const int extra_pixels = kFilterExtraRows[dec->filter_type_]; if (dec->filter_type_ == 2) { @@ -651,7 +648,7 @@ static int InitThreadContext(VP8Decoder* const dec) { } worker->data1 = dec; worker->data2 = (void*)&dec->thread_ctx_.io_; - worker->hook = (WebPWorkerHook)FinishRow; + worker->hook = FinishRow; dec->num_caches_ = (dec->filter_type_ > 0) ? MT_CACHE_LINES : MT_CACHE_LINES - 1; } else { @@ -671,15 +668,9 @@ int VP8GetThreadMethod(const WebPDecoderOptions* const options, (void)height; assert(headers == NULL || !headers->is_lossless); #if defined(WEBP_USE_THREAD) - if (width < MIN_WIDTH_FOR_THREADS) return 0; - // TODO(skal): tune the heuristic further -#if 0 - if (height < 2 * width) return 2; + if (width >= MIN_WIDTH_FOR_THREADS) return 2; #endif - return 2; -#else // !WEBP_USE_THREAD return 0; -#endif } #undef MT_CACHE_LINES @@ -728,7 +719,7 @@ static int AllocateMemory(VP8Decoder* const dec) { } mem = (uint8_t*)dec->mem_; - dec->intra_t_ = (uint8_t*)mem; + dec->intra_t_ = mem; mem += intra_pred_mode_size; dec->yuv_t_ = (VP8TopSamples*)mem; @@ -741,7 +732,7 @@ static int AllocateMemory(VP8Decoder* const dec) { mem += f_info_size; dec->thread_ctx_.id_ = 0; dec->thread_ctx_.f_info_ = dec->f_info_; - if (dec->mt_method_ > 0) { + if (dec->filter_type_ > 0 && dec->mt_method_ > 0) { // secondary cache line. The deblocking process need to make use of the // filtering strength from previous macroblock row, while the new ones // are being decoded in parallel. We'll just swap the pointers. @@ -750,7 +741,7 @@ static int AllocateMemory(VP8Decoder* const dec) { mem = (uint8_t*)WEBP_ALIGN(mem); assert((yuv_size & WEBP_ALIGN_CST) == 0); - dec->yuv_b_ = (uint8_t*)mem; + dec->yuv_b_ = mem; mem += yuv_size; dec->mb_data_ = (VP8MBData*)mem; @@ -766,7 +757,7 @@ static int AllocateMemory(VP8Decoder* const dec) { const int extra_rows = kFilterExtraRows[dec->filter_type_]; const int extra_y = extra_rows * dec->cache_y_stride_; const int extra_uv = (extra_rows / 2) * dec->cache_uv_stride_; - dec->cache_y_ = ((uint8_t*)mem) + extra_y; + dec->cache_y_ = mem + extra_y; dec->cache_u_ = dec->cache_y_ + 16 * num_caches * dec->cache_y_stride_ + extra_uv; dec->cache_v_ = dec->cache_u_ @@ -776,7 +767,7 @@ static int AllocateMemory(VP8Decoder* const dec) { mem += cache_size; // alpha plane - dec->alpha_plane_ = alpha_size ? (uint8_t*)mem : NULL; + dec->alpha_plane_ = alpha_size ? mem : NULL; mem += alpha_size; assert(mem <= (uint8_t*)dec->mem_ + dec->mem_size_); diff --git a/Pods/libwebp/src/dec/idec_dec.c b/Pods/libwebp/src/dec/idec_dec.c index 78fb2e7..9035df5 100644 --- a/Pods/libwebp/src/dec/idec_dec.c +++ b/Pods/libwebp/src/dec/idec_dec.c @@ -15,10 +15,10 @@ #include #include -#include "./alphai_dec.h" -#include "./webpi_dec.h" -#include "./vp8i_dec.h" -#include "../utils/utils.h" +#include "src/dec/alphai_dec.h" +#include "src/dec/webpi_dec.h" +#include "src/dec/vp8i_dec.h" +#include "src/utils/utils.h" // In append mode, buffer allocations increase as multiples of this value. // Needs to be a power of 2. @@ -140,10 +140,9 @@ static void DoRemap(WebPIDecoder* const idec, ptrdiff_t offset) { if (NeedCompressedAlpha(idec)) { ALPHDecoder* const alph_dec = dec->alph_dec_; dec->alpha_data_ += offset; - if (alph_dec != NULL) { + if (alph_dec != NULL && alph_dec->vp8l_dec_ != NULL) { if (alph_dec->method_ == ALPHA_LOSSLESS_COMPRESSION) { VP8LDecoder* const alph_vp8l_dec = alph_dec->vp8l_dec_; - assert(alph_vp8l_dec != NULL); assert(dec->alpha_data_size_ >= ALPHA_HEADER_LEN); VP8LBitReaderSetBuffer(&alph_vp8l_dec->br_, dec->alpha_data_ + ALPHA_HEADER_LEN, @@ -167,9 +166,11 @@ static int AppendToMemBuffer(WebPIDecoder* const idec, VP8Decoder* const dec = (VP8Decoder*)idec->dec_; MemBuffer* const mem = &idec->mem_; const int need_compressed_alpha = NeedCompressedAlpha(idec); - const uint8_t* const old_start = mem->buf_ + mem->start_; + const uint8_t* const old_start = + (mem->buf_ == NULL) ? NULL : mem->buf_ + mem->start_; const uint8_t* const old_base = need_compressed_alpha ? dec->alpha_data_ : old_start; + assert(mem->buf_ != NULL || mem->start_ == 0); assert(mem->mode_ == MEM_MODE_APPEND); if (data_size > MAX_CHUNK_PAYLOAD) { // security safeguard: trying to allocate more than what the format @@ -185,7 +186,7 @@ static int AppendToMemBuffer(WebPIDecoder* const idec, uint8_t* const new_buf = (uint8_t*)WebPSafeMalloc(extra_size, sizeof(*new_buf)); if (new_buf == NULL) return 0; - memcpy(new_buf, old_base, current_size); + if (old_base != NULL) memcpy(new_buf, old_base, current_size); WebPSafeFree(mem->buf_); mem->buf_ = new_buf; mem->buf_size_ = (size_t)extra_size; @@ -193,6 +194,7 @@ static int AppendToMemBuffer(WebPIDecoder* const idec, mem->end_ = current_size; } + assert(mem->buf_ != NULL); memcpy(mem->buf_ + mem->end_, data, data_size); mem->end_ += data_size; assert(mem->end_ <= mem->buf_size_); @@ -205,7 +207,9 @@ static int RemapMemBuffer(WebPIDecoder* const idec, const uint8_t* const data, size_t data_size) { MemBuffer* const mem = &idec->mem_; const uint8_t* const old_buf = mem->buf_; - const uint8_t* const old_start = old_buf + mem->start_; + const uint8_t* const old_start = + (old_buf == NULL) ? NULL : old_buf + mem->start_; + assert(old_buf != NULL || mem->start_ == 0); assert(mem->mode_ == MEM_MODE_MAP); if (data_size < mem->buf_size_) return 0; // can't remap to a shorter buffer! @@ -283,10 +287,8 @@ static void RestoreContext(const MBContext* context, VP8Decoder* const dec, static VP8StatusCode IDecError(WebPIDecoder* const idec, VP8StatusCode error) { if (idec->state_ == STATE_VP8_DATA) { - VP8Io* const io = &idec->io_; - if (io->teardown != NULL) { - io->teardown(io); - } + // Synchronize the thread, clean-up and check for errors. + VP8ExitCritical((VP8Decoder*)idec->dec_, &idec->io_); } idec->state_ = STATE_ERROR; return error; @@ -451,7 +453,10 @@ static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) { VP8Decoder* const dec = (VP8Decoder*)idec->dec_; VP8Io* const io = &idec->io_; - assert(dec->ready_); + // Make sure partition #0 has been read before, to set dec to ready_. + if (!dec->ready_) { + return IDecError(idec, VP8_STATUS_BITSTREAM_ERROR); + } for (; dec->mb_y_ < dec->mb_h_; ++dec->mb_y_) { if (idec->last_mb_y_ != dec->mb_y_) { if (!VP8ParseIntraModeRow(&dec->br_, dec)) { @@ -473,6 +478,12 @@ static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) { MemDataSize(&idec->mem_) > MAX_MB_SIZE) { return IDecError(idec, VP8_STATUS_BITSTREAM_ERROR); } + // Synchronize the threads. + if (dec->mt_method_ > 0) { + if (!WebPGetWorkerInterface()->Sync(&dec->worker_)) { + return IDecError(idec, VP8_STATUS_BITSTREAM_ERROR); + } + } RestoreContext(&context, dec, token_br); return VP8_STATUS_SUSPENDED; } @@ -491,6 +502,7 @@ static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) { } // Synchronize the thread and check for errors. if (!VP8ExitCritical(dec, io)) { + idec->state_ = STATE_ERROR; // prevent re-entry in IDecError return IDecError(idec, VP8_STATUS_USER_ABORT); } dec->ready_ = 0; @@ -571,6 +583,10 @@ static VP8StatusCode IDecode(WebPIDecoder* idec) { status = DecodePartition0(idec); } if (idec->state_ == STATE_VP8_DATA) { + const VP8Decoder* const dec = (VP8Decoder*)idec->dec_; + if (dec == NULL) { + return VP8_STATUS_SUSPENDED; // can't continue if we have no decoder. + } status = DecodeRemaining(idec); } if (idec->state_ == STATE_VP8L_HEADER) { @@ -673,12 +689,12 @@ void WebPIDelete(WebPIDecoder* idec) { //------------------------------------------------------------------------------ // Wrapper toward WebPINewDecoder -WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer, +WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE csp, uint8_t* output_buffer, size_t output_buffer_size, int output_stride) { const int is_external_memory = (output_buffer != NULL) ? 1 : 0; WebPIDecoder* idec; - if (mode >= MODE_YUV) return NULL; + if (csp >= MODE_YUV) return NULL; if (is_external_memory == 0) { // Overwrite parameters to sane values. output_buffer_size = 0; output_stride = 0; @@ -689,7 +705,7 @@ WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer, } idec = WebPINewDecoder(NULL); if (idec == NULL) return NULL; - idec->output_.colorspace = mode; + idec->output_.colorspace = csp; idec->output_.is_external_memory = is_external_memory; idec->output_.u.RGBA.rgba = output_buffer; idec->output_.u.RGBA.stride = output_stride; diff --git a/Pods/libwebp/src/dec/io_dec.c b/Pods/libwebp/src/dec/io_dec.c index 8bfab86..e603f19 100644 --- a/Pods/libwebp/src/dec/io_dec.c +++ b/Pods/libwebp/src/dec/io_dec.c @@ -13,11 +13,11 @@ #include #include -#include "../dec/vp8i_dec.h" -#include "./webpi_dec.h" -#include "../dsp/dsp.h" -#include "../dsp/yuv.h" -#include "../utils/utils.h" +#include "src/dec/vp8i_dec.h" +#include "src/dec/webpi_dec.h" +#include "src/dsp/dsp.h" +#include "src/dsp/yuv.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // Main YUV<->RGB conversion functions @@ -212,7 +212,7 @@ static int EmitAlphaRGBA4444(const VP8Io* const io, WebPDecParams* const p, int num_rows; const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); uint8_t* const base_rgba = buf->rgba + start_y * buf->stride; -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) uint8_t* alpha_dst = base_rgba; #else uint8_t* alpha_dst = base_rgba + 1; @@ -241,6 +241,7 @@ static int EmitAlphaRGBA4444(const VP8Io* const io, WebPDecParams* const p, //------------------------------------------------------------------------------ // YUV rescaling (no final RGB conversion needed) +#if !defined(WEBP_REDUCE_SIZE) static int Rescale(const uint8_t* src, int src_stride, int new_lines, WebPRescaler* const wrk) { int num_lines_out = 0; @@ -431,7 +432,7 @@ static int ExportAlphaRGBA4444(WebPDecParams* const p, int y_pos, int max_lines_out) { const WebPRGBABuffer* const buf = &p->output->u.RGBA; uint8_t* const base_rgba = buf->rgba + y_pos * buf->stride; -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) uint8_t* alpha_dst = base_rgba; #else uint8_t* alpha_dst = base_rgba + 1; @@ -541,6 +542,8 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) { return 1; } +#endif // WEBP_REDUCE_SIZE + //------------------------------------------------------------------------------ // Default custom functions @@ -561,10 +564,14 @@ static int CustomSetup(VP8Io* io) { WebPInitUpsamplers(); } if (io->use_scaling) { +#if !defined(WEBP_REDUCE_SIZE) const int ok = is_rgb ? InitRGBRescaler(io, p) : InitYUVRescaler(io, p); if (!ok) { return 0; // memory error } +#else + return 0; // rescaling support not compiled +#endif } else { if (is_rgb) { WebPInitSamplers(); @@ -598,9 +605,6 @@ static int CustomSetup(VP8Io* io) { } } - if (is_rgb) { - VP8YUVInit(); - } return 1; } diff --git a/Pods/libwebp/src/dec/quant_dec.c b/Pods/libwebp/src/dec/quant_dec.c index 14e3198..a0ac018 100644 --- a/Pods/libwebp/src/dec/quant_dec.c +++ b/Pods/libwebp/src/dec/quant_dec.c @@ -11,7 +11,7 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./vp8i_dec.h" +#include "src/dec/vp8i_dec.h" static WEBP_INLINE int clip(int v, int M) { return v < 0 ? 0 : v > M ? M : v; @@ -61,12 +61,17 @@ static const uint16_t kAcTable[128] = { void VP8ParseQuant(VP8Decoder* const dec) { VP8BitReader* const br = &dec->br_; - const int base_q0 = VP8GetValue(br, 7); - const int dqy1_dc = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0; - const int dqy2_dc = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0; - const int dqy2_ac = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0; - const int dquv_dc = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0; - const int dquv_ac = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0; + const int base_q0 = VP8GetValue(br, 7, "global-header"); + const int dqy1_dc = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 4, "global-header") : 0; + const int dqy2_dc = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 4, "global-header") : 0; + const int dqy2_ac = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 4, "global-header") : 0; + const int dquv_dc = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 4, "global-header") : 0; + const int dquv_ac = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 4, "global-header") : 0; const VP8SegmentHeader* const hdr = &dec->segment_hdr_; int i; diff --git a/Pods/libwebp/src/dec/tree_dec.c b/Pods/libwebp/src/dec/tree_dec.c index 9e805f6..1c6fdea 100644 --- a/Pods/libwebp/src/dec/tree_dec.c +++ b/Pods/libwebp/src/dec/tree_dec.c @@ -11,15 +11,19 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./vp8i_dec.h" -#include "../utils/bit_reader_inl_utils.h" +#include "src/dec/vp8i_dec.h" +#include "src/utils/bit_reader_inl_utils.h" +#if !defined(USE_GENERIC_TREE) #if !defined(__arm__) && !defined(_M_ARM) && !defined(__aarch64__) // using a table is ~1-2% slower on ARM. Prefer the coded-tree approach then. -#define USE_GENERIC_TREE +#define USE_GENERIC_TREE 1 // ALTERNATE_CODE +#else +#define USE_GENERIC_TREE 0 #endif +#endif // USE_GENERIC_TREE -#ifdef USE_GENERIC_TREE +#if (USE_GENERIC_TREE == 1) static const int8_t kYModesIntra4[18] = { -B_DC_PRED, 1, -B_TM_PRED, 2, @@ -292,20 +296,21 @@ static void ParseIntraMode(VP8BitReader* const br, // to decode more than 1 keyframe. if (dec->segment_hdr_.update_map_) { // Hardcoded tree parsing - block->segment_ = !VP8GetBit(br, dec->proba_.segments_[0]) - ? VP8GetBit(br, dec->proba_.segments_[1]) - : 2 + VP8GetBit(br, dec->proba_.segments_[2]); + block->segment_ = !VP8GetBit(br, dec->proba_.segments_[0], "segments") + ? VP8GetBit(br, dec->proba_.segments_[1], "segments") + : VP8GetBit(br, dec->proba_.segments_[2], "segments") + 2; } else { block->segment_ = 0; // default for intra } - if (dec->use_skip_proba_) block->skip_ = VP8GetBit(br, dec->skip_p_); + if (dec->use_skip_proba_) block->skip_ = VP8GetBit(br, dec->skip_p_, "skip"); - block->is_i4x4_ = !VP8GetBit(br, 145); // decide for B_PRED first + block->is_i4x4_ = !VP8GetBit(br, 145, "block-size"); if (!block->is_i4x4_) { // Hardcoded 16x16 intra-mode decision tree. const int ymode = - VP8GetBit(br, 156) ? (VP8GetBit(br, 128) ? TM_PRED : H_PRED) - : (VP8GetBit(br, 163) ? V_PRED : DC_PRED); + VP8GetBit(br, 156, "pred-modes") ? + (VP8GetBit(br, 128, "pred-modes") ? TM_PRED : H_PRED) : + (VP8GetBit(br, 163, "pred-modes") ? V_PRED : DC_PRED); block->imodes_[0] = ymode; memset(top, ymode, 4 * sizeof(*top)); memset(left, ymode, 4 * sizeof(*left)); @@ -317,25 +322,28 @@ static void ParseIntraMode(VP8BitReader* const br, int x; for (x = 0; x < 4; ++x) { const uint8_t* const prob = kBModesProba[top[x]][ymode]; -#ifdef USE_GENERIC_TREE +#if (USE_GENERIC_TREE == 1) // Generic tree-parsing - int i = kYModesIntra4[VP8GetBit(br, prob[0])]; + int i = kYModesIntra4[VP8GetBit(br, prob[0], "pred-modes")]; while (i > 0) { - i = kYModesIntra4[2 * i + VP8GetBit(br, prob[i])]; + i = kYModesIntra4[2 * i + VP8GetBit(br, prob[i], "pred-modes")]; } ymode = -i; #else // Hardcoded tree parsing - ymode = !VP8GetBit(br, prob[0]) ? B_DC_PRED : - !VP8GetBit(br, prob[1]) ? B_TM_PRED : - !VP8GetBit(br, prob[2]) ? B_VE_PRED : - !VP8GetBit(br, prob[3]) ? - (!VP8GetBit(br, prob[4]) ? B_HE_PRED : - (!VP8GetBit(br, prob[5]) ? B_RD_PRED : B_VR_PRED)) : - (!VP8GetBit(br, prob[6]) ? B_LD_PRED : - (!VP8GetBit(br, prob[7]) ? B_VL_PRED : - (!VP8GetBit(br, prob[8]) ? B_HD_PRED : B_HU_PRED))); -#endif // USE_GENERIC_TREE + ymode = !VP8GetBit(br, prob[0], "pred-modes") ? B_DC_PRED : + !VP8GetBit(br, prob[1], "pred-modes") ? B_TM_PRED : + !VP8GetBit(br, prob[2], "pred-modes") ? B_VE_PRED : + !VP8GetBit(br, prob[3], "pred-modes") ? + (!VP8GetBit(br, prob[4], "pred-modes") ? B_HE_PRED : + (!VP8GetBit(br, prob[5], "pred-modes") ? B_RD_PRED + : B_VR_PRED)) : + (!VP8GetBit(br, prob[6], "pred-modes") ? B_LD_PRED : + (!VP8GetBit(br, prob[7], "pred-modes") ? B_VL_PRED : + (!VP8GetBit(br, prob[8], "pred-modes") ? B_HD_PRED + : B_HU_PRED)) + ); +#endif // USE_GENERIC_TREE top[x] = ymode; } memcpy(modes, top, 4 * sizeof(*top)); @@ -344,9 +352,9 @@ static void ParseIntraMode(VP8BitReader* const br, } } // Hardcoded UVMode decision tree - block->uvmode_ = !VP8GetBit(br, 142) ? DC_PRED - : !VP8GetBit(br, 114) ? V_PRED - : VP8GetBit(br, 183) ? TM_PRED : H_PRED; + block->uvmode_ = !VP8GetBit(br, 142, "pred-modes-uv") ? DC_PRED + : !VP8GetBit(br, 114, "pred-modes-uv") ? V_PRED + : VP8GetBit(br, 183, "pred-modes-uv") ? TM_PRED : H_PRED; } int VP8ParseIntraModeRow(VP8BitReader* const br, VP8Decoder* const dec) { @@ -498,7 +506,7 @@ static const uint8_t // Paragraph 9.9 -static const int kBands[16 + 1] = { +static const uint8_t kBands[16 + 1] = { 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 0 // extra entry as sentinel }; @@ -510,8 +518,10 @@ void VP8ParseProba(VP8BitReader* const br, VP8Decoder* const dec) { for (b = 0; b < NUM_BANDS; ++b) { for (c = 0; c < NUM_CTX; ++c) { for (p = 0; p < NUM_PROBAS; ++p) { - const int v = VP8GetBit(br, CoeffsUpdateProba[t][b][c][p]) ? - VP8GetValue(br, 8) : CoeffsProba0[t][b][c][p]; + const int v = + VP8GetBit(br, CoeffsUpdateProba[t][b][c][p], "global-header") ? + VP8GetValue(br, 8, "global-header") : + CoeffsProba0[t][b][c][p]; proba->bands_[t][b].probas_[c][p] = v; } } @@ -520,9 +530,8 @@ void VP8ParseProba(VP8BitReader* const br, VP8Decoder* const dec) { proba->bands_ptr_[t][b] = &proba->bands_[t][kBands[b]]; } } - dec->use_skip_proba_ = VP8Get(br); + dec->use_skip_proba_ = VP8Get(br, "global-header"); if (dec->use_skip_proba_) { - dec->skip_p_ = VP8GetValue(br, 8); + dec->skip_p_ = VP8GetValue(br, 8, "global-header"); } } - diff --git a/Pods/libwebp/src/dec/vp8_dec.c b/Pods/libwebp/src/dec/vp8_dec.c index fad8d9c..57efb69 100644 --- a/Pods/libwebp/src/dec/vp8_dec.c +++ b/Pods/libwebp/src/dec/vp8_dec.c @@ -13,12 +13,12 @@ #include -#include "./alphai_dec.h" -#include "./vp8i_dec.h" -#include "./vp8li_dec.h" -#include "./webpi_dec.h" -#include "../utils/bit_reader_inl_utils.h" -#include "../utils/utils.h" +#include "src/dec/alphai_dec.h" +#include "src/dec/vp8i_dec.h" +#include "src/dec/vp8li_dec.h" +#include "src/dec/webpi_dec.h" +#include "src/utils/bit_reader_inl_utils.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ @@ -161,23 +161,26 @@ static int ParseSegmentHeader(VP8BitReader* br, VP8SegmentHeader* hdr, VP8Proba* proba) { assert(br != NULL); assert(hdr != NULL); - hdr->use_segment_ = VP8Get(br); + hdr->use_segment_ = VP8Get(br, "global-header"); if (hdr->use_segment_) { - hdr->update_map_ = VP8Get(br); - if (VP8Get(br)) { // update data + hdr->update_map_ = VP8Get(br, "global-header"); + if (VP8Get(br, "global-header")) { // update data int s; - hdr->absolute_delta_ = VP8Get(br); + hdr->absolute_delta_ = VP8Get(br, "global-header"); for (s = 0; s < NUM_MB_SEGMENTS; ++s) { - hdr->quantizer_[s] = VP8Get(br) ? VP8GetSignedValue(br, 7) : 0; + hdr->quantizer_[s] = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 7, "global-header") : 0; } for (s = 0; s < NUM_MB_SEGMENTS; ++s) { - hdr->filter_strength_[s] = VP8Get(br) ? VP8GetSignedValue(br, 6) : 0; + hdr->filter_strength_[s] = VP8Get(br, "global-header") ? + VP8GetSignedValue(br, 6, "global-header") : 0; } } if (hdr->update_map_) { int s; for (s = 0; s < MB_FEATURE_TREE_PROBS; ++s) { - proba->segments_[s] = VP8Get(br) ? VP8GetValue(br, 8) : 255u; + proba->segments_[s] = VP8Get(br, "global-header") ? + VP8GetValue(br, 8, "global-header") : 255u; } } } else { @@ -205,7 +208,7 @@ static VP8StatusCode ParsePartitions(VP8Decoder* const dec, size_t last_part; size_t p; - dec->num_parts_minus_one_ = (1 << VP8GetValue(br, 2)) - 1; + dec->num_parts_minus_one_ = (1 << VP8GetValue(br, 2, "global-header")) - 1; last_part = dec->num_parts_minus_one_; if (size < 3 * last_part) { // we can't even read the sizes with sz[]! That's a failure. @@ -229,21 +232,21 @@ static VP8StatusCode ParsePartitions(VP8Decoder* const dec, // Paragraph 9.4 static int ParseFilterHeader(VP8BitReader* br, VP8Decoder* const dec) { VP8FilterHeader* const hdr = &dec->filter_hdr_; - hdr->simple_ = VP8Get(br); - hdr->level_ = VP8GetValue(br, 6); - hdr->sharpness_ = VP8GetValue(br, 3); - hdr->use_lf_delta_ = VP8Get(br); + hdr->simple_ = VP8Get(br, "global-header"); + hdr->level_ = VP8GetValue(br, 6, "global-header"); + hdr->sharpness_ = VP8GetValue(br, 3, "global-header"); + hdr->use_lf_delta_ = VP8Get(br, "global-header"); if (hdr->use_lf_delta_) { - if (VP8Get(br)) { // update lf-delta? + if (VP8Get(br, "global-header")) { // update lf-delta? int i; for (i = 0; i < NUM_REF_LF_DELTAS; ++i) { - if (VP8Get(br)) { - hdr->ref_lf_delta_[i] = VP8GetSignedValue(br, 6); + if (VP8Get(br, "global-header")) { + hdr->ref_lf_delta_[i] = VP8GetSignedValue(br, 6, "global-header"); } } for (i = 0; i < NUM_MODE_LF_DELTAS; ++i) { - if (VP8Get(br)) { - hdr->mode_lf_delta_[i] = VP8GetSignedValue(br, 6); + if (VP8Get(br, "global-header")) { + hdr->mode_lf_delta_[i] = VP8GetSignedValue(br, 6, "global-header"); } } } @@ -352,8 +355,8 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) { buf_size -= frm_hdr->partition_length_; if (frm_hdr->key_frame_) { - pic_hdr->colorspace_ = VP8Get(br); - pic_hdr->clamp_type_ = VP8Get(br); + pic_hdr->colorspace_ = VP8Get(br, "global-header"); + pic_hdr->clamp_type_ = VP8Get(br, "global-header"); } if (!ParseSegmentHeader(br, &dec->segment_hdr_, &dec->proba_)) { return VP8SetError(dec, VP8_STATUS_BITSTREAM_ERROR, @@ -378,7 +381,7 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) { "Not a key frame."); } - VP8Get(br); // ignore the value of update_proba_ + VP8Get(br, "global-header"); // ignore the value of update_proba_ VP8ParseProba(br, dec); @@ -403,28 +406,28 @@ static const uint8_t kZigzag[16] = { // See section 13-2: http://tools.ietf.org/html/rfc6386#section-13.2 static int GetLargeValue(VP8BitReader* const br, const uint8_t* const p) { int v; - if (!VP8GetBit(br, p[3])) { - if (!VP8GetBit(br, p[4])) { + if (!VP8GetBit(br, p[3], "coeffs")) { + if (!VP8GetBit(br, p[4], "coeffs")) { v = 2; } else { - v = 3 + VP8GetBit(br, p[5]); + v = 3 + VP8GetBit(br, p[5], "coeffs"); } } else { - if (!VP8GetBit(br, p[6])) { - if (!VP8GetBit(br, p[7])) { - v = 5 + VP8GetBit(br, 159); + if (!VP8GetBit(br, p[6], "coeffs")) { + if (!VP8GetBit(br, p[7], "coeffs")) { + v = 5 + VP8GetBit(br, 159, "coeffs"); } else { - v = 7 + 2 * VP8GetBit(br, 165); - v += VP8GetBit(br, 145); + v = 7 + 2 * VP8GetBit(br, 165, "coeffs"); + v += VP8GetBit(br, 145, "coeffs"); } } else { const uint8_t* tab; - const int bit1 = VP8GetBit(br, p[8]); - const int bit0 = VP8GetBit(br, p[9 + bit1]); + const int bit1 = VP8GetBit(br, p[8], "coeffs"); + const int bit0 = VP8GetBit(br, p[9 + bit1], "coeffs"); const int cat = 2 * bit1 + bit0; v = 0; for (tab = kCat3456[cat]; *tab; ++tab) { - v += v + VP8GetBit(br, *tab); + v += v + VP8GetBit(br, *tab, "coeffs"); } v += 3 + (8 << cat); } @@ -438,24 +441,24 @@ static int GetCoeffsFast(VP8BitReader* const br, int ctx, const quant_t dq, int n, int16_t* out) { const uint8_t* p = prob[n]->probas_[ctx]; for (; n < 16; ++n) { - if (!VP8GetBit(br, p[0])) { + if (!VP8GetBit(br, p[0], "coeffs")) { return n; // previous coeff was last non-zero coeff } - while (!VP8GetBit(br, p[1])) { // sequence of zero coeffs + while (!VP8GetBit(br, p[1], "coeffs")) { // sequence of zero coeffs p = prob[++n]->probas_[0]; if (n == 16) return 16; } { // non zero coeff const VP8ProbaArray* const p_ctx = &prob[n + 1]->probas_[0]; int v; - if (!VP8GetBit(br, p[2])) { + if (!VP8GetBit(br, p[2], "coeffs")) { v = 1; p = p_ctx[1]; } else { v = GetLargeValue(br, p); p = p_ctx[2]; } - out[kZigzag[n]] = VP8GetSigned(br, v) * dq[n > 0]; + out[kZigzag[n]] = VP8GetSigned(br, v, "coeffs") * dq[n > 0]; } } return 16; @@ -468,30 +471,30 @@ static int GetCoeffsAlt(VP8BitReader* const br, int ctx, const quant_t dq, int n, int16_t* out) { const uint8_t* p = prob[n]->probas_[ctx]; for (; n < 16; ++n) { - if (!VP8GetBitAlt(br, p[0])) { + if (!VP8GetBitAlt(br, p[0], "coeffs")) { return n; // previous coeff was last non-zero coeff } - while (!VP8GetBitAlt(br, p[1])) { // sequence of zero coeffs + while (!VP8GetBitAlt(br, p[1], "coeffs")) { // sequence of zero coeffs p = prob[++n]->probas_[0]; if (n == 16) return 16; } { // non zero coeff const VP8ProbaArray* const p_ctx = &prob[n + 1]->probas_[0]; int v; - if (!VP8GetBitAlt(br, p[2])) { + if (!VP8GetBitAlt(br, p[2], "coeffs")) { v = 1; p = p_ctx[1]; } else { v = GetLargeValue(br, p); p = p_ctx[2]; } - out[kZigzag[n]] = VP8GetSigned(br, v) * dq[n > 0]; + out[kZigzag[n]] = VP8GetSigned(br, v, "coeffs") * dq[n > 0]; } } return 16; } -WEBP_TSAN_IGNORE_FUNCTION static void InitGetCoeffs(void) { +static WEBP_TSAN_IGNORE_FUNCTION void InitGetCoeffs(void) { if (GetCoeffs == NULL) { if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) { GetCoeffs = GetCoeffsAlt; diff --git a/Pods/libwebp/src/dec/vp8_dec.h b/Pods/libwebp/src/dec/vp8_dec.h index b9337bb..a05405d 100644 --- a/Pods/libwebp/src/dec/vp8_dec.h +++ b/Pods/libwebp/src/dec/vp8_dec.h @@ -11,10 +11,10 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_WEBP_DECODE_VP8_H_ -#define WEBP_WEBP_DECODE_VP8_H_ +#ifndef WEBP_DEC_VP8_DEC_H_ +#define WEBP_DEC_VP8_DEC_H_ -#include "../webp/decode.h" +#include "src/webp/decode.h" #ifdef __cplusplus extern "C" { @@ -33,7 +33,7 @@ extern "C" { // /* customize io's functions (setup()/put()/teardown()) if needed. */ // // VP8Decoder* dec = VP8New(); -// bool ok = VP8Decode(dec); +// int ok = VP8Decode(dec, &io); // if (!ok) printf("Error: %s\n", VP8StatusMessage(dec)); // VP8Delete(dec); // return ok; @@ -157,24 +157,24 @@ void VP8Delete(VP8Decoder* const dec); // Miscellaneous VP8/VP8L bitstream probing functions. // Returns true if the next 3 bytes in data contain the VP8 signature. -WEBP_EXTERN(int) VP8CheckSignature(const uint8_t* const data, size_t data_size); +WEBP_EXTERN int VP8CheckSignature(const uint8_t* const data, size_t data_size); // Validates the VP8 data-header and retrieves basic header information viz // width and height. Returns 0 in case of formatting error. *width/*height // can be passed NULL. -WEBP_EXTERN(int) VP8GetInfo( +WEBP_EXTERN int VP8GetInfo( const uint8_t* data, size_t data_size, // data available so far size_t chunk_size, // total data size expected in the chunk int* const width, int* const height); // Returns true if the next byte(s) in data is a VP8L signature. -WEBP_EXTERN(int) VP8LCheckSignature(const uint8_t* const data, size_t size); +WEBP_EXTERN int VP8LCheckSignature(const uint8_t* const data, size_t size); // Validates the VP8L data-header and retrieves basic header information viz // width, height and alpha. Returns 0 in case of formatting error. // width/height/has_alpha can be passed NULL. -WEBP_EXTERN(int) VP8LGetInfo( +WEBP_EXTERN int VP8LGetInfo( const uint8_t* data, size_t data_size, // data available so far int* const width, int* const height, int* const has_alpha); @@ -182,4 +182,4 @@ WEBP_EXTERN(int) VP8LGetInfo( } // extern "C" #endif -#endif /* WEBP_WEBP_DECODE_VP8_H_ */ +#endif // WEBP_DEC_VP8_DEC_H_ diff --git a/Pods/libwebp/src/dec/vp8i_dec.h b/Pods/libwebp/src/dec/vp8i_dec.h index 555853e..600a684 100644 --- a/Pods/libwebp/src/dec/vp8i_dec.h +++ b/Pods/libwebp/src/dec/vp8i_dec.h @@ -11,16 +11,16 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_DEC_VP8I_H_ -#define WEBP_DEC_VP8I_H_ +#ifndef WEBP_DEC_VP8I_DEC_H_ +#define WEBP_DEC_VP8I_DEC_H_ #include // for memcpy() -#include "./common_dec.h" -#include "./vp8li_dec.h" -#include "../utils/bit_reader_utils.h" -#include "../utils/random_utils.h" -#include "../utils/thread_utils.h" -#include "../dsp/dsp.h" +#include "src/dec/common_dec.h" +#include "src/dec/vp8li_dec.h" +#include "src/utils/bit_reader_utils.h" +#include "src/utils/random_utils.h" +#include "src/utils/thread_utils.h" +#include "src/dsp/dsp.h" #ifdef __cplusplus extern "C" { @@ -30,8 +30,8 @@ extern "C" { // Various defines and enums // version numbers -#define DEC_MAJ_VERSION 0 -#define DEC_MIN_VERSION 6 +#define DEC_MAJ_VERSION 1 +#define DEC_MIN_VERSION 1 #define DEC_REV_VERSION 0 // YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). @@ -57,7 +57,6 @@ extern "C" { // '|' = left sample, '-' = top sample, '+' = top-left sample // 't' = extra top-right sample for 4x4 modes #define YUV_SIZE (BPS * 17 + BPS * 9) -#define Y_SIZE (BPS * 17) #define Y_OFF (BPS * 1 + 8) #define U_OFF (Y_OFF + BPS * 16 + BPS) #define V_OFF (U_OFF + 16) @@ -317,4 +316,4 @@ const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, } // extern "C" #endif -#endif /* WEBP_DEC_VP8I_H_ */ +#endif // WEBP_DEC_VP8I_DEC_H_ diff --git a/Pods/libwebp/src/dec/vp8l_dec.c b/Pods/libwebp/src/dec/vp8l_dec.c index ef359a9..93615d4 100644 --- a/Pods/libwebp/src/dec/vp8l_dec.c +++ b/Pods/libwebp/src/dec/vp8l_dec.c @@ -14,22 +14,22 @@ #include -#include "./alphai_dec.h" -#include "./vp8li_dec.h" -#include "../dsp/dsp.h" -#include "../dsp/lossless.h" -#include "../dsp/lossless_common.h" -#include "../dsp/yuv.h" -#include "../utils/endian_inl_utils.h" -#include "../utils/huffman_utils.h" -#include "../utils/utils.h" +#include "src/dec/alphai_dec.h" +#include "src/dec/vp8li_dec.h" +#include "src/dsp/dsp.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" +#include "src/dsp/yuv.h" +#include "src/utils/endian_inl_utils.h" +#include "src/utils/huffman_utils.h" +#include "src/utils/utils.h" #define NUM_ARGB_CACHE_ROWS 16 static const int kCodeLengthLiterals = 16; static const int kCodeLengthRepeatCode = 16; -static const int kCodeLengthExtraBits[3] = { 2, 3, 7 }; -static const int kCodeLengthRepeatOffsets[3] = { 3, 3, 11 }; +static const uint8_t kCodeLengthExtraBits[3] = { 2, 3, 7 }; +static const uint8_t kCodeLengthRepeatOffsets[3] = { 3, 3, 11 }; // ----------------------------------------------------------------------------- // Five Huffman codes are used at each meta code: @@ -86,7 +86,7 @@ static const uint8_t kCodeToPlane[CODE_TO_PLANE_CODES] = { // All values computed for 8-bit first level lookup with Mark Adler's tool: // http://www.hdfgroup.org/ftp/lib-external/zlib/zlib-1.2.5/examples/enough.c #define FIXED_TABLE_SIZE (630 * 3 + 410) -static const int kTableSize[12] = { +static const uint16_t kTableSize[12] = { FIXED_TABLE_SIZE + 654, FIXED_TABLE_SIZE + 656, FIXED_TABLE_SIZE + 658, @@ -363,11 +363,14 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize, uint32_t* huffman_image = NULL; HTreeGroup* htree_groups = NULL; HuffmanCode* huffman_tables = NULL; - HuffmanCode* next = NULL; + HuffmanCode* huffman_table = NULL; int num_htree_groups = 1; + int num_htree_groups_max = 1; int max_alphabet_size = 0; int* code_lengths = NULL; const int table_size = kTableSize[color_cache_bits]; + int* mapping = NULL; + int ok = 0; if (allow_recursion && VP8LReadBits(br, 1)) { // use meta Huffman codes. @@ -384,9 +387,35 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize, // The huffman data is stored in red and green bytes. const int group = (huffman_image[i] >> 8) & 0xffff; huffman_image[i] = group; - if (group >= num_htree_groups) { - num_htree_groups = group + 1; + if (group >= num_htree_groups_max) { + num_htree_groups_max = group + 1; + } + } + // Check the validity of num_htree_groups_max. If it seems too big, use a + // smaller value for later. This will prevent big memory allocations to end + // up with a bad bitstream anyway. + // The value of 1000 is totally arbitrary. We know that num_htree_groups_max + // is smaller than (1 << 16) and should be smaller than the number of pixels + // (though the format allows it to be bigger). + if (num_htree_groups_max > 1000 || num_htree_groups_max > xsize * ysize) { + // Create a mapping from the used indices to the minimal set of used + // values [0, num_htree_groups) + mapping = (int*)WebPSafeMalloc(num_htree_groups_max, sizeof(*mapping)); + if (mapping == NULL) { + dec->status_ = VP8_STATUS_OUT_OF_MEMORY; + goto Error; + } + // -1 means a value is unmapped, and therefore unused in the Huffman + // image. + memset(mapping, 0xff, num_htree_groups_max * sizeof(*mapping)); + for (num_htree_groups = 0, i = 0; i < huffman_pixs; ++i) { + // Get the current mapping for the group and remap the Huffman image. + int* const mapped_group = &mapping[huffman_image[i]]; + if (*mapped_group == -1) *mapped_group = num_htree_groups++; + huffman_image[i] = *mapped_group; } + } else { + num_htree_groups = num_htree_groups_max; } } @@ -403,88 +432,106 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize, } } + code_lengths = (int*)WebPSafeCalloc((uint64_t)max_alphabet_size, + sizeof(*code_lengths)); huffman_tables = (HuffmanCode*)WebPSafeMalloc(num_htree_groups * table_size, sizeof(*huffman_tables)); htree_groups = VP8LHtreeGroupsNew(num_htree_groups); - code_lengths = (int*)WebPSafeCalloc((uint64_t)max_alphabet_size, - sizeof(*code_lengths)); if (htree_groups == NULL || code_lengths == NULL || huffman_tables == NULL) { dec->status_ = VP8_STATUS_OUT_OF_MEMORY; goto Error; } - next = huffman_tables; - for (i = 0; i < num_htree_groups; ++i) { - HTreeGroup* const htree_group = &htree_groups[i]; - HuffmanCode** const htrees = htree_group->htrees; - int size; - int total_size = 0; - int is_trivial_literal = 1; - int max_bits = 0; - for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) { - int alphabet_size = kAlphabetSize[j]; - htrees[j] = next; - if (j == 0 && color_cache_bits > 0) { - alphabet_size += 1 << color_cache_bits; - } - size = ReadHuffmanCode(alphabet_size, dec, code_lengths, next); - if (size == 0) { - goto Error; - } - if (is_trivial_literal && kLiteralMap[j] == 1) { - is_trivial_literal = (next->bits == 0); + huffman_table = huffman_tables; + for (i = 0; i < num_htree_groups_max; ++i) { + // If the index "i" is unused in the Huffman image, just make sure the + // coefficients are valid but do not store them. + if (mapping != NULL && mapping[i] == -1) { + for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) { + int alphabet_size = kAlphabetSize[j]; + if (j == 0 && color_cache_bits > 0) { + alphabet_size += (1 << color_cache_bits); + } + // Passing in NULL so that nothing gets filled. + if (!ReadHuffmanCode(alphabet_size, dec, code_lengths, NULL)) { + goto Error; + } } - total_size += next->bits; - next += size; - if (j <= ALPHA) { - int local_max_bits = code_lengths[0]; - int k; - for (k = 1; k < alphabet_size; ++k) { - if (code_lengths[k] > local_max_bits) { - local_max_bits = code_lengths[k]; + } else { + HTreeGroup* const htree_group = + &htree_groups[(mapping == NULL) ? i : mapping[i]]; + HuffmanCode** const htrees = htree_group->htrees; + int size; + int total_size = 0; + int is_trivial_literal = 1; + int max_bits = 0; + for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) { + int alphabet_size = kAlphabetSize[j]; + htrees[j] = huffman_table; + if (j == 0 && color_cache_bits > 0) { + alphabet_size += (1 << color_cache_bits); + } + size = ReadHuffmanCode(alphabet_size, dec, code_lengths, huffman_table); + if (size == 0) { + goto Error; + } + if (is_trivial_literal && kLiteralMap[j] == 1) { + is_trivial_literal = (huffman_table->bits == 0); + } + total_size += huffman_table->bits; + huffman_table += size; + if (j <= ALPHA) { + int local_max_bits = code_lengths[0]; + int k; + for (k = 1; k < alphabet_size; ++k) { + if (code_lengths[k] > local_max_bits) { + local_max_bits = code_lengths[k]; + } } + max_bits += local_max_bits; } - max_bits += local_max_bits; } - } - htree_group->is_trivial_literal = is_trivial_literal; - htree_group->is_trivial_code = 0; - if (is_trivial_literal) { - const int red = htrees[RED][0].value; - const int blue = htrees[BLUE][0].value; - const int alpha = htrees[ALPHA][0].value; - htree_group->literal_arb = - ((uint32_t)alpha << 24) | (red << 16) | blue; - if (total_size == 0 && htrees[GREEN][0].value < NUM_LITERAL_CODES) { - htree_group->is_trivial_code = 1; - htree_group->literal_arb |= htrees[GREEN][0].value << 8; + htree_group->is_trivial_literal = is_trivial_literal; + htree_group->is_trivial_code = 0; + if (is_trivial_literal) { + const int red = htrees[RED][0].value; + const int blue = htrees[BLUE][0].value; + const int alpha = htrees[ALPHA][0].value; + htree_group->literal_arb = ((uint32_t)alpha << 24) | (red << 16) | blue; + if (total_size == 0 && htrees[GREEN][0].value < NUM_LITERAL_CODES) { + htree_group->is_trivial_code = 1; + htree_group->literal_arb |= htrees[GREEN][0].value << 8; + } } + htree_group->use_packed_table = + !htree_group->is_trivial_code && (max_bits < HUFFMAN_PACKED_BITS); + if (htree_group->use_packed_table) BuildPackedTable(htree_group); } - htree_group->use_packed_table = !htree_group->is_trivial_code && - (max_bits < HUFFMAN_PACKED_BITS); - if (htree_group->use_packed_table) BuildPackedTable(htree_group); } - WebPSafeFree(code_lengths); + ok = 1; - // All OK. Finalize pointers and return. + // All OK. Finalize pointers. hdr->huffman_image_ = huffman_image; hdr->num_htree_groups_ = num_htree_groups; hdr->htree_groups_ = htree_groups; hdr->huffman_tables_ = huffman_tables; - return 1; Error: WebPSafeFree(code_lengths); - WebPSafeFree(huffman_image); - WebPSafeFree(huffman_tables); - VP8LHtreeGroupsFree(htree_groups); - return 0; + WebPSafeFree(mapping); + if (!ok) { + WebPSafeFree(huffman_image); + WebPSafeFree(huffman_tables); + VP8LHtreeGroupsFree(htree_groups); + } + return ok; } //------------------------------------------------------------------------------ // Scaling. +#if !defined(WEBP_REDUCE_SIZE) static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) { const int num_channels = 4; const int in_width = io->mb_w; @@ -516,10 +563,13 @@ static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) { out_width, out_height, 0, num_channels, work); return 1; } +#endif // WEBP_REDUCE_SIZE //------------------------------------------------------------------------------ // Export to ARGB +#if !defined(WEBP_REDUCE_SIZE) + // We have special "export" function since we need to convert from BGRA static int Export(WebPRescaler* const rescaler, WEBP_CSP_MODE colorspace, int rgba_stride, uint8_t* const rgba) { @@ -561,6 +611,8 @@ static int EmitRescaledRowsRGBA(const VP8LDecoder* const dec, return num_lines_out; } +#endif // WEBP_REDUCE_SIZE + // Emit rows without any scaling. static int EmitRows(WEBP_CSP_MODE colorspace, const uint8_t* row_in, int in_stride, @@ -702,11 +754,11 @@ static WEBP_INLINE HTreeGroup* GetHtreeGroupForPos(VP8LMetadata* const hdr, typedef void (*ProcessRowsFunc)(VP8LDecoder* const dec, int row); -static void ApplyInverseTransforms(VP8LDecoder* const dec, int num_rows, +static void ApplyInverseTransforms(VP8LDecoder* const dec, + int start_row, int num_rows, const uint32_t* const rows) { int n = dec->next_transform_; const int cache_pixs = dec->width_ * num_rows; - const int start_row = dec->last_row_; const int end_row = start_row + num_rows; const uint32_t* rows_in = rows; uint32_t* const rows_out = dec->argb_cache_; @@ -737,8 +789,7 @@ static void ProcessRows(VP8LDecoder* const dec, int row) { VP8Io* const io = dec->io_; uint8_t* rows_data = (uint8_t*)dec->argb_cache_; const int in_stride = io->width * sizeof(uint32_t); // in unit of RGBA - - ApplyInverseTransforms(dec, num_rows, rows); + ApplyInverseTransforms(dec, dec->last_row_, num_rows, rows); if (!SetCropWindow(io, dec->last_row_, row, &rows_data, in_stride)) { // Nothing to output (this time). } else { @@ -746,9 +797,12 @@ static void ProcessRows(VP8LDecoder* const dec, int row) { if (WebPIsRGBMode(output->colorspace)) { // convert to RGBA const WebPRGBABuffer* const buf = &output->u.RGBA; uint8_t* const rgba = buf->rgba + dec->last_out_row_ * buf->stride; - const int num_rows_out = io->use_scaling ? + const int num_rows_out = +#if !defined(WEBP_REDUCE_SIZE) + io->use_scaling ? EmitRescaledRowsRGBA(dec, rows_data, in_stride, io->mb_h, rgba, buf->stride) : +#endif // WEBP_REDUCE_SIZE EmitRows(output->colorspace, rows_data, in_stride, io->mb_w, io->mb_h, rgba, buf->stride); // Update 'last_out_row_'. @@ -875,7 +929,11 @@ static WEBP_INLINE void CopyBlock8b(uint8_t* const dst, int dist, int length) { #endif break; case 2: +#if !defined(WORDS_BIGENDIAN) memcpy(&pattern, src, sizeof(uint16_t)); +#else + pattern = ((uint32_t)src[0] << 8) | src[1]; +#endif #if defined(__arm__) || defined(_M_ARM) pattern |= pattern << 16; #elif defined(WEBP_USE_MIPS_DSP_R2) @@ -1012,12 +1070,13 @@ static int DecodeAlphaData(VP8LDecoder* const dec, uint8_t* const data, ok = 0; goto End; } - assert(br->eos_ == VP8LIsEndOfStream(br)); + br->eos_ = VP8LIsEndOfStream(br); } // Process the remaining rows corresponding to last row-block. ExtractPalettedAlphaRows(dec, row > last_row ? last_row : row); End: + br->eos_ = VP8LIsEndOfStream(br); if (!ok || (br->eos_ && pos < end)) { ok = 0; dec->status_ = br->eos_ ? VP8_STATUS_SUSPENDED @@ -1090,11 +1149,12 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data, VP8LFillBitWindow(br); if (htree_group->use_packed_table) { code = ReadPackedSymbols(htree_group, br, src); + if (VP8LIsEndOfStream(br)) break; if (code == PACKED_NON_LITERAL_CODE) goto AdvanceByOne; } else { code = ReadSymbol(htree_group->htrees[GREEN], br); } - if (br->eos_) break; // early out + if (VP8LIsEndOfStream(br)) break; if (code < NUM_LITERAL_CODES) { // Literal if (htree_group->is_trivial_literal) { *src = htree_group->literal_arb | (code << 8); @@ -1104,7 +1164,7 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data, VP8LFillBitWindow(br); blue = ReadSymbol(htree_group->htrees[BLUE], br); alpha = ReadSymbol(htree_group->htrees[ALPHA], br); - if (br->eos_) break; + if (VP8LIsEndOfStream(br)) break; *src = ((uint32_t)alpha << 24) | (red << 16) | (code << 8) | blue; } AdvanceByOne: @@ -1132,7 +1192,8 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data, VP8LFillBitWindow(br); dist_code = GetCopyDistance(dist_symbol, br); dist = PlaneCodeToDistance(width, dist_code); - if (br->eos_) break; + + if (VP8LIsEndOfStream(br)) break; if (src - data < (ptrdiff_t)dist || src_end - src < (ptrdiff_t)length) { goto Error; } else { @@ -1169,9 +1230,9 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data, } else { // Not reached goto Error; } - assert(br->eos_ == VP8LIsEndOfStream(br)); } + br->eos_ = VP8LIsEndOfStream(br); if (dec->incremental_ && br->eos_ && src < src_end) { RestoreState(dec); } else if (!br->eos_) { @@ -1492,7 +1553,7 @@ static void ExtractAlphaRows(VP8LDecoder* const dec, int last_row) { const int cache_pixs = width * num_rows_to_process; uint8_t* const dst = output + width * cur_row; const uint32_t* const src = dec->argb_cache_; - ApplyInverseTransforms(dec, num_rows_to_process, in); + ApplyInverseTransforms(dec, cur_row, num_rows_to_process, in); WebPExtractGreen(src, dst, cache_pixs); AlphaApplyFilter(alph_dec, cur_row, cur_row + num_rows_to_process, dst, width); @@ -1512,7 +1573,6 @@ int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec, if (dec == NULL) return 0; assert(alph_dec != NULL); - alph_dec->vp8l_dec_ = dec; dec->width_ = alph_dec->width_; dec->height_ = alph_dec->height_; @@ -1544,11 +1604,12 @@ int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec, if (!ok) goto Err; + // Only set here, once we are sure it is valid (to avoid thread races). + alph_dec->vp8l_dec_ = dec; return 1; Err: - VP8LDelete(alph_dec->vp8l_dec_); - alph_dec->vp8l_dec_ = NULL; + VP8LDelete(dec); return 0; } @@ -1630,12 +1691,19 @@ int VP8LDecodeImage(VP8LDecoder* const dec) { if (!AllocateInternalBuffers32b(dec, io->width)) goto Err; +#if !defined(WEBP_REDUCE_SIZE) if (io->use_scaling && !AllocateAndInitRescaler(dec, io)) goto Err; - +#else + if (io->use_scaling) { + dec->status_ = VP8_STATUS_INVALID_PARAM; + goto Err; + } +#endif if (io->use_scaling || WebPIsPremultipliedMode(dec->output_->colorspace)) { // need the alpha-multiply functions for premultiplied output or rescaling WebPInitAlphaProcessing(); } + if (!WebPIsRGBMode(dec->output_->colorspace)) { WebPInitConvertARGBToYUV(); if (dec->output_->u.YUVA.a != NULL) WebPInitAlphaProcessing(); diff --git a/Pods/libwebp/src/dec/vp8li_dec.h b/Pods/libwebp/src/dec/vp8li_dec.h index 097a9d0..72b2e86 100644 --- a/Pods/libwebp/src/dec/vp8li_dec.h +++ b/Pods/libwebp/src/dec/vp8li_dec.h @@ -12,14 +12,14 @@ // Author: Skal (pascal.massimino@gmail.com) // Vikas Arora(vikaas.arora@gmail.com) -#ifndef WEBP_DEC_VP8LI_H_ -#define WEBP_DEC_VP8LI_H_ +#ifndef WEBP_DEC_VP8LI_DEC_H_ +#define WEBP_DEC_VP8LI_DEC_H_ #include // for memcpy() -#include "./webpi_dec.h" -#include "../utils/bit_reader_utils.h" -#include "../utils/color_cache_utils.h" -#include "../utils/huffman_utils.h" +#include "src/dec/webpi_dec.h" +#include "src/utils/bit_reader_utils.h" +#include "src/utils/color_cache_utils.h" +#include "src/utils/huffman_utils.h" #ifdef __cplusplus extern "C" { @@ -37,7 +37,7 @@ struct VP8LTransform { int bits_; // subsampling bits defining transform window. int xsize_; // transform window X index. int ysize_; // transform window Y index. - uint32_t *data_; // transform data. + uint32_t* data_; // transform data. }; typedef struct { @@ -48,23 +48,23 @@ typedef struct { int huffman_mask_; int huffman_subsample_bits_; int huffman_xsize_; - uint32_t *huffman_image_; + uint32_t* huffman_image_; int num_htree_groups_; - HTreeGroup *htree_groups_; - HuffmanCode *huffman_tables_; + HTreeGroup* htree_groups_; + HuffmanCode* huffman_tables_; } VP8LMetadata; typedef struct VP8LDecoder VP8LDecoder; struct VP8LDecoder { VP8StatusCode status_; VP8LDecodeState state_; - VP8Io *io_; + VP8Io* io_; - const WebPDecBuffer *output_; // shortcut to io->opaque->output + const WebPDecBuffer* output_; // shortcut to io->opaque->output - uint32_t *pixels_; // Internal data: either uint8_t* for alpha + uint32_t* pixels_; // Internal data: either uint8_t* for alpha // or uint32_t* for BGRA. - uint32_t *argb_cache_; // Scratch buffer for temporary BGRA storage. + uint32_t* argb_cache_; // Scratch buffer for temporary BGRA storage. VP8LBitReader br_; int incremental_; // if true, incremental decoding is expected @@ -86,8 +86,8 @@ struct VP8LDecoder { // or'd bitset storing the transforms types. uint32_t transforms_seen_; - uint8_t *rescaler_memory; // Working memory for rescaling work. - WebPRescaler *rescaler; // Common rescaler for all channels. + uint8_t* rescaler_memory; // Working memory for rescaling work. + WebPRescaler* rescaler; // Common rescaler for all channels. }; //------------------------------------------------------------------------------ @@ -132,4 +132,4 @@ void VP8LDelete(VP8LDecoder* const dec); } // extern "C" #endif -#endif /* WEBP_DEC_VP8LI_H_ */ +#endif // WEBP_DEC_VP8LI_DEC_H_ diff --git a/Pods/libwebp/src/dec/webp_dec.c b/Pods/libwebp/src/dec/webp_dec.c index a8e9c2c..42d0988 100644 --- a/Pods/libwebp/src/dec/webp_dec.c +++ b/Pods/libwebp/src/dec/webp_dec.c @@ -13,11 +13,11 @@ #include -#include "./vp8i_dec.h" -#include "./vp8li_dec.h" -#include "./webpi_dec.h" -#include "../utils/utils.h" -#include "../webp/mux_types.h" // ALPHA_FLAG +#include "src/dec/vp8i_dec.h" +#include "src/dec/vp8li_dec.h" +#include "src/dec/webpi_dec.h" +#include "src/utils/utils.h" +#include "src/webp/mux_types.h" // ALPHA_FLAG //------------------------------------------------------------------------------ // RIFF layout is: @@ -421,7 +421,9 @@ VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers) { NULL, NULL, NULL, &has_animation, NULL, headers); if (status == VP8_STATUS_OK || status == VP8_STATUS_NOT_ENOUGH_DATA) { - // TODO(jzern): full support of animation frames will require API additions. + // The WebPDemux API + libwebp can be used to decode individual + // uncomposited frames or the WebPAnimDecoder can be used to fully + // reconstruct them (see webp/demux.h). if (has_animation) { status = VP8_STATUS_UNSUPPORTED_FEATURE; } diff --git a/Pods/libwebp/src/dec/webpi_dec.h b/Pods/libwebp/src/dec/webpi_dec.h index 696abc1..24baff5 100644 --- a/Pods/libwebp/src/dec/webpi_dec.h +++ b/Pods/libwebp/src/dec/webpi_dec.h @@ -11,15 +11,15 @@ // // Author: somnath@google.com (Somnath Banerjee) -#ifndef WEBP_DEC_WEBPI_H_ -#define WEBP_DEC_WEBPI_H_ +#ifndef WEBP_DEC_WEBPI_DEC_H_ +#define WEBP_DEC_WEBPI_DEC_H_ #ifdef __cplusplus extern "C" { #endif -#include "../utils/rescaler_utils.h" -#include "./vp8_dec.h" +#include "src/utils/rescaler_utils.h" +#include "src/dec/vp8_dec.h" //------------------------------------------------------------------------------ // WebPDecParams: Decoding output parameters. Transient internal object. @@ -130,4 +130,4 @@ int WebPAvoidSlowMemory(const WebPDecBuffer* const output, } // extern "C" #endif -#endif /* WEBP_DEC_WEBPI_H_ */ +#endif // WEBP_DEC_WEBPI_DEC_H_ diff --git a/Pods/libwebp/src/demux/Makefile.am b/Pods/libwebp/src/demux/Makefile.am new file mode 100644 index 0000000..a0b0c6a --- /dev/null +++ b/Pods/libwebp/src/demux/Makefile.am @@ -0,0 +1,18 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +lib_LTLIBRARIES = libwebpdemux.la + +libwebpdemux_la_SOURCES = +libwebpdemux_la_SOURCES += anim_decode.c demux.c + +libwebpdemuxinclude_HEADERS = +libwebpdemuxinclude_HEADERS += ../webp/decode.h +libwebpdemuxinclude_HEADERS += ../webp/demux.h +libwebpdemuxinclude_HEADERS += ../webp/mux_types.h +libwebpdemuxinclude_HEADERS += ../webp/types.h +noinst_HEADERS = +noinst_HEADERS += ../webp/format_constants.h + +libwebpdemux_la_LIBADD = ../libwebp.la +libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:6:0 +libwebpdemuxincludedir = $(includedir)/webp +pkgconfig_DATA = libwebpdemux.pc diff --git a/Pods/libwebp/src/demux/anim_decode.c b/Pods/libwebp/src/demux/anim_decode.c index f1cf176..05dd707 100644 --- a/Pods/libwebp/src/demux/anim_decode.c +++ b/Pods/libwebp/src/demux/anim_decode.c @@ -11,15 +11,15 @@ // #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif #include #include -#include "../utils/utils.h" -#include "../webp/decode.h" -#include "../webp/demux.h" +#include "src/utils/utils.h" +#include "src/webp/decode.h" +#include "src/webp/demux.h" #define NUM_CHANNELS 4 diff --git a/Pods/libwebp/src/demux/demux.c b/Pods/libwebp/src/demux/demux.c index 100eab8..1b3cc2e 100644 --- a/Pods/libwebp/src/demux/demux.c +++ b/Pods/libwebp/src/demux/demux.c @@ -11,21 +11,21 @@ // #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif #include #include #include -#include "../utils/utils.h" -#include "../webp/decode.h" // WebPGetFeatures -#include "../webp/demux.h" -#include "../webp/format_constants.h" +#include "src/utils/utils.h" +#include "src/webp/decode.h" // WebPGetFeatures +#include "src/webp/demux.h" +#include "src/webp/format_constants.h" -#define DMUX_MAJ_VERSION 0 -#define DMUX_MIN_VERSION 3 -#define DMUX_REV_VERSION 2 +#define DMUX_MAJ_VERSION 1 +#define DMUX_MIN_VERSION 1 +#define DMUX_REV_VERSION 0 typedef struct { size_t start_; // start location of the data @@ -205,12 +205,14 @@ static void SetFrameInfo(size_t start_offset, size_t size, frame->complete_ = complete; } -// Store image bearing chunks to 'frame'. +// Store image bearing chunks to 'frame'. 'min_size' is an optional size +// requirement, it may be zero. static ParseStatus StoreFrame(int frame_num, uint32_t min_size, MemBuffer* const mem, Frame* const frame) { int alpha_chunks = 0; int image_chunks = 0; - int done = (MemDataSize(mem) < min_size); + int done = (MemDataSize(mem) < CHUNK_HEADER_SIZE || + MemDataSize(mem) < min_size); ParseStatus status = PARSE_OK; if (done) return PARSE_NEED_MORE_DATA; @@ -401,9 +403,9 @@ static ParseStatus ParseSingleImage(WebPDemuxer* const dmux) { frame = (Frame*)WebPSafeCalloc(1ULL, sizeof(*frame)); if (frame == NULL) return PARSE_ERROR; - // For the single image case we allow parsing of a partial frame, but we need - // at least CHUNK_HEADER_SIZE for parsing. - status = StoreFrame(1, CHUNK_HEADER_SIZE, &dmux->mem_, frame); + // For the single image case we allow parsing of a partial frame, so no + // minimum size is imposed here. + status = StoreFrame(1, 0, &dmux->mem_, frame); if (status != PARSE_ERROR) { const int has_alpha = !!(dmux->feature_flags_ & ALPHA_FLAG); // Clear any alpha when the alpha flag is missing. diff --git a/Pods/libwebp/src/demux/libwebpdemux.pc.in b/Pods/libwebp/src/demux/libwebpdemux.pc.in new file mode 100644 index 0000000..6dfbbbd --- /dev/null +++ b/Pods/libwebp/src/demux/libwebpdemux.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libwebpdemux +Description: Library for parsing the WebP graphics format container +Version: @PACKAGE_VERSION@ +Requires: libwebp >= 0.2.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lwebpdemux diff --git a/Pods/libwebp/src/demux/libwebpdemux.rc b/Pods/libwebp/src/demux/libwebpdemux.rc new file mode 100644 index 0000000..66f26d1 --- /dev/null +++ b/Pods/libwebp/src/demux/libwebpdemux.rc @@ -0,0 +1,41 @@ +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,1,0 + PRODUCTVERSION 1,0,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Google, Inc." + VALUE "FileDescription", "libwebpdemux DLL" + VALUE "FileVersion", "1.1.0" + VALUE "InternalName", "libwebpdemux.dll" + VALUE "LegalCopyright", "Copyright (C) 2019" + VALUE "OriginalFilename", "libwebpdemux.dll" + VALUE "ProductName", "WebP Image Demuxer" + VALUE "ProductVersion", "1.1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources diff --git a/Pods/libwebp/src/dsp/Makefile.am b/Pods/libwebp/src/dsp/Makefile.am new file mode 100644 index 0000000..9f67f5b --- /dev/null +++ b/Pods/libwebp/src/dsp/Makefile.am @@ -0,0 +1,185 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +noinst_LTLIBRARIES = +noinst_LTLIBRARIES += libwebpdsp.la +noinst_LTLIBRARIES += libwebpdsp_sse2.la +noinst_LTLIBRARIES += libwebpdspdecode_sse2.la +noinst_LTLIBRARIES += libwebpdsp_sse41.la +noinst_LTLIBRARIES += libwebpdspdecode_sse41.la +noinst_LTLIBRARIES += libwebpdsp_neon.la +noinst_LTLIBRARIES += libwebpdspdecode_neon.la +noinst_LTLIBRARIES += libwebpdsp_msa.la +noinst_LTLIBRARIES += libwebpdspdecode_msa.la +noinst_LTLIBRARIES += libwebpdsp_mips32.la +noinst_LTLIBRARIES += libwebpdspdecode_mips32.la +noinst_LTLIBRARIES += libwebpdsp_mips_dsp_r2.la +noinst_LTLIBRARIES += libwebpdspdecode_mips_dsp_r2.la + +if BUILD_LIBWEBPDECODER + noinst_LTLIBRARIES += libwebpdspdecode.la +endif + +common_HEADERS = ../webp/types.h +commondir = $(includedir)/webp + +COMMON_SOURCES = +COMMON_SOURCES += alpha_processing.c +COMMON_SOURCES += cpu.c +COMMON_SOURCES += dec.c +COMMON_SOURCES += dec_clip_tables.c +COMMON_SOURCES += dsp.h +COMMON_SOURCES += filters.c +COMMON_SOURCES += lossless.c +COMMON_SOURCES += lossless.h +COMMON_SOURCES += lossless_common.h +COMMON_SOURCES += rescaler.c +COMMON_SOURCES += upsampling.c +COMMON_SOURCES += yuv.c +COMMON_SOURCES += yuv.h + +ENC_SOURCES = +ENC_SOURCES += cost.c +ENC_SOURCES += enc.c +ENC_SOURCES += lossless_enc.c +ENC_SOURCES += quant.h +ENC_SOURCES += ssim.c + +libwebpdspdecode_sse41_la_SOURCES = +libwebpdspdecode_sse41_la_SOURCES += alpha_processing_sse41.c +libwebpdspdecode_sse41_la_SOURCES += dec_sse41.c +libwebpdspdecode_sse41_la_SOURCES += upsampling_sse41.c +libwebpdspdecode_sse41_la_SOURCES += yuv_sse41.c +libwebpdspdecode_sse41_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdspdecode_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_FLAGS) + +libwebpdspdecode_sse2_la_SOURCES = +libwebpdspdecode_sse2_la_SOURCES += alpha_processing_sse2.c +libwebpdspdecode_sse2_la_SOURCES += common_sse2.h +libwebpdspdecode_sse2_la_SOURCES += dec_sse2.c +libwebpdspdecode_sse2_la_SOURCES += filters_sse2.c +libwebpdspdecode_sse2_la_SOURCES += lossless_sse2.c +libwebpdspdecode_sse2_la_SOURCES += rescaler_sse2.c +libwebpdspdecode_sse2_la_SOURCES += upsampling_sse2.c +libwebpdspdecode_sse2_la_SOURCES += yuv_sse2.c +libwebpdspdecode_sse2_la_CPPFLAGS = $(libwebpdsp_sse2_la_CPPFLAGS) +libwebpdspdecode_sse2_la_CFLAGS = $(libwebpdsp_sse2_la_CFLAGS) + +libwebpdspdecode_neon_la_SOURCES = +libwebpdspdecode_neon_la_SOURCES += alpha_processing_neon.c +libwebpdspdecode_neon_la_SOURCES += dec_neon.c +libwebpdspdecode_neon_la_SOURCES += filters_neon.c +libwebpdspdecode_neon_la_SOURCES += lossless_neon.c +libwebpdspdecode_neon_la_SOURCES += neon.h +libwebpdspdecode_neon_la_SOURCES += rescaler_neon.c +libwebpdspdecode_neon_la_SOURCES += upsampling_neon.c +libwebpdspdecode_neon_la_SOURCES += yuv_neon.c +libwebpdspdecode_neon_la_CPPFLAGS = $(libwebpdsp_neon_la_CPPFLAGS) +libwebpdspdecode_neon_la_CFLAGS = $(libwebpdsp_neon_la_CFLAGS) + +libwebpdspdecode_msa_la_SOURCES = +libwebpdspdecode_msa_la_SOURCES += dec_msa.c +libwebpdspdecode_msa_la_SOURCES += filters_msa.c +libwebpdspdecode_msa_la_SOURCES += lossless_msa.c +libwebpdspdecode_msa_la_SOURCES += msa_macro.h +libwebpdspdecode_msa_la_SOURCES += rescaler_msa.c +libwebpdspdecode_msa_la_SOURCES += upsampling_msa.c +libwebpdspdecode_msa_la_CPPFLAGS = $(libwebpdsp_msa_la_CPPFLAGS) +libwebpdspdecode_msa_la_CFLAGS = $(libwebpdsp_msa_la_CFLAGS) + +libwebpdspdecode_mips32_la_SOURCES = +libwebpdspdecode_mips32_la_SOURCES += dec_mips32.c +libwebpdspdecode_mips32_la_SOURCES += mips_macro.h +libwebpdspdecode_mips32_la_SOURCES += rescaler_mips32.c +libwebpdspdecode_mips32_la_SOURCES += yuv_mips32.c +libwebpdspdecode_mips32_la_CPPFLAGS = $(libwebpdsp_mips32_la_CPPFLAGS) +libwebpdspdecode_mips32_la_CFLAGS = $(libwebpdsp_mips32_la_CFLAGS) + +libwebpdspdecode_mips_dsp_r2_la_SOURCES = +libwebpdspdecode_mips_dsp_r2_la_SOURCES += alpha_processing_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_SOURCES += dec_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_SOURCES += filters_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_SOURCES += lossless_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_SOURCES += mips_macro.h +libwebpdspdecode_mips_dsp_r2_la_SOURCES += rescaler_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_SOURCES += upsampling_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_SOURCES += yuv_mips_dsp_r2.c +libwebpdspdecode_mips_dsp_r2_la_CPPFLAGS = $(libwebpdsp_mips_dsp_r2_la_CPPFLAGS) +libwebpdspdecode_mips_dsp_r2_la_CFLAGS = $(libwebpdsp_mips_dsp_r2_la_CFLAGS) + +libwebpdsp_sse2_la_SOURCES = +libwebpdsp_sse2_la_SOURCES += cost_sse2.c +libwebpdsp_sse2_la_SOURCES += enc_sse2.c +libwebpdsp_sse2_la_SOURCES += lossless_enc_sse2.c +libwebpdsp_sse2_la_SOURCES += ssim_sse2.c +libwebpdsp_sse2_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_sse2_la_CFLAGS = $(AM_CFLAGS) $(SSE2_FLAGS) +libwebpdsp_sse2_la_LIBADD = libwebpdspdecode_sse2.la + +libwebpdsp_sse41_la_SOURCES = +libwebpdsp_sse41_la_SOURCES += enc_sse41.c +libwebpdsp_sse41_la_SOURCES += lossless_enc_sse41.c +libwebpdsp_sse41_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_FLAGS) +libwebpdsp_sse41_la_LIBADD = libwebpdspdecode_sse41.la + +libwebpdsp_neon_la_SOURCES = +libwebpdsp_neon_la_SOURCES += cost_neon.c +libwebpdsp_neon_la_SOURCES += enc_neon.c +libwebpdsp_neon_la_SOURCES += lossless_enc_neon.c +libwebpdsp_neon_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_neon_la_CFLAGS = $(AM_CFLAGS) $(NEON_FLAGS) +libwebpdsp_neon_la_LIBADD = libwebpdspdecode_neon.la + +libwebpdsp_msa_la_SOURCES = +libwebpdsp_msa_la_SOURCES += enc_msa.c +libwebpdsp_msa_la_SOURCES += lossless_enc_msa.c +libwebpdsp_msa_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_msa_la_CFLAGS = $(AM_CFLAGS) +libwebpdsp_msa_la_LIBADD = libwebpdspdecode_msa.la + +libwebpdsp_mips32_la_SOURCES = +libwebpdsp_mips32_la_SOURCES += cost_mips32.c +libwebpdsp_mips32_la_SOURCES += enc_mips32.c +libwebpdsp_mips32_la_SOURCES += lossless_enc_mips32.c +libwebpdsp_mips32_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_mips32_la_CFLAGS = $(AM_CFLAGS) +libwebpdsp_mips32_la_LIBADD = libwebpdspdecode_mips32.la + +libwebpdsp_mips_dsp_r2_la_SOURCES = +libwebpdsp_mips_dsp_r2_la_SOURCES += cost_mips_dsp_r2.c +libwebpdsp_mips_dsp_r2_la_SOURCES += enc_mips_dsp_r2.c +libwebpdsp_mips_dsp_r2_la_SOURCES += lossless_enc_mips_dsp_r2.c +libwebpdsp_mips_dsp_r2_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) +libwebpdsp_mips_dsp_r2_la_CFLAGS = $(AM_CFLAGS) +libwebpdsp_mips_dsp_r2_la_LIBADD = libwebpdspdecode_mips_dsp_r2.la + +libwebpdsp_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES) + +noinst_HEADERS = +noinst_HEADERS += ../dec/vp8_dec.h +noinst_HEADERS += ../webp/decode.h + +libwebpdsp_la_CPPFLAGS = +libwebpdsp_la_CPPFLAGS += $(AM_CPPFLAGS) +libwebpdsp_la_CPPFLAGS += $(USE_SWAP_16BIT_CSP) +libwebpdsp_la_LDFLAGS = -lm +libwebpdsp_la_LIBADD = +libwebpdsp_la_LIBADD += libwebpdsp_sse2.la +libwebpdsp_la_LIBADD += libwebpdsp_sse41.la +libwebpdsp_la_LIBADD += libwebpdsp_neon.la +libwebpdsp_la_LIBADD += libwebpdsp_msa.la +libwebpdsp_la_LIBADD += libwebpdsp_mips32.la +libwebpdsp_la_LIBADD += libwebpdsp_mips_dsp_r2.la + +if BUILD_LIBWEBPDECODER + libwebpdspdecode_la_SOURCES = $(COMMON_SOURCES) + + libwebpdspdecode_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) + libwebpdspdecode_la_LDFLAGS = $(libwebpdsp_la_LDFLAGS) + libwebpdspdecode_la_LIBADD = + libwebpdspdecode_la_LIBADD += libwebpdspdecode_sse2.la + libwebpdspdecode_la_LIBADD += libwebpdspdecode_sse41.la + libwebpdspdecode_la_LIBADD += libwebpdspdecode_neon.la + libwebpdspdecode_la_LIBADD += libwebpdspdecode_msa.la + libwebpdspdecode_la_LIBADD += libwebpdspdecode_mips32.la + libwebpdspdecode_la_LIBADD += libwebpdspdecode_mips_dsp_r2.la +endif diff --git a/Pods/libwebp/src/dsp/alpha_processing.c b/Pods/libwebp/src/dsp/alpha_processing.c index 4b60e09..819d139 100644 --- a/Pods/libwebp/src/dsp/alpha_processing.c +++ b/Pods/libwebp/src/dsp/alpha_processing.c @@ -12,10 +12,13 @@ // Author: Skal (pascal.massimino@gmail.com) #include -#include "./dsp.h" +#include "src/dsp/dsp.h" // Tables can be faster on some platform but incur some extra binary size (~2k). -// #define USE_TABLES_FOR_ALPHA_MULT +#if !defined(USE_TABLES_FOR_ALPHA_MULT) +#define USE_TABLES_FOR_ALPHA_MULT 0 // ALTERNATE_CODE +#endif + // ----------------------------------------------------------------------------- @@ -29,7 +32,7 @@ static uint32_t Mult(uint8_t x, uint32_t mult) { return v; } -#ifdef USE_TABLES_FOR_ALPHA_MULT +#if (USE_TABLES_FOR_ALPHA_MULT == 1) static const uint32_t kMultTables[2][256] = { { // (255u << MFIX) / alpha @@ -132,9 +135,9 @@ static WEBP_INLINE uint32_t GetScale(uint32_t a, int inverse) { return inverse ? (255u << MFIX) / a : a * KINV_255; } -#endif // USE_TABLES_FOR_ALPHA_MULT +#endif // USE_TABLES_FOR_ALPHA_MULT -void WebPMultARGBRowC(uint32_t* const ptr, int width, int inverse) { +void WebPMultARGBRow_C(uint32_t* const ptr, int width, int inverse) { int x; for (x = 0; x < width; ++x) { const uint32_t argb = ptr[x]; @@ -154,8 +157,8 @@ void WebPMultARGBRowC(uint32_t* const ptr, int width, int inverse) { } } -void WebPMultRowC(uint8_t* const ptr, const uint8_t* const alpha, - int width, int inverse) { +void WebPMultRow_C(uint8_t* const ptr, const uint8_t* const alpha, + int width, int inverse) { int x; for (x = 0; x < width; ++x) { const uint32_t a = alpha[x]; @@ -217,8 +220,9 @@ void WebPMultRows(uint8_t* ptr, int stride, #define PREMULTIPLY(x, m) (((x) * (m) + (1U << 23)) >> 24) #endif -static void ApplyAlphaMultiply(uint8_t* rgba, int alpha_first, - int w, int h, int stride) { +#if !WEBP_NEON_OMIT_C_CODE +static void ApplyAlphaMultiply_C(uint8_t* rgba, int alpha_first, + int w, int h, int stride) { while (h-- > 0) { uint8_t* const rgb = rgba + (alpha_first ? 1 : 0); const uint8_t* const alpha = rgba + (alpha_first ? 0 : 3); @@ -235,6 +239,7 @@ static void ApplyAlphaMultiply(uint8_t* rgba, int alpha_first, rgba += stride; } } +#endif // !WEBP_NEON_OMIT_C_CODE #undef MULTIPLIER #undef PREMULTIPLY @@ -254,9 +259,9 @@ static WEBP_INLINE uint8_t multiply(uint8_t x, uint32_t m) { return (x * m) >> 16; } -static WEBP_INLINE void ApplyAlphaMultiply4444(uint8_t* rgba4444, - int w, int h, int stride, - int rg_byte_pos /* 0 or 1 */) { +static WEBP_INLINE void ApplyAlphaMultiply4444_C(uint8_t* rgba4444, + int w, int h, int stride, + int rg_byte_pos /* 0 or 1 */) { while (h-- > 0) { int i; for (i = 0; i < w; ++i) { @@ -275,15 +280,16 @@ static WEBP_INLINE void ApplyAlphaMultiply4444(uint8_t* rgba4444, } #undef MULTIPLIER -static void ApplyAlphaMultiply_16b(uint8_t* rgba4444, - int w, int h, int stride) { -#ifdef WEBP_SWAP_16BIT_CSP - ApplyAlphaMultiply4444(rgba4444, w, h, stride, 1); +static void ApplyAlphaMultiply_16b_C(uint8_t* rgba4444, + int w, int h, int stride) { +#if (WEBP_SWAP_16BIT_CSP == 1) + ApplyAlphaMultiply4444_C(rgba4444, w, h, stride, 1); #else - ApplyAlphaMultiply4444(rgba4444, w, h, stride, 0); + ApplyAlphaMultiply4444_C(rgba4444, w, h, stride, 0); #endif } +#if !WEBP_NEON_OMIT_C_CODE static int DispatchAlpha_C(const uint8_t* alpha, int alpha_stride, int width, int height, uint8_t* dst, int dst_stride) { @@ -338,6 +344,46 @@ static void ExtractGreen_C(const uint32_t* argb, uint8_t* alpha, int size) { int i; for (i = 0; i < size; ++i) alpha[i] = argb[i] >> 8; } +#endif // !WEBP_NEON_OMIT_C_CODE + +//------------------------------------------------------------------------------ + +static int HasAlpha8b_C(const uint8_t* src, int length) { + while (length-- > 0) if (*src++ != 0xff) return 1; + return 0; +} + +static int HasAlpha32b_C(const uint8_t* src, int length) { + int x; + for (x = 0; length-- > 0; x += 4) if (src[x] != 0xff) return 1; + return 0; +} + +//------------------------------------------------------------------------------ +// Simple channel manipulations. + +static WEBP_INLINE uint32_t MakeARGB32(int a, int r, int g, int b) { + return (((uint32_t)a << 24) | (r << 16) | (g << 8) | b); +} + +#ifdef WORDS_BIGENDIAN +static void PackARGB_C(const uint8_t* a, const uint8_t* r, const uint8_t* g, + const uint8_t* b, int len, uint32_t* out) { + int i; + for (i = 0; i < len; ++i) { + out[i] = MakeARGB32(a[4 * i], r[4 * i], g[4 * i], b[4 * i]); + } +} +#endif + +static void PackRGB_C(const uint8_t* r, const uint8_t* g, const uint8_t* b, + int len, int step, uint32_t* out) { + int i, offset = 0; + for (i = 0; i < len; ++i) { + out[i] = MakeARGB32(0xff, r[offset], g[offset], b[offset]); + offset += step; + } +} void (*WebPApplyAlphaMultiply)(uint8_t*, int, int, int, int); void (*WebPApplyAlphaMultiply4444)(uint8_t*, int, int, int); @@ -345,6 +391,15 @@ int (*WebPDispatchAlpha)(const uint8_t*, int, int, int, uint8_t*, int); void (*WebPDispatchAlphaToGreen)(const uint8_t*, int, int, int, uint32_t*, int); int (*WebPExtractAlpha)(const uint8_t*, int, int, int, uint8_t*, int); void (*WebPExtractGreen)(const uint32_t* argb, uint8_t* alpha, int size); +#ifdef WORDS_BIGENDIAN +void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r, const uint8_t* g, + const uint8_t* b, int, uint32_t*); +#endif +void (*WebPPackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b, + int len, int step, uint32_t* out); + +int (*WebPHasAlpha8b)(const uint8_t* src, int length); +int (*WebPHasAlpha32b)(const uint8_t* src, int length); //------------------------------------------------------------------------------ // Init function @@ -354,21 +409,25 @@ extern void WebPInitAlphaProcessingSSE2(void); extern void WebPInitAlphaProcessingSSE41(void); extern void WebPInitAlphaProcessingNEON(void); -static volatile VP8CPUInfo alpha_processing_last_cpuinfo_used = - (VP8CPUInfo)&alpha_processing_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void) { - if (alpha_processing_last_cpuinfo_used == VP8GetCPUInfo) return; - - WebPMultARGBRow = WebPMultARGBRowC; - WebPMultRow = WebPMultRowC; - WebPApplyAlphaMultiply = ApplyAlphaMultiply; - WebPApplyAlphaMultiply4444 = ApplyAlphaMultiply_16b; +WEBP_DSP_INIT_FUNC(WebPInitAlphaProcessing) { + WebPMultARGBRow = WebPMultARGBRow_C; + WebPMultRow = WebPMultRow_C; + WebPApplyAlphaMultiply4444 = ApplyAlphaMultiply_16b_C; +#ifdef WORDS_BIGENDIAN + WebPPackARGB = PackARGB_C; +#endif + WebPPackRGB = PackRGB_C; +#if !WEBP_NEON_OMIT_C_CODE + WebPApplyAlphaMultiply = ApplyAlphaMultiply_C; WebPDispatchAlpha = DispatchAlpha_C; WebPDispatchAlphaToGreen = DispatchAlphaToGreen_C; WebPExtractAlpha = ExtractAlpha_C; WebPExtractGreen = ExtractGreen_C; +#endif + + WebPHasAlpha8b = HasAlpha8b_C; + WebPHasAlpha32b = HasAlpha32b_C; // If defined, use CPUInfo() to overwrite some pointers with faster versions. if (VP8GetCPUInfo != NULL) { @@ -382,16 +441,32 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void) { #endif } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - WebPInitAlphaProcessingNEON(); - } -#endif #if defined(WEBP_USE_MIPS_DSP_R2) if (VP8GetCPUInfo(kMIPSdspR2)) { WebPInitAlphaProcessingMIPSdspR2(); } #endif } - alpha_processing_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + WebPInitAlphaProcessingNEON(); + } +#endif + + assert(WebPMultARGBRow != NULL); + assert(WebPMultRow != NULL); + assert(WebPApplyAlphaMultiply != NULL); + assert(WebPApplyAlphaMultiply4444 != NULL); + assert(WebPDispatchAlpha != NULL); + assert(WebPDispatchAlphaToGreen != NULL); + assert(WebPExtractAlpha != NULL); + assert(WebPExtractGreen != NULL); +#ifdef WORDS_BIGENDIAN + assert(WebPPackARGB != NULL); +#endif + assert(WebPPackRGB != NULL); + assert(WebPHasAlpha8b != NULL); + assert(WebPHasAlpha32b != NULL); } diff --git a/Pods/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c b/Pods/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c index c631d78..0090e87 100644 --- a/Pods/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c @@ -12,13 +12,13 @@ // Author(s): Branimir Vasic (branimir.vasic@imgtec.com) // Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -static int DispatchAlpha(const uint8_t* alpha, int alpha_stride, - int width, int height, - uint8_t* dst, int dst_stride) { +static int DispatchAlpha_MIPSdspR2(const uint8_t* alpha, int alpha_stride, + int width, int height, + uint8_t* dst, int dst_stride) { uint32_t alpha_mask = 0xffffffff; int i, j, temp0; @@ -79,7 +79,8 @@ static int DispatchAlpha(const uint8_t* alpha, int alpha_stride, return (alpha_mask != 0xff); } -static void MultARGBRow(uint32_t* const ptr, int width, int inverse) { +static void MultARGBRow_MIPSdspR2(uint32_t* const ptr, int width, + int inverse) { int x; const uint32_t c_00ffffff = 0x00ffffffu; const uint32_t c_ff000000 = 0xff000000u; @@ -124,14 +125,100 @@ static void MultARGBRow(uint32_t* const ptr, int width, int inverse) { } } +#ifdef WORDS_BIGENDIAN +static void PackARGB_MIPSdspR2(const uint8_t* a, const uint8_t* r, + const uint8_t* g, const uint8_t* b, int len, + uint32_t* out) { + int temp0, temp1, temp2, temp3, offset; + const int rest = len & 1; + const uint32_t* const loop_end = out + len - rest; + const int step = 4; + __asm__ volatile ( + "xor %[offset], %[offset], %[offset] \n\t" + "beq %[loop_end], %[out], 0f \n\t" + "2: \n\t" + "lbux %[temp0], %[offset](%[a]) \n\t" + "lbux %[temp1], %[offset](%[r]) \n\t" + "lbux %[temp2], %[offset](%[g]) \n\t" + "lbux %[temp3], %[offset](%[b]) \n\t" + "ins %[temp1], %[temp0], 16, 16 \n\t" + "ins %[temp3], %[temp2], 16, 16 \n\t" + "addiu %[out], %[out], 4 \n\t" + "precr.qb.ph %[temp0], %[temp1], %[temp3] \n\t" + "sw %[temp0], -4(%[out]) \n\t" + "addu %[offset], %[offset], %[step] \n\t" + "bne %[loop_end], %[out], 2b \n\t" + "0: \n\t" + "beq %[rest], $zero, 1f \n\t" + "lbux %[temp0], %[offset](%[a]) \n\t" + "lbux %[temp1], %[offset](%[r]) \n\t" + "lbux %[temp2], %[offset](%[g]) \n\t" + "lbux %[temp3], %[offset](%[b]) \n\t" + "ins %[temp1], %[temp0], 16, 16 \n\t" + "ins %[temp3], %[temp2], 16, 16 \n\t" + "precr.qb.ph %[temp0], %[temp1], %[temp3] \n\t" + "sw %[temp0], 0(%[out]) \n\t" + "1: \n\t" + : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), + [temp3]"=&r"(temp3), [offset]"=&r"(offset), [out]"+&r"(out) + : [a]"r"(a), [r]"r"(r), [g]"r"(g), [b]"r"(b), [step]"r"(step), + [loop_end]"r"(loop_end), [rest]"r"(rest) + : "memory" + ); +} +#endif // WORDS_BIGENDIAN + +static void PackRGB_MIPSdspR2(const uint8_t* r, const uint8_t* g, + const uint8_t* b, int len, int step, + uint32_t* out) { + int temp0, temp1, temp2, offset; + const int rest = len & 1; + const int a = 0xff; + const uint32_t* const loop_end = out + len - rest; + __asm__ volatile ( + "xor %[offset], %[offset], %[offset] \n\t" + "beq %[loop_end], %[out], 0f \n\t" + "2: \n\t" + "lbux %[temp0], %[offset](%[r]) \n\t" + "lbux %[temp1], %[offset](%[g]) \n\t" + "lbux %[temp2], %[offset](%[b]) \n\t" + "ins %[temp0], %[a], 16, 16 \n\t" + "ins %[temp2], %[temp1], 16, 16 \n\t" + "addiu %[out], %[out], 4 \n\t" + "precr.qb.ph %[temp0], %[temp0], %[temp2] \n\t" + "sw %[temp0], -4(%[out]) \n\t" + "addu %[offset], %[offset], %[step] \n\t" + "bne %[loop_end], %[out], 2b \n\t" + "0: \n\t" + "beq %[rest], $zero, 1f \n\t" + "lbux %[temp0], %[offset](%[r]) \n\t" + "lbux %[temp1], %[offset](%[g]) \n\t" + "lbux %[temp2], %[offset](%[b]) \n\t" + "ins %[temp0], %[a], 16, 16 \n\t" + "ins %[temp2], %[temp1], 16, 16 \n\t" + "precr.qb.ph %[temp0], %[temp0], %[temp2] \n\t" + "sw %[temp0], 0(%[out]) \n\t" + "1: \n\t" + : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), + [offset]"=&r"(offset), [out]"+&r"(out) + : [a]"r"(a), [r]"r"(r), [g]"r"(g), [b]"r"(b), [step]"r"(step), + [loop_end]"r"(loop_end), [rest]"r"(rest) + : "memory" + ); +} + //------------------------------------------------------------------------------ // Entry point extern void WebPInitAlphaProcessingMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessingMIPSdspR2(void) { - WebPDispatchAlpha = DispatchAlpha; - WebPMultARGBRow = MultARGBRow; + WebPDispatchAlpha = DispatchAlpha_MIPSdspR2; + WebPMultARGBRow = MultARGBRow_MIPSdspR2; +#ifdef WORDS_BIGENDIAN + WebPPackARGB = PackARGB_MIPSdspR2; +#endif + WebPPackRGB = PackRGB_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/alpha_processing_neon.c b/Pods/libwebp/src/dsp/alpha_processing_neon.c index 606a401..9d55421 100644 --- a/Pods/libwebp/src/dsp/alpha_processing_neon.c +++ b/Pods/libwebp/src/dsp/alpha_processing_neon.c @@ -11,11 +11,11 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) -#include "./neon.h" +#include "src/dsp/neon.h" //------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/dsp/alpha_processing_sse2.c b/Pods/libwebp/src/dsp/alpha_processing_sse2.c index 83dc559..2871c56 100644 --- a/Pods/libwebp/src/dsp/alpha_processing_sse2.c +++ b/Pods/libwebp/src/dsp/alpha_processing_sse2.c @@ -11,16 +11,16 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) #include //------------------------------------------------------------------------------ -static int DispatchAlpha(const uint8_t* alpha, int alpha_stride, - int width, int height, - uint8_t* dst, int dst_stride) { +static int DispatchAlpha_SSE2(const uint8_t* alpha, int alpha_stride, + int width, int height, + uint8_t* dst, int dst_stride) { // alpha_and stores an 'and' operation of all the alpha[] values. The final // value is not 0xff if any of the alpha[] is not equal to 0xff. uint32_t alpha_and = 0xff; @@ -72,9 +72,9 @@ static int DispatchAlpha(const uint8_t* alpha, int alpha_stride, return (alpha_and != 0xff); } -static void DispatchAlphaToGreen(const uint8_t* alpha, int alpha_stride, - int width, int height, - uint32_t* dst, int dst_stride) { +static void DispatchAlphaToGreen_SSE2(const uint8_t* alpha, int alpha_stride, + int width, int height, + uint32_t* dst, int dst_stride) { int i, j; const __m128i zero = _mm_setzero_si128(); const int limit = width & ~15; @@ -98,9 +98,9 @@ static void DispatchAlphaToGreen(const uint8_t* alpha, int alpha_stride, } } -static int ExtractAlpha(const uint8_t* argb, int argb_stride, - int width, int height, - uint8_t* alpha, int alpha_stride) { +static int ExtractAlpha_SSE2(const uint8_t* argb, int argb_stride, + int width, int height, + uint8_t* alpha, int alpha_stride) { // alpha_and stores an 'and' operation of all the alpha[] values. The final // value is not 0xff if any of the alpha[] is not equal to 0xff. uint32_t alpha_and = 0xff; @@ -210,6 +210,61 @@ static void ApplyAlphaMultiply_SSE2(uint8_t* rgba, int alpha_first, #undef MULTIPLIER #undef PREMULTIPLY +//------------------------------------------------------------------------------ +// Alpha detection + +static int HasAlpha8b_SSE2(const uint8_t* src, int length) { + const __m128i all_0xff = _mm_set1_epi8((char)0xff); + int i = 0; + for (; i + 16 <= length; i += 16) { + const __m128i v = _mm_loadu_si128((const __m128i*)(src + i)); + const __m128i bits = _mm_cmpeq_epi8(v, all_0xff); + const int mask = _mm_movemask_epi8(bits); + if (mask != 0xffff) return 1; + } + for (; i < length; ++i) if (src[i] != 0xff) return 1; + return 0; +} + +static int HasAlpha32b_SSE2(const uint8_t* src, int length) { + const __m128i alpha_mask = _mm_set1_epi32(0xff); + const __m128i all_0xff = _mm_set1_epi8((char)0xff); + int i = 0; + // We don't know if we can access the last 3 bytes after the last alpha + // value 'src[4 * length - 4]' (because we don't know if alpha is the first + // or the last byte of the quadruplet). Hence the '-3' protection below. + length = length * 4 - 3; // size in bytes + for (; i + 64 <= length; i += 64) { + const __m128i a0 = _mm_loadu_si128((const __m128i*)(src + i + 0)); + const __m128i a1 = _mm_loadu_si128((const __m128i*)(src + i + 16)); + const __m128i a2 = _mm_loadu_si128((const __m128i*)(src + i + 32)); + const __m128i a3 = _mm_loadu_si128((const __m128i*)(src + i + 48)); + const __m128i b0 = _mm_and_si128(a0, alpha_mask); + const __m128i b1 = _mm_and_si128(a1, alpha_mask); + const __m128i b2 = _mm_and_si128(a2, alpha_mask); + const __m128i b3 = _mm_and_si128(a3, alpha_mask); + const __m128i c0 = _mm_packs_epi32(b0, b1); + const __m128i c1 = _mm_packs_epi32(b2, b3); + const __m128i d = _mm_packus_epi16(c0, c1); + const __m128i bits = _mm_cmpeq_epi8(d, all_0xff); + const int mask = _mm_movemask_epi8(bits); + if (mask != 0xffff) return 1; + } + for (; i + 32 <= length; i += 32) { + const __m128i a0 = _mm_loadu_si128((const __m128i*)(src + i + 0)); + const __m128i a1 = _mm_loadu_si128((const __m128i*)(src + i + 16)); + const __m128i b0 = _mm_and_si128(a0, alpha_mask); + const __m128i b1 = _mm_and_si128(a1, alpha_mask); + const __m128i c = _mm_packs_epi32(b0, b1); + const __m128i d = _mm_packus_epi16(c, c); + const __m128i bits = _mm_cmpeq_epi8(d, all_0xff); + const int mask = _mm_movemask_epi8(bits); + if (mask != 0xffff) return 1; + } + for (; i <= length; i += 4) if (src[i] != 0xff) return 1; + return 0; +} + // ----------------------------------------------------------------------------- // Apply alpha value to rows @@ -238,7 +293,7 @@ static void MultARGBRow_SSE2(uint32_t* const ptr, int width, int inverse) { } } width -= x; - if (width > 0) WebPMultARGBRowC(ptr + x, width, inverse); + if (width > 0) WebPMultARGBRow_C(ptr + x, width, inverse); } static void MultRow_SSE2(uint8_t* const ptr, const uint8_t* const alpha, @@ -261,7 +316,7 @@ static void MultRow_SSE2(uint8_t* const ptr, const uint8_t* const alpha, } } width -= x; - if (width > 0) WebPMultRowC(ptr + x, alpha + x, width, inverse); + if (width > 0) WebPMultRow_C(ptr + x, alpha + x, width, inverse); } //------------------------------------------------------------------------------ @@ -273,9 +328,12 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessingSSE2(void) { WebPMultARGBRow = MultARGBRow_SSE2; WebPMultRow = MultRow_SSE2; WebPApplyAlphaMultiply = ApplyAlphaMultiply_SSE2; - WebPDispatchAlpha = DispatchAlpha; - WebPDispatchAlphaToGreen = DispatchAlphaToGreen; - WebPExtractAlpha = ExtractAlpha; + WebPDispatchAlpha = DispatchAlpha_SSE2; + WebPDispatchAlphaToGreen = DispatchAlphaToGreen_SSE2; + WebPExtractAlpha = ExtractAlpha_SSE2; + + WebPHasAlpha8b = HasAlpha8b_SSE2; + WebPHasAlpha32b = HasAlpha32b_SSE2; } #else // !WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/alpha_processing_sse41.c b/Pods/libwebp/src/dsp/alpha_processing_sse41.c index 986fde9..56040f9 100644 --- a/Pods/libwebp/src/dsp/alpha_processing_sse41.c +++ b/Pods/libwebp/src/dsp/alpha_processing_sse41.c @@ -11,7 +11,7 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE41) @@ -19,9 +19,9 @@ //------------------------------------------------------------------------------ -static int ExtractAlpha(const uint8_t* argb, int argb_stride, - int width, int height, - uint8_t* alpha, int alpha_stride) { +static int ExtractAlpha_SSE41(const uint8_t* argb, int argb_stride, + int width, int height, + uint8_t* alpha, int alpha_stride) { // alpha_and stores an 'and' operation of all the alpha[] values. The final // value is not 0xff if any of the alpha[] is not equal to 0xff. uint32_t alpha_and = 0xff; @@ -82,7 +82,7 @@ static int ExtractAlpha(const uint8_t* argb, int argb_stride, extern void WebPInitAlphaProcessingSSE41(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessingSSE41(void) { - WebPExtractAlpha = ExtractAlpha; + WebPExtractAlpha = ExtractAlpha_SSE41; } #else // !WEBP_USE_SSE41 diff --git a/Pods/libwebp/src/dsp/argb.c b/Pods/libwebp/src/dsp/argb.c deleted file mode 100644 index cc1f9a9..0000000 --- a/Pods/libwebp/src/dsp/argb.c +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the COPYING file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// ----------------------------------------------------------------------------- -// -// ARGB making functions. -// -// Author: Djordje Pesut (djordje.pesut@imgtec.com) - -#include "./dsp.h" - -static WEBP_INLINE uint32_t MakeARGB32(int a, int r, int g, int b) { - return (((uint32_t)a << 24) | (r << 16) | (g << 8) | b); -} - -static void PackARGB(const uint8_t* a, const uint8_t* r, const uint8_t* g, - const uint8_t* b, int len, uint32_t* out) { - int i; - for (i = 0; i < len; ++i) { - out[i] = MakeARGB32(a[4 * i], r[4 * i], g[4 * i], b[4 * i]); - } -} - -static void PackRGB(const uint8_t* r, const uint8_t* g, const uint8_t* b, - int len, int step, uint32_t* out) { - int i, offset = 0; - for (i = 0; i < len; ++i) { - out[i] = MakeARGB32(0xff, r[offset], g[offset], b[offset]); - offset += step; - } -} - -void (*VP8PackARGB)(const uint8_t*, const uint8_t*, const uint8_t*, - const uint8_t*, int, uint32_t*); -void (*VP8PackRGB)(const uint8_t*, const uint8_t*, const uint8_t*, - int, int, uint32_t*); - -extern void VP8EncDspARGBInitMIPSdspR2(void); -extern void VP8EncDspARGBInitSSE2(void); - -static volatile VP8CPUInfo argb_last_cpuinfo_used = - (VP8CPUInfo)&argb_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspARGBInit(void) { - if (argb_last_cpuinfo_used == VP8GetCPUInfo) return; - - VP8PackARGB = PackARGB; - VP8PackRGB = PackRGB; - - // If defined, use CPUInfo() to overwrite some pointers with faster versions. - if (VP8GetCPUInfo != NULL) { -#if defined(WEBP_USE_SSE2) - if (VP8GetCPUInfo(kSSE2)) { - VP8EncDspARGBInitSSE2(); - } -#endif -#if defined(WEBP_USE_MIPS_DSP_R2) - if (VP8GetCPUInfo(kMIPSdspR2)) { - VP8EncDspARGBInitMIPSdspR2(); - } -#endif - } - argb_last_cpuinfo_used = VP8GetCPUInfo; -} diff --git a/Pods/libwebp/src/dsp/argb_mips_dsp_r2.c b/Pods/libwebp/src/dsp/argb_mips_dsp_r2.c deleted file mode 100644 index af65acb..0000000 --- a/Pods/libwebp/src/dsp/argb_mips_dsp_r2.c +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the COPYING file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// ----------------------------------------------------------------------------- -// -// ARGB making functions (mips version). -// -// Author: Djordje Pesut (djordje.pesut@imgtec.com) - -#include "./dsp.h" - -#if defined(WEBP_USE_MIPS_DSP_R2) - -static void PackARGB(const uint8_t* a, const uint8_t* r, const uint8_t* g, - const uint8_t* b, int len, uint32_t* out) { - int temp0, temp1, temp2, temp3, offset; - const int rest = len & 1; - const uint32_t* const loop_end = out + len - rest; - const int step = 4; - __asm__ volatile ( - "xor %[offset], %[offset], %[offset] \n\t" - "beq %[loop_end], %[out], 0f \n\t" - "2: \n\t" - "lbux %[temp0], %[offset](%[a]) \n\t" - "lbux %[temp1], %[offset](%[r]) \n\t" - "lbux %[temp2], %[offset](%[g]) \n\t" - "lbux %[temp3], %[offset](%[b]) \n\t" - "ins %[temp1], %[temp0], 16, 16 \n\t" - "ins %[temp3], %[temp2], 16, 16 \n\t" - "addiu %[out], %[out], 4 \n\t" - "precr.qb.ph %[temp0], %[temp1], %[temp3] \n\t" - "sw %[temp0], -4(%[out]) \n\t" - "addu %[offset], %[offset], %[step] \n\t" - "bne %[loop_end], %[out], 2b \n\t" - "0: \n\t" - "beq %[rest], $zero, 1f \n\t" - "lbux %[temp0], %[offset](%[a]) \n\t" - "lbux %[temp1], %[offset](%[r]) \n\t" - "lbux %[temp2], %[offset](%[g]) \n\t" - "lbux %[temp3], %[offset](%[b]) \n\t" - "ins %[temp1], %[temp0], 16, 16 \n\t" - "ins %[temp3], %[temp2], 16, 16 \n\t" - "precr.qb.ph %[temp0], %[temp1], %[temp3] \n\t" - "sw %[temp0], 0(%[out]) \n\t" - "1: \n\t" - : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), - [temp3]"=&r"(temp3), [offset]"=&r"(offset), [out]"+&r"(out) - : [a]"r"(a), [r]"r"(r), [g]"r"(g), [b]"r"(b), [step]"r"(step), - [loop_end]"r"(loop_end), [rest]"r"(rest) - : "memory" - ); -} - -static void PackRGB(const uint8_t* r, const uint8_t* g, const uint8_t* b, - int len, int step, uint32_t* out) { - int temp0, temp1, temp2, offset; - const int rest = len & 1; - const int a = 0xff; - const uint32_t* const loop_end = out + len - rest; - __asm__ volatile ( - "xor %[offset], %[offset], %[offset] \n\t" - "beq %[loop_end], %[out], 0f \n\t" - "2: \n\t" - "lbux %[temp0], %[offset](%[r]) \n\t" - "lbux %[temp1], %[offset](%[g]) \n\t" - "lbux %[temp2], %[offset](%[b]) \n\t" - "ins %[temp0], %[a], 16, 16 \n\t" - "ins %[temp2], %[temp1], 16, 16 \n\t" - "addiu %[out], %[out], 4 \n\t" - "precr.qb.ph %[temp0], %[temp0], %[temp2] \n\t" - "sw %[temp0], -4(%[out]) \n\t" - "addu %[offset], %[offset], %[step] \n\t" - "bne %[loop_end], %[out], 2b \n\t" - "0: \n\t" - "beq %[rest], $zero, 1f \n\t" - "lbux %[temp0], %[offset](%[r]) \n\t" - "lbux %[temp1], %[offset](%[g]) \n\t" - "lbux %[temp2], %[offset](%[b]) \n\t" - "ins %[temp0], %[a], 16, 16 \n\t" - "ins %[temp2], %[temp1], 16, 16 \n\t" - "precr.qb.ph %[temp0], %[temp0], %[temp2] \n\t" - "sw %[temp0], 0(%[out]) \n\t" - "1: \n\t" - : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), - [offset]"=&r"(offset), [out]"+&r"(out) - : [a]"r"(a), [r]"r"(r), [g]"r"(g), [b]"r"(b), [step]"r"(step), - [loop_end]"r"(loop_end), [rest]"r"(rest) - : "memory" - ); -} - -//------------------------------------------------------------------------------ -// Entry point - -extern void VP8EncDspARGBInitMIPSdspR2(void); - -WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspARGBInitMIPSdspR2(void) { - VP8PackARGB = PackARGB; - VP8PackRGB = PackRGB; -} - -#else // !WEBP_USE_MIPS_DSP_R2 - -WEBP_DSP_INIT_STUB(VP8EncDspARGBInitMIPSdspR2) - -#endif // WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/argb_sse2.c b/Pods/libwebp/src/dsp/argb_sse2.c deleted file mode 100644 index afcb195..0000000 --- a/Pods/libwebp/src/dsp/argb_sse2.c +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the COPYING file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// ----------------------------------------------------------------------------- -// -// ARGB making functions (SSE2 version). -// -// Author: Skal (pascal.massimino@gmail.com) - -#include "./dsp.h" - -#if defined(WEBP_USE_SSE2) - -#include -#include -#include - -static WEBP_INLINE uint32_t MakeARGB32(int a, int r, int g, int b) { - return (((uint32_t)a << 24) | (r << 16) | (g << 8) | b); -} - -static void PackARGB(const uint8_t* a, const uint8_t* r, const uint8_t* g, - const uint8_t* b, int len, uint32_t* out) { - if (g == r + 1) { // RGBA input order. Need to swap R and B. - int i = 0; - const int len_max = len & ~3; // max length processed in main loop - const __m128i red_blue_mask = _mm_set1_epi32(0x00ff00ffu); - assert(b == r + 2); - assert(a == r + 3); - for (; i < len_max; i += 4) { - const __m128i A = _mm_loadu_si128((const __m128i*)(r + 4 * i)); - const __m128i B = _mm_and_si128(A, red_blue_mask); // R 0 B 0 - const __m128i C = _mm_andnot_si128(red_blue_mask, A); // 0 G 0 A - const __m128i D = _mm_shufflelo_epi16(B, _MM_SHUFFLE(2, 3, 0, 1)); - const __m128i E = _mm_shufflehi_epi16(D, _MM_SHUFFLE(2, 3, 0, 1)); - const __m128i F = _mm_or_si128(E, C); - _mm_storeu_si128((__m128i*)(out + i), F); - } - for (; i < len; ++i) { - out[i] = MakeARGB32(a[4 * i], r[4 * i], g[4 * i], b[4 * i]); - } - } else { - assert(g == b + 1); - assert(r == b + 2); - assert(a == b + 3); - memcpy(out, b, len * 4); - } -} - -//------------------------------------------------------------------------------ -// Entry point - -extern void VP8EncDspARGBInitSSE2(void); - -WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspARGBInitSSE2(void) { - VP8PackARGB = PackARGB; -} - -#else // !WEBP_USE_SSE2 - -WEBP_DSP_INIT_STUB(VP8EncDspARGBInitSSE2) - -#endif // WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/common_sse2.h b/Pods/libwebp/src/dsp/common_sse2.h index 995d7cf..e9f1ebf 100644 --- a/Pods/libwebp/src/dsp/common_sse2.h +++ b/Pods/libwebp/src/dsp/common_sse2.h @@ -128,9 +128,9 @@ static WEBP_INLINE void VP8Transpose_2_4x4_16b( // Pack the planar buffers // rrrr... rrrr... gggg... gggg... bbbb... bbbb.... // triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ... -static WEBP_INLINE void VP8PlanarTo24b(__m128i* const in0, __m128i* const in1, - __m128i* const in2, __m128i* const in3, - __m128i* const in4, __m128i* const in5) { +static WEBP_INLINE void VP8PlanarTo24b_SSE2( + __m128i* const in0, __m128i* const in1, __m128i* const in2, + __m128i* const in3, __m128i* const in4, __m128i* const in5) { // The input is 6 registers of sixteen 8b but for the sake of explanation, // let's take 6 registers of four 8b values. // To pack, we will keep taking one every two 8b integer and move it @@ -159,10 +159,10 @@ static WEBP_INLINE void VP8PlanarTo24b(__m128i* const in0, __m128i* const in1, // Convert four packed four-channel buffers like argbargbargbargb... into the // split channels aaaaa ... rrrr ... gggg .... bbbbb ...... -static WEBP_INLINE void VP8L32bToPlanar(__m128i* const in0, - __m128i* const in1, - __m128i* const in2, - __m128i* const in3) { +static WEBP_INLINE void VP8L32bToPlanar_SSE2(__m128i* const in0, + __m128i* const in1, + __m128i* const in2, + __m128i* const in3) { // Column-wise transpose. const __m128i A0 = _mm_unpacklo_epi8(*in0, *in1); const __m128i A1 = _mm_unpackhi_epi8(*in0, *in1); diff --git a/Pods/libwebp/src/dsp/common_sse41.h b/Pods/libwebp/src/dsp/common_sse41.h new file mode 100644 index 0000000..2f173c0 --- /dev/null +++ b/Pods/libwebp/src/dsp/common_sse41.h @@ -0,0 +1,132 @@ +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// SSE4 code common to several files. +// +// Author: Vincent Rabaud (vrabaud@google.com) + +#ifndef WEBP_DSP_COMMON_SSE41_H_ +#define WEBP_DSP_COMMON_SSE41_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(WEBP_USE_SSE41) +#include + +//------------------------------------------------------------------------------ +// Channel mixing. +// Shuffles the input buffer as A0 0 0 A1 0 0 A2 ... +#define WEBP_SSE41_SHUFF(OUT, IN0, IN1) \ + OUT##0 = _mm_shuffle_epi8(*IN0, shuff0); \ + OUT##1 = _mm_shuffle_epi8(*IN0, shuff1); \ + OUT##2 = _mm_shuffle_epi8(*IN0, shuff2); \ + OUT##3 = _mm_shuffle_epi8(*IN1, shuff0); \ + OUT##4 = _mm_shuffle_epi8(*IN1, shuff1); \ + OUT##5 = _mm_shuffle_epi8(*IN1, shuff2); + +// Pack the planar buffers +// rrrr... rrrr... gggg... gggg... bbbb... bbbb.... +// triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ... +static WEBP_INLINE void VP8PlanarTo24b_SSE41( + __m128i* const in0, __m128i* const in1, __m128i* const in2, + __m128i* const in3, __m128i* const in4, __m128i* const in5) { + __m128i R0, R1, R2, R3, R4, R5; + __m128i G0, G1, G2, G3, G4, G5; + __m128i B0, B1, B2, B3, B4, B5; + + // Process R. + { + const __m128i shuff0 = _mm_set_epi8( + 5, -1, -1, 4, -1, -1, 3, -1, -1, 2, -1, -1, 1, -1, -1, 0); + const __m128i shuff1 = _mm_set_epi8( + -1, 10, -1, -1, 9, -1, -1, 8, -1, -1, 7, -1, -1, 6, -1, -1); + const __m128i shuff2 = _mm_set_epi8( + -1, -1, 15, -1, -1, 14, -1, -1, 13, -1, -1, 12, -1, -1, 11, -1); + WEBP_SSE41_SHUFF(R, in0, in1) + } + + // Process G. + { + // Same as before, just shifted to the left by one and including the right + // padding. + const __m128i shuff0 = _mm_set_epi8( + -1, -1, 4, -1, -1, 3, -1, -1, 2, -1, -1, 1, -1, -1, 0, -1); + const __m128i shuff1 = _mm_set_epi8( + 10, -1, -1, 9, -1, -1, 8, -1, -1, 7, -1, -1, 6, -1, -1, 5); + const __m128i shuff2 = _mm_set_epi8( + -1, 15, -1, -1, 14, -1, -1, 13, -1, -1, 12, -1, -1, 11, -1, -1); + WEBP_SSE41_SHUFF(G, in2, in3) + } + + // Process B. + { + const __m128i shuff0 = _mm_set_epi8( + -1, 4, -1, -1, 3, -1, -1, 2, -1, -1, 1, -1, -1, 0, -1, -1); + const __m128i shuff1 = _mm_set_epi8( + -1, -1, 9, -1, -1, 8, -1, -1, 7, -1, -1, 6, -1, -1, 5, -1); + const __m128i shuff2 = _mm_set_epi8( + 15, -1, -1, 14, -1, -1, 13, -1, -1, 12, -1, -1, 11, -1, -1, 10); + WEBP_SSE41_SHUFF(B, in4, in5) + } + + // OR the different channels. + { + const __m128i RG0 = _mm_or_si128(R0, G0); + const __m128i RG1 = _mm_or_si128(R1, G1); + const __m128i RG2 = _mm_or_si128(R2, G2); + const __m128i RG3 = _mm_or_si128(R3, G3); + const __m128i RG4 = _mm_or_si128(R4, G4); + const __m128i RG5 = _mm_or_si128(R5, G5); + *in0 = _mm_or_si128(RG0, B0); + *in1 = _mm_or_si128(RG1, B1); + *in2 = _mm_or_si128(RG2, B2); + *in3 = _mm_or_si128(RG3, B3); + *in4 = _mm_or_si128(RG4, B4); + *in5 = _mm_or_si128(RG5, B5); + } +} + +#undef WEBP_SSE41_SHUFF + +// Convert four packed four-channel buffers like argbargbargbargb... into the +// split channels aaaaa ... rrrr ... gggg .... bbbbb ...... +static WEBP_INLINE void VP8L32bToPlanar_SSE41(__m128i* const in0, + __m128i* const in1, + __m128i* const in2, + __m128i* const in3) { + // aaaarrrrggggbbbb + const __m128i shuff0 = + _mm_set_epi8(15, 11, 7, 3, 14, 10, 6, 2, 13, 9, 5, 1, 12, 8, 4, 0); + const __m128i A0 = _mm_shuffle_epi8(*in0, shuff0); + const __m128i A1 = _mm_shuffle_epi8(*in1, shuff0); + const __m128i A2 = _mm_shuffle_epi8(*in2, shuff0); + const __m128i A3 = _mm_shuffle_epi8(*in3, shuff0); + // A0A1R0R1 + // G0G1B0B1 + // A2A3R2R3 + // G0G1B0B1 + const __m128i B0 = _mm_unpacklo_epi32(A0, A1); + const __m128i B1 = _mm_unpackhi_epi32(A0, A1); + const __m128i B2 = _mm_unpacklo_epi32(A2, A3); + const __m128i B3 = _mm_unpackhi_epi32(A2, A3); + *in3 = _mm_unpacklo_epi64(B0, B2); + *in2 = _mm_unpackhi_epi64(B0, B2); + *in1 = _mm_unpacklo_epi64(B1, B3); + *in0 = _mm_unpackhi_epi64(B1, B3); +} + +#endif // WEBP_USE_SSE41 + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_DSP_COMMON_SSE41_H_ diff --git a/Pods/libwebp/src/dsp/cost.c b/Pods/libwebp/src/dsp/cost.c index 58ddea7..cc681cd 100644 --- a/Pods/libwebp/src/dsp/cost.c +++ b/Pods/libwebp/src/dsp/cost.c @@ -9,8 +9,8 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" -#include "../enc/cost_enc.h" +#include "src/dsp/dsp.h" +#include "src/enc/cost_enc.h" //------------------------------------------------------------------------------ // Boolean-cost cost table @@ -319,7 +319,7 @@ const uint8_t VP8EncBands[16 + 1] = { //------------------------------------------------------------------------------ // Mode costs -static int GetResidualCost(int ctx0, const VP8Residual* const res) { +static int GetResidualCost_C(int ctx0, const VP8Residual* const res) { int n = res->first; // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1 const int p0 = res->prob[n][ctx0][0]; @@ -354,8 +354,8 @@ static int GetResidualCost(int ctx0, const VP8Residual* const res) { return cost; } -static void SetResidualCoeffs(const int16_t* const coeffs, - VP8Residual* const res) { +static void SetResidualCoeffs_C(const int16_t* const coeffs, + VP8Residual* const res) { int n; res->last = -1; assert(res->first == 0 || coeffs[0] == 0); @@ -377,15 +377,11 @@ VP8SetResidualCoeffsFunc VP8SetResidualCoeffs; extern void VP8EncDspCostInitMIPS32(void); extern void VP8EncDspCostInitMIPSdspR2(void); extern void VP8EncDspCostInitSSE2(void); +extern void VP8EncDspCostInitNEON(void); -static volatile VP8CPUInfo cost_last_cpuinfo_used = - (VP8CPUInfo)&cost_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInit(void) { - if (cost_last_cpuinfo_used == VP8GetCPUInfo) return; - - VP8GetResidualCost = GetResidualCost; - VP8SetResidualCoeffs = SetResidualCoeffs; +WEBP_DSP_INIT_FUNC(VP8EncDspCostInit) { + VP8GetResidualCost = GetResidualCost_C; + VP8SetResidualCoeffs = SetResidualCoeffs_C; // If defined, use CPUInfo() to overwrite some pointers with faster versions. if (VP8GetCPUInfo != NULL) { @@ -403,10 +399,13 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInit(void) { if (VP8GetCPUInfo(kSSE2)) { VP8EncDspCostInitSSE2(); } +#endif +#if defined(WEBP_USE_NEON) + if (VP8GetCPUInfo(kNEON)) { + VP8EncDspCostInitNEON(); + } #endif } - - cost_last_cpuinfo_used = VP8GetCPUInfo; } //------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/dsp/cost_mips32.c b/Pods/libwebp/src/dsp/cost_mips32.c index 3102da8..0500f88 100644 --- a/Pods/libwebp/src/dsp/cost_mips32.c +++ b/Pods/libwebp/src/dsp/cost_mips32.c @@ -9,13 +9,13 @@ // // Author: Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS32) -#include "../enc/cost_enc.h" +#include "src/enc/cost_enc.h" -static int GetResidualCost(int ctx0, const VP8Residual* const res) { +static int GetResidualCost_MIPS32(int ctx0, const VP8Residual* const res) { int temp0, temp1; int v_reg, ctx_reg; int n = res->first; @@ -96,8 +96,8 @@ static int GetResidualCost(int ctx0, const VP8Residual* const res) { return cost; } -static void SetResidualCoeffs(const int16_t* const coeffs, - VP8Residual* const res) { +static void SetResidualCoeffs_MIPS32(const int16_t* const coeffs, + VP8Residual* const res) { const int16_t* p_coeffs = (int16_t*)coeffs; int temp0, temp1, temp2, n, n1; assert(res->first == 0 || coeffs[0] == 0); @@ -143,8 +143,8 @@ static void SetResidualCoeffs(const int16_t* const coeffs, extern void VP8EncDspCostInitMIPS32(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPS32(void) { - VP8GetResidualCost = GetResidualCost; - VP8SetResidualCoeffs = SetResidualCoeffs; + VP8GetResidualCost = GetResidualCost_MIPS32; + VP8SetResidualCoeffs = SetResidualCoeffs_MIPS32; } #else // !WEBP_USE_MIPS32 diff --git a/Pods/libwebp/src/dsp/cost_mips_dsp_r2.c b/Pods/libwebp/src/dsp/cost_mips_dsp_r2.c index 6ec8aeb..51248de 100644 --- a/Pods/libwebp/src/dsp/cost_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/cost_mips_dsp_r2.c @@ -9,13 +9,13 @@ // // Author: Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "../enc/cost_enc.h" +#include "src/enc/cost_enc.h" -static int GetResidualCost(int ctx0, const VP8Residual* const res) { +static int GetResidualCost_MIPSdspR2(int ctx0, const VP8Residual* const res) { int temp0, temp1; int v_reg, ctx_reg; int n = res->first; @@ -97,7 +97,7 @@ static int GetResidualCost(int ctx0, const VP8Residual* const res) { extern void VP8EncDspCostInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPSdspR2(void) { - VP8GetResidualCost = GetResidualCost; + VP8GetResidualCost = GetResidualCost_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/cost_neon.c b/Pods/libwebp/src/dsp/cost_neon.c new file mode 100644 index 0000000..8cc8ce5 --- /dev/null +++ b/Pods/libwebp/src/dsp/cost_neon.c @@ -0,0 +1,122 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// ARM NEON version of cost functions + +#include "src/dsp/dsp.h" + +#if defined(WEBP_USE_NEON) + +#include "src/dsp/neon.h" +#include "src/enc/cost_enc.h" + +static const uint8_t position[16] = { 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16 }; + +static void SetResidualCoeffs_NEON(const int16_t* const coeffs, + VP8Residual* const res) { + const int16x8_t minus_one = vdupq_n_s16(-1); + const int16x8_t coeffs_0 = vld1q_s16(coeffs); + const int16x8_t coeffs_1 = vld1q_s16(coeffs + 8); + const uint16x8_t eob_0 = vtstq_s16(coeffs_0, minus_one); + const uint16x8_t eob_1 = vtstq_s16(coeffs_1, minus_one); + const uint8x16_t eob = vcombine_u8(vqmovn_u16(eob_0), vqmovn_u16(eob_1)); + const uint8x16_t masked = vandq_u8(eob, vld1q_u8(position)); + +#ifdef __aarch64__ + res->last = vmaxvq_u8(masked) - 1; +#else + const uint8x8_t eob_8x8 = vmax_u8(vget_low_u8(masked), vget_high_u8(masked)); + const uint16x8_t eob_16x8 = vmovl_u8(eob_8x8); + const uint16x4_t eob_16x4 = + vmax_u16(vget_low_u16(eob_16x8), vget_high_u16(eob_16x8)); + const uint32x4_t eob_32x4 = vmovl_u16(eob_16x4); + uint32x2_t eob_32x2 = + vmax_u32(vget_low_u32(eob_32x4), vget_high_u32(eob_32x4)); + eob_32x2 = vpmax_u32(eob_32x2, eob_32x2); + + vst1_lane_s32(&res->last, vreinterpret_s32_u32(eob_32x2), 0); + --res->last; +#endif // __aarch64__ + + res->coeffs = coeffs; +} + +static int GetResidualCost_NEON(int ctx0, const VP8Residual* const res) { + uint8_t levels[16], ctxs[16]; + uint16_t abs_levels[16]; + int n = res->first; + // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1 + const int p0 = res->prob[n][ctx0][0]; + CostArrayPtr const costs = res->costs; + const uint16_t* t = costs[n][ctx0]; + // bit_cost(1, p0) is already incorporated in t[] tables, but only if ctx != 0 + // (as required by the syntax). For ctx0 == 0, we need to add it here or it'll + // be missing during the loop. + int cost = (ctx0 == 0) ? VP8BitCost(1, p0) : 0; + + if (res->last < 0) { + return VP8BitCost(0, p0); + } + + { // precompute clamped levels and contexts, packed to 8b. + const uint8x16_t kCst2 = vdupq_n_u8(2); + const uint8x16_t kCst67 = vdupq_n_u8(MAX_VARIABLE_LEVEL); + const int16x8_t c0 = vld1q_s16(res->coeffs); + const int16x8_t c1 = vld1q_s16(res->coeffs + 8); + const uint16x8_t E0 = vreinterpretq_u16_s16(vabsq_s16(c0)); + const uint16x8_t E1 = vreinterpretq_u16_s16(vabsq_s16(c1)); + const uint8x16_t F = vcombine_u8(vqmovn_u16(E0), vqmovn_u16(E1)); + const uint8x16_t G = vminq_u8(F, kCst2); // context = 0,1,2 + const uint8x16_t H = vminq_u8(F, kCst67); // clamp_level in [0..67] + + vst1q_u8(ctxs, G); + vst1q_u8(levels, H); + + vst1q_u16(abs_levels, E0); + vst1q_u16(abs_levels + 8, E1); + } + for (; n < res->last; ++n) { + const int ctx = ctxs[n]; + const int level = levels[n]; + const int flevel = abs_levels[n]; // full level + cost += VP8LevelFixedCosts[flevel] + t[level]; // simplified VP8LevelCost() + t = costs[n + 1][ctx]; + } + // Last coefficient is always non-zero + { + const int level = levels[n]; + const int flevel = abs_levels[n]; + assert(flevel != 0); + cost += VP8LevelFixedCosts[flevel] + t[level]; + if (n < 15) { + const int b = VP8EncBands[n + 1]; + const int ctx = ctxs[n]; + const int last_p0 = res->prob[b][ctx][0]; + cost += VP8BitCost(0, last_p0); + } + } + return cost; +} + +//------------------------------------------------------------------------------ +// Entry point + +extern void VP8EncDspCostInitNEON(void); + +WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitNEON(void) { + VP8SetResidualCoeffs = SetResidualCoeffs_NEON; + VP8GetResidualCost = GetResidualCost_NEON; +} + +#else // !WEBP_USE_NEON + +WEBP_DSP_INIT_STUB(VP8EncDspCostInitNEON) + +#endif // WEBP_USE_NEON diff --git a/Pods/libwebp/src/dsp/cost_sse2.c b/Pods/libwebp/src/dsp/cost_sse2.c index 421d51f..487a079 100644 --- a/Pods/libwebp/src/dsp/cost_sse2.c +++ b/Pods/libwebp/src/dsp/cost_sse2.c @@ -11,19 +11,19 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) #include -#include "../enc/cost_enc.h" -#include "../enc/vp8i_enc.h" -#include "../utils/utils.h" +#include "src/enc/cost_enc.h" +#include "src/enc/vp8i_enc.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ -static void SetResidualCoeffsSSE2(const int16_t* const coeffs, - VP8Residual* const res) { +static void SetResidualCoeffs_SSE2(const int16_t* const coeffs, + VP8Residual* const res) { const __m128i c0 = _mm_loadu_si128((const __m128i*)(coeffs + 0)); const __m128i c1 = _mm_loadu_si128((const __m128i*)(coeffs + 8)); // Use SSE2 to compare 16 values with a single instruction. @@ -42,7 +42,7 @@ static void SetResidualCoeffsSSE2(const int16_t* const coeffs, res->coeffs = coeffs; } -static int GetResidualCostSSE2(int ctx0, const VP8Residual* const res) { +static int GetResidualCost_SSE2(int ctx0, const VP8Residual* const res) { uint8_t levels[16], ctxs[16]; uint16_t abs_levels[16]; int n = res->first; @@ -108,8 +108,8 @@ static int GetResidualCostSSE2(int ctx0, const VP8Residual* const res) { extern void VP8EncDspCostInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitSSE2(void) { - VP8SetResidualCoeffs = SetResidualCoeffsSSE2; - VP8GetResidualCost = GetResidualCostSSE2; + VP8SetResidualCoeffs = SetResidualCoeffs_SSE2; + VP8GetResidualCost = GetResidualCost_SSE2; } #else // !WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/cpu.c b/Pods/libwebp/src/dsp/cpu.c index b5583b6..0fa5b6a 100644 --- a/Pods/libwebp/src/dsp/cpu.c +++ b/Pods/libwebp/src/dsp/cpu.c @@ -11,7 +11,7 @@ // // Author: Christian Duvivier (cduvivier@google.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_HAVE_NEON_RTCD) #include @@ -143,7 +143,7 @@ static int x86CPUInfo(CPUFeature feature) { return !!(cpu_info[2] & (1 << 0)); } if (feature == kSlowSSSE3) { - if (is_intel && (cpu_info[2] & (1 << 0))) { // SSSE3? + if (is_intel && (cpu_info[2] & (1 << 9))) { // SSSE3? return CheckSlowModel(cpu_info[0]); } return 0; @@ -173,8 +173,8 @@ static int AndroidCPUInfo(CPUFeature feature) { const AndroidCpuFamily cpu_family = android_getCpuFamily(); const uint64_t cpu_features = android_getCpuFeatures(); if (feature == kNEON) { - return (cpu_family == ANDROID_CPU_FAMILY_ARM && - 0 != (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON)); + return cpu_family == ANDROID_CPU_FAMILY_ARM && + (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0; } return 0; } diff --git a/Pods/libwebp/src/dsp/dec.c b/Pods/libwebp/src/dsp/dec.c index 007e985..1119842 100644 --- a/Pods/libwebp/src/dsp/dec.c +++ b/Pods/libwebp/src/dsp/dec.c @@ -11,9 +11,11 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" -#include "../dec/vp8i_dec.h" -#include "../utils/utils.h" +#include + +#include "src/dsp/dsp.h" +#include "src/dec/vp8i_dec.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ @@ -25,7 +27,7 @@ static WEBP_INLINE uint8_t clip_8b(int v) { // Transforms (Paragraph 14.4) #define STORE(x, y, v) \ - dst[x + y * BPS] = clip_8b(dst[x + y * BPS] + ((v) >> 3)) + dst[(x) + (y) * BPS] = clip_8b(dst[(x) + (y) * BPS] + ((v) >> 3)) #define STORE2(y, dc, d, c) do { \ const int DC = (dc); \ @@ -38,7 +40,8 @@ static WEBP_INLINE uint8_t clip_8b(int v) { #define MUL1(a) ((((a) * 20091) >> 16) + (a)) #define MUL2(a) (((a) * 35468) >> 16) -static void TransformOne(const int16_t* in, uint8_t* dst) { +#if !WEBP_NEON_OMIT_C_CODE +static void TransformOne_C(const int16_t* in, uint8_t* dst) { int C[4 * 4], *tmp; int i; tmp = C; @@ -78,7 +81,7 @@ static void TransformOne(const int16_t* in, uint8_t* dst) { } // Simplified transform when only in[0], in[1] and in[4] are non-zero -static void TransformAC3(const int16_t* in, uint8_t* dst) { +static void TransformAC3_C(const int16_t* in, uint8_t* dst) { const int a = in[0] + 4; const int c4 = MUL2(in[4]); const int d4 = MUL1(in[4]); @@ -93,19 +96,21 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) { #undef MUL2 #undef STORE2 -static void TransformTwo(const int16_t* in, uint8_t* dst, int do_two) { - TransformOne(in, dst); +static void TransformTwo_C(const int16_t* in, uint8_t* dst, int do_two) { + TransformOne_C(in, dst); if (do_two) { - TransformOne(in + 16, dst + 4); + TransformOne_C(in + 16, dst + 4); } } +#endif // !WEBP_NEON_OMIT_C_CODE -static void TransformUV(const int16_t* in, uint8_t* dst) { +static void TransformUV_C(const int16_t* in, uint8_t* dst) { VP8Transform(in + 0 * 16, dst, 1); VP8Transform(in + 2 * 16, dst + 4 * BPS, 1); } -static void TransformDC(const int16_t* in, uint8_t* dst) { +#if !WEBP_NEON_OMIT_C_CODE +static void TransformDC_C(const int16_t* in, uint8_t* dst) { const int DC = in[0] + 4; int i, j; for (j = 0; j < 4; ++j) { @@ -114,8 +119,9 @@ static void TransformDC(const int16_t* in, uint8_t* dst) { } } } +#endif // !WEBP_NEON_OMIT_C_CODE -static void TransformDCUV(const int16_t* in, uint8_t* dst) { +static void TransformDCUV_C(const int16_t* in, uint8_t* dst) { if (in[0 * 16]) VP8TransformDC(in + 0 * 16, dst); if (in[1 * 16]) VP8TransformDC(in + 1 * 16, dst + 4); if (in[2 * 16]) VP8TransformDC(in + 2 * 16, dst + 4 * BPS); @@ -127,7 +133,8 @@ static void TransformDCUV(const int16_t* in, uint8_t* dst) { //------------------------------------------------------------------------------ // Paragraph 14.3 -static void TransformWHT(const int16_t* in, int16_t* out) { +#if !WEBP_NEON_OMIT_C_CODE +static void TransformWHT_C(const int16_t* in, int16_t* out) { int tmp[16]; int i; for (i = 0; i < 4; ++i) { @@ -153,6 +160,7 @@ static void TransformWHT(const int16_t* in, int16_t* out) { out += 64; } } +#endif // !WEBP_NEON_OMIT_C_CODE void (*VP8TransformWHT)(const int16_t* in, int16_t* out); @@ -161,6 +169,7 @@ void (*VP8TransformWHT)(const int16_t* in, int16_t* out); #define DST(x, y) dst[(x) + (y) * BPS] +#if !WEBP_NEON_OMIT_C_CODE static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { const uint8_t* top = dst - BPS; const uint8_t* const clip0 = VP8kclip1 - top[-1]; @@ -174,21 +183,21 @@ static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { dst += BPS; } } -static void TM4(uint8_t* dst) { TrueMotion(dst, 4); } -static void TM8uv(uint8_t* dst) { TrueMotion(dst, 8); } -static void TM16(uint8_t* dst) { TrueMotion(dst, 16); } +static void TM4_C(uint8_t* dst) { TrueMotion(dst, 4); } +static void TM8uv_C(uint8_t* dst) { TrueMotion(dst, 8); } +static void TM16_C(uint8_t* dst) { TrueMotion(dst, 16); } //------------------------------------------------------------------------------ // 16x16 -static void VE16(uint8_t* dst) { // vertical +static void VE16_C(uint8_t* dst) { // vertical int j; for (j = 0; j < 16; ++j) { memcpy(dst + j * BPS, dst - BPS, 16); } } -static void HE16(uint8_t* dst) { // horizontal +static void HE16_C(uint8_t* dst) { // horizontal int j; for (j = 16; j > 0; --j) { memset(dst, dst[-1], 16); @@ -203,7 +212,7 @@ static WEBP_INLINE void Put16(int v, uint8_t* dst) { } } -static void DC16(uint8_t* dst) { // DC +static void DC16_C(uint8_t* dst) { // DC int DC = 16; int j; for (j = 0; j < 16; ++j) { @@ -212,7 +221,7 @@ static void DC16(uint8_t* dst) { // DC Put16(DC >> 5, dst); } -static void DC16NoTop(uint8_t* dst) { // DC with top samples not available +static void DC16NoTop_C(uint8_t* dst) { // DC with top samples not available int DC = 8; int j; for (j = 0; j < 16; ++j) { @@ -221,7 +230,7 @@ static void DC16NoTop(uint8_t* dst) { // DC with top samples not available Put16(DC >> 4, dst); } -static void DC16NoLeft(uint8_t* dst) { // DC with left samples not available +static void DC16NoLeft_C(uint8_t* dst) { // DC with left samples not available int DC = 8; int i; for (i = 0; i < 16; ++i) { @@ -230,9 +239,10 @@ static void DC16NoLeft(uint8_t* dst) { // DC with left samples not available Put16(DC >> 4, dst); } -static void DC16NoTopLeft(uint8_t* dst) { // DC with no top and left samples +static void DC16NoTopLeft_C(uint8_t* dst) { // DC with no top and left samples Put16(0x80, dst); } +#endif // !WEBP_NEON_OMIT_C_CODE VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES]; @@ -242,7 +252,8 @@ VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES]; #define AVG3(a, b, c) ((uint8_t)(((a) + 2 * (b) + (c) + 2) >> 2)) #define AVG2(a, b) (((a) + (b) + 1) >> 1) -static void VE4(uint8_t* dst) { // vertical +#if !WEBP_NEON_OMIT_C_CODE +static void VE4_C(uint8_t* dst) { // vertical const uint8_t* top = dst - BPS; const uint8_t vals[4] = { AVG3(top[-1], top[0], top[1]), @@ -255,8 +266,9 @@ static void VE4(uint8_t* dst) { // vertical memcpy(dst + i * BPS, vals, sizeof(vals)); } } +#endif // !WEBP_NEON_OMIT_C_CODE -static void HE4(uint8_t* dst) { // horizontal +static void HE4_C(uint8_t* dst) { // horizontal const int A = dst[-1 - BPS]; const int B = dst[-1]; const int C = dst[-1 + BPS]; @@ -268,7 +280,8 @@ static void HE4(uint8_t* dst) { // horizontal WebPUint32ToMem(dst + 3 * BPS, 0x01010101U * AVG3(D, E, E)); } -static void DC4(uint8_t* dst) { // DC +#if !WEBP_NEON_OMIT_C_CODE +static void DC4_C(uint8_t* dst) { // DC uint32_t dc = 4; int i; for (i = 0; i < 4; ++i) dc += dst[i - BPS] + dst[-1 + i * BPS]; @@ -276,7 +289,7 @@ static void DC4(uint8_t* dst) { // DC for (i = 0; i < 4; ++i) memset(dst + i * BPS, dc, 4); } -static void RD4(uint8_t* dst) { // Down-right +static void RD4_C(uint8_t* dst) { // Down-right const int I = dst[-1 + 0 * BPS]; const int J = dst[-1 + 1 * BPS]; const int K = dst[-1 + 2 * BPS]; @@ -295,7 +308,7 @@ static void RD4(uint8_t* dst) { // Down-right DST(3, 0) = AVG3(D, C, B); } -static void LD4(uint8_t* dst) { // Down-Left +static void LD4_C(uint8_t* dst) { // Down-Left const int A = dst[0 - BPS]; const int B = dst[1 - BPS]; const int C = dst[2 - BPS]; @@ -312,8 +325,9 @@ static void LD4(uint8_t* dst) { // Down-Left DST(3, 2) = DST(2, 3) = AVG3(F, G, H); DST(3, 3) = AVG3(G, H, H); } +#endif // !WEBP_NEON_OMIT_C_CODE -static void VR4(uint8_t* dst) { // Vertical-Right +static void VR4_C(uint8_t* dst) { // Vertical-Right const int I = dst[-1 + 0 * BPS]; const int J = dst[-1 + 1 * BPS]; const int K = dst[-1 + 2 * BPS]; @@ -335,7 +349,7 @@ static void VR4(uint8_t* dst) { // Vertical-Right DST(3, 1) = AVG3(B, C, D); } -static void VL4(uint8_t* dst) { // Vertical-Left +static void VL4_C(uint8_t* dst) { // Vertical-Left const int A = dst[0 - BPS]; const int B = dst[1 - BPS]; const int C = dst[2 - BPS]; @@ -357,7 +371,7 @@ static void VL4(uint8_t* dst) { // Vertical-Left DST(3, 3) = AVG3(F, G, H); } -static void HU4(uint8_t* dst) { // Horizontal-Up +static void HU4_C(uint8_t* dst) { // Horizontal-Up const int I = dst[-1 + 0 * BPS]; const int J = dst[-1 + 1 * BPS]; const int K = dst[-1 + 2 * BPS]; @@ -372,7 +386,7 @@ static void HU4(uint8_t* dst) { // Horizontal-Up DST(0, 3) = DST(1, 3) = DST(2, 3) = DST(3, 3) = L; } -static void HD4(uint8_t* dst) { // Horizontal-Down +static void HD4_C(uint8_t* dst) { // Horizontal-Down const int I = dst[-1 + 0 * BPS]; const int J = dst[-1 + 1 * BPS]; const int K = dst[-1 + 2 * BPS]; @@ -404,14 +418,15 @@ VP8PredFunc VP8PredLuma4[NUM_BMODES]; //------------------------------------------------------------------------------ // Chroma -static void VE8uv(uint8_t* dst) { // vertical +#if !WEBP_NEON_OMIT_C_CODE +static void VE8uv_C(uint8_t* dst) { // vertical int j; for (j = 0; j < 8; ++j) { memcpy(dst + j * BPS, dst - BPS, 8); } } -static void HE8uv(uint8_t* dst) { // horizontal +static void HE8uv_C(uint8_t* dst) { // horizontal int j; for (j = 0; j < 8; ++j) { memset(dst, dst[-1], 8); @@ -427,7 +442,7 @@ static WEBP_INLINE void Put8x8uv(uint8_t value, uint8_t* dst) { } } -static void DC8uv(uint8_t* dst) { // DC +static void DC8uv_C(uint8_t* dst) { // DC int dc0 = 8; int i; for (i = 0; i < 8; ++i) { @@ -436,7 +451,7 @@ static void DC8uv(uint8_t* dst) { // DC Put8x8uv(dc0 >> 4, dst); } -static void DC8uvNoLeft(uint8_t* dst) { // DC with no left samples +static void DC8uvNoLeft_C(uint8_t* dst) { // DC with no left samples int dc0 = 4; int i; for (i = 0; i < 8; ++i) { @@ -445,7 +460,7 @@ static void DC8uvNoLeft(uint8_t* dst) { // DC with no left samples Put8x8uv(dc0 >> 3, dst); } -static void DC8uvNoTop(uint8_t* dst) { // DC with no top samples +static void DC8uvNoTop_C(uint8_t* dst) { // DC with no top samples int dc0 = 4; int i; for (i = 0; i < 8; ++i) { @@ -454,17 +469,19 @@ static void DC8uvNoTop(uint8_t* dst) { // DC with no top samples Put8x8uv(dc0 >> 3, dst); } -static void DC8uvNoTopLeft(uint8_t* dst) { // DC with nothing +static void DC8uvNoTopLeft_C(uint8_t* dst) { // DC with nothing Put8x8uv(0x80, dst); } +#endif // !WEBP_NEON_OMIT_C_CODE VP8PredFunc VP8PredChroma8[NUM_B_DC_MODES]; //------------------------------------------------------------------------------ // Edge filtering functions +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC // 4 pixels in, 2 pixels out -static WEBP_INLINE void do_filter2(uint8_t* p, int step) { +static WEBP_INLINE void DoFilter2_C(uint8_t* p, int step) { const int p1 = p[-2*step], p0 = p[-step], q0 = p[0], q1 = p[step]; const int a = 3 * (q0 - p0) + VP8ksclip1[p1 - q1]; // in [-893,892] const int a1 = VP8ksclip2[(a + 4) >> 3]; // in [-16,15] @@ -474,7 +491,7 @@ static WEBP_INLINE void do_filter2(uint8_t* p, int step) { } // 4 pixels in, 4 pixels out -static WEBP_INLINE void do_filter4(uint8_t* p, int step) { +static WEBP_INLINE void DoFilter4_C(uint8_t* p, int step) { const int p1 = p[-2*step], p0 = p[-step], q0 = p[0], q1 = p[step]; const int a = 3 * (q0 - p0); const int a1 = VP8ksclip2[(a + 4) >> 3]; @@ -487,7 +504,7 @@ static WEBP_INLINE void do_filter4(uint8_t* p, int step) { } // 6 pixels in, 6 pixels out -static WEBP_INLINE void do_filter6(uint8_t* p, int step) { +static WEBP_INLINE void DoFilter6_C(uint8_t* p, int step) { const int p2 = p[-3*step], p1 = p[-2*step], p0 = p[-step]; const int q0 = p[0], q1 = p[step], q2 = p[2*step]; const int a = VP8ksclip1[3 * (q0 - p0) + VP8ksclip1[p1 - q1]]; @@ -503,18 +520,22 @@ static WEBP_INLINE void do_filter6(uint8_t* p, int step) { p[ 2*step] = VP8kclip1[q2 - a3]; } -static WEBP_INLINE int hev(const uint8_t* p, int step, int thresh) { +static WEBP_INLINE int Hev(const uint8_t* p, int step, int thresh) { const int p1 = p[-2*step], p0 = p[-step], q0 = p[0], q1 = p[step]; return (VP8kabs0[p1 - p0] > thresh) || (VP8kabs0[q1 - q0] > thresh); } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC -static WEBP_INLINE int needs_filter(const uint8_t* p, int step, int t) { +#if !WEBP_NEON_OMIT_C_CODE +static WEBP_INLINE int NeedsFilter_C(const uint8_t* p, int step, int t) { const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step]; return ((4 * VP8kabs0[p0 - q0] + VP8kabs0[p1 - q1]) <= t); } +#endif // !WEBP_NEON_OMIT_C_CODE -static WEBP_INLINE int needs_filter2(const uint8_t* p, - int step, int t, int it) { +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +static WEBP_INLINE int NeedsFilter2_C(const uint8_t* p, + int step, int t, int it) { const int p3 = p[-4 * step], p2 = p[-3 * step], p1 = p[-2 * step]; const int p0 = p[-step], q0 = p[0]; const int q1 = p[step], q2 = p[2 * step], q3 = p[3 * step]; @@ -523,140 +544,159 @@ static WEBP_INLINE int needs_filter2(const uint8_t* p, VP8kabs0[p1 - p0] <= it && VP8kabs0[q3 - q2] <= it && VP8kabs0[q2 - q1] <= it && VP8kabs0[q1 - q0] <= it; } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC //------------------------------------------------------------------------------ // Simple In-loop filtering (Paragraph 15.2) -static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { +#if !WEBP_NEON_OMIT_C_CODE +static void SimpleVFilter16_C(uint8_t* p, int stride, int thresh) { int i; const int thresh2 = 2 * thresh + 1; for (i = 0; i < 16; ++i) { - if (needs_filter(p + i, stride, thresh2)) { - do_filter2(p + i, stride); + if (NeedsFilter_C(p + i, stride, thresh2)) { + DoFilter2_C(p + i, stride); } } } -static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16_C(uint8_t* p, int stride, int thresh) { int i; const int thresh2 = 2 * thresh + 1; for (i = 0; i < 16; ++i) { - if (needs_filter(p + i * stride, 1, thresh2)) { - do_filter2(p + i * stride, 1); + if (NeedsFilter_C(p + i * stride, 1, thresh2)) { + DoFilter2_C(p + i * stride, 1); } } } -static void SimpleVFilter16i(uint8_t* p, int stride, int thresh) { +static void SimpleVFilter16i_C(uint8_t* p, int stride, int thresh) { int k; for (k = 3; k > 0; --k) { p += 4 * stride; - SimpleVFilter16(p, stride, thresh); + SimpleVFilter16_C(p, stride, thresh); } } -static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16i_C(uint8_t* p, int stride, int thresh) { int k; for (k = 3; k > 0; --k) { p += 4; - SimpleHFilter16(p, stride, thresh); + SimpleHFilter16_C(p, stride, thresh); } } +#endif // !WEBP_NEON_OMIT_C_CODE //------------------------------------------------------------------------------ // Complex In-loop filtering (Paragraph 15.3) -static WEBP_INLINE void FilterLoop26(uint8_t* p, - int hstride, int vstride, int size, - int thresh, int ithresh, int hev_thresh) { +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +static WEBP_INLINE void FilterLoop26_C(uint8_t* p, + int hstride, int vstride, int size, + int thresh, int ithresh, + int hev_thresh) { const int thresh2 = 2 * thresh + 1; while (size-- > 0) { - if (needs_filter2(p, hstride, thresh2, ithresh)) { - if (hev(p, hstride, hev_thresh)) { - do_filter2(p, hstride); + if (NeedsFilter2_C(p, hstride, thresh2, ithresh)) { + if (Hev(p, hstride, hev_thresh)) { + DoFilter2_C(p, hstride); } else { - do_filter6(p, hstride); + DoFilter6_C(p, hstride); } } p += vstride; } } -static WEBP_INLINE void FilterLoop24(uint8_t* p, - int hstride, int vstride, int size, - int thresh, int ithresh, int hev_thresh) { +static WEBP_INLINE void FilterLoop24_C(uint8_t* p, + int hstride, int vstride, int size, + int thresh, int ithresh, + int hev_thresh) { const int thresh2 = 2 * thresh + 1; while (size-- > 0) { - if (needs_filter2(p, hstride, thresh2, ithresh)) { - if (hev(p, hstride, hev_thresh)) { - do_filter2(p, hstride); + if (NeedsFilter2_C(p, hstride, thresh2, ithresh)) { + if (Hev(p, hstride, hev_thresh)) { + DoFilter2_C(p, hstride); } else { - do_filter4(p, hstride); + DoFilter4_C(p, hstride); } } p += vstride; } } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +#if !WEBP_NEON_OMIT_C_CODE // on macroblock edges -static void VFilter16(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { - FilterLoop26(p, stride, 1, 16, thresh, ithresh, hev_thresh); +static void VFilter16_C(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { + FilterLoop26_C(p, stride, 1, 16, thresh, ithresh, hev_thresh); } -static void HFilter16(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { - FilterLoop26(p, 1, stride, 16, thresh, ithresh, hev_thresh); +static void HFilter16_C(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { + FilterLoop26_C(p, 1, stride, 16, thresh, ithresh, hev_thresh); } // on three inner edges -static void VFilter16i(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter16i_C(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { int k; for (k = 3; k > 0; --k) { p += 4 * stride; - FilterLoop24(p, stride, 1, 16, thresh, ithresh, hev_thresh); + FilterLoop24_C(p, stride, 1, 16, thresh, ithresh, hev_thresh); } } +#endif // !WEBP_NEON_OMIT_C_CODE -static void HFilter16i(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +static void HFilter16i_C(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { int k; for (k = 3; k > 0; --k) { p += 4; - FilterLoop24(p, 1, stride, 16, thresh, ithresh, hev_thresh); + FilterLoop24_C(p, 1, stride, 16, thresh, ithresh, hev_thresh); } } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +#if !WEBP_NEON_OMIT_C_CODE // 8-pixels wide variant, for chroma filtering -static void VFilter8(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { - FilterLoop26(u, stride, 1, 8, thresh, ithresh, hev_thresh); - FilterLoop26(v, stride, 1, 8, thresh, ithresh, hev_thresh); +static void VFilter8_C(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { + FilterLoop26_C(u, stride, 1, 8, thresh, ithresh, hev_thresh); + FilterLoop26_C(v, stride, 1, 8, thresh, ithresh, hev_thresh); } +#endif // !WEBP_NEON_OMIT_C_CODE -static void HFilter8(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { - FilterLoop26(u, 1, stride, 8, thresh, ithresh, hev_thresh); - FilterLoop26(v, 1, stride, 8, thresh, ithresh, hev_thresh); +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +static void HFilter8_C(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { + FilterLoop26_C(u, 1, stride, 8, thresh, ithresh, hev_thresh); + FilterLoop26_C(v, 1, stride, 8, thresh, ithresh, hev_thresh); } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC -static void VFilter8i(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { - FilterLoop24(u + 4 * stride, stride, 1, 8, thresh, ithresh, hev_thresh); - FilterLoop24(v + 4 * stride, stride, 1, 8, thresh, ithresh, hev_thresh); +#if !WEBP_NEON_OMIT_C_CODE +static void VFilter8i_C(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { + FilterLoop24_C(u + 4 * stride, stride, 1, 8, thresh, ithresh, hev_thresh); + FilterLoop24_C(v + 4 * stride, stride, 1, 8, thresh, ithresh, hev_thresh); } +#endif // !WEBP_NEON_OMIT_C_CODE -static void HFilter8i(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { - FilterLoop24(u + 4, 1, stride, 8, thresh, ithresh, hev_thresh); - FilterLoop24(v + 4, 1, stride, 8, thresh, ithresh, hev_thresh); +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +static void HFilter8i_C(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { + FilterLoop24_C(u + 4, 1, stride, 8, thresh, ithresh, hev_thresh); + FilterLoop24_C(v + 4, 1, stride, 8, thresh, ithresh, hev_thresh); } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC //------------------------------------------------------------------------------ -static void DitherCombine8x8(const uint8_t* dither, uint8_t* dst, - int dst_stride) { +static void DitherCombine8x8_C(const uint8_t* dither, uint8_t* dst, + int dst_stride) { int i, j; for (j = 0; j < 8; ++j) { for (i = 0; i < 8; ++i) { @@ -701,62 +741,69 @@ extern void VP8DspInitMIPS32(void); extern void VP8DspInitMIPSdspR2(void); extern void VP8DspInitMSA(void); -static volatile VP8CPUInfo dec_last_cpuinfo_used = - (VP8CPUInfo)&dec_last_cpuinfo_used; +WEBP_DSP_INIT_FUNC(VP8DspInit) { + VP8InitClipTables(); -WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) { - if (dec_last_cpuinfo_used == VP8GetCPUInfo) return; +#if !WEBP_NEON_OMIT_C_CODE + VP8TransformWHT = TransformWHT_C; + VP8Transform = TransformTwo_C; + VP8TransformDC = TransformDC_C; + VP8TransformAC3 = TransformAC3_C; +#endif + VP8TransformUV = TransformUV_C; + VP8TransformDCUV = TransformDCUV_C; + +#if !WEBP_NEON_OMIT_C_CODE + VP8VFilter16 = VFilter16_C; + VP8VFilter16i = VFilter16i_C; + VP8HFilter16 = HFilter16_C; + VP8VFilter8 = VFilter8_C; + VP8VFilter8i = VFilter8i_C; + VP8SimpleVFilter16 = SimpleVFilter16_C; + VP8SimpleHFilter16 = SimpleHFilter16_C; + VP8SimpleVFilter16i = SimpleVFilter16i_C; + VP8SimpleHFilter16i = SimpleHFilter16i_C; +#endif - VP8InitClipTables(); +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC + VP8HFilter16i = HFilter16i_C; + VP8HFilter8 = HFilter8_C; + VP8HFilter8i = HFilter8i_C; +#endif + +#if !WEBP_NEON_OMIT_C_CODE + VP8PredLuma4[0] = DC4_C; + VP8PredLuma4[1] = TM4_C; + VP8PredLuma4[2] = VE4_C; + VP8PredLuma4[4] = RD4_C; + VP8PredLuma4[6] = LD4_C; +#endif + + VP8PredLuma4[3] = HE4_C; + VP8PredLuma4[5] = VR4_C; + VP8PredLuma4[7] = VL4_C; + VP8PredLuma4[8] = HD4_C; + VP8PredLuma4[9] = HU4_C; + +#if !WEBP_NEON_OMIT_C_CODE + VP8PredLuma16[0] = DC16_C; + VP8PredLuma16[1] = TM16_C; + VP8PredLuma16[2] = VE16_C; + VP8PredLuma16[3] = HE16_C; + VP8PredLuma16[4] = DC16NoTop_C; + VP8PredLuma16[5] = DC16NoLeft_C; + VP8PredLuma16[6] = DC16NoTopLeft_C; + + VP8PredChroma8[0] = DC8uv_C; + VP8PredChroma8[1] = TM8uv_C; + VP8PredChroma8[2] = VE8uv_C; + VP8PredChroma8[3] = HE8uv_C; + VP8PredChroma8[4] = DC8uvNoTop_C; + VP8PredChroma8[5] = DC8uvNoLeft_C; + VP8PredChroma8[6] = DC8uvNoTopLeft_C; +#endif - VP8TransformWHT = TransformWHT; - VP8Transform = TransformTwo; - VP8TransformUV = TransformUV; - VP8TransformDC = TransformDC; - VP8TransformDCUV = TransformDCUV; - VP8TransformAC3 = TransformAC3; - - VP8VFilter16 = VFilter16; - VP8HFilter16 = HFilter16; - VP8VFilter8 = VFilter8; - VP8HFilter8 = HFilter8; - VP8VFilter16i = VFilter16i; - VP8HFilter16i = HFilter16i; - VP8VFilter8i = VFilter8i; - VP8HFilter8i = HFilter8i; - VP8SimpleVFilter16 = SimpleVFilter16; - VP8SimpleHFilter16 = SimpleHFilter16; - VP8SimpleVFilter16i = SimpleVFilter16i; - VP8SimpleHFilter16i = SimpleHFilter16i; - - VP8PredLuma4[0] = DC4; - VP8PredLuma4[1] = TM4; - VP8PredLuma4[2] = VE4; - VP8PredLuma4[3] = HE4; - VP8PredLuma4[4] = RD4; - VP8PredLuma4[5] = VR4; - VP8PredLuma4[6] = LD4; - VP8PredLuma4[7] = VL4; - VP8PredLuma4[8] = HD4; - VP8PredLuma4[9] = HU4; - - VP8PredLuma16[0] = DC16; - VP8PredLuma16[1] = TM16; - VP8PredLuma16[2] = VE16; - VP8PredLuma16[3] = HE16; - VP8PredLuma16[4] = DC16NoTop; - VP8PredLuma16[5] = DC16NoLeft; - VP8PredLuma16[6] = DC16NoTopLeft; - - VP8PredChroma8[0] = DC8uv; - VP8PredChroma8[1] = TM8uv; - VP8PredChroma8[2] = VE8uv; - VP8PredChroma8[3] = HE8uv; - VP8PredChroma8[4] = DC8uvNoTop; - VP8PredChroma8[5] = DC8uvNoLeft; - VP8PredChroma8[6] = DC8uvNoTopLeft; - - VP8DitherCombine8x8 = DitherCombine8x8; + VP8DitherCombine8x8 = DitherCombine8x8_C; // If defined, use CPUInfo() to overwrite some pointers with faster versions. if (VP8GetCPUInfo != NULL) { @@ -770,11 +817,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) { #endif } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - VP8DspInitNEON(); - } -#endif #if defined(WEBP_USE_MIPS32) if (VP8GetCPUInfo(kMIPS32)) { VP8DspInitMIPS32(); @@ -791,5 +833,55 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) { } #endif } - dec_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + VP8DspInitNEON(); + } +#endif + + assert(VP8TransformWHT != NULL); + assert(VP8Transform != NULL); + assert(VP8TransformDC != NULL); + assert(VP8TransformAC3 != NULL); + assert(VP8TransformUV != NULL); + assert(VP8TransformDCUV != NULL); + assert(VP8VFilter16 != NULL); + assert(VP8HFilter16 != NULL); + assert(VP8VFilter8 != NULL); + assert(VP8HFilter8 != NULL); + assert(VP8VFilter16i != NULL); + assert(VP8HFilter16i != NULL); + assert(VP8VFilter8i != NULL); + assert(VP8HFilter8i != NULL); + assert(VP8SimpleVFilter16 != NULL); + assert(VP8SimpleHFilter16 != NULL); + assert(VP8SimpleVFilter16i != NULL); + assert(VP8SimpleHFilter16i != NULL); + assert(VP8PredLuma4[0] != NULL); + assert(VP8PredLuma4[1] != NULL); + assert(VP8PredLuma4[2] != NULL); + assert(VP8PredLuma4[3] != NULL); + assert(VP8PredLuma4[4] != NULL); + assert(VP8PredLuma4[5] != NULL); + assert(VP8PredLuma4[6] != NULL); + assert(VP8PredLuma4[7] != NULL); + assert(VP8PredLuma4[8] != NULL); + assert(VP8PredLuma4[9] != NULL); + assert(VP8PredLuma16[0] != NULL); + assert(VP8PredLuma16[1] != NULL); + assert(VP8PredLuma16[2] != NULL); + assert(VP8PredLuma16[3] != NULL); + assert(VP8PredLuma16[4] != NULL); + assert(VP8PredLuma16[5] != NULL); + assert(VP8PredLuma16[6] != NULL); + assert(VP8PredChroma8[0] != NULL); + assert(VP8PredChroma8[1] != NULL); + assert(VP8PredChroma8[2] != NULL); + assert(VP8PredChroma8[3] != NULL); + assert(VP8PredChroma8[4] != NULL); + assert(VP8PredChroma8[5] != NULL); + assert(VP8PredChroma8[6] != NULL); + assert(VP8DitherCombine8x8 != NULL); } diff --git a/Pods/libwebp/src/dsp/dec_clip_tables.c b/Pods/libwebp/src/dsp/dec_clip_tables.c index 74ba34c..427b74f 100644 --- a/Pods/libwebp/src/dsp/dec_clip_tables.c +++ b/Pods/libwebp/src/dsp/dec_clip_tables.c @@ -11,11 +11,14 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" -#define USE_STATIC_TABLES // undefine to have run-time table initialization +// define to 0 to have run-time table initialization +#if !defined(USE_STATIC_TABLES) +#define USE_STATIC_TABLES 1 // ALTERNATE_CODE +#endif -#ifdef USE_STATIC_TABLES +#if (USE_STATIC_TABLES == 1) static const uint8_t abs0[255 + 255 + 1] = { 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, @@ -337,7 +340,7 @@ static uint8_t clip1[255 + 511 + 1]; // and make sure it's set to true _last_ (so as to be thread-safe) static volatile int tables_ok = 0; -#endif +#endif // USE_STATIC_TABLES const int8_t* const VP8ksclip1 = (const int8_t*)&sclip1[1020]; const int8_t* const VP8ksclip2 = (const int8_t*)&sclip2[112]; @@ -345,7 +348,7 @@ const uint8_t* const VP8kclip1 = &clip1[255]; const uint8_t* const VP8kabs0 = &abs0[255]; WEBP_TSAN_IGNORE_FUNCTION void VP8InitClipTables(void) { -#if !defined(USE_STATIC_TABLES) +#if (USE_STATIC_TABLES == 0) int i; if (!tables_ok) { for (i = -255; i <= 255; ++i) { diff --git a/Pods/libwebp/src/dsp/dec_mips32.c b/Pods/libwebp/src/dsp/dec_mips32.c index 4e9ef42..e4e7096 100644 --- a/Pods/libwebp/src/dsp/dec_mips32.c +++ b/Pods/libwebp/src/dsp/dec_mips32.c @@ -12,11 +12,11 @@ // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) // Jovan Zelincevic (jovan.zelincevic@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS32) -#include "./mips_macro.h" +#include "src/dsp/mips_macro.h" static const int kC1 = 20091 + (1 << 16); static const int kC2 = 35468; diff --git a/Pods/libwebp/src/dsp/dec_mips_dsp_r2.c b/Pods/libwebp/src/dsp/dec_mips_dsp_r2.c index db5c657..b0936bc 100644 --- a/Pods/libwebp/src/dsp/dec_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/dec_mips_dsp_r2.c @@ -12,11 +12,11 @@ // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) // Jovan Zelincevic (jovan.zelincevic@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "./mips_macro.h" +#include "src/dsp/mips_macro.h" static const int kC1 = 20091 + (1 << 16); static const int kC2 = 35468; diff --git a/Pods/libwebp/src/dsp/dec_msa.c b/Pods/libwebp/src/dsp/dec_msa.c index 8d9c98c..8090622 100644 --- a/Pods/libwebp/src/dsp/dec_msa.c +++ b/Pods/libwebp/src/dsp/dec_msa.c @@ -12,11 +12,11 @@ // Author(s): Prashant Patil (prashant.patil@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MSA) -#include "./msa_macro.h" +#include "src/dsp/msa_macro.h" //------------------------------------------------------------------------------ // Transforms @@ -222,6 +222,7 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) { const v16i8 cnst4b = __msa_ldi_b(4); \ const v16i8 cnst3b = __msa_ldi_b(3); \ const v8i16 cnst9h = __msa_ldi_h(9); \ + const v8i16 cnst63h = __msa_ldi_h(63); \ \ FLIP_SIGN4(p1, p0, q0, q1, p1_m, p0_m, q0_m, q1_m); \ filt = __msa_subs_s_b(p1_m, q1_m); \ @@ -241,9 +242,9 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) { ILVRL_B2_SH(filt_sign, filt, filt_r, filt_l); \ /* update q2/p2 */ \ temp0 = filt_r * cnst9h; \ - temp1 = ADDVI_H(temp0, 63); \ + temp1 = temp0 + cnst63h; \ temp2 = filt_l * cnst9h; \ - temp3 = ADDVI_H(temp2, 63); \ + temp3 = temp2 + cnst63h; \ FILT2(q2_m, p2_m, q2, p2); \ /* update q1/p1 */ \ temp1 = temp1 + temp0; \ @@ -708,7 +709,7 @@ static void VE4(uint8_t* dst) { // vertical const uint32_t val0 = LW(ptop + 0); const uint32_t val1 = LW(ptop + 4); uint32_t out; - v16u8 A, B, C, AC, B2, R; + v16u8 A = { 0 }, B, C, AC, B2, R; INSERT_W2_UB(val0, val1, A); B = SLDI_UB(A, A, 1); @@ -725,7 +726,7 @@ static void RD4(uint8_t* dst) { // Down-right uint32_t val0 = LW(ptop + 0); uint32_t val1 = LW(ptop + 4); uint32_t val2, val3; - v16u8 A, B, C, AC, B2, R, A1; + v16u8 A, B, C, AC, B2, R, A1 = { 0 }; INSERT_W2_UB(val0, val1, A1); A = SLDI_UB(A1, A1, 12); @@ -753,7 +754,7 @@ static void LD4(uint8_t* dst) { // Down-Left uint32_t val0 = LW(ptop + 0); uint32_t val1 = LW(ptop + 4); uint32_t val2, val3; - v16u8 A, B, C, AC, B2, R; + v16u8 A = { 0 }, B, C, AC, B2, R; INSERT_W2_UB(val0, val1, A); B = SLDI_UB(A, A, 1); diff --git a/Pods/libwebp/src/dsp/dec_neon.c b/Pods/libwebp/src/dsp/dec_neon.c index 34796cf..239ec41 100644 --- a/Pods/libwebp/src/dsp/dec_neon.c +++ b/Pods/libwebp/src/dsp/dec_neon.c @@ -12,43 +12,23 @@ // Authors: Somnath Banerjee (somnath@google.com) // Johann Koenig (johannkoenig@google.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) -#include "./neon.h" -#include "../dec/vp8i_dec.h" +#include "src/dsp/neon.h" +#include "src/dec/vp8i_dec.h" //------------------------------------------------------------------------------ // NxM Loading functions -// Load/Store vertical edge -#define LOAD8x4(c1, c2, c3, c4, b1, b2, stride) \ - "vld4.8 {" #c1 "[0]," #c2 "[0]," #c3 "[0]," #c4 "[0]}," #b1 "," #stride "\n" \ - "vld4.8 {" #c1 "[1]," #c2 "[1]," #c3 "[1]," #c4 "[1]}," #b2 "," #stride "\n" \ - "vld4.8 {" #c1 "[2]," #c2 "[2]," #c3 "[2]," #c4 "[2]}," #b1 "," #stride "\n" \ - "vld4.8 {" #c1 "[3]," #c2 "[3]," #c3 "[3]," #c4 "[3]}," #b2 "," #stride "\n" \ - "vld4.8 {" #c1 "[4]," #c2 "[4]," #c3 "[4]," #c4 "[4]}," #b1 "," #stride "\n" \ - "vld4.8 {" #c1 "[5]," #c2 "[5]," #c3 "[5]," #c4 "[5]}," #b2 "," #stride "\n" \ - "vld4.8 {" #c1 "[6]," #c2 "[6]," #c3 "[6]," #c4 "[6]}," #b1 "," #stride "\n" \ - "vld4.8 {" #c1 "[7]," #c2 "[7]," #c3 "[7]," #c4 "[7]}," #b2 "," #stride "\n" - -#define STORE8x2(c1, c2, p, stride) \ - "vst2.8 {" #c1 "[0], " #c2 "[0]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[1], " #c2 "[1]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[2], " #c2 "[2]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[3], " #c2 "[3]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[4], " #c2 "[4]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[5], " #c2 "[5]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[6], " #c2 "[6]}," #p "," #stride " \n" \ - "vst2.8 {" #c1 "[7], " #c2 "[7]}," #p "," #stride " \n" - #if !defined(WORK_AROUND_GCC) // This intrinsics version makes gcc-4.6.3 crash during Load4x??() compilation // (register alloc, probably). The variants somewhat mitigate the problem, but // not quite. HFilter16i() remains problematic. -static WEBP_INLINE uint8x8x4_t Load4x8(const uint8_t* const src, int stride) { +static WEBP_INLINE uint8x8x4_t Load4x8_NEON(const uint8_t* const src, + int stride) { const uint8x8_t zero = vdup_n_u8(0); uint8x8x4_t out; INIT_VECTOR4(out, zero, zero, zero, zero); @@ -63,13 +43,15 @@ static WEBP_INLINE uint8x8x4_t Load4x8(const uint8_t* const src, int stride) { return out; } -static WEBP_INLINE void Load4x16(const uint8_t* const src, int stride, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1) { +static WEBP_INLINE void Load4x16_NEON(const uint8_t* const src, int stride, + uint8x16_t* const p1, + uint8x16_t* const p0, + uint8x16_t* const q0, + uint8x16_t* const q1) { // row0 = p1[0..7]|p0[0..7]|q0[0..7]|q1[0..7] // row8 = p1[8..15]|p0[8..15]|q0[8..15]|q1[8..15] - const uint8x8x4_t row0 = Load4x8(src - 2 + 0 * stride, stride); - const uint8x8x4_t row8 = Load4x8(src - 2 + 8 * stride, stride); + const uint8x8x4_t row0 = Load4x8_NEON(src - 2 + 0 * stride, stride); + const uint8x8x4_t row8 = Load4x8_NEON(src - 2 + 8 * stride, stride); *p1 = vcombine_u8(row0.val[0], row8.val[0]); *p0 = vcombine_u8(row0.val[1], row8.val[1]); *q0 = vcombine_u8(row0.val[2], row8.val[2]); @@ -83,9 +65,11 @@ static WEBP_INLINE void Load4x16(const uint8_t* const src, int stride, src += stride; \ } while (0) -static WEBP_INLINE void Load4x16(const uint8_t* src, int stride, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1) { +static WEBP_INLINE void Load4x16_NEON(const uint8_t* src, int stride, + uint8x16_t* const p1, + uint8x16_t* const p0, + uint8x16_t* const q0, + uint8x16_t* const q1) { const uint32x4_t zero = vdupq_n_u32(0); uint32x4x4_t in; INIT_VECTOR4(in, zero, zero, zero, zero); @@ -126,40 +110,40 @@ static WEBP_INLINE void Load4x16(const uint8_t* src, int stride, #endif // !WORK_AROUND_GCC -static WEBP_INLINE void Load8x16(const uint8_t* const src, int stride, - uint8x16_t* const p3, uint8x16_t* const p2, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1, - uint8x16_t* const q2, uint8x16_t* const q3) { - Load4x16(src - 2, stride, p3, p2, p1, p0); - Load4x16(src + 2, stride, q0, q1, q2, q3); +static WEBP_INLINE void Load8x16_NEON( + const uint8_t* const src, int stride, + uint8x16_t* const p3, uint8x16_t* const p2, uint8x16_t* const p1, + uint8x16_t* const p0, uint8x16_t* const q0, uint8x16_t* const q1, + uint8x16_t* const q2, uint8x16_t* const q3) { + Load4x16_NEON(src - 2, stride, p3, p2, p1, p0); + Load4x16_NEON(src + 2, stride, q0, q1, q2, q3); } -static WEBP_INLINE void Load16x4(const uint8_t* const src, int stride, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1) { +static WEBP_INLINE void Load16x4_NEON(const uint8_t* const src, int stride, + uint8x16_t* const p1, + uint8x16_t* const p0, + uint8x16_t* const q0, + uint8x16_t* const q1) { *p1 = vld1q_u8(src - 2 * stride); *p0 = vld1q_u8(src - 1 * stride); *q0 = vld1q_u8(src + 0 * stride); *q1 = vld1q_u8(src + 1 * stride); } -static WEBP_INLINE void Load16x8(const uint8_t* const src, int stride, - uint8x16_t* const p3, uint8x16_t* const p2, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1, - uint8x16_t* const q2, uint8x16_t* const q3) { - Load16x4(src - 2 * stride, stride, p3, p2, p1, p0); - Load16x4(src + 2 * stride, stride, q0, q1, q2, q3); +static WEBP_INLINE void Load16x8_NEON( + const uint8_t* const src, int stride, + uint8x16_t* const p3, uint8x16_t* const p2, uint8x16_t* const p1, + uint8x16_t* const p0, uint8x16_t* const q0, uint8x16_t* const q1, + uint8x16_t* const q2, uint8x16_t* const q3) { + Load16x4_NEON(src - 2 * stride, stride, p3, p2, p1, p0); + Load16x4_NEON(src + 2 * stride, stride, q0, q1, q2, q3); } -static WEBP_INLINE void Load8x8x2(const uint8_t* const u, - const uint8_t* const v, - int stride, - uint8x16_t* const p3, uint8x16_t* const p2, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1, - uint8x16_t* const q2, uint8x16_t* const q3) { +static WEBP_INLINE void Load8x8x2_NEON( + const uint8_t* const u, const uint8_t* const v, int stride, + uint8x16_t* const p3, uint8x16_t* const p2, uint8x16_t* const p1, + uint8x16_t* const p0, uint8x16_t* const q0, uint8x16_t* const q1, + uint8x16_t* const q2, uint8x16_t* const q3) { // We pack the 8x8 u-samples in the lower half of the uint8x16_t destination // and the v-samples on the higher half. *p3 = vcombine_u8(vld1_u8(u - 4 * stride), vld1_u8(v - 4 * stride)); @@ -177,13 +161,11 @@ static WEBP_INLINE void Load8x8x2(const uint8_t* const u, #define LOAD_UV_8(ROW) \ vcombine_u8(vld1_u8(u - 4 + (ROW) * stride), vld1_u8(v - 4 + (ROW) * stride)) -static WEBP_INLINE void Load8x8x2T(const uint8_t* const u, - const uint8_t* const v, - int stride, - uint8x16_t* const p3, uint8x16_t* const p2, - uint8x16_t* const p1, uint8x16_t* const p0, - uint8x16_t* const q0, uint8x16_t* const q1, - uint8x16_t* const q2, uint8x16_t* const q3) { +static WEBP_INLINE void Load8x8x2T_NEON( + const uint8_t* const u, const uint8_t* const v, int stride, + uint8x16_t* const p3, uint8x16_t* const p2, uint8x16_t* const p1, + uint8x16_t* const p0, uint8x16_t* const q0, uint8x16_t* const q1, + uint8x16_t* const q2, uint8x16_t* const q3) { // We pack the 8x8 u-samples in the lower half of the uint8x16_t destination // and the v-samples on the higher half. const uint8x16_t row0 = LOAD_UV_8(0); @@ -238,8 +220,8 @@ static WEBP_INLINE void Load8x8x2T(const uint8_t* const u, #endif // !WORK_AROUND_GCC -static WEBP_INLINE void Store2x8(const uint8x8x2_t v, - uint8_t* const dst, int stride) { +static WEBP_INLINE void Store2x8_NEON(const uint8x8x2_t v, + uint8_t* const dst, int stride) { vst2_lane_u8(dst + 0 * stride, v, 0); vst2_lane_u8(dst + 1 * stride, v, 1); vst2_lane_u8(dst + 2 * stride, v, 2); @@ -250,20 +232,20 @@ static WEBP_INLINE void Store2x8(const uint8x8x2_t v, vst2_lane_u8(dst + 7 * stride, v, 7); } -static WEBP_INLINE void Store2x16(const uint8x16_t p0, const uint8x16_t q0, - uint8_t* const dst, int stride) { +static WEBP_INLINE void Store2x16_NEON(const uint8x16_t p0, const uint8x16_t q0, + uint8_t* const dst, int stride) { uint8x8x2_t lo, hi; lo.val[0] = vget_low_u8(p0); lo.val[1] = vget_low_u8(q0); hi.val[0] = vget_high_u8(p0); hi.val[1] = vget_high_u8(q0); - Store2x8(lo, dst - 1 + 0 * stride, stride); - Store2x8(hi, dst - 1 + 8 * stride, stride); + Store2x8_NEON(lo, dst - 1 + 0 * stride, stride); + Store2x8_NEON(hi, dst - 1 + 8 * stride, stride); } #if !defined(WORK_AROUND_GCC) -static WEBP_INLINE void Store4x8(const uint8x8x4_t v, - uint8_t* const dst, int stride) { +static WEBP_INLINE void Store4x8_NEON(const uint8x8x4_t v, + uint8_t* const dst, int stride) { vst4_lane_u8(dst + 0 * stride, v, 0); vst4_lane_u8(dst + 1 * stride, v, 1); vst4_lane_u8(dst + 2 * stride, v, 2); @@ -274,9 +256,9 @@ static WEBP_INLINE void Store4x8(const uint8x8x4_t v, vst4_lane_u8(dst + 7 * stride, v, 7); } -static WEBP_INLINE void Store4x16(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - uint8_t* const dst, int stride) { +static WEBP_INLINE void Store4x16_NEON(const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, + uint8_t* const dst, int stride) { uint8x8x4_t lo, hi; INIT_VECTOR4(lo, vget_low_u8(p1), vget_low_u8(p0), @@ -284,27 +266,28 @@ static WEBP_INLINE void Store4x16(const uint8x16_t p1, const uint8x16_t p0, INIT_VECTOR4(hi, vget_high_u8(p1), vget_high_u8(p0), vget_high_u8(q0), vget_high_u8(q1)); - Store4x8(lo, dst - 2 + 0 * stride, stride); - Store4x8(hi, dst - 2 + 8 * stride, stride); + Store4x8_NEON(lo, dst - 2 + 0 * stride, stride); + Store4x8_NEON(hi, dst - 2 + 8 * stride, stride); } #endif // !WORK_AROUND_GCC -static WEBP_INLINE void Store16x2(const uint8x16_t p0, const uint8x16_t q0, - uint8_t* const dst, int stride) { +static WEBP_INLINE void Store16x2_NEON(const uint8x16_t p0, const uint8x16_t q0, + uint8_t* const dst, int stride) { vst1q_u8(dst - stride, p0); vst1q_u8(dst, q0); } -static WEBP_INLINE void Store16x4(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - uint8_t* const dst, int stride) { - Store16x2(p1, p0, dst - stride, stride); - Store16x2(q0, q1, dst + stride, stride); +static WEBP_INLINE void Store16x4_NEON(const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, + uint8_t* const dst, int stride) { + Store16x2_NEON(p1, p0, dst - stride, stride); + Store16x2_NEON(q0, q1, dst + stride, stride); } -static WEBP_INLINE void Store8x2x2(const uint8x16_t p0, const uint8x16_t q0, - uint8_t* const u, uint8_t* const v, - int stride) { +static WEBP_INLINE void Store8x2x2_NEON(const uint8x16_t p0, + const uint8x16_t q0, + uint8_t* const u, uint8_t* const v, + int stride) { // p0 and q0 contain the u+v samples packed in low/high halves. vst1_u8(u - stride, vget_low_u8(p0)); vst1_u8(u, vget_low_u8(q0)); @@ -312,13 +295,15 @@ static WEBP_INLINE void Store8x2x2(const uint8x16_t p0, const uint8x16_t q0, vst1_u8(v, vget_high_u8(q0)); } -static WEBP_INLINE void Store8x4x2(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - uint8_t* const u, uint8_t* const v, - int stride) { +static WEBP_INLINE void Store8x4x2_NEON(const uint8x16_t p1, + const uint8x16_t p0, + const uint8x16_t q0, + const uint8x16_t q1, + uint8_t* const u, uint8_t* const v, + int stride) { // The p1...q1 registers contain the u+v samples packed in low/high halves. - Store8x2x2(p1, p0, u - stride, v - stride, stride); - Store8x2x2(q0, q1, u + stride, v + stride, stride); + Store8x2x2_NEON(p1, p0, u - stride, v - stride, stride); + Store8x2x2_NEON(q0, q1, u + stride, v + stride, stride); } #if !defined(WORK_AROUND_GCC) @@ -329,11 +314,10 @@ static WEBP_INLINE void Store8x4x2(const uint8x16_t p1, const uint8x16_t p0, (DST) += stride; \ } while (0) -static WEBP_INLINE void Store6x8x2(const uint8x16_t p2, const uint8x16_t p1, - const uint8x16_t p0, const uint8x16_t q0, - const uint8x16_t q1, const uint8x16_t q2, - uint8_t* u, uint8_t* v, - int stride) { +static WEBP_INLINE void Store6x8x2_NEON( + const uint8x16_t p2, const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, const uint8x16_t q2, + uint8_t* u, uint8_t* v, int stride) { uint8x8x3_t u0, u1, v0, v1; INIT_VECTOR3(u0, vget_low_u8(p2), vget_low_u8(p1), vget_low_u8(p0)); INIT_VECTOR3(u1, vget_low_u8(q0), vget_low_u8(q1), vget_low_u8(q2)); @@ -358,10 +342,12 @@ static WEBP_INLINE void Store6x8x2(const uint8x16_t p2, const uint8x16_t p1, } #undef STORE6_LANE -static WEBP_INLINE void Store4x8x2(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - uint8_t* const u, uint8_t* const v, - int stride) { +static WEBP_INLINE void Store4x8x2_NEON(const uint8x16_t p1, + const uint8x16_t p0, + const uint8x16_t q0, + const uint8x16_t q1, + uint8_t* const u, uint8_t* const v, + int stride) { uint8x8x4_t u0, v0; INIT_VECTOR4(u0, vget_low_u8(p1), vget_low_u8(p0), @@ -390,15 +376,15 @@ static WEBP_INLINE void Store4x8x2(const uint8x16_t p1, const uint8x16_t p0, #endif // !WORK_AROUND_GCC // Zero extend 'v' to an int16x8_t. -static WEBP_INLINE int16x8_t ConvertU8ToS16(uint8x8_t v) { +static WEBP_INLINE int16x8_t ConvertU8ToS16_NEON(uint8x8_t v) { return vreinterpretq_s16_u16(vmovl_u8(v)); } // Performs unsigned 8b saturation on 'dst01' and 'dst23' storing the result // to the corresponding rows of 'dst'. -static WEBP_INLINE void SaturateAndStore4x4(uint8_t* const dst, - const int16x8_t dst01, - const int16x8_t dst23) { +static WEBP_INLINE void SaturateAndStore4x4_NEON(uint8_t* const dst, + const int16x8_t dst01, + const int16x8_t dst23) { // Unsigned saturate to 8b. const uint8x8_t dst01_u8 = vqmovun_s16(dst01); const uint8x8_t dst23_u8 = vqmovun_s16(dst23); @@ -410,8 +396,9 @@ static WEBP_INLINE void SaturateAndStore4x4(uint8_t* const dst, vst1_lane_u32((uint32_t*)(dst + 3 * BPS), vreinterpret_u32_u8(dst23_u8), 1); } -static WEBP_INLINE void Add4x4(const int16x8_t row01, const int16x8_t row23, - uint8_t* const dst) { +static WEBP_INLINE void Add4x4_NEON(const int16x8_t row01, + const int16x8_t row23, + uint8_t* const dst) { uint32x2_t dst01 = vdup_n_u32(0); uint32x2_t dst23 = vdup_n_u32(0); @@ -423,23 +410,23 @@ static WEBP_INLINE void Add4x4(const int16x8_t row01, const int16x8_t row23, { // Convert to 16b. - const int16x8_t dst01_s16 = ConvertU8ToS16(vreinterpret_u8_u32(dst01)); - const int16x8_t dst23_s16 = ConvertU8ToS16(vreinterpret_u8_u32(dst23)); + const int16x8_t dst01_s16 = ConvertU8ToS16_NEON(vreinterpret_u8_u32(dst01)); + const int16x8_t dst23_s16 = ConvertU8ToS16_NEON(vreinterpret_u8_u32(dst23)); // Descale with rounding. const int16x8_t out01 = vrsraq_n_s16(dst01_s16, row01, 3); const int16x8_t out23 = vrsraq_n_s16(dst23_s16, row23, 3); // Add the inverse transform. - SaturateAndStore4x4(dst, out01, out23); + SaturateAndStore4x4_NEON(dst, out01, out23); } } //----------------------------------------------------------------------------- // Simple In-loop filtering (Paragraph 15.2) -static uint8x16_t NeedsFilter(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - int thresh) { +static uint8x16_t NeedsFilter_NEON(const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, + int thresh) { const uint8x16_t thresh_v = vdupq_n_u8((uint8_t)thresh); const uint8x16_t a_p0_q0 = vabdq_u8(p0, q0); // abs(p0-q0) const uint8x16_t a_p1_q1 = vabdq_u8(p1, q1); // abs(p1-q1) @@ -450,18 +437,18 @@ static uint8x16_t NeedsFilter(const uint8x16_t p1, const uint8x16_t p0, return mask; } -static int8x16_t FlipSign(const uint8x16_t v) { +static int8x16_t FlipSign_NEON(const uint8x16_t v) { const uint8x16_t sign_bit = vdupq_n_u8(0x80); return vreinterpretq_s8_u8(veorq_u8(v, sign_bit)); } -static uint8x16_t FlipSignBack(const int8x16_t v) { +static uint8x16_t FlipSignBack_NEON(const int8x16_t v) { const int8x16_t sign_bit = vdupq_n_s8(0x80); return vreinterpretq_u8_s8(veorq_s8(v, sign_bit)); } -static int8x16_t GetBaseDelta(const int8x16_t p1, const int8x16_t p0, - const int8x16_t q0, const int8x16_t q1) { +static int8x16_t GetBaseDelta_NEON(const int8x16_t p1, const int8x16_t p0, + const int8x16_t q0, const int8x16_t q1) { const int8x16_t q0_p0 = vqsubq_s8(q0, p0); // (q0-p0) const int8x16_t p1_q1 = vqsubq_s8(p1, q1); // (p1-q1) const int8x16_t s1 = vqaddq_s8(p1_q1, q0_p0); // (p1-q1) + 1 * (q0 - p0) @@ -470,7 +457,7 @@ static int8x16_t GetBaseDelta(const int8x16_t p1, const int8x16_t p0, return s3; } -static int8x16_t GetBaseDelta0(const int8x16_t p0, const int8x16_t q0) { +static int8x16_t GetBaseDelta0_NEON(const int8x16_t p0, const int8x16_t q0) { const int8x16_t q0_p0 = vqsubq_s8(q0, p0); // (q0-p0) const int8x16_t s1 = vqaddq_s8(q0_p0, q0_p0); // 2 * (q0 - p0) const int8x16_t s2 = vqaddq_s8(q0_p0, s1); // 3 * (q0 - p0) @@ -479,9 +466,10 @@ static int8x16_t GetBaseDelta0(const int8x16_t p0, const int8x16_t q0) { //------------------------------------------------------------------------------ -static void ApplyFilter2NoFlip(const int8x16_t p0s, const int8x16_t q0s, - const int8x16_t delta, - int8x16_t* const op0, int8x16_t* const oq0) { +static void ApplyFilter2NoFlip_NEON(const int8x16_t p0s, const int8x16_t q0s, + const int8x16_t delta, + int8x16_t* const op0, + int8x16_t* const oq0) { const int8x16_t kCst3 = vdupq_n_s8(0x03); const int8x16_t kCst4 = vdupq_n_s8(0x04); const int8x16_t delta_p3 = vqaddq_s8(delta, kCst3); @@ -494,9 +482,9 @@ static void ApplyFilter2NoFlip(const int8x16_t p0s, const int8x16_t q0s, #if defined(WEBP_USE_INTRINSICS) -static void ApplyFilter2(const int8x16_t p0s, const int8x16_t q0s, - const int8x16_t delta, - uint8x16_t* const op0, uint8x16_t* const oq0) { +static void ApplyFilter2_NEON(const int8x16_t p0s, const int8x16_t q0s, + const int8x16_t delta, + uint8x16_t* const op0, uint8x16_t* const oq0) { const int8x16_t kCst3 = vdupq_n_s8(0x03); const int8x16_t kCst4 = vdupq_n_s8(0x04); const int8x16_t delta_p3 = vqaddq_s8(delta, kCst3); @@ -505,45 +493,66 @@ static void ApplyFilter2(const int8x16_t p0s, const int8x16_t q0s, const int8x16_t delta4 = vshrq_n_s8(delta_p4, 3); const int8x16_t sp0 = vqaddq_s8(p0s, delta3); const int8x16_t sq0 = vqsubq_s8(q0s, delta4); - *op0 = FlipSignBack(sp0); - *oq0 = FlipSignBack(sq0); -} - -static void DoFilter2(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - const uint8x16_t mask, - uint8x16_t* const op0, uint8x16_t* const oq0) { - const int8x16_t p1s = FlipSign(p1); - const int8x16_t p0s = FlipSign(p0); - const int8x16_t q0s = FlipSign(q0); - const int8x16_t q1s = FlipSign(q1); - const int8x16_t delta0 = GetBaseDelta(p1s, p0s, q0s, q1s); + *op0 = FlipSignBack_NEON(sp0); + *oq0 = FlipSignBack_NEON(sq0); +} + +static void DoFilter2_NEON(const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, + const uint8x16_t mask, + uint8x16_t* const op0, uint8x16_t* const oq0) { + const int8x16_t p1s = FlipSign_NEON(p1); + const int8x16_t p0s = FlipSign_NEON(p0); + const int8x16_t q0s = FlipSign_NEON(q0); + const int8x16_t q1s = FlipSign_NEON(q1); + const int8x16_t delta0 = GetBaseDelta_NEON(p1s, p0s, q0s, q1s); const int8x16_t delta1 = vandq_s8(delta0, vreinterpretq_s8_u8(mask)); - ApplyFilter2(p0s, q0s, delta1, op0, oq0); + ApplyFilter2_NEON(p0s, q0s, delta1, op0, oq0); } -static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleVFilter16_NEON(uint8_t* p, int stride, int thresh) { uint8x16_t p1, p0, q0, q1, op0, oq0; - Load16x4(p, stride, &p1, &p0, &q0, &q1); + Load16x4_NEON(p, stride, &p1, &p0, &q0, &q1); { - const uint8x16_t mask = NeedsFilter(p1, p0, q0, q1, thresh); - DoFilter2(p1, p0, q0, q1, mask, &op0, &oq0); + const uint8x16_t mask = NeedsFilter_NEON(p1, p0, q0, q1, thresh); + DoFilter2_NEON(p1, p0, q0, q1, mask, &op0, &oq0); } - Store16x2(op0, oq0, p, stride); + Store16x2_NEON(op0, oq0, p, stride); } -static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16_NEON(uint8_t* p, int stride, int thresh) { uint8x16_t p1, p0, q0, q1, oq0, op0; - Load4x16(p, stride, &p1, &p0, &q0, &q1); + Load4x16_NEON(p, stride, &p1, &p0, &q0, &q1); { - const uint8x16_t mask = NeedsFilter(p1, p0, q0, q1, thresh); - DoFilter2(p1, p0, q0, q1, mask, &op0, &oq0); + const uint8x16_t mask = NeedsFilter_NEON(p1, p0, q0, q1, thresh); + DoFilter2_NEON(p1, p0, q0, q1, mask, &op0, &oq0); } - Store2x16(op0, oq0, p, stride); + Store2x16_NEON(op0, oq0, p, stride); } #else +// Load/Store vertical edge +#define LOAD8x4(c1, c2, c3, c4, b1, b2, stride) \ + "vld4.8 {" #c1 "[0]," #c2 "[0]," #c3 "[0]," #c4 "[0]}," #b1 "," #stride "\n" \ + "vld4.8 {" #c1 "[1]," #c2 "[1]," #c3 "[1]," #c4 "[1]}," #b2 "," #stride "\n" \ + "vld4.8 {" #c1 "[2]," #c2 "[2]," #c3 "[2]," #c4 "[2]}," #b1 "," #stride "\n" \ + "vld4.8 {" #c1 "[3]," #c2 "[3]," #c3 "[3]," #c4 "[3]}," #b2 "," #stride "\n" \ + "vld4.8 {" #c1 "[4]," #c2 "[4]," #c3 "[4]," #c4 "[4]}," #b1 "," #stride "\n" \ + "vld4.8 {" #c1 "[5]," #c2 "[5]," #c3 "[5]," #c4 "[5]}," #b2 "," #stride "\n" \ + "vld4.8 {" #c1 "[6]," #c2 "[6]," #c3 "[6]," #c4 "[6]}," #b1 "," #stride "\n" \ + "vld4.8 {" #c1 "[7]," #c2 "[7]," #c3 "[7]," #c4 "[7]}," #b2 "," #stride "\n" + +#define STORE8x2(c1, c2, p, stride) \ + "vst2.8 {" #c1 "[0], " #c2 "[0]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[1], " #c2 "[1]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[2], " #c2 "[2]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[3], " #c2 "[3]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[4], " #c2 "[4]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[5], " #c2 "[5]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[6], " #c2 "[6]}," #p "," #stride " \n" \ + "vst2.8 {" #c1 "[7], " #c2 "[7]}," #p "," #stride " \n" + #define QRegs "q0", "q1", "q2", "q3", \ "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15" @@ -592,7 +601,7 @@ static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { DO_SIMPLE_FILTER(p0, q0, q9) /* apply filter */ \ FLIP_SIGN_BIT2(p0, q0, q10) -static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleVFilter16_NEON(uint8_t* p, int stride, int thresh) { __asm__ volatile ( "sub %[p], %[p], %[stride], lsl #1 \n" // p -= 2 * stride @@ -613,7 +622,7 @@ static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { ); } -static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16_NEON(uint8_t* p, int stride, int thresh) { __asm__ volatile ( "sub r4, %[p], #2 \n" // base1 = p - 2 "lsl r6, %[stride], #1 \n" // r6 = 2 * stride @@ -639,30 +648,33 @@ static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { ); } +#undef LOAD8x4 +#undef STORE8x2 + #endif // WEBP_USE_INTRINSICS -static void SimpleVFilter16i(uint8_t* p, int stride, int thresh) { +static void SimpleVFilter16i_NEON(uint8_t* p, int stride, int thresh) { uint32_t k; for (k = 3; k != 0; --k) { p += 4 * stride; - SimpleVFilter16(p, stride, thresh); + SimpleVFilter16_NEON(p, stride, thresh); } } -static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16i_NEON(uint8_t* p, int stride, int thresh) { uint32_t k; for (k = 3; k != 0; --k) { p += 4; - SimpleHFilter16(p, stride, thresh); + SimpleHFilter16_NEON(p, stride, thresh); } } //------------------------------------------------------------------------------ // Complex In-loop filtering (Paragraph 15.3) -static uint8x16_t NeedsHev(const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - int hev_thresh) { +static uint8x16_t NeedsHev_NEON(const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, + int hev_thresh) { const uint8x16_t hev_thresh_v = vdupq_n_u8((uint8_t)hev_thresh); const uint8x16_t a_p1_p0 = vabdq_u8(p1, p0); // abs(p1 - p0) const uint8x16_t a_q1_q0 = vabdq_u8(q1, q0); // abs(q1 - q0) @@ -671,11 +683,11 @@ static uint8x16_t NeedsHev(const uint8x16_t p1, const uint8x16_t p0, return mask; } -static uint8x16_t NeedsFilter2(const uint8x16_t p3, const uint8x16_t p2, - const uint8x16_t p1, const uint8x16_t p0, - const uint8x16_t q0, const uint8x16_t q1, - const uint8x16_t q2, const uint8x16_t q3, - int ithresh, int thresh) { +static uint8x16_t NeedsFilter2_NEON(const uint8x16_t p3, const uint8x16_t p2, + const uint8x16_t p1, const uint8x16_t p0, + const uint8x16_t q0, const uint8x16_t q1, + const uint8x16_t q2, const uint8x16_t q3, + int ithresh, int thresh) { const uint8x16_t ithresh_v = vdupq_n_u8((uint8_t)ithresh); const uint8x16_t a_p3_p2 = vabdq_u8(p3, p2); // abs(p3 - p2) const uint8x16_t a_p2_p1 = vabdq_u8(p2, p1); // abs(p2 - p1) @@ -689,14 +701,14 @@ static uint8x16_t NeedsFilter2(const uint8x16_t p3, const uint8x16_t p2, const uint8x16_t max12 = vmaxq_u8(max1, max2); const uint8x16_t max123 = vmaxq_u8(max12, max3); const uint8x16_t mask2 = vcgeq_u8(ithresh_v, max123); - const uint8x16_t mask1 = NeedsFilter(p1, p0, q0, q1, thresh); + const uint8x16_t mask1 = NeedsFilter_NEON(p1, p0, q0, q1, thresh); const uint8x16_t mask = vandq_u8(mask1, mask2); return mask; } // 4-points filter -static void ApplyFilter4( +static void ApplyFilter4_NEON( const int8x16_t p1, const int8x16_t p0, const int8x16_t q0, const int8x16_t q1, const int8x16_t delta0, @@ -709,47 +721,47 @@ static void ApplyFilter4( const int8x16_t a1 = vshrq_n_s8(delta1, 3); const int8x16_t a2 = vshrq_n_s8(delta2, 3); const int8x16_t a3 = vrshrq_n_s8(a1, 1); // a3 = (a1 + 1) >> 1 - *op0 = FlipSignBack(vqaddq_s8(p0, a2)); // clip(p0 + a2) - *oq0 = FlipSignBack(vqsubq_s8(q0, a1)); // clip(q0 - a1) - *op1 = FlipSignBack(vqaddq_s8(p1, a3)); // clip(p1 + a3) - *oq1 = FlipSignBack(vqsubq_s8(q1, a3)); // clip(q1 - a3) + *op0 = FlipSignBack_NEON(vqaddq_s8(p0, a2)); // clip(p0 + a2) + *oq0 = FlipSignBack_NEON(vqsubq_s8(q0, a1)); // clip(q0 - a1) + *op1 = FlipSignBack_NEON(vqaddq_s8(p1, a3)); // clip(p1 + a3) + *oq1 = FlipSignBack_NEON(vqsubq_s8(q1, a3)); // clip(q1 - a3) } -static void DoFilter4( +static void DoFilter4_NEON( const uint8x16_t p1, const uint8x16_t p0, const uint8x16_t q0, const uint8x16_t q1, const uint8x16_t mask, const uint8x16_t hev_mask, uint8x16_t* const op1, uint8x16_t* const op0, uint8x16_t* const oq0, uint8x16_t* const oq1) { // This is a fused version of DoFilter2() calling ApplyFilter2 directly - const int8x16_t p1s = FlipSign(p1); - int8x16_t p0s = FlipSign(p0); - int8x16_t q0s = FlipSign(q0); - const int8x16_t q1s = FlipSign(q1); + const int8x16_t p1s = FlipSign_NEON(p1); + int8x16_t p0s = FlipSign_NEON(p0); + int8x16_t q0s = FlipSign_NEON(q0); + const int8x16_t q1s = FlipSign_NEON(q1); const uint8x16_t simple_lf_mask = vandq_u8(mask, hev_mask); // do_filter2 part (simple loopfilter on pixels with hev) { - const int8x16_t delta = GetBaseDelta(p1s, p0s, q0s, q1s); + const int8x16_t delta = GetBaseDelta_NEON(p1s, p0s, q0s, q1s); const int8x16_t simple_lf_delta = vandq_s8(delta, vreinterpretq_s8_u8(simple_lf_mask)); - ApplyFilter2NoFlip(p0s, q0s, simple_lf_delta, &p0s, &q0s); + ApplyFilter2NoFlip_NEON(p0s, q0s, simple_lf_delta, &p0s, &q0s); } // do_filter4 part (complex loopfilter on pixels without hev) { - const int8x16_t delta0 = GetBaseDelta0(p0s, q0s); + const int8x16_t delta0 = GetBaseDelta0_NEON(p0s, q0s); // we use: (mask & hev_mask) ^ mask = mask & !hev_mask const uint8x16_t complex_lf_mask = veorq_u8(simple_lf_mask, mask); const int8x16_t complex_lf_delta = vandq_s8(delta0, vreinterpretq_s8_u8(complex_lf_mask)); - ApplyFilter4(p1s, p0s, q0s, q1s, complex_lf_delta, op1, op0, oq0, oq1); + ApplyFilter4_NEON(p1s, p0s, q0s, q1s, complex_lf_delta, op1, op0, oq0, oq1); } } // 6-points filter -static void ApplyFilter6( +static void ApplyFilter6_NEON( const int8x16_t p2, const int8x16_t p1, const int8x16_t p0, const int8x16_t q0, const int8x16_t q1, const int8x16_t q2, const int8x16_t delta, @@ -778,35 +790,35 @@ static void ApplyFilter6( const int8x16_t a2 = vcombine_s8(a2_lo, a2_hi); const int8x16_t a3 = vcombine_s8(a3_lo, a3_hi); - *op0 = FlipSignBack(vqaddq_s8(p0, a1)); // clip(p0 + a1) - *oq0 = FlipSignBack(vqsubq_s8(q0, a1)); // clip(q0 - q1) - *oq1 = FlipSignBack(vqsubq_s8(q1, a2)); // clip(q1 - a2) - *op1 = FlipSignBack(vqaddq_s8(p1, a2)); // clip(p1 + a2) - *oq2 = FlipSignBack(vqsubq_s8(q2, a3)); // clip(q2 - a3) - *op2 = FlipSignBack(vqaddq_s8(p2, a3)); // clip(p2 + a3) + *op0 = FlipSignBack_NEON(vqaddq_s8(p0, a1)); // clip(p0 + a1) + *oq0 = FlipSignBack_NEON(vqsubq_s8(q0, a1)); // clip(q0 - q1) + *oq1 = FlipSignBack_NEON(vqsubq_s8(q1, a2)); // clip(q1 - a2) + *op1 = FlipSignBack_NEON(vqaddq_s8(p1, a2)); // clip(p1 + a2) + *oq2 = FlipSignBack_NEON(vqsubq_s8(q2, a3)); // clip(q2 - a3) + *op2 = FlipSignBack_NEON(vqaddq_s8(p2, a3)); // clip(p2 + a3) } -static void DoFilter6( +static void DoFilter6_NEON( const uint8x16_t p2, const uint8x16_t p1, const uint8x16_t p0, const uint8x16_t q0, const uint8x16_t q1, const uint8x16_t q2, const uint8x16_t mask, const uint8x16_t hev_mask, uint8x16_t* const op2, uint8x16_t* const op1, uint8x16_t* const op0, uint8x16_t* const oq0, uint8x16_t* const oq1, uint8x16_t* const oq2) { // This is a fused version of DoFilter2() calling ApplyFilter2 directly - const int8x16_t p2s = FlipSign(p2); - const int8x16_t p1s = FlipSign(p1); - int8x16_t p0s = FlipSign(p0); - int8x16_t q0s = FlipSign(q0); - const int8x16_t q1s = FlipSign(q1); - const int8x16_t q2s = FlipSign(q2); + const int8x16_t p2s = FlipSign_NEON(p2); + const int8x16_t p1s = FlipSign_NEON(p1); + int8x16_t p0s = FlipSign_NEON(p0); + int8x16_t q0s = FlipSign_NEON(q0); + const int8x16_t q1s = FlipSign_NEON(q1); + const int8x16_t q2s = FlipSign_NEON(q2); const uint8x16_t simple_lf_mask = vandq_u8(mask, hev_mask); - const int8x16_t delta0 = GetBaseDelta(p1s, p0s, q0s, q1s); + const int8x16_t delta0 = GetBaseDelta_NEON(p1s, p0s, q0s, q1s); // do_filter2 part (simple loopfilter on pixels with hev) { const int8x16_t simple_lf_delta = vandq_s8(delta0, vreinterpretq_s8_u8(simple_lf_mask)); - ApplyFilter2NoFlip(p0s, q0s, simple_lf_delta, &p0s, &q0s); + ApplyFilter2NoFlip_NEON(p0s, q0s, simple_lf_delta, &p0s, &q0s); } // do_filter6 part (complex loopfilter on pixels without hev) @@ -815,65 +827,65 @@ static void DoFilter6( const uint8x16_t complex_lf_mask = veorq_u8(simple_lf_mask, mask); const int8x16_t complex_lf_delta = vandq_s8(delta0, vreinterpretq_s8_u8(complex_lf_mask)); - ApplyFilter6(p2s, p1s, p0s, q0s, q1s, q2s, complex_lf_delta, - op2, op1, op0, oq0, oq1, oq2); + ApplyFilter6_NEON(p2s, p1s, p0s, q0s, q1s, q2s, complex_lf_delta, + op2, op1, op0, oq0, oq1, oq2); } } // on macroblock edges -static void VFilter16(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter16_NEON(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { uint8x16_t p3, p2, p1, p0, q0, q1, q2, q3; - Load16x8(p, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); + Load16x8_NEON(p, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); { - const uint8x16_t mask = NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, - ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + const uint8x16_t mask = NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, + ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); uint8x16_t op2, op1, op0, oq0, oq1, oq2; - DoFilter6(p2, p1, p0, q0, q1, q2, mask, hev_mask, - &op2, &op1, &op0, &oq0, &oq1, &oq2); - Store16x2(op2, op1, p - 2 * stride, stride); - Store16x2(op0, oq0, p + 0 * stride, stride); - Store16x2(oq1, oq2, p + 2 * stride, stride); + DoFilter6_NEON(p2, p1, p0, q0, q1, q2, mask, hev_mask, + &op2, &op1, &op0, &oq0, &oq1, &oq2); + Store16x2_NEON(op2, op1, p - 2 * stride, stride); + Store16x2_NEON(op0, oq0, p + 0 * stride, stride); + Store16x2_NEON(oq1, oq2, p + 2 * stride, stride); } } -static void HFilter16(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter16_NEON(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { uint8x16_t p3, p2, p1, p0, q0, q1, q2, q3; - Load8x16(p, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); + Load8x16_NEON(p, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); { - const uint8x16_t mask = NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, - ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + const uint8x16_t mask = NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, + ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); uint8x16_t op2, op1, op0, oq0, oq1, oq2; - DoFilter6(p2, p1, p0, q0, q1, q2, mask, hev_mask, - &op2, &op1, &op0, &oq0, &oq1, &oq2); - Store2x16(op2, op1, p - 2, stride); - Store2x16(op0, oq0, p + 0, stride); - Store2x16(oq1, oq2, p + 2, stride); + DoFilter6_NEON(p2, p1, p0, q0, q1, q2, mask, hev_mask, + &op2, &op1, &op0, &oq0, &oq1, &oq2); + Store2x16_NEON(op2, op1, p - 2, stride); + Store2x16_NEON(op0, oq0, p + 0, stride); + Store2x16_NEON(oq1, oq2, p + 2, stride); } } // on three inner edges -static void VFilter16i(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter16i_NEON(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { uint32_t k; uint8x16_t p3, p2, p1, p0; - Load16x4(p + 2 * stride, stride, &p3, &p2, &p1, &p0); + Load16x4_NEON(p + 2 * stride, stride, &p3, &p2, &p1, &p0); for (k = 3; k != 0; --k) { uint8x16_t q0, q1, q2, q3; p += 4 * stride; - Load16x4(p + 2 * stride, stride, &q0, &q1, &q2, &q3); + Load16x4_NEON(p + 2 * stride, stride, &q0, &q1, &q2, &q3); { const uint8x16_t mask = - NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); // p3 and p2 are not just temporary variables here: they will be // re-used for next span. And q2/q3 will become p1/p0 accordingly. - DoFilter4(p1, p0, q0, q1, mask, hev_mask, &p1, &p0, &p3, &p2); - Store16x4(p1, p0, p3, p2, p, stride); + DoFilter4_NEON(p1, p0, q0, q1, mask, hev_mask, &p1, &p0, &p3, &p2); + Store16x4_NEON(p1, p0, p3, p2, p, stride); p1 = q2; p0 = q3; } @@ -881,21 +893,21 @@ static void VFilter16i(uint8_t* p, int stride, } #if !defined(WORK_AROUND_GCC) -static void HFilter16i(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter16i_NEON(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { uint32_t k; uint8x16_t p3, p2, p1, p0; - Load4x16(p + 2, stride, &p3, &p2, &p1, &p0); + Load4x16_NEON(p + 2, stride, &p3, &p2, &p1, &p0); for (k = 3; k != 0; --k) { uint8x16_t q0, q1, q2, q3; p += 4; - Load4x16(p + 2, stride, &q0, &q1, &q2, &q3); + Load4x16_NEON(p + 2, stride, &q0, &q1, &q2, &q3); { const uint8x16_t mask = - NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); - DoFilter4(p1, p0, q0, q1, mask, hev_mask, &p1, &p0, &p3, &p2); - Store4x16(p1, p0, p3, p2, p, stride); + NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); + DoFilter4_NEON(p1, p0, q0, q1, mask, hev_mask, &p1, &p0, &p3, &p2); + Store4x16_NEON(p1, p0, p3, p2, p, stride); p1 = q2; p0 = q3; } @@ -904,67 +916,67 @@ static void HFilter16i(uint8_t* p, int stride, #endif // !WORK_AROUND_GCC // 8-pixels wide variant, for chroma filtering -static void VFilter8(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter8_NEON(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { uint8x16_t p3, p2, p1, p0, q0, q1, q2, q3; - Load8x8x2(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); + Load8x8x2_NEON(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); { - const uint8x16_t mask = NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, - ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + const uint8x16_t mask = NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, + ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); uint8x16_t op2, op1, op0, oq0, oq1, oq2; - DoFilter6(p2, p1, p0, q0, q1, q2, mask, hev_mask, - &op2, &op1, &op0, &oq0, &oq1, &oq2); - Store8x2x2(op2, op1, u - 2 * stride, v - 2 * stride, stride); - Store8x2x2(op0, oq0, u + 0 * stride, v + 0 * stride, stride); - Store8x2x2(oq1, oq2, u + 2 * stride, v + 2 * stride, stride); + DoFilter6_NEON(p2, p1, p0, q0, q1, q2, mask, hev_mask, + &op2, &op1, &op0, &oq0, &oq1, &oq2); + Store8x2x2_NEON(op2, op1, u - 2 * stride, v - 2 * stride, stride); + Store8x2x2_NEON(op0, oq0, u + 0 * stride, v + 0 * stride, stride); + Store8x2x2_NEON(oq1, oq2, u + 2 * stride, v + 2 * stride, stride); } } -static void VFilter8i(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter8i_NEON(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { uint8x16_t p3, p2, p1, p0, q0, q1, q2, q3; u += 4 * stride; v += 4 * stride; - Load8x8x2(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); + Load8x8x2_NEON(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); { - const uint8x16_t mask = NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, - ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + const uint8x16_t mask = NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, + ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); uint8x16_t op1, op0, oq0, oq1; - DoFilter4(p1, p0, q0, q1, mask, hev_mask, &op1, &op0, &oq0, &oq1); - Store8x4x2(op1, op0, oq0, oq1, u, v, stride); + DoFilter4_NEON(p1, p0, q0, q1, mask, hev_mask, &op1, &op0, &oq0, &oq1); + Store8x4x2_NEON(op1, op0, oq0, oq1, u, v, stride); } } #if !defined(WORK_AROUND_GCC) -static void HFilter8(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter8_NEON(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { uint8x16_t p3, p2, p1, p0, q0, q1, q2, q3; - Load8x8x2T(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); + Load8x8x2T_NEON(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); { - const uint8x16_t mask = NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, - ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + const uint8x16_t mask = NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, + ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); uint8x16_t op2, op1, op0, oq0, oq1, oq2; - DoFilter6(p2, p1, p0, q0, q1, q2, mask, hev_mask, - &op2, &op1, &op0, &oq0, &oq1, &oq2); - Store6x8x2(op2, op1, op0, oq0, oq1, oq2, u, v, stride); + DoFilter6_NEON(p2, p1, p0, q0, q1, q2, mask, hev_mask, + &op2, &op1, &op0, &oq0, &oq1, &oq2); + Store6x8x2_NEON(op2, op1, op0, oq0, oq1, oq2, u, v, stride); } } -static void HFilter8i(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter8i_NEON(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { uint8x16_t p3, p2, p1, p0, q0, q1, q2, q3; u += 4; v += 4; - Load8x8x2T(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); + Load8x8x2T_NEON(u, v, stride, &p3, &p2, &p1, &p0, &q0, &q1, &q2, &q3); { - const uint8x16_t mask = NeedsFilter2(p3, p2, p1, p0, q0, q1, q2, q3, - ithresh, thresh); - const uint8x16_t hev_mask = NeedsHev(p1, p0, q0, q1, hev_thresh); + const uint8x16_t mask = NeedsFilter2_NEON(p3, p2, p1, p0, q0, q1, q2, q3, + ithresh, thresh); + const uint8x16_t hev_mask = NeedsHev_NEON(p1, p0, q0, q1, hev_thresh); uint8x16_t op1, op0, oq0, oq1; - DoFilter4(p1, p0, q0, q1, mask, hev_mask, &op1, &op0, &oq0, &oq1); - Store4x8x2(op1, op0, oq0, oq1, u, v, stride); + DoFilter4_NEON(p1, p0, q0, q1, mask, hev_mask, &op1, &op0, &oq0, &oq1); + Store4x8x2_NEON(op1, op0, oq0, oq1, u, v, stride); } } #endif // !WORK_AROUND_GCC @@ -992,8 +1004,9 @@ static const int16_t kC1 = 20091; static const int16_t kC2 = 17734; // half of kC2, actually. See comment above. #if defined(WEBP_USE_INTRINSICS) -static WEBP_INLINE void Transpose8x2(const int16x8_t in0, const int16x8_t in1, - int16x8x2_t* const out) { +static WEBP_INLINE void Transpose8x2_NEON(const int16x8_t in0, + const int16x8_t in1, + int16x8x2_t* const out) { // a0 a1 a2 a3 | b0 b1 b2 b3 => a0 b0 c0 d0 | a1 b1 c1 d1 // c0 c1 c2 c3 | d0 d1 d2 d3 a2 b2 c2 d2 | a3 b3 c3 d3 const int16x8x2_t tmp0 = vzipq_s16(in0, in1); // a0 c0 a1 c1 a2 c2 ... @@ -1001,7 +1014,7 @@ static WEBP_INLINE void Transpose8x2(const int16x8_t in0, const int16x8_t in1, *out = vzipq_s16(tmp0.val[0], tmp0.val[1]); } -static WEBP_INLINE void TransformPass(int16x8x2_t* const rows) { +static WEBP_INLINE void TransformPass_NEON(int16x8x2_t* const rows) { // {rows} = in0 | in4 // in8 | in12 // B1 = in4 | in12 @@ -1024,20 +1037,20 @@ static WEBP_INLINE void TransformPass(int16x8x2_t* const rows) { const int16x8_t E0 = vqaddq_s16(D0, D1); // a+d | b+c const int16x8_t E_tmp = vqsubq_s16(D0, D1); // a-d | b-c const int16x8_t E1 = vcombine_s16(vget_high_s16(E_tmp), vget_low_s16(E_tmp)); - Transpose8x2(E0, E1, rows); + Transpose8x2_NEON(E0, E1, rows); } -static void TransformOne(const int16_t* in, uint8_t* dst) { +static void TransformOne_NEON(const int16_t* in, uint8_t* dst) { int16x8x2_t rows; INIT_VECTOR2(rows, vld1q_s16(in + 0), vld1q_s16(in + 8)); - TransformPass(&rows); - TransformPass(&rows); - Add4x4(rows.val[0], rows.val[1], dst); + TransformPass_NEON(&rows); + TransformPass_NEON(&rows); + Add4x4_NEON(rows.val[0], rows.val[1], dst); } #else -static void TransformOne(const int16_t* in, uint8_t* dst) { +static void TransformOne_NEON(const int16_t* in, uint8_t* dst) { const int kBPS = BPS; // kC1, kC2. Padded because vld1.16 loads 8 bytes const int16_t constants[4] = { kC1, kC2, 0, 0 }; @@ -1170,16 +1183,16 @@ static void TransformOne(const int16_t* in, uint8_t* dst) { #endif // WEBP_USE_INTRINSICS -static void TransformTwo(const int16_t* in, uint8_t* dst, int do_two) { - TransformOne(in, dst); +static void TransformTwo_NEON(const int16_t* in, uint8_t* dst, int do_two) { + TransformOne_NEON(in, dst); if (do_two) { - TransformOne(in + 16, dst + 4); + TransformOne_NEON(in + 16, dst + 4); } } -static void TransformDC(const int16_t* in, uint8_t* dst) { +static void TransformDC_NEON(const int16_t* in, uint8_t* dst) { const int16x8_t DC = vdupq_n_s16(in[0]); - Add4x4(DC, DC, dst); + Add4x4_NEON(DC, DC, dst); } //------------------------------------------------------------------------------ @@ -1191,7 +1204,7 @@ static void TransformDC(const int16_t* in, uint8_t* dst) { *dst = vgetq_lane_s32(rows.val[3], col); (dst) += 16; \ } while (0) -static void TransformWHT(const int16_t* in, int16_t* out) { +static void TransformWHT_NEON(const int16_t* in, int16_t* out) { int32x4x4_t tmp; { @@ -1209,7 +1222,7 @@ static void TransformWHT(const int16_t* in, int16_t* out) { tmp.val[2] = vsubq_s32(a0, a1); tmp.val[3] = vsubq_s32(a3, a2); // Arrange the temporary results column-wise. - tmp = Transpose4x4(tmp); + tmp = Transpose4x4_NEON(tmp); } { @@ -1243,7 +1256,7 @@ static void TransformWHT(const int16_t* in, int16_t* out) { //------------------------------------------------------------------------------ #define MUL(a, b) (((a) * (b)) >> 16) -static void TransformAC3(const int16_t* in, uint8_t* dst) { +static void TransformAC3_NEON(const int16_t* in, uint8_t* dst) { static const int kC1_full = 20091 + (1 << 16); static const int kC2_full = 35468; const int16x4_t A = vld1_dup_s16(in); @@ -1259,14 +1272,14 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) { const int16x4_t B = vqadd_s16(A, CD); const int16x8_t m0_m1 = vcombine_s16(vqadd_s16(B, d4), vqadd_s16(B, c4)); const int16x8_t m2_m3 = vcombine_s16(vqsub_s16(B, c4), vqsub_s16(B, d4)); - Add4x4(m0_m1, m2_m3, dst); + Add4x4_NEON(m0_m1, m2_m3, dst); } #undef MUL //------------------------------------------------------------------------------ // 4x4 -static void DC4(uint8_t* dst) { // DC +static void DC4_NEON(uint8_t* dst) { // DC const uint8x8_t A = vld1_u8(dst - BPS); // top row const uint16x4_t p0 = vpaddl_u8(A); // cascading summation of the top const uint16x4_t p1 = vpadd_u16(p0, p0); @@ -1287,17 +1300,17 @@ static void DC4(uint8_t* dst) { // DC } // TrueMotion (4x4 + 8x8) -static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { +static WEBP_INLINE void TrueMotion_NEON(uint8_t* dst, int size) { const uint8x8_t TL = vld1_dup_u8(dst - BPS - 1); // top-left pixel 'A[-1]' const uint8x8_t T = vld1_u8(dst - BPS); // top row 'A[0..3]' const int16x8_t d = vreinterpretq_s16_u16(vsubl_u8(T, TL)); // A[c] - A[-1] int y; for (y = 0; y < size; y += 4) { // left edge - const int16x8_t L0 = ConvertU8ToS16(vld1_dup_u8(dst + 0 * BPS - 1)); - const int16x8_t L1 = ConvertU8ToS16(vld1_dup_u8(dst + 1 * BPS - 1)); - const int16x8_t L2 = ConvertU8ToS16(vld1_dup_u8(dst + 2 * BPS - 1)); - const int16x8_t L3 = ConvertU8ToS16(vld1_dup_u8(dst + 3 * BPS - 1)); + const int16x8_t L0 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 0 * BPS - 1)); + const int16x8_t L1 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 1 * BPS - 1)); + const int16x8_t L2 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 2 * BPS - 1)); + const int16x8_t L3 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 3 * BPS - 1)); const int16x8_t r0 = vaddq_s16(L0, d); // L[r] + A[c] - A[-1] const int16x8_t r1 = vaddq_s16(L1, d); const int16x8_t r2 = vaddq_s16(L2, d); @@ -1322,9 +1335,9 @@ static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { } } -static void TM4(uint8_t* dst) { TrueMotion(dst, 4); } +static void TM4_NEON(uint8_t* dst) { TrueMotion_NEON(dst, 4); } -static void VE4(uint8_t* dst) { // vertical +static void VE4_NEON(uint8_t* dst) { // vertical // NB: avoid vld1_u64 here as an alignment hint may be added -> SIGBUS. const uint64x1_t A0 = vreinterpret_u64_u8(vld1_u8(dst - BPS - 1)); // top row const uint64x1_t A1 = vshr_n_u64(A0, 8); @@ -1340,7 +1353,7 @@ static void VE4(uint8_t* dst) { // vertical } } -static void RD4(uint8_t* dst) { // Down-right +static void RD4_NEON(uint8_t* dst) { // Down-right const uint8x8_t XABCD_u8 = vld1_u8(dst - BPS - 1); const uint64x1_t XABCD = vreinterpret_u64_u8(XABCD_u8); const uint64x1_t ____XABC = vshl_n_u64(XABCD, 32); @@ -1348,7 +1361,8 @@ static void RD4(uint8_t* dst) { // Down-right const uint32_t J = dst[-1 + 1 * BPS]; const uint32_t K = dst[-1 + 2 * BPS]; const uint32_t L = dst[-1 + 3 * BPS]; - const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24)); + const uint64x1_t LKJI____ = + vcreate_u64((uint64_t)L | (K << 8) | (J << 16) | (I << 24)); const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC); const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8)); const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16)); @@ -1368,7 +1382,7 @@ static void RD4(uint8_t* dst) { // Down-right vst1_lane_u32((uint32_t*)(dst + 3 * BPS), r3, 0); } -static void LD4(uint8_t* dst) { // Down-left +static void LD4_NEON(uint8_t* dst) { // Down-left // Note using the same shift trick as VE4() is slower here. const uint8x8_t ABCDEFGH = vld1_u8(dst - BPS + 0); const uint8x8_t BCDEFGH0 = vld1_u8(dst - BPS + 1); @@ -1390,7 +1404,7 @@ static void LD4(uint8_t* dst) { // Down-left //------------------------------------------------------------------------------ // Chroma -static void VE8uv(uint8_t* dst) { // vertical +static void VE8uv_NEON(uint8_t* dst) { // vertical const uint8x8_t top = vld1_u8(dst - BPS); int j; for (j = 0; j < 8; ++j) { @@ -1398,7 +1412,7 @@ static void VE8uv(uint8_t* dst) { // vertical } } -static void HE8uv(uint8_t* dst) { // horizontal +static void HE8uv_NEON(uint8_t* dst) { // horizontal int j; for (j = 0; j < 8; ++j) { const uint8x8_t left = vld1_dup_u8(dst - 1); @@ -1407,17 +1421,23 @@ static void HE8uv(uint8_t* dst) { // horizontal } } -static WEBP_INLINE void DC8(uint8_t* dst, int do_top, int do_left) { +static WEBP_INLINE void DC8_NEON(uint8_t* dst, int do_top, int do_left) { uint16x8_t sum_top; uint16x8_t sum_left; uint8x8_t dc0; if (do_top) { const uint8x8_t A = vld1_u8(dst - BPS); // top row +#if defined(__aarch64__) + const uint16x8_t B = vmovl_u8(A); + const uint16_t p2 = vaddvq_u16(B); + sum_top = vdupq_n_u16(p2); +#else const uint16x4_t p0 = vpaddl_u8(A); // cascading summation of the top const uint16x4_t p1 = vpadd_u16(p0, p0); const uint16x4_t p2 = vpadd_u16(p1, p1); sum_top = vcombine_u16(p2, p2); +#endif } if (do_left) { @@ -1458,17 +1478,17 @@ static WEBP_INLINE void DC8(uint8_t* dst, int do_top, int do_left) { } } -static void DC8uv(uint8_t* dst) { DC8(dst, 1, 1); } -static void DC8uvNoTop(uint8_t* dst) { DC8(dst, 0, 1); } -static void DC8uvNoLeft(uint8_t* dst) { DC8(dst, 1, 0); } -static void DC8uvNoTopLeft(uint8_t* dst) { DC8(dst, 0, 0); } +static void DC8uv_NEON(uint8_t* dst) { DC8_NEON(dst, 1, 1); } +static void DC8uvNoTop_NEON(uint8_t* dst) { DC8_NEON(dst, 0, 1); } +static void DC8uvNoLeft_NEON(uint8_t* dst) { DC8_NEON(dst, 1, 0); } +static void DC8uvNoTopLeft_NEON(uint8_t* dst) { DC8_NEON(dst, 0, 0); } -static void TM8uv(uint8_t* dst) { TrueMotion(dst, 8); } +static void TM8uv_NEON(uint8_t* dst) { TrueMotion_NEON(dst, 8); } //------------------------------------------------------------------------------ // 16x16 -static void VE16(uint8_t* dst) { // vertical +static void VE16_NEON(uint8_t* dst) { // vertical const uint8x16_t top = vld1q_u8(dst - BPS); int j; for (j = 0; j < 16; ++j) { @@ -1476,7 +1496,7 @@ static void VE16(uint8_t* dst) { // vertical } } -static void HE16(uint8_t* dst) { // horizontal +static void HE16_NEON(uint8_t* dst) { // horizontal int j; for (j = 0; j < 16; ++j) { const uint8x16_t left = vld1q_dup_u8(dst - 1); @@ -1485,7 +1505,7 @@ static void HE16(uint8_t* dst) { // horizontal } } -static WEBP_INLINE void DC16(uint8_t* dst, int do_top, int do_left) { +static WEBP_INLINE void DC16_NEON(uint8_t* dst, int do_top, int do_left) { uint16x8_t sum_top; uint16x8_t sum_left; uint8x8_t dc0; @@ -1542,12 +1562,12 @@ static WEBP_INLINE void DC16(uint8_t* dst, int do_top, int do_left) { } } -static void DC16TopLeft(uint8_t* dst) { DC16(dst, 1, 1); } -static void DC16NoTop(uint8_t* dst) { DC16(dst, 0, 1); } -static void DC16NoLeft(uint8_t* dst) { DC16(dst, 1, 0); } -static void DC16NoTopLeft(uint8_t* dst) { DC16(dst, 0, 0); } +static void DC16TopLeft_NEON(uint8_t* dst) { DC16_NEON(dst, 1, 1); } +static void DC16NoTop_NEON(uint8_t* dst) { DC16_NEON(dst, 0, 1); } +static void DC16NoLeft_NEON(uint8_t* dst) { DC16_NEON(dst, 1, 0); } +static void DC16NoTopLeft_NEON(uint8_t* dst) { DC16_NEON(dst, 0, 0); } -static void TM16(uint8_t* dst) { +static void TM16_NEON(uint8_t* dst) { const uint8x8_t TL = vld1_dup_u8(dst - BPS - 1); // top-left pixel 'A[-1]' const uint8x16_t T = vld1q_u8(dst - BPS); // top row 'A[0..15]' // A[c] - A[-1] @@ -1556,10 +1576,10 @@ static void TM16(uint8_t* dst) { int y; for (y = 0; y < 16; y += 4) { // left edge - const int16x8_t L0 = ConvertU8ToS16(vld1_dup_u8(dst + 0 * BPS - 1)); - const int16x8_t L1 = ConvertU8ToS16(vld1_dup_u8(dst + 1 * BPS - 1)); - const int16x8_t L2 = ConvertU8ToS16(vld1_dup_u8(dst + 2 * BPS - 1)); - const int16x8_t L3 = ConvertU8ToS16(vld1_dup_u8(dst + 3 * BPS - 1)); + const int16x8_t L0 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 0 * BPS - 1)); + const int16x8_t L1 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 1 * BPS - 1)); + const int16x8_t L2 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 2 * BPS - 1)); + const int16x8_t L3 = ConvertU8ToS16_NEON(vld1_dup_u8(dst + 3 * BPS - 1)); const int16x8_t r0_lo = vaddq_s16(L0, d_lo); // L[r] + A[c] - A[-1] const int16x8_t r1_lo = vaddq_s16(L1, d_lo); const int16x8_t r2_lo = vaddq_s16(L2, d_lo); @@ -1587,49 +1607,49 @@ static void TM16(uint8_t* dst) { extern void VP8DspInitNEON(void); WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitNEON(void) { - VP8Transform = TransformTwo; - VP8TransformAC3 = TransformAC3; - VP8TransformDC = TransformDC; - VP8TransformWHT = TransformWHT; - - VP8VFilter16 = VFilter16; - VP8VFilter16i = VFilter16i; - VP8HFilter16 = HFilter16; + VP8Transform = TransformTwo_NEON; + VP8TransformAC3 = TransformAC3_NEON; + VP8TransformDC = TransformDC_NEON; + VP8TransformWHT = TransformWHT_NEON; + + VP8VFilter16 = VFilter16_NEON; + VP8VFilter16i = VFilter16i_NEON; + VP8HFilter16 = HFilter16_NEON; #if !defined(WORK_AROUND_GCC) - VP8HFilter16i = HFilter16i; + VP8HFilter16i = HFilter16i_NEON; #endif - VP8VFilter8 = VFilter8; - VP8VFilter8i = VFilter8i; + VP8VFilter8 = VFilter8_NEON; + VP8VFilter8i = VFilter8i_NEON; #if !defined(WORK_AROUND_GCC) - VP8HFilter8 = HFilter8; - VP8HFilter8i = HFilter8i; + VP8HFilter8 = HFilter8_NEON; + VP8HFilter8i = HFilter8i_NEON; #endif - VP8SimpleVFilter16 = SimpleVFilter16; - VP8SimpleHFilter16 = SimpleHFilter16; - VP8SimpleVFilter16i = SimpleVFilter16i; - VP8SimpleHFilter16i = SimpleHFilter16i; - - VP8PredLuma4[0] = DC4; - VP8PredLuma4[1] = TM4; - VP8PredLuma4[2] = VE4; - VP8PredLuma4[4] = RD4; - VP8PredLuma4[6] = LD4; - - VP8PredLuma16[0] = DC16TopLeft; - VP8PredLuma16[1] = TM16; - VP8PredLuma16[2] = VE16; - VP8PredLuma16[3] = HE16; - VP8PredLuma16[4] = DC16NoTop; - VP8PredLuma16[5] = DC16NoLeft; - VP8PredLuma16[6] = DC16NoTopLeft; - - VP8PredChroma8[0] = DC8uv; - VP8PredChroma8[1] = TM8uv; - VP8PredChroma8[2] = VE8uv; - VP8PredChroma8[3] = HE8uv; - VP8PredChroma8[4] = DC8uvNoTop; - VP8PredChroma8[5] = DC8uvNoLeft; - VP8PredChroma8[6] = DC8uvNoTopLeft; + VP8SimpleVFilter16 = SimpleVFilter16_NEON; + VP8SimpleHFilter16 = SimpleHFilter16_NEON; + VP8SimpleVFilter16i = SimpleVFilter16i_NEON; + VP8SimpleHFilter16i = SimpleHFilter16i_NEON; + + VP8PredLuma4[0] = DC4_NEON; + VP8PredLuma4[1] = TM4_NEON; + VP8PredLuma4[2] = VE4_NEON; + VP8PredLuma4[4] = RD4_NEON; + VP8PredLuma4[6] = LD4_NEON; + + VP8PredLuma16[0] = DC16TopLeft_NEON; + VP8PredLuma16[1] = TM16_NEON; + VP8PredLuma16[2] = VE16_NEON; + VP8PredLuma16[3] = HE16_NEON; + VP8PredLuma16[4] = DC16NoTop_NEON; + VP8PredLuma16[5] = DC16NoLeft_NEON; + VP8PredLuma16[6] = DC16NoTopLeft_NEON; + + VP8PredChroma8[0] = DC8uv_NEON; + VP8PredChroma8[1] = TM8uv_NEON; + VP8PredChroma8[2] = VE8uv_NEON; + VP8PredChroma8[3] = HE8uv_NEON; + VP8PredChroma8[4] = DC8uvNoTop_NEON; + VP8PredChroma8[5] = DC8uvNoLeft_NEON; + VP8PredChroma8[6] = DC8uvNoTopLeft_NEON; } #else // !WEBP_USE_NEON diff --git a/Pods/libwebp/src/dsp/dec_sse2.c b/Pods/libwebp/src/dsp/dec_sse2.c index 411fb02..873aa59 100644 --- a/Pods/libwebp/src/dsp/dec_sse2.c +++ b/Pods/libwebp/src/dsp/dec_sse2.c @@ -12,23 +12,25 @@ // Author: somnath@google.com (Somnath Banerjee) // cduvivier@google.com (Christian Duvivier) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) // The 3-coeff sparse transform in SSE2 is not really faster than the plain-C // one it seems => disable it by default. Uncomment the following to enable: -// #define USE_TRANSFORM_AC3 +#if !defined(USE_TRANSFORM_AC3) +#define USE_TRANSFORM_AC3 0 // ALTERNATE_CODE +#endif #include -#include "./common_sse2.h" -#include "../dec/vp8i_dec.h" -#include "../utils/utils.h" +#include "src/dsp/common_sse2.h" +#include "src/dec/vp8i_dec.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // Transforms (Paragraph 14.4) -static void Transform(const int16_t* in, uint8_t* dst, int do_two) { +static void Transform_SSE2(const int16_t* in, uint8_t* dst, int do_two) { // This implementation makes use of 16-bit fixed point versions of two // multiply constants: // K1 = sqrt(2) * cos (pi/8) ~= 85627 / 2^16 @@ -193,7 +195,7 @@ static void Transform(const int16_t* in, uint8_t* dst, int do_two) { } } -#if defined(USE_TRANSFORM_AC3) +#if (USE_TRANSFORM_AC3 == 1) #define MUL(a, b) (((a) * (b)) >> 16) static void TransformAC3(const int16_t* in, uint8_t* dst) { static const int kC1 = 20091 + (1 << 16); @@ -248,7 +250,7 @@ static void TransformAC3(const int16_t* in, uint8_t* dst) { _mm_subs_epu8((p), (q))) // Shift each byte of "x" by 3 bits while preserving by the sign bit. -static WEBP_INLINE void SignedShift8b(__m128i* const x) { +static WEBP_INLINE void SignedShift8b_SSE2(__m128i* const x) { const __m128i zero = _mm_setzero_si128(); const __m128i lo_0 = _mm_unpacklo_epi8(zero, *x); const __m128i hi_0 = _mm_unpackhi_epi8(zero, *x); @@ -258,8 +260,8 @@ static WEBP_INLINE void SignedShift8b(__m128i* const x) { } #define FLIP_SIGN_BIT2(a, b) { \ - a = _mm_xor_si128(a, sign_bit); \ - b = _mm_xor_si128(b, sign_bit); \ + (a) = _mm_xor_si128(a, sign_bit); \ + (b) = _mm_xor_si128(b, sign_bit); \ } #define FLIP_SIGN_BIT4(a, b, c, d) { \ @@ -268,11 +270,11 @@ static WEBP_INLINE void SignedShift8b(__m128i* const x) { } // input/output is uint8_t -static WEBP_INLINE void GetNotHEV(const __m128i* const p1, - const __m128i* const p0, - const __m128i* const q0, - const __m128i* const q1, - int hev_thresh, __m128i* const not_hev) { +static WEBP_INLINE void GetNotHEV_SSE2(const __m128i* const p1, + const __m128i* const p0, + const __m128i* const q0, + const __m128i* const q1, + int hev_thresh, __m128i* const not_hev) { const __m128i zero = _mm_setzero_si128(); const __m128i t_1 = MM_ABS(*p1, *p0); const __m128i t_2 = MM_ABS(*q1, *q0); @@ -285,11 +287,11 @@ static WEBP_INLINE void GetNotHEV(const __m128i* const p1, } // input pixels are int8_t -static WEBP_INLINE void GetBaseDelta(const __m128i* const p1, - const __m128i* const p0, - const __m128i* const q0, - const __m128i* const q1, - __m128i* const delta) { +static WEBP_INLINE void GetBaseDelta_SSE2(const __m128i* const p1, + const __m128i* const p0, + const __m128i* const q0, + const __m128i* const q1, + __m128i* const delta) { // beware of addition order, for saturation! const __m128i p1_q1 = _mm_subs_epi8(*p1, *q1); // p1 - q1 const __m128i q0_p0 = _mm_subs_epi8(*q0, *p0); // q0 - p0 @@ -300,15 +302,16 @@ static WEBP_INLINE void GetBaseDelta(const __m128i* const p1, } // input and output are int8_t -static WEBP_INLINE void DoSimpleFilter(__m128i* const p0, __m128i* const q0, - const __m128i* const fl) { +static WEBP_INLINE void DoSimpleFilter_SSE2(__m128i* const p0, + __m128i* const q0, + const __m128i* const fl) { const __m128i k3 = _mm_set1_epi8(3); const __m128i k4 = _mm_set1_epi8(4); __m128i v3 = _mm_adds_epi8(*fl, k3); __m128i v4 = _mm_adds_epi8(*fl, k4); - SignedShift8b(&v4); // v4 >> 3 - SignedShift8b(&v3); // v3 >> 3 + SignedShift8b_SSE2(&v4); // v4 >> 3 + SignedShift8b_SSE2(&v3); // v3 >> 3 *q0 = _mm_subs_epi8(*q0, v4); // q0 -= v4 *p0 = _mm_adds_epi8(*p0, v3); // p0 += v3 } @@ -317,27 +320,27 @@ static WEBP_INLINE void DoSimpleFilter(__m128i* const p0, __m128i* const q0, // Update operations: // q = q - delta and p = p + delta; where delta = [(a_hi >> 7), (a_lo >> 7)] // Pixels 'pi' and 'qi' are int8_t on input, uint8_t on output (sign flip). -static WEBP_INLINE void Update2Pixels(__m128i* const pi, __m128i* const qi, - const __m128i* const a0_lo, - const __m128i* const a0_hi) { +static WEBP_INLINE void Update2Pixels_SSE2(__m128i* const pi, __m128i* const qi, + const __m128i* const a0_lo, + const __m128i* const a0_hi) { const __m128i a1_lo = _mm_srai_epi16(*a0_lo, 7); const __m128i a1_hi = _mm_srai_epi16(*a0_hi, 7); const __m128i delta = _mm_packs_epi16(a1_lo, a1_hi); - const __m128i sign_bit = _mm_set1_epi8(0x80); + const __m128i sign_bit = _mm_set1_epi8((char)0x80); *pi = _mm_adds_epi8(*pi, delta); *qi = _mm_subs_epi8(*qi, delta); FLIP_SIGN_BIT2(*pi, *qi); } // input pixels are uint8_t -static WEBP_INLINE void NeedsFilter(const __m128i* const p1, - const __m128i* const p0, - const __m128i* const q0, - const __m128i* const q1, - int thresh, __m128i* const mask) { - const __m128i m_thresh = _mm_set1_epi8(thresh); +static WEBP_INLINE void NeedsFilter_SSE2(const __m128i* const p1, + const __m128i* const p0, + const __m128i* const q0, + const __m128i* const q1, + int thresh, __m128i* const mask) { + const __m128i m_thresh = _mm_set1_epi8((char)thresh); const __m128i t1 = MM_ABS(*p1, *q1); // abs(p1 - q1) - const __m128i kFE = _mm_set1_epi8(0xFE); + const __m128i kFE = _mm_set1_epi8((char)0xFE); const __m128i t2 = _mm_and_si128(t1, kFE); // set lsb of each byte to zero const __m128i t3 = _mm_srli_epi16(t2, 1); // abs(p1 - q1) / 2 @@ -353,30 +356,31 @@ static WEBP_INLINE void NeedsFilter(const __m128i* const p1, // Edge filtering functions // Applies filter on 2 pixels (p0 and q0) -static WEBP_INLINE void DoFilter2(__m128i* const p1, __m128i* const p0, - __m128i* const q0, __m128i* const q1, - int thresh) { +static WEBP_INLINE void DoFilter2_SSE2(__m128i* const p1, __m128i* const p0, + __m128i* const q0, __m128i* const q1, + int thresh) { __m128i a, mask; - const __m128i sign_bit = _mm_set1_epi8(0x80); - // convert p1/q1 to int8_t (for GetBaseDelta) + const __m128i sign_bit = _mm_set1_epi8((char)0x80); + // convert p1/q1 to int8_t (for GetBaseDelta_SSE2) const __m128i p1s = _mm_xor_si128(*p1, sign_bit); const __m128i q1s = _mm_xor_si128(*q1, sign_bit); - NeedsFilter(p1, p0, q0, q1, thresh, &mask); + NeedsFilter_SSE2(p1, p0, q0, q1, thresh, &mask); FLIP_SIGN_BIT2(*p0, *q0); - GetBaseDelta(&p1s, p0, q0, &q1s, &a); + GetBaseDelta_SSE2(&p1s, p0, q0, &q1s, &a); a = _mm_and_si128(a, mask); // mask filter values we don't care about - DoSimpleFilter(p0, q0, &a); + DoSimpleFilter_SSE2(p0, q0, &a); FLIP_SIGN_BIT2(*p0, *q0); } // Applies filter on 4 pixels (p1, p0, q0 and q1) -static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0, - __m128i* const q0, __m128i* const q1, - const __m128i* const mask, int hev_thresh) { +static WEBP_INLINE void DoFilter4_SSE2(__m128i* const p1, __m128i* const p0, + __m128i* const q0, __m128i* const q1, + const __m128i* const mask, + int hev_thresh) { const __m128i zero = _mm_setzero_si128(); - const __m128i sign_bit = _mm_set1_epi8(0x80); + const __m128i sign_bit = _mm_set1_epi8((char)0x80); const __m128i k64 = _mm_set1_epi8(64); const __m128i k3 = _mm_set1_epi8(3); const __m128i k4 = _mm_set1_epi8(4); @@ -384,7 +388,7 @@ static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0, __m128i t1, t2, t3; // compute hev mask - GetNotHEV(p1, p0, q0, q1, hev_thresh, ¬_hev); + GetNotHEV_SSE2(p1, p0, q0, q1, hev_thresh, ¬_hev); // convert to signed values FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1); @@ -399,8 +403,8 @@ static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0, t2 = _mm_adds_epi8(t1, k3); // 3 * (q0 - p0) + hev(p1 - q1) + 3 t3 = _mm_adds_epi8(t1, k4); // 3 * (q0 - p0) + hev(p1 - q1) + 4 - SignedShift8b(&t2); // (3 * (q0 - p0) + hev(p1 - q1) + 3) >> 3 - SignedShift8b(&t3); // (3 * (q0 - p0) + hev(p1 - q1) + 4) >> 3 + SignedShift8b_SSE2(&t2); // (3 * (q0 - p0) + hev(p1 - q1) + 3) >> 3 + SignedShift8b_SSE2(&t3); // (3 * (q0 - p0) + hev(p1 - q1) + 4) >> 3 *p0 = _mm_adds_epi8(*p0, t2); // p0 += t2 *q0 = _mm_subs_epi8(*q0, t3); // q0 -= t3 FLIP_SIGN_BIT2(*p0, *q0); @@ -417,25 +421,26 @@ static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0, } // Applies filter on 6 pixels (p2, p1, p0, q0, q1 and q2) -static WEBP_INLINE void DoFilter6(__m128i* const p2, __m128i* const p1, - __m128i* const p0, __m128i* const q0, - __m128i* const q1, __m128i* const q2, - const __m128i* const mask, int hev_thresh) { +static WEBP_INLINE void DoFilter6_SSE2(__m128i* const p2, __m128i* const p1, + __m128i* const p0, __m128i* const q0, + __m128i* const q1, __m128i* const q2, + const __m128i* const mask, + int hev_thresh) { const __m128i zero = _mm_setzero_si128(); - const __m128i sign_bit = _mm_set1_epi8(0x80); + const __m128i sign_bit = _mm_set1_epi8((char)0x80); __m128i a, not_hev; // compute hev mask - GetNotHEV(p1, p0, q0, q1, hev_thresh, ¬_hev); + GetNotHEV_SSE2(p1, p0, q0, q1, hev_thresh, ¬_hev); FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1); FLIP_SIGN_BIT2(*p2, *q2); - GetBaseDelta(p1, p0, q0, q1, &a); + GetBaseDelta_SSE2(p1, p0, q0, q1, &a); { // do simple filter on pixels with hev const __m128i m = _mm_andnot_si128(not_hev, *mask); const __m128i f = _mm_and_si128(a, m); - DoSimpleFilter(p0, q0, &f); + DoSimpleFilter_SSE2(p0, q0, &f); } { // do strong filter on pixels with not hev @@ -460,15 +465,15 @@ static WEBP_INLINE void DoFilter6(__m128i* const p2, __m128i* const p1, const __m128i a0_lo = _mm_add_epi16(a1_lo, f9_lo); // Filter * 27 + 63 const __m128i a0_hi = _mm_add_epi16(a1_hi, f9_hi); // Filter * 27 + 63 - Update2Pixels(p2, q2, &a2_lo, &a2_hi); - Update2Pixels(p1, q1, &a1_lo, &a1_hi); - Update2Pixels(p0, q0, &a0_lo, &a0_hi); + Update2Pixels_SSE2(p2, q2, &a2_lo, &a2_hi); + Update2Pixels_SSE2(p1, q1, &a1_lo, &a1_hi); + Update2Pixels_SSE2(p0, q0, &a0_lo, &a0_hi); } } // reads 8 rows across a vertical edge. -static WEBP_INLINE void Load8x4(const uint8_t* const b, int stride, - __m128i* const p, __m128i* const q) { +static WEBP_INLINE void Load8x4_SSE2(const uint8_t* const b, int stride, + __m128i* const p, __m128i* const q) { // A0 = 63 62 61 60 23 22 21 20 43 42 41 40 03 02 01 00 // A1 = 73 72 71 70 33 32 31 30 53 52 51 50 13 12 11 10 const __m128i A0 = _mm_set_epi32( @@ -494,11 +499,11 @@ static WEBP_INLINE void Load8x4(const uint8_t* const b, int stride, *q = _mm_unpackhi_epi32(C0, C1); } -static WEBP_INLINE void Load16x4(const uint8_t* const r0, - const uint8_t* const r8, - int stride, - __m128i* const p1, __m128i* const p0, - __m128i* const q0, __m128i* const q1) { +static WEBP_INLINE void Load16x4_SSE2(const uint8_t* const r0, + const uint8_t* const r8, + int stride, + __m128i* const p1, __m128i* const p0, + __m128i* const q0, __m128i* const q1) { // Assume the pixels around the edge (|) are numbered as follows // 00 01 | 02 03 // 10 11 | 12 13 @@ -514,8 +519,8 @@ static WEBP_INLINE void Load16x4(const uint8_t* const r0, // q0 = 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02 // p0 = f1 e1 d1 c1 b1 a1 91 81 f0 e0 d0 c0 b0 a0 90 80 // q1 = f3 e3 d3 c3 b3 a3 93 83 f2 e2 d2 c2 b2 a2 92 82 - Load8x4(r0, stride, p1, q0); - Load8x4(r8, stride, p0, q1); + Load8x4_SSE2(r0, stride, p1, q0); + Load8x4_SSE2(r8, stride, p0, q1); { // p1 = f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00 @@ -531,7 +536,8 @@ static WEBP_INLINE void Load16x4(const uint8_t* const r0, } } -static WEBP_INLINE void Store4x4(__m128i* const x, uint8_t* dst, int stride) { +static WEBP_INLINE void Store4x4_SSE2(__m128i* const x, + uint8_t* dst, int stride) { int i; for (i = 0; i < 4; ++i, dst += stride) { WebPUint32ToMem(dst, _mm_cvtsi128_si32(*x)); @@ -540,12 +546,12 @@ static WEBP_INLINE void Store4x4(__m128i* const x, uint8_t* dst, int stride) { } // Transpose back and store -static WEBP_INLINE void Store16x4(const __m128i* const p1, - const __m128i* const p0, - const __m128i* const q0, - const __m128i* const q1, - uint8_t* r0, uint8_t* r8, - int stride) { +static WEBP_INLINE void Store16x4_SSE2(const __m128i* const p1, + const __m128i* const p0, + const __m128i* const q0, + const __m128i* const q1, + uint8_t* r0, uint8_t* r8, + int stride) { __m128i t1, p1_s, p0_s, q0_s, q1_s; // p0 = 71 70 61 60 51 50 41 40 31 30 21 20 11 10 01 00 @@ -572,55 +578,55 @@ static WEBP_INLINE void Store16x4(const __m128i* const p1, p1_s = _mm_unpacklo_epi16(t1, q1_s); q1_s = _mm_unpackhi_epi16(t1, q1_s); - Store4x4(&p0_s, r0, stride); + Store4x4_SSE2(&p0_s, r0, stride); r0 += 4 * stride; - Store4x4(&q0_s, r0, stride); + Store4x4_SSE2(&q0_s, r0, stride); - Store4x4(&p1_s, r8, stride); + Store4x4_SSE2(&p1_s, r8, stride); r8 += 4 * stride; - Store4x4(&q1_s, r8, stride); + Store4x4_SSE2(&q1_s, r8, stride); } //------------------------------------------------------------------------------ // Simple In-loop filtering (Paragraph 15.2) -static void SimpleVFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleVFilter16_SSE2(uint8_t* p, int stride, int thresh) { // Load __m128i p1 = _mm_loadu_si128((__m128i*)&p[-2 * stride]); __m128i p0 = _mm_loadu_si128((__m128i*)&p[-stride]); __m128i q0 = _mm_loadu_si128((__m128i*)&p[0]); __m128i q1 = _mm_loadu_si128((__m128i*)&p[stride]); - DoFilter2(&p1, &p0, &q0, &q1, thresh); + DoFilter2_SSE2(&p1, &p0, &q0, &q1, thresh); // Store _mm_storeu_si128((__m128i*)&p[-stride], p0); _mm_storeu_si128((__m128i*)&p[0], q0); } -static void SimpleHFilter16(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16_SSE2(uint8_t* p, int stride, int thresh) { __m128i p1, p0, q0, q1; p -= 2; // beginning of p1 - Load16x4(p, p + 8 * stride, stride, &p1, &p0, &q0, &q1); - DoFilter2(&p1, &p0, &q0, &q1, thresh); - Store16x4(&p1, &p0, &q0, &q1, p, p + 8 * stride, stride); + Load16x4_SSE2(p, p + 8 * stride, stride, &p1, &p0, &q0, &q1); + DoFilter2_SSE2(&p1, &p0, &q0, &q1, thresh); + Store16x4_SSE2(&p1, &p0, &q0, &q1, p, p + 8 * stride, stride); } -static void SimpleVFilter16i(uint8_t* p, int stride, int thresh) { +static void SimpleVFilter16i_SSE2(uint8_t* p, int stride, int thresh) { int k; for (k = 3; k > 0; --k) { p += 4 * stride; - SimpleVFilter16(p, stride, thresh); + SimpleVFilter16_SSE2(p, stride, thresh); } } -static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) { +static void SimpleHFilter16i_SSE2(uint8_t* p, int stride, int thresh) { int k; for (k = 3; k > 0; --k) { p += 4; - SimpleHFilter16(p, stride, thresh); + SimpleHFilter16_SSE2(p, stride, thresh); } } @@ -628,60 +634,60 @@ static void SimpleHFilter16i(uint8_t* p, int stride, int thresh) { // Complex In-loop filtering (Paragraph 15.3) #define MAX_DIFF1(p3, p2, p1, p0, m) do { \ - m = MM_ABS(p1, p0); \ - m = _mm_max_epu8(m, MM_ABS(p3, p2)); \ - m = _mm_max_epu8(m, MM_ABS(p2, p1)); \ + (m) = MM_ABS(p1, p0); \ + (m) = _mm_max_epu8(m, MM_ABS(p3, p2)); \ + (m) = _mm_max_epu8(m, MM_ABS(p2, p1)); \ } while (0) #define MAX_DIFF2(p3, p2, p1, p0, m) do { \ - m = _mm_max_epu8(m, MM_ABS(p1, p0)); \ - m = _mm_max_epu8(m, MM_ABS(p3, p2)); \ - m = _mm_max_epu8(m, MM_ABS(p2, p1)); \ + (m) = _mm_max_epu8(m, MM_ABS(p1, p0)); \ + (m) = _mm_max_epu8(m, MM_ABS(p3, p2)); \ + (m) = _mm_max_epu8(m, MM_ABS(p2, p1)); \ } while (0) #define LOAD_H_EDGES4(p, stride, e1, e2, e3, e4) { \ - e1 = _mm_loadu_si128((__m128i*)&(p)[0 * stride]); \ - e2 = _mm_loadu_si128((__m128i*)&(p)[1 * stride]); \ - e3 = _mm_loadu_si128((__m128i*)&(p)[2 * stride]); \ - e4 = _mm_loadu_si128((__m128i*)&(p)[3 * stride]); \ + (e1) = _mm_loadu_si128((__m128i*)&(p)[0 * (stride)]); \ + (e2) = _mm_loadu_si128((__m128i*)&(p)[1 * (stride)]); \ + (e3) = _mm_loadu_si128((__m128i*)&(p)[2 * (stride)]); \ + (e4) = _mm_loadu_si128((__m128i*)&(p)[3 * (stride)]); \ } #define LOADUV_H_EDGE(p, u, v, stride) do { \ const __m128i U = _mm_loadl_epi64((__m128i*)&(u)[(stride)]); \ const __m128i V = _mm_loadl_epi64((__m128i*)&(v)[(stride)]); \ - p = _mm_unpacklo_epi64(U, V); \ + (p) = _mm_unpacklo_epi64(U, V); \ } while (0) #define LOADUV_H_EDGES4(u, v, stride, e1, e2, e3, e4) { \ - LOADUV_H_EDGE(e1, u, v, 0 * stride); \ - LOADUV_H_EDGE(e2, u, v, 1 * stride); \ - LOADUV_H_EDGE(e3, u, v, 2 * stride); \ - LOADUV_H_EDGE(e4, u, v, 3 * stride); \ + LOADUV_H_EDGE(e1, u, v, 0 * (stride)); \ + LOADUV_H_EDGE(e2, u, v, 1 * (stride)); \ + LOADUV_H_EDGE(e3, u, v, 2 * (stride)); \ + LOADUV_H_EDGE(e4, u, v, 3 * (stride)); \ } #define STOREUV(p, u, v, stride) { \ - _mm_storel_epi64((__m128i*)&u[(stride)], p); \ - p = _mm_srli_si128(p, 8); \ - _mm_storel_epi64((__m128i*)&v[(stride)], p); \ + _mm_storel_epi64((__m128i*)&(u)[(stride)], p); \ + (p) = _mm_srli_si128(p, 8); \ + _mm_storel_epi64((__m128i*)&(v)[(stride)], p); \ } -static WEBP_INLINE void ComplexMask(const __m128i* const p1, - const __m128i* const p0, - const __m128i* const q0, - const __m128i* const q1, - int thresh, int ithresh, - __m128i* const mask) { +static WEBP_INLINE void ComplexMask_SSE2(const __m128i* const p1, + const __m128i* const p0, + const __m128i* const q0, + const __m128i* const q1, + int thresh, int ithresh, + __m128i* const mask) { const __m128i it = _mm_set1_epi8(ithresh); const __m128i diff = _mm_subs_epu8(*mask, it); const __m128i thresh_mask = _mm_cmpeq_epi8(diff, _mm_setzero_si128()); __m128i filter_mask; - NeedsFilter(p1, p0, q0, q1, thresh, &filter_mask); + NeedsFilter_SSE2(p1, p0, q0, q1, thresh, &filter_mask); *mask = _mm_and_si128(thresh_mask, filter_mask); } // on macroblock edges -static void VFilter16(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter16_SSE2(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { __m128i t1; __m128i mask; __m128i p2, p1, p0, q0, q1, q2; @@ -694,8 +700,8 @@ static void VFilter16(uint8_t* p, int stride, LOAD_H_EDGES4(p, stride, q0, q1, q2, t1); MAX_DIFF2(t1, q2, q1, q0, mask); - ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); - DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); + DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); // Store _mm_storeu_si128((__m128i*)&p[-3 * stride], p2); @@ -706,28 +712,28 @@ static void VFilter16(uint8_t* p, int stride, _mm_storeu_si128((__m128i*)&p[+2 * stride], q2); } -static void HFilter16(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter16_SSE2(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i p3, p2, p1, p0, q0, q1, q2, q3; uint8_t* const b = p - 4; - Load16x4(b, b + 8 * stride, stride, &p3, &p2, &p1, &p0); // p3, p2, p1, p0 + Load16x4_SSE2(b, b + 8 * stride, stride, &p3, &p2, &p1, &p0); MAX_DIFF1(p3, p2, p1, p0, mask); - Load16x4(p, p + 8 * stride, stride, &q0, &q1, &q2, &q3); // q0, q1, q2, q3 + Load16x4_SSE2(p, p + 8 * stride, stride, &q0, &q1, &q2, &q3); MAX_DIFF2(q3, q2, q1, q0, mask); - ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); - DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); + DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); - Store16x4(&p3, &p2, &p1, &p0, b, b + 8 * stride, stride); - Store16x4(&q0, &q1, &q2, &q3, p, p + 8 * stride, stride); + Store16x4_SSE2(&p3, &p2, &p1, &p0, b, b + 8 * stride, stride); + Store16x4_SSE2(&q0, &q1, &q2, &q3, p, p + 8 * stride, stride); } // on three inner edges -static void VFilter16i(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter16i_SSE2(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { int k; __m128i p3, p2, p1, p0; // loop invariants @@ -744,8 +750,8 @@ static void VFilter16i(uint8_t* p, int stride, // p3 and p2 are not just temporary variables here: they will be // re-used for next span. And q2/q3 will become p1/p0 accordingly. - ComplexMask(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); - DoFilter4(&p1, &p0, &p3, &p2, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); + DoFilter4_SSE2(&p1, &p0, &p3, &p2, &mask, hev_thresh); // Store _mm_storeu_si128((__m128i*)&b[0 * stride], p1); @@ -759,12 +765,12 @@ static void VFilter16i(uint8_t* p, int stride, } } -static void HFilter16i(uint8_t* p, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter16i_SSE2(uint8_t* p, int stride, + int thresh, int ithresh, int hev_thresh) { int k; __m128i p3, p2, p1, p0; // loop invariants - Load16x4(p, p + 8 * stride, stride, &p3, &p2, &p1, &p0); // prologue + Load16x4_SSE2(p, p + 8 * stride, stride, &p3, &p2, &p1, &p0); // prologue for (k = 3; k > 0; --k) { __m128i mask, tmp1, tmp2; @@ -773,13 +779,13 @@ static void HFilter16i(uint8_t* p, int stride, p += 4; // beginning of q0 (and next span) MAX_DIFF1(p3, p2, p1, p0, mask); // compute partial mask - Load16x4(p, p + 8 * stride, stride, &p3, &p2, &tmp1, &tmp2); + Load16x4_SSE2(p, p + 8 * stride, stride, &p3, &p2, &tmp1, &tmp2); MAX_DIFF2(p3, p2, tmp1, tmp2, mask); - ComplexMask(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); - DoFilter4(&p1, &p0, &p3, &p2, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); + DoFilter4_SSE2(&p1, &p0, &p3, &p2, &mask, hev_thresh); - Store16x4(&p1, &p0, &p3, &p2, b, b + 8 * stride, stride); + Store16x4_SSE2(&p1, &p0, &p3, &p2, b, b + 8 * stride, stride); // rotate samples p1 = tmp1; @@ -788,8 +794,8 @@ static void HFilter16i(uint8_t* p, int stride, } // 8-pixels wide variant, for chroma filtering -static void VFilter8(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter8_SSE2(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i t1, p2, p1, p0, q0, q1, q2; @@ -801,8 +807,8 @@ static void VFilter8(uint8_t* u, uint8_t* v, int stride, LOADUV_H_EDGES4(u, v, stride, q0, q1, q2, t1); MAX_DIFF2(t1, q2, q1, q0, mask); - ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); - DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); + DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); // Store STOREUV(p2, u, v, -3 * stride); @@ -813,28 +819,28 @@ static void VFilter8(uint8_t* u, uint8_t* v, int stride, STOREUV(q2, u, v, 2 * stride); } -static void HFilter8(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter8_SSE2(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i p3, p2, p1, p0, q0, q1, q2, q3; uint8_t* const tu = u - 4; uint8_t* const tv = v - 4; - Load16x4(tu, tv, stride, &p3, &p2, &p1, &p0); // p3, p2, p1, p0 + Load16x4_SSE2(tu, tv, stride, &p3, &p2, &p1, &p0); MAX_DIFF1(p3, p2, p1, p0, mask); - Load16x4(u, v, stride, &q0, &q1, &q2, &q3); // q0, q1, q2, q3 + Load16x4_SSE2(u, v, stride, &q0, &q1, &q2, &q3); MAX_DIFF2(q3, q2, q1, q0, mask); - ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); - DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); + DoFilter6_SSE2(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); - Store16x4(&p3, &p2, &p1, &p0, tu, tv, stride); - Store16x4(&q0, &q1, &q2, &q3, u, v, stride); + Store16x4_SSE2(&p3, &p2, &p1, &p0, tu, tv, stride); + Store16x4_SSE2(&q0, &q1, &q2, &q3, u, v, stride); } -static void VFilter8i(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void VFilter8i_SSE2(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i t1, t2, p1, p0, q0, q1; @@ -849,8 +855,8 @@ static void VFilter8i(uint8_t* u, uint8_t* v, int stride, LOADUV_H_EDGES4(u, v, stride, q0, q1, t1, t2); MAX_DIFF2(t2, t1, q1, q0, mask); - ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); - DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); + DoFilter4_SSE2(&p1, &p0, &q0, &q1, &mask, hev_thresh); // Store STOREUV(p1, u, v, -2 * stride); @@ -859,24 +865,24 @@ static void VFilter8i(uint8_t* u, uint8_t* v, int stride, STOREUV(q1, u, v, 1 * stride); } -static void HFilter8i(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_thresh) { +static void HFilter8i_SSE2(uint8_t* u, uint8_t* v, int stride, + int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i t1, t2, p1, p0, q0, q1; - Load16x4(u, v, stride, &t2, &t1, &p1, &p0); // p3, p2, p1, p0 + Load16x4_SSE2(u, v, stride, &t2, &t1, &p1, &p0); // p3, p2, p1, p0 MAX_DIFF1(t2, t1, p1, p0, mask); u += 4; // beginning of q0 v += 4; - Load16x4(u, v, stride, &q0, &q1, &t1, &t2); // q0, q1, q2, q3 + Load16x4_SSE2(u, v, stride, &q0, &q1, &t1, &t2); // q0, q1, q2, q3 MAX_DIFF2(t2, t1, q1, q0, mask); - ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); - DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh); + ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask); + DoFilter4_SSE2(&p1, &p0, &q0, &q1, &mask, hev_thresh); u -= 2; // beginning of p1 v -= 2; - Store16x4(&p1, &p0, &q0, &q1, u, v, stride); + Store16x4_SSE2(&p1, &p0, &q0, &q1, u, v, stride); } //------------------------------------------------------------------------------ @@ -893,7 +899,7 @@ static void HFilter8i(uint8_t* u, uint8_t* v, int stride, // where: AC = (a + b + 1) >> 1, BC = (b + c + 1) >> 1 // and ab = a ^ b, bc = b ^ c, lsb = (AC^BC)&1 -static void VE4(uint8_t* dst) { // vertical +static void VE4_SSE2(uint8_t* dst) { // vertical const __m128i one = _mm_set1_epi8(1); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS - 1)); const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1); @@ -909,7 +915,7 @@ static void VE4(uint8_t* dst) { // vertical } } -static void LD4(uint8_t* dst) { // Down-Left +static void LD4_SSE2(uint8_t* dst) { // Down-Left const __m128i one = _mm_set1_epi8(1); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS)); const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1); @@ -925,7 +931,7 @@ static void LD4(uint8_t* dst) { // Down-Left WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } -static void VR4(uint8_t* dst) { // Vertical-Right +static void VR4_SSE2(uint8_t* dst) { // Vertical-Right const __m128i one = _mm_set1_epi8(1); const int I = dst[-1 + 0 * BPS]; const int J = dst[-1 + 1 * BPS]; @@ -935,7 +941,7 @@ static void VR4(uint8_t* dst) { // Vertical-Right const __m128i ABCD0 = _mm_srli_si128(XABCD, 1); const __m128i abcd = _mm_avg_epu8(XABCD, ABCD0); const __m128i _XABCD = _mm_slli_si128(XABCD, 1); - const __m128i IXABCD = _mm_insert_epi16(_XABCD, I | (X << 8), 0); + const __m128i IXABCD = _mm_insert_epi16(_XABCD, (short)(I | (X << 8)), 0); const __m128i avg1 = _mm_avg_epu8(IXABCD, ABCD0); const __m128i lsb = _mm_and_si128(_mm_xor_si128(IXABCD, ABCD0), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); @@ -950,7 +956,7 @@ static void VR4(uint8_t* dst) { // Vertical-Right DST(0, 3) = AVG3(K, J, I); } -static void VL4(uint8_t* dst) { // Vertical-Left +static void VL4_SSE2(uint8_t* dst) { // Vertical-Left const __m128i one = _mm_set1_epi8(1); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(dst - BPS)); const __m128i BCDEFGH_ = _mm_srli_si128(ABCDEFGH, 1); @@ -975,7 +981,7 @@ static void VL4(uint8_t* dst) { // Vertical-Left DST(3, 3) = (extra_out >> 8) & 0xff; } -static void RD4(uint8_t* dst) { // Down-right +static void RD4_SSE2(uint8_t* dst) { // Down-right const __m128i one = _mm_set1_epi8(1); const __m128i XABCD = _mm_loadl_epi64((__m128i*)(dst - BPS - 1)); const __m128i ____XABCD = _mm_slli_si128(XABCD, 4); @@ -1004,7 +1010,7 @@ static void RD4(uint8_t* dst) { // Down-right //------------------------------------------------------------------------------ // Luma 16x16 -static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { +static WEBP_INLINE void TrueMotion_SSE2(uint8_t* dst, int size) { const uint8_t* top = dst - BPS; const __m128i zero = _mm_setzero_si128(); int y; @@ -1041,11 +1047,11 @@ static WEBP_INLINE void TrueMotion(uint8_t* dst, int size) { } } -static void TM4(uint8_t* dst) { TrueMotion(dst, 4); } -static void TM8uv(uint8_t* dst) { TrueMotion(dst, 8); } -static void TM16(uint8_t* dst) { TrueMotion(dst, 16); } +static void TM4_SSE2(uint8_t* dst) { TrueMotion_SSE2(dst, 4); } +static void TM8uv_SSE2(uint8_t* dst) { TrueMotion_SSE2(dst, 8); } +static void TM16_SSE2(uint8_t* dst) { TrueMotion_SSE2(dst, 16); } -static void VE16(uint8_t* dst) { +static void VE16_SSE2(uint8_t* dst) { const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS)); int j; for (j = 0; j < 16; ++j) { @@ -1053,7 +1059,7 @@ static void VE16(uint8_t* dst) { } } -static void HE16(uint8_t* dst) { // horizontal +static void HE16_SSE2(uint8_t* dst) { // horizontal int j; for (j = 16; j > 0; --j) { const __m128i values = _mm_set1_epi8(dst[-1]); @@ -1062,7 +1068,7 @@ static void HE16(uint8_t* dst) { // horizontal } } -static WEBP_INLINE void Put16(uint8_t v, uint8_t* dst) { +static WEBP_INLINE void Put16_SSE2(uint8_t v, uint8_t* dst) { int j; const __m128i values = _mm_set1_epi8(v); for (j = 0; j < 16; ++j) { @@ -1070,7 +1076,7 @@ static WEBP_INLINE void Put16(uint8_t v, uint8_t* dst) { } } -static void DC16(uint8_t* dst) { // DC +static void DC16_SSE2(uint8_t* dst) { // DC const __m128i zero = _mm_setzero_si128(); const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS)); const __m128i sad8x2 = _mm_sad_epu8(top, zero); @@ -1083,37 +1089,37 @@ static void DC16(uint8_t* dst) { // DC } { const int DC = _mm_cvtsi128_si32(sum) + left + 16; - Put16(DC >> 5, dst); + Put16_SSE2(DC >> 5, dst); } } -static void DC16NoTop(uint8_t* dst) { // DC with top samples not available +static void DC16NoTop_SSE2(uint8_t* dst) { // DC with top samples unavailable int DC = 8; int j; for (j = 0; j < 16; ++j) { DC += dst[-1 + j * BPS]; } - Put16(DC >> 4, dst); + Put16_SSE2(DC >> 4, dst); } -static void DC16NoLeft(uint8_t* dst) { // DC with left samples not available +static void DC16NoLeft_SSE2(uint8_t* dst) { // DC with left samples unavailable const __m128i zero = _mm_setzero_si128(); const __m128i top = _mm_loadu_si128((const __m128i*)(dst - BPS)); const __m128i sad8x2 = _mm_sad_epu8(top, zero); // sum the two sads: sad8x2[0:1] + sad8x2[8:9] const __m128i sum = _mm_add_epi16(sad8x2, _mm_shuffle_epi32(sad8x2, 2)); const int DC = _mm_cvtsi128_si32(sum) + 8; - Put16(DC >> 4, dst); + Put16_SSE2(DC >> 4, dst); } -static void DC16NoTopLeft(uint8_t* dst) { // DC with no top and left samples - Put16(0x80, dst); +static void DC16NoTopLeft_SSE2(uint8_t* dst) { // DC with no top & left samples + Put16_SSE2(0x80, dst); } //------------------------------------------------------------------------------ // Chroma -static void VE8uv(uint8_t* dst) { // vertical +static void VE8uv_SSE2(uint8_t* dst) { // vertical int j; const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS)); for (j = 0; j < 8; ++j) { @@ -1121,17 +1127,8 @@ static void VE8uv(uint8_t* dst) { // vertical } } -static void HE8uv(uint8_t* dst) { // horizontal - int j; - for (j = 0; j < 8; ++j) { - const __m128i values = _mm_set1_epi8(dst[-1]); - _mm_storel_epi64((__m128i*)dst, values); - dst += BPS; - } -} - // helper for chroma-DC predictions -static WEBP_INLINE void Put8x8uv(uint8_t v, uint8_t* dst) { +static WEBP_INLINE void Put8x8uv_SSE2(uint8_t v, uint8_t* dst) { int j; const __m128i values = _mm_set1_epi8(v); for (j = 0; j < 8; ++j) { @@ -1139,7 +1136,7 @@ static WEBP_INLINE void Put8x8uv(uint8_t v, uint8_t* dst) { } } -static void DC8uv(uint8_t* dst) { // DC +static void DC8uv_SSE2(uint8_t* dst) { // DC const __m128i zero = _mm_setzero_si128(); const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS)); const __m128i sum = _mm_sad_epu8(top, zero); @@ -1150,29 +1147,29 @@ static void DC8uv(uint8_t* dst) { // DC } { const int DC = _mm_cvtsi128_si32(sum) + left + 8; - Put8x8uv(DC >> 4, dst); + Put8x8uv_SSE2(DC >> 4, dst); } } -static void DC8uvNoLeft(uint8_t* dst) { // DC with no left samples +static void DC8uvNoLeft_SSE2(uint8_t* dst) { // DC with no left samples const __m128i zero = _mm_setzero_si128(); const __m128i top = _mm_loadl_epi64((const __m128i*)(dst - BPS)); const __m128i sum = _mm_sad_epu8(top, zero); const int DC = _mm_cvtsi128_si32(sum) + 4; - Put8x8uv(DC >> 3, dst); + Put8x8uv_SSE2(DC >> 3, dst); } -static void DC8uvNoTop(uint8_t* dst) { // DC with no top samples +static void DC8uvNoTop_SSE2(uint8_t* dst) { // DC with no top samples int dc0 = 4; int i; for (i = 0; i < 8; ++i) { dc0 += dst[-1 + i * BPS]; } - Put8x8uv(dc0 >> 3, dst); + Put8x8uv_SSE2(dc0 >> 3, dst); } -static void DC8uvNoTopLeft(uint8_t* dst) { // DC with nothing - Put8x8uv(0x80, dst); +static void DC8uvNoTopLeft_SSE2(uint8_t* dst) { // DC with nothing + Put8x8uv_SSE2(0x80, dst); } //------------------------------------------------------------------------------ @@ -1181,47 +1178,46 @@ static void DC8uvNoTopLeft(uint8_t* dst) { // DC with nothing extern void VP8DspInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitSSE2(void) { - VP8Transform = Transform; -#if defined(USE_TRANSFORM_AC3) - VP8TransformAC3 = TransformAC3; + VP8Transform = Transform_SSE2; +#if (USE_TRANSFORM_AC3 == 1) + VP8TransformAC3 = TransformAC3_SSE2; #endif - VP8VFilter16 = VFilter16; - VP8HFilter16 = HFilter16; - VP8VFilter8 = VFilter8; - VP8HFilter8 = HFilter8; - VP8VFilter16i = VFilter16i; - VP8HFilter16i = HFilter16i; - VP8VFilter8i = VFilter8i; - VP8HFilter8i = HFilter8i; - - VP8SimpleVFilter16 = SimpleVFilter16; - VP8SimpleHFilter16 = SimpleHFilter16; - VP8SimpleVFilter16i = SimpleVFilter16i; - VP8SimpleHFilter16i = SimpleHFilter16i; - - VP8PredLuma4[1] = TM4; - VP8PredLuma4[2] = VE4; - VP8PredLuma4[4] = RD4; - VP8PredLuma4[5] = VR4; - VP8PredLuma4[6] = LD4; - VP8PredLuma4[7] = VL4; - - VP8PredLuma16[0] = DC16; - VP8PredLuma16[1] = TM16; - VP8PredLuma16[2] = VE16; - VP8PredLuma16[3] = HE16; - VP8PredLuma16[4] = DC16NoTop; - VP8PredLuma16[5] = DC16NoLeft; - VP8PredLuma16[6] = DC16NoTopLeft; - - VP8PredChroma8[0] = DC8uv; - VP8PredChroma8[1] = TM8uv; - VP8PredChroma8[2] = VE8uv; - VP8PredChroma8[3] = HE8uv; - VP8PredChroma8[4] = DC8uvNoTop; - VP8PredChroma8[5] = DC8uvNoLeft; - VP8PredChroma8[6] = DC8uvNoTopLeft; + VP8VFilter16 = VFilter16_SSE2; + VP8HFilter16 = HFilter16_SSE2; + VP8VFilter8 = VFilter8_SSE2; + VP8HFilter8 = HFilter8_SSE2; + VP8VFilter16i = VFilter16i_SSE2; + VP8HFilter16i = HFilter16i_SSE2; + VP8VFilter8i = VFilter8i_SSE2; + VP8HFilter8i = HFilter8i_SSE2; + + VP8SimpleVFilter16 = SimpleVFilter16_SSE2; + VP8SimpleHFilter16 = SimpleHFilter16_SSE2; + VP8SimpleVFilter16i = SimpleVFilter16i_SSE2; + VP8SimpleHFilter16i = SimpleHFilter16i_SSE2; + + VP8PredLuma4[1] = TM4_SSE2; + VP8PredLuma4[2] = VE4_SSE2; + VP8PredLuma4[4] = RD4_SSE2; + VP8PredLuma4[5] = VR4_SSE2; + VP8PredLuma4[6] = LD4_SSE2; + VP8PredLuma4[7] = VL4_SSE2; + + VP8PredLuma16[0] = DC16_SSE2; + VP8PredLuma16[1] = TM16_SSE2; + VP8PredLuma16[2] = VE16_SSE2; + VP8PredLuma16[3] = HE16_SSE2; + VP8PredLuma16[4] = DC16NoTop_SSE2; + VP8PredLuma16[5] = DC16NoLeft_SSE2; + VP8PredLuma16[6] = DC16NoTopLeft_SSE2; + + VP8PredChroma8[0] = DC8uv_SSE2; + VP8PredChroma8[1] = TM8uv_SSE2; + VP8PredChroma8[2] = VE8uv_SSE2; + VP8PredChroma8[4] = DC8uvNoTop_SSE2; + VP8PredChroma8[5] = DC8uvNoLeft_SSE2; + VP8PredChroma8[6] = DC8uvNoTopLeft_SSE2; } #else // !WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/dec_sse41.c b/Pods/libwebp/src/dsp/dec_sse41.c index 4e81ec4..8f18506 100644 --- a/Pods/libwebp/src/dsp/dec_sse41.c +++ b/Pods/libwebp/src/dsp/dec_sse41.c @@ -11,15 +11,15 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE41) #include -#include "../dec/vp8i_dec.h" -#include "../utils/utils.h" +#include "src/dec/vp8i_dec.h" +#include "src/utils/utils.h" -static void HE16(uint8_t* dst) { // horizontal +static void HE16_SSE41(uint8_t* dst) { // horizontal int j; const __m128i kShuffle3 = _mm_set1_epi8(3); for (j = 16; j > 0; --j) { @@ -36,7 +36,7 @@ static void HE16(uint8_t* dst) { // horizontal extern void VP8DspInitSSE41(void); WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitSSE41(void) { - VP8PredLuma16[3] = HE16; + VP8PredLuma16[3] = HE16_SSE41; } #else // !WEBP_USE_SSE41 diff --git a/Pods/libwebp/src/dsp/dsp.h b/Pods/libwebp/src/dsp/dsp.h index 813fed4..a784de3 100644 --- a/Pods/libwebp/src/dsp/dsp.h +++ b/Pods/libwebp/src/dsp/dsp.h @@ -15,10 +15,10 @@ #define WEBP_DSP_DSP_H_ #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -38,10 +38,22 @@ extern "C" { # define LOCAL_GCC_PREREQ(maj, min) 0 #endif +#if defined(__clang__) +# define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__) +# define LOCAL_CLANG_PREREQ(maj, min) \ + (LOCAL_CLANG_VERSION >= (((maj) << 8) | (min))) +#else +# define LOCAL_CLANG_VERSION 0 +# define LOCAL_CLANG_PREREQ(maj, min) 0 +#endif + #ifndef __has_builtin # define __has_builtin(x) 0 #endif +// for now, none of the optimizations below are available in emscripten +#if !defined(EMSCRIPTEN) + #if defined(_MSC_VER) && _MSC_VER > 1310 && \ (defined(_M_X64) || defined(_M_IX86)) #define WEBP_MSC_SSE2 // Visual C++ SSE2 targets @@ -64,22 +76,20 @@ extern "C" { #define WEBP_USE_SSE41 #endif -#if defined(__AVX2__) || defined(WEBP_HAVE_AVX2) -#define WEBP_USE_AVX2 -#endif - -#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__) -#define WEBP_ANDROID_NEON // Android targets that might support NEON -#endif - // The intrinsics currently cause compiler errors with arm-nacl-gcc and the // inline assembly would need to be modified for use with Native Client. -#if (defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON) || \ +#if (defined(__ARM_NEON__) || \ defined(__aarch64__) || defined(WEBP_HAVE_NEON)) && \ !defined(__native_client__) #define WEBP_USE_NEON #endif +#if !defined(WEBP_USE_NEON) && defined(__ANDROID__) && \ + defined(__ARM_ARCH_7A__) && defined(HAVE_CPU_FEATURES_H) +#define WEBP_ANDROID_NEON // Android targets that may have NEON +#define WEBP_USE_NEON +#endif + #if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM) #define WEBP_USE_NEON #define WEBP_USE_INTRINSICS @@ -90,7 +100,7 @@ extern "C" { #define WEBP_USE_MIPS32 #if (__mips_isa_rev >= 2) #define WEBP_USE_MIPS32_R2 -#if defined(__mips_dspr2) || (__mips_dsp_rev >= 2) +#if defined(__mips_dspr2) || (defined(__mips_dsp_rev) && __mips_dsp_rev >= 2) #define WEBP_USE_MIPS_DSP_R2 #endif #endif @@ -100,6 +110,24 @@ extern "C" { #define WEBP_USE_MSA #endif +#endif /* EMSCRIPTEN */ + +#ifndef WEBP_DSP_OMIT_C_CODE +#define WEBP_DSP_OMIT_C_CODE 1 +#endif + +#if (defined(__aarch64__) || defined(__ARM_NEON__)) && WEBP_DSP_OMIT_C_CODE +#define WEBP_NEON_OMIT_C_CODE 1 +#else +#define WEBP_NEON_OMIT_C_CODE 0 +#endif + +#if !(LOCAL_CLANG_PREREQ(3,8) || LOCAL_GCC_PREREQ(4,8) || defined(__aarch64__)) +#define WEBP_NEON_WORK_AROUND_GCC 1 +#else +#define WEBP_NEON_WORK_AROUND_GCC 0 +#endif + // This macro prevents thread_sanitizer from reporting known concurrent writes. #define WEBP_TSAN_IGNORE_FUNCTION #if defined(__has_feature) @@ -109,6 +137,42 @@ extern "C" { #endif #endif +#if defined(WEBP_USE_THREAD) && !defined(_WIN32) +#include // NOLINT + +#define WEBP_DSP_INIT(func) do { \ + static volatile VP8CPUInfo func ## _last_cpuinfo_used = \ + (VP8CPUInfo)&func ## _last_cpuinfo_used; \ + static pthread_mutex_t func ## _lock = PTHREAD_MUTEX_INITIALIZER; \ + if (pthread_mutex_lock(&func ## _lock)) break; \ + if (func ## _last_cpuinfo_used != VP8GetCPUInfo) func(); \ + func ## _last_cpuinfo_used = VP8GetCPUInfo; \ + (void)pthread_mutex_unlock(&func ## _lock); \ +} while (0) +#else // !(defined(WEBP_USE_THREAD) && !defined(_WIN32)) +#define WEBP_DSP_INIT(func) do { \ + static volatile VP8CPUInfo func ## _last_cpuinfo_used = \ + (VP8CPUInfo)&func ## _last_cpuinfo_used; \ + if (func ## _last_cpuinfo_used == VP8GetCPUInfo) break; \ + func(); \ + func ## _last_cpuinfo_used = VP8GetCPUInfo; \ +} while (0) +#endif // defined(WEBP_USE_THREAD) && !defined(_WIN32) + +// Defines an Init + helper function that control multiple initialization of +// function pointers / tables. +/* Usage: + WEBP_DSP_INIT_FUNC(InitFunc) { + ...function body + } +*/ +#define WEBP_DSP_INIT_FUNC(name) \ + static WEBP_TSAN_IGNORE_FUNCTION void name ## _body(void); \ + WEBP_TSAN_IGNORE_FUNCTION void name(void) { \ + WEBP_DSP_INIT(name ## _body); \ + } \ + static WEBP_TSAN_IGNORE_FUNCTION void name ## _body(void) + #define WEBP_UBSAN_IGNORE_UNDEF #define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW #if defined(__clang__) && defined(__has_attribute) @@ -129,6 +193,18 @@ extern "C" { #endif #endif +// Regularize the definition of WEBP_SWAP_16BIT_CSP (backward compatibility) +#if !defined(WEBP_SWAP_16BIT_CSP) +#define WEBP_SWAP_16BIT_CSP 0 +#endif + +// some endian fix (e.g.: mips-gcc doesn't define __BIG_ENDIAN__) +#if !defined(WORDS_BIGENDIAN) && \ + (defined(__BIG_ENDIAN__) || defined(_M_PPC) || \ + (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))) +#define WORDS_BIGENDIAN +#endif + typedef enum { kSSE2, kSSE3, @@ -143,7 +219,7 @@ typedef enum { } CPUFeature; // returns true if the CPU supports the feature. typedef int (*VP8CPUInfo)(CPUFeature feature); -WEBP_EXTERN(VP8CPUInfo) VP8GetCPUInfo; +WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo; //------------------------------------------------------------------------------ // Init stub generator @@ -152,7 +228,7 @@ WEBP_EXTERN(VP8CPUInfo) VP8GetCPUInfo; // avoiding a compiler warning. #define WEBP_DSP_INIT_STUB(func) \ extern void func(void); \ - WEBP_TSAN_IGNORE_FUNCTION void func(void) {} + void func(void) {} //------------------------------------------------------------------------------ // Encoding @@ -170,9 +246,9 @@ extern VP8Fdct VP8FTransform2; // performs two transforms at a time extern VP8WHT VP8FTransformWHT; // Predictions // *dst is the destination block. *top and *left can be NULL. -typedef void (*VP8IntraPreds)(uint8_t *dst, const uint8_t* left, +typedef void (*VP8IntraPreds)(uint8_t* dst, const uint8_t* left, const uint8_t* top); -typedef void (*VP8Intra4Preds)(uint8_t *dst, const uint8_t* top); +typedef void (*VP8Intra4Preds)(uint8_t* dst, const uint8_t* top); extern VP8Intra4Preds VP8EncPredLuma4; extern VP8IntraPreds VP8EncPredLuma16; extern VP8IntraPreds VP8EncPredChroma8; @@ -271,6 +347,7 @@ typedef double (*VP8SSIMGetClippedFunc)(const uint8_t* src1, int stride1, int xo, int yo, // center position int W, int H); // plane dimension +#if !defined(WEBP_REDUCE_SIZE) // This version is called with the guarantee that you can load 8 bytes and // 8 rows at offset src1 and src2 typedef double (*VP8SSIMGetFunc)(const uint8_t* src1, int stride1, @@ -278,10 +355,13 @@ typedef double (*VP8SSIMGetFunc)(const uint8_t* src1, int stride1, extern VP8SSIMGetFunc VP8SSIMGet; // unclipped / unchecked extern VP8SSIMGetClippedFunc VP8SSIMGetClipped; // with clipping +#endif +#if !defined(WEBP_DISABLE_STATS) typedef uint32_t (*VP8AccumulateSSEFunc)(const uint8_t* src1, const uint8_t* src2, int len); extern VP8AccumulateSSEFunc VP8AccumulateSSE; +#endif // must be called before using any of the above directly void VP8SSIMDspInit(void); @@ -462,12 +542,12 @@ extern WebPRescalerExportRowFunc WebPRescalerExportRowExpand; extern WebPRescalerExportRowFunc WebPRescalerExportRowShrink; // Plain-C implementation, as fall-back. -extern void WebPRescalerImportRowExpandC(struct WebPRescaler* const wrk, - const uint8_t* src); -extern void WebPRescalerImportRowShrinkC(struct WebPRescaler* const wrk, - const uint8_t* src); -extern void WebPRescalerExportRowExpandC(struct WebPRescaler* const wrk); -extern void WebPRescalerExportRowShrinkC(struct WebPRescaler* const wrk); +extern void WebPRescalerImportRowExpand_C(struct WebPRescaler* const wrk, + const uint8_t* src); +extern void WebPRescalerImportRowShrink_C(struct WebPRescaler* const wrk, + const uint8_t* src); +extern void WebPRescalerExportRowExpand_C(struct WebPRescaler* const wrk); +extern void WebPRescalerExportRowShrink_C(struct WebPRescaler* const wrk); // Main entry calls: extern void WebPRescalerImportRow(struct WebPRescaler* const wrk, @@ -533,24 +613,28 @@ void WebPMultRows(uint8_t* ptr, int stride, int width, int num_rows, int inverse); // Plain-C versions, used as fallback by some implementations. -void WebPMultRowC(uint8_t* const ptr, const uint8_t* const alpha, - int width, int inverse); -void WebPMultARGBRowC(uint32_t* const ptr, int width, int inverse); - -// To be called first before using the above. -void WebPInitAlphaProcessing(void); +void WebPMultRow_C(uint8_t* const ptr, const uint8_t* const alpha, + int width, int inverse); +void WebPMultARGBRow_C(uint32_t* const ptr, int width, int inverse); +#ifdef WORDS_BIGENDIAN // ARGB packing function: a/r/g/b input is rgba or bgra order. -extern void (*VP8PackARGB)(const uint8_t* a, const uint8_t* r, - const uint8_t* g, const uint8_t* b, int len, - uint32_t* out); +extern void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r, + const uint8_t* g, const uint8_t* b, int len, + uint32_t* out); +#endif // RGB packing function. 'step' can be 3 or 4. r/g/b input is rgb or bgr order. -extern void (*VP8PackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b, - int len, int step, uint32_t* out); +extern void (*WebPPackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b, + int len, int step, uint32_t* out); + +// This function returns true if src[i] contains a value different from 0xff. +extern int (*WebPHasAlpha8b)(const uint8_t* src, int length); +// This function returns true if src[4*i] contains a value different from 0xff. +extern int (*WebPHasAlpha32b)(const uint8_t* src, int length); // To be called first before using the above. -void VP8EncDspARGBInit(void); +void WebPInitAlphaProcessing(void); //------------------------------------------------------------------------------ // Filter functions @@ -591,4 +675,4 @@ void VP8FiltersInit(void); } // extern "C" #endif -#endif /* WEBP_DSP_DSP_H_ */ +#endif // WEBP_DSP_DSP_H_ diff --git a/Pods/libwebp/src/dsp/enc.c b/Pods/libwebp/src/dsp/enc.c index f31bc6d..2fddbc4 100644 --- a/Pods/libwebp/src/dsp/enc.c +++ b/Pods/libwebp/src/dsp/enc.c @@ -14,16 +14,18 @@ #include #include // for abs() -#include "./dsp.h" -#include "../enc/vp8i_enc.h" +#include "src/dsp/dsp.h" +#include "src/enc/vp8i_enc.h" static WEBP_INLINE uint8_t clip_8b(int v) { return (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255; } +#if !WEBP_NEON_OMIT_C_CODE static WEBP_INLINE int clip_max(int v, int max) { return (v > max) ? max : v; } +#endif // !WEBP_NEON_OMIT_C_CODE //------------------------------------------------------------------------------ // Compute susceptibility based on DCT-coeff histograms: @@ -56,9 +58,10 @@ void VP8SetHistogramData(const int distribution[MAX_COEFF_THRESH + 1], histo->last_non_zero = last_non_zero; } -static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo) { +#if !WEBP_NEON_OMIT_C_CODE +static void CollectHistogram_C(const uint8_t* ref, const uint8_t* pred, + int start_block, int end_block, + VP8Histogram* const histo) { int j; int distribution[MAX_COEFF_THRESH + 1] = { 0 }; for (j = start_block; j < end_block; ++j) { @@ -76,6 +79,7 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, } VP8SetHistogramData(distribution, histo); } +#endif // !WEBP_NEON_OMIT_C_CODE //------------------------------------------------------------------------------ // run-time tables (~4k) @@ -100,6 +104,8 @@ static WEBP_TSAN_IGNORE_FUNCTION void InitTables(void) { //------------------------------------------------------------------------------ // Transforms (Paragraph 14.4) +#if !WEBP_NEON_OMIT_C_CODE + #define STORE(x, y, v) \ dst[(x) + (y) * BPS] = clip_8b(ref[(x) + (y) * BPS] + ((v) >> 3)) @@ -140,15 +146,15 @@ static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in, } } -static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst, - int do_two) { +static void ITransform_C(const uint8_t* ref, const int16_t* in, uint8_t* dst, + int do_two) { ITransformOne(ref, in, dst); if (do_two) { ITransformOne(ref + 4, in + 16, dst + 4); } } -static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform_C(const uint8_t* src, const uint8_t* ref, int16_t* out) { int i; int tmp[16]; for (i = 0; i < 4; ++i, src += BPS, ref += BPS) { @@ -176,13 +182,16 @@ static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { out[12+ i] = ((a3 * 2217 - a2 * 5352 + 51000) >> 16); } } +#endif // !WEBP_NEON_OMIT_C_CODE -static void FTransform2(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform2_C(const uint8_t* src, const uint8_t* ref, + int16_t* out) { VP8FTransform(src, ref, out); VP8FTransform(src + 4, ref + 4, out + 16); } -static void FTransformWHT(const int16_t* in, int16_t* out) { +#if !WEBP_NEON_OMIT_C_CODE +static void FTransformWHT_C(const int16_t* in, int16_t* out) { // input is 12b signed int32_t tmp[16]; int i; @@ -211,6 +220,7 @@ static void FTransformWHT(const int16_t* in, int16_t* out) { out[12 + i] = b3 >> 1; } } +#endif // !WEBP_NEON_OMIT_C_CODE #undef MUL #undef STORE @@ -303,8 +313,8 @@ static WEBP_INLINE void DCMode(uint8_t* dst, const uint8_t* left, //------------------------------------------------------------------------------ // Chroma 8x8 prediction (paragraph 12.2) -static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static void IntraChromaPreds_C(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { // U block DCMode(C8DC8 + dst, left, top, 8, 8, 4); VerticalPred(C8VE8 + dst, top, 8); @@ -323,8 +333,8 @@ static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, //------------------------------------------------------------------------------ // luma 16x16 prediction (paragraph 12.3) -static void Intra16Preds(uint8_t* dst, - const uint8_t* left, const uint8_t* top) { +static void Intra16Preds_C(uint8_t* dst, + const uint8_t* left, const uint8_t* top) { DCMode(I16DC16 + dst, left, top, 16, 16, 5); VerticalPred(I16VE16 + dst, top, 16); HorizontalPred(I16HE16 + dst, left, 16); @@ -507,7 +517,7 @@ static void TM4(uint8_t* dst, const uint8_t* top) { // Left samples are top[-5 .. -2], top_left is top[-1], top are // located at top[0..3], and top right is top[4..7] -static void Intra4Preds(uint8_t* dst, const uint8_t* top) { +static void Intra4Preds_C(uint8_t* dst, const uint8_t* top) { DC4(I4DC4 + dst, top); TM4(I4TM4 + dst, top); VE4(I4VE4 + dst, top); @@ -523,6 +533,7 @@ static void Intra4Preds(uint8_t* dst, const uint8_t* top) { //------------------------------------------------------------------------------ // Metric +#if !WEBP_NEON_OMIT_C_CODE static WEBP_INLINE int GetSSE(const uint8_t* a, const uint8_t* b, int w, int h) { int count = 0; @@ -538,20 +549,21 @@ static WEBP_INLINE int GetSSE(const uint8_t* a, const uint8_t* b, return count; } -static int SSE16x16(const uint8_t* a, const uint8_t* b) { +static int SSE16x16_C(const uint8_t* a, const uint8_t* b) { return GetSSE(a, b, 16, 16); } -static int SSE16x8(const uint8_t* a, const uint8_t* b) { +static int SSE16x8_C(const uint8_t* a, const uint8_t* b) { return GetSSE(a, b, 16, 8); } -static int SSE8x8(const uint8_t* a, const uint8_t* b) { +static int SSE8x8_C(const uint8_t* a, const uint8_t* b) { return GetSSE(a, b, 8, 8); } -static int SSE4x4(const uint8_t* a, const uint8_t* b) { +static int SSE4x4_C(const uint8_t* a, const uint8_t* b) { return GetSSE(a, b, 4, 4); } +#endif // !WEBP_NEON_OMIT_C_CODE -static void Mean16x4(const uint8_t* ref, uint32_t dc[4]) { +static void Mean16x4_C(const uint8_t* ref, uint32_t dc[4]) { int k, x, y; for (k = 0; k < 4; ++k) { uint32_t avg = 0; @@ -571,6 +583,7 @@ static void Mean16x4(const uint8_t* ref, uint32_t dc[4]) { // We try to match the spectral content (weighted) between source and // reconstructed samples. +#if !WEBP_NEON_OMIT_C_CODE // Hadamard transform // Returns the weighted sum of the absolute value of transformed coefficients. // w[] contains a row-major 4 by 4 symmetric matrix. @@ -608,24 +621,25 @@ static int TTransform(const uint8_t* in, const uint16_t* w) { return sum; } -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto4x4_C(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { const int sum1 = TTransform(a, w); const int sum2 = TTransform(b, w); return abs(sum2 - sum1) >> 5; } -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_C(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_C(a + x + y, b + x + y, w); } } return D; } +#endif // !WEBP_NEON_OMIT_C_CODE //------------------------------------------------------------------------------ // Quantization @@ -636,8 +650,8 @@ static const uint8_t kZigzag[16] = { }; // Simple quantization -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { +static int QuantizeBlock_C(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { int last = -1; int n; for (n = 0; n < 16; ++n) { @@ -662,13 +676,15 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], return (last >= 0); } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC +static int Quantize2Blocks_C(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; nz = VP8EncQuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; nz |= VP8EncQuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; return nz; } +#endif // !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC //------------------------------------------------------------------------------ // Block copy @@ -682,148 +698,14 @@ static WEBP_INLINE void Copy(const uint8_t* src, uint8_t* dst, int w, int h) { } } -static void Copy4x4(const uint8_t* src, uint8_t* dst) { +static void Copy4x4_C(const uint8_t* src, uint8_t* dst) { Copy(src, dst, 4, 4); } -static void Copy16x8(const uint8_t* src, uint8_t* dst) { +static void Copy16x8_C(const uint8_t* src, uint8_t* dst) { Copy(src, dst, 16, 8); } -//------------------------------------------------------------------------------ -// SSIM / PSNR - -// hat-shaped filter. Sum of coefficients is equal to 16. -static const uint32_t kWeight[2 * VP8_SSIM_KERNEL + 1] = { - 1, 2, 3, 4, 3, 2, 1 -}; -static const uint32_t kWeightSum = 16 * 16; // sum{kWeight}^2 - -static WEBP_INLINE double SSIMCalculation( - const VP8DistoStats* const stats, uint32_t N /*num samples*/) { - const uint32_t w2 = N * N; - const uint32_t C1 = 20 * w2; - const uint32_t C2 = 60 * w2; - const uint32_t C3 = 8 * 8 * w2; // 'dark' limit ~= 6 - const uint64_t xmxm = (uint64_t)stats->xm * stats->xm; - const uint64_t ymym = (uint64_t)stats->ym * stats->ym; - if (xmxm + ymym >= C3) { - const int64_t xmym = (int64_t)stats->xm * stats->ym; - const int64_t sxy = (int64_t)stats->xym * N - xmym; // can be negative - const uint64_t sxx = (uint64_t)stats->xxm * N - xmxm; - const uint64_t syy = (uint64_t)stats->yym * N - ymym; - // we descale by 8 to prevent overflow during the fnum/fden multiply. - const uint64_t num_S = (2 * (uint64_t)(sxy < 0 ? 0 : sxy) + C2) >> 8; - const uint64_t den_S = (sxx + syy + C2) >> 8; - const uint64_t fnum = (2 * xmym + C1) * num_S; - const uint64_t fden = (xmxm + ymym + C1) * den_S; - const double r = (double)fnum / fden; - assert(r >= 0. && r <= 1.0); - return r; - } - return 1.; // area is too dark to contribute meaningfully -} - -double VP8SSIMFromStats(const VP8DistoStats* const stats) { - return SSIMCalculation(stats, kWeightSum); -} - -double VP8SSIMFromStatsClipped(const VP8DistoStats* const stats) { - return SSIMCalculation(stats, stats->w); -} - -static double SSIMGetClipped_C(const uint8_t* src1, int stride1, - const uint8_t* src2, int stride2, - int xo, int yo, int W, int H) { - VP8DistoStats stats = { 0, 0, 0, 0, 0, 0 }; - const int ymin = (yo - VP8_SSIM_KERNEL < 0) ? 0 : yo - VP8_SSIM_KERNEL; - const int ymax = (yo + VP8_SSIM_KERNEL > H - 1) ? H - 1 - : yo + VP8_SSIM_KERNEL; - const int xmin = (xo - VP8_SSIM_KERNEL < 0) ? 0 : xo - VP8_SSIM_KERNEL; - const int xmax = (xo + VP8_SSIM_KERNEL > W - 1) ? W - 1 - : xo + VP8_SSIM_KERNEL; - int x, y; - src1 += ymin * stride1; - src2 += ymin * stride2; - for (y = ymin; y <= ymax; ++y, src1 += stride1, src2 += stride2) { - for (x = xmin; x <= xmax; ++x) { - const uint32_t w = kWeight[VP8_SSIM_KERNEL + x - xo] - * kWeight[VP8_SSIM_KERNEL + y - yo]; - const uint32_t s1 = src1[x]; - const uint32_t s2 = src2[x]; - stats.w += w; - stats.xm += w * s1; - stats.ym += w * s2; - stats.xxm += w * s1 * s1; - stats.xym += w * s1 * s2; - stats.yym += w * s2 * s2; - } - } - return VP8SSIMFromStatsClipped(&stats); -} - -static double SSIMGet_C(const uint8_t* src1, int stride1, - const uint8_t* src2, int stride2) { - VP8DistoStats stats = { 0, 0, 0, 0, 0, 0 }; - int x, y; - for (y = 0; y <= 2 * VP8_SSIM_KERNEL; ++y, src1 += stride1, src2 += stride2) { - for (x = 0; x <= 2 * VP8_SSIM_KERNEL; ++x) { - const uint32_t w = kWeight[x] * kWeight[y]; - const uint32_t s1 = src1[x]; - const uint32_t s2 = src2[x]; - stats.xm += w * s1; - stats.ym += w * s2; - stats.xxm += w * s1 * s1; - stats.xym += w * s1 * s2; - stats.yym += w * s2 * s2; - } - } - return VP8SSIMFromStats(&stats); -} - -//------------------------------------------------------------------------------ - -static uint32_t AccumulateSSE(const uint8_t* src1, - const uint8_t* src2, int len) { - int i; - uint32_t sse2 = 0; - assert(len <= 65535); // to ensure that accumulation fits within uint32_t - for (i = 0; i < len; ++i) { - const int32_t diff = src1[i] - src2[i]; - sse2 += diff * diff; - } - return sse2; -} - -//------------------------------------------------------------------------------ - -VP8SSIMGetFunc VP8SSIMGet; -VP8SSIMGetClippedFunc VP8SSIMGetClipped; -VP8AccumulateSSEFunc VP8AccumulateSSE; - -extern void VP8SSIMDspInitSSE2(void); - -static volatile VP8CPUInfo ssim_last_cpuinfo_used = - (VP8CPUInfo)&ssim_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInit(void) { - if (ssim_last_cpuinfo_used == VP8GetCPUInfo) return; - - VP8SSIMGetClipped = SSIMGetClipped_C; - VP8SSIMGet = SSIMGet_C; - - VP8AccumulateSSE = AccumulateSSE; - if (VP8GetCPUInfo != NULL) { -#if defined(WEBP_USE_SSE2) - if (VP8GetCPUInfo(kSSE2)) { - VP8SSIMDspInitSSE2(); - } -#endif - } - - ssim_last_cpuinfo_used = VP8GetCPUInfo; -} - //------------------------------------------------------------------------------ // Initialization @@ -852,42 +734,42 @@ VP8BlockCopy VP8Copy16x8; extern void VP8EncDspInitSSE2(void); extern void VP8EncDspInitSSE41(void); -extern void VP8EncDspInitAVX2(void); extern void VP8EncDspInitNEON(void); extern void VP8EncDspInitMIPS32(void); extern void VP8EncDspInitMIPSdspR2(void); extern void VP8EncDspInitMSA(void); -static volatile VP8CPUInfo enc_last_cpuinfo_used = - (VP8CPUInfo)&enc_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) { - if (enc_last_cpuinfo_used == VP8GetCPUInfo) return; - +WEBP_DSP_INIT_FUNC(VP8EncDspInit) { VP8DspInit(); // common inverse transforms InitTables(); // default C implementations - VP8CollectHistogram = CollectHistogram; - VP8ITransform = ITransform; - VP8FTransform = FTransform; - VP8FTransform2 = FTransform2; - VP8FTransformWHT = FTransformWHT; - VP8EncPredLuma4 = Intra4Preds; - VP8EncPredLuma16 = Intra16Preds; - VP8EncPredChroma8 = IntraChromaPreds; - VP8SSE16x16 = SSE16x16; - VP8SSE8x8 = SSE8x8; - VP8SSE16x8 = SSE16x8; - VP8SSE4x4 = SSE4x4; - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; - VP8Mean16x4 = Mean16x4; - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; - VP8EncQuantizeBlockWHT = QuantizeBlock; - VP8Copy4x4 = Copy4x4; - VP8Copy16x8 = Copy16x8; +#if !WEBP_NEON_OMIT_C_CODE + VP8ITransform = ITransform_C; + VP8FTransform = FTransform_C; + VP8FTransformWHT = FTransformWHT_C; + VP8TDisto4x4 = Disto4x4_C; + VP8TDisto16x16 = Disto16x16_C; + VP8CollectHistogram = CollectHistogram_C; + VP8SSE16x16 = SSE16x16_C; + VP8SSE16x8 = SSE16x8_C; + VP8SSE8x8 = SSE8x8_C; + VP8SSE4x4 = SSE4x4_C; +#endif + +#if !WEBP_NEON_OMIT_C_CODE || WEBP_NEON_WORK_AROUND_GCC + VP8EncQuantizeBlock = QuantizeBlock_C; + VP8EncQuantize2Blocks = Quantize2Blocks_C; +#endif + + VP8FTransform2 = FTransform2_C; + VP8EncPredLuma4 = Intra4Preds_C; + VP8EncPredLuma16 = Intra16Preds_C; + VP8EncPredChroma8 = IntraChromaPreds_C; + VP8Mean16x4 = Mean16x4_C; + VP8EncQuantizeBlockWHT = QuantizeBlock_C; + VP8Copy4x4 = Copy4x4_C; + VP8Copy16x8 = Copy16x8_C; // If defined, use CPUInfo() to overwrite some pointers with faster versions. if (VP8GetCPUInfo != NULL) { @@ -901,16 +783,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) { #endif } #endif -#if defined(WEBP_USE_AVX2) - if (VP8GetCPUInfo(kAVX2)) { - VP8EncDspInitAVX2(); - } -#endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - VP8EncDspInitNEON(); - } -#endif #if defined(WEBP_USE_MIPS32) if (VP8GetCPUInfo(kMIPS32)) { VP8EncDspInitMIPS32(); @@ -927,5 +799,32 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) { } #endif } - enc_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + VP8EncDspInitNEON(); + } +#endif + + assert(VP8ITransform != NULL); + assert(VP8FTransform != NULL); + assert(VP8FTransformWHT != NULL); + assert(VP8TDisto4x4 != NULL); + assert(VP8TDisto16x16 != NULL); + assert(VP8CollectHistogram != NULL); + assert(VP8SSE16x16 != NULL); + assert(VP8SSE16x8 != NULL); + assert(VP8SSE8x8 != NULL); + assert(VP8SSE4x4 != NULL); + assert(VP8EncQuantizeBlock != NULL); + assert(VP8EncQuantize2Blocks != NULL); + assert(VP8FTransform2 != NULL); + assert(VP8EncPredLuma4 != NULL); + assert(VP8EncPredLuma16 != NULL); + assert(VP8EncPredChroma8 != NULL); + assert(VP8Mean16x4 != NULL); + assert(VP8EncQuantizeBlockWHT != NULL); + assert(VP8Copy4x4 != NULL); + assert(VP8Copy16x8 != NULL); } diff --git a/Pods/libwebp/src/dsp/enc_avx2.c b/Pods/libwebp/src/dsp/enc_avx2.c deleted file mode 100644 index 93efb30..0000000 --- a/Pods/libwebp/src/dsp/enc_avx2.c +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the COPYING file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// ----------------------------------------------------------------------------- -// -// AVX2 version of speed-critical encoding functions. - -#include "./dsp.h" - -#if defined(WEBP_USE_AVX2) - -#endif // WEBP_USE_AVX2 - -//------------------------------------------------------------------------------ -// Entry point - -WEBP_DSP_INIT_STUB(VP8EncDspInitAVX2) diff --git a/Pods/libwebp/src/dsp/enc_mips32.c b/Pods/libwebp/src/dsp/enc_mips32.c index 752b14d..618f0fc 100644 --- a/Pods/libwebp/src/dsp/enc_mips32.c +++ b/Pods/libwebp/src/dsp/enc_mips32.c @@ -13,13 +13,13 @@ // Jovan Zelincevic (jovan.zelincevic@imgtec.com) // Slobodan Prijic (slobodan.prijic@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS32) -#include "./mips_macro.h" -#include "../enc/vp8i_enc.h" -#include "../enc/cost_enc.h" +#include "src/dsp/mips_macro.h" +#include "src/enc/vp8i_enc.h" +#include "src/enc/cost_enc.h" static const int kC1 = 20091 + (1 << 16); static const int kC2 = 35468; @@ -113,8 +113,9 @@ static const int kC2 = 35468; "sb %[" #TEMP12 "], 3+" XSTR(BPS) "*" #A "(%[temp16]) \n\t" // Does one or two inverse transforms. -static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in, - uint8_t* dst) { +static WEBP_INLINE void ITransformOne_MIPS32(const uint8_t* ref, + const int16_t* in, + uint8_t* dst) { int temp0, temp1, temp2, temp3, temp4, temp5, temp6; int temp7, temp8, temp9, temp10, temp11, temp12, temp13; int temp14, temp15, temp16, temp17, temp18, temp19, temp20; @@ -144,11 +145,11 @@ static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in, ); } -static void ITransform(const uint8_t* ref, const int16_t* in, - uint8_t* dst, int do_two) { - ITransformOne(ref, in, dst); +static void ITransform_MIPS32(const uint8_t* ref, const int16_t* in, + uint8_t* dst, int do_two) { + ITransformOne_MIPS32(ref, in, dst); if (do_two) { - ITransformOne(ref + 4, in + 16, dst + 4); + ITransformOne_MIPS32(ref + 4, in + 16, dst + 4); } } @@ -187,8 +188,8 @@ static void ITransform(const uint8_t* ref, const int16_t* in, "sh %[temp5], " #J "(%[ppin]) \n\t" \ "sh %[level], " #N "(%[pout]) \n\t" -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { +static int QuantizeBlock_MIPS32(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { int temp0, temp1, temp2, temp3, temp4, temp5; int sign, coeff, level, i; int max_level = MAX_LEVEL; @@ -238,11 +239,11 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], return 0; } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +static int Quantize2Blocks_MIPS32(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; - nz = QuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; - nz |= QuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; + nz = QuantizeBlock_MIPS32(in + 0 * 16, out + 0 * 16, mtx) << 0; + nz |= QuantizeBlock_MIPS32(in + 1 * 16, out + 1 * 16, mtx) << 1; return nz; } @@ -361,8 +362,8 @@ static int Quantize2Blocks(int16_t in[32], int16_t out[32], "msub %[temp6], %[temp0] \n\t" \ "msub %[temp7], %[temp1] \n\t" -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto4x4_MIPS32(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int tmp[32]; int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8; @@ -396,13 +397,13 @@ static int Disto4x4(const uint8_t* const a, const uint8_t* const b, #undef VERTICAL_PASS #undef HORIZONTAL_PASS -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_MIPS32(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_MIPS32(a + x + y, b + x + y, w); } } return D; @@ -478,7 +479,8 @@ static int Disto16x16(const uint8_t* const a, const uint8_t* const b, "sh %[" #TEMP8 "], " #D "(%[temp20]) \n\t" \ "sh %[" #TEMP12 "], " #B "(%[temp20]) \n\t" -static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform_MIPS32(const uint8_t* src, const uint8_t* ref, + int16_t* out) { int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8; int temp9, temp10, temp11, temp12, temp13, temp14, temp15, temp16; int temp17, temp18, temp19, temp20; @@ -539,7 +541,7 @@ static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { GET_SSE_INNER(C, C + 1, C + 2, C + 3) \ GET_SSE_INNER(D, D + 1, D + 2, D + 3) -static int SSE16x16(const uint8_t* a, const uint8_t* b) { +static int SSE16x16_MIPS32(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; @@ -573,7 +575,7 @@ static int SSE16x16(const uint8_t* a, const uint8_t* b) { return count; } -static int SSE16x8(const uint8_t* a, const uint8_t* b) { +static int SSE16x8_MIPS32(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; @@ -599,7 +601,7 @@ static int SSE16x8(const uint8_t* a, const uint8_t* b) { return count; } -static int SSE8x8(const uint8_t* a, const uint8_t* b) { +static int SSE8x8_MIPS32(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; @@ -621,7 +623,7 @@ static int SSE8x8(const uint8_t* a, const uint8_t* b) { return count; } -static int SSE4x4(const uint8_t* a, const uint8_t* b) { +static int SSE4x4_MIPS32(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; @@ -651,17 +653,20 @@ static int SSE4x4(const uint8_t* a, const uint8_t* b) { extern void VP8EncDspInitMIPS32(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitMIPS32(void) { - VP8ITransform = ITransform; - VP8FTransform = FTransform; - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; + VP8ITransform = ITransform_MIPS32; + VP8FTransform = FTransform_MIPS32; + + VP8EncQuantizeBlock = QuantizeBlock_MIPS32; + VP8EncQuantize2Blocks = Quantize2Blocks_MIPS32; + + VP8TDisto4x4 = Disto4x4_MIPS32; + VP8TDisto16x16 = Disto16x16_MIPS32; + #if !defined(WORK_AROUND_GCC) - VP8SSE16x16 = SSE16x16; - VP8SSE8x8 = SSE8x8; - VP8SSE16x8 = SSE16x8; - VP8SSE4x4 = SSE4x4; + VP8SSE16x16 = SSE16x16_MIPS32; + VP8SSE8x8 = SSE8x8_MIPS32; + VP8SSE16x8 = SSE16x8_MIPS32; + VP8SSE4x4 = SSE4x4_MIPS32; #endif } diff --git a/Pods/libwebp/src/dsp/enc_mips_dsp_r2.c b/Pods/libwebp/src/dsp/enc_mips_dsp_r2.c index 6c8c1c6..9ddd895 100644 --- a/Pods/libwebp/src/dsp/enc_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/enc_mips_dsp_r2.c @@ -12,13 +12,13 @@ // Author(s): Darko Laus (darko.laus@imgtec.com) // Mirko Raus (mirko.raus@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "./mips_macro.h" -#include "../enc/cost_enc.h" -#include "../enc/vp8i_enc.h" +#include "src/dsp/mips_macro.h" +#include "src/enc/cost_enc.h" +#include "src/enc/vp8i_enc.h" static const int kC1 = 20091 + (1 << 16); static const int kC2 = 35468; @@ -141,7 +141,8 @@ static const int kC2 = 35468; "sh %[" #TEMP8 "], " #D "(%[temp20]) \n\t" \ "sh %[" #TEMP12 "], " #B "(%[temp20]) \n\t" -static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform_MIPSdspR2(const uint8_t* src, const uint8_t* ref, + int16_t* out) { const int c2217 = 2217; const int c5352 = 5352; int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8; @@ -238,16 +239,16 @@ static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in, ); } -static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst, - int do_two) { +static void ITransform_MIPSdspR2(const uint8_t* ref, const int16_t* in, + uint8_t* dst, int do_two) { ITransformOne(ref, in, dst); if (do_two) { ITransformOne(ref + 4, in + 16, dst + 4); } } -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto4x4_MIPSdspR2(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9; int temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17; @@ -313,13 +314,14 @@ static int Disto4x4(const uint8_t* const a, const uint8_t* const b, return abs(temp3 - temp17) >> 5; } -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_MIPSdspR2(const uint8_t* const a, + const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_MIPSdspR2(a + x + y, b + x + y, w); } } return D; @@ -1011,8 +1013,8 @@ static void HU4(uint8_t* dst, const uint8_t* top) { //------------------------------------------------------------------------------ // Chroma 8x8 prediction (paragraph 12.2) -static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static void IntraChromaPreds_MIPSdspR2(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { // U block DCMode8(C8DC8 + dst, left, top); VerticalPred8(C8VE8 + dst, top); @@ -1031,8 +1033,8 @@ static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, //------------------------------------------------------------------------------ // luma 16x16 prediction (paragraph 12.3) -static void Intra16Preds(uint8_t* dst, - const uint8_t* left, const uint8_t* top) { +static void Intra16Preds_MIPSdspR2(uint8_t* dst, + const uint8_t* left, const uint8_t* top) { DCMode16(I16DC16 + dst, left, top); VerticalPred16(I16VE16 + dst, top); HorizontalPred16(I16HE16 + dst, left); @@ -1041,7 +1043,7 @@ static void Intra16Preds(uint8_t* dst, // Left samples are top[-5 .. -2], top_left is top[-1], top are // located at top[0..3], and top right is top[4..7] -static void Intra4Preds(uint8_t* dst, const uint8_t* top) { +static void Intra4Preds_MIPSdspR2(uint8_t* dst, const uint8_t* top) { DC4(I4DC4 + dst, top); TM4(I4TM4 + dst, top); VE4(I4VE4 + dst, top); @@ -1077,7 +1079,7 @@ static void Intra4Preds(uint8_t* dst, const uint8_t* top) { GET_SSE_INNER(C) \ GET_SSE_INNER(D) -static int SSE16x16(const uint8_t* a, const uint8_t* b) { +static int SSE16x16_MIPSdspR2(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3; __asm__ volatile ( @@ -1107,7 +1109,7 @@ static int SSE16x16(const uint8_t* a, const uint8_t* b) { return count; } -static int SSE16x8(const uint8_t* a, const uint8_t* b) { +static int SSE16x8_MIPSdspR2(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3; __asm__ volatile ( @@ -1129,7 +1131,7 @@ static int SSE16x8(const uint8_t* a, const uint8_t* b) { return count; } -static int SSE8x8(const uint8_t* a, const uint8_t* b) { +static int SSE8x8_MIPSdspR2(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3; __asm__ volatile ( @@ -1147,7 +1149,7 @@ static int SSE8x8(const uint8_t* a, const uint8_t* b) { return count; } -static int SSE4x4(const uint8_t* a, const uint8_t* b) { +static int SSE4x4_MIPSdspR2(const uint8_t* a, const uint8_t* b) { int count; int temp0, temp1, temp2, temp3; __asm__ volatile ( @@ -1270,8 +1272,8 @@ static int SSE4x4(const uint8_t* a, const uint8_t* b) { "usw $0, " #J "(%[ppin]) \n\t" \ "3: \n\t" -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { +static int QuantizeBlock_MIPSdspR2(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { int temp0, temp1, temp2, temp3, temp4, temp5,temp6; int sign, coeff, level; int max_level = MAX_LEVEL; @@ -1311,11 +1313,11 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], return (ret != 0); } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +static int Quantize2Blocks_MIPSdspR2(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; - nz = QuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; - nz |= QuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; + nz = QuantizeBlock_MIPSdspR2(in + 0 * 16, out + 0 * 16, mtx) << 0; + nz |= QuantizeBlock_MIPSdspR2(in + 1 * 16, out + 1 * 16, mtx) << 1; return nz; } @@ -1358,7 +1360,7 @@ static int Quantize2Blocks(int16_t in[32], int16_t out[32], "usw %[" #TEMP4 "], " #C "(%[out]) \n\t" \ "usw %[" #TEMP6 "], " #D "(%[out]) \n\t" -static void FTransformWHT(const int16_t* in, int16_t* out) { +static void FTransformWHT_MIPSdspR2(const int16_t* in, int16_t* out) { int temp0, temp1, temp2, temp3, temp4; int temp5, temp6, temp7, temp8, temp9; @@ -1450,9 +1452,9 @@ static void FTransformWHT(const int16_t* in, int16_t* out) { "addiu %[temp8], %[temp8], 1 \n\t" \ "sw %[temp8], 0(%[temp3]) \n\t" -static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo) { +static void CollectHistogram_MIPSdspR2(const uint8_t* ref, const uint8_t* pred, + int start_block, int end_block, + VP8Histogram* const histo) { int j; int distribution[MAX_COEFF_THRESH + 1] = { 0 }; const int max_coeff = (MAX_COEFF_THRESH << 16) + MAX_COEFF_THRESH; @@ -1484,23 +1486,28 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, extern void VP8EncDspInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitMIPSdspR2(void) { - VP8FTransform = FTransform; - VP8ITransform = ITransform; - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; - VP8EncPredLuma16 = Intra16Preds; - VP8EncPredChroma8 = IntraChromaPreds; - VP8EncPredLuma4 = Intra4Preds; + VP8FTransform = FTransform_MIPSdspR2; + VP8FTransformWHT = FTransformWHT_MIPSdspR2; + VP8ITransform = ITransform_MIPSdspR2; + + VP8TDisto4x4 = Disto4x4_MIPSdspR2; + VP8TDisto16x16 = Disto16x16_MIPSdspR2; + + VP8EncPredLuma16 = Intra16Preds_MIPSdspR2; + VP8EncPredChroma8 = IntraChromaPreds_MIPSdspR2; + VP8EncPredLuma4 = Intra4Preds_MIPSdspR2; + #if !defined(WORK_AROUND_GCC) - VP8SSE16x16 = SSE16x16; - VP8SSE8x8 = SSE8x8; - VP8SSE16x8 = SSE16x8; - VP8SSE4x4 = SSE4x4; + VP8SSE16x16 = SSE16x16_MIPSdspR2; + VP8SSE8x8 = SSE8x8_MIPSdspR2; + VP8SSE16x8 = SSE16x8_MIPSdspR2; + VP8SSE4x4 = SSE4x4_MIPSdspR2; #endif - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; - VP8FTransformWHT = FTransformWHT; - VP8CollectHistogram = CollectHistogram; + + VP8EncQuantizeBlock = QuantizeBlock_MIPSdspR2; + VP8EncQuantize2Blocks = Quantize2Blocks_MIPSdspR2; + + VP8CollectHistogram = CollectHistogram_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/enc_msa.c b/Pods/libwebp/src/dsp/enc_msa.c index 909b46d..6f85add 100644 --- a/Pods/libwebp/src/dsp/enc_msa.c +++ b/Pods/libwebp/src/dsp/enc_msa.c @@ -11,13 +11,13 @@ // // Author: Prashant Patil (prashant.patil@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MSA) #include -#include "./msa_macro.h" -#include "../enc/vp8i_enc.h" +#include "src/dsp/msa_macro.h" +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // Transforms @@ -69,20 +69,21 @@ static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in, ST4x4_UB(res0, res0, 3, 2, 1, 0, dst, BPS); } -static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst, - int do_two) { +static void ITransform_MSA(const uint8_t* ref, const int16_t* in, uint8_t* dst, + int do_two) { ITransformOne(ref, in, dst); if (do_two) { ITransformOne(ref + 4, in + 16, dst + 4); } } -static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform_MSA(const uint8_t* src, const uint8_t* ref, + int16_t* out) { uint64_t out0, out1, out2, out3; uint32_t in0, in1, in2, in3; v4i32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; v8i16 t0, t1, t2, t3; - v16u8 srcl0, srcl1, src0, src1; + v16u8 srcl0, srcl1, src0 = { 0 }, src1 = { 0 }; const v8i16 mask0 = { 0, 4, 8, 12, 1, 5, 9, 13 }; const v8i16 mask1 = { 3, 7, 11, 15, 2, 6, 10, 14 }; const v8i16 mask2 = { 4, 0, 5, 1, 6, 2, 7, 3 }; @@ -130,7 +131,7 @@ static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { SD4(out0, out1, out2, out3, out, 8); } -static void FTransformWHT(const int16_t* in, int16_t* out) { +static void FTransformWHT_MSA(const int16_t* in, int16_t* out) { v8i16 in0 = { 0 }; v8i16 in1 = { 0 }; v8i16 tmp0, tmp1, tmp2, tmp3; @@ -167,10 +168,10 @@ static void FTransformWHT(const int16_t* in, int16_t* out) { ST_SH2(out0, out1, out, 8); } -static int TTransform(const uint8_t* in, const uint16_t* w) { +static int TTransform_MSA(const uint8_t* in, const uint16_t* w) { int sum; uint32_t in0_m, in1_m, in2_m, in3_m; - v16i8 src0; + v16i8 src0 = { 0 }; v8i16 in0, in1, tmp0, tmp1, tmp2, tmp3; v4i32 dst0, dst1; const v16i8 zero = { 0 }; @@ -199,20 +200,20 @@ static int TTransform(const uint8_t* in, const uint16_t* w) { return sum; } -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { - const int sum1 = TTransform(a, w); - const int sum2 = TTransform(b, w); +static int Disto4x4_MSA(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { + const int sum1 = TTransform_MSA(a, w); + const int sum2 = TTransform_MSA(b, w); return abs(sum2 - sum1) >> 5; } -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_MSA(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_MSA(a + x + y, b + x + y, w); } } return D; @@ -221,9 +222,9 @@ static int Disto16x16(const uint8_t* const a, const uint8_t* const b, //------------------------------------------------------------------------------ // Histogram -static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo) { +static void CollectHistogram_MSA(const uint8_t* ref, const uint8_t* pred, + int start_block, int end_block, + VP8Histogram* const histo) { int j; int distribution[MAX_COEFF_THRESH + 1] = { 0 }; for (j = start_block; j < end_block; ++j) { @@ -259,8 +260,9 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, #define AVG2(a, b) (((a) + (b) + 1) >> 1) static WEBP_INLINE void VE4(uint8_t* dst, const uint8_t* top) { // vertical + const v16u8 A1 = { 0 }; const uint64_t val_m = LD(top - 1); - const v16u8 A = (v16u8)__msa_insert_d((v2i64)A, 0, val_m); + const v16u8 A = (v16u8)__msa_insert_d((v2i64)A1, 0, val_m); const v16u8 B = SLDI_UB(A, A, 1); const v16u8 C = SLDI_UB(A, A, 2); const v16u8 AC = __msa_ave_u_b(A, C); @@ -292,8 +294,9 @@ static WEBP_INLINE void DC4(uint8_t* dst, const uint8_t* top) { } static WEBP_INLINE void RD4(uint8_t* dst, const uint8_t* top) { + const v16u8 A2 = { 0 }; const uint64_t val_m = LD(top - 5); - const v16u8 A1 = (v16u8)__msa_insert_d((v2i64)A1, 0, val_m); + const v16u8 A1 = (v16u8)__msa_insert_d((v2i64)A2, 0, val_m); const v16u8 A = (v16u8)__msa_insert_b((v16i8)A1, 8, top[3]); const v16u8 B = SLDI_UB(A, A, 1); const v16u8 C = SLDI_UB(A, A, 2); @@ -311,8 +314,9 @@ static WEBP_INLINE void RD4(uint8_t* dst, const uint8_t* top) { } static WEBP_INLINE void LD4(uint8_t* dst, const uint8_t* top) { + const v16u8 A1 = { 0 }; const uint64_t val_m = LD(top); - const v16u8 A = (v16u8)__msa_insert_d((v2i64)A, 0, val_m); + const v16u8 A = (v16u8)__msa_insert_d((v2i64)A1, 0, val_m); const v16u8 B = SLDI_UB(A, A, 1); const v16u8 C1 = SLDI_UB(A, A, 2); const v16u8 C = (v16u8)__msa_insert_b((v16i8)C1, 6, top[7]); @@ -427,7 +431,7 @@ static WEBP_INLINE void TM4(uint8_t* dst, const uint8_t* top) { #undef AVG3 #undef AVG2 -static void Intra4Preds(uint8_t* dst, const uint8_t* top) { +static void Intra4Preds_MSA(uint8_t* dst, const uint8_t* top) { DC4(I4DC4 + dst, top); TM4(I4TM4 + dst, top); VE4(I4VE4 + dst, top); @@ -544,8 +548,8 @@ static WEBP_INLINE void DCMode16x16(uint8_t* dst, const uint8_t* left, STORE16x16(out, dst); } -static void Intra16Preds(uint8_t* dst, - const uint8_t* left, const uint8_t* top) { +static void Intra16Preds_MSA(uint8_t* dst, + const uint8_t* left, const uint8_t* top) { DCMode16x16(I16DC16 + dst, left, top); VerticalPred16x16(I16VE16 + dst, top); HorizontalPred16x16(I16HE16 + dst, left); @@ -645,7 +649,7 @@ static WEBP_INLINE void TrueMotion8x8(uint8_t* dst, const uint8_t* left, static WEBP_INLINE void DCMode8x8(uint8_t* dst, const uint8_t* left, const uint8_t* top) { uint64_t out; - v16u8 src; + v16u8 src = { 0 }; if (top != NULL && left != NULL) { const uint64_t left_m = LD(left); const uint64_t top_m = LD(top); @@ -666,8 +670,8 @@ static WEBP_INLINE void DCMode8x8(uint8_t* dst, const uint8_t* left, STORE8x8(out, dst); } -static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static void IntraChromaPreds_MSA(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { // U block DCMode8x8(C8DC8 + dst, left, top); VerticalPred8x8(C8VE8 + dst, top); @@ -708,7 +712,7 @@ static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, DPADD_SH2_SW(tmp2, tmp3, tmp2, tmp3, out2, out3); \ } while (0) -static int SSE16x16(const uint8_t* a, const uint8_t* b) { +static int SSE16x16_MSA(const uint8_t* a, const uint8_t* b) { uint32_t sum; v16u8 src0, src1, src2, src3, src4, src5, src6, src7; v16u8 ref0, ref1, ref2, ref3, ref4, ref5, ref6, ref7; @@ -735,7 +739,7 @@ static int SSE16x16(const uint8_t* a, const uint8_t* b) { return sum; } -static int SSE16x8(const uint8_t* a, const uint8_t* b) { +static int SSE16x8_MSA(const uint8_t* a, const uint8_t* b) { uint32_t sum; v16u8 src0, src1, src2, src3, src4, src5, src6, src7; v16u8 ref0, ref1, ref2, ref3, ref4, ref5, ref6, ref7; @@ -754,7 +758,7 @@ static int SSE16x8(const uint8_t* a, const uint8_t* b) { return sum; } -static int SSE8x8(const uint8_t* a, const uint8_t* b) { +static int SSE8x8_MSA(const uint8_t* a, const uint8_t* b) { uint32_t sum; v16u8 src0, src1, src2, src3, src4, src5, src6, src7; v16u8 ref0, ref1, ref2, ref3, ref4, ref5, ref6, ref7; @@ -774,10 +778,10 @@ static int SSE8x8(const uint8_t* a, const uint8_t* b) { return sum; } -static int SSE4x4(const uint8_t* a, const uint8_t* b) { +static int SSE4x4_MSA(const uint8_t* a, const uint8_t* b) { uint32_t sum = 0; uint32_t src0, src1, src2, src3, ref0, ref1, ref2, ref3; - v16u8 src, ref, tmp0, tmp1; + v16u8 src = { 0 }, ref = { 0 }, tmp0, tmp1; v8i16 diff0, diff1; v4i32 out0, out1; @@ -796,8 +800,8 @@ static int SSE4x4(const uint8_t* a, const uint8_t* b) { //------------------------------------------------------------------------------ // Quantization -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { +static int QuantizeBlock_MSA(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { int sum; v8i16 in0, in1, sh0, sh1, out0, out1; v8i16 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, sign0, sign1; @@ -828,7 +832,7 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], tmp1 = (tmp3 > maxlevel); tmp2 = (v8i16)__msa_bmnz_v((v16u8)tmp2, (v16u8)maxlevel, (v16u8)tmp0); tmp3 = (v8i16)__msa_bmnz_v((v16u8)tmp3, (v16u8)maxlevel, (v16u8)tmp1); - SUB2(0, tmp2, 0, tmp3, tmp0, tmp1); + SUB2(zero, tmp2, zero, tmp3, tmp0, tmp1); tmp2 = (v8i16)__msa_bmnz_v((v16u8)tmp2, (v16u8)tmp0, (v16u8)sign0); tmp3 = (v8i16)__msa_bmnz_v((v16u8)tmp3, (v16u8)tmp1, (v16u8)sign1); LD_SW4(&mtx->zthresh_[0], 4, t0, t1, t2, t3); // zthresh @@ -849,8 +853,8 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], return (sum > 0); } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +static int Quantize2Blocks_MSA(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; nz = VP8EncQuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; nz |= VP8EncQuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; @@ -863,26 +867,26 @@ static int Quantize2Blocks(int16_t in[32], int16_t out[32], extern void VP8EncDspInitMSA(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitMSA(void) { - VP8ITransform = ITransform; - VP8FTransform = FTransform; - VP8FTransformWHT = FTransformWHT; - - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; - VP8CollectHistogram = CollectHistogram; - - VP8EncPredLuma4 = Intra4Preds; - VP8EncPredLuma16 = Intra16Preds; - VP8EncPredChroma8 = IntraChromaPreds; - - VP8SSE16x16 = SSE16x16; - VP8SSE16x8 = SSE16x8; - VP8SSE8x8 = SSE8x8; - VP8SSE4x4 = SSE4x4; - - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; - VP8EncQuantizeBlockWHT = QuantizeBlock; + VP8ITransform = ITransform_MSA; + VP8FTransform = FTransform_MSA; + VP8FTransformWHT = FTransformWHT_MSA; + + VP8TDisto4x4 = Disto4x4_MSA; + VP8TDisto16x16 = Disto16x16_MSA; + VP8CollectHistogram = CollectHistogram_MSA; + + VP8EncPredLuma4 = Intra4Preds_MSA; + VP8EncPredLuma16 = Intra16Preds_MSA; + VP8EncPredChroma8 = IntraChromaPreds_MSA; + + VP8SSE16x16 = SSE16x16_MSA; + VP8SSE16x8 = SSE16x8_MSA; + VP8SSE8x8 = SSE8x8_MSA; + VP8SSE4x4 = SSE4x4_MSA; + + VP8EncQuantizeBlock = QuantizeBlock_MSA; + VP8EncQuantize2Blocks = Quantize2Blocks_MSA; + VP8EncQuantizeBlockWHT = QuantizeBlock_MSA; } #else // !WEBP_USE_MSA diff --git a/Pods/libwebp/src/dsp/enc_neon.c b/Pods/libwebp/src/dsp/enc_neon.c index 6a078d6..43bf124 100644 --- a/Pods/libwebp/src/dsp/enc_neon.c +++ b/Pods/libwebp/src/dsp/enc_neon.c @@ -11,14 +11,14 @@ // // adapted from libvpx (http://www.webmproject.org/code/) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) #include -#include "./neon.h" -#include "../enc/vp8i_enc.h" +#include "src/dsp/neon.h" +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // Transforms (Paragraph 14.4) @@ -37,15 +37,15 @@ static const int16_t kC2 = 17734; // half of kC2, actually. See comment above. #if defined(WEBP_USE_INTRINSICS) // Treats 'v' as an uint8x8_t and zero extends to an int16x8_t. -static WEBP_INLINE int16x8_t ConvertU8ToS16(uint32x2_t v) { +static WEBP_INLINE int16x8_t ConvertU8ToS16_NEON(uint32x2_t v) { return vreinterpretq_s16_u16(vmovl_u8(vreinterpret_u8_u32(v))); } // Performs unsigned 8b saturation on 'dst01' and 'dst23' storing the result // to the corresponding rows of 'dst'. -static WEBP_INLINE void SaturateAndStore4x4(uint8_t* const dst, - const int16x8_t dst01, - const int16x8_t dst23) { +static WEBP_INLINE void SaturateAndStore4x4_NEON(uint8_t* const dst, + const int16x8_t dst01, + const int16x8_t dst23) { // Unsigned saturate to 8b. const uint8x8_t dst01_u8 = vqmovun_s16(dst01); const uint8x8_t dst23_u8 = vqmovun_s16(dst23); @@ -57,8 +57,10 @@ static WEBP_INLINE void SaturateAndStore4x4(uint8_t* const dst, vst1_lane_u32((uint32_t*)(dst + 3 * BPS), vreinterpret_u32_u8(dst23_u8), 1); } -static WEBP_INLINE void Add4x4(const int16x8_t row01, const int16x8_t row23, - const uint8_t* const ref, uint8_t* const dst) { +static WEBP_INLINE void Add4x4_NEON(const int16x8_t row01, + const int16x8_t row23, + const uint8_t* const ref, + uint8_t* const dst) { uint32x2_t dst01 = vdup_n_u32(0); uint32x2_t dst23 = vdup_n_u32(0); @@ -70,19 +72,20 @@ static WEBP_INLINE void Add4x4(const int16x8_t row01, const int16x8_t row23, { // Convert to 16b. - const int16x8_t dst01_s16 = ConvertU8ToS16(dst01); - const int16x8_t dst23_s16 = ConvertU8ToS16(dst23); + const int16x8_t dst01_s16 = ConvertU8ToS16_NEON(dst01); + const int16x8_t dst23_s16 = ConvertU8ToS16_NEON(dst23); // Descale with rounding. const int16x8_t out01 = vrsraq_n_s16(dst01_s16, row01, 3); const int16x8_t out23 = vrsraq_n_s16(dst23_s16, row23, 3); // Add the inverse transform. - SaturateAndStore4x4(dst, out01, out23); + SaturateAndStore4x4_NEON(dst, out01, out23); } } -static WEBP_INLINE void Transpose8x2(const int16x8_t in0, const int16x8_t in1, - int16x8x2_t* const out) { +static WEBP_INLINE void Transpose8x2_NEON(const int16x8_t in0, + const int16x8_t in1, + int16x8x2_t* const out) { // a0 a1 a2 a3 | b0 b1 b2 b3 => a0 b0 c0 d0 | a1 b1 c1 d1 // c0 c1 c2 c3 | d0 d1 d2 d3 a2 b2 c2 d2 | a3 b3 c3 d3 const int16x8x2_t tmp0 = vzipq_s16(in0, in1); // a0 c0 a1 c1 a2 c2 ... @@ -90,7 +93,7 @@ static WEBP_INLINE void Transpose8x2(const int16x8_t in0, const int16x8_t in1, *out = vzipq_s16(tmp0.val[0], tmp0.val[1]); } -static WEBP_INLINE void TransformPass(int16x8x2_t* const rows) { +static WEBP_INLINE void TransformPass_NEON(int16x8x2_t* const rows) { // {rows} = in0 | in4 // in8 | in12 // B1 = in4 | in12 @@ -113,22 +116,22 @@ static WEBP_INLINE void TransformPass(int16x8x2_t* const rows) { const int16x8_t E0 = vqaddq_s16(D0, D1); // a+d | b+c const int16x8_t E_tmp = vqsubq_s16(D0, D1); // a-d | b-c const int16x8_t E1 = vcombine_s16(vget_high_s16(E_tmp), vget_low_s16(E_tmp)); - Transpose8x2(E0, E1, rows); + Transpose8x2_NEON(E0, E1, rows); } -static void ITransformOne(const uint8_t* ref, - const int16_t* in, uint8_t* dst) { +static void ITransformOne_NEON(const uint8_t* ref, + const int16_t* in, uint8_t* dst) { int16x8x2_t rows; INIT_VECTOR2(rows, vld1q_s16(in + 0), vld1q_s16(in + 8)); - TransformPass(&rows); - TransformPass(&rows); - Add4x4(rows.val[0], rows.val[1], ref, dst); + TransformPass_NEON(&rows); + TransformPass_NEON(&rows); + Add4x4_NEON(rows.val[0], rows.val[1], ref, dst); } #else -static void ITransformOne(const uint8_t* ref, - const int16_t* in, uint8_t* dst) { +static void ITransformOne_NEON(const uint8_t* ref, + const int16_t* in, uint8_t* dst) { const int kBPS = BPS; const int16_t kC1C2[] = { kC1, kC2, 0, 0 }; @@ -243,16 +246,16 @@ static void ITransformOne(const uint8_t* ref, #endif // WEBP_USE_INTRINSICS -static void ITransform(const uint8_t* ref, - const int16_t* in, uint8_t* dst, int do_two) { - ITransformOne(ref, in, dst); +static void ITransform_NEON(const uint8_t* ref, + const int16_t* in, uint8_t* dst, int do_two) { + ITransformOne_NEON(ref, in, dst); if (do_two) { - ITransformOne(ref + 4, in + 16, dst + 4); + ITransformOne_NEON(ref + 4, in + 16, dst + 4); } } // Load all 4x4 pixels into a single uint8x16_t variable. -static uint8x16_t Load4x4(const uint8_t* src) { +static uint8x16_t Load4x4_NEON(const uint8_t* src) { uint32x4_t out = vdupq_n_u32(0); out = vld1q_lane_u32((const uint32_t*)(src + 0 * BPS), out, 0); out = vld1q_lane_u32((const uint32_t*)(src + 1 * BPS), out, 1); @@ -265,10 +268,12 @@ static uint8x16_t Load4x4(const uint8_t* src) { #if defined(WEBP_USE_INTRINSICS) -static WEBP_INLINE void Transpose4x4_S16(const int16x4_t A, const int16x4_t B, - const int16x4_t C, const int16x4_t D, - int16x8_t* const out01, - int16x8_t* const out32) { +static WEBP_INLINE void Transpose4x4_S16_NEON(const int16x4_t A, + const int16x4_t B, + const int16x4_t C, + const int16x4_t D, + int16x8_t* const out01, + int16x8_t* const out32) { const int16x4x2_t AB = vtrn_s16(A, B); const int16x4x2_t CD = vtrn_s16(C, D); const int32x2x2_t tmp02 = vtrn_s32(vreinterpret_s32_s16(AB.val[0]), @@ -283,24 +288,24 @@ static WEBP_INLINE void Transpose4x4_S16(const int16x4_t A, const int16x4_t B, vreinterpret_s64_s32(tmp02.val[1]))); } -static WEBP_INLINE int16x8_t DiffU8ToS16(const uint8x8_t a, - const uint8x8_t b) { +static WEBP_INLINE int16x8_t DiffU8ToS16_NEON(const uint8x8_t a, + const uint8x8_t b) { return vreinterpretq_s16_u16(vsubl_u8(a, b)); } -static void FTransform(const uint8_t* src, const uint8_t* ref, - int16_t* out) { +static void FTransform_NEON(const uint8_t* src, const uint8_t* ref, + int16_t* out) { int16x8_t d0d1, d3d2; // working 4x4 int16 variables { - const uint8x16_t S0 = Load4x4(src); - const uint8x16_t R0 = Load4x4(ref); - const int16x8_t D0D1 = DiffU8ToS16(vget_low_u8(S0), vget_low_u8(R0)); - const int16x8_t D2D3 = DiffU8ToS16(vget_high_u8(S0), vget_high_u8(R0)); + const uint8x16_t S0 = Load4x4_NEON(src); + const uint8x16_t R0 = Load4x4_NEON(ref); + const int16x8_t D0D1 = DiffU8ToS16_NEON(vget_low_u8(S0), vget_low_u8(R0)); + const int16x8_t D2D3 = DiffU8ToS16_NEON(vget_high_u8(S0), vget_high_u8(R0)); const int16x4_t D0 = vget_low_s16(D0D1); const int16x4_t D1 = vget_high_s16(D0D1); const int16x4_t D2 = vget_low_s16(D2D3); const int16x4_t D3 = vget_high_s16(D2D3); - Transpose4x4_S16(D0, D1, D2, D3, &d0d1, &d3d2); + Transpose4x4_S16_NEON(D0, D1, D2, D3, &d0d1, &d3d2); } { // 1rst pass const int32x4_t kCst937 = vdupq_n_s32(937); @@ -318,7 +323,7 @@ static void FTransform(const uint8_t* src, const uint8_t* ref, const int32x4_t a3_m_a2 = vmlsl_n_s16(a3_2217, vget_high_s16(a3a2), 5352); const int16x4_t tmp1 = vshrn_n_s32(vaddq_s32(a2_p_a3, kCst1812), 9); const int16x4_t tmp3 = vshrn_n_s32(vaddq_s32(a3_m_a2, kCst937), 9); - Transpose4x4_S16(tmp0, tmp1, tmp2, tmp3, &d0d1, &d3d2); + Transpose4x4_S16_NEON(tmp0, tmp1, tmp2, tmp3, &d0d1, &d3d2); } { // 2nd pass // the (1<<16) addition is for the replacement: a3!=0 <-> 1-(a3==0) @@ -358,8 +363,8 @@ static const int32_t kCoeff32[] = { 51000, 51000, 51000, 51000 }; -static void FTransform(const uint8_t* src, const uint8_t* ref, - int16_t* out) { +static void FTransform_NEON(const uint8_t* src, const uint8_t* ref, + int16_t* out) { const int kBPS = BPS; const uint8_t* src_ptr = src; const uint8_t* ref_ptr = ref; @@ -478,7 +483,7 @@ static void FTransform(const uint8_t* src, const uint8_t* ref, src += stride; \ } while (0) -static void FTransformWHT(const int16_t* src, int16_t* out) { +static void FTransformWHT_NEON(const int16_t* src, int16_t* out) { const int stride = 16; const int16x4_t zero = vdup_n_s16(0); int32x4x4_t tmp0; @@ -516,7 +521,7 @@ static void FTransformWHT(const int16_t* src, int16_t* out) { tmp0.val[3] = vsubq_s32(a0, a1); } { - const int32x4x4_t tmp1 = Transpose4x4(tmp0); + const int32x4x4_t tmp1 = Transpose4x4_NEON(tmp0); // a0 = tmp[0 + i] + tmp[ 8 + i] // a1 = tmp[4 + i] + tmp[12 + i] // a2 = tmp[4 + i] - tmp[12 + i] @@ -560,7 +565,7 @@ static void FTransformWHT(const int16_t* src, int16_t* out) { // a 26ae, b 26ae // a 37bf, b 37bf // -static WEBP_INLINE int16x8x4_t DistoTranspose4x4S16(int16x8x4_t q4_in) { +static WEBP_INLINE int16x8x4_t DistoTranspose4x4S16_NEON(int16x8x4_t q4_in) { const int16x8x2_t q2_tmp0 = vtrnq_s16(q4_in.val[0], q4_in.val[1]); const int16x8x2_t q2_tmp1 = vtrnq_s16(q4_in.val[2], q4_in.val[3]); const int32x4x2_t q2_tmp2 = vtrnq_s32(vreinterpretq_s32_s16(q2_tmp0.val[0]), @@ -574,7 +579,8 @@ static WEBP_INLINE int16x8x4_t DistoTranspose4x4S16(int16x8x4_t q4_in) { return q4_in; } -static WEBP_INLINE int16x8x4_t DistoHorizontalPass(const int16x8x4_t q4_in) { +static WEBP_INLINE int16x8x4_t DistoHorizontalPass_NEON( + const int16x8x4_t q4_in) { // {a0, a1} = {in[0] + in[2], in[1] + in[3]} // {a3, a2} = {in[0] - in[2], in[1] - in[3]} const int16x8_t q_a0 = vaddq_s16(q4_in.val[0], q4_in.val[2]); @@ -593,7 +599,7 @@ static WEBP_INLINE int16x8x4_t DistoHorizontalPass(const int16x8x4_t q4_in) { return q4_out; } -static WEBP_INLINE int16x8x4_t DistoVerticalPass(const uint8x8x4_t q4_in) { +static WEBP_INLINE int16x8x4_t DistoVerticalPass_NEON(const uint8x8x4_t q4_in) { const int16x8_t q_a0 = vreinterpretq_s16_u16(vaddl_u8(q4_in.val[0], q4_in.val[2])); const int16x8_t q_a1 = vreinterpretq_s16_u16(vaddl_u8(q4_in.val[1], @@ -610,7 +616,7 @@ static WEBP_INLINE int16x8x4_t DistoVerticalPass(const uint8x8x4_t q4_in) { return q4_out; } -static WEBP_INLINE int16x4x4_t DistoLoadW(const uint16_t* w) { +static WEBP_INLINE int16x4x4_t DistoLoadW_NEON(const uint16_t* w) { const uint16x8_t q_w07 = vld1q_u16(&w[0]); const uint16x8_t q_w8f = vld1q_u16(&w[8]); int16x4x4_t d4_w; @@ -622,8 +628,8 @@ static WEBP_INLINE int16x4x4_t DistoLoadW(const uint16_t* w) { return d4_w; } -static WEBP_INLINE int32x2_t DistoSum(const int16x8x4_t q4_in, - const int16x4x4_t d4_w) { +static WEBP_INLINE int32x2_t DistoSum_NEON(const int16x8x4_t q4_in, + const int16x4x4_t d4_w) { int32x2_t d_sum; // sum += w[ 0] * abs(b0); // sum += w[ 4] * abs(b1); @@ -652,8 +658,8 @@ static WEBP_INLINE int32x2_t DistoSum(const int16x8x4_t q4_in, // Hadamard transform // Returns the weighted sum of the absolute value of transformed coefficients. // w[] contains a row-major 4 by 4 symmetric matrix. -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto4x4_NEON(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { uint32x2_t d_in_ab_0123 = vdup_n_u32(0); uint32x2_t d_in_ab_4567 = vdup_n_u32(0); uint32x2_t d_in_ab_89ab = vdup_n_u32(0); @@ -679,12 +685,12 @@ static int Disto4x4(const uint8_t* const a, const uint8_t* const b, // Vertical pass first to avoid a transpose (vertical and horizontal passes // are commutative because w/kWeightY is symmetric) and subsequent // transpose. - const int16x8x4_t q4_v = DistoVerticalPass(d4_in); - const int16x4x4_t d4_w = DistoLoadW(w); + const int16x8x4_t q4_v = DistoVerticalPass_NEON(d4_in); + const int16x4x4_t d4_w = DistoLoadW_NEON(w); // horizontal pass - const int16x8x4_t q4_t = DistoTranspose4x4S16(q4_v); - const int16x8x4_t q4_h = DistoHorizontalPass(q4_t); - int32x2_t d_sum = DistoSum(q4_h, d4_w); + const int16x8x4_t q4_t = DistoTranspose4x4S16_NEON(q4_v); + const int16x8x4_t q4_h = DistoHorizontalPass_NEON(q4_t); + int32x2_t d_sum = DistoSum_NEON(q4_h, d4_w); // abs(sum2 - sum1) >> 5 d_sum = vabs_s32(d_sum); @@ -694,13 +700,13 @@ static int Disto4x4(const uint8_t* const a, const uint8_t* const b, } #undef LOAD_LANE_32b -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_NEON(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_NEON(a + x + y, b + x + y, w); } } return D; @@ -708,15 +714,15 @@ static int Disto16x16(const uint8_t* const a, const uint8_t* const b, //------------------------------------------------------------------------------ -static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo) { +static void CollectHistogram_NEON(const uint8_t* ref, const uint8_t* pred, + int start_block, int end_block, + VP8Histogram* const histo) { const uint16x8_t max_coeff_thresh = vdupq_n_u16(MAX_COEFF_THRESH); int j; int distribution[MAX_COEFF_THRESH + 1] = { 0 }; for (j = start_block; j < end_block; ++j) { int16_t out[16]; - FTransform(ref + VP8DspScan[j], pred + VP8DspScan[j], out); + FTransform_NEON(ref + VP8DspScan[j], pred + VP8DspScan[j], out); { int k; const int16x8_t a0 = vld1q_s16(out + 0); @@ -740,9 +746,9 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, //------------------------------------------------------------------------------ -static WEBP_INLINE void AccumulateSSE16(const uint8_t* const a, - const uint8_t* const b, - uint32x4_t* const sum) { +static WEBP_INLINE void AccumulateSSE16_NEON(const uint8_t* const a, + const uint8_t* const b, + uint32x4_t* const sum) { const uint8x16_t a0 = vld1q_u8(a); const uint8x16_t b0 = vld1q_u8(b); const uint8x16_t abs_diff = vabdq_u8(a0, b0); @@ -757,7 +763,7 @@ static WEBP_INLINE void AccumulateSSE16(const uint8_t* const a, } // Horizontal sum of all four uint32_t values in 'sum'. -static int SumToInt(uint32x4_t sum) { +static int SumToInt_NEON(uint32x4_t sum) { const uint64x2_t sum2 = vpaddlq_u32(sum); const uint64_t sum3 = vgetq_lane_u64(sum2, 0) + vgetq_lane_u64(sum2, 1); return (int)sum3; @@ -767,18 +773,18 @@ static int SSE16x16_NEON(const uint8_t* a, const uint8_t* b) { uint32x4_t sum = vdupq_n_u32(0); int y; for (y = 0; y < 16; ++y) { - AccumulateSSE16(a + y * BPS, b + y * BPS, &sum); + AccumulateSSE16_NEON(a + y * BPS, b + y * BPS, &sum); } - return SumToInt(sum); + return SumToInt_NEON(sum); } static int SSE16x8_NEON(const uint8_t* a, const uint8_t* b) { uint32x4_t sum = vdupq_n_u32(0); int y; for (y = 0; y < 8; ++y) { - AccumulateSSE16(a + y * BPS, b + y * BPS, &sum); + AccumulateSSE16_NEON(a + y * BPS, b + y * BPS, &sum); } - return SumToInt(sum); + return SumToInt_NEON(sum); } static int SSE8x8_NEON(const uint8_t* a, const uint8_t* b) { @@ -791,12 +797,12 @@ static int SSE8x8_NEON(const uint8_t* a, const uint8_t* b) { const uint16x8_t prod = vmull_u8(abs_diff, abs_diff); sum = vpadalq_u16(sum, prod); } - return SumToInt(sum); + return SumToInt_NEON(sum); } static int SSE4x4_NEON(const uint8_t* a, const uint8_t* b) { - const uint8x16_t a0 = Load4x4(a); - const uint8x16_t b0 = Load4x4(b); + const uint8x16_t a0 = Load4x4_NEON(a); + const uint8x16_t b0 = Load4x4_NEON(b); const uint8x16_t abs_diff = vabdq_u8(a0, b0); const uint16x8_t prod1 = vmull_u8(vget_low_u8(abs_diff), vget_low_u8(abs_diff)); @@ -805,7 +811,7 @@ static int SSE4x4_NEON(const uint8_t* a, const uint8_t* b) { /* pair-wise adds and widen */ const uint32x4_t sum1 = vpaddlq_u16(prod1); const uint32x4_t sum2 = vpaddlq_u16(prod2); - return SumToInt(vaddq_u32(sum1, sum2)); + return SumToInt_NEON(vaddq_u32(sum1, sum2)); } //------------------------------------------------------------------------------ @@ -813,8 +819,8 @@ static int SSE4x4_NEON(const uint8_t* a, const uint8_t* b) { // Compilation with gcc-4.6.x is problematic for now. #if !defined(WORK_AROUND_GCC) -static int16x8_t Quantize(int16_t* const in, - const VP8Matrix* const mtx, int offset) { +static int16x8_t Quantize_NEON(int16_t* const in, + const VP8Matrix* const mtx, int offset) { const uint16x8_t sharp = vld1q_u16(&mtx->sharpen_[offset]); const uint16x8_t q = vld1q_u16(&mtx->q_[offset]); const uint16x8_t iq = vld1q_u16(&mtx->iq_[offset]); @@ -847,10 +853,10 @@ static const uint8_t kShuffles[4][8] = { { 14, 15, 22, 23, 28, 29, 30, 31 } }; -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { - const int16x8_t out0 = Quantize(in, mtx, 0); - const int16x8_t out1 = Quantize(in, mtx, 8); +static int QuantizeBlock_NEON(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { + const int16x8_t out0 = Quantize_NEON(in, mtx, 0); + const int16x8_t out1 = Quantize_NEON(in, mtx, 8); uint8x8x4_t shuffles; // vtbl?_u8 are marked unavailable for iOS arm64 with Xcode < 6.3, use // non-standard versions there. @@ -889,11 +895,11 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16], return 0; } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +static int Quantize2Blocks_NEON(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; - nz = QuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; - nz |= QuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; + nz = QuantizeBlock_NEON(in + 0 * 16, out + 0 * 16, mtx) << 0; + nz |= QuantizeBlock_NEON(in + 1 * 16, out + 1 * 16, mtx) << 1; return nz; } @@ -905,14 +911,14 @@ static int Quantize2Blocks(int16_t in[32], int16_t out[32], extern void VP8EncDspInitNEON(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitNEON(void) { - VP8ITransform = ITransform; - VP8FTransform = FTransform; + VP8ITransform = ITransform_NEON; + VP8FTransform = FTransform_NEON; - VP8FTransformWHT = FTransformWHT; + VP8FTransformWHT = FTransformWHT_NEON; - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; - VP8CollectHistogram = CollectHistogram; + VP8TDisto4x4 = Disto4x4_NEON; + VP8TDisto16x16 = Disto16x16_NEON; + VP8CollectHistogram = CollectHistogram_NEON; VP8SSE16x16 = SSE16x16_NEON; VP8SSE16x8 = SSE16x8_NEON; @@ -920,8 +926,8 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitNEON(void) { VP8SSE4x4 = SSE4x4_NEON; #if !defined(WORK_AROUND_GCC) - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; + VP8EncQuantizeBlock = QuantizeBlock_NEON; + VP8EncQuantize2Blocks = Quantize2Blocks_NEON; #endif } diff --git a/Pods/libwebp/src/dsp/enc_sse2.c b/Pods/libwebp/src/dsp/enc_sse2.c index 2026a74..b2e78ed 100644 --- a/Pods/libwebp/src/dsp/enc_sse2.c +++ b/Pods/libwebp/src/dsp/enc_sse2.c @@ -11,23 +11,23 @@ // // Author: Christian Duvivier (cduvivier@google.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) #include #include // for abs() #include -#include "./common_sse2.h" -#include "../enc/cost_enc.h" -#include "../enc/vp8i_enc.h" +#include "src/dsp/common_sse2.h" +#include "src/enc/cost_enc.h" +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // Transforms (Paragraph 14.4) // Does one or two inverse transforms. -static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst, - int do_two) { +static void ITransform_SSE2(const uint8_t* ref, const int16_t* in, uint8_t* dst, + int do_two) { // This implementation makes use of 16-bit fixed point versions of two // multiply constants: // K1 = sqrt(2) * cos (pi/8) ~= 85627 / 2^16 @@ -193,10 +193,10 @@ static void ITransform(const uint8_t* ref, const int16_t* in, uint8_t* dst, } } -static void FTransformPass1(const __m128i* const in01, - const __m128i* const in23, - __m128i* const out01, - __m128i* const out32) { +static void FTransformPass1_SSE2(const __m128i* const in01, + const __m128i* const in23, + __m128i* const out01, + __m128i* const out32) { const __m128i k937 = _mm_set1_epi32(937); const __m128i k1812 = _mm_set1_epi32(1812); @@ -239,8 +239,9 @@ static void FTransformPass1(const __m128i* const in01, *out32 = _mm_shuffle_epi32(v23, _MM_SHUFFLE(1, 0, 3, 2)); // 3 2 3 2 3 2.. } -static void FTransformPass2(const __m128i* const v01, const __m128i* const v32, - int16_t* out) { +static void FTransformPass2_SSE2(const __m128i* const v01, + const __m128i* const v32, + int16_t* out) { const __m128i zero = _mm_setzero_si128(); const __m128i seven = _mm_set1_epi16(7); const __m128i k5352_2217 = _mm_set_epi16(5352, 2217, 5352, 2217, @@ -291,7 +292,8 @@ static void FTransformPass2(const __m128i* const v01, const __m128i* const v32, _mm_storeu_si128((__m128i*)&out[8], d2_f3); } -static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform_SSE2(const uint8_t* src, const uint8_t* ref, + int16_t* out) { const __m128i zero = _mm_setzero_si128(); // Load src. const __m128i src0 = _mm_loadl_epi64((const __m128i*)&src[0 * BPS]); @@ -328,13 +330,14 @@ static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) { __m128i v01, v32; // First pass - FTransformPass1(&row01, &row23, &v01, &v32); + FTransformPass1_SSE2(&row01, &row23, &v01, &v32); // Second pass - FTransformPass2(&v01, &v32, out); + FTransformPass2_SSE2(&v01, &v32, out); } -static void FTransform2(const uint8_t* src, const uint8_t* ref, int16_t* out) { +static void FTransform2_SSE2(const uint8_t* src, const uint8_t* ref, + int16_t* out) { const __m128i zero = _mm_setzero_si128(); // Load src and convert to 16b. @@ -374,15 +377,15 @@ static void FTransform2(const uint8_t* src, const uint8_t* ref, int16_t* out) { __m128i v01h, v32h; // First pass - FTransformPass1(&shuf01l, &shuf23l, &v01l, &v32l); - FTransformPass1(&shuf01h, &shuf23h, &v01h, &v32h); + FTransformPass1_SSE2(&shuf01l, &shuf23l, &v01l, &v32l); + FTransformPass1_SSE2(&shuf01h, &shuf23h, &v01h, &v32h); // Second pass - FTransformPass2(&v01l, &v32l, out + 0); - FTransformPass2(&v01h, &v32h, out + 16); + FTransformPass2_SSE2(&v01l, &v32l, out + 0); + FTransformPass2_SSE2(&v01h, &v32h, out + 16); } -static void FTransformWHTRow(const int16_t* const in, __m128i* const out) { +static void FTransformWHTRow_SSE2(const int16_t* const in, __m128i* const out) { const __m128i kMult = _mm_set_epi16(-1, 1, -1, 1, 1, 1, 1, 1); const __m128i src0 = _mm_loadl_epi64((__m128i*)&in[0 * 16]); const __m128i src1 = _mm_loadl_epi64((__m128i*)&in[1 * 16]); @@ -398,14 +401,14 @@ static void FTransformWHTRow(const int16_t* const in, __m128i* const out) { *out = _mm_madd_epi16(D, kMult); } -static void FTransformWHT(const int16_t* in, int16_t* out) { +static void FTransformWHT_SSE2(const int16_t* in, int16_t* out) { // Input is 12b signed. __m128i row0, row1, row2, row3; // Rows are 14b signed. - FTransformWHTRow(in + 0 * 64, &row0); - FTransformWHTRow(in + 1 * 64, &row1); - FTransformWHTRow(in + 2 * 64, &row2); - FTransformWHTRow(in + 3 * 64, &row3); + FTransformWHTRow_SSE2(in + 0 * 64, &row0); + FTransformWHTRow_SSE2(in + 1 * 64, &row1); + FTransformWHTRow_SSE2(in + 2 * 64, &row2); + FTransformWHTRow_SSE2(in + 3 * 64, &row3); { // The a* are 15b signed. @@ -431,9 +434,9 @@ static void FTransformWHT(const int16_t* in, int16_t* out) { // Compute susceptibility based on DCT-coeff histograms: // the higher, the "easier" the macroblock is to compress. -static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo) { +static void CollectHistogram_SSE2(const uint8_t* ref, const uint8_t* pred, + int start_block, int end_block, + VP8Histogram* const histo) { const __m128i zero = _mm_setzero_si128(); const __m128i max_coeff_thresh = _mm_set1_epi16(MAX_COEFF_THRESH); int j; @@ -442,7 +445,7 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, int16_t out[16]; int k; - FTransform(ref + VP8DspScan[j], pred + VP8DspScan[j], out); + FTransform_SSE2(ref + VP8DspScan[j], pred + VP8DspScan[j], out); // Convert coefficients to bin (within out[]). { @@ -476,7 +479,7 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, // Intra predictions // helper for chroma-DC predictions -static WEBP_INLINE void Put8x8uv(uint8_t v, uint8_t* dst) { +static WEBP_INLINE void Put8x8uv_SSE2(uint8_t v, uint8_t* dst) { int j; const __m128i values = _mm_set1_epi8(v); for (j = 0; j < 8; ++j) { @@ -484,7 +487,7 @@ static WEBP_INLINE void Put8x8uv(uint8_t v, uint8_t* dst) { } } -static WEBP_INLINE void Put16(uint8_t v, uint8_t* dst) { +static WEBP_INLINE void Put16_SSE2(uint8_t v, uint8_t* dst) { int j; const __m128i values = _mm_set1_epi8(v); for (j = 0; j < 16; ++j) { @@ -492,20 +495,20 @@ static WEBP_INLINE void Put16(uint8_t v, uint8_t* dst) { } } -static WEBP_INLINE void Fill(uint8_t* dst, int value, int size) { +static WEBP_INLINE void Fill_SSE2(uint8_t* dst, int value, int size) { if (size == 4) { int j; for (j = 0; j < 4; ++j) { memset(dst + j * BPS, value, 4); } } else if (size == 8) { - Put8x8uv(value, dst); + Put8x8uv_SSE2(value, dst); } else { - Put16(value, dst); + Put16_SSE2(value, dst); } } -static WEBP_INLINE void VE8uv(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void VE8uv_SSE2(uint8_t* dst, const uint8_t* top) { int j; const __m128i top_values = _mm_loadl_epi64((const __m128i*)top); for (j = 0; j < 8; ++j) { @@ -513,7 +516,7 @@ static WEBP_INLINE void VE8uv(uint8_t* dst, const uint8_t* top) { } } -static WEBP_INLINE void VE16(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void VE16_SSE2(uint8_t* dst, const uint8_t* top) { const __m128i top_values = _mm_load_si128((const __m128i*)top); int j; for (j = 0; j < 16; ++j) { @@ -521,20 +524,20 @@ static WEBP_INLINE void VE16(uint8_t* dst, const uint8_t* top) { } } -static WEBP_INLINE void VerticalPred(uint8_t* dst, - const uint8_t* top, int size) { +static WEBP_INLINE void VerticalPred_SSE2(uint8_t* dst, + const uint8_t* top, int size) { if (top != NULL) { if (size == 8) { - VE8uv(dst, top); + VE8uv_SSE2(dst, top); } else { - VE16(dst, top); + VE16_SSE2(dst, top); } } else { - Fill(dst, 127, size); + Fill_SSE2(dst, 127, size); } } -static WEBP_INLINE void HE8uv(uint8_t* dst, const uint8_t* left) { +static WEBP_INLINE void HE8uv_SSE2(uint8_t* dst, const uint8_t* left) { int j; for (j = 0; j < 8; ++j) { const __m128i values = _mm_set1_epi8(left[j]); @@ -543,7 +546,7 @@ static WEBP_INLINE void HE8uv(uint8_t* dst, const uint8_t* left) { } } -static WEBP_INLINE void HE16(uint8_t* dst, const uint8_t* left) { +static WEBP_INLINE void HE16_SSE2(uint8_t* dst, const uint8_t* left) { int j; for (j = 0; j < 16; ++j) { const __m128i values = _mm_set1_epi8(left[j]); @@ -552,21 +555,21 @@ static WEBP_INLINE void HE16(uint8_t* dst, const uint8_t* left) { } } -static WEBP_INLINE void HorizontalPred(uint8_t* dst, - const uint8_t* left, int size) { +static WEBP_INLINE void HorizontalPred_SSE2(uint8_t* dst, + const uint8_t* left, int size) { if (left != NULL) { if (size == 8) { - HE8uv(dst, left); + HE8uv_SSE2(dst, left); } else { - HE16(dst, left); + HE16_SSE2(dst, left); } } else { - Fill(dst, 129, size); + Fill_SSE2(dst, 129, size); } } -static WEBP_INLINE void TM(uint8_t* dst, const uint8_t* left, - const uint8_t* top, int size) { +static WEBP_INLINE void TM_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top, int size) { const __m128i zero = _mm_setzero_si128(); int y; if (size == 8) { @@ -593,13 +596,13 @@ static WEBP_INLINE void TM(uint8_t* dst, const uint8_t* left, } } -static WEBP_INLINE void TrueMotion(uint8_t* dst, const uint8_t* left, - const uint8_t* top, int size) { +static WEBP_INLINE void TrueMotion_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top, int size) { if (left != NULL) { if (top != NULL) { - TM(dst, left, top, size); + TM_SSE2(dst, left, top, size); } else { - HorizontalPred(dst, left, size); + HorizontalPred_SSE2(dst, left, size); } } else { // true motion without left samples (hence: with default 129 value) @@ -607,90 +610,90 @@ static WEBP_INLINE void TrueMotion(uint8_t* dst, const uint8_t* left, // Note that if top samples are not available, the default value is // then 129, and not 127 as in the VerticalPred case. if (top != NULL) { - VerticalPred(dst, top, size); + VerticalPred_SSE2(dst, top, size); } else { - Fill(dst, 129, size); + Fill_SSE2(dst, 129, size); } } } -static WEBP_INLINE void DC8uv(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static WEBP_INLINE void DC8uv_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { const __m128i top_values = _mm_loadl_epi64((const __m128i*)top); const __m128i left_values = _mm_loadl_epi64((const __m128i*)left); const __m128i combined = _mm_unpacklo_epi64(top_values, left_values); const int DC = VP8HorizontalAdd8b(&combined) + 8; - Put8x8uv(DC >> 4, dst); + Put8x8uv_SSE2(DC >> 4, dst); } -static WEBP_INLINE void DC8uvNoLeft(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void DC8uvNoLeft_SSE2(uint8_t* dst, const uint8_t* top) { const __m128i zero = _mm_setzero_si128(); const __m128i top_values = _mm_loadl_epi64((const __m128i*)top); const __m128i sum = _mm_sad_epu8(top_values, zero); const int DC = _mm_cvtsi128_si32(sum) + 4; - Put8x8uv(DC >> 3, dst); + Put8x8uv_SSE2(DC >> 3, dst); } -static WEBP_INLINE void DC8uvNoTop(uint8_t* dst, const uint8_t* left) { +static WEBP_INLINE void DC8uvNoTop_SSE2(uint8_t* dst, const uint8_t* left) { // 'left' is contiguous so we can reuse the top summation. - DC8uvNoLeft(dst, left); + DC8uvNoLeft_SSE2(dst, left); } -static WEBP_INLINE void DC8uvNoTopLeft(uint8_t* dst) { - Put8x8uv(0x80, dst); +static WEBP_INLINE void DC8uvNoTopLeft_SSE2(uint8_t* dst) { + Put8x8uv_SSE2(0x80, dst); } -static WEBP_INLINE void DC8uvMode(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static WEBP_INLINE void DC8uvMode_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { if (top != NULL) { if (left != NULL) { // top and left present - DC8uv(dst, left, top); + DC8uv_SSE2(dst, left, top); } else { // top, but no left - DC8uvNoLeft(dst, top); + DC8uvNoLeft_SSE2(dst, top); } } else if (left != NULL) { // left but no top - DC8uvNoTop(dst, left); + DC8uvNoTop_SSE2(dst, left); } else { // no top, no left, nothing. - DC8uvNoTopLeft(dst); + DC8uvNoTopLeft_SSE2(dst); } } -static WEBP_INLINE void DC16(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static WEBP_INLINE void DC16_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { const __m128i top_row = _mm_load_si128((const __m128i*)top); const __m128i left_row = _mm_load_si128((const __m128i*)left); const int DC = VP8HorizontalAdd8b(&top_row) + VP8HorizontalAdd8b(&left_row) + 16; - Put16(DC >> 5, dst); + Put16_SSE2(DC >> 5, dst); } -static WEBP_INLINE void DC16NoLeft(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void DC16NoLeft_SSE2(uint8_t* dst, const uint8_t* top) { const __m128i top_row = _mm_load_si128((const __m128i*)top); const int DC = VP8HorizontalAdd8b(&top_row) + 8; - Put16(DC >> 4, dst); + Put16_SSE2(DC >> 4, dst); } -static WEBP_INLINE void DC16NoTop(uint8_t* dst, const uint8_t* left) { +static WEBP_INLINE void DC16NoTop_SSE2(uint8_t* dst, const uint8_t* left) { // 'left' is contiguous so we can reuse the top summation. - DC16NoLeft(dst, left); + DC16NoLeft_SSE2(dst, left); } -static WEBP_INLINE void DC16NoTopLeft(uint8_t* dst) { - Put16(0x80, dst); +static WEBP_INLINE void DC16NoTopLeft_SSE2(uint8_t* dst) { + Put16_SSE2(0x80, dst); } -static WEBP_INLINE void DC16Mode(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static WEBP_INLINE void DC16Mode_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { if (top != NULL) { if (left != NULL) { // top and left present - DC16(dst, left, top); + DC16_SSE2(dst, left, top); } else { // top, but no left - DC16NoLeft(dst, top); + DC16NoLeft_SSE2(dst, top); } } else if (left != NULL) { // left but no top - DC16NoTop(dst, left); + DC16NoTop_SSE2(dst, left); } else { // no top, no left, nothing. - DC16NoTopLeft(dst); + DC16NoTopLeft_SSE2(dst); } } @@ -709,7 +712,8 @@ static WEBP_INLINE void DC16Mode(uint8_t* dst, const uint8_t* left, // where: AC = (a + b + 1) >> 1, BC = (b + c + 1) >> 1 // and ab = a ^ b, bc = b ^ c, lsb = (AC^BC)&1 -static WEBP_INLINE void VE4(uint8_t* dst, const uint8_t* top) { // vertical +static WEBP_INLINE void VE4_SSE2(uint8_t* dst, + const uint8_t* top) { // vertical const __m128i one = _mm_set1_epi8(1); const __m128i ABCDEFGH = _mm_loadl_epi64((__m128i*)(top - 1)); const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1); @@ -725,7 +729,8 @@ static WEBP_INLINE void VE4(uint8_t* dst, const uint8_t* top) { // vertical } } -static WEBP_INLINE void HE4(uint8_t* dst, const uint8_t* top) { // horizontal +static WEBP_INLINE void HE4_SSE2(uint8_t* dst, + const uint8_t* top) { // horizontal const int X = top[-1]; const int I = top[-2]; const int J = top[-3]; @@ -737,14 +742,15 @@ static WEBP_INLINE void HE4(uint8_t* dst, const uint8_t* top) { // horizontal WebPUint32ToMem(dst + 3 * BPS, 0x01010101U * AVG3(K, L, L)); } -static WEBP_INLINE void DC4(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void DC4_SSE2(uint8_t* dst, const uint8_t* top) { uint32_t dc = 4; int i; for (i = 0; i < 4; ++i) dc += top[i] + top[-5 + i]; - Fill(dst, dc >> 3, 4); + Fill_SSE2(dst, dc >> 3, 4); } -static WEBP_INLINE void LD4(uint8_t* dst, const uint8_t* top) { // Down-Left +static WEBP_INLINE void LD4_SSE2(uint8_t* dst, + const uint8_t* top) { // Down-Left const __m128i one = _mm_set1_epi8(1); const __m128i ABCDEFGH = _mm_loadl_epi64((const __m128i*)top); const __m128i BCDEFGH0 = _mm_srli_si128(ABCDEFGH, 1); @@ -760,8 +766,8 @@ static WEBP_INLINE void LD4(uint8_t* dst, const uint8_t* top) { // Down-Left WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } -static WEBP_INLINE void VR4(uint8_t* dst, - const uint8_t* top) { // Vertical-Right +static WEBP_INLINE void VR4_SSE2(uint8_t* dst, + const uint8_t* top) { // Vertical-Right const __m128i one = _mm_set1_epi8(1); const int I = top[-2]; const int J = top[-3]; @@ -771,7 +777,7 @@ static WEBP_INLINE void VR4(uint8_t* dst, const __m128i ABCD0 = _mm_srli_si128(XABCD, 1); const __m128i abcd = _mm_avg_epu8(XABCD, ABCD0); const __m128i _XABCD = _mm_slli_si128(XABCD, 1); - const __m128i IXABCD = _mm_insert_epi16(_XABCD, I | (X << 8), 0); + const __m128i IXABCD = _mm_insert_epi16(_XABCD, (short)(I | (X << 8)), 0); const __m128i avg1 = _mm_avg_epu8(IXABCD, ABCD0); const __m128i lsb = _mm_and_si128(_mm_xor_si128(IXABCD, ABCD0), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); @@ -786,8 +792,8 @@ static WEBP_INLINE void VR4(uint8_t* dst, DST(0, 3) = AVG3(K, J, I); } -static WEBP_INLINE void VL4(uint8_t* dst, - const uint8_t* top) { // Vertical-Left +static WEBP_INLINE void VL4_SSE2(uint8_t* dst, + const uint8_t* top) { // Vertical-Left const __m128i one = _mm_set1_epi8(1); const __m128i ABCDEFGH = _mm_loadl_epi64((const __m128i*)top); const __m128i BCDEFGH_ = _mm_srli_si128(ABCDEFGH, 1); @@ -812,7 +818,8 @@ static WEBP_INLINE void VL4(uint8_t* dst, DST(3, 3) = (extra_out >> 8) & 0xff; } -static WEBP_INLINE void RD4(uint8_t* dst, const uint8_t* top) { // Down-right +static WEBP_INLINE void RD4_SSE2(uint8_t* dst, + const uint8_t* top) { // Down-right const __m128i one = _mm_set1_epi8(1); const __m128i LKJIXABC = _mm_loadl_epi64((const __m128i*)(top - 5)); const __m128i LKJIXABCD = _mm_insert_epi16(LKJIXABC, top[3], 4); @@ -828,7 +835,7 @@ static WEBP_INLINE void RD4(uint8_t* dst, const uint8_t* top) { // Down-right WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } -static WEBP_INLINE void HU4(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void HU4_SSE2(uint8_t* dst, const uint8_t* top) { const int I = top[-2]; const int J = top[-3]; const int K = top[-4]; @@ -843,7 +850,7 @@ static WEBP_INLINE void HU4(uint8_t* dst, const uint8_t* top) { DST(0, 3) = DST(1, 3) = DST(2, 3) = DST(3, 3) = L; } -static WEBP_INLINE void HD4(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void HD4_SSE2(uint8_t* dst, const uint8_t* top) { const int X = top[-1]; const int I = top[-2]; const int J = top[-3]; @@ -866,7 +873,7 @@ static WEBP_INLINE void HD4(uint8_t* dst, const uint8_t* top) { DST(1, 3) = AVG3(L, K, J); } -static WEBP_INLINE void TM4(uint8_t* dst, const uint8_t* top) { +static WEBP_INLINE void TM4_SSE2(uint8_t* dst, const uint8_t* top) { const __m128i zero = _mm_setzero_si128(); const __m128i top_values = _mm_cvtsi32_si128(WebPMemToUint32(top)); const __m128i top_base = _mm_unpacklo_epi8(top_values, zero); @@ -888,55 +895,56 @@ static WEBP_INLINE void TM4(uint8_t* dst, const uint8_t* top) { // Left samples are top[-5 .. -2], top_left is top[-1], top are // located at top[0..3], and top right is top[4..7] -static void Intra4Preds(uint8_t* dst, const uint8_t* top) { - DC4(I4DC4 + dst, top); - TM4(I4TM4 + dst, top); - VE4(I4VE4 + dst, top); - HE4(I4HE4 + dst, top); - RD4(I4RD4 + dst, top); - VR4(I4VR4 + dst, top); - LD4(I4LD4 + dst, top); - VL4(I4VL4 + dst, top); - HD4(I4HD4 + dst, top); - HU4(I4HU4 + dst, top); +static void Intra4Preds_SSE2(uint8_t* dst, const uint8_t* top) { + DC4_SSE2(I4DC4 + dst, top); + TM4_SSE2(I4TM4 + dst, top); + VE4_SSE2(I4VE4 + dst, top); + HE4_SSE2(I4HE4 + dst, top); + RD4_SSE2(I4RD4 + dst, top); + VR4_SSE2(I4VR4 + dst, top); + LD4_SSE2(I4LD4 + dst, top); + VL4_SSE2(I4VL4 + dst, top); + HD4_SSE2(I4HD4 + dst, top); + HU4_SSE2(I4HU4 + dst, top); } //------------------------------------------------------------------------------ // Chroma 8x8 prediction (paragraph 12.2) -static void IntraChromaPreds(uint8_t* dst, const uint8_t* left, - const uint8_t* top) { +static void IntraChromaPreds_SSE2(uint8_t* dst, const uint8_t* left, + const uint8_t* top) { // U block - DC8uvMode(C8DC8 + dst, left, top); - VerticalPred(C8VE8 + dst, top, 8); - HorizontalPred(C8HE8 + dst, left, 8); - TrueMotion(C8TM8 + dst, left, top, 8); + DC8uvMode_SSE2(C8DC8 + dst, left, top); + VerticalPred_SSE2(C8VE8 + dst, top, 8); + HorizontalPred_SSE2(C8HE8 + dst, left, 8); + TrueMotion_SSE2(C8TM8 + dst, left, top, 8); // V block dst += 8; if (top != NULL) top += 8; if (left != NULL) left += 16; - DC8uvMode(C8DC8 + dst, left, top); - VerticalPred(C8VE8 + dst, top, 8); - HorizontalPred(C8HE8 + dst, left, 8); - TrueMotion(C8TM8 + dst, left, top, 8); + DC8uvMode_SSE2(C8DC8 + dst, left, top); + VerticalPred_SSE2(C8VE8 + dst, top, 8); + HorizontalPred_SSE2(C8HE8 + dst, left, 8); + TrueMotion_SSE2(C8TM8 + dst, left, top, 8); } //------------------------------------------------------------------------------ // luma 16x16 prediction (paragraph 12.3) -static void Intra16Preds(uint8_t* dst, - const uint8_t* left, const uint8_t* top) { - DC16Mode(I16DC16 + dst, left, top); - VerticalPred(I16VE16 + dst, top, 16); - HorizontalPred(I16HE16 + dst, left, 16); - TrueMotion(I16TM16 + dst, left, top, 16); +static void Intra16Preds_SSE2(uint8_t* dst, + const uint8_t* left, const uint8_t* top) { + DC16Mode_SSE2(I16DC16 + dst, left, top); + VerticalPred_SSE2(I16VE16 + dst, top, 16); + HorizontalPred_SSE2(I16HE16 + dst, left, 16); + TrueMotion_SSE2(I16TM16 + dst, left, top, 16); } //------------------------------------------------------------------------------ // Metric -static WEBP_INLINE void SubtractAndAccumulate(const __m128i a, const __m128i b, - __m128i* const sum) { +static WEBP_INLINE void SubtractAndAccumulate_SSE2(const __m128i a, + const __m128i b, + __m128i* const sum) { // take abs(a-b) in 8b const __m128i a_b = _mm_subs_epu8(a, b); const __m128i b_a = _mm_subs_epu8(b, a); @@ -951,8 +959,8 @@ static WEBP_INLINE void SubtractAndAccumulate(const __m128i a, const __m128i b, *sum = _mm_add_epi32(sum1, sum2); } -static WEBP_INLINE int SSE_16xN(const uint8_t* a, const uint8_t* b, - int num_pairs) { +static WEBP_INLINE int SSE_16xN_SSE2(const uint8_t* a, const uint8_t* b, + int num_pairs) { __m128i sum = _mm_setzero_si128(); int32_t tmp[4]; int i; @@ -963,8 +971,8 @@ static WEBP_INLINE int SSE_16xN(const uint8_t* a, const uint8_t* b, const __m128i a1 = _mm_loadu_si128((const __m128i*)&a[BPS * 1]); const __m128i b1 = _mm_loadu_si128((const __m128i*)&b[BPS * 1]); __m128i sum1, sum2; - SubtractAndAccumulate(a0, b0, &sum1); - SubtractAndAccumulate(a1, b1, &sum2); + SubtractAndAccumulate_SSE2(a0, b0, &sum1); + SubtractAndAccumulate_SSE2(a1, b1, &sum2); sum = _mm_add_epi32(sum, _mm_add_epi32(sum1, sum2)); a += 2 * BPS; b += 2 * BPS; @@ -973,18 +981,18 @@ static WEBP_INLINE int SSE_16xN(const uint8_t* a, const uint8_t* b, return (tmp[3] + tmp[2] + tmp[1] + tmp[0]); } -static int SSE16x16(const uint8_t* a, const uint8_t* b) { - return SSE_16xN(a, b, 8); +static int SSE16x16_SSE2(const uint8_t* a, const uint8_t* b) { + return SSE_16xN_SSE2(a, b, 8); } -static int SSE16x8(const uint8_t* a, const uint8_t* b) { - return SSE_16xN(a, b, 4); +static int SSE16x8_SSE2(const uint8_t* a, const uint8_t* b) { + return SSE_16xN_SSE2(a, b, 4); } #define LOAD_8x16b(ptr) \ _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(ptr)), zero) -static int SSE8x8(const uint8_t* a, const uint8_t* b) { +static int SSE8x8_SSE2(const uint8_t* a, const uint8_t* b) { const __m128i zero = _mm_setzero_si128(); int num_pairs = 4; __m128i sum = zero; @@ -1011,7 +1019,7 @@ static int SSE8x8(const uint8_t* a, const uint8_t* b) { } #undef LOAD_8x16b -static int SSE4x4(const uint8_t* a, const uint8_t* b) { +static int SSE4x4_SSE2(const uint8_t* a, const uint8_t* b) { const __m128i zero = _mm_setzero_si128(); // Load values. Note that we read 8 pixels instead of 4, @@ -1048,7 +1056,7 @@ static int SSE4x4(const uint8_t* a, const uint8_t* b) { //------------------------------------------------------------------------------ -static void Mean16x4(const uint8_t* ref, uint32_t dc[4]) { +static void Mean16x4_SSE2(const uint8_t* ref, uint32_t dc[4]) { const __m128i mask = _mm_set1_epi16(0x00ff); const __m128i a0 = _mm_loadu_si128((const __m128i*)&ref[BPS * 0]); const __m128i a1 = _mm_loadu_si128((const __m128i*)&ref[BPS * 1]); @@ -1086,8 +1094,8 @@ static void Mean16x4(const uint8_t* ref, uint32_t dc[4]) { // Hadamard transform // Returns the weighted sum of the absolute value of transformed coefficients. // w[] contains a row-major 4 by 4 symmetric matrix. -static int TTransform(const uint8_t* inA, const uint8_t* inB, - const uint16_t* const w) { +static int TTransform_SSE2(const uint8_t* inA, const uint8_t* inB, + const uint16_t* const w) { int32_t sum[4]; __m128i tmp_0, tmp_1, tmp_2, tmp_3; const __m128i zero = _mm_setzero_si128(); @@ -1187,19 +1195,19 @@ static int TTransform(const uint8_t* inA, const uint8_t* inB, return sum[0] + sum[1] + sum[2] + sum[3]; } -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { - const int diff_sum = TTransform(a, b, w); +static int Disto4x4_SSE2(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { + const int diff_sum = TTransform_SSE2(a, b, w); return abs(diff_sum) >> 5; } -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_SSE2(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_SSE2(a + x + y, b + x + y, w); } } return D; @@ -1209,9 +1217,9 @@ static int Disto16x16(const uint8_t* const a, const uint8_t* const b, // Quantization // -static WEBP_INLINE int DoQuantizeBlock(int16_t in[16], int16_t out[16], - const uint16_t* const sharpen, - const VP8Matrix* const mtx) { +static WEBP_INLINE int DoQuantizeBlock_SSE2(int16_t in[16], int16_t out[16], + const uint16_t* const sharpen, + const VP8Matrix* const mtx) { const __m128i max_coeff_2047 = _mm_set1_epi16(MAX_LEVEL); const __m128i zero = _mm_setzero_si128(); __m128i coeff0, coeff8; @@ -1321,22 +1329,22 @@ static WEBP_INLINE int DoQuantizeBlock(int16_t in[16], int16_t out[16], return (_mm_movemask_epi8(_mm_cmpeq_epi8(packed_out, zero)) != 0xffff); } -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { - return DoQuantizeBlock(in, out, &mtx->sharpen_[0], mtx); +static int QuantizeBlock_SSE2(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { + return DoQuantizeBlock_SSE2(in, out, &mtx->sharpen_[0], mtx); } -static int QuantizeBlockWHT(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { - return DoQuantizeBlock(in, out, NULL, mtx); +static int QuantizeBlockWHT_SSE2(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { + return DoQuantizeBlock_SSE2(in, out, NULL, mtx); } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +static int Quantize2Blocks_SSE2(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; const uint16_t* const sharpen = &mtx->sharpen_[0]; - nz = DoQuantizeBlock(in + 0 * 16, out + 0 * 16, sharpen, mtx) << 0; - nz |= DoQuantizeBlock(in + 1 * 16, out + 1 * 16, sharpen, mtx) << 1; + nz = DoQuantizeBlock_SSE2(in + 0 * 16, out + 0 * 16, sharpen, mtx) << 0; + nz |= DoQuantizeBlock_SSE2(in + 1 * 16, out + 1 * 16, sharpen, mtx) << 1; return nz; } @@ -1346,139 +1354,28 @@ static int Quantize2Blocks(int16_t in[32], int16_t out[32], extern void VP8EncDspInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitSSE2(void) { - VP8CollectHistogram = CollectHistogram; - VP8EncPredLuma16 = Intra16Preds; - VP8EncPredChroma8 = IntraChromaPreds; - VP8EncPredLuma4 = Intra4Preds; - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; - VP8EncQuantizeBlockWHT = QuantizeBlockWHT; - VP8ITransform = ITransform; - VP8FTransform = FTransform; - VP8FTransform2 = FTransform2; - VP8FTransformWHT = FTransformWHT; - VP8SSE16x16 = SSE16x16; - VP8SSE16x8 = SSE16x8; - VP8SSE8x8 = SSE8x8; - VP8SSE4x4 = SSE4x4; - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; - VP8Mean16x4 = Mean16x4; -} - -//------------------------------------------------------------------------------ -// SSIM / PSNR entry point (TODO(skal): move to its own file later) - -static uint32_t AccumulateSSE_SSE2(const uint8_t* src1, - const uint8_t* src2, int len) { - int i = 0; - uint32_t sse2 = 0; - if (len >= 16) { - const int limit = len - 32; - int32_t tmp[4]; - __m128i sum1; - __m128i sum = _mm_setzero_si128(); - __m128i a0 = _mm_loadu_si128((const __m128i*)&src1[i]); - __m128i b0 = _mm_loadu_si128((const __m128i*)&src2[i]); - i += 16; - while (i <= limit) { - const __m128i a1 = _mm_loadu_si128((const __m128i*)&src1[i]); - const __m128i b1 = _mm_loadu_si128((const __m128i*)&src2[i]); - __m128i sum2; - i += 16; - SubtractAndAccumulate(a0, b0, &sum1); - sum = _mm_add_epi32(sum, sum1); - a0 = _mm_loadu_si128((const __m128i*)&src1[i]); - b0 = _mm_loadu_si128((const __m128i*)&src2[i]); - i += 16; - SubtractAndAccumulate(a1, b1, &sum2); - sum = _mm_add_epi32(sum, sum2); - } - SubtractAndAccumulate(a0, b0, &sum1); - sum = _mm_add_epi32(sum, sum1); - _mm_storeu_si128((__m128i*)tmp, sum); - sse2 += (tmp[3] + tmp[2] + tmp[1] + tmp[0]); - } - - for (; i < len; ++i) { - const int32_t diff = src1[i] - src2[i]; - sse2 += diff * diff; - } - return sse2; -} - -static uint32_t HorizontalAdd16b(const __m128i* const m) { - uint16_t tmp[8]; - const __m128i a = _mm_srli_si128(*m, 8); - const __m128i b = _mm_add_epi16(*m, a); - _mm_storeu_si128((__m128i*)tmp, b); - return (uint32_t)tmp[3] + tmp[2] + tmp[1] + tmp[0]; -} - -static uint32_t HorizontalAdd32b(const __m128i* const m) { - const __m128i a = _mm_srli_si128(*m, 8); - const __m128i b = _mm_add_epi32(*m, a); - const __m128i c = _mm_add_epi32(b, _mm_srli_si128(b, 4)); - return (uint32_t)_mm_cvtsi128_si32(c); -} - -static const uint16_t kWeight[] = { 1, 2, 3, 4, 3, 2, 1, 0 }; - -#define ACCUMULATE_ROW(WEIGHT) do { \ - /* compute row weight (Wx * Wy) */ \ - const __m128i Wy = _mm_set1_epi16((WEIGHT)); \ - const __m128i W = _mm_mullo_epi16(Wx, Wy); \ - /* process 8 bytes at a time (7 bytes, actually) */ \ - const __m128i a0 = _mm_loadl_epi64((const __m128i*)src1); \ - const __m128i b0 = _mm_loadl_epi64((const __m128i*)src2); \ - /* convert to 16b and multiply by weight */ \ - const __m128i a1 = _mm_unpacklo_epi8(a0, zero); \ - const __m128i b1 = _mm_unpacklo_epi8(b0, zero); \ - const __m128i wa1 = _mm_mullo_epi16(a1, W); \ - const __m128i wb1 = _mm_mullo_epi16(b1, W); \ - /* accumulate */ \ - xm = _mm_add_epi16(xm, wa1); \ - ym = _mm_add_epi16(ym, wb1); \ - xxm = _mm_add_epi32(xxm, _mm_madd_epi16(a1, wa1)); \ - xym = _mm_add_epi32(xym, _mm_madd_epi16(a1, wb1)); \ - yym = _mm_add_epi32(yym, _mm_madd_epi16(b1, wb1)); \ - src1 += stride1; \ - src2 += stride2; \ -} while (0) - -static double SSIMGet_SSE2(const uint8_t* src1, int stride1, - const uint8_t* src2, int stride2) { - VP8DistoStats stats; - const __m128i zero = _mm_setzero_si128(); - __m128i xm = zero, ym = zero; // 16b accums - __m128i xxm = zero, yym = zero, xym = zero; // 32b accum - const __m128i Wx = _mm_loadu_si128((const __m128i*)kWeight); - assert(2 * VP8_SSIM_KERNEL + 1 == 7); - ACCUMULATE_ROW(1); - ACCUMULATE_ROW(2); - ACCUMULATE_ROW(3); - ACCUMULATE_ROW(4); - ACCUMULATE_ROW(3); - ACCUMULATE_ROW(2); - ACCUMULATE_ROW(1); - stats.xm = HorizontalAdd16b(&xm); - stats.ym = HorizontalAdd16b(&ym); - stats.xxm = HorizontalAdd32b(&xxm); - stats.xym = HorizontalAdd32b(&xym); - stats.yym = HorizontalAdd32b(&yym); - return VP8SSIMFromStats(&stats); -} - -extern void VP8SSIMDspInitSSE2(void); - -WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInitSSE2(void) { - VP8AccumulateSSE = AccumulateSSE_SSE2; - VP8SSIMGet = SSIMGet_SSE2; + VP8CollectHistogram = CollectHistogram_SSE2; + VP8EncPredLuma16 = Intra16Preds_SSE2; + VP8EncPredChroma8 = IntraChromaPreds_SSE2; + VP8EncPredLuma4 = Intra4Preds_SSE2; + VP8EncQuantizeBlock = QuantizeBlock_SSE2; + VP8EncQuantize2Blocks = Quantize2Blocks_SSE2; + VP8EncQuantizeBlockWHT = QuantizeBlockWHT_SSE2; + VP8ITransform = ITransform_SSE2; + VP8FTransform = FTransform_SSE2; + VP8FTransform2 = FTransform2_SSE2; + VP8FTransformWHT = FTransformWHT_SSE2; + VP8SSE16x16 = SSE16x16_SSE2; + VP8SSE16x8 = SSE16x8_SSE2; + VP8SSE8x8 = SSE8x8_SSE2; + VP8SSE4x4 = SSE4x4_SSE2; + VP8TDisto4x4 = Disto4x4_SSE2; + VP8TDisto16x16 = Disto16x16_SSE2; + VP8Mean16x4 = Mean16x4_SSE2; } #else // !WEBP_USE_SSE2 WEBP_DSP_INIT_STUB(VP8EncDspInitSSE2) -WEBP_DSP_INIT_STUB(VP8SSIMDspInitSSE2) #endif // WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/enc_sse41.c b/Pods/libwebp/src/dsp/enc_sse41.c index e32086d..924035a 100644 --- a/Pods/libwebp/src/dsp/enc_sse41.c +++ b/Pods/libwebp/src/dsp/enc_sse41.c @@ -11,21 +11,21 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE41) #include #include // for abs() -#include "./common_sse2.h" -#include "../enc/vp8i_enc.h" +#include "src/dsp/common_sse2.h" +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // Compute susceptibility based on DCT-coeff histograms. -static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo) { +static void CollectHistogram_SSE41(const uint8_t* ref, const uint8_t* pred, + int start_block, int end_block, + VP8Histogram* const histo) { const __m128i max_coeff_thresh = _mm_set1_epi16(MAX_COEFF_THRESH); int j; int distribution[MAX_COEFF_THRESH + 1] = { 0 }; @@ -70,8 +70,8 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred, // Hadamard transform // Returns the weighted sum of the absolute value of transformed coefficients. // w[] contains a row-major 4 by 4 symmetric matrix. -static int TTransform(const uint8_t* inA, const uint8_t* inB, - const uint16_t* const w) { +static int TTransform_SSE41(const uint8_t* inA, const uint8_t* inB, + const uint16_t* const w) { int32_t sum[4]; __m128i tmp_0, tmp_1, tmp_2, tmp_3; @@ -168,19 +168,19 @@ static int TTransform(const uint8_t* inA, const uint8_t* inB, return sum[0] + sum[1] + sum[2] + sum[3]; } -static int Disto4x4(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { - const int diff_sum = TTransform(a, b, w); +static int Disto4x4_SSE41(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { + const int diff_sum = TTransform_SSE41(a, b, w); return abs(diff_sum) >> 5; } -static int Disto16x16(const uint8_t* const a, const uint8_t* const b, - const uint16_t* const w) { +static int Disto16x16_SSE41(const uint8_t* const a, const uint8_t* const b, + const uint16_t* const w) { int D = 0; int x, y; for (y = 0; y < 16 * BPS; y += 4 * BPS) { for (x = 0; x < 16; x += 4) { - D += Disto4x4(a + x + y, b + x + y, w); + D += Disto4x4_SSE41(a + x + y, b + x + y, w); } } return D; @@ -197,9 +197,9 @@ static int Disto16x16(const uint8_t* const a, const uint8_t* const b, 2 * (D) + 1, 2 * (D) + 0, 2 * (C) + 1, 2 * (C) + 0, \ 2 * (B) + 1, 2 * (B) + 0, 2 * (A) + 1, 2 * (A) + 0) -static WEBP_INLINE int DoQuantizeBlock(int16_t in[16], int16_t out[16], - const uint16_t* const sharpen, - const VP8Matrix* const mtx) { +static WEBP_INLINE int DoQuantizeBlock_SSE41(int16_t in[16], int16_t out[16], + const uint16_t* const sharpen, + const VP8Matrix* const mtx) { const __m128i max_coeff_2047 = _mm_set1_epi16(MAX_LEVEL); const __m128i zero = _mm_setzero_si128(); __m128i out0, out8; @@ -300,22 +300,22 @@ static WEBP_INLINE int DoQuantizeBlock(int16_t in[16], int16_t out[16], #undef PSHUFB_CST -static int QuantizeBlock(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { - return DoQuantizeBlock(in, out, &mtx->sharpen_[0], mtx); +static int QuantizeBlock_SSE41(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { + return DoQuantizeBlock_SSE41(in, out, &mtx->sharpen_[0], mtx); } -static int QuantizeBlockWHT(int16_t in[16], int16_t out[16], - const VP8Matrix* const mtx) { - return DoQuantizeBlock(in, out, NULL, mtx); +static int QuantizeBlockWHT_SSE41(int16_t in[16], int16_t out[16], + const VP8Matrix* const mtx) { + return DoQuantizeBlock_SSE41(in, out, NULL, mtx); } -static int Quantize2Blocks(int16_t in[32], int16_t out[32], - const VP8Matrix* const mtx) { +static int Quantize2Blocks_SSE41(int16_t in[32], int16_t out[32], + const VP8Matrix* const mtx) { int nz; const uint16_t* const sharpen = &mtx->sharpen_[0]; - nz = DoQuantizeBlock(in + 0 * 16, out + 0 * 16, sharpen, mtx) << 0; - nz |= DoQuantizeBlock(in + 1 * 16, out + 1 * 16, sharpen, mtx) << 1; + nz = DoQuantizeBlock_SSE41(in + 0 * 16, out + 0 * 16, sharpen, mtx) << 0; + nz |= DoQuantizeBlock_SSE41(in + 1 * 16, out + 1 * 16, sharpen, mtx) << 1; return nz; } @@ -324,12 +324,12 @@ static int Quantize2Blocks(int16_t in[32], int16_t out[32], extern void VP8EncDspInitSSE41(void); WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitSSE41(void) { - VP8CollectHistogram = CollectHistogram; - VP8EncQuantizeBlock = QuantizeBlock; - VP8EncQuantize2Blocks = Quantize2Blocks; - VP8EncQuantizeBlockWHT = QuantizeBlockWHT; - VP8TDisto4x4 = Disto4x4; - VP8TDisto16x16 = Disto16x16; + VP8CollectHistogram = CollectHistogram_SSE41; + VP8EncQuantizeBlock = QuantizeBlock_SSE41; + VP8EncQuantize2Blocks = Quantize2Blocks_SSE41; + VP8EncQuantizeBlockWHT = QuantizeBlockWHT_SSE41; + VP8TDisto4x4 = Disto4x4_SSE41; + VP8TDisto16x16 = Disto16x16_SSE41; } #else // !WEBP_USE_SSE41 diff --git a/Pods/libwebp/src/dsp/filters.c b/Pods/libwebp/src/dsp/filters.c index 65f34aa..9e910d9 100644 --- a/Pods/libwebp/src/dsp/filters.c +++ b/Pods/libwebp/src/dsp/filters.c @@ -11,7 +11,7 @@ // // Author: Urvang (urvang@google.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #include #include #include @@ -20,31 +20,32 @@ // Helpful macro. # define SANITY_CHECK(in, out) \ - assert(in != NULL); \ - assert(out != NULL); \ + assert((in) != NULL); \ + assert((out) != NULL); \ assert(width > 0); \ assert(height > 0); \ assert(stride >= width); \ assert(row >= 0 && num_rows > 0 && row + num_rows <= height); \ (void)height; // Silence unused warning. -static WEBP_INLINE void PredictLine(const uint8_t* src, const uint8_t* pred, - uint8_t* dst, int length, int inverse) { +#if !WEBP_NEON_OMIT_C_CODE +static WEBP_INLINE void PredictLine_C(const uint8_t* src, const uint8_t* pred, + uint8_t* dst, int length, int inverse) { int i; if (inverse) { - for (i = 0; i < length; ++i) dst[i] = src[i] + pred[i]; + for (i = 0; i < length; ++i) dst[i] = (uint8_t)(src[i] + pred[i]); } else { - for (i = 0; i < length; ++i) dst[i] = src[i] - pred[i]; + for (i = 0; i < length; ++i) dst[i] = (uint8_t)(src[i] - pred[i]); } } //------------------------------------------------------------------------------ // Horizontal filter. -static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, - int inverse, uint8_t* out) { +static WEBP_INLINE void DoHorizontalFilter_C(const uint8_t* in, + int width, int height, int stride, + int row, int num_rows, + int inverse, uint8_t* out) { const uint8_t* preds; const size_t start_offset = row * stride; const int last_row = row + num_rows; @@ -56,7 +57,7 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, if (row == 0) { // Leftmost pixel is the same as input for topmost scanline. out[0] = in[0]; - PredictLine(in + 1, preds, out + 1, width - 1, inverse); + PredictLine_C(in + 1, preds, out + 1, width - 1, inverse); row = 1; preds += stride; in += stride; @@ -66,8 +67,8 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, // Filter line-by-line. while (row < last_row) { // Leftmost pixel is predicted from above. - PredictLine(in, preds - stride, out, 1, inverse); - PredictLine(in + 1, preds, out + 1, width - 1, inverse); + PredictLine_C(in, preds - stride, out, 1, inverse); + PredictLine_C(in + 1, preds, out + 1, width - 1, inverse); ++row; preds += stride; in += stride; @@ -78,10 +79,10 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, //------------------------------------------------------------------------------ // Vertical filter. -static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, - int inverse, uint8_t* out) { +static WEBP_INLINE void DoVerticalFilter_C(const uint8_t* in, + int width, int height, int stride, + int row, int num_rows, + int inverse, uint8_t* out) { const uint8_t* preds; const size_t start_offset = row * stride; const int last_row = row + num_rows; @@ -94,7 +95,7 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, // Very first top-left pixel is copied. out[0] = in[0]; // Rest of top scan-line is left-predicted. - PredictLine(in + 1, preds, out + 1, width - 1, inverse); + PredictLine_C(in + 1, preds, out + 1, width - 1, inverse); row = 1; in += stride; out += stride; @@ -105,26 +106,28 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, // Filter line-by-line. while (row < last_row) { - PredictLine(in, preds, out, width, inverse); + PredictLine_C(in, preds, out, width, inverse); ++row; preds += stride; in += stride; out += stride; } } +#endif // !WEBP_NEON_OMIT_C_CODE //------------------------------------------------------------------------------ // Gradient filter. -static WEBP_INLINE int GradientPredictor(uint8_t a, uint8_t b, uint8_t c) { +static WEBP_INLINE int GradientPredictor_C(uint8_t a, uint8_t b, uint8_t c) { const int g = a + b - c; return ((g & ~0xff) == 0) ? g : (g < 0) ? 0 : 255; // clip to 8bit } -static WEBP_INLINE void DoGradientFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, - int inverse, uint8_t* out) { +#if !WEBP_NEON_OMIT_C_CODE +static WEBP_INLINE void DoGradientFilter_C(const uint8_t* in, + int width, int height, int stride, + int row, int num_rows, + int inverse, uint8_t* out) { const uint8_t* preds; const size_t start_offset = row * stride; const int last_row = row + num_rows; @@ -136,7 +139,7 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, // left prediction for top scan-line if (row == 0) { out[0] = in[0]; - PredictLine(in + 1, preds, out + 1, width - 1, inverse); + PredictLine_C(in + 1, preds, out + 1, width - 1, inverse); row = 1; preds += stride; in += stride; @@ -147,12 +150,12 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, while (row < last_row) { int w; // leftmost pixel: predict from above. - PredictLine(in, preds - stride, out, 1, inverse); + PredictLine_C(in, preds - stride, out, 1, inverse); for (w = 1; w < width; ++w) { - const int pred = GradientPredictor(preds[w - 1], - preds[w - stride], - preds[w - stride - 1]); - out[w] = in[w] + (inverse ? pred : -pred); + const int pred = GradientPredictor_C(preds[w - 1], + preds[w - stride], + preds[w - stride - 1]); + out[w] = (uint8_t)(in[w] + (inverse ? pred : -pred)); } ++row; preds += stride; @@ -160,60 +163,64 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, out += stride; } } +#endif // !WEBP_NEON_OMIT_C_CODE #undef SANITY_CHECK //------------------------------------------------------------------------------ -static void HorizontalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoHorizontalFilter(data, width, height, stride, 0, height, 0, filtered_data); +#if !WEBP_NEON_OMIT_C_CODE +static void HorizontalFilter_C(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoHorizontalFilter_C(data, width, height, stride, 0, height, 0, + filtered_data); } -static void VerticalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoVerticalFilter(data, width, height, stride, 0, height, 0, filtered_data); +static void VerticalFilter_C(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoVerticalFilter_C(data, width, height, stride, 0, height, 0, filtered_data); } - -static void GradientFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoGradientFilter(data, width, height, stride, 0, height, 0, filtered_data); +static void GradientFilter_C(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoGradientFilter_C(data, width, height, stride, 0, height, 0, filtered_data); } - +#endif // !WEBP_NEON_OMIT_C_CODE //------------------------------------------------------------------------------ -static void HorizontalUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void HorizontalUnfilter_C(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { uint8_t pred = (prev == NULL) ? 0 : prev[0]; int i; for (i = 0; i < width; ++i) { - out[i] = pred + in[i]; + out[i] = (uint8_t)(pred + in[i]); pred = out[i]; } } -static void VerticalUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +#if !WEBP_NEON_OMIT_C_CODE +static void VerticalUnfilter_C(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { if (prev == NULL) { - HorizontalUnfilter(NULL, in, out, width); + HorizontalUnfilter_C(NULL, in, out, width); } else { int i; - for (i = 0; i < width; ++i) out[i] = prev[i] + in[i]; + for (i = 0; i < width; ++i) out[i] = (uint8_t)(prev[i] + in[i]); } } +#endif // !WEBP_NEON_OMIT_C_CODE -static void GradientUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void GradientUnfilter_C(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { if (prev == NULL) { - HorizontalUnfilter(NULL, in, out, width); + HorizontalUnfilter_C(NULL, in, out, width); } else { uint8_t top = prev[0], top_left = top, left = top; int i; for (i = 0; i < width; ++i) { top = prev[i]; // need to read this first, in case prev==out - left = in[i] + GradientPredictor(left, top, top_left); + left = (uint8_t)(in[i] + GradientPredictor_C(left, top, top_left)); top_left = top; out[i] = left; } @@ -231,21 +238,20 @@ extern void VP8FiltersInitMSA(void); extern void VP8FiltersInitNEON(void); extern void VP8FiltersInitSSE2(void); -static volatile VP8CPUInfo filters_last_cpuinfo_used = - (VP8CPUInfo)&filters_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInit(void) { - if (filters_last_cpuinfo_used == VP8GetCPUInfo) return; - +WEBP_DSP_INIT_FUNC(VP8FiltersInit) { WebPUnfilters[WEBP_FILTER_NONE] = NULL; - WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter; - WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter; - WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter; +#if !WEBP_NEON_OMIT_C_CODE + WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_C; + WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_C; +#endif + WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter_C; WebPFilters[WEBP_FILTER_NONE] = NULL; - WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter; - WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter; - WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter; +#if !WEBP_NEON_OMIT_C_CODE + WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter_C; + WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter_C; + WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter_C; +#endif if (VP8GetCPUInfo != NULL) { #if defined(WEBP_USE_SSE2) @@ -253,11 +259,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInit(void) { VP8FiltersInitSSE2(); } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - VP8FiltersInitNEON(); - } -#endif #if defined(WEBP_USE_MIPS_DSP_R2) if (VP8GetCPUInfo(kMIPSdspR2)) { VP8FiltersInitMIPSdspR2(); @@ -269,5 +270,18 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInit(void) { } #endif } - filters_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + VP8FiltersInitNEON(); + } +#endif + + assert(WebPUnfilters[WEBP_FILTER_HORIZONTAL] != NULL); + assert(WebPUnfilters[WEBP_FILTER_VERTICAL] != NULL); + assert(WebPUnfilters[WEBP_FILTER_GRADIENT] != NULL); + assert(WebPFilters[WEBP_FILTER_HORIZONTAL] != NULL); + assert(WebPFilters[WEBP_FILTER_VERTICAL] != NULL); + assert(WebPFilters[WEBP_FILTER_GRADIENT] != NULL); } diff --git a/Pods/libwebp/src/dsp/filters_mips_dsp_r2.c b/Pods/libwebp/src/dsp/filters_mips_dsp_r2.c index 1d82e3c..9382b12 100644 --- a/Pods/libwebp/src/dsp/filters_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/filters_mips_dsp_r2.c @@ -12,11 +12,11 @@ // Author(s): Branimir Vasic (branimir.vasic@imgtec.com) // Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "../dsp/dsp.h" +#include "src/dsp/dsp.h" #include #include #include @@ -101,8 +101,8 @@ ); \ } while (0) -static WEBP_INLINE void PredictLine(const uint8_t* src, uint8_t* dst, - int length) { +static WEBP_INLINE void PredictLine_MIPSdspR2(const uint8_t* src, uint8_t* dst, + int length) { DO_PREDICT_LINE(src, dst, length, 0); } @@ -192,10 +192,11 @@ static WEBP_INLINE void PredictLine(const uint8_t* src, uint8_t* dst, } \ } while (0) -static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, - uint8_t* out) { +static WEBP_INLINE void DoHorizontalFilter_MIPSdspR2(const uint8_t* in, + int width, int height, + int stride, + int row, int num_rows, + uint8_t* out) { const uint8_t* preds; const size_t start_offset = row * stride; const int last_row = row + num_rows; @@ -207,7 +208,7 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, if (row == 0) { // Leftmost pixel is the same as input for topmost scanline. out[0] = in[0]; - PredictLine(in + 1, out + 1, width - 1); + PredictLine_MIPSdspR2(in + 1, out + 1, width - 1); row = 1; preds += stride; in += stride; @@ -219,9 +220,11 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, } #undef FILTER_LINE_BY_LINE -static void HorizontalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoHorizontalFilter(data, width, height, stride, 0, height, filtered_data); +static void HorizontalFilter_MIPSdspR2(const uint8_t* data, + int width, int height, + int stride, uint8_t* filtered_data) { + DoHorizontalFilter_MIPSdspR2(data, width, height, stride, 0, height, + filtered_data); } //------------------------------------------------------------------------------ @@ -237,9 +240,11 @@ static void HorizontalFilter(const uint8_t* data, int width, int height, } \ } while (0) -static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, uint8_t* out) { +static WEBP_INLINE void DoVerticalFilter_MIPSdspR2(const uint8_t* in, + int width, int height, + int stride, + int row, int num_rows, + uint8_t* out) { const uint8_t* preds; const size_t start_offset = row * stride; const int last_row = row + num_rows; @@ -252,7 +257,7 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, // Very first top-left pixel is copied. out[0] = in[0]; // Rest of top scan-line is left-predicted. - PredictLine(in + 1, out + 1, width - 1); + PredictLine_MIPSdspR2(in + 1, out + 1, width - 1); row = 1; in += stride; out += stride; @@ -266,15 +271,16 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, } #undef FILTER_LINE_BY_LINE -static void VerticalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoVerticalFilter(data, width, height, stride, 0, height, filtered_data); +static void VerticalFilter_MIPSdspR2(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoVerticalFilter_MIPSdspR2(data, width, height, stride, 0, height, + filtered_data); } //------------------------------------------------------------------------------ // Gradient filter. -static WEBP_INLINE int GradientPredictor(uint8_t a, uint8_t b, uint8_t c) { +static int GradientPredictor_MIPSdspR2(uint8_t a, uint8_t b, uint8_t c) { int temp0; __asm__ volatile ( "addu %[temp0], %[a], %[b] \n\t" @@ -293,9 +299,9 @@ static WEBP_INLINE int GradientPredictor(uint8_t a, uint8_t b, uint8_t c) { int w; \ PREDICT_LINE_ONE_PASS(in, PREDS - stride, out); \ for (w = 1; w < width; ++w) { \ - const int pred = GradientPredictor(PREDS[w - 1], \ - PREDS[w - stride], \ - PREDS[w - stride - 1]); \ + const int pred = GradientPredictor_MIPSdspR2(PREDS[w - 1], \ + PREDS[w - stride], \ + PREDS[w - stride - 1]); \ out[w] = in[w] OPERATION pred; \ } \ ++row; \ @@ -304,9 +310,9 @@ static WEBP_INLINE int GradientPredictor(uint8_t a, uint8_t b, uint8_t c) { } \ } while (0) -static WEBP_INLINE void DoGradientFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, uint8_t* out) { +static void DoGradientFilter_MIPSdspR2(const uint8_t* in, + int width, int height, int stride, + int row, int num_rows, uint8_t* out) { const uint8_t* preds; const size_t start_offset = row * stride; const int last_row = row + num_rows; @@ -318,7 +324,7 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, // left prediction for top scan-line if (row == 0) { out[0] = in[0]; - PredictLine(in + 1, out + 1, width - 1); + PredictLine_MIPSdspR2(in + 1, out + 1, width - 1); row = 1; preds += stride; in += stride; @@ -330,38 +336,39 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, } #undef FILTER_LINE_BY_LINE -static void GradientFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoGradientFilter(data, width, height, stride, 0, height, filtered_data); +static void GradientFilter_MIPSdspR2(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoGradientFilter_MIPSdspR2(data, width, height, stride, 0, height, + filtered_data); } //------------------------------------------------------------------------------ -static void HorizontalUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void HorizontalUnfilter_MIPSdspR2(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { out[0] = in[0] + (prev == NULL ? 0 : prev[0]); DO_PREDICT_LINE(in + 1, out + 1, width - 1, 1); } -static void VerticalUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void VerticalUnfilter_MIPSdspR2(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { if (prev == NULL) { - HorizontalUnfilter(NULL, in, out, width); + HorizontalUnfilter_MIPSdspR2(NULL, in, out, width); } else { DO_PREDICT_LINE_VERTICAL(in, prev, out, width, 1); } } -static void GradientUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void GradientUnfilter_MIPSdspR2(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { if (prev == NULL) { - HorizontalUnfilter(NULL, in, out, width); + HorizontalUnfilter_MIPSdspR2(NULL, in, out, width); } else { uint8_t top = prev[0], top_left = top, left = top; int i; for (i = 0; i < width; ++i) { top = prev[i]; // need to read this first, in case prev==dst - left = in[i] + GradientPredictor(left, top, top_left); + left = in[i] + GradientPredictor_MIPSdspR2(left, top, top_left); top_left = top; out[i] = left; } @@ -379,13 +386,13 @@ static void GradientUnfilter(const uint8_t* prev, const uint8_t* in, extern void VP8FiltersInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInitMIPSdspR2(void) { - WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter; - WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter; - WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter; + WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_MIPSdspR2; + WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_MIPSdspR2; + WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter_MIPSdspR2; - WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter; - WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter; - WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter; + WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter_MIPSdspR2; + WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter_MIPSdspR2; + WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/filters_msa.c b/Pods/libwebp/src/dsp/filters_msa.c index 4b8922d..14c437d 100644 --- a/Pods/libwebp/src/dsp/filters_msa.c +++ b/Pods/libwebp/src/dsp/filters_msa.c @@ -11,11 +11,11 @@ // // Author: Prashant Patil (prashant.patil@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MSA) -#include "./msa_macro.h" +#include "src/dsp/msa_macro.h" #include @@ -66,8 +66,8 @@ static WEBP_INLINE void PredictLineInverse0(const uint8_t* src, //------------------------------------------------------------------------------ // Horrizontal filter -static void HorizontalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { +static void HorizontalFilter_MSA(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { const uint8_t* preds = data; const uint8_t* in = data; uint8_t* out = filtered_data; @@ -129,8 +129,8 @@ static WEBP_INLINE void PredictLineGradient(const uint8_t* pinput, } -static void GradientFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { +static void GradientFilter_MSA(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { const uint8_t* in = data; const uint8_t* preds = data; uint8_t* out = filtered_data; @@ -157,8 +157,8 @@ static void GradientFilter(const uint8_t* data, int width, int height, //------------------------------------------------------------------------------ // Vertical filter -static void VerticalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { +static void VerticalFilter_MSA(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { const uint8_t* in = data; const uint8_t* preds = data; uint8_t* out = filtered_data; @@ -190,9 +190,9 @@ static void VerticalFilter(const uint8_t* data, int width, int height, extern void VP8FiltersInitMSA(void); WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInitMSA(void) { - WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter; - WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter; - WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter; + WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter_MSA; + WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter_MSA; + WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter_MSA; } #else // !WEBP_USE_MSA diff --git a/Pods/libwebp/src/dsp/filters_neon.c b/Pods/libwebp/src/dsp/filters_neon.c index 4d6e50c..3e6a578 100644 --- a/Pods/libwebp/src/dsp/filters_neon.c +++ b/Pods/libwebp/src/dsp/filters_neon.c @@ -11,12 +11,12 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) #include -#include "./neon.h" +#include "src/dsp/neon.h" //------------------------------------------------------------------------------ // Helpful macros. @@ -134,7 +134,7 @@ static WEBP_INLINE void DoVerticalFilter_NEON(const uint8_t* in, } static void VerticalFilter_NEON(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { + int stride, uint8_t* filtered_data) { DoVerticalFilter_NEON(data, width, height, stride, 0, height, filtered_data); } @@ -196,7 +196,7 @@ static WEBP_INLINE void DoGradientFilter_NEON(const uint8_t* in, } static void GradientFilter_NEON(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { + int stride, uint8_t* filtered_data) { DoGradientFilter_NEON(data, width, height, stride, 0, height, filtered_data); } @@ -251,9 +251,11 @@ static void VerticalUnfilter_NEON(const uint8_t* prev, const uint8_t* in, // GradientUnfilter_NEON is correct but slower than the C-version, // at least on ARM64. For armv7, it's a wash. // So best is to disable it for now, but keep the idea around... -// #define USE_GRADIENT_UNFILTER +#if !defined(USE_GRADIENT_UNFILTER) +#define USE_GRADIENT_UNFILTER 0 // ALTERNATE_CODE +#endif -#if defined(USE_GRADIENT_UNFILTER) +#if (USE_GRADIENT_UNFILTER == 1) #define GRAD_PROCESS_LANE(L) do { \ const uint8x8_t tmp1 = ROTATE_RIGHT_N(pred, 1); /* rotate predictor in */ \ const int16x8_t tmp2 = vaddq_s16(BC, U8_TO_S16(tmp1)); \ @@ -292,7 +294,7 @@ static void GradientPredictInverse_NEON(const uint8_t* const in, #undef GRAD_PROCESS_LANE static void GradientUnfilter_NEON(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { + uint8_t* out, int width) { if (prev == NULL) { HorizontalUnfilter_NEON(NULL, in, out, width); } else { @@ -311,7 +313,7 @@ extern void VP8FiltersInitNEON(void); WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInitNEON(void) { WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_NEON; WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_NEON; -#if defined(USE_GRADIENT_UNFILTER) +#if (USE_GRADIENT_UNFILTER == 1) WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter_NEON; #endif diff --git a/Pods/libwebp/src/dsp/filters_sse2.c b/Pods/libwebp/src/dsp/filters_sse2.c index 67f7799..4b3f2d0 100644 --- a/Pods/libwebp/src/dsp/filters_sse2.c +++ b/Pods/libwebp/src/dsp/filters_sse2.c @@ -11,7 +11,7 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) @@ -24,16 +24,16 @@ // Helpful macro. # define SANITY_CHECK(in, out) \ - assert(in != NULL); \ - assert(out != NULL); \ + assert((in) != NULL); \ + assert((out) != NULL); \ assert(width > 0); \ assert(height > 0); \ assert(stride >= width); \ assert(row >= 0 && num_rows > 0 && row + num_rows <= height); \ (void)height; // Silence unused warning. -static void PredictLineTop(const uint8_t* src, const uint8_t* pred, - uint8_t* dst, int length) { +static void PredictLineTop_SSE2(const uint8_t* src, const uint8_t* pred, + uint8_t* dst, int length) { int i; const int max_pos = length & ~31; assert(length >= 0); @@ -51,7 +51,7 @@ static void PredictLineTop(const uint8_t* src, const uint8_t* pred, } // Special case for left-based prediction (when preds==dst-1 or preds==src-1). -static void PredictLineLeft(const uint8_t* src, uint8_t* dst, int length) { +static void PredictLineLeft_SSE2(const uint8_t* src, uint8_t* dst, int length) { int i; const int max_pos = length & ~31; assert(length >= 0); @@ -71,10 +71,11 @@ static void PredictLineLeft(const uint8_t* src, uint8_t* dst, int length) { //------------------------------------------------------------------------------ // Horizontal filter. -static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, - uint8_t* out) { +static WEBP_INLINE void DoHorizontalFilter_SSE2(const uint8_t* in, + int width, int height, + int stride, + int row, int num_rows, + uint8_t* out) { const size_t start_offset = row * stride; const int last_row = row + num_rows; SANITY_CHECK(in, out); @@ -84,7 +85,7 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, if (row == 0) { // Leftmost pixel is the same as input for topmost scanline. out[0] = in[0]; - PredictLineLeft(in + 1, out + 1, width - 1); + PredictLineLeft_SSE2(in + 1, out + 1, width - 1); row = 1; in += stride; out += stride; @@ -94,7 +95,7 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, while (row < last_row) { // Leftmost pixel is predicted from above. out[0] = in[0] - in[-stride]; - PredictLineLeft(in + 1, out + 1, width - 1); + PredictLineLeft_SSE2(in + 1, out + 1, width - 1); ++row; in += stride; out += stride; @@ -104,9 +105,10 @@ static WEBP_INLINE void DoHorizontalFilter(const uint8_t* in, //------------------------------------------------------------------------------ // Vertical filter. -static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, uint8_t* out) { +static WEBP_INLINE void DoVerticalFilter_SSE2(const uint8_t* in, + int width, int height, int stride, + int row, int num_rows, + uint8_t* out) { const size_t start_offset = row * stride; const int last_row = row + num_rows; SANITY_CHECK(in, out); @@ -117,7 +119,7 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, // Very first top-left pixel is copied. out[0] = in[0]; // Rest of top scan-line is left-predicted. - PredictLineLeft(in + 1, out + 1, width - 1); + PredictLineLeft_SSE2(in + 1, out + 1, width - 1); row = 1; in += stride; out += stride; @@ -125,7 +127,7 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, // Filter line-by-line. while (row < last_row) { - PredictLineTop(in, in - stride, out, width); + PredictLineTop_SSE2(in, in - stride, out, width); ++row; in += stride; out += stride; @@ -135,14 +137,14 @@ static WEBP_INLINE void DoVerticalFilter(const uint8_t* in, //------------------------------------------------------------------------------ // Gradient filter. -static WEBP_INLINE int GradientPredictorC(uint8_t a, uint8_t b, uint8_t c) { +static WEBP_INLINE int GradientPredictor_SSE2(uint8_t a, uint8_t b, uint8_t c) { const int g = a + b - c; return ((g & ~0xff) == 0) ? g : (g < 0) ? 0 : 255; // clip to 8bit } -static void GradientPredictDirect(const uint8_t* const row, - const uint8_t* const top, - uint8_t* const out, int length) { +static void GradientPredictDirect_SSE2(const uint8_t* const row, + const uint8_t* const top, + uint8_t* const out, int length) { const int max_pos = length & ~7; int i; const __m128i zero = _mm_setzero_si128(); @@ -161,14 +163,15 @@ static void GradientPredictDirect(const uint8_t* const row, _mm_storel_epi64((__m128i*)(out + i), H); } for (; i < length; ++i) { - out[i] = row[i] - GradientPredictorC(row[i - 1], top[i], top[i - 1]); + const int delta = GradientPredictor_SSE2(row[i - 1], top[i], top[i - 1]); + out[i] = (uint8_t)(row[i] - delta); } } -static WEBP_INLINE void DoGradientFilter(const uint8_t* in, - int width, int height, int stride, - int row, int num_rows, - uint8_t* out) { +static WEBP_INLINE void DoGradientFilter_SSE2(const uint8_t* in, + int width, int height, int stride, + int row, int num_rows, + uint8_t* out) { const size_t start_offset = row * stride; const int last_row = row + num_rows; SANITY_CHECK(in, out); @@ -178,7 +181,7 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, // left prediction for top scan-line if (row == 0) { out[0] = in[0]; - PredictLineLeft(in + 1, out + 1, width - 1); + PredictLineLeft_SSE2(in + 1, out + 1, width - 1); row = 1; in += stride; out += stride; @@ -186,8 +189,8 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, // Filter line-by-line. while (row < last_row) { - out[0] = in[0] - in[-stride]; - GradientPredictDirect(in + 1, in + 1 - stride, out + 1, width - 1); + out[0] = (uint8_t)(in[0] - in[-stride]); + GradientPredictDirect_SSE2(in + 1, in + 1 - stride, out + 1, width - 1); ++row; in += stride; out += stride; @@ -198,29 +201,30 @@ static WEBP_INLINE void DoGradientFilter(const uint8_t* in, //------------------------------------------------------------------------------ -static void HorizontalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoHorizontalFilter(data, width, height, stride, 0, height, filtered_data); +static void HorizontalFilter_SSE2(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoHorizontalFilter_SSE2(data, width, height, stride, 0, height, + filtered_data); } -static void VerticalFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoVerticalFilter(data, width, height, stride, 0, height, filtered_data); +static void VerticalFilter_SSE2(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoVerticalFilter_SSE2(data, width, height, stride, 0, height, filtered_data); } -static void GradientFilter(const uint8_t* data, int width, int height, - int stride, uint8_t* filtered_data) { - DoGradientFilter(data, width, height, stride, 0, height, filtered_data); +static void GradientFilter_SSE2(const uint8_t* data, int width, int height, + int stride, uint8_t* filtered_data) { + DoGradientFilter_SSE2(data, width, height, stride, 0, height, filtered_data); } //------------------------------------------------------------------------------ // Inverse transforms -static void HorizontalUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void HorizontalUnfilter_SSE2(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { int i; __m128i last; - out[0] = in[0] + (prev == NULL ? 0 : prev[0]); + out[0] = (uint8_t)(in[0] + (prev == NULL ? 0 : prev[0])); if (width <= 1) return; last = _mm_set_epi32(0, 0, 0, out[0]); for (i = 1; i + 8 <= width; i += 8) { @@ -235,13 +239,13 @@ static void HorizontalUnfilter(const uint8_t* prev, const uint8_t* in, _mm_storel_epi64((__m128i*)(out + i), A7); last = _mm_srli_epi64(A7, 56); } - for (; i < width; ++i) out[i] = in[i] + out[i - 1]; + for (; i < width; ++i) out[i] = (uint8_t)(in[i] + out[i - 1]); } -static void VerticalUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void VerticalUnfilter_SSE2(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { if (prev == NULL) { - HorizontalUnfilter(NULL, in, out, width); + HorizontalUnfilter_SSE2(NULL, in, out, width); } else { int i; const int max_pos = width & ~31; @@ -256,13 +260,13 @@ static void VerticalUnfilter(const uint8_t* prev, const uint8_t* in, _mm_storeu_si128((__m128i*)&out[i + 0], C0); _mm_storeu_si128((__m128i*)&out[i + 16], C1); } - for (; i < width; ++i) out[i] = in[i] + prev[i]; + for (; i < width; ++i) out[i] = (uint8_t)(in[i] + prev[i]); } } -static void GradientPredictInverse(const uint8_t* const in, - const uint8_t* const top, - uint8_t* const row, int length) { +static void GradientPredictInverse_SSE2(const uint8_t* const in, + const uint8_t* const top, + uint8_t* const row, int length) { if (length > 0) { int i; const int max_pos = length & ~7; @@ -293,18 +297,19 @@ static void GradientPredictInverse(const uint8_t* const in, _mm_storel_epi64((__m128i*)&row[i], out); } for (; i < length; ++i) { - row[i] = in[i] + GradientPredictorC(row[i - 1], top[i], top[i - 1]); + const int delta = GradientPredictor_SSE2(row[i - 1], top[i], top[i - 1]); + row[i] = (uint8_t)(in[i] + delta); } } } -static void GradientUnfilter(const uint8_t* prev, const uint8_t* in, - uint8_t* out, int width) { +static void GradientUnfilter_SSE2(const uint8_t* prev, const uint8_t* in, + uint8_t* out, int width) { if (prev == NULL) { - HorizontalUnfilter(NULL, in, out, width); + HorizontalUnfilter_SSE2(NULL, in, out, width); } else { - out[0] = in[0] + prev[0]; // predict from above - GradientPredictInverse(in + 1, prev + 1, out + 1, width - 1); + out[0] = (uint8_t)(in[0] + prev[0]); // predict from above + GradientPredictInverse_SSE2(in + 1, prev + 1, out + 1, width - 1); } } @@ -314,13 +319,13 @@ static void GradientUnfilter(const uint8_t* prev, const uint8_t* in, extern void VP8FiltersInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInitSSE2(void) { - WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter; - WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter; - WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter; + WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_SSE2; + WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_SSE2; + WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter_SSE2; - WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter; - WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter; - WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter; + WebPFilters[WEBP_FILTER_HORIZONTAL] = HorizontalFilter_SSE2; + WebPFilters[WEBP_FILTER_VERTICAL] = VerticalFilter_SSE2; + WebPFilters[WEBP_FILTER_GRADIENT] = GradientFilter_SSE2; } #else // !WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/lossless.c b/Pods/libwebp/src/dsp/lossless.c index 20d18f6..aad5f43 100644 --- a/Pods/libwebp/src/dsp/lossless.c +++ b/Pods/libwebp/src/dsp/lossless.c @@ -13,16 +13,15 @@ // Jyrki Alakuijala (jyrki@google.com) // Urvang Joshi (urvang@google.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" +#include #include #include -#include "../dec/vp8li_dec.h" -#include "../utils/endian_inl_utils.h" -#include "./lossless.h" -#include "./lossless_common.h" - -#define MAX_DIFF_COST (1e30f) +#include "src/dec/vp8li_dec.h" +#include "src/utils/endian_inl_utils.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" //------------------------------------------------------------------------------ // Image transforms. @@ -80,8 +79,9 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b; } -// gcc-4.9 on ARM generates incorrect code in Select() when Sub3() is inlined. -#if defined(__arm__) && LOCAL_GCC_VERSION == 0x409 +// gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is +// inlined. +#if defined(__arm__) && defined(__GNUC__) && LOCAL_GCC_VERSION <= 0x409 # define LOCAL_INLINE __attribute__ ((noinline)) #else # define LOCAL_INLINE WEBP_INLINE @@ -107,99 +107,104 @@ static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) { //------------------------------------------------------------------------------ // Predictors -static uint32_t Predictor0(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor0_C(uint32_t left, const uint32_t* const top) { (void)top; (void)left; return ARGB_BLACK; } -static uint32_t Predictor1(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor1_C(uint32_t left, const uint32_t* const top) { (void)top; return left; } -static uint32_t Predictor2(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor2_C(uint32_t left, const uint32_t* const top) { (void)left; return top[0]; } -static uint32_t Predictor3(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor3_C(uint32_t left, const uint32_t* const top) { (void)left; return top[1]; } -static uint32_t Predictor4(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor4_C(uint32_t left, const uint32_t* const top) { (void)left; return top[-1]; } -static uint32_t Predictor5(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor5_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Average3(left, top[0], top[1]); return pred; } -static uint32_t Predictor6(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor6_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Average2(left, top[-1]); return pred; } -static uint32_t Predictor7(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor7_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Average2(left, top[0]); return pred; } -static uint32_t Predictor8(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor8_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Average2(top[-1], top[0]); (void)left; return pred; } -static uint32_t Predictor9(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor9_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Average2(top[0], top[1]); (void)left; return pred; } -static uint32_t Predictor10(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor10_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Average4(left, top[-1], top[0], top[1]); return pred; } -static uint32_t Predictor11(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor11_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = Select(top[0], left, top[-1]); return pred; } -static uint32_t Predictor12(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor12_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = ClampedAddSubtractFull(left, top[0], top[-1]); return pred; } -static uint32_t Predictor13(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor13_C(uint32_t left, const uint32_t* const top) { const uint32_t pred = ClampedAddSubtractHalf(left, top[0], top[-1]); return pred; } -GENERATE_PREDICTOR_ADD(Predictor0, PredictorAdd0) -static void PredictorAdd1(const uint32_t* in, const uint32_t* upper, - int num_pixels, uint32_t* out) { +static void PredictorAdd0_C(const uint32_t* in, const uint32_t* upper, + int num_pixels, uint32_t* out) { + int x; + (void)upper; + for (x = 0; x < num_pixels; ++x) out[x] = VP8LAddPixels(in[x], ARGB_BLACK); +} +static void PredictorAdd1_C(const uint32_t* in, const uint32_t* upper, + int num_pixels, uint32_t* out) { int i; uint32_t left = out[-1]; + (void)upper; for (i = 0; i < num_pixels; ++i) { out[i] = left = VP8LAddPixels(in[i], left); } - (void)upper; } -GENERATE_PREDICTOR_ADD(Predictor2, PredictorAdd2) -GENERATE_PREDICTOR_ADD(Predictor3, PredictorAdd3) -GENERATE_PREDICTOR_ADD(Predictor4, PredictorAdd4) -GENERATE_PREDICTOR_ADD(Predictor5, PredictorAdd5) -GENERATE_PREDICTOR_ADD(Predictor6, PredictorAdd6) -GENERATE_PREDICTOR_ADD(Predictor7, PredictorAdd7) -GENERATE_PREDICTOR_ADD(Predictor8, PredictorAdd8) -GENERATE_PREDICTOR_ADD(Predictor9, PredictorAdd9) -GENERATE_PREDICTOR_ADD(Predictor10, PredictorAdd10) -GENERATE_PREDICTOR_ADD(Predictor11, PredictorAdd11) -GENERATE_PREDICTOR_ADD(Predictor12, PredictorAdd12) -GENERATE_PREDICTOR_ADD(Predictor13, PredictorAdd13) +GENERATE_PREDICTOR_ADD(Predictor2_C, PredictorAdd2_C) +GENERATE_PREDICTOR_ADD(Predictor3_C, PredictorAdd3_C) +GENERATE_PREDICTOR_ADD(Predictor4_C, PredictorAdd4_C) +GENERATE_PREDICTOR_ADD(Predictor5_C, PredictorAdd5_C) +GENERATE_PREDICTOR_ADD(Predictor6_C, PredictorAdd6_C) +GENERATE_PREDICTOR_ADD(Predictor7_C, PredictorAdd7_C) +GENERATE_PREDICTOR_ADD(Predictor8_C, PredictorAdd8_C) +GENERATE_PREDICTOR_ADD(Predictor9_C, PredictorAdd9_C) +GENERATE_PREDICTOR_ADD(Predictor10_C, PredictorAdd10_C) +GENERATE_PREDICTOR_ADD(Predictor11_C, PredictorAdd11_C) +GENERATE_PREDICTOR_ADD(Predictor12_C, PredictorAdd12_C) +GENERATE_PREDICTOR_ADD(Predictor13_C, PredictorAdd13_C) //------------------------------------------------------------------------------ // Inverse prediction. -static void PredictorInverseTransform(const VP8LTransform* const transform, - int y_start, int y_end, - const uint32_t* in, uint32_t* out) { +static void PredictorInverseTransform_C(const VP8LTransform* const transform, + int y_start, int y_end, + const uint32_t* in, uint32_t* out) { const int width = transform->xsize_; if (y_start == 0) { // First Row follows the L (mode=1) mode. - PredictorAdd0(in, NULL, 1, out); - PredictorAdd1(in + 1, NULL, width - 1, out + 1); + PredictorAdd0_C(in, NULL, 1, out); + PredictorAdd1_C(in + 1, NULL, width - 1, out + 1); in += width; out += width; ++y_start; @@ -217,7 +222,7 @@ static void PredictorInverseTransform(const VP8LTransform* const transform, const uint32_t* pred_mode_src = pred_mode_base; int x = 1; // First pixel follows the T (mode=2) mode. - PredictorAdd2(in, out - width, 1, out); + PredictorAdd2_C(in, out - width, 1, out); // .. the rest: while (x < width) { const VP8LPredictorAddSubFunc pred_func = @@ -270,23 +275,23 @@ void VP8LTransformColorInverse_C(const VP8LMultipliers* const m, int i; for (i = 0; i < num_pixels; ++i) { const uint32_t argb = src[i]; - const uint32_t green = argb >> 8; + const int8_t green = (int8_t)(argb >> 8); const uint32_t red = argb >> 16; - int new_red = red; - int new_blue = argb; + int new_red = red & 0xff; + int new_blue = argb & 0xff; new_red += ColorTransformDelta(m->green_to_red_, green); new_red &= 0xff; new_blue += ColorTransformDelta(m->green_to_blue_, green); - new_blue += ColorTransformDelta(m->red_to_blue_, new_red); + new_blue += ColorTransformDelta(m->red_to_blue_, (int8_t)new_red); new_blue &= 0xff; dst[i] = (argb & 0xff00ff00u) | (new_red << 16) | (new_blue); } } // Color space inverse transform. -static void ColorSpaceInverseTransform(const VP8LTransform* const transform, - int y_start, int y_end, - const uint32_t* src, uint32_t* dst) { +static void ColorSpaceInverseTransform_C(const VP8LTransform* const transform, + int y_start, int y_end, + const uint32_t* src, uint32_t* dst) { const int width = transform->xsize_; const int tile_width = 1 << transform->bits_; const int mask = tile_width - 1; @@ -362,10 +367,10 @@ STATIC_DECL void FUNC_NAME(const VP8LTransform* const transform, \ } \ } -COLOR_INDEX_INVERSE(ColorIndexInverseTransform, MapARGB, static, uint32_t, 32b, - VP8GetARGBIndex, VP8GetARGBValue) -COLOR_INDEX_INVERSE(VP8LColorIndexInverseTransformAlpha, MapAlpha, , uint8_t, - 8b, VP8GetAlphaIndex, VP8GetAlphaValue) +COLOR_INDEX_INVERSE(ColorIndexInverseTransform_C, MapARGB_C, static, + uint32_t, 32b, VP8GetARGBIndex, VP8GetARGBValue) +COLOR_INDEX_INVERSE(VP8LColorIndexInverseTransformAlpha, MapAlpha_C, , + uint8_t, 8b, VP8GetAlphaIndex, VP8GetAlphaValue) #undef COLOR_INDEX_INVERSE @@ -380,7 +385,7 @@ void VP8LInverseTransform(const VP8LTransform* const transform, VP8LAddGreenToBlueAndRed(in, (row_end - row_start) * width, out); break; case PREDICTOR_TRANSFORM: - PredictorInverseTransform(transform, row_start, row_end, in, out); + PredictorInverseTransform_C(transform, row_start, row_end, in, out); if (row_end != transform->ysize_) { // The last predicted row in this iteration will be the top-pred row // for the first row in next iteration. @@ -389,7 +394,7 @@ void VP8LInverseTransform(const VP8LTransform* const transform, } break; case CROSS_COLOR_TRANSFORM: - ColorSpaceInverseTransform(transform, row_start, row_end, in, out); + ColorSpaceInverseTransform_C(transform, row_start, row_end, in, out); break; case COLOR_INDEXING_TRANSFORM: if (in == out && transform->bits_ > 0) { @@ -403,9 +408,9 @@ void VP8LInverseTransform(const VP8LTransform* const transform, VP8LSubSampleSize(transform->xsize_, transform->bits_); uint32_t* const src = out + out_stride - in_stride; memmove(src, out, in_stride * sizeof(*src)); - ColorIndexInverseTransform(transform, row_start, row_end, src, out); + ColorIndexInverseTransform_C(transform, row_start, row_end, src, out); } else { - ColorIndexInverseTransform(transform, row_start, row_end, in, out); + ColorIndexInverseTransform_C(transform, row_start, row_end, in, out); } break; } @@ -452,7 +457,7 @@ void VP8LConvertBGRAToRGBA4444_C(const uint32_t* src, const uint32_t argb = *src++; const uint8_t rg = ((argb >> 16) & 0xf0) | ((argb >> 12) & 0xf); const uint8_t ba = ((argb >> 0) & 0xf0) | ((argb >> 28) & 0xf); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) *dst++ = ba; *dst++ = rg; #else @@ -469,7 +474,7 @@ void VP8LConvertBGRAToRGB565_C(const uint32_t* src, const uint32_t argb = *src++; const uint8_t rg = ((argb >> 16) & 0xf8) | ((argb >> 13) & 0x7); const uint8_t gb = ((argb >> 5) & 0xe0) | ((argb >> 3) & 0x1f); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) *dst++ = gb; *dst++ = rg; #else @@ -496,22 +501,7 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst, const uint32_t* const src_end = src + num_pixels; while (src < src_end) { const uint32_t argb = *src++; - -#if !defined(WORDS_BIGENDIAN) -#if !defined(WEBP_REFERENCE_IMPLEMENTATION) WebPUint32ToMem(dst, BSwap32(argb)); -#else // WEBP_REFERENCE_IMPLEMENTATION - dst[0] = (argb >> 24) & 0xff; - dst[1] = (argb >> 16) & 0xff; - dst[2] = (argb >> 8) & 0xff; - dst[3] = (argb >> 0) & 0xff; -#endif -#else // WORDS_BIGENDIAN - dst[0] = (argb >> 0) & 0xff; - dst[1] = (argb >> 8) & 0xff; - dst[2] = (argb >> 16) & 0xff; - dst[3] = (argb >> 24) & 0xff; -#endif dst += sizeof(argb); } } else { @@ -590,48 +580,46 @@ extern void VP8LDspInitNEON(void); extern void VP8LDspInitMIPSdspR2(void); extern void VP8LDspInitMSA(void); -static volatile VP8CPUInfo lossless_last_cpuinfo_used = - (VP8CPUInfo)&lossless_last_cpuinfo_used; - -#define COPY_PREDICTOR_ARRAY(IN, OUT) do { \ - (OUT)[0] = IN##0; \ - (OUT)[1] = IN##1; \ - (OUT)[2] = IN##2; \ - (OUT)[3] = IN##3; \ - (OUT)[4] = IN##4; \ - (OUT)[5] = IN##5; \ - (OUT)[6] = IN##6; \ - (OUT)[7] = IN##7; \ - (OUT)[8] = IN##8; \ - (OUT)[9] = IN##9; \ - (OUT)[10] = IN##10; \ - (OUT)[11] = IN##11; \ - (OUT)[12] = IN##12; \ - (OUT)[13] = IN##13; \ - (OUT)[14] = IN##0; /* <- padding security sentinels*/ \ - (OUT)[15] = IN##0; \ +#define COPY_PREDICTOR_ARRAY(IN, OUT) do { \ + (OUT)[0] = IN##0_C; \ + (OUT)[1] = IN##1_C; \ + (OUT)[2] = IN##2_C; \ + (OUT)[3] = IN##3_C; \ + (OUT)[4] = IN##4_C; \ + (OUT)[5] = IN##5_C; \ + (OUT)[6] = IN##6_C; \ + (OUT)[7] = IN##7_C; \ + (OUT)[8] = IN##8_C; \ + (OUT)[9] = IN##9_C; \ + (OUT)[10] = IN##10_C; \ + (OUT)[11] = IN##11_C; \ + (OUT)[12] = IN##12_C; \ + (OUT)[13] = IN##13_C; \ + (OUT)[14] = IN##0_C; /* <- padding security sentinels*/ \ + (OUT)[15] = IN##0_C; \ } while (0); -WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) { - if (lossless_last_cpuinfo_used == VP8GetCPUInfo) return; - +WEBP_DSP_INIT_FUNC(VP8LDspInit) { COPY_PREDICTOR_ARRAY(Predictor, VP8LPredictors) COPY_PREDICTOR_ARRAY(Predictor, VP8LPredictors_C) COPY_PREDICTOR_ARRAY(PredictorAdd, VP8LPredictorsAdd) COPY_PREDICTOR_ARRAY(PredictorAdd, VP8LPredictorsAdd_C) +#if !WEBP_NEON_OMIT_C_CODE VP8LAddGreenToBlueAndRed = VP8LAddGreenToBlueAndRed_C; VP8LTransformColorInverse = VP8LTransformColorInverse_C; - VP8LConvertBGRAToRGB = VP8LConvertBGRAToRGB_C; VP8LConvertBGRAToRGBA = VP8LConvertBGRAToRGBA_C; + VP8LConvertBGRAToRGB = VP8LConvertBGRAToRGB_C; + VP8LConvertBGRAToBGR = VP8LConvertBGRAToBGR_C; +#endif + VP8LConvertBGRAToRGBA4444 = VP8LConvertBGRAToRGBA4444_C; VP8LConvertBGRAToRGB565 = VP8LConvertBGRAToRGB565_C; - VP8LConvertBGRAToBGR = VP8LConvertBGRAToBGR_C; - VP8LMapColor32b = MapARGB; - VP8LMapColor8b = MapAlpha; + VP8LMapColor32b = MapARGB_C; + VP8LMapColor8b = MapAlpha_C; // If defined, use CPUInfo() to overwrite some pointers with faster versions. if (VP8GetCPUInfo != NULL) { @@ -640,11 +628,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) { VP8LDspInitSSE2(); } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - VP8LDspInitNEON(); - } -#endif #if defined(WEBP_USE_MIPS_DSP_R2) if (VP8GetCPUInfo(kMIPSdspR2)) { VP8LDspInitMIPSdspR2(); @@ -656,7 +639,23 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) { } #endif } - lossless_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + VP8LDspInitNEON(); + } +#endif + + assert(VP8LAddGreenToBlueAndRed != NULL); + assert(VP8LTransformColorInverse != NULL); + assert(VP8LConvertBGRAToRGBA != NULL); + assert(VP8LConvertBGRAToRGB != NULL); + assert(VP8LConvertBGRAToBGR != NULL); + assert(VP8LConvertBGRAToRGBA4444 != NULL); + assert(VP8LConvertBGRAToRGB565 != NULL); + assert(VP8LMapColor32b != NULL); + assert(VP8LMapColor8b != NULL); } #undef COPY_PREDICTOR_ARRAY diff --git a/Pods/libwebp/src/dsp/lossless.h b/Pods/libwebp/src/dsp/lossless.h index 352a54e..f709cc8 100644 --- a/Pods/libwebp/src/dsp/lossless.h +++ b/Pods/libwebp/src/dsp/lossless.h @@ -15,20 +15,16 @@ #ifndef WEBP_DSP_LOSSLESS_H_ #define WEBP_DSP_LOSSLESS_H_ -#include "../webp/types.h" -#include "../webp/decode.h" +#include "src/webp/types.h" +#include "src/webp/decode.h" -#include "../enc/histogram_enc.h" -#include "../utils/utils.h" +#include "src/enc/histogram_enc.h" +#include "src/utils/utils.h" #ifdef __cplusplus extern "C" { #endif -#ifdef WEBP_EXPERIMENTAL_FEATURES -#include "../enc/delta_palettization_enc.h" -#endif // WEBP_EXPERIMENTAL_FEATURES - //------------------------------------------------------------------------------ // Decoding @@ -124,7 +120,7 @@ void VP8LDspInit(void); typedef void (*VP8LProcessEncBlueAndRedFunc)(uint32_t* dst, int num_pixels); extern VP8LProcessEncBlueAndRedFunc VP8LSubtractGreenFromBlueAndRed; typedef void (*VP8LTransformColorFunc)(const VP8LMultipliers* const m, - uint32_t* const dst, int num_pixels); + uint32_t* dst, int num_pixels); extern VP8LTransformColorFunc VP8LTransformColor; typedef void (*VP8LCollectColorBlueTransformsFunc)( const uint32_t* argb, int stride, @@ -167,7 +163,7 @@ extern VP8LCostCombinedFunc VP8LExtraCostCombined; extern VP8LCombinedShannonEntropyFunc VP8LCombinedShannonEntropy; typedef struct { // small struct to hold counters - int counts[2]; // index: 0=zero steak, 1=non-zero streak + int counts[2]; // index: 0=zero streak, 1=non-zero streak int streaks[2][2]; // [zero/non-zero][streak<3 / streak>=3] } VP8LStreaks; @@ -198,10 +194,14 @@ extern VP8LGetEntropyUnrefinedFunc VP8LGetEntropyUnrefined; void VP8LBitsEntropyUnrefined(const uint32_t* const array, int n, VP8LBitEntropy* const entropy); -typedef void (*VP8LHistogramAddFunc)(const VP8LHistogram* const a, - const VP8LHistogram* const b, - VP8LHistogram* const out); -extern VP8LHistogramAddFunc VP8LHistogramAdd; +typedef void (*VP8LAddVectorFunc)(const uint32_t* a, const uint32_t* b, + uint32_t* out, int size); +extern VP8LAddVectorFunc VP8LAddVector; +typedef void (*VP8LAddVectorEqFunc)(const uint32_t* a, uint32_t* out, int size); +extern VP8LAddVectorEqFunc VP8LAddVectorEq; +void VP8LHistogramAdd(const VP8LHistogram* const a, + const VP8LHistogram* const b, + VP8LHistogram* const out); // ----------------------------------------------------------------------------- // PrefixEncode() diff --git a/Pods/libwebp/src/dsp/lossless_common.h b/Pods/libwebp/src/dsp/lossless_common.h index c40f711..9c2ebe6 100644 --- a/Pods/libwebp/src/dsp/lossless_common.h +++ b/Pods/libwebp/src/dsp/lossless_common.h @@ -16,9 +16,9 @@ #ifndef WEBP_DSP_LOSSLESS_COMMON_H_ #define WEBP_DSP_LOSSLESS_COMMON_H_ -#include "../webp/types.h" +#include "src/webp/types.h" -#include "../utils/utils.h" +#include "src/utils/utils.h" #ifdef __cplusplus extern "C" { @@ -93,14 +93,6 @@ static WEBP_INLINE float VP8LFastSLog2(uint32_t v) { // ----------------------------------------------------------------------------- // PrefixEncode() -static WEBP_INLINE int VP8LBitsLog2Ceiling(uint32_t n) { - const int log_floor = BitsLog2Floor(n); - if (n == (n & ~(n - 1))) { // zero or a power of two. - return log_floor; - } - return log_floor + 1; -} - // Splitting of distance and length codes into prefixes and // extra bits. The prefixes are encoded with an entropy code // while the extra bits are stored just as normal bits. @@ -185,6 +177,7 @@ uint32_t VP8LSubPixels(uint32_t a, uint32_t b) { static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \ int num_pixels, uint32_t* out) { \ int x; \ + assert(upper != NULL); \ for (x = 0; x < num_pixels; ++x) { \ const uint32_t pred = (PREDICTOR)(out[x - 1], upper + x); \ out[x] = VP8LAddPixels(in[x], pred); \ @@ -197,6 +190,7 @@ static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \ static void PREDICTOR_SUB(const uint32_t* in, const uint32_t* upper, \ int num_pixels, uint32_t* out) { \ int x; \ + assert(upper != NULL); \ for (x = 0; x < num_pixels; ++x) { \ const uint32_t pred = (PREDICTOR)(in[x - 1], upper + x); \ out[x] = VP8LSubPixels(in[x], pred); \ diff --git a/Pods/libwebp/src/dsp/lossless_enc.c b/Pods/libwebp/src/dsp/lossless_enc.c index 4e46fba..9c36055 100644 --- a/Pods/libwebp/src/dsp/lossless_enc.c +++ b/Pods/libwebp/src/dsp/lossless_enc.c @@ -13,15 +13,16 @@ // Jyrki Alakuijala (jyrki@google.com) // Urvang Joshi (urvang@google.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" +#include #include #include -#include "../dec/vp8li_dec.h" -#include "../utils/endian_inl_utils.h" -#include "./lossless.h" -#include "./lossless_common.h" -#include "./yuv.h" +#include "src/dec/vp8li_dec.h" +#include "src/utils/endian_inl_utils.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" +#include "src/dsp/yuv.h" // lookup table for small values of log2(int) const float kLog2Table[LOG_LOOKUP_IDX_MAX] = { @@ -325,7 +326,7 @@ const uint8_t kPrefixEncodeExtraBitsValue[PREFIX_LOOKUP_IDX_MAX] = { 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126 }; -static float FastSLog2Slow(uint32_t v) { +static float FastSLog2Slow_C(uint32_t v) { assert(v >= LOG_LOOKUP_IDX_MAX); if (v < APPROX_LOG_WITH_CORRECTION_MAX) { int log_cnt = 0; @@ -351,7 +352,7 @@ static float FastSLog2Slow(uint32_t v) { } } -static float FastLog2Slow(uint32_t v) { +static float FastLog2Slow_C(uint32_t v) { assert(v >= LOG_LOOKUP_IDX_MAX); if (v < APPROX_LOG_WITH_CORRECTION_MAX) { int log_cnt = 0; @@ -380,7 +381,7 @@ static float FastLog2Slow(uint32_t v) { // Methods to calculate Entropy (Shannon). // Compute the combined Shanon's entropy for distribution {X} and {X+Y} -static float CombinedShannonEntropy(const int X[256], const int Y[256]) { +static float CombinedShannonEntropy_C(const int X[256], const int Y[256]) { int i; double retval = 0.; int sumX = 0, sumXY = 0; @@ -453,9 +454,9 @@ static WEBP_INLINE void GetEntropyUnrefinedHelper( *i_prev = i; } -static void GetEntropyUnrefined(const uint32_t X[], int length, - VP8LBitEntropy* const bit_entropy, - VP8LStreaks* const stats) { +static void GetEntropyUnrefined_C(const uint32_t X[], int length, + VP8LBitEntropy* const bit_entropy, + VP8LStreaks* const stats) { int i; int i_prev = 0; uint32_t x_prev = X[0]; @@ -474,10 +475,11 @@ static void GetEntropyUnrefined(const uint32_t X[], int length, bit_entropy->entropy += VP8LFastSLog2(bit_entropy->sum); } -static void GetCombinedEntropyUnrefined(const uint32_t X[], const uint32_t Y[], - int length, - VP8LBitEntropy* const bit_entropy, - VP8LStreaks* const stats) { +static void GetCombinedEntropyUnrefined_C(const uint32_t X[], + const uint32_t Y[], + int length, + VP8LBitEntropy* const bit_entropy, + VP8LStreaks* const stats) { int i = 1; int i_prev = 0; uint32_t xy_prev = X[0] + Y[0]; @@ -513,15 +515,19 @@ static WEBP_INLINE int ColorTransformDelta(int8_t color_pred, int8_t color) { return ((int)color_pred * color) >> 5; } +static WEBP_INLINE int8_t U32ToS8(uint32_t v) { + return (int8_t)(v & 0xff); +} + void VP8LTransformColor_C(const VP8LMultipliers* const m, uint32_t* data, int num_pixels) { int i; for (i = 0; i < num_pixels; ++i) { const uint32_t argb = data[i]; - const uint32_t green = argb >> 8; - const uint32_t red = argb >> 16; - int new_red = red; - int new_blue = argb; + const int8_t green = U32ToS8(argb >> 8); + const int8_t red = U32ToS8(argb >> 16); + int new_red = red & 0xff; + int new_blue = argb & 0xff; new_red -= ColorTransformDelta(m->green_to_red_, green); new_red &= 0xff; new_blue -= ColorTransformDelta(m->green_to_blue_, green); @@ -533,7 +539,7 @@ void VP8LTransformColor_C(const VP8LMultipliers* const m, uint32_t* data, static WEBP_INLINE uint8_t TransformColorRed(uint8_t green_to_red, uint32_t argb) { - const uint32_t green = argb >> 8; + const int8_t green = U32ToS8(argb >> 8); int new_red = argb >> 16; new_red -= ColorTransformDelta(green_to_red, green); return (new_red & 0xff); @@ -542,9 +548,9 @@ static WEBP_INLINE uint8_t TransformColorRed(uint8_t green_to_red, static WEBP_INLINE uint8_t TransformColorBlue(uint8_t green_to_blue, uint8_t red_to_blue, uint32_t argb) { - const uint32_t green = argb >> 8; - const uint32_t red = argb >> 16; - uint8_t new_blue = argb; + const int8_t green = U32ToS8(argb >> 8); + const int8_t red = U32ToS8(argb >> 16); + uint8_t new_blue = argb & 0xff; new_blue -= ColorTransformDelta(green_to_blue, green); new_blue -= ColorTransformDelta(red_to_blue, red); return (new_blue & 0xff); @@ -556,7 +562,7 @@ void VP8LCollectColorRedTransforms_C(const uint32_t* argb, int stride, while (tile_height-- > 0) { int x; for (x = 0; x < tile_width; ++x) { - ++histo[TransformColorRed(green_to_red, argb[x])]; + ++histo[TransformColorRed((uint8_t)green_to_red, argb[x])]; } argb += stride; } @@ -569,7 +575,8 @@ void VP8LCollectColorBlueTransforms_C(const uint32_t* argb, int stride, while (tile_height-- > 0) { int x; for (x = 0; x < tile_width; ++x) { - ++histo[TransformColorBlue(green_to_blue, red_to_blue, argb[x])]; + ++histo[TransformColorBlue((uint8_t)green_to_blue, (uint8_t)red_to_blue, + argb[x])]; } argb += stride; } @@ -577,8 +584,8 @@ void VP8LCollectColorBlueTransforms_C(const uint32_t* argb, int stride, //------------------------------------------------------------------------------ -static int VectorMismatch(const uint32_t* const array1, - const uint32_t* const array2, int length) { +static int VectorMismatch_C(const uint32_t* const array1, + const uint32_t* const array2, int length) { int match_len = 0; while (match_len < length && array1[match_len] == array2[match_len]) { @@ -610,15 +617,15 @@ void VP8LBundleColorMap_C(const uint8_t* const row, int width, int xbits, //------------------------------------------------------------------------------ -static double ExtraCost(const uint32_t* population, int length) { +static double ExtraCost_C(const uint32_t* population, int length) { int i; double cost = 0.; for (i = 2; i < length - 2; ++i) cost += (i >> 1) * population[i + 2]; return cost; } -static double ExtraCostCombined(const uint32_t* X, const uint32_t* Y, - int length) { +static double ExtraCostCombined_C(const uint32_t* X, const uint32_t* Y, + int length) { int i; double cost = 0.; for (i = 2; i < length - 2; ++i) { @@ -630,38 +637,67 @@ static double ExtraCostCombined(const uint32_t* X, const uint32_t* Y, //------------------------------------------------------------------------------ -static void HistogramAdd(const VP8LHistogram* const a, - const VP8LHistogram* const b, - VP8LHistogram* const out) { +static void AddVector_C(const uint32_t* a, const uint32_t* b, uint32_t* out, + int size) { + int i; + for (i = 0; i < size; ++i) out[i] = a[i] + b[i]; +} + +static void AddVectorEq_C(const uint32_t* a, uint32_t* out, int size) { + int i; + for (i = 0; i < size; ++i) out[i] += a[i]; +} + +#define ADD(X, ARG, LEN) do { \ + if (a->is_used_[X]) { \ + if (b->is_used_[X]) { \ + VP8LAddVector(a->ARG, b->ARG, out->ARG, (LEN)); \ + } else { \ + memcpy(&out->ARG[0], &a->ARG[0], (LEN) * sizeof(out->ARG[0])); \ + } \ + } else if (b->is_used_[X]) { \ + memcpy(&out->ARG[0], &b->ARG[0], (LEN) * sizeof(out->ARG[0])); \ + } else { \ + memset(&out->ARG[0], 0, (LEN) * sizeof(out->ARG[0])); \ + } \ +} while (0) + +#define ADD_EQ(X, ARG, LEN) do { \ + if (a->is_used_[X]) { \ + if (out->is_used_[X]) { \ + VP8LAddVectorEq(a->ARG, out->ARG, (LEN)); \ + } else { \ + memcpy(&out->ARG[0], &a->ARG[0], (LEN) * sizeof(out->ARG[0])); \ + } \ + } \ +} while (0) + +void VP8LHistogramAdd(const VP8LHistogram* const a, + const VP8LHistogram* const b, VP8LHistogram* const out) { int i; const int literal_size = VP8LHistogramNumCodes(a->palette_code_bits_); assert(a->palette_code_bits_ == b->palette_code_bits_); + if (b != out) { - for (i = 0; i < literal_size; ++i) { - out->literal_[i] = a->literal_[i] + b->literal_[i]; - } - for (i = 0; i < NUM_DISTANCE_CODES; ++i) { - out->distance_[i] = a->distance_[i] + b->distance_[i]; - } - for (i = 0; i < NUM_LITERAL_CODES; ++i) { - out->red_[i] = a->red_[i] + b->red_[i]; - out->blue_[i] = a->blue_[i] + b->blue_[i]; - out->alpha_[i] = a->alpha_[i] + b->alpha_[i]; + ADD(0, literal_, literal_size); + ADD(1, red_, NUM_LITERAL_CODES); + ADD(2, blue_, NUM_LITERAL_CODES); + ADD(3, alpha_, NUM_LITERAL_CODES); + ADD(4, distance_, NUM_DISTANCE_CODES); + for (i = 0; i < 5; ++i) { + out->is_used_[i] = (a->is_used_[i] | b->is_used_[i]); } } else { - for (i = 0; i < literal_size; ++i) { - out->literal_[i] += a->literal_[i]; - } - for (i = 0; i < NUM_DISTANCE_CODES; ++i) { - out->distance_[i] += a->distance_[i]; - } - for (i = 0; i < NUM_LITERAL_CODES; ++i) { - out->red_[i] += a->red_[i]; - out->blue_[i] += a->blue_[i]; - out->alpha_[i] += a->alpha_[i]; - } + ADD_EQ(0, literal_, literal_size); + ADD_EQ(1, red_, NUM_LITERAL_CODES); + ADD_EQ(2, blue_, NUM_LITERAL_CODES); + ADD_EQ(3, alpha_, NUM_LITERAL_CODES); + ADD_EQ(4, distance_, NUM_DISTANCE_CODES); + for (i = 0; i < 5; ++i) out->is_used_[i] |= a->is_used_[i]; } } +#undef ADD +#undef ADD_EQ //------------------------------------------------------------------------------ // Image transforms. @@ -846,7 +882,8 @@ VP8LCombinedShannonEntropyFunc VP8LCombinedShannonEntropy; VP8LGetEntropyUnrefinedFunc VP8LGetEntropyUnrefined; VP8LGetCombinedEntropyUnrefinedFunc VP8LGetCombinedEntropyUnrefined; -VP8LHistogramAddFunc VP8LHistogramAdd; +VP8LAddVectorFunc VP8LAddVector; +VP8LAddVectorEqFunc VP8LAddVectorEq; VP8LVectorMismatchFunc VP8LVectorMismatch; VP8LBundleColorMapFunc VP8LBundleColorMap; @@ -861,34 +898,32 @@ extern void VP8LEncDspInitMIPS32(void); extern void VP8LEncDspInitMIPSdspR2(void); extern void VP8LEncDspInitMSA(void); -static volatile VP8CPUInfo lossless_enc_last_cpuinfo_used = - (VP8CPUInfo)&lossless_enc_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInit(void) { - if (lossless_enc_last_cpuinfo_used == VP8GetCPUInfo) return; - +WEBP_DSP_INIT_FUNC(VP8LEncDspInit) { VP8LDspInit(); +#if !WEBP_NEON_OMIT_C_CODE VP8LSubtractGreenFromBlueAndRed = VP8LSubtractGreenFromBlueAndRed_C; VP8LTransformColor = VP8LTransformColor_C; +#endif VP8LCollectColorBlueTransforms = VP8LCollectColorBlueTransforms_C; VP8LCollectColorRedTransforms = VP8LCollectColorRedTransforms_C; - VP8LFastLog2Slow = FastLog2Slow; - VP8LFastSLog2Slow = FastSLog2Slow; + VP8LFastLog2Slow = FastLog2Slow_C; + VP8LFastSLog2Slow = FastSLog2Slow_C; - VP8LExtraCost = ExtraCost; - VP8LExtraCostCombined = ExtraCostCombined; - VP8LCombinedShannonEntropy = CombinedShannonEntropy; + VP8LExtraCost = ExtraCost_C; + VP8LExtraCostCombined = ExtraCostCombined_C; + VP8LCombinedShannonEntropy = CombinedShannonEntropy_C; - VP8LGetEntropyUnrefined = GetEntropyUnrefined; - VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined; + VP8LGetEntropyUnrefined = GetEntropyUnrefined_C; + VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined_C; - VP8LHistogramAdd = HistogramAdd; + VP8LAddVector = AddVector_C; + VP8LAddVectorEq = AddVectorEq_C; - VP8LVectorMismatch = VectorMismatch; + VP8LVectorMismatch = VectorMismatch_C; VP8LBundleColorMap = VP8LBundleColorMap_C; VP8LPredictorsSub[0] = PredictorSub0_C; @@ -937,11 +972,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInit(void) { #endif } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - VP8LEncDspInitNEON(); - } -#endif #if defined(WEBP_USE_MIPS32) if (VP8GetCPUInfo(kMIPS32)) { VP8LEncDspInitMIPS32(); @@ -958,7 +988,61 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInit(void) { } #endif } - lossless_enc_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + VP8LEncDspInitNEON(); + } +#endif + + assert(VP8LSubtractGreenFromBlueAndRed != NULL); + assert(VP8LTransformColor != NULL); + assert(VP8LCollectColorBlueTransforms != NULL); + assert(VP8LCollectColorRedTransforms != NULL); + assert(VP8LFastLog2Slow != NULL); + assert(VP8LFastSLog2Slow != NULL); + assert(VP8LExtraCost != NULL); + assert(VP8LExtraCostCombined != NULL); + assert(VP8LCombinedShannonEntropy != NULL); + assert(VP8LGetEntropyUnrefined != NULL); + assert(VP8LGetCombinedEntropyUnrefined != NULL); + assert(VP8LAddVector != NULL); + assert(VP8LAddVectorEq != NULL); + assert(VP8LVectorMismatch != NULL); + assert(VP8LBundleColorMap != NULL); + assert(VP8LPredictorsSub[0] != NULL); + assert(VP8LPredictorsSub[1] != NULL); + assert(VP8LPredictorsSub[2] != NULL); + assert(VP8LPredictorsSub[3] != NULL); + assert(VP8LPredictorsSub[4] != NULL); + assert(VP8LPredictorsSub[5] != NULL); + assert(VP8LPredictorsSub[6] != NULL); + assert(VP8LPredictorsSub[7] != NULL); + assert(VP8LPredictorsSub[8] != NULL); + assert(VP8LPredictorsSub[9] != NULL); + assert(VP8LPredictorsSub[10] != NULL); + assert(VP8LPredictorsSub[11] != NULL); + assert(VP8LPredictorsSub[12] != NULL); + assert(VP8LPredictorsSub[13] != NULL); + assert(VP8LPredictorsSub[14] != NULL); + assert(VP8LPredictorsSub[15] != NULL); + assert(VP8LPredictorsSub_C[0] != NULL); + assert(VP8LPredictorsSub_C[1] != NULL); + assert(VP8LPredictorsSub_C[2] != NULL); + assert(VP8LPredictorsSub_C[3] != NULL); + assert(VP8LPredictorsSub_C[4] != NULL); + assert(VP8LPredictorsSub_C[5] != NULL); + assert(VP8LPredictorsSub_C[6] != NULL); + assert(VP8LPredictorsSub_C[7] != NULL); + assert(VP8LPredictorsSub_C[8] != NULL); + assert(VP8LPredictorsSub_C[9] != NULL); + assert(VP8LPredictorsSub_C[10] != NULL); + assert(VP8LPredictorsSub_C[11] != NULL); + assert(VP8LPredictorsSub_C[12] != NULL); + assert(VP8LPredictorsSub_C[13] != NULL); + assert(VP8LPredictorsSub_C[14] != NULL); + assert(VP8LPredictorsSub_C[15] != NULL); } //------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/dsp/lossless_enc_mips32.c b/Pods/libwebp/src/dsp/lossless_enc_mips32.c index 4186b9f..0412a09 100644 --- a/Pods/libwebp/src/dsp/lossless_enc_mips32.c +++ b/Pods/libwebp/src/dsp/lossless_enc_mips32.c @@ -12,9 +12,9 @@ // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) // Jovan Zelincevic (jovan.zelincevic@imgtec.com) -#include "./dsp.h" -#include "./lossless.h" -#include "./lossless_common.h" +#include "src/dsp/dsp.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" #if defined(WEBP_USE_MIPS32) @@ -23,7 +23,7 @@ #include #include -static float FastSLog2Slow(uint32_t v) { +static float FastSLog2Slow_MIPS32(uint32_t v) { assert(v >= LOG_LOOKUP_IDX_MAX); if (v < APPROX_LOG_WITH_CORRECTION_MAX) { uint32_t log_cnt, y, correction; @@ -59,7 +59,7 @@ static float FastSLog2Slow(uint32_t v) { } } -static float FastLog2Slow(uint32_t v) { +static float FastLog2Slow_MIPS32(uint32_t v) { assert(v >= LOG_LOOKUP_IDX_MAX); if (v < APPROX_LOG_WITH_CORRECTION_MAX) { uint32_t log_cnt, y; @@ -104,7 +104,7 @@ static float FastLog2Slow(uint32_t v) { // pop += 2; // } // return (double)cost; -static double ExtraCost(const uint32_t* const population, int length) { +static double ExtraCost_MIPS32(const uint32_t* const population, int length) { int i, temp0, temp1; const uint32_t* pop = &population[4]; const uint32_t* const LoopEnd = &population[length]; @@ -149,8 +149,8 @@ static double ExtraCost(const uint32_t* const population, int length) { // pY += 2; // } // return (double)cost; -static double ExtraCostCombined(const uint32_t* const X, - const uint32_t* const Y, int length) { +static double ExtraCostCombined_MIPS32(const uint32_t* const X, + const uint32_t* const Y, int length) { int i, temp0, temp1, temp2, temp3; const uint32_t* pX = &X[4]; const uint32_t* pY = &Y[4]; @@ -241,9 +241,9 @@ static WEBP_INLINE void GetEntropyUnrefinedHelper( *i_prev = i; } -static void GetEntropyUnrefined(const uint32_t X[], int length, - VP8LBitEntropy* const bit_entropy, - VP8LStreaks* const stats) { +static void GetEntropyUnrefined_MIPS32(const uint32_t X[], int length, + VP8LBitEntropy* const bit_entropy, + VP8LStreaks* const stats) { int i; int i_prev = 0; uint32_t x_prev = X[0]; @@ -262,26 +262,27 @@ static void GetEntropyUnrefined(const uint32_t X[], int length, bit_entropy->entropy += VP8LFastSLog2(bit_entropy->sum); } -static void GetCombinedEntropyUnrefined(const uint32_t X[], const uint32_t Y[], - int length, - VP8LBitEntropy* const bit_entropy, - VP8LStreaks* const stats) { +static void GetCombinedEntropyUnrefined_MIPS32(const uint32_t X[], + const uint32_t Y[], + int length, + VP8LBitEntropy* const entropy, + VP8LStreaks* const stats) { int i = 1; int i_prev = 0; uint32_t xy_prev = X[0] + Y[0]; memset(stats, 0, sizeof(*stats)); - VP8LBitEntropyInit(bit_entropy); + VP8LBitEntropyInit(entropy); for (i = 1; i < length; ++i) { const uint32_t xy = X[i] + Y[i]; if (xy != xy_prev) { - GetEntropyUnrefinedHelper(xy, i, &xy_prev, &i_prev, bit_entropy, stats); + GetEntropyUnrefinedHelper(xy, i, &xy_prev, &i_prev, entropy, stats); } } - GetEntropyUnrefinedHelper(0, i, &xy_prev, &i_prev, bit_entropy, stats); + GetEntropyUnrefinedHelper(0, i, &xy_prev, &i_prev, entropy, stats); - bit_entropy->entropy += VP8LFastSLog2(bit_entropy->sum); + entropy->entropy += VP8LFastSLog2(entropy->sum); } #define ASM_START \ @@ -343,65 +344,29 @@ static void GetCombinedEntropyUnrefined(const uint32_t X[], const uint32_t Y[], ASM_END_COMMON_0 \ ASM_END_COMMON_1 -#define ADD_VECTOR(A, B, OUT, SIZE, EXTRA_SIZE) do { \ - const uint32_t* pa = (const uint32_t*)(A); \ - const uint32_t* pb = (const uint32_t*)(B); \ - uint32_t* pout = (uint32_t*)(OUT); \ - const uint32_t* const LoopEnd = pa + (SIZE); \ - assert((SIZE) % 4 == 0); \ - ASM_START \ - ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout) \ - ASM_END_0 \ - if ((EXTRA_SIZE) > 0) { \ - const int last = (EXTRA_SIZE); \ - int i; \ - for (i = 0; i < last; ++i) pout[i] = pa[i] + pb[i]; \ - } \ -} while (0) - -#define ADD_VECTOR_EQ(A, OUT, SIZE, EXTRA_SIZE) do { \ - const uint32_t* pa = (const uint32_t*)(A); \ - uint32_t* pout = (uint32_t*)(OUT); \ - const uint32_t* const LoopEnd = pa + (SIZE); \ - assert((SIZE) % 4 == 0); \ - ASM_START \ - ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout) \ - ASM_END_1 \ - if ((EXTRA_SIZE) > 0) { \ - const int last = (EXTRA_SIZE); \ - int i; \ - for (i = 0; i < last; ++i) pout[i] += pa[i]; \ - } \ -} while (0) - -static void HistogramAdd(const VP8LHistogram* const a, - const VP8LHistogram* const b, - VP8LHistogram* const out) { +static void AddVector_MIPS32(const uint32_t* pa, const uint32_t* pb, + uint32_t* pout, int size) { uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; - const int extra_cache_size = VP8LHistogramNumCodes(a->palette_code_bits_) - - (NUM_LITERAL_CODES + NUM_LENGTH_CODES); - assert(a->palette_code_bits_ == b->palette_code_bits_); - - if (b != out) { - ADD_VECTOR(a->literal_, b->literal_, out->literal_, - NUM_LITERAL_CODES + NUM_LENGTH_CODES, extra_cache_size); - ADD_VECTOR(a->distance_, b->distance_, out->distance_, - NUM_DISTANCE_CODES, 0); - ADD_VECTOR(a->red_, b->red_, out->red_, NUM_LITERAL_CODES, 0); - ADD_VECTOR(a->blue_, b->blue_, out->blue_, NUM_LITERAL_CODES, 0); - ADD_VECTOR(a->alpha_, b->alpha_, out->alpha_, NUM_LITERAL_CODES, 0); - } else { - ADD_VECTOR_EQ(a->literal_, out->literal_, - NUM_LITERAL_CODES + NUM_LENGTH_CODES, extra_cache_size); - ADD_VECTOR_EQ(a->distance_, out->distance_, NUM_DISTANCE_CODES, 0); - ADD_VECTOR_EQ(a->red_, out->red_, NUM_LITERAL_CODES, 0); - ADD_VECTOR_EQ(a->blue_, out->blue_, NUM_LITERAL_CODES, 0); - ADD_VECTOR_EQ(a->alpha_, out->alpha_, NUM_LITERAL_CODES, 0); - } + const uint32_t end = ((size) / 4) * 4; + const uint32_t* const LoopEnd = pa + end; + int i; + ASM_START + ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout) + ASM_END_0 + for (i = end; i < size; ++i) pout[i] = pa[i] + pb[i]; +} + +static void AddVectorEq_MIPS32(const uint32_t* pa, uint32_t* pout, int size) { + uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + const uint32_t end = ((size) / 4) * 4; + const uint32_t* const LoopEnd = pa + end; + int i; + ASM_START + ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout) + ASM_END_1 + for (i = end; i < size; ++i) pout[i] += pa[i]; } -#undef ADD_VECTOR_EQ -#undef ADD_VECTOR #undef ASM_END_1 #undef ASM_END_0 #undef ASM_END_COMMON_1 @@ -415,13 +380,14 @@ static void HistogramAdd(const VP8LHistogram* const a, extern void VP8LEncDspInitMIPS32(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitMIPS32(void) { - VP8LFastSLog2Slow = FastSLog2Slow; - VP8LFastLog2Slow = FastLog2Slow; - VP8LExtraCost = ExtraCost; - VP8LExtraCostCombined = ExtraCostCombined; - VP8LGetEntropyUnrefined = GetEntropyUnrefined; - VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined; - VP8LHistogramAdd = HistogramAdd; + VP8LFastSLog2Slow = FastSLog2Slow_MIPS32; + VP8LFastLog2Slow = FastLog2Slow_MIPS32; + VP8LExtraCost = ExtraCost_MIPS32; + VP8LExtraCostCombined = ExtraCostCombined_MIPS32; + VP8LGetEntropyUnrefined = GetEntropyUnrefined_MIPS32; + VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined_MIPS32; + VP8LAddVector = AddVector_MIPS32; + VP8LAddVectorEq = AddVectorEq_MIPS32; } #else // !WEBP_USE_MIPS32 diff --git a/Pods/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c b/Pods/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c index 0abf3c4..5855e6a 100644 --- a/Pods/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c @@ -12,14 +12,14 @@ // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) // Jovan Zelincevic (jovan.zelincevic@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "./lossless.h" +#include "src/dsp/lossless.h" -static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, - int num_pixels) { +static void SubtractGreenFromBlueAndRed_MIPSdspR2(uint32_t* argb_data, + int num_pixels) { uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; uint32_t* const p_loop1_end = argb_data + (num_pixels & ~3); uint32_t* const p_loop2_end = p_loop1_end + (num_pixels & 3); @@ -78,8 +78,8 @@ static WEBP_INLINE uint32_t ColorTransformDelta(int8_t color_pred, return (uint32_t)((int)(color_pred) * color) >> 5; } -static void TransformColor(const VP8LMultipliers* const m, uint32_t* data, - int num_pixels) { +static void TransformColor_MIPSdspR2(const VP8LMultipliers* const m, + uint32_t* data, int num_pixels) { int temp0, temp1, temp2, temp3, temp4, temp5; uint32_t argb, argb1, new_red, new_red1; const uint32_t G_to_R = m->green_to_red_; @@ -171,10 +171,13 @@ static WEBP_INLINE uint8_t TransformColorBlue(uint8_t green_to_blue, return (new_blue & 0xff); } -static void CollectColorBlueTransforms(const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_blue, int red_to_blue, - int histo[]) { +static void CollectColorBlueTransforms_MIPSdspR2(const uint32_t* argb, + int stride, + int tile_width, + int tile_height, + int green_to_blue, + int red_to_blue, + int histo[]) { const int rtb = (red_to_blue << 16) | (red_to_blue & 0xffff); const int gtb = (green_to_blue << 16) | (green_to_blue & 0xffff); const uint32_t mask = 0xff00ffu; @@ -222,9 +225,12 @@ static WEBP_INLINE uint8_t TransformColorRed(uint8_t green_to_red, return (new_red & 0xff); } -static void CollectColorRedTransforms(const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_red, int histo[]) { +static void CollectColorRedTransforms_MIPSdspR2(const uint32_t* argb, + int stride, + int tile_width, + int tile_height, + int green_to_red, + int histo[]) { const int gtr = (green_to_red << 16) | (green_to_red & 0xffff); while (tile_height-- > 0) { int x; @@ -262,10 +268,10 @@ static void CollectColorRedTransforms(const uint32_t* argb, int stride, extern void VP8LEncDspInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitMIPSdspR2(void) { - VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; - VP8LTransformColor = TransformColor; - VP8LCollectColorBlueTransforms = CollectColorBlueTransforms; - VP8LCollectColorRedTransforms = CollectColorRedTransforms; + VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed_MIPSdspR2; + VP8LTransformColor = TransformColor_MIPSdspR2; + VP8LCollectColorBlueTransforms = CollectColorBlueTransforms_MIPSdspR2; + VP8LCollectColorRedTransforms = CollectColorRedTransforms_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/lossless_enc_msa.c b/Pods/libwebp/src/dsp/lossless_enc_msa.c index 2f69ba3..600dddf 100644 --- a/Pods/libwebp/src/dsp/lossless_enc_msa.c +++ b/Pods/libwebp/src/dsp/lossless_enc_msa.c @@ -11,12 +11,12 @@ // // Authors: Prashant Patil (Prashant.Patil@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MSA) -#include "./lossless.h" -#include "./msa_macro.h" +#include "src/dsp/lossless.h" +#include "src/dsp/msa_macro.h" #define TRANSFORM_COLOR_8(src0, src1, dst0, dst1, c0, c1, mask0, mask1) do { \ v8i16 g0, g1, t0, t1, t2, t3; \ @@ -48,8 +48,8 @@ dst = VSHF_UB(src, t0, mask1); \ } while (0) -static void TransformColor(const VP8LMultipliers* const m, uint32_t* data, - int num_pixels) { +static void TransformColor_MSA(const VP8LMultipliers* const m, uint32_t* data, + int num_pixels) { v16u8 src0, dst0; const v16i8 g2br = (v16i8)__msa_fill_w(m->green_to_blue_ | (m->green_to_red_ << 16)); @@ -94,7 +94,8 @@ static void TransformColor(const VP8LMultipliers* const m, uint32_t* data, } } -static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { +static void SubtractGreenFromBlueAndRed_MSA(uint32_t* argb_data, + int num_pixels) { int i; uint8_t* ptemp_data = (uint8_t*)argb_data; v16u8 src0, dst0, tmp0; @@ -136,8 +137,8 @@ static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { extern void VP8LEncDspInitMSA(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitMSA(void) { - VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; - VP8LTransformColor = TransformColor; + VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed_MSA; + VP8LTransformColor = TransformColor_MSA; } #else // !WEBP_USE_MSA diff --git a/Pods/libwebp/src/dsp/lossless_enc_neon.c b/Pods/libwebp/src/dsp/lossless_enc_neon.c index 4c56f25..7c7b73f 100644 --- a/Pods/libwebp/src/dsp/lossless_enc_neon.c +++ b/Pods/libwebp/src/dsp/lossless_enc_neon.c @@ -11,14 +11,14 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) #include -#include "./lossless.h" -#include "./neon.h" +#include "src/dsp/lossless.h" +#include "src/dsp/neon.h" //------------------------------------------------------------------------------ // Subtract-Green Transform @@ -36,8 +36,8 @@ static const uint8_t kGreenShuffle[16] = { 1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255 }; -static WEBP_INLINE uint8x16_t DoGreenShuffle(const uint8x16_t argb, - const uint8x16_t shuffle) { +static WEBP_INLINE uint8x16_t DoGreenShuffle_NEON(const uint8x16_t argb, + const uint8x16_t shuffle) { return vcombine_u8(vtbl1q_u8(argb, vget_low_u8(shuffle)), vtbl1q_u8(argb, vget_high_u8(shuffle))); } @@ -45,14 +45,15 @@ static WEBP_INLINE uint8x16_t DoGreenShuffle(const uint8x16_t argb, // 255 = byte will be zeroed static const uint8_t kGreenShuffle[8] = { 1, 255, 1, 255, 5, 255, 5, 255 }; -static WEBP_INLINE uint8x16_t DoGreenShuffle(const uint8x16_t argb, - const uint8x8_t shuffle) { +static WEBP_INLINE uint8x16_t DoGreenShuffle_NEON(const uint8x16_t argb, + const uint8x8_t shuffle) { return vcombine_u8(vtbl1_u8(vget_low_u8(argb), shuffle), vtbl1_u8(vget_high_u8(argb), shuffle)); } #endif // USE_VTBLQ -static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { +static void SubtractGreenFromBlueAndRed_NEON(uint32_t* argb_data, + int num_pixels) { const uint32_t* const end = argb_data + (num_pixels & ~3); #ifdef USE_VTBLQ const uint8x16_t shuffle = vld1q_u8(kGreenShuffle); @@ -61,7 +62,7 @@ static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { #endif for (; argb_data < end; argb_data += 4) { const uint8x16_t argb = vld1q_u8((uint8_t*)argb_data); - const uint8x16_t greens = DoGreenShuffle(argb, shuffle); + const uint8x16_t greens = DoGreenShuffle_NEON(argb, shuffle); vst1q_u8((uint8_t*)argb_data, vsubq_u8(argb, greens)); } // fallthrough and finish off with plain-C @@ -71,8 +72,8 @@ static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { //------------------------------------------------------------------------------ // Color Transform -static void TransformColor(const VP8LMultipliers* const m, - uint32_t* argb_data, int num_pixels) { +static void TransformColor_NEON(const VP8LMultipliers* const m, + uint32_t* argb_data, int num_pixels) { // sign-extended multiplying constants, pre-shifted by 6. #define CST(X) (((int16_t)(m->X << 8)) >> 6) const int16_t rb[8] = { @@ -102,7 +103,7 @@ static void TransformColor(const VP8LMultipliers* const m, for (i = 0; i + 4 <= num_pixels; i += 4) { const uint8x16_t in = vld1q_u8((uint8_t*)(argb_data + i)); // 0 g 0 g - const uint8x16_t greens = DoGreenShuffle(in, shuffle); + const uint8x16_t greens = DoGreenShuffle_NEON(in, shuffle); // x dr x db1 const int16x8_t A = vqdmulhq_s16(vreinterpretq_s16_u8(greens), mults_rb); // r 0 b 0 @@ -132,8 +133,8 @@ static void TransformColor(const VP8LMultipliers* const m, extern void VP8LEncDspInitNEON(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitNEON(void) { - VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; - VP8LTransformColor = TransformColor; + VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed_NEON; + VP8LTransformColor = TransformColor_NEON; } #else // !WEBP_USE_NEON diff --git a/Pods/libwebp/src/dsp/lossless_enc_sse2.c b/Pods/libwebp/src/dsp/lossless_enc_sse2.c index 8ad85d9..e676f6f 100644 --- a/Pods/libwebp/src/dsp/lossless_enc_sse2.c +++ b/Pods/libwebp/src/dsp/lossless_enc_sse2.c @@ -11,22 +11,23 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) #include #include -#include "./lossless.h" -#include "./common_sse2.h" -#include "./lossless_common.h" +#include "src/dsp/lossless.h" +#include "src/dsp/common_sse2.h" +#include "src/dsp/lossless_common.h" // For sign-extended multiplying constants, pre-shifted by 5: -#define CST_5b(X) (((int16_t)((uint16_t)X << 8)) >> 5) +#define CST_5b(X) (((int16_t)((uint16_t)(X) << 8)) >> 5) //------------------------------------------------------------------------------ // Subtract-Green Transform -static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { +static void SubtractGreenFromBlueAndRed_SSE2(uint32_t* argb_data, + int num_pixels) { int i; for (i = 0; i + 4 <= num_pixels; i += 4) { const __m128i in = _mm_loadu_si128((__m128i*)&argb_data[i]); // argb @@ -45,16 +46,14 @@ static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { //------------------------------------------------------------------------------ // Color Transform -static void TransformColor(const VP8LMultipliers* const m, - uint32_t* argb_data, int num_pixels) { - const __m128i mults_rb = _mm_set_epi16( - CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_), - CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_), - CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_), - CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_)); - const __m128i mults_b2 = _mm_set_epi16( - CST_5b(m->red_to_blue_), 0, CST_5b(m->red_to_blue_), 0, - CST_5b(m->red_to_blue_), 0, CST_5b(m->red_to_blue_), 0); +#define MK_CST_16(HI, LO) \ + _mm_set1_epi32((int)(((uint32_t)(HI) << 16) | ((LO) & 0xffff))) + +static void TransformColor_SSE2(const VP8LMultipliers* const m, + uint32_t* argb_data, int num_pixels) { + const __m128i mults_rb = MK_CST_16(CST_5b(m->green_to_red_), + CST_5b(m->green_to_blue_)); + const __m128i mults_b2 = MK_CST_16(CST_5b(m->red_to_blue_), 0); const __m128i mask_ag = _mm_set1_epi32(0xff00ff00); // alpha-green masks const __m128i mask_rb = _mm_set1_epi32(0x00ff00ff); // red-blue masks int i; @@ -80,16 +79,12 @@ static void TransformColor(const VP8LMultipliers* const m, //------------------------------------------------------------------------------ #define SPAN 8 -static void CollectColorBlueTransforms(const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_blue, int red_to_blue, - int histo[]) { - const __m128i mults_r = _mm_set_epi16( - CST_5b(red_to_blue), 0, CST_5b(red_to_blue), 0, - CST_5b(red_to_blue), 0, CST_5b(red_to_blue), 0); - const __m128i mults_g = _mm_set_epi16( - 0, CST_5b(green_to_blue), 0, CST_5b(green_to_blue), - 0, CST_5b(green_to_blue), 0, CST_5b(green_to_blue)); +static void CollectColorBlueTransforms_SSE2(const uint32_t* argb, int stride, + int tile_width, int tile_height, + int green_to_blue, int red_to_blue, + int histo[]) { + const __m128i mults_r = MK_CST_16(CST_5b(red_to_blue), 0); + const __m128i mults_g = MK_CST_16(0, CST_5b(green_to_blue)); const __m128i mask_g = _mm_set1_epi32(0x00ff00); // green mask const __m128i mask_b = _mm_set1_epi32(0x0000ff); // blue mask int y; @@ -131,12 +126,10 @@ static void CollectColorBlueTransforms(const uint32_t* argb, int stride, } } -static void CollectColorRedTransforms(const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_red, int histo[]) { - const __m128i mults_g = _mm_set_epi16( - 0, CST_5b(green_to_red), 0, CST_5b(green_to_red), - 0, CST_5b(green_to_red), 0, CST_5b(green_to_red)); +static void CollectColorRedTransforms_SSE2(const uint32_t* argb, int stride, + int tile_width, int tile_height, + int green_to_red, int histo[]) { + const __m128i mults_g = MK_CST_16(0, CST_5b(green_to_red)); const __m128i mask_g = _mm_set1_epi32(0x00ff00); // green mask const __m128i mask = _mm_set1_epi32(0xff); @@ -173,15 +166,17 @@ static void CollectColorRedTransforms(const uint32_t* argb, int stride, } } #undef SPAN +#undef MK_CST_16 //------------------------------------------------------------------------------ +// Note we are adding uint32_t's as *signed* int32's (using _mm_add_epi32). But +// that's ok since the histogram values are less than 1<<28 (max picture size). #define LINE_SIZE 16 // 8 or 16 -static void AddVector(const uint32_t* a, const uint32_t* b, uint32_t* out, - int size) { +static void AddVector_SSE2(const uint32_t* a, const uint32_t* b, uint32_t* out, + int size) { int i; - assert(size % LINE_SIZE == 0); - for (i = 0; i < size; i += LINE_SIZE) { + for (i = 0; i + LINE_SIZE <= size; i += LINE_SIZE) { const __m128i a0 = _mm_loadu_si128((const __m128i*)&a[i + 0]); const __m128i a1 = _mm_loadu_si128((const __m128i*)&a[i + 4]); #if (LINE_SIZE == 16) @@ -201,12 +196,14 @@ static void AddVector(const uint32_t* a, const uint32_t* b, uint32_t* out, _mm_storeu_si128((__m128i*)&out[i + 12], _mm_add_epi32(a3, b3)); #endif } + for (; i < size; ++i) { + out[i] = a[i] + b[i]; + } } -static void AddVectorEq(const uint32_t* a, uint32_t* out, int size) { +static void AddVectorEq_SSE2(const uint32_t* a, uint32_t* out, int size) { int i; - assert(size % LINE_SIZE == 0); - for (i = 0; i < size; i += LINE_SIZE) { + for (i = 0; i + LINE_SIZE <= size; i += LINE_SIZE) { const __m128i a0 = _mm_loadu_si128((const __m128i*)&a[i + 0]); const __m128i a1 = _mm_loadu_si128((const __m128i*)&a[i + 4]); #if (LINE_SIZE == 16) @@ -226,44 +223,20 @@ static void AddVectorEq(const uint32_t* a, uint32_t* out, int size) { _mm_storeu_si128((__m128i*)&out[i + 12], _mm_add_epi32(a3, b3)); #endif } -} -#undef LINE_SIZE - -// Note we are adding uint32_t's as *signed* int32's (using _mm_add_epi32). But -// that's ok since the histogram values are less than 1<<28 (max picture size). -static void HistogramAdd(const VP8LHistogram* const a, - const VP8LHistogram* const b, - VP8LHistogram* const out) { - int i; - const int literal_size = VP8LHistogramNumCodes(a->palette_code_bits_); - assert(a->palette_code_bits_ == b->palette_code_bits_); - if (b != out) { - AddVector(a->literal_, b->literal_, out->literal_, NUM_LITERAL_CODES); - AddVector(a->red_, b->red_, out->red_, NUM_LITERAL_CODES); - AddVector(a->blue_, b->blue_, out->blue_, NUM_LITERAL_CODES); - AddVector(a->alpha_, b->alpha_, out->alpha_, NUM_LITERAL_CODES); - } else { - AddVectorEq(a->literal_, out->literal_, NUM_LITERAL_CODES); - AddVectorEq(a->red_, out->red_, NUM_LITERAL_CODES); - AddVectorEq(a->blue_, out->blue_, NUM_LITERAL_CODES); - AddVectorEq(a->alpha_, out->alpha_, NUM_LITERAL_CODES); - } - for (i = NUM_LITERAL_CODES; i < literal_size; ++i) { - out->literal_[i] = a->literal_[i] + b->literal_[i]; - } - for (i = 0; i < NUM_DISTANCE_CODES; ++i) { - out->distance_[i] = a->distance_[i] + b->distance_[i]; + for (; i < size; ++i) { + out[i] += a[i]; } } +#undef LINE_SIZE //------------------------------------------------------------------------------ // Entropy // Checks whether the X or Y contribution is worth computing and adding. // Used in loop unrolling. -#define ANALYZE_X_OR_Y(x_or_y, j) \ - do { \ - if (x_or_y[i + j] != 0) retval -= VP8LFastSLog2(x_or_y[i + j]); \ +#define ANALYZE_X_OR_Y(x_or_y, j) \ + do { \ + if ((x_or_y)[i + (j)] != 0) retval -= VP8LFastSLog2((x_or_y)[i + (j)]); \ } while (0) // Checks whether the X + Y contribution is worth computing and adding. @@ -276,7 +249,7 @@ static void HistogramAdd(const VP8LHistogram* const a, } \ } while (0) -static float CombinedShannonEntropy(const int X[256], const int Y[256]) { +static float CombinedShannonEntropy_SSE2(const int X[256], const int Y[256]) { int i; double retval = 0.; int sumX, sumXY; @@ -332,8 +305,8 @@ static float CombinedShannonEntropy(const int X[256], const int Y[256]) { //------------------------------------------------------------------------------ -static int VectorMismatch(const uint32_t* const array1, - const uint32_t* const array2, int length) { +static int VectorMismatch_SSE2(const uint32_t* const array1, + const uint32_t* const array2, int length) { int match_len; if (length >= 12) { @@ -390,7 +363,7 @@ static void BundleColorMap_SSE2(const uint8_t* const row, int width, int xbits, assert(xbits <= 3); switch (xbits) { case 0: { - const __m128i ff = _mm_set1_epi16(0xff00); + const __m128i ff = _mm_set1_epi16((short)0xff00); const __m128i zero = _mm_setzero_si128(); // Store 0xff000000 | (row[x] << 8). for (x = 0; x + 16 <= width; x += 16, dst += 16) { @@ -409,7 +382,7 @@ static void BundleColorMap_SSE2(const uint8_t* const row, int width, int xbits, break; } case 1: { - const __m128i ff = _mm_set1_epi16(0xff00); + const __m128i ff = _mm_set1_epi16((short)0xff00); const __m128i mul = _mm_set1_epi16(0x110); for (x = 0; x + 16 <= width; x += 16, dst += 8) { // 0a0b | (where a/b are 4 bits). @@ -482,8 +455,9 @@ static void PredictorSub0_SSE2(const uint32_t* in, const uint32_t* upper, _mm_storeu_si128((__m128i*)&out[i], res); } if (i != num_pixels) { - VP8LPredictorsSub_C[0](in + i, upper + i, num_pixels - i, out + i); + VP8LPredictorsSub_C[0](in + i, NULL, num_pixels - i, out + i); } + (void)upper; } #define GENERATE_PREDICTOR_1(X, IN) \ @@ -574,8 +548,8 @@ static void PredictorSub10_SSE2(const uint32_t* in, const uint32_t* upper, } // Predictor11: select. -static void GetSumAbsDiff32(const __m128i* const A, const __m128i* const B, - __m128i* const out) { +static void GetSumAbsDiff32_SSE2(const __m128i* const A, const __m128i* const B, + __m128i* const out) { // We can unpack with any value on the upper 32 bits, provided it's the same // on both operands (to that their sum of abs diff is zero). Here we use *A. const __m128i A_lo = _mm_unpacklo_epi32(*A, *A); @@ -596,8 +570,8 @@ static void PredictorSub11_SSE2(const uint32_t* in, const uint32_t* upper, const __m128i TL = _mm_loadu_si128((const __m128i*)&upper[i - 1]); const __m128i src = _mm_loadu_si128((const __m128i*)&in[i]); __m128i pa, pb; - GetSumAbsDiff32(&T, &TL, &pa); // pa = sum |T-TL| - GetSumAbsDiff32(&L, &TL, &pb); // pb = sum |L-TL| + GetSumAbsDiff32_SSE2(&T, &TL, &pa); // pa = sum |T-TL| + GetSumAbsDiff32_SSE2(&L, &TL, &pb); // pb = sum |L-TL| { const __m128i mask = _mm_cmpgt_epi32(pb, pa); const __m128i A = _mm_and_si128(mask, L); @@ -677,13 +651,14 @@ static void PredictorSub13_SSE2(const uint32_t* in, const uint32_t* upper, extern void VP8LEncDspInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitSSE2(void) { - VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; - VP8LTransformColor = TransformColor; - VP8LCollectColorBlueTransforms = CollectColorBlueTransforms; - VP8LCollectColorRedTransforms = CollectColorRedTransforms; - VP8LHistogramAdd = HistogramAdd; - VP8LCombinedShannonEntropy = CombinedShannonEntropy; - VP8LVectorMismatch = VectorMismatch; + VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed_SSE2; + VP8LTransformColor = TransformColor_SSE2; + VP8LCollectColorBlueTransforms = CollectColorBlueTransforms_SSE2; + VP8LCollectColorRedTransforms = CollectColorRedTransforms_SSE2; + VP8LAddVector = AddVector_SSE2; + VP8LAddVectorEq = AddVectorEq_SSE2; + VP8LCombinedShannonEntropy = CombinedShannonEntropy_SSE2; + VP8LVectorMismatch = VectorMismatch_SSE2; VP8LBundleColorMap = BundleColorMap_SSE2; VP8LPredictorsSub[0] = PredictorSub0_SSE2; diff --git a/Pods/libwebp/src/dsp/lossless_enc_sse41.c b/Pods/libwebp/src/dsp/lossless_enc_sse41.c index 821057c..719d8ed 100644 --- a/Pods/libwebp/src/dsp/lossless_enc_sse41.c +++ b/Pods/libwebp/src/dsp/lossless_enc_sse41.c @@ -11,17 +11,21 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE41) #include #include -#include "./lossless.h" +#include "src/dsp/lossless.h" + +// For sign-extended multiplying constants, pre-shifted by 5: +#define CST_5b(X) (((int16_t)((uint16_t)(X) << 8)) >> 5) //------------------------------------------------------------------------------ // Subtract-Green Transform -static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { +static void SubtractGreenFromBlueAndRed_SSE41(uint32_t* argb_data, + int num_pixels) { int i; const __m128i kCstShuffle = _mm_set_epi8(-1, 13, -1, 13, -1, 9, -1, 9, -1, 5, -1, 5, -1, 1, -1, 1); @@ -37,13 +41,104 @@ static void SubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixels) { } } +//------------------------------------------------------------------------------ +// Color Transform + +#define SPAN 8 +static void CollectColorBlueTransforms_SSE41(const uint32_t* argb, int stride, + int tile_width, int tile_height, + int green_to_blue, int red_to_blue, + int histo[]) { + const __m128i mults_r = _mm_set1_epi16(CST_5b(red_to_blue)); + const __m128i mults_g = _mm_set1_epi16(CST_5b(green_to_blue)); + const __m128i mask_g = _mm_set1_epi16((short)0xff00); // green mask + const __m128i mask_gb = _mm_set1_epi32(0xffff); // green/blue mask + const __m128i mask_b = _mm_set1_epi16(0x00ff); // blue mask + const __m128i shuffler_lo = _mm_setr_epi8(-1, 2, -1, 6, -1, 10, -1, 14, -1, + -1, -1, -1, -1, -1, -1, -1); + const __m128i shuffler_hi = _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1, + 2, -1, 6, -1, 10, -1, 14); + int y; + for (y = 0; y < tile_height; ++y) { + const uint32_t* const src = argb + y * stride; + int i, x; + for (x = 0; x + SPAN <= tile_width; x += SPAN) { + uint16_t values[SPAN]; + const __m128i in0 = _mm_loadu_si128((__m128i*)&src[x + 0]); + const __m128i in1 = _mm_loadu_si128((__m128i*)&src[x + SPAN / 2]); + const __m128i r0 = _mm_shuffle_epi8(in0, shuffler_lo); + const __m128i r1 = _mm_shuffle_epi8(in1, shuffler_hi); + const __m128i r = _mm_or_si128(r0, r1); // r 0 + const __m128i gb0 = _mm_and_si128(in0, mask_gb); + const __m128i gb1 = _mm_and_si128(in1, mask_gb); + const __m128i gb = _mm_packus_epi32(gb0, gb1); // g b + const __m128i g = _mm_and_si128(gb, mask_g); // g 0 + const __m128i A = _mm_mulhi_epi16(r, mults_r); // x dbr + const __m128i B = _mm_mulhi_epi16(g, mults_g); // x dbg + const __m128i C = _mm_sub_epi8(gb, B); // x b' + const __m128i D = _mm_sub_epi8(C, A); // x b'' + const __m128i E = _mm_and_si128(D, mask_b); // 0 b'' + _mm_storeu_si128((__m128i*)values, E); + for (i = 0; i < SPAN; ++i) ++histo[values[i]]; + } + } + { + const int left_over = tile_width & (SPAN - 1); + if (left_over > 0) { + VP8LCollectColorBlueTransforms_C(argb + tile_width - left_over, stride, + left_over, tile_height, + green_to_blue, red_to_blue, histo); + } + } +} + +static void CollectColorRedTransforms_SSE41(const uint32_t* argb, int stride, + int tile_width, int tile_height, + int green_to_red, int histo[]) { + const __m128i mults_g = _mm_set1_epi16(CST_5b(green_to_red)); + const __m128i mask_g = _mm_set1_epi32(0x00ff00); // green mask + const __m128i mask = _mm_set1_epi16(0xff); + + int y; + for (y = 0; y < tile_height; ++y) { + const uint32_t* const src = argb + y * stride; + int i, x; + for (x = 0; x + SPAN <= tile_width; x += SPAN) { + uint16_t values[SPAN]; + const __m128i in0 = _mm_loadu_si128((__m128i*)&src[x + 0]); + const __m128i in1 = _mm_loadu_si128((__m128i*)&src[x + SPAN / 2]); + const __m128i g0 = _mm_and_si128(in0, mask_g); // 0 0 | g 0 + const __m128i g1 = _mm_and_si128(in1, mask_g); + const __m128i g = _mm_packus_epi32(g0, g1); // g 0 + const __m128i A0 = _mm_srli_epi32(in0, 16); // 0 0 | x r + const __m128i A1 = _mm_srli_epi32(in1, 16); + const __m128i A = _mm_packus_epi32(A0, A1); // x r + const __m128i B = _mm_mulhi_epi16(g, mults_g); // x dr + const __m128i C = _mm_sub_epi8(A, B); // x r' + const __m128i D = _mm_and_si128(C, mask); // 0 r' + _mm_storeu_si128((__m128i*)values, D); + for (i = 0; i < SPAN; ++i) ++histo[values[i]]; + } + } + { + const int left_over = tile_width & (SPAN - 1); + if (left_over > 0) { + VP8LCollectColorRedTransforms_C(argb + tile_width - left_over, stride, + left_over, tile_height, green_to_red, + histo); + } + } +} + //------------------------------------------------------------------------------ // Entry point extern void VP8LEncDspInitSSE41(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitSSE41(void) { - VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; + VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed_SSE41; + VP8LCollectColorBlueTransforms = CollectColorBlueTransforms_SSE41; + VP8LCollectColorRedTransforms = CollectColorRedTransforms_SSE41; } #else // !WEBP_USE_SSE41 diff --git a/Pods/libwebp/src/dsp/lossless_mips_dsp_r2.c b/Pods/libwebp/src/dsp/lossless_mips_dsp_r2.c index 2984ce8..9888854 100644 --- a/Pods/libwebp/src/dsp/lossless_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/lossless_mips_dsp_r2.c @@ -12,12 +12,12 @@ // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) // Jovan Zelincevic (jovan.zelincevic@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "./lossless.h" -#include "./lossless_common.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" #define MAP_COLOR_FUNCS(FUNC_NAME, TYPE, GET_INDEX, GET_VALUE) \ static void FUNC_NAME(const TYPE* src, \ @@ -86,8 +86,8 @@ static void FUNC_NAME(const TYPE* src, \ } \ } -MAP_COLOR_FUNCS(MapARGB, uint32_t, VP8GetARGBIndex, VP8GetARGBValue) -MAP_COLOR_FUNCS(MapAlpha, uint8_t, VP8GetAlphaIndex, VP8GetAlphaValue) +MAP_COLOR_FUNCS(MapARGB_MIPSdspR2, uint32_t, VP8GetARGBIndex, VP8GetARGBValue) +MAP_COLOR_FUNCS(MapAlpha_MIPSdspR2, uint8_t, VP8GetAlphaIndex, VP8GetAlphaValue) #undef MAP_COLOR_FUNCS @@ -188,48 +188,52 @@ static WEBP_INLINE uint32_t Average4(uint32_t a0, uint32_t a1, return Average2(Average2(a0, a1), Average2(a2, a3)); } -static uint32_t Predictor5(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor5_MIPSdspR2(uint32_t left, const uint32_t* const top) { return Average3(left, top[0], top[1]); } -static uint32_t Predictor6(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor6_MIPSdspR2(uint32_t left, const uint32_t* const top) { return Average2(left, top[-1]); } -static uint32_t Predictor7(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor7_MIPSdspR2(uint32_t left, const uint32_t* const top) { return Average2(left, top[0]); } -static uint32_t Predictor8(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor8_MIPSdspR2(uint32_t left, const uint32_t* const top) { (void)left; return Average2(top[-1], top[0]); } -static uint32_t Predictor9(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor9_MIPSdspR2(uint32_t left, const uint32_t* const top) { (void)left; return Average2(top[0], top[1]); } -static uint32_t Predictor10(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor10_MIPSdspR2(uint32_t left, + const uint32_t* const top) { return Average4(left, top[-1], top[0], top[1]); } -static uint32_t Predictor11(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor11_MIPSdspR2(uint32_t left, + const uint32_t* const top) { return Select(top[0], left, top[-1]); } -static uint32_t Predictor12(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor12_MIPSdspR2(uint32_t left, + const uint32_t* const top) { return ClampedAddSubtractFull(left, top[0], top[-1]); } -static uint32_t Predictor13(uint32_t left, const uint32_t* const top) { +static uint32_t Predictor13_MIPSdspR2(uint32_t left, + const uint32_t* const top) { return ClampedAddSubtractHalf(left, top[0], top[-1]); } // Add green to blue and red channels (i.e. perform the inverse transform of // 'subtract green'). -static void AddGreenToBlueAndRed(const uint32_t* src, int num_pixels, - uint32_t* dst) { +static void AddGreenToBlueAndRed_MIPSdspR2(const uint32_t* src, int num_pixels, + uint32_t* dst) { uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; const uint32_t* const p_loop1_end = src + (num_pixels & ~3); const uint32_t* const p_loop2_end = src + num_pixels; @@ -285,9 +289,9 @@ static void AddGreenToBlueAndRed(const uint32_t* src, int num_pixels, ); } -static void TransformColorInverse(const VP8LMultipliers* const m, - const uint32_t* src, int num_pixels, - uint32_t* dst) { +static void TransformColorInverse_MIPSdspR2(const VP8LMultipliers* const m, + const uint32_t* src, int num_pixels, + uint32_t* dst) { int temp0, temp1, temp2, temp3, temp4, temp5; uint32_t argb, argb1, new_red; const uint32_t G_to_R = m->green_to_red_; @@ -356,8 +360,8 @@ static void TransformColorInverse(const VP8LMultipliers* const m, if (num_pixels & 1) VP8LTransformColorInverse_C(m, src, 1, dst); } -static void ConvertBGRAToRGB(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGB_MIPSdspR2(const uint32_t* src, + int num_pixels, uint8_t* dst) { int temp0, temp1, temp2, temp3; const uint32_t* const p_loop1_end = src + (num_pixels & ~3); const uint32_t* const p_loop2_end = src + num_pixels; @@ -408,8 +412,8 @@ static void ConvertBGRAToRGB(const uint32_t* src, ); } -static void ConvertBGRAToRGBA(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA_MIPSdspR2(const uint32_t* src, + int num_pixels, uint8_t* dst) { int temp0, temp1, temp2, temp3; const uint32_t* const p_loop1_end = src + (num_pixels & ~3); const uint32_t* const p_loop2_end = src + num_pixels; @@ -458,8 +462,8 @@ static void ConvertBGRAToRGBA(const uint32_t* src, ); } -static void ConvertBGRAToRGBA4444(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA4444_MIPSdspR2(const uint32_t* src, + int num_pixels, uint8_t* dst) { int temp0, temp1, temp2, temp3, temp4, temp5; const uint32_t* const p_loop1_end = src + (num_pixels & ~3); const uint32_t* const p_loop2_end = src + num_pixels; @@ -492,7 +496,7 @@ static void ConvertBGRAToRGBA4444(const uint32_t* src, "ins %[temp3], %[temp5], 16, 4 \n\t" "addiu %[src], %[src], 16 \n\t" "precr.qb.ph %[temp3], %[temp3], %[temp2] \n\t" -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) "usw %[temp1], 0(%[dst]) \n\t" "usw %[temp3], 4(%[dst]) \n\t" #else @@ -514,7 +518,7 @@ static void ConvertBGRAToRGBA4444(const uint32_t* src, "ins %[temp0], %[temp5], 16, 4 \n\t" "addiu %[src], %[src], 4 \n\t" "precr.qb.ph %[temp0], %[temp0], %[temp0] \n\t" -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) "ush %[temp0], 0(%[dst]) \n\t" #else "wsbh %[temp0], %[temp0] \n\t" @@ -532,8 +536,8 @@ static void ConvertBGRAToRGBA4444(const uint32_t* src, ); } -static void ConvertBGRAToRGB565(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGB565_MIPSdspR2(const uint32_t* src, + int num_pixels, uint8_t* dst) { int temp0, temp1, temp2, temp3, temp4, temp5; const uint32_t* const p_loop1_end = src + (num_pixels & ~3); const uint32_t* const p_loop2_end = src + num_pixels; @@ -570,7 +574,7 @@ static void ConvertBGRAToRGB565(const uint32_t* src, "ins %[temp2], %[temp3], 0, 5 \n\t" "addiu %[src], %[src], 16 \n\t" "append %[temp2], %[temp1], 16 \n\t" -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) "usw %[temp0], 0(%[dst]) \n\t" "usw %[temp2], 4(%[dst]) \n\t" #else @@ -592,7 +596,7 @@ static void ConvertBGRAToRGB565(const uint32_t* src, "ins %[temp4], %[temp5], 0, 11 \n\t" "addiu %[src], %[src], 4 \n\t" "ins %[temp4], %[temp0], 0, 5 \n\t" -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) "ush %[temp4], 0(%[dst]) \n\t" #else "wsbh %[temp4], %[temp4] \n\t" @@ -610,8 +614,8 @@ static void ConvertBGRAToRGB565(const uint32_t* src, ); } -static void ConvertBGRAToBGR(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToBGR_MIPSdspR2(const uint32_t* src, + int num_pixels, uint8_t* dst) { int temp0, temp1, temp2, temp3; const uint32_t* const p_loop1_end = src + (num_pixels & ~3); const uint32_t* const p_loop2_end = src + num_pixels; @@ -662,24 +666,27 @@ static void ConvertBGRAToBGR(const uint32_t* src, extern void VP8LDspInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPSdspR2(void) { - VP8LMapColor32b = MapARGB; - VP8LMapColor8b = MapAlpha; - VP8LPredictors[5] = Predictor5; - VP8LPredictors[6] = Predictor6; - VP8LPredictors[7] = Predictor7; - VP8LPredictors[8] = Predictor8; - VP8LPredictors[9] = Predictor9; - VP8LPredictors[10] = Predictor10; - VP8LPredictors[11] = Predictor11; - VP8LPredictors[12] = Predictor12; - VP8LPredictors[13] = Predictor13; - VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed; - VP8LTransformColorInverse = TransformColorInverse; - VP8LConvertBGRAToRGB = ConvertBGRAToRGB; - VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA; - VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444; - VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565; - VP8LConvertBGRAToBGR = ConvertBGRAToBGR; + VP8LMapColor32b = MapARGB_MIPSdspR2; + VP8LMapColor8b = MapAlpha_MIPSdspR2; + + VP8LPredictors[5] = Predictor5_MIPSdspR2; + VP8LPredictors[6] = Predictor6_MIPSdspR2; + VP8LPredictors[7] = Predictor7_MIPSdspR2; + VP8LPredictors[8] = Predictor8_MIPSdspR2; + VP8LPredictors[9] = Predictor9_MIPSdspR2; + VP8LPredictors[10] = Predictor10_MIPSdspR2; + VP8LPredictors[11] = Predictor11_MIPSdspR2; + VP8LPredictors[12] = Predictor12_MIPSdspR2; + VP8LPredictors[13] = Predictor13_MIPSdspR2; + + VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed_MIPSdspR2; + VP8LTransformColorInverse = TransformColorInverse_MIPSdspR2; + + VP8LConvertBGRAToRGB = ConvertBGRAToRGB_MIPSdspR2; + VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA_MIPSdspR2; + VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444_MIPSdspR2; + VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565_MIPSdspR2; + VP8LConvertBGRAToBGR = ConvertBGRAToBGR_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/lossless_msa.c b/Pods/libwebp/src/dsp/lossless_msa.c index f6dd564..9f54720 100644 --- a/Pods/libwebp/src/dsp/lossless_msa.c +++ b/Pods/libwebp/src/dsp/lossless_msa.c @@ -11,12 +11,12 @@ // // Author: Prashant Patil (prashant.patil@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MSA) -#include "./lossless.h" -#include "./msa_macro.h" +#include "src/dsp/lossless.h" +#include "src/dsp/msa_macro.h" //------------------------------------------------------------------------------ // Colorspace conversion functions @@ -43,7 +43,7 @@ #define CONVERT8_BGRA_XXX(psrc, pdst, m0, m1) do { \ uint64_t pix_d; \ - v16u8 src0, src1, src2, dst0, dst1; \ + v16u8 src0, src1, src2 = { 0 }, dst0, dst1; \ LD_UB2(psrc, 16, src0, src1); \ VSHF_B2_UB(src0, src1, src1, src2, m0, m1, dst0, dst1); \ ST_UB(dst0, pdst); \ @@ -109,8 +109,8 @@ dst = VSHF_UB(src, t0, mask1); \ } while (0) -static void ConvertBGRAToRGBA(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA_MSA(const uint32_t* src, + int num_pixels, uint8_t* dst) { int i; const uint8_t* ptemp_src = (const uint8_t*)src; uint8_t* ptemp_dst = (uint8_t*)dst; @@ -150,8 +150,8 @@ static void ConvertBGRAToRGBA(const uint32_t* src, } } -static void ConvertBGRAToBGR(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToBGR_MSA(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint8_t* ptemp_src = (const uint8_t*)src; uint8_t* ptemp_dst = (uint8_t*)dst; const v16u8 mask0 = { 0, 1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, @@ -197,8 +197,8 @@ static void ConvertBGRAToBGR(const uint32_t* src, } } -static void ConvertBGRAToRGB(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGB_MSA(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint8_t* ptemp_src = (const uint8_t*)src; uint8_t* ptemp_dst = (uint8_t*)dst; const v16u8 mask0 = { 2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, @@ -244,8 +244,8 @@ static void ConvertBGRAToRGB(const uint32_t* src, } } -static void AddGreenToBlueAndRed(const uint32_t* const src, int num_pixels, - uint32_t* dst) { +static void AddGreenToBlueAndRed_MSA(const uint32_t* const src, int num_pixels, + uint32_t* dst) { int i; const uint8_t* in = (const uint8_t*)src; uint8_t* out = (uint8_t*)dst; @@ -286,9 +286,9 @@ static void AddGreenToBlueAndRed(const uint32_t* const src, int num_pixels, } } -static void TransformColorInverse(const VP8LMultipliers* const m, - const uint32_t* src, int num_pixels, - uint32_t* dst) { +static void TransformColorInverse_MSA(const VP8LMultipliers* const m, + const uint32_t* src, int num_pixels, + uint32_t* dst) { v16u8 src0, dst0; const v16i8 g2br = (v16i8)__msa_fill_w(m->green_to_blue_ | (m->green_to_red_ << 16)); @@ -341,11 +341,12 @@ static void TransformColorInverse(const VP8LMultipliers* const m, extern void VP8LDspInitMSA(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMSA(void) { - VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA; - VP8LConvertBGRAToBGR = ConvertBGRAToBGR; - VP8LConvertBGRAToRGB = ConvertBGRAToRGB; - VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed; - VP8LTransformColorInverse = TransformColorInverse; + VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA_MSA; + VP8LConvertBGRAToBGR = ConvertBGRAToBGR_MSA; + VP8LConvertBGRAToRGB = ConvertBGRAToRGB_MSA; + + VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed_MSA; + VP8LTransformColorInverse = TransformColorInverse_MSA; } #else // !WEBP_USE_MSA diff --git a/Pods/libwebp/src/dsp/lossless_neon.c b/Pods/libwebp/src/dsp/lossless_neon.c index 1145d5f..76a1b6f 100644 --- a/Pods/libwebp/src/dsp/lossless_neon.c +++ b/Pods/libwebp/src/dsp/lossless_neon.c @@ -11,14 +11,14 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) #include -#include "./lossless.h" -#include "./neon.h" +#include "src/dsp/lossless.h" +#include "src/dsp/neon.h" //------------------------------------------------------------------------------ // Colorspace conversion functions @@ -26,8 +26,8 @@ #if !defined(WORK_AROUND_GCC) // gcc 4.6.0 had some trouble (NDK-r9) with this code. We only use it for // gcc-4.8.x at least. -static void ConvertBGRAToRGBA(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA_NEON(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint32_t* const end = src + (num_pixels & ~15); for (; src < end; src += 16) { uint8x16x4_t pixel = vld4q_u8((uint8_t*)src); @@ -41,8 +41,8 @@ static void ConvertBGRAToRGBA(const uint32_t* src, VP8LConvertBGRAToRGBA_C(src, num_pixels & 15, dst); // left-overs } -static void ConvertBGRAToBGR(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToBGR_NEON(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint32_t* const end = src + (num_pixels & ~15); for (; src < end; src += 16) { const uint8x16x4_t pixel = vld4q_u8((uint8_t*)src); @@ -53,8 +53,8 @@ static void ConvertBGRAToBGR(const uint32_t* src, VP8LConvertBGRAToBGR_C(src, num_pixels & 15, dst); // left-overs } -static void ConvertBGRAToRGB(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGB_NEON(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint32_t* const end = src + (num_pixels & ~15); for (; src < end; src += 16) { const uint8x16x4_t pixel = vld4q_u8((uint8_t*)src); @@ -71,8 +71,8 @@ static void ConvertBGRAToRGB(const uint32_t* src, static const uint8_t kRGBAShuffle[8] = { 2, 1, 0, 3, 6, 5, 4, 7 }; -static void ConvertBGRAToRGBA(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA_NEON(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint32_t* const end = src + (num_pixels & ~1); const uint8x8_t shuffle = vld1_u8(kRGBAShuffle); for (; src < end; src += 2) { @@ -89,8 +89,8 @@ static const uint8_t kBGRShuffle[3][8] = { { 21, 22, 24, 25, 26, 28, 29, 30 } }; -static void ConvertBGRAToBGR(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToBGR_NEON(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint32_t* const end = src + (num_pixels & ~7); const uint8x8_t shuffle0 = vld1_u8(kBGRShuffle[0]); const uint8x8_t shuffle1 = vld1_u8(kBGRShuffle[1]); @@ -116,8 +116,8 @@ static const uint8_t kRGBShuffle[3][8] = { { 21, 20, 26, 25, 24, 30, 29, 28 } }; -static void ConvertBGRAToRGB(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGB_NEON(const uint32_t* src, + int num_pixels, uint8_t* dst) { const uint32_t* const end = src + (num_pixels & ~7); const uint8x8_t shuffle0 = vld1_u8(kRGBShuffle[0]); const uint8x8_t shuffle1 = vld1_u8(kRGBShuffle[1]); @@ -139,7 +139,6 @@ static void ConvertBGRAToRGB(const uint32_t* src, #endif // !WORK_AROUND_GCC - //------------------------------------------------------------------------------ // Predictor Transform @@ -506,8 +505,8 @@ static const uint8_t kGreenShuffle[16] = { 1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255 }; -static WEBP_INLINE uint8x16_t DoGreenShuffle(const uint8x16_t argb, - const uint8x16_t shuffle) { +static WEBP_INLINE uint8x16_t DoGreenShuffle_NEON(const uint8x16_t argb, + const uint8x16_t shuffle) { return vcombine_u8(vtbl1q_u8(argb, vget_low_u8(shuffle)), vtbl1q_u8(argb, vget_high_u8(shuffle))); } @@ -515,15 +514,15 @@ static WEBP_INLINE uint8x16_t DoGreenShuffle(const uint8x16_t argb, // 255 = byte will be zeroed static const uint8_t kGreenShuffle[8] = { 1, 255, 1, 255, 5, 255, 5, 255 }; -static WEBP_INLINE uint8x16_t DoGreenShuffle(const uint8x16_t argb, - const uint8x8_t shuffle) { +static WEBP_INLINE uint8x16_t DoGreenShuffle_NEON(const uint8x16_t argb, + const uint8x8_t shuffle) { return vcombine_u8(vtbl1_u8(vget_low_u8(argb), shuffle), vtbl1_u8(vget_high_u8(argb), shuffle)); } #endif // USE_VTBLQ -static void AddGreenToBlueAndRed(const uint32_t* src, int num_pixels, - uint32_t* dst) { +static void AddGreenToBlueAndRed_NEON(const uint32_t* src, int num_pixels, + uint32_t* dst) { const uint32_t* const end = src + (num_pixels & ~3); #ifdef USE_VTBLQ const uint8x16_t shuffle = vld1q_u8(kGreenShuffle); @@ -532,7 +531,7 @@ static void AddGreenToBlueAndRed(const uint32_t* src, int num_pixels, #endif for (; src < end; src += 4, dst += 4) { const uint8x16_t argb = vld1q_u8((const uint8_t*)src); - const uint8x16_t greens = DoGreenShuffle(argb, shuffle); + const uint8x16_t greens = DoGreenShuffle_NEON(argb, shuffle); vst1q_u8((uint8_t*)dst, vaddq_u8(argb, greens)); } // fallthrough and finish off with plain-C @@ -542,9 +541,9 @@ static void AddGreenToBlueAndRed(const uint32_t* src, int num_pixels, //------------------------------------------------------------------------------ // Color Transform -static void TransformColorInverse(const VP8LMultipliers* const m, - const uint32_t* const src, int num_pixels, - uint32_t* dst) { +static void TransformColorInverse_NEON(const VP8LMultipliers* const m, + const uint32_t* const src, + int num_pixels, uint32_t* dst) { // sign-extended multiplying constants, pre-shifted by 6. #define CST(X) (((int16_t)(m->X << 8)) >> 6) const int16_t rb[8] = { @@ -575,7 +574,7 @@ static void TransformColorInverse(const VP8LMultipliers* const m, const uint8x16_t in = vld1q_u8((const uint8_t*)(src + i)); const uint32x4_t a0g0 = vandq_u32(vreinterpretq_u32_u8(in), mask_ag); // 0 g 0 g - const uint8x16_t greens = DoGreenShuffle(in, shuffle); + const uint8x16_t greens = DoGreenShuffle_NEON(in, shuffle); // x dr x db1 const int16x8_t A = vqdmulhq_s16(vreinterpretq_s16_u8(greens), mults_rb); // x r' x b' @@ -627,12 +626,12 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitNEON(void) { VP8LPredictorsAdd[12] = PredictorAdd12_NEON; VP8LPredictorsAdd[13] = PredictorAdd13_NEON; - VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA; - VP8LConvertBGRAToBGR = ConvertBGRAToBGR; - VP8LConvertBGRAToRGB = ConvertBGRAToRGB; + VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA_NEON; + VP8LConvertBGRAToBGR = ConvertBGRAToBGR_NEON; + VP8LConvertBGRAToRGB = ConvertBGRAToRGB_NEON; - VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed; - VP8LTransformColorInverse = TransformColorInverse; + VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed_NEON; + VP8LTransformColorInverse = TransformColorInverse_NEON; } #else // !WEBP_USE_NEON diff --git a/Pods/libwebp/src/dsp/lossless_sse2.c b/Pods/libwebp/src/dsp/lossless_sse2.c index 15aae93..aef0cee 100644 --- a/Pods/libwebp/src/dsp/lossless_sse2.c +++ b/Pods/libwebp/src/dsp/lossless_sse2.c @@ -11,21 +11,22 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) -#include "./common_sse2.h" -#include "./lossless.h" -#include "./lossless_common.h" +#include "src/dsp/common_sse2.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" #include #include //------------------------------------------------------------------------------ // Predictor Transform -static WEBP_INLINE uint32_t ClampedAddSubtractFull(uint32_t c0, uint32_t c1, - uint32_t c2) { +static WEBP_INLINE uint32_t ClampedAddSubtractFull_SSE2(uint32_t c0, + uint32_t c1, + uint32_t c2) { const __m128i zero = _mm_setzero_si128(); const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c0), zero); const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c1), zero); @@ -37,8 +38,9 @@ static WEBP_INLINE uint32_t ClampedAddSubtractFull(uint32_t c0, uint32_t c1, return output; } -static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, - uint32_t c2) { +static WEBP_INLINE uint32_t ClampedAddSubtractHalf_SSE2(uint32_t c0, + uint32_t c1, + uint32_t c2) { const __m128i zero = _mm_setzero_si128(); const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c0), zero); const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c1), zero); @@ -55,7 +57,7 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, return output; } -static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) { +static WEBP_INLINE uint32_t Select_SSE2(uint32_t a, uint32_t b, uint32_t c) { int pa_minus_pb; const __m128i zero = _mm_setzero_si128(); const __m128i A0 = _mm_cvtsi32_si128(a); @@ -88,8 +90,9 @@ static WEBP_INLINE void Average2_m128i(const __m128i* const a0, *avg = _mm_sub_epi8(avg1, one); } -static WEBP_INLINE void Average2_uint32(const uint32_t a0, const uint32_t a1, - __m128i* const avg) { +static WEBP_INLINE void Average2_uint32_SSE2(const uint32_t a0, + const uint32_t a1, + __m128i* const avg) { // (a + b) >> 1 = ((a + b + 1) >> 1) - ((a ^ b) & 1) const __m128i ones = _mm_set1_epi8(1); const __m128i A0 = _mm_cvtsi32_si128(a0); @@ -99,7 +102,7 @@ static WEBP_INLINE void Average2_uint32(const uint32_t a0, const uint32_t a1, *avg = _mm_sub_epi8(avg1, one); } -static WEBP_INLINE __m128i Average2_uint32_16(uint32_t a0, uint32_t a1) { +static WEBP_INLINE __m128i Average2_uint32_16_SSE2(uint32_t a0, uint32_t a1) { const __m128i zero = _mm_setzero_si128(); const __m128i A0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(a0), zero); const __m128i A1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(a1), zero); @@ -107,15 +110,16 @@ static WEBP_INLINE __m128i Average2_uint32_16(uint32_t a0, uint32_t a1) { return _mm_srli_epi16(sum, 1); } -static WEBP_INLINE uint32_t Average2(uint32_t a0, uint32_t a1) { +static WEBP_INLINE uint32_t Average2_SSE2(uint32_t a0, uint32_t a1) { __m128i output; - Average2_uint32(a0, a1, &output); + Average2_uint32_SSE2(a0, a1, &output); return _mm_cvtsi128_si32(output); } -static WEBP_INLINE uint32_t Average3(uint32_t a0, uint32_t a1, uint32_t a2) { +static WEBP_INLINE uint32_t Average3_SSE2(uint32_t a0, uint32_t a1, + uint32_t a2) { const __m128i zero = _mm_setzero_si128(); - const __m128i avg1 = Average2_uint32_16(a0, a2); + const __m128i avg1 = Average2_uint32_16_SSE2(a0, a2); const __m128i A1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(a1), zero); const __m128i sum = _mm_add_epi16(avg1, A1); const __m128i avg2 = _mm_srli_epi16(sum, 1); @@ -124,10 +128,10 @@ static WEBP_INLINE uint32_t Average3(uint32_t a0, uint32_t a1, uint32_t a2) { return output; } -static WEBP_INLINE uint32_t Average4(uint32_t a0, uint32_t a1, - uint32_t a2, uint32_t a3) { - const __m128i avg1 = Average2_uint32_16(a0, a1); - const __m128i avg2 = Average2_uint32_16(a2, a3); +static WEBP_INLINE uint32_t Average4_SSE2(uint32_t a0, uint32_t a1, + uint32_t a2, uint32_t a3) { + const __m128i avg1 = Average2_uint32_16_SSE2(a0, a1); + const __m128i avg2 = Average2_uint32_16_SSE2(a2, a3); const __m128i sum = _mm_add_epi16(avg2, avg1); const __m128i avg3 = _mm_srli_epi16(sum, 1); const __m128i A0 = _mm_packus_epi16(avg3, avg3); @@ -136,41 +140,41 @@ static WEBP_INLINE uint32_t Average4(uint32_t a0, uint32_t a1, } static uint32_t Predictor5_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average3(left, top[0], top[1]); + const uint32_t pred = Average3_SSE2(left, top[0], top[1]); return pred; } static uint32_t Predictor6_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average2(left, top[-1]); + const uint32_t pred = Average2_SSE2(left, top[-1]); return pred; } static uint32_t Predictor7_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average2(left, top[0]); + const uint32_t pred = Average2_SSE2(left, top[0]); return pred; } static uint32_t Predictor8_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average2(top[-1], top[0]); + const uint32_t pred = Average2_SSE2(top[-1], top[0]); (void)left; return pred; } static uint32_t Predictor9_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average2(top[0], top[1]); + const uint32_t pred = Average2_SSE2(top[0], top[1]); (void)left; return pred; } static uint32_t Predictor10_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average4(left, top[-1], top[0], top[1]); + const uint32_t pred = Average4_SSE2(left, top[-1], top[0], top[1]); return pred; } static uint32_t Predictor11_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Select(top[0], left, top[-1]); + const uint32_t pred = Select_SSE2(top[0], left, top[-1]); return pred; } static uint32_t Predictor12_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = ClampedAddSubtractFull(left, top[0], top[-1]); + const uint32_t pred = ClampedAddSubtractFull_SSE2(left, top[0], top[-1]); return pred; } static uint32_t Predictor13_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = ClampedAddSubtractHalf(left, top[0], top[-1]); + const uint32_t pred = ClampedAddSubtractHalf_SSE2(left, top[0], top[-1]); return pred; } @@ -187,8 +191,9 @@ static void PredictorAdd0_SSE2(const uint32_t* in, const uint32_t* upper, _mm_storeu_si128((__m128i*)&out[i], res); } if (i != num_pixels) { - VP8LPredictorsAdd_C[0](in + i, upper + i, num_pixels - i, out + i); + VP8LPredictorsAdd_C[0](in + i, NULL, num_pixels - i, out + i); } + (void)upper; } // Predictor1: left. @@ -272,9 +277,24 @@ GENERATE_PREDICTOR_2(9, upper[i + 1]) #undef GENERATE_PREDICTOR_2 // Predictor10: average of (average of (L,TL), average of (T, TR)). +#define DO_PRED10(OUT) do { \ + __m128i avgLTL, avg; \ + Average2_m128i(&L, &TL, &avgLTL); \ + Average2_m128i(&avgTTR, &avgLTL, &avg); \ + L = _mm_add_epi8(avg, src); \ + out[i + (OUT)] = _mm_cvtsi128_si32(L); \ +} while (0) + +#define DO_PRED10_SHIFT do { \ + /* Rotate the pre-computed values for the next iteration.*/ \ + avgTTR = _mm_srli_si128(avgTTR, 4); \ + TL = _mm_srli_si128(TL, 4); \ + src = _mm_srli_si128(src, 4); \ +} while (0) + static void PredictorAdd10_SSE2(const uint32_t* in, const uint32_t* upper, int num_pixels, uint32_t* out) { - int i, j; + int i; __m128i L = _mm_cvtsi32_si128(out[-1]); for (i = 0; i + 4 <= num_pixels; i += 4) { __m128i src = _mm_loadu_si128((const __m128i*)&in[i]); @@ -283,79 +303,90 @@ static void PredictorAdd10_SSE2(const uint32_t* in, const uint32_t* upper, const __m128i TR = _mm_loadu_si128((const __m128i*)&upper[i + 1]); __m128i avgTTR; Average2_m128i(&T, &TR, &avgTTR); - for (j = 0; j < 4; ++j) { - __m128i avgLTL, avg; - Average2_m128i(&L, &TL, &avgLTL); - Average2_m128i(&avgTTR, &avgLTL, &avg); - L = _mm_add_epi8(avg, src); - out[i + j] = _mm_cvtsi128_si32(L); - // Rotate the pre-computed values for the next iteration. - avgTTR = _mm_srli_si128(avgTTR, 4); - TL = _mm_srli_si128(TL, 4); - src = _mm_srli_si128(src, 4); - } + DO_PRED10(0); + DO_PRED10_SHIFT; + DO_PRED10(1); + DO_PRED10_SHIFT; + DO_PRED10(2); + DO_PRED10_SHIFT; + DO_PRED10(3); } if (i != num_pixels) { VP8LPredictorsAdd_C[10](in + i, upper + i, num_pixels - i, out + i); } } +#undef DO_PRED10 +#undef DO_PRED10_SHIFT // Predictor11: select. -static void GetSumAbsDiff32(const __m128i* const A, const __m128i* const B, - __m128i* const out) { - // We can unpack with any value on the upper 32 bits, provided it's the same - // on both operands (to that their sum of abs diff is zero). Here we use *A. - const __m128i A_lo = _mm_unpacklo_epi32(*A, *A); - const __m128i B_lo = _mm_unpacklo_epi32(*B, *A); - const __m128i A_hi = _mm_unpackhi_epi32(*A, *A); - const __m128i B_hi = _mm_unpackhi_epi32(*B, *A); - const __m128i s_lo = _mm_sad_epu8(A_lo, B_lo); - const __m128i s_hi = _mm_sad_epu8(A_hi, B_hi); - *out = _mm_packs_epi32(s_lo, s_hi); -} +#define DO_PRED11(OUT) do { \ + const __m128i L_lo = _mm_unpacklo_epi32(L, T); \ + const __m128i TL_lo = _mm_unpacklo_epi32(TL, T); \ + const __m128i pb = _mm_sad_epu8(L_lo, TL_lo); /* pb = sum |L-TL|*/ \ + const __m128i mask = _mm_cmpgt_epi32(pb, pa); \ + const __m128i A = _mm_and_si128(mask, L); \ + const __m128i B = _mm_andnot_si128(mask, T); \ + const __m128i pred = _mm_or_si128(A, B); /* pred = (pa > b)? L : T*/ \ + L = _mm_add_epi8(src, pred); \ + out[i + (OUT)] = _mm_cvtsi128_si32(L); \ +} while (0) + +#define DO_PRED11_SHIFT do { \ + /* Shift the pre-computed value for the next iteration.*/ \ + T = _mm_srli_si128(T, 4); \ + TL = _mm_srli_si128(TL, 4); \ + src = _mm_srli_si128(src, 4); \ + pa = _mm_srli_si128(pa, 4); \ +} while (0) static void PredictorAdd11_SSE2(const uint32_t* in, const uint32_t* upper, int num_pixels, uint32_t* out) { - int i, j; + int i; + __m128i pa; __m128i L = _mm_cvtsi32_si128(out[-1]); for (i = 0; i + 4 <= num_pixels; i += 4) { __m128i T = _mm_loadu_si128((const __m128i*)&upper[i]); __m128i TL = _mm_loadu_si128((const __m128i*)&upper[i - 1]); __m128i src = _mm_loadu_si128((const __m128i*)&in[i]); - __m128i pa; - GetSumAbsDiff32(&T, &TL, &pa); // pa = sum |T-TL| - for (j = 0; j < 4; ++j) { - const __m128i L_lo = _mm_unpacklo_epi32(L, L); - const __m128i TL_lo = _mm_unpacklo_epi32(TL, L); - const __m128i pb = _mm_sad_epu8(L_lo, TL_lo); // pb = sum |L-TL| - const __m128i mask = _mm_cmpgt_epi32(pb, pa); - const __m128i A = _mm_and_si128(mask, L); - const __m128i B = _mm_andnot_si128(mask, T); - const __m128i pred = _mm_or_si128(A, B); // pred = (L > T)? L : T - L = _mm_add_epi8(src, pred); - out[i + j] = _mm_cvtsi128_si32(L); - // Shift the pre-computed value for the next iteration. - T = _mm_srli_si128(T, 4); - TL = _mm_srli_si128(TL, 4); - src = _mm_srli_si128(src, 4); - pa = _mm_srli_si128(pa, 4); + { + // We can unpack with any value on the upper 32 bits, provided it's the + // same on both operands (so that their sum of abs diff is zero). Here we + // use T. + const __m128i T_lo = _mm_unpacklo_epi32(T, T); + const __m128i TL_lo = _mm_unpacklo_epi32(TL, T); + const __m128i T_hi = _mm_unpackhi_epi32(T, T); + const __m128i TL_hi = _mm_unpackhi_epi32(TL, T); + const __m128i s_lo = _mm_sad_epu8(T_lo, TL_lo); + const __m128i s_hi = _mm_sad_epu8(T_hi, TL_hi); + pa = _mm_packs_epi32(s_lo, s_hi); // pa = sum |T-TL| } + DO_PRED11(0); + DO_PRED11_SHIFT; + DO_PRED11(1); + DO_PRED11_SHIFT; + DO_PRED11(2); + DO_PRED11_SHIFT; + DO_PRED11(3); } if (i != num_pixels) { VP8LPredictorsAdd_C[11](in + i, upper + i, num_pixels - i, out + i); } } +#undef DO_PRED11 +#undef DO_PRED11_SHIFT // Predictor12: ClampedAddSubtractFull. -#define DO_PRED12(DIFF, LANE, OUT) \ -do { \ - const __m128i all = _mm_add_epi16(L, (DIFF)); \ - const __m128i alls = _mm_packus_epi16(all, all); \ - const __m128i res = _mm_add_epi8(src, alls); \ - out[i + (OUT)] = _mm_cvtsi128_si32(res); \ - L = _mm_unpacklo_epi8(res, zero); \ +#define DO_PRED12(DIFF, LANE, OUT) do { \ + const __m128i all = _mm_add_epi16(L, (DIFF)); \ + const __m128i alls = _mm_packus_epi16(all, all); \ + const __m128i res = _mm_add_epi8(src, alls); \ + out[i + (OUT)] = _mm_cvtsi128_si32(res); \ + L = _mm_unpacklo_epi8(res, zero); \ +} while (0) + +#define DO_PRED12_SHIFT(DIFF, LANE) do { \ /* Shift the pre-computed value for the next iteration.*/ \ - if (LANE == 0) (DIFF) = _mm_srli_si128((DIFF), 8); \ + if ((LANE) == 0) (DIFF) = _mm_srli_si128((DIFF), 8); \ src = _mm_srli_si128(src, 4); \ } while (0) @@ -377,8 +408,11 @@ static void PredictorAdd12_SSE2(const uint32_t* in, const uint32_t* upper, __m128i diff_lo = _mm_sub_epi16(T_lo, TL_lo); __m128i diff_hi = _mm_sub_epi16(T_hi, TL_hi); DO_PRED12(diff_lo, 0, 0); + DO_PRED12_SHIFT(diff_lo, 0); DO_PRED12(diff_lo, 1, 1); + DO_PRED12_SHIFT(diff_lo, 1); DO_PRED12(diff_hi, 0, 2); + DO_PRED12_SHIFT(diff_hi, 0); DO_PRED12(diff_hi, 1, 3); } if (i != num_pixels) { @@ -386,6 +420,7 @@ static void PredictorAdd12_SSE2(const uint32_t* in, const uint32_t* upper, } } #undef DO_PRED12 +#undef DO_PRED12_SHIFT // Due to averages with integers, values cannot be accumulated in parallel for // predictors 13. @@ -394,8 +429,8 @@ GENERATE_PREDICTOR_ADD(Predictor13_SSE2, PredictorAdd13_SSE2) //------------------------------------------------------------------------------ // Subtract-Green Transform -static void AddGreenToBlueAndRed(const uint32_t* const src, int num_pixels, - uint32_t* dst) { +static void AddGreenToBlueAndRed_SSE2(const uint32_t* const src, int num_pixels, + uint32_t* dst) { int i; for (i = 0; i + 4 <= num_pixels; i += 4) { const __m128i in = _mm_loadu_si128((const __m128i*)&src[i]); // argb @@ -414,19 +449,16 @@ static void AddGreenToBlueAndRed(const uint32_t* const src, int num_pixels, //------------------------------------------------------------------------------ // Color Transform -static void TransformColorInverse(const VP8LMultipliers* const m, - const uint32_t* const src, int num_pixels, - uint32_t* dst) { +static void TransformColorInverse_SSE2(const VP8LMultipliers* const m, + const uint32_t* const src, + int num_pixels, uint32_t* dst) { // sign-extended multiplying constants, pre-shifted by 5. #define CST(X) (((int16_t)(m->X << 8)) >> 5) // sign-extend - const __m128i mults_rb = _mm_set_epi16( - CST(green_to_red_), CST(green_to_blue_), - CST(green_to_red_), CST(green_to_blue_), - CST(green_to_red_), CST(green_to_blue_), - CST(green_to_red_), CST(green_to_blue_)); - const __m128i mults_b2 = _mm_set_epi16( - CST(red_to_blue_), 0, CST(red_to_blue_), 0, - CST(red_to_blue_), 0, CST(red_to_blue_), 0); +#define MK_CST_16(HI, LO) \ + _mm_set1_epi32((int)(((uint32_t)(HI) << 16) | ((LO) & 0xffff))) + const __m128i mults_rb = MK_CST_16(CST(green_to_red_), CST(green_to_blue_)); + const __m128i mults_b2 = MK_CST_16(CST(red_to_blue_), 0); +#undef MK_CST_16 #undef CST const __m128i mask_ag = _mm_set1_epi32(0xff00ff00); // alpha-green masks int i; @@ -454,8 +486,8 @@ static void TransformColorInverse(const VP8LMultipliers* const m, //------------------------------------------------------------------------------ // Color-space conversion functions -static void ConvertBGRAToRGB(const uint32_t* src, int num_pixels, - uint8_t* dst) { +static void ConvertBGRAToRGB_SSE2(const uint32_t* src, int num_pixels, + uint8_t* dst) { const __m128i* in = (const __m128i*)src; __m128i* out = (__m128i*)dst; @@ -469,11 +501,11 @@ static void ConvertBGRAToRGB(const uint32_t* src, int num_pixels, __m128i in5 = _mm_loadu_si128(in + 5); __m128i in6 = _mm_loadu_si128(in + 6); __m128i in7 = _mm_loadu_si128(in + 7); - VP8L32bToPlanar(&in0, &in1, &in2, &in3); - VP8L32bToPlanar(&in4, &in5, &in6, &in7); + VP8L32bToPlanar_SSE2(&in0, &in1, &in2, &in3); + VP8L32bToPlanar_SSE2(&in4, &in5, &in6, &in7); // At this points, in1/in5 contains red only, in2/in6 green only ... // Pack the colors in 24b RGB. - VP8PlanarTo24b(&in1, &in5, &in2, &in6, &in3, &in7); + VP8PlanarTo24b_SSE2(&in1, &in5, &in2, &in6, &in3, &in7); _mm_storeu_si128(out + 0, in1); _mm_storeu_si128(out + 1, in5); _mm_storeu_si128(out + 2, in2); @@ -490,27 +522,26 @@ static void ConvertBGRAToRGB(const uint32_t* src, int num_pixels, } } -static void ConvertBGRAToRGBA(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA_SSE2(const uint32_t* src, + int num_pixels, uint8_t* dst) { + const __m128i red_blue_mask = _mm_set1_epi32(0x00ff00ffu); const __m128i* in = (const __m128i*)src; __m128i* out = (__m128i*)dst; while (num_pixels >= 8) { - const __m128i bgra0 = _mm_loadu_si128(in++); // bgra0|bgra1|bgra2|bgra3 - const __m128i bgra4 = _mm_loadu_si128(in++); // bgra4|bgra5|bgra6|bgra7 - const __m128i v0l = _mm_unpacklo_epi8(bgra0, bgra4); // b0b4g0g4r0r4a0a4... - const __m128i v0h = _mm_unpackhi_epi8(bgra0, bgra4); // b2b6g2g6r2r6a2a6... - const __m128i v1l = _mm_unpacklo_epi8(v0l, v0h); // b0b2b4b6g0g2g4g6... - const __m128i v1h = _mm_unpackhi_epi8(v0l, v0h); // b1b3b5b7g1g3g5g7... - const __m128i v2l = _mm_unpacklo_epi8(v1l, v1h); // b0...b7 | g0...g7 - const __m128i v2h = _mm_unpackhi_epi8(v1l, v1h); // r0...r7 | a0...a7 - const __m128i ga0 = _mm_unpackhi_epi64(v2l, v2h); // g0...g7 | a0...a7 - const __m128i rb0 = _mm_unpacklo_epi64(v2h, v2l); // r0...r7 | b0...b7 - const __m128i rg0 = _mm_unpacklo_epi8(rb0, ga0); // r0g0r1g1 ... r6g6r7g7 - const __m128i ba0 = _mm_unpackhi_epi8(rb0, ga0); // b0a0b1a1 ... b6a6b7a7 - const __m128i rgba0 = _mm_unpacklo_epi16(rg0, ba0); // rgba0|rgba1... - const __m128i rgba4 = _mm_unpackhi_epi16(rg0, ba0); // rgba4|rgba5... - _mm_storeu_si128(out++, rgba0); - _mm_storeu_si128(out++, rgba4); + const __m128i A1 = _mm_loadu_si128(in++); + const __m128i A2 = _mm_loadu_si128(in++); + const __m128i B1 = _mm_and_si128(A1, red_blue_mask); // R 0 B 0 + const __m128i B2 = _mm_and_si128(A2, red_blue_mask); // R 0 B 0 + const __m128i C1 = _mm_andnot_si128(red_blue_mask, A1); // 0 G 0 A + const __m128i C2 = _mm_andnot_si128(red_blue_mask, A2); // 0 G 0 A + const __m128i D1 = _mm_shufflelo_epi16(B1, _MM_SHUFFLE(2, 3, 0, 1)); + const __m128i D2 = _mm_shufflelo_epi16(B2, _MM_SHUFFLE(2, 3, 0, 1)); + const __m128i E1 = _mm_shufflehi_epi16(D1, _MM_SHUFFLE(2, 3, 0, 1)); + const __m128i E2 = _mm_shufflehi_epi16(D2, _MM_SHUFFLE(2, 3, 0, 1)); + const __m128i F1 = _mm_or_si128(E1, C1); + const __m128i F2 = _mm_or_si128(E2, C2); + _mm_storeu_si128(out++, F1); + _mm_storeu_si128(out++, F2); num_pixels -= 8; } // left-overs @@ -519,8 +550,8 @@ static void ConvertBGRAToRGBA(const uint32_t* src, } } -static void ConvertBGRAToRGBA4444(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGBA4444_SSE2(const uint32_t* src, + int num_pixels, uint8_t* dst) { const __m128i mask_0x0f = _mm_set1_epi8(0x0f); const __m128i mask_0xf0 = _mm_set1_epi8(0xf0); const __m128i* in = (const __m128i*)src; @@ -541,7 +572,7 @@ static void ConvertBGRAToRGBA4444(const uint32_t* src, const __m128i ga2 = _mm_and_si128(ga1, mask_0x0f); // g0-|g1-|...|a6-|a7- const __m128i rgba0 = _mm_or_si128(ga2, rb1); // rg0..rg7 | ba0..ba7 const __m128i rgba1 = _mm_srli_si128(rgba0, 8); // ba0..ba7 | 0 -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) const __m128i rgba = _mm_unpacklo_epi8(rgba1, rgba0); // barg0...barg7 #else const __m128i rgba = _mm_unpacklo_epi8(rgba0, rgba1); // rgba0...rgba7 @@ -555,8 +586,8 @@ static void ConvertBGRAToRGBA4444(const uint32_t* src, } } -static void ConvertBGRAToRGB565(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToRGB565_SSE2(const uint32_t* src, + int num_pixels, uint8_t* dst) { const __m128i mask_0xe0 = _mm_set1_epi8(0xe0); const __m128i mask_0xf8 = _mm_set1_epi8(0xf8); const __m128i mask_0x07 = _mm_set1_epi8(0x07); @@ -582,7 +613,7 @@ static void ConvertBGRAToRGB565(const uint32_t* src, const __m128i rg1 = _mm_or_si128(rb1, g_lo2); // gr0...gr7|xx const __m128i b1 = _mm_srli_epi16(b0, 3); const __m128i gb1 = _mm_or_si128(b1, g_hi2); // bg0...bg7|xx -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) const __m128i rgba = _mm_unpacklo_epi8(gb1, rg1); // rggb0...rggb7 #else const __m128i rgba = _mm_unpacklo_epi8(rg1, gb1); // bgrb0...bgrb7 @@ -596,8 +627,8 @@ static void ConvertBGRAToRGB565(const uint32_t* src, } } -static void ConvertBGRAToBGR(const uint32_t* src, - int num_pixels, uint8_t* dst) { +static void ConvertBGRAToBGR_SSE2(const uint32_t* src, + int num_pixels, uint8_t* dst) { const __m128i mask_l = _mm_set_epi32(0, 0x00ffffff, 0, 0x00ffffff); const __m128i mask_h = _mm_set_epi32(0x00ffffff, 0, 0x00ffffff, 0); const __m128i* in = (const __m128i*)src; @@ -660,14 +691,14 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitSSE2(void) { VP8LPredictorsAdd[12] = PredictorAdd12_SSE2; VP8LPredictorsAdd[13] = PredictorAdd13_SSE2; - VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed; - VP8LTransformColorInverse = TransformColorInverse; + VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed_SSE2; + VP8LTransformColorInverse = TransformColorInverse_SSE2; - VP8LConvertBGRAToRGB = ConvertBGRAToRGB; - VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA; - VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444; - VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565; - VP8LConvertBGRAToBGR = ConvertBGRAToBGR; + VP8LConvertBGRAToRGB = ConvertBGRAToRGB_SSE2; + VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA_SSE2; + VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444_SSE2; + VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565_SSE2; + VP8LConvertBGRAToBGR = ConvertBGRAToBGR_SSE2; } #else // !WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/msa_macro.h b/Pods/libwebp/src/dsp/msa_macro.h index d0e5f45..de026a1 100644 --- a/Pods/libwebp/src/dsp/msa_macro.h +++ b/Pods/libwebp/src/dsp/msa_macro.h @@ -22,6 +22,7 @@ #endif #ifdef CLANG_BUILD + #define ALPHAVAL (-1) #define ADDVI_H(a, b) __msa_addvi_h((v8i16)a, b) #define ADDVI_W(a, b) __msa_addvi_w((v4i32)a, b) #define SRAI_B(a, b) __msa_srai_b((v16i8)a, b) @@ -32,6 +33,7 @@ #define ANDI_B(a, b) __msa_andi_b((v16u8)a, b) #define ORI_B(a, b) __msa_ori_b((v16u8)a, b) #else + #define ALPHAVAL (0xff) #define ADDVI_H(a, b) (a + b) #define ADDVI_W(a, b) (a + b) #define SRAI_B(a, b) (a >> b) @@ -1387,4 +1389,4 @@ static WEBP_INLINE uint32_t func_hadd_uh_u32(v8u16 in) { } while (0) #define AVER_UB2_UB(...) AVER_UB2(v16u8, __VA_ARGS__) -#endif /* WEBP_DSP_MSA_MACRO_H_ */ +#endif // WEBP_DSP_MSA_MACRO_H_ diff --git a/Pods/libwebp/src/dsp/neon.h b/Pods/libwebp/src/dsp/neon.h index 3b548a6..aa1dea1 100644 --- a/Pods/libwebp/src/dsp/neon.h +++ b/Pods/libwebp/src/dsp/neon.h @@ -14,11 +14,12 @@ #include -#include "./dsp.h" +#include "src/dsp/dsp.h" // Right now, some intrinsics functions seem slower, so we disable them -// everywhere except aarch64 where the inline assembly is incompatible. -#if defined(__aarch64__) +// everywhere except newer clang/gcc or aarch64 where the inline assembly is +// incompatible. +#if LOCAL_CLANG_PREREQ(3,8) || LOCAL_GCC_PREREQ(4,9) || defined(__aarch64__) #define WEBP_USE_INTRINSICS // use intrinsics when possible #endif @@ -43,11 +44,11 @@ // if using intrinsics, this flag avoids some functions that make gcc-4.6.3 // crash ("internal compiler error: in immed_double_const, at emit-rtl."). // (probably similar to gcc.gnu.org/bugzilla/show_bug.cgi?id=48183) -#if !(LOCAL_GCC_PREREQ(4,8) || defined(__aarch64__)) +#if !(LOCAL_CLANG_PREREQ(3,8) || LOCAL_GCC_PREREQ(4,8) || defined(__aarch64__)) #define WORK_AROUND_GCC #endif -static WEBP_INLINE int32x4x4_t Transpose4x4(const int32x4x4_t rows) { +static WEBP_INLINE int32x4x4_t Transpose4x4_NEON(const int32x4x4_t rows) { uint64x2x2_t row01, row23; row01.val[0] = vreinterpretq_u64_s32(rows.val[0]); diff --git a/Pods/libwebp/src/dsp/quant.h b/Pods/libwebp/src/dsp/quant.h new file mode 100644 index 0000000..5e8dba8 --- /dev/null +++ b/Pods/libwebp/src/dsp/quant.h @@ -0,0 +1,85 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- + +#ifndef WEBP_DSP_QUANT_H_ +#define WEBP_DSP_QUANT_H_ + +#include + +#include "src/dsp/dsp.h" +#include "src/webp/types.h" + +#if defined(WEBP_USE_NEON) && !defined(WEBP_ANDROID_NEON) && \ + !defined(WEBP_HAVE_NEON_RTCD) +#include + +#define IsFlat IsFlat_NEON + +static uint32x2_t horizontal_add_uint32x4(const uint32x4_t a) { + const uint64x2_t b = vpaddlq_u32(a); + return vadd_u32(vreinterpret_u32_u64(vget_low_u64(b)), + vreinterpret_u32_u64(vget_high_u64(b))); +} + +static WEBP_INLINE int IsFlat(const int16_t* levels, int num_blocks, + int thresh) { + const int16x8_t tst_ones = vdupq_n_s16(-1); + uint32x4_t sum = vdupq_n_u32(0); + + for (int i = 0; i < num_blocks; ++i) { + // Set DC to zero. + const int16x8_t a_0 = vsetq_lane_s16(0, vld1q_s16(levels), 0); + const int16x8_t a_1 = vld1q_s16(levels + 8); + + const uint16x8_t b_0 = vshrq_n_u16(vtstq_s16(a_0, tst_ones), 15); + const uint16x8_t b_1 = vshrq_n_u16(vtstq_s16(a_1, tst_ones), 15); + + sum = vpadalq_u16(sum, b_0); + sum = vpadalq_u16(sum, b_1); + + levels += 16; + } + return thresh >= (int32_t)vget_lane_u32(horizontal_add_uint32x4(sum), 0); +} + +#else + +#define IsFlat IsFlat_C + +static WEBP_INLINE int IsFlat(const int16_t* levels, int num_blocks, + int thresh) { + int score = 0; + while (num_blocks-- > 0) { // TODO(skal): refine positional scoring? + int i; + for (i = 1; i < 16; ++i) { // omit DC, we're only interested in AC + score += (levels[i] != 0); + if (score > thresh) return 0; + } + levels += 16; + } + return 1; +} + +#endif // defined(WEBP_USE_NEON) && !defined(WEBP_ANDROID_NEON) && + // !defined(WEBP_HAVE_NEON_RTCD) + +static WEBP_INLINE int IsFlatSource16(const uint8_t* src) { + const uint32_t v = src[0] * 0x01010101u; + int i; + for (i = 0; i < 16; ++i) { + if (memcmp(src + 0, &v, 4) || memcmp(src + 4, &v, 4) || + memcmp(src + 8, &v, 4) || memcmp(src + 12, &v, 4)) { + return 0; + } + src += BPS; + } + return 1; +} + +#endif // WEBP_DSP_QUANT_H_ diff --git a/Pods/libwebp/src/dsp/rescaler.c b/Pods/libwebp/src/dsp/rescaler.c index 0f54502..c5a01e8 100644 --- a/Pods/libwebp/src/dsp/rescaler.c +++ b/Pods/libwebp/src/dsp/rescaler.c @@ -13,19 +13,21 @@ #include -#include "./dsp.h" -#include "../utils/rescaler_utils.h" +#include "src/dsp/dsp.h" +#include "src/utils/rescaler_utils.h" //------------------------------------------------------------------------------ // Implementations of critical functions ImportRow / ExportRow #define ROUNDER (WEBP_RESCALER_ONE >> 1) #define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) +#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX) //------------------------------------------------------------------------------ // Row import -void WebPRescalerImportRowExpandC(WebPRescaler* const wrk, const uint8_t* src) { +void WebPRescalerImportRowExpand_C(WebPRescaler* const wrk, + const uint8_t* src) { const int x_stride = wrk->num_channels; const int x_out_max = wrk->dst_width * wrk->num_channels; int channel; @@ -56,7 +58,8 @@ void WebPRescalerImportRowExpandC(WebPRescaler* const wrk, const uint8_t* src) { } } -void WebPRescalerImportRowShrinkC(WebPRescaler* const wrk, const uint8_t* src) { +void WebPRescalerImportRowShrink_C(WebPRescaler* const wrk, + const uint8_t* src) { const int x_stride = wrk->num_channels; const int x_out_max = wrk->dst_width * wrk->num_channels; int channel; @@ -92,7 +95,7 @@ void WebPRescalerImportRowShrinkC(WebPRescaler* const wrk, const uint8_t* src) { //------------------------------------------------------------------------------ // Row export -void WebPRescalerExportRowExpandC(WebPRescaler* const wrk) { +void WebPRescalerExportRowExpand_C(WebPRescaler* const wrk) { int x_out; uint8_t* const dst = wrk->dst; rescaler_t* const irow = wrk->irow; @@ -106,8 +109,7 @@ void WebPRescalerExportRowExpandC(WebPRescaler* const wrk) { for (x_out = 0; x_out < x_out_max; ++x_out) { const uint32_t J = frow[x_out]; const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } else { const uint32_t B = WEBP_RESCALER_FRAC(-wrk->y_accum, wrk->y_sub); @@ -117,13 +119,12 @@ void WebPRescalerExportRowExpandC(WebPRescaler* const wrk) { + (uint64_t)B * irow[x_out]; const uint32_t J = (uint32_t)((I + ROUNDER) >> WEBP_RESCALER_RFIX); const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } } -void WebPRescalerExportRowShrinkC(WebPRescaler* const wrk) { +void WebPRescalerExportRowShrink_C(WebPRescaler* const wrk) { int x_out; uint8_t* const dst = wrk->dst; rescaler_t* const irow = wrk->irow; @@ -135,22 +136,21 @@ void WebPRescalerExportRowShrinkC(WebPRescaler* const wrk) { assert(!wrk->y_expand); if (yscale) { for (x_out = 0; x_out < x_out_max; ++x_out) { - const uint32_t frac = (uint32_t)MULT_FIX(frow[x_out], yscale); + const uint32_t frac = (uint32_t)MULT_FIX_FLOOR(frow[x_out], yscale); const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = frac; // new fractional start } } else { for (x_out = 0; x_out < x_out_max; ++x_out) { const int v = (int)MULT_FIX(irow[x_out], wrk->fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = 0; } } } +#undef MULT_FIX_FLOOR #undef MULT_FIX #undef ROUNDER @@ -202,16 +202,15 @@ extern void WebPRescalerDspInitMIPSdspR2(void); extern void WebPRescalerDspInitMSA(void); extern void WebPRescalerDspInitNEON(void); -static volatile VP8CPUInfo rescaler_last_cpuinfo_used = - (VP8CPUInfo)&rescaler_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { - if (rescaler_last_cpuinfo_used == VP8GetCPUInfo) return; +WEBP_DSP_INIT_FUNC(WebPRescalerDspInit) { +#if !defined(WEBP_REDUCE_SIZE) +#if !WEBP_NEON_OMIT_C_CODE + WebPRescalerExportRowExpand = WebPRescalerExportRowExpand_C; + WebPRescalerExportRowShrink = WebPRescalerExportRowShrink_C; +#endif - WebPRescalerImportRowExpand = WebPRescalerImportRowExpandC; - WebPRescalerImportRowShrink = WebPRescalerImportRowShrinkC; - WebPRescalerExportRowExpand = WebPRescalerExportRowExpandC; - WebPRescalerExportRowShrink = WebPRescalerExportRowShrinkC; + WebPRescalerImportRowExpand = WebPRescalerImportRowExpand_C; + WebPRescalerImportRowShrink = WebPRescalerImportRowShrink_C; if (VP8GetCPUInfo != NULL) { #if defined(WEBP_USE_SSE2) @@ -219,11 +218,6 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { WebPRescalerDspInitSSE2(); } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - WebPRescalerDspInitNEON(); - } -#endif #if defined(WEBP_USE_MIPS32) if (VP8GetCPUInfo(kMIPS32)) { WebPRescalerDspInitMIPS32(); @@ -240,5 +234,17 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { } #endif } - rescaler_last_cpuinfo_used = VP8GetCPUInfo; + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + WebPRescalerDspInitNEON(); + } +#endif + + assert(WebPRescalerExportRowExpand != NULL); + assert(WebPRescalerExportRowShrink != NULL); + assert(WebPRescalerImportRowExpand != NULL); + assert(WebPRescalerImportRowShrink != NULL); +#endif // WEBP_REDUCE_SIZE } diff --git a/Pods/libwebp/src/dsp/rescaler_mips32.c b/Pods/libwebp/src/dsp/rescaler_mips32.c index e09ad5d..61f63c6 100644 --- a/Pods/libwebp/src/dsp/rescaler_mips32.c +++ b/Pods/libwebp/src/dsp/rescaler_mips32.c @@ -11,17 +11,18 @@ // // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" -#if defined(WEBP_USE_MIPS32) +#if defined(WEBP_USE_MIPS32) && !defined(WEBP_REDUCE_SIZE) #include -#include "../utils/rescaler_utils.h" +#include "src/utils/rescaler_utils.h" //------------------------------------------------------------------------------ // Row import -static void ImportRowShrink(WebPRescaler* const wrk, const uint8_t* src) { +static void ImportRowShrink_MIPS32(WebPRescaler* const wrk, + const uint8_t* src) { const int x_stride = wrk->num_channels; const int x_out_max = wrk->dst_width * wrk->num_channels; const int fx_scale = wrk->fx_scale; @@ -80,7 +81,8 @@ static void ImportRowShrink(WebPRescaler* const wrk, const uint8_t* src) { } } -static void ImportRowExpand(WebPRescaler* const wrk, const uint8_t* src) { +static void ImportRowExpand_MIPS32(WebPRescaler* const wrk, + const uint8_t* src) { const int x_stride = wrk->num_channels; const int x_out_max = wrk->dst_width * wrk->num_channels; const int x_add = wrk->x_add; @@ -144,7 +146,7 @@ static void ImportRowExpand(WebPRescaler* const wrk, const uint8_t* src) { //------------------------------------------------------------------------------ // Row export -static void ExportRowExpand(WebPRescaler* const wrk) { +static void ExportRowExpand_MIPS32(WebPRescaler* const wrk) { uint8_t* dst = wrk->dst; rescaler_t* irow = wrk->irow; const int x_out_max = wrk->dst_width * wrk->num_channels; @@ -207,7 +209,8 @@ static void ExportRowExpand(WebPRescaler* const wrk) { } } -static void ExportRowShrink(WebPRescaler* const wrk) { +#if 0 // disabled for now. TODO(skal): make match the C-code +static void ExportRowShrink_MIPS32(WebPRescaler* const wrk) { const int x_out_max = wrk->dst_width * wrk->num_channels; uint8_t* dst = wrk->dst; rescaler_t* irow = wrk->irow; @@ -271,6 +274,7 @@ static void ExportRowShrink(WebPRescaler* const wrk) { ); } } +#endif // 0 //------------------------------------------------------------------------------ // Entry point @@ -278,10 +282,10 @@ static void ExportRowShrink(WebPRescaler* const wrk) { extern void WebPRescalerDspInitMIPS32(void); WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPS32(void) { - WebPRescalerImportRowExpand = ImportRowExpand; - WebPRescalerImportRowShrink = ImportRowShrink; - WebPRescalerExportRowExpand = ExportRowExpand; - WebPRescalerExportRowShrink = ExportRowShrink; + WebPRescalerImportRowExpand = ImportRowExpand_MIPS32; + WebPRescalerImportRowShrink = ImportRowShrink_MIPS32; + WebPRescalerExportRowExpand = ExportRowExpand_MIPS32; +// WebPRescalerExportRowShrink = ExportRowShrink_MIPS32; } #else // !WEBP_USE_MIPS32 diff --git a/Pods/libwebp/src/dsp/rescaler_mips_dsp_r2.c b/Pods/libwebp/src/dsp/rescaler_mips_dsp_r2.c index 2308d64..419b741 100644 --- a/Pods/libwebp/src/dsp/rescaler_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/rescaler_mips_dsp_r2.c @@ -11,20 +11,22 @@ // // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" -#if defined(WEBP_USE_MIPS_DSP_R2) +#if defined(WEBP_USE_MIPS_DSP_R2) && !defined(WEBP_REDUCE_SIZE) #include -#include "../utils/rescaler_utils.h" +#include "src/utils/rescaler_utils.h" #define ROUNDER (WEBP_RESCALER_ONE >> 1) #define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) +#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX) //------------------------------------------------------------------------------ // Row export -static void ExportRowShrink(WebPRescaler* const wrk) { +#if 0 // disabled for now. TODO(skal): make match the C-code +static void ExportRowShrink_MIPSdspR2(WebPRescaler* const wrk) { int i; const int x_out_max = wrk->dst_width * wrk->num_channels; uint8_t* dst = wrk->dst; @@ -105,10 +107,9 @@ static void ExportRowShrink(WebPRescaler* const wrk) { ); } for (i = 0; i < (x_out_max & 0x3); ++i) { - const uint32_t frac = (uint32_t)MULT_FIX(*frow++, yscale); + const uint32_t frac = (uint32_t)MULT_FIX_FLOOR(*frow++, yscale); const int v = (int)MULT_FIX(*irow - frac, wrk->fxy_scale); - assert(v >= 0 && v <= 255); - *dst++ = v; + *dst++ = (v > 255) ? 255u : (uint8_t)v; *irow++ = frac; // new fractional start } } else { @@ -154,15 +155,15 @@ static void ExportRowShrink(WebPRescaler* const wrk) { ); } for (i = 0; i < (x_out_max & 0x3); ++i) { - const int v = (int)MULT_FIX(*irow, wrk->fxy_scale); - assert(v >= 0 && v <= 255); - *dst++ = v; + const int v = (int)MULT_FIX_FLOOR(*irow, wrk->fxy_scale); + *dst++ = (v > 255) ? 255u : (uint8_t)v; *irow++ = 0; } } } +#endif // 0 -static void ExportRowExpand(WebPRescaler* const wrk) { +static void ExportRowExpand_MIPSdspR2(WebPRescaler* const wrk) { int i; uint8_t* dst = wrk->dst; rescaler_t* irow = wrk->irow; @@ -216,8 +217,7 @@ static void ExportRowExpand(WebPRescaler* const wrk) { for (i = 0; i < (x_out_max & 0x3); ++i) { const uint32_t J = *frow++; const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - *dst++ = v; + *dst++ = (v > 255) ? 255u : (uint8_t)v; } } else { const uint32_t B = WEBP_RESCALER_FRAC(-wrk->y_accum, wrk->y_sub); @@ -288,12 +288,12 @@ static void ExportRowExpand(WebPRescaler* const wrk) { + (uint64_t)B * *irow++; const uint32_t J = (uint32_t)((I + ROUNDER) >> WEBP_RESCALER_RFIX); const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - *dst++ = v; + *dst++ = (v > 255) ? 255u : (uint8_t)v; } } } +#undef MULT_FIX_FLOOR #undef MULT_FIX #undef ROUNDER @@ -303,8 +303,8 @@ static void ExportRowExpand(WebPRescaler* const wrk) { extern void WebPRescalerDspInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPSdspR2(void) { - WebPRescalerExportRowExpand = ExportRowExpand; - WebPRescalerExportRowShrink = ExportRowShrink; + WebPRescalerExportRowExpand = ExportRowExpand_MIPSdspR2; +// WebPRescalerExportRowShrink = ExportRowShrink_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/rescaler_msa.c b/Pods/libwebp/src/dsp/rescaler_msa.c index 2c10e55..256dbdd 100644 --- a/Pods/libwebp/src/dsp/rescaler_msa.c +++ b/Pods/libwebp/src/dsp/rescaler_msa.c @@ -11,17 +11,18 @@ // // Author: Prashant Patil (prashant.patil@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" -#if defined(WEBP_USE_MSA) +#if defined(WEBP_USE_MSA) && !defined(WEBP_REDUCE_SIZE) #include -#include "../utils/rescaler_utils.h" -#include "./msa_macro.h" +#include "src/utils/rescaler_utils.h" +#include "src/dsp/msa_macro.h" #define ROUNDER (WEBP_RESCALER_ONE >> 1) #define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) +#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX) #define CALC_MULT_FIX_16(in0, in1, in2, in3, scale, shift, dst) do { \ v4u32 tmp0, tmp1, tmp2, tmp3; \ @@ -165,8 +166,7 @@ static WEBP_INLINE void ExportRowExpand_0(const uint32_t* frow, uint8_t* dst, for (x_out = 0; x_out < length; ++x_out) { const uint32_t J = frow[x_out]; const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } } @@ -240,13 +240,12 @@ static WEBP_INLINE void ExportRowExpand_1(const uint32_t* frow, uint32_t* irow, + (uint64_t)B * irow[x_out]; const uint32_t J = (uint32_t)((I + ROUNDER) >> WEBP_RESCALER_RFIX); const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } } -static void RescalerExportRowExpand(WebPRescaler* const wrk) { +static void RescalerExportRowExpand_MIPSdspR2(WebPRescaler* const wrk) { uint8_t* dst = wrk->dst; rescaler_t* irow = wrk->irow; const int x_out_max = wrk->dst_width * wrk->num_channels; @@ -262,6 +261,7 @@ static void RescalerExportRowExpand(WebPRescaler* const wrk) { } } +#if 0 // disabled for now. TODO(skal): make match the C-code static WEBP_INLINE void ExportRowShrink_0(const uint32_t* frow, uint32_t* irow, uint8_t* dst, int length, const uint32_t yscale, @@ -340,10 +340,9 @@ static WEBP_INLINE void ExportRowShrink_0(const uint32_t* frow, uint32_t* irow, length -= 4; } for (x_out = 0; x_out < length; ++x_out) { - const uint32_t frac = (uint32_t)MULT_FIX(frow[x_out], yscale); + const uint32_t frac = (uint32_t)MULT_FIX_FLOOR(frow[x_out], yscale); const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = frac; } } @@ -404,14 +403,13 @@ static WEBP_INLINE void ExportRowShrink_1(uint32_t* irow, uint8_t* dst, } for (x_out = 0; x_out < length; ++x_out) { const int v = (int)MULT_FIX(irow[x_out], wrk->fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = 0; } } } -static void RescalerExportRowShrink(WebPRescaler* const wrk) { +static void RescalerExportRowShrink_MIPSdspR2(WebPRescaler* const wrk) { uint8_t* dst = wrk->dst; rescaler_t* irow = wrk->irow; const int x_out_max = wrk->dst_width * wrk->num_channels; @@ -426,6 +424,7 @@ static void RescalerExportRowShrink(WebPRescaler* const wrk) { ExportRowShrink_1(irow, dst, x_out_max, wrk); } } +#endif // 0 //------------------------------------------------------------------------------ // Entry point @@ -433,8 +432,8 @@ static void RescalerExportRowShrink(WebPRescaler* const wrk) { extern void WebPRescalerDspInitMSA(void); WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMSA(void) { - WebPRescalerExportRowExpand = RescalerExportRowExpand; - WebPRescalerExportRowShrink = RescalerExportRowShrink; + WebPRescalerExportRowExpand = RescalerExportRowExpand_MIPSdspR2; +// WebPRescalerExportRowShrink = RescalerExportRowShrink_MIPSdspR2; } #else // !WEBP_USE_MSA diff --git a/Pods/libwebp/src/dsp/rescaler_neon.c b/Pods/libwebp/src/dsp/rescaler_neon.c index b2dd8f3..b976a85 100644 --- a/Pods/libwebp/src/dsp/rescaler_neon.c +++ b/Pods/libwebp/src/dsp/rescaler_neon.c @@ -11,17 +11,18 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" -#if defined(WEBP_USE_NEON) +#if defined(WEBP_USE_NEON) && !defined(WEBP_REDUCE_SIZE) #include #include -#include "./neon.h" -#include "../utils/rescaler_utils.h" +#include "src/dsp/neon.h" +#include "src/utils/rescaler_utils.h" #define ROUNDER (WEBP_RESCALER_ONE >> 1) #define MULT_FIX_C(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) +#define MULT_FIX_FLOOR_C(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX) #define LOAD_32x4(SRC, DST) const uint32x4_t DST = vld1q_u32((SRC)) #define LOAD_32x8(SRC, DST0, DST1) \ @@ -35,15 +36,18 @@ #if (WEBP_RESCALER_RFIX == 32) #define MAKE_HALF_CST(C) vdupq_n_s32((int32_t)((C) >> 1)) -#define MULT_FIX(A, B) /* note: B is actualy scale>>1. See MAKE_HALF_CST */ \ +// note: B is actualy scale>>1. See MAKE_HALF_CST +#define MULT_FIX(A, B) \ vreinterpretq_u32_s32(vqrdmulhq_s32(vreinterpretq_s32_u32((A)), (B))) +#define MULT_FIX_FLOOR(A, B) \ + vreinterpretq_u32_s32(vqdmulhq_s32(vreinterpretq_s32_u32((A)), (B))) #else #error "MULT_FIX/WEBP_RESCALER_RFIX need some more work" #endif -static uint32x4_t Interpolate(const rescaler_t* const frow, - const rescaler_t* const irow, - uint32_t A, uint32_t B) { +static uint32x4_t Interpolate_NEON(const rescaler_t* const frow, + const rescaler_t* const irow, + uint32_t A, uint32_t B) { LOAD_32x4(frow, A0); LOAD_32x4(irow, B0); const uint64x2_t C0 = vmull_n_u32(vget_low_u32(A0), A); @@ -56,7 +60,7 @@ static uint32x4_t Interpolate(const rescaler_t* const frow, return E; } -static void RescalerExportRowExpand(WebPRescaler* const wrk) { +static void RescalerExportRowExpand_NEON(WebPRescaler* const wrk) { int x_out; uint8_t* const dst = wrk->dst; rescaler_t* const irow = wrk->irow; @@ -77,28 +81,27 @@ static void RescalerExportRowExpand(WebPRescaler* const wrk) { const uint32x4_t B1 = MULT_FIX(A1, fy_scale_half); const uint16x4_t C0 = vmovn_u32(B0); const uint16x4_t C1 = vmovn_u32(B1); - const uint8x8_t D = vmovn_u16(vcombine_u16(C0, C1)); + const uint8x8_t D = vqmovn_u16(vcombine_u16(C0, C1)); vst1_u8(dst + x_out, D); } for (; x_out < x_out_max; ++x_out) { const uint32_t J = frow[x_out]; const int v = (int)MULT_FIX_C(J, fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } else { const uint32_t B = WEBP_RESCALER_FRAC(-wrk->y_accum, wrk->y_sub); const uint32_t A = (uint32_t)(WEBP_RESCALER_ONE - B); for (x_out = 0; x_out < max_span; x_out += 8) { const uint32x4_t C0 = - Interpolate(frow + x_out + 0, irow + x_out + 0, A, B); + Interpolate_NEON(frow + x_out + 0, irow + x_out + 0, A, B); const uint32x4_t C1 = - Interpolate(frow + x_out + 4, irow + x_out + 4, A, B); + Interpolate_NEON(frow + x_out + 4, irow + x_out + 4, A, B); const uint32x4_t D0 = MULT_FIX(C0, fy_scale_half); const uint32x4_t D1 = MULT_FIX(C1, fy_scale_half); const uint16x4_t E0 = vmovn_u32(D0); const uint16x4_t E1 = vmovn_u32(D1); - const uint8x8_t F = vmovn_u16(vcombine_u16(E0, E1)); + const uint8x8_t F = vqmovn_u16(vcombine_u16(E0, E1)); vst1_u8(dst + x_out, F); } for (; x_out < x_out_max; ++x_out) { @@ -106,13 +109,12 @@ static void RescalerExportRowExpand(WebPRescaler* const wrk) { + (uint64_t)B * irow[x_out]; const uint32_t J = (uint32_t)((I + ROUNDER) >> WEBP_RESCALER_RFIX); const int v = (int)MULT_FIX_C(J, fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } } -static void RescalerExportRowShrink(WebPRescaler* const wrk) { +static void RescalerExportRowShrink_NEON(WebPRescaler* const wrk) { int x_out; uint8_t* const dst = wrk->dst; rescaler_t* const irow = wrk->irow; @@ -131,23 +133,22 @@ static void RescalerExportRowShrink(WebPRescaler* const wrk) { for (x_out = 0; x_out < max_span; x_out += 8) { LOAD_32x8(frow + x_out, in0, in1); LOAD_32x8(irow + x_out, in2, in3); - const uint32x4_t A0 = MULT_FIX(in0, yscale_half); - const uint32x4_t A1 = MULT_FIX(in1, yscale_half); + const uint32x4_t A0 = MULT_FIX_FLOOR(in0, yscale_half); + const uint32x4_t A1 = MULT_FIX_FLOOR(in1, yscale_half); const uint32x4_t B0 = vqsubq_u32(in2, A0); const uint32x4_t B1 = vqsubq_u32(in3, A1); const uint32x4_t C0 = MULT_FIX(B0, fxy_scale_half); const uint32x4_t C1 = MULT_FIX(B1, fxy_scale_half); const uint16x4_t D0 = vmovn_u32(C0); const uint16x4_t D1 = vmovn_u32(C1); - const uint8x8_t E = vmovn_u16(vcombine_u16(D0, D1)); + const uint8x8_t E = vqmovn_u16(vcombine_u16(D0, D1)); vst1_u8(dst + x_out, E); STORE_32x8(A0, A1, irow + x_out); } for (; x_out < x_out_max; ++x_out) { - const uint32_t frac = (uint32_t)MULT_FIX_C(frow[x_out], yscale); - const int v = (int)MULT_FIX_C(irow[x_out] - frac, wrk->fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + const uint32_t frac = (uint32_t)MULT_FIX_FLOOR_C(frow[x_out], yscale); + const int v = (int)MULT_FIX_C(irow[x_out] - frac, fxy_scale); + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = frac; // new fractional start } } else { @@ -157,26 +158,31 @@ static void RescalerExportRowShrink(WebPRescaler* const wrk) { const uint32x4_t A1 = MULT_FIX(in1, fxy_scale_half); const uint16x4_t B0 = vmovn_u32(A0); const uint16x4_t B1 = vmovn_u32(A1); - const uint8x8_t C = vmovn_u16(vcombine_u16(B0, B1)); + const uint8x8_t C = vqmovn_u16(vcombine_u16(B0, B1)); vst1_u8(dst + x_out, C); STORE_32x8(zero, zero, irow + x_out); } for (; x_out < x_out_max; ++x_out) { const int v = (int)MULT_FIX_C(irow[x_out], fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = 0; } } } +#undef MULT_FIX_FLOOR_C +#undef MULT_FIX_C +#undef MULT_FIX_FLOOR +#undef MULT_FIX +#undef ROUNDER + //------------------------------------------------------------------------------ extern void WebPRescalerDspInitNEON(void); WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitNEON(void) { - WebPRescalerExportRowExpand = RescalerExportRowExpand; - WebPRescalerExportRowShrink = RescalerExportRowShrink; + WebPRescalerExportRowExpand = RescalerExportRowExpand_NEON; + WebPRescalerExportRowShrink = RescalerExportRowShrink_NEON; } #else // !WEBP_USE_NEON diff --git a/Pods/libwebp/src/dsp/rescaler_sse2.c b/Pods/libwebp/src/dsp/rescaler_sse2.c index 8271c22..d7effea 100644 --- a/Pods/libwebp/src/dsp/rescaler_sse2.c +++ b/Pods/libwebp/src/dsp/rescaler_sse2.c @@ -11,23 +11,24 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" -#if defined(WEBP_USE_SSE2) +#if defined(WEBP_USE_SSE2) && !defined(WEBP_REDUCE_SIZE) #include #include -#include "../utils/rescaler_utils.h" -#include "../utils/utils.h" +#include "src/utils/rescaler_utils.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // Implementations of critical functions ImportRow / ExportRow #define ROUNDER (WEBP_RESCALER_ONE >> 1) #define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) +#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX) // input: 8 bytes ABCDEFGH -> output: A0E0B0F0C0G0D0H0 -static void LoadTwoPixels(const uint8_t* const src, __m128i* out) { +static void LoadTwoPixels_SSE2(const uint8_t* const src, __m128i* out) { const __m128i zero = _mm_setzero_si128(); const __m128i A = _mm_loadl_epi64((const __m128i*)(src)); // ABCDEFGH const __m128i B = _mm_unpacklo_epi8(A, zero); // A0B0C0D0E0F0G0H0 @@ -36,28 +37,30 @@ static void LoadTwoPixels(const uint8_t* const src, __m128i* out) { } // input: 8 bytes ABCDEFGH -> output: A0B0C0D0E0F0G0H0 -static void LoadHeightPixels(const uint8_t* const src, __m128i* out) { +static void LoadEightPixels_SSE2(const uint8_t* const src, __m128i* out) { const __m128i zero = _mm_setzero_si128(); const __m128i A = _mm_loadl_epi64((const __m128i*)(src)); // ABCDEFGH *out = _mm_unpacklo_epi8(A, zero); } -static void RescalerImportRowExpandSSE2(WebPRescaler* const wrk, - const uint8_t* src) { +static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk, + const uint8_t* src) { rescaler_t* frow = wrk->frow; const rescaler_t* const frow_end = frow + wrk->dst_width * wrk->num_channels; const int x_add = wrk->x_add; int accum = x_add; __m128i cur_pixels; + // SSE2 implementation only works with 16b signed arithmetic at max. + if (wrk->src_width < 8 || accum >= (1 << 15)) { + WebPRescalerImportRowExpand_C(wrk, src); + return; + } + assert(!WebPRescalerInputDone(wrk)); assert(wrk->x_expand); if (wrk->num_channels == 4) { - if (wrk->src_width < 2) { - WebPRescalerImportRowExpandC(wrk, src); - return; - } - LoadTwoPixels(src, &cur_pixels); + LoadTwoPixels_SSE2(src, &cur_pixels); src += 4; while (1) { const __m128i mult = _mm_set1_epi32(((x_add - accum) << 16) | accum); @@ -67,7 +70,7 @@ static void RescalerImportRowExpandSSE2(WebPRescaler* const wrk, if (frow >= frow_end) break; accum -= wrk->x_sub; if (accum < 0) { - LoadTwoPixels(src, &cur_pixels); + LoadTwoPixels_SSE2(src, &cur_pixels); src += 4; accum += x_add; } @@ -75,11 +78,7 @@ static void RescalerImportRowExpandSSE2(WebPRescaler* const wrk, } else { int left; const uint8_t* const src_limit = src + wrk->src_width - 8; - if (wrk->src_width < 8) { - WebPRescalerImportRowExpandC(wrk, src); - return; - } - LoadHeightPixels(src, &cur_pixels); + LoadEightPixels_SSE2(src, &cur_pixels); src += 7; left = 7; while (1) { @@ -94,7 +93,7 @@ static void RescalerImportRowExpandSSE2(WebPRescaler* const wrk, if (--left) { cur_pixels = _mm_srli_si128(cur_pixels, 2); } else if (src <= src_limit) { - LoadHeightPixels(src, &cur_pixels); + LoadEightPixels_SSE2(src, &cur_pixels); src += 7; left = 7; } else { // tail @@ -110,8 +109,8 @@ static void RescalerImportRowExpandSSE2(WebPRescaler* const wrk, assert(accum == 0); } -static void RescalerImportRowShrinkSSE2(WebPRescaler* const wrk, - const uint8_t* src) { +static void RescalerImportRowShrink_SSE2(WebPRescaler* const wrk, + const uint8_t* src) { const int x_sub = wrk->x_sub; int accum = 0; const __m128i zero = _mm_setzero_si128(); @@ -123,7 +122,7 @@ static void RescalerImportRowShrinkSSE2(WebPRescaler* const wrk, const rescaler_t* const frow_end = wrk->frow + 4 * wrk->dst_width; if (wrk->num_channels != 4 || wrk->x_add > (x_sub << 7)) { - WebPRescalerImportRowShrinkC(wrk, src); + WebPRescalerImportRowShrink_C(wrk, src); return; } assert(!WebPRescalerInputDone(wrk)); @@ -169,12 +168,12 @@ static void RescalerImportRowShrinkSSE2(WebPRescaler* const wrk, // Row export // load *src as epi64, multiply by mult and store result in [out0 ... out3] -static WEBP_INLINE void LoadDispatchAndMult(const rescaler_t* const src, - const __m128i* const mult, - __m128i* const out0, - __m128i* const out1, - __m128i* const out2, - __m128i* const out3) { +static WEBP_INLINE void LoadDispatchAndMult_SSE2(const rescaler_t* const src, + const __m128i* const mult, + __m128i* const out0, + __m128i* const out1, + __m128i* const out2, + __m128i* const out3) { const __m128i A0 = _mm_loadu_si128((const __m128i*)(src + 0)); const __m128i A1 = _mm_loadu_si128((const __m128i*)(src + 4)); const __m128i A2 = _mm_srli_epi64(A0, 32); @@ -192,12 +191,12 @@ static WEBP_INLINE void LoadDispatchAndMult(const rescaler_t* const src, } } -static WEBP_INLINE void ProcessRow(const __m128i* const A0, - const __m128i* const A1, - const __m128i* const A2, - const __m128i* const A3, - const __m128i* const mult, - uint8_t* const dst) { +static WEBP_INLINE void ProcessRow_SSE2(const __m128i* const A0, + const __m128i* const A1, + const __m128i* const A2, + const __m128i* const A3, + const __m128i* const mult, + uint8_t* const dst) { const __m128i rounder = _mm_set_epi32(0, ROUNDER, 0, ROUNDER); const __m128i mask = _mm_set_epi32(0xffffffffu, 0, 0xffffffffu, 0); const __m128i B0 = _mm_mul_epu32(*A0, *mult); @@ -210,7 +209,7 @@ static WEBP_INLINE void ProcessRow(const __m128i* const A0, const __m128i C3 = _mm_add_epi64(B3, rounder); const __m128i D0 = _mm_srli_epi64(C0, WEBP_RESCALER_RFIX); const __m128i D1 = _mm_srli_epi64(C1, WEBP_RESCALER_RFIX); -#if (WEBP_RESCALER_FIX < 32) +#if (WEBP_RESCALER_RFIX < 32) const __m128i D2 = _mm_and_si128(_mm_slli_epi64(C2, 32 - WEBP_RESCALER_RFIX), mask); const __m128i D3 = @@ -226,7 +225,7 @@ static WEBP_INLINE void ProcessRow(const __m128i* const A0, _mm_storel_epi64((__m128i*)dst, G); } -static void RescalerExportRowExpandSSE2(WebPRescaler* const wrk) { +static void RescalerExportRowExpand_SSE2(WebPRescaler* const wrk) { int x_out; uint8_t* const dst = wrk->dst; rescaler_t* const irow = wrk->irow; @@ -240,14 +239,13 @@ static void RescalerExportRowExpandSSE2(WebPRescaler* const wrk) { if (wrk->y_accum == 0) { for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) { __m128i A0, A1, A2, A3; - LoadDispatchAndMult(frow + x_out, NULL, &A0, &A1, &A2, &A3); - ProcessRow(&A0, &A1, &A2, &A3, &mult, dst + x_out); + LoadDispatchAndMult_SSE2(frow + x_out, NULL, &A0, &A1, &A2, &A3); + ProcessRow_SSE2(&A0, &A1, &A2, &A3, &mult, dst + x_out); } for (; x_out < x_out_max; ++x_out) { const uint32_t J = frow[x_out]; const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } else { const uint32_t B = WEBP_RESCALER_FRAC(-wrk->y_accum, wrk->y_sub); @@ -257,8 +255,8 @@ static void RescalerExportRowExpandSSE2(WebPRescaler* const wrk) { const __m128i rounder = _mm_set_epi32(0, ROUNDER, 0, ROUNDER); for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) { __m128i A0, A1, A2, A3, B0, B1, B2, B3; - LoadDispatchAndMult(frow + x_out, &mA, &A0, &A1, &A2, &A3); - LoadDispatchAndMult(irow + x_out, &mB, &B0, &B1, &B2, &B3); + LoadDispatchAndMult_SSE2(frow + x_out, &mA, &A0, &A1, &A2, &A3); + LoadDispatchAndMult_SSE2(irow + x_out, &mB, &B0, &B1, &B2, &B3); { const __m128i C0 = _mm_add_epi64(A0, B0); const __m128i C1 = _mm_add_epi64(A1, B1); @@ -272,7 +270,7 @@ static void RescalerExportRowExpandSSE2(WebPRescaler* const wrk) { const __m128i E1 = _mm_srli_epi64(D1, WEBP_RESCALER_RFIX); const __m128i E2 = _mm_srli_epi64(D2, WEBP_RESCALER_RFIX); const __m128i E3 = _mm_srli_epi64(D3, WEBP_RESCALER_RFIX); - ProcessRow(&E0, &E1, &E2, &E3, &mult, dst + x_out); + ProcessRow_SSE2(&E0, &E1, &E2, &E3, &mult, dst + x_out); } } for (; x_out < x_out_max; ++x_out) { @@ -280,13 +278,12 @@ static void RescalerExportRowExpandSSE2(WebPRescaler* const wrk) { + (uint64_t)B * irow[x_out]; const uint32_t J = (uint32_t)((I + ROUNDER) >> WEBP_RESCALER_RFIX); const int v = (int)MULT_FIX(J, wrk->fy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; } } } -static void RescalerExportRowShrinkSSE2(WebPRescaler* const wrk) { +static void RescalerExportRowShrink_SSE2(WebPRescaler* const wrk) { int x_out; uint8_t* const dst = wrk->dst; rescaler_t* const irow = wrk->irow; @@ -300,20 +297,15 @@ static void RescalerExportRowShrinkSSE2(WebPRescaler* const wrk) { const int scale_xy = wrk->fxy_scale; const __m128i mult_xy = _mm_set_epi32(0, scale_xy, 0, scale_xy); const __m128i mult_y = _mm_set_epi32(0, yscale, 0, yscale); - const __m128i rounder = _mm_set_epi32(0, ROUNDER, 0, ROUNDER); for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) { __m128i A0, A1, A2, A3, B0, B1, B2, B3; - LoadDispatchAndMult(irow + x_out, NULL, &A0, &A1, &A2, &A3); - LoadDispatchAndMult(frow + x_out, &mult_y, &B0, &B1, &B2, &B3); + LoadDispatchAndMult_SSE2(irow + x_out, NULL, &A0, &A1, &A2, &A3); + LoadDispatchAndMult_SSE2(frow + x_out, &mult_y, &B0, &B1, &B2, &B3); { - const __m128i C0 = _mm_add_epi64(B0, rounder); - const __m128i C1 = _mm_add_epi64(B1, rounder); - const __m128i C2 = _mm_add_epi64(B2, rounder); - const __m128i C3 = _mm_add_epi64(B3, rounder); - const __m128i D0 = _mm_srli_epi64(C0, WEBP_RESCALER_RFIX); // = frac - const __m128i D1 = _mm_srli_epi64(C1, WEBP_RESCALER_RFIX); - const __m128i D2 = _mm_srli_epi64(C2, WEBP_RESCALER_RFIX); - const __m128i D3 = _mm_srli_epi64(C3, WEBP_RESCALER_RFIX); + const __m128i D0 = _mm_srli_epi64(B0, WEBP_RESCALER_RFIX); // = frac + const __m128i D1 = _mm_srli_epi64(B1, WEBP_RESCALER_RFIX); + const __m128i D2 = _mm_srli_epi64(B2, WEBP_RESCALER_RFIX); + const __m128i D3 = _mm_srli_epi64(B3, WEBP_RESCALER_RFIX); const __m128i E0 = _mm_sub_epi64(A0, D0); // irow[x] - frac const __m128i E1 = _mm_sub_epi64(A1, D1); const __m128i E2 = _mm_sub_epi64(A2, D2); @@ -324,14 +316,13 @@ static void RescalerExportRowShrinkSSE2(WebPRescaler* const wrk) { const __m128i G1 = _mm_or_si128(D1, F3); _mm_storeu_si128((__m128i*)(irow + x_out + 0), G0); _mm_storeu_si128((__m128i*)(irow + x_out + 4), G1); - ProcessRow(&E0, &E1, &E2, &E3, &mult_xy, dst + x_out); + ProcessRow_SSE2(&E0, &E1, &E2, &E3, &mult_xy, dst + x_out); } } for (; x_out < x_out_max; ++x_out) { - const uint32_t frac = (int)MULT_FIX(frow[x_out], yscale); + const uint32_t frac = (int)MULT_FIX_FLOOR(frow[x_out], yscale); const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = frac; // new fractional start } } else { @@ -340,20 +331,20 @@ static void RescalerExportRowShrinkSSE2(WebPRescaler* const wrk) { const __m128i zero = _mm_setzero_si128(); for (x_out = 0; x_out + 8 <= x_out_max; x_out += 8) { __m128i A0, A1, A2, A3; - LoadDispatchAndMult(irow + x_out, NULL, &A0, &A1, &A2, &A3); + LoadDispatchAndMult_SSE2(irow + x_out, NULL, &A0, &A1, &A2, &A3); _mm_storeu_si128((__m128i*)(irow + x_out + 0), zero); _mm_storeu_si128((__m128i*)(irow + x_out + 4), zero); - ProcessRow(&A0, &A1, &A2, &A3, &mult, dst + x_out); + ProcessRow_SSE2(&A0, &A1, &A2, &A3, &mult, dst + x_out); } for (; x_out < x_out_max; ++x_out) { const int v = (int)MULT_FIX(irow[x_out], scale); - assert(v >= 0 && v <= 255); - dst[x_out] = v; + dst[x_out] = (v > 255) ? 255u : (uint8_t)v; irow[x_out] = 0; } } } +#undef MULT_FIX_FLOOR #undef MULT_FIX #undef ROUNDER @@ -362,10 +353,10 @@ static void RescalerExportRowShrinkSSE2(WebPRescaler* const wrk) { extern void WebPRescalerDspInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitSSE2(void) { - WebPRescalerImportRowExpand = RescalerImportRowExpandSSE2; - WebPRescalerImportRowShrink = RescalerImportRowShrinkSSE2; - WebPRescalerExportRowExpand = RescalerExportRowExpandSSE2; - WebPRescalerExportRowShrink = RescalerExportRowShrinkSSE2; + WebPRescalerImportRowExpand = RescalerImportRowExpand_SSE2; + WebPRescalerImportRowShrink = RescalerImportRowShrink_SSE2; + WebPRescalerExportRowExpand = RescalerExportRowExpand_SSE2; + WebPRescalerExportRowShrink = RescalerExportRowShrink_SSE2; } #else // !WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/ssim.c b/Pods/libwebp/src/dsp/ssim.c new file mode 100644 index 0000000..989ce82 --- /dev/null +++ b/Pods/libwebp/src/dsp/ssim.c @@ -0,0 +1,159 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// distortion calculation +// +// Author: Skal (pascal.massimino@gmail.com) + +#include +#include // for abs() + +#include "src/dsp/dsp.h" + +#if !defined(WEBP_REDUCE_SIZE) + +//------------------------------------------------------------------------------ +// SSIM / PSNR + +// hat-shaped filter. Sum of coefficients is equal to 16. +static const uint32_t kWeight[2 * VP8_SSIM_KERNEL + 1] = { + 1, 2, 3, 4, 3, 2, 1 +}; +static const uint32_t kWeightSum = 16 * 16; // sum{kWeight}^2 + +static WEBP_INLINE double SSIMCalculation( + const VP8DistoStats* const stats, uint32_t N /*num samples*/) { + const uint32_t w2 = N * N; + const uint32_t C1 = 20 * w2; + const uint32_t C2 = 60 * w2; + const uint32_t C3 = 8 * 8 * w2; // 'dark' limit ~= 6 + const uint64_t xmxm = (uint64_t)stats->xm * stats->xm; + const uint64_t ymym = (uint64_t)stats->ym * stats->ym; + if (xmxm + ymym >= C3) { + const int64_t xmym = (int64_t)stats->xm * stats->ym; + const int64_t sxy = (int64_t)stats->xym * N - xmym; // can be negative + const uint64_t sxx = (uint64_t)stats->xxm * N - xmxm; + const uint64_t syy = (uint64_t)stats->yym * N - ymym; + // we descale by 8 to prevent overflow during the fnum/fden multiply. + const uint64_t num_S = (2 * (uint64_t)(sxy < 0 ? 0 : sxy) + C2) >> 8; + const uint64_t den_S = (sxx + syy + C2) >> 8; + const uint64_t fnum = (2 * xmym + C1) * num_S; + const uint64_t fden = (xmxm + ymym + C1) * den_S; + const double r = (double)fnum / fden; + assert(r >= 0. && r <= 1.0); + return r; + } + return 1.; // area is too dark to contribute meaningfully +} + +double VP8SSIMFromStats(const VP8DistoStats* const stats) { + return SSIMCalculation(stats, kWeightSum); +} + +double VP8SSIMFromStatsClipped(const VP8DistoStats* const stats) { + return SSIMCalculation(stats, stats->w); +} + +static double SSIMGetClipped_C(const uint8_t* src1, int stride1, + const uint8_t* src2, int stride2, + int xo, int yo, int W, int H) { + VP8DistoStats stats = { 0, 0, 0, 0, 0, 0 }; + const int ymin = (yo - VP8_SSIM_KERNEL < 0) ? 0 : yo - VP8_SSIM_KERNEL; + const int ymax = (yo + VP8_SSIM_KERNEL > H - 1) ? H - 1 + : yo + VP8_SSIM_KERNEL; + const int xmin = (xo - VP8_SSIM_KERNEL < 0) ? 0 : xo - VP8_SSIM_KERNEL; + const int xmax = (xo + VP8_SSIM_KERNEL > W - 1) ? W - 1 + : xo + VP8_SSIM_KERNEL; + int x, y; + src1 += ymin * stride1; + src2 += ymin * stride2; + for (y = ymin; y <= ymax; ++y, src1 += stride1, src2 += stride2) { + for (x = xmin; x <= xmax; ++x) { + const uint32_t w = kWeight[VP8_SSIM_KERNEL + x - xo] + * kWeight[VP8_SSIM_KERNEL + y - yo]; + const uint32_t s1 = src1[x]; + const uint32_t s2 = src2[x]; + stats.w += w; + stats.xm += w * s1; + stats.ym += w * s2; + stats.xxm += w * s1 * s1; + stats.xym += w * s1 * s2; + stats.yym += w * s2 * s2; + } + } + return VP8SSIMFromStatsClipped(&stats); +} + +static double SSIMGet_C(const uint8_t* src1, int stride1, + const uint8_t* src2, int stride2) { + VP8DistoStats stats = { 0, 0, 0, 0, 0, 0 }; + int x, y; + for (y = 0; y <= 2 * VP8_SSIM_KERNEL; ++y, src1 += stride1, src2 += stride2) { + for (x = 0; x <= 2 * VP8_SSIM_KERNEL; ++x) { + const uint32_t w = kWeight[x] * kWeight[y]; + const uint32_t s1 = src1[x]; + const uint32_t s2 = src2[x]; + stats.xm += w * s1; + stats.ym += w * s2; + stats.xxm += w * s1 * s1; + stats.xym += w * s1 * s2; + stats.yym += w * s2 * s2; + } + } + return VP8SSIMFromStats(&stats); +} + +#endif // !defined(WEBP_REDUCE_SIZE) + +//------------------------------------------------------------------------------ + +#if !defined(WEBP_DISABLE_STATS) +static uint32_t AccumulateSSE_C(const uint8_t* src1, + const uint8_t* src2, int len) { + int i; + uint32_t sse2 = 0; + assert(len <= 65535); // to ensure that accumulation fits within uint32_t + for (i = 0; i < len; ++i) { + const int32_t diff = src1[i] - src2[i]; + sse2 += diff * diff; + } + return sse2; +} +#endif + +//------------------------------------------------------------------------------ + +#if !defined(WEBP_REDUCE_SIZE) +VP8SSIMGetFunc VP8SSIMGet; +VP8SSIMGetClippedFunc VP8SSIMGetClipped; +#endif +#if !defined(WEBP_DISABLE_STATS) +VP8AccumulateSSEFunc VP8AccumulateSSE; +#endif + +extern void VP8SSIMDspInitSSE2(void); + +WEBP_DSP_INIT_FUNC(VP8SSIMDspInit) { +#if !defined(WEBP_REDUCE_SIZE) + VP8SSIMGetClipped = SSIMGetClipped_C; + VP8SSIMGet = SSIMGet_C; +#endif + +#if !defined(WEBP_DISABLE_STATS) + VP8AccumulateSSE = AccumulateSSE_C; +#endif + + if (VP8GetCPUInfo != NULL) { +#if defined(WEBP_USE_SSE2) + if (VP8GetCPUInfo(kSSE2)) { + VP8SSIMDspInitSSE2(); + } +#endif + } +} diff --git a/Pods/libwebp/src/dsp/ssim_sse2.c b/Pods/libwebp/src/dsp/ssim_sse2.c new file mode 100644 index 0000000..1dcb0eb --- /dev/null +++ b/Pods/libwebp/src/dsp/ssim_sse2.c @@ -0,0 +1,165 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// SSE2 version of distortion calculation +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "src/dsp/dsp.h" + +#if defined(WEBP_USE_SSE2) + +#include +#include + +#include "src/dsp/common_sse2.h" + +#if !defined(WEBP_DISABLE_STATS) + +// Helper function +static WEBP_INLINE void SubtractAndSquare_SSE2(const __m128i a, const __m128i b, + __m128i* const sum) { + // take abs(a-b) in 8b + const __m128i a_b = _mm_subs_epu8(a, b); + const __m128i b_a = _mm_subs_epu8(b, a); + const __m128i abs_a_b = _mm_or_si128(a_b, b_a); + // zero-extend to 16b + const __m128i zero = _mm_setzero_si128(); + const __m128i C0 = _mm_unpacklo_epi8(abs_a_b, zero); + const __m128i C1 = _mm_unpackhi_epi8(abs_a_b, zero); + // multiply with self + const __m128i sum1 = _mm_madd_epi16(C0, C0); + const __m128i sum2 = _mm_madd_epi16(C1, C1); + *sum = _mm_add_epi32(sum1, sum2); +} + +//------------------------------------------------------------------------------ +// SSIM / PSNR entry point + +static uint32_t AccumulateSSE_SSE2(const uint8_t* src1, + const uint8_t* src2, int len) { + int i = 0; + uint32_t sse2 = 0; + if (len >= 16) { + const int limit = len - 32; + int32_t tmp[4]; + __m128i sum1; + __m128i sum = _mm_setzero_si128(); + __m128i a0 = _mm_loadu_si128((const __m128i*)&src1[i]); + __m128i b0 = _mm_loadu_si128((const __m128i*)&src2[i]); + i += 16; + while (i <= limit) { + const __m128i a1 = _mm_loadu_si128((const __m128i*)&src1[i]); + const __m128i b1 = _mm_loadu_si128((const __m128i*)&src2[i]); + __m128i sum2; + i += 16; + SubtractAndSquare_SSE2(a0, b0, &sum1); + sum = _mm_add_epi32(sum, sum1); + a0 = _mm_loadu_si128((const __m128i*)&src1[i]); + b0 = _mm_loadu_si128((const __m128i*)&src2[i]); + i += 16; + SubtractAndSquare_SSE2(a1, b1, &sum2); + sum = _mm_add_epi32(sum, sum2); + } + SubtractAndSquare_SSE2(a0, b0, &sum1); + sum = _mm_add_epi32(sum, sum1); + _mm_storeu_si128((__m128i*)tmp, sum); + sse2 += (tmp[3] + tmp[2] + tmp[1] + tmp[0]); + } + + for (; i < len; ++i) { + const int32_t diff = src1[i] - src2[i]; + sse2 += diff * diff; + } + return sse2; +} +#endif // !defined(WEBP_DISABLE_STATS) + +#if !defined(WEBP_REDUCE_SIZE) + +static uint32_t HorizontalAdd16b_SSE2(const __m128i* const m) { + uint16_t tmp[8]; + const __m128i a = _mm_srli_si128(*m, 8); + const __m128i b = _mm_add_epi16(*m, a); + _mm_storeu_si128((__m128i*)tmp, b); + return (uint32_t)tmp[3] + tmp[2] + tmp[1] + tmp[0]; +} + +static uint32_t HorizontalAdd32b_SSE2(const __m128i* const m) { + const __m128i a = _mm_srli_si128(*m, 8); + const __m128i b = _mm_add_epi32(*m, a); + const __m128i c = _mm_add_epi32(b, _mm_srli_si128(b, 4)); + return (uint32_t)_mm_cvtsi128_si32(c); +} + +static const uint16_t kWeight[] = { 1, 2, 3, 4, 3, 2, 1, 0 }; + +#define ACCUMULATE_ROW(WEIGHT) do { \ + /* compute row weight (Wx * Wy) */ \ + const __m128i Wy = _mm_set1_epi16((WEIGHT)); \ + const __m128i W = _mm_mullo_epi16(Wx, Wy); \ + /* process 8 bytes at a time (7 bytes, actually) */ \ + const __m128i a0 = _mm_loadl_epi64((const __m128i*)src1); \ + const __m128i b0 = _mm_loadl_epi64((const __m128i*)src2); \ + /* convert to 16b and multiply by weight */ \ + const __m128i a1 = _mm_unpacklo_epi8(a0, zero); \ + const __m128i b1 = _mm_unpacklo_epi8(b0, zero); \ + const __m128i wa1 = _mm_mullo_epi16(a1, W); \ + const __m128i wb1 = _mm_mullo_epi16(b1, W); \ + /* accumulate */ \ + xm = _mm_add_epi16(xm, wa1); \ + ym = _mm_add_epi16(ym, wb1); \ + xxm = _mm_add_epi32(xxm, _mm_madd_epi16(a1, wa1)); \ + xym = _mm_add_epi32(xym, _mm_madd_epi16(a1, wb1)); \ + yym = _mm_add_epi32(yym, _mm_madd_epi16(b1, wb1)); \ + src1 += stride1; \ + src2 += stride2; \ +} while (0) + +static double SSIMGet_SSE2(const uint8_t* src1, int stride1, + const uint8_t* src2, int stride2) { + VP8DistoStats stats; + const __m128i zero = _mm_setzero_si128(); + __m128i xm = zero, ym = zero; // 16b accums + __m128i xxm = zero, yym = zero, xym = zero; // 32b accum + const __m128i Wx = _mm_loadu_si128((const __m128i*)kWeight); + assert(2 * VP8_SSIM_KERNEL + 1 == 7); + ACCUMULATE_ROW(1); + ACCUMULATE_ROW(2); + ACCUMULATE_ROW(3); + ACCUMULATE_ROW(4); + ACCUMULATE_ROW(3); + ACCUMULATE_ROW(2); + ACCUMULATE_ROW(1); + stats.xm = HorizontalAdd16b_SSE2(&xm); + stats.ym = HorizontalAdd16b_SSE2(&ym); + stats.xxm = HorizontalAdd32b_SSE2(&xxm); + stats.xym = HorizontalAdd32b_SSE2(&xym); + stats.yym = HorizontalAdd32b_SSE2(&yym); + return VP8SSIMFromStats(&stats); +} + +#endif // !defined(WEBP_REDUCE_SIZE) + +extern void VP8SSIMDspInitSSE2(void); + +WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInitSSE2(void) { +#if !defined(WEBP_DISABLE_STATS) + VP8AccumulateSSE = AccumulateSSE_SSE2; +#endif +#if !defined(WEBP_REDUCE_SIZE) + VP8SSIMGet = SSIMGet_SSE2; +#endif +} + +#else // !WEBP_USE_SSE2 + +WEBP_DSP_INIT_STUB(VP8SSIMDspInitSSE2) + +#endif // WEBP_USE_SSE2 diff --git a/Pods/libwebp/src/dsp/upsampling.c b/Pods/libwebp/src/dsp/upsampling.c index 265e722..9b60da5 100644 --- a/Pods/libwebp/src/dsp/upsampling.c +++ b/Pods/libwebp/src/dsp/upsampling.c @@ -11,8 +11,8 @@ // // Author: somnath@google.com (Somnath Banerjee) -#include "./dsp.h" -#include "./yuv.h" +#include "src/dsp/dsp.h" +#include "src/dsp/yuv.h" #include @@ -63,17 +63,17 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ const uint32_t uv0 = (diag_12 + tl_uv) >> 1; \ const uint32_t uv1 = (diag_03 + t_uv) >> 1; \ FUNC(top_y[2 * x - 1], uv0 & 0xff, (uv0 >> 16), \ - top_dst + (2 * x - 1) * XSTEP); \ + top_dst + (2 * x - 1) * (XSTEP)); \ FUNC(top_y[2 * x - 0], uv1 & 0xff, (uv1 >> 16), \ - top_dst + (2 * x - 0) * XSTEP); \ + top_dst + (2 * x - 0) * (XSTEP)); \ } \ if (bottom_y != NULL) { \ const uint32_t uv0 = (diag_03 + l_uv) >> 1; \ const uint32_t uv1 = (diag_12 + uv) >> 1; \ FUNC(bottom_y[2 * x - 1], uv0 & 0xff, (uv0 >> 16), \ - bottom_dst + (2 * x - 1) * XSTEP); \ + bottom_dst + (2 * x - 1) * (XSTEP)); \ FUNC(bottom_y[2 * x + 0], uv1 & 0xff, (uv1 >> 16), \ - bottom_dst + (2 * x + 0) * XSTEP); \ + bottom_dst + (2 * x + 0) * (XSTEP)); \ } \ tl_uv = t_uv; \ l_uv = uv; \ @@ -82,24 +82,50 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ { \ const uint32_t uv0 = (3 * tl_uv + l_uv + 0x00020002u) >> 2; \ FUNC(top_y[len - 1], uv0 & 0xff, (uv0 >> 16), \ - top_dst + (len - 1) * XSTEP); \ + top_dst + (len - 1) * (XSTEP)); \ } \ if (bottom_y != NULL) { \ const uint32_t uv0 = (3 * l_uv + tl_uv + 0x00020002u) >> 2; \ FUNC(bottom_y[len - 1], uv0 & 0xff, (uv0 >> 16), \ - bottom_dst + (len - 1) * XSTEP); \ + bottom_dst + (len - 1) * (XSTEP)); \ } \ } \ } // All variants implemented. -UPSAMPLE_FUNC(UpsampleRgbLinePair, VP8YuvToRgb, 3) -UPSAMPLE_FUNC(UpsampleBgrLinePair, VP8YuvToBgr, 3) -UPSAMPLE_FUNC(UpsampleRgbaLinePair, VP8YuvToRgba, 4) -UPSAMPLE_FUNC(UpsampleBgraLinePair, VP8YuvToBgra, 4) -UPSAMPLE_FUNC(UpsampleArgbLinePair, VP8YuvToArgb, 4) -UPSAMPLE_FUNC(UpsampleRgba4444LinePair, VP8YuvToRgba4444, 2) -UPSAMPLE_FUNC(UpsampleRgb565LinePair, VP8YuvToRgb565, 2) +#if !WEBP_NEON_OMIT_C_CODE +UPSAMPLE_FUNC(UpsampleRgbaLinePair_C, VP8YuvToRgba, 4) +UPSAMPLE_FUNC(UpsampleBgraLinePair_C, VP8YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +UPSAMPLE_FUNC(UpsampleArgbLinePair_C, VP8YuvToArgb, 4) +UPSAMPLE_FUNC(UpsampleRgbLinePair_C, VP8YuvToRgb, 3) +UPSAMPLE_FUNC(UpsampleBgrLinePair_C, VP8YuvToBgr, 3) +UPSAMPLE_FUNC(UpsampleRgba4444LinePair_C, VP8YuvToRgba4444, 2) +UPSAMPLE_FUNC(UpsampleRgb565LinePair_C, VP8YuvToRgb565, 2) +#else +static void EmptyUpsampleFunc(const uint8_t* top_y, const uint8_t* bottom_y, + const uint8_t* top_u, const uint8_t* top_v, + const uint8_t* cur_u, const uint8_t* cur_v, + uint8_t* top_dst, uint8_t* bottom_dst, int len) { + (void)top_y; + (void)bottom_y; + (void)top_u; + (void)top_v; + (void)cur_u; + (void)cur_v; + (void)top_dst; + (void)bottom_dst; + (void)len; + assert(0); // COLORSPACE SUPPORT NOT COMPILED +} +#define UpsampleArgbLinePair_C EmptyUpsampleFunc +#define UpsampleRgbLinePair_C EmptyUpsampleFunc +#define UpsampleBgrLinePair_C EmptyUpsampleFunc +#define UpsampleRgba4444LinePair_C EmptyUpsampleFunc +#define UpsampleRgb565LinePair_C EmptyUpsampleFunc +#endif // WEBP_REDUCE_CSP + +#endif #undef LOAD_UV #undef UPSAMPLE_FUNC @@ -141,7 +167,6 @@ DUAL_SAMPLE_FUNC(DualLineSamplerARGB, VP8YuvToArgb) WebPUpsampleLinePairFunc WebPGetLinePairConverter(int alpha_is_last) { WebPInitUpsamplers(); - VP8YUVInit(); #ifdef FANCY_UPSAMPLING return WebPUpsamplers[alpha_is_last ? MODE_BGRA : MODE_ARGB]; #else @@ -158,16 +183,33 @@ extern void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ uint8_t* dst, int len) { \ int i; \ - for (i = 0; i < len; ++i) FUNC(y[i], u[i], v[i], &dst[i * XSTEP]); \ + for (i = 0; i < len; ++i) FUNC(y[i], u[i], v[i], &dst[i * (XSTEP)]); \ } -YUV444_FUNC(WebPYuv444ToRgbC, VP8YuvToRgb, 3) -YUV444_FUNC(WebPYuv444ToBgrC, VP8YuvToBgr, 3) -YUV444_FUNC(WebPYuv444ToRgbaC, VP8YuvToRgba, 4) -YUV444_FUNC(WebPYuv444ToBgraC, VP8YuvToBgra, 4) -YUV444_FUNC(WebPYuv444ToArgbC, VP8YuvToArgb, 4) -YUV444_FUNC(WebPYuv444ToRgba4444C, VP8YuvToRgba4444, 2) -YUV444_FUNC(WebPYuv444ToRgb565C, VP8YuvToRgb565, 2) +YUV444_FUNC(WebPYuv444ToRgba_C, VP8YuvToRgba, 4) +YUV444_FUNC(WebPYuv444ToBgra_C, VP8YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +YUV444_FUNC(WebPYuv444ToRgb_C, VP8YuvToRgb, 3) +YUV444_FUNC(WebPYuv444ToBgr_C, VP8YuvToBgr, 3) +YUV444_FUNC(WebPYuv444ToArgb_C, VP8YuvToArgb, 4) +YUV444_FUNC(WebPYuv444ToRgba4444_C, VP8YuvToRgba4444, 2) +YUV444_FUNC(WebPYuv444ToRgb565_C, VP8YuvToRgb565, 2) +#else +static void EmptyYuv444Func(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { + (void)y; + (void)u; + (void)v; + (void)dst; + (void)len; +} +#define WebPYuv444ToRgb_C EmptyYuv444Func +#define WebPYuv444ToBgr_C EmptyYuv444Func +#define WebPYuv444ToArgb_C EmptyYuv444Func +#define WebPYuv444ToRgba4444_C EmptyYuv444Func +#define WebPYuv444ToRgb565_C EmptyYuv444Func +#endif // WEBP_REDUCE_CSP #undef YUV444_FUNC @@ -175,24 +217,20 @@ WebPYUV444Converter WebPYUV444Converters[MODE_LAST]; extern void WebPInitYUV444ConvertersMIPSdspR2(void); extern void WebPInitYUV444ConvertersSSE2(void); - -static volatile VP8CPUInfo upsampling_last_cpuinfo_used1 = - (VP8CPUInfo)&upsampling_last_cpuinfo_used1; - -WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) { - if (upsampling_last_cpuinfo_used1 == VP8GetCPUInfo) return; - - WebPYUV444Converters[MODE_RGB] = WebPYuv444ToRgbC; - WebPYUV444Converters[MODE_RGBA] = WebPYuv444ToRgbaC; - WebPYUV444Converters[MODE_BGR] = WebPYuv444ToBgrC; - WebPYUV444Converters[MODE_BGRA] = WebPYuv444ToBgraC; - WebPYUV444Converters[MODE_ARGB] = WebPYuv444ToArgbC; - WebPYUV444Converters[MODE_RGBA_4444] = WebPYuv444ToRgba4444C; - WebPYUV444Converters[MODE_RGB_565] = WebPYuv444ToRgb565C; - WebPYUV444Converters[MODE_rgbA] = WebPYuv444ToRgbaC; - WebPYUV444Converters[MODE_bgrA] = WebPYuv444ToBgraC; - WebPYUV444Converters[MODE_Argb] = WebPYuv444ToArgbC; - WebPYUV444Converters[MODE_rgbA_4444] = WebPYuv444ToRgba4444C; +extern void WebPInitYUV444ConvertersSSE41(void); + +WEBP_DSP_INIT_FUNC(WebPInitYUV444Converters) { + WebPYUV444Converters[MODE_RGBA] = WebPYuv444ToRgba_C; + WebPYUV444Converters[MODE_BGRA] = WebPYuv444ToBgra_C; + WebPYUV444Converters[MODE_RGB] = WebPYuv444ToRgb_C; + WebPYUV444Converters[MODE_BGR] = WebPYuv444ToBgr_C; + WebPYUV444Converters[MODE_ARGB] = WebPYuv444ToArgb_C; + WebPYUV444Converters[MODE_RGBA_4444] = WebPYuv444ToRgba4444_C; + WebPYUV444Converters[MODE_RGB_565] = WebPYuv444ToRgb565_C; + WebPYUV444Converters[MODE_rgbA] = WebPYuv444ToRgba_C; + WebPYUV444Converters[MODE_bgrA] = WebPYuv444ToBgra_C; + WebPYUV444Converters[MODE_Argb] = WebPYuv444ToArgb_C; + WebPYUV444Converters[MODE_rgbA_4444] = WebPYuv444ToRgba4444_C; if (VP8GetCPUInfo != NULL) { #if defined(WEBP_USE_SSE2) @@ -200,41 +238,43 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) { WebPInitYUV444ConvertersSSE2(); } #endif +#if defined(WEBP_USE_SSE41) + if (VP8GetCPUInfo(kSSE4_1)) { + WebPInitYUV444ConvertersSSE41(); + } +#endif #if defined(WEBP_USE_MIPS_DSP_R2) if (VP8GetCPUInfo(kMIPSdspR2)) { WebPInitYUV444ConvertersMIPSdspR2(); } #endif } - upsampling_last_cpuinfo_used1 = VP8GetCPUInfo; } //------------------------------------------------------------------------------ // Main calls extern void WebPInitUpsamplersSSE2(void); +extern void WebPInitUpsamplersSSE41(void); extern void WebPInitUpsamplersNEON(void); extern void WebPInitUpsamplersMIPSdspR2(void); extern void WebPInitUpsamplersMSA(void); -static volatile VP8CPUInfo upsampling_last_cpuinfo_used2 = - (VP8CPUInfo)&upsampling_last_cpuinfo_used2; - -WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) { - if (upsampling_last_cpuinfo_used2 == VP8GetCPUInfo) return; - +WEBP_DSP_INIT_FUNC(WebPInitUpsamplers) { #ifdef FANCY_UPSAMPLING - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; - WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; - WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; - WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; - WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; - WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; - WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; +#if !WEBP_NEON_OMIT_C_CODE + WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_C; + WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair_C; + WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_C; + WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_C; + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_C; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_C; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_C; + WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair_C; + WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair_C; + WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair_C; + WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair_C; +#endif // If defined, use CPUInfo() to overwrite some pointers with faster versions. if (VP8GetCPUInfo != NULL) { @@ -243,9 +283,9 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) { WebPInitUpsamplersSSE2(); } #endif -#if defined(WEBP_USE_NEON) - if (VP8GetCPUInfo(kNEON)) { - WebPInitUpsamplersNEON(); +#if defined(WEBP_USE_SSE41) + if (VP8GetCPUInfo(kSSE4_1)) { + WebPInitUpsamplersSSE41(); } #endif #if defined(WEBP_USE_MIPS_DSP_R2) @@ -259,8 +299,29 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) { } #endif } + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + WebPInitUpsamplersNEON(); + } +#endif + + assert(WebPUpsamplers[MODE_RGBA] != NULL); + assert(WebPUpsamplers[MODE_BGRA] != NULL); + assert(WebPUpsamplers[MODE_rgbA] != NULL); + assert(WebPUpsamplers[MODE_bgrA] != NULL); +#if !defined(WEBP_REDUCE_CSP) || !WEBP_NEON_OMIT_C_CODE + assert(WebPUpsamplers[MODE_RGB] != NULL); + assert(WebPUpsamplers[MODE_BGR] != NULL); + assert(WebPUpsamplers[MODE_ARGB] != NULL); + assert(WebPUpsamplers[MODE_RGBA_4444] != NULL); + assert(WebPUpsamplers[MODE_RGB_565] != NULL); + assert(WebPUpsamplers[MODE_Argb] != NULL); + assert(WebPUpsamplers[MODE_rgbA_4444] != NULL); +#endif + #endif // FANCY_UPSAMPLING - upsampling_last_cpuinfo_used2 = VP8GetCPUInfo; } //------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/dsp/upsampling_mips_dsp_r2.c b/Pods/libwebp/src/dsp/upsampling_mips_dsp_r2.c index ed2eb74..10d499d 100644 --- a/Pods/libwebp/src/dsp/upsampling_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/upsampling_mips_dsp_r2.c @@ -12,14 +12,12 @@ // Author(s): Branimir Vasic (branimir.vasic@imgtec.com) // Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) #include -#include "./yuv.h" - -#if !defined(WEBP_YUV_USE_TABLE) +#include "src/dsp/yuv.h" #define YUV_TO_RGB(Y, U, V, R, G, B) do { \ const int t1 = MultHi(Y, 19077); \ @@ -48,6 +46,7 @@ ); \ } while (0) +#if !defined(WEBP_REDUCE_CSP) static WEBP_INLINE void YuvToRgb(int y, int u, int v, uint8_t* const rgb) { int r, g, b; YUV_TO_RGB(y, u, v, r, g, b); @@ -68,7 +67,7 @@ static WEBP_INLINE void YuvToRgb565(int y, int u, int v, uint8_t* const rgb) { { const int rg = (r & 0xf8) | (g >> 5); const int gb = ((g << 3) & 0xe0) | (b >> 3); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) rgb[0] = gb; rgb[1] = rg; #else @@ -84,7 +83,7 @@ static WEBP_INLINE void YuvToRgba4444(int y, int u, int v, { const int rg = (r & 0xf0) | (g >> 4); const int ba = (b & 0xf0) | 0x0f; // overwrite the lower 4 bits -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) argb[0] = ba; argb[1] = rg; #else @@ -93,11 +92,12 @@ static WEBP_INLINE void YuvToRgba4444(int y, int u, int v, #endif } } -#endif // WEBP_YUV_USE_TABLE +#endif // WEBP_REDUCE_CSP //----------------------------------------------------------------------------- // Alpha handling variants +#if !defined(WEBP_REDUCE_CSP) static WEBP_INLINE void YuvToArgb(uint8_t y, uint8_t u, uint8_t v, uint8_t* const argb) { int r, g, b; @@ -107,6 +107,7 @@ static WEBP_INLINE void YuvToArgb(uint8_t y, uint8_t u, uint8_t v, argb[2] = g; argb[3] = b; } +#endif // WEBP_REDUCE_CSP static WEBP_INLINE void YuvToBgra(uint8_t y, uint8_t u, uint8_t v, uint8_t* const bgra) { int r, g, b; @@ -200,13 +201,15 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ } // All variants implemented. -UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) -UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleRgbaLinePair, YuvToRgba, 4) UPSAMPLE_FUNC(UpsampleBgraLinePair, YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) +UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleArgbLinePair, YuvToArgb, 4) UPSAMPLE_FUNC(UpsampleRgba4444LinePair, YuvToRgba4444, 2) UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP #undef LOAD_UV #undef UPSAMPLE_FUNC @@ -217,17 +220,19 @@ UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2) extern void WebPInitUpsamplersMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersMIPSdspR2(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; + WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; + WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; - WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING @@ -242,13 +247,15 @@ static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ for (i = 0; i < len; ++i) FUNC(y[i], u[i], v[i], &dst[i * XSTEP]); \ } -YUV444_FUNC(Yuv444ToRgb, YuvToRgb, 3) -YUV444_FUNC(Yuv444ToBgr, YuvToBgr, 3) YUV444_FUNC(Yuv444ToRgba, YuvToRgba, 4) YUV444_FUNC(Yuv444ToBgra, YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +YUV444_FUNC(Yuv444ToRgb, YuvToRgb, 3) +YUV444_FUNC(Yuv444ToBgr, YuvToBgr, 3) YUV444_FUNC(Yuv444ToArgb, YuvToArgb, 4) YUV444_FUNC(Yuv444ToRgba4444, YuvToRgba4444, 2) YUV444_FUNC(Yuv444ToRgb565, YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP #undef YUV444_FUNC @@ -258,17 +265,19 @@ YUV444_FUNC(Yuv444ToRgb565, YuvToRgb565, 2) extern void WebPInitYUV444ConvertersMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersMIPSdspR2(void) { - WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb; WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba; - WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr; WebPYUV444Converters[MODE_BGRA] = Yuv444ToBgra; + WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba; + WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra; +#if !defined(WEBP_REDUCE_CSP) + WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb; + WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr; WebPYUV444Converters[MODE_ARGB] = Yuv444ToArgb; WebPYUV444Converters[MODE_RGBA_4444] = Yuv444ToRgba4444; WebPYUV444Converters[MODE_RGB_565] = Yuv444ToRgb565; - WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba; - WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra; WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb; WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444; +#endif // WEBP_REDUCE_CSP } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/upsampling_msa.c b/Pods/libwebp/src/dsp/upsampling_msa.c index f24926f..f2e03e8 100644 --- a/Pods/libwebp/src/dsp/upsampling_msa.c +++ b/Pods/libwebp/src/dsp/upsampling_msa.c @@ -12,12 +12,12 @@ // Author: Prashant Patil (prashant.patil@imgtec.com) #include -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MSA) -#include "./msa_macro.h" -#include "./yuv.h" +#include "src/dsp/msa_macro.h" +#include "src/dsp/yuv.h" #ifdef FANCY_UPSAMPLING @@ -264,6 +264,7 @@ static void YuvToBgr(int y, int u, int v, uint8_t* const bgr) { bgr[2] = Clip8(r1 >> 6); } +#if !defined(WEBP_REDUCE_CSP) static void YuvToRgb565(int y, int u, int v, uint8_t* const rgb) { const int y1 = MultHi(y, 19077); const int r1 = y1 + MultHi(v, 26149) - 14234; @@ -274,7 +275,7 @@ static void YuvToRgb565(int y, int u, int v, uint8_t* const rgb) { const int b = Clip8(b1 >> 6); const int rg = (r & 0xf8) | (g >> 5); const int gb = ((g << 3) & 0xe0) | (b >> 3); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) rgb[0] = gb; rgb[1] = rg; #else @@ -293,7 +294,7 @@ static void YuvToRgba4444(int y, int u, int v, uint8_t* const argb) { const int b = Clip8(b1 >> 6); const int rg = (r & 0xf0) | (g >> 4); const int ba = (b & 0xf0) | 0x0f; // overwrite the lower 4 bits -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) argb[0] = ba; argb[1] = rg; #else @@ -306,6 +307,7 @@ static void YuvToArgb(uint8_t y, uint8_t u, uint8_t v, uint8_t* const argb) { argb[0] = 0xff; YuvToRgb(y, u, v, argb + 1); } +#endif // WEBP_REDUCE_CSP static void YuvToBgra(uint8_t y, uint8_t u, uint8_t v, uint8_t* const bgra) { YuvToBgr(y, u, v, bgra); @@ -317,6 +319,7 @@ static void YuvToRgba(uint8_t y, uint8_t u, uint8_t v, uint8_t* const rgba) { rgba[3] = 0xff; } +#if !defined(WEBP_REDUCE_CSP) static void YuvToRgbLine(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst, int length) { v16u8 R, G, B; @@ -370,11 +373,12 @@ static void YuvToBgrLine(const uint8_t* y, const uint8_t* u, memcpy(dst, temp, length * 3 * sizeof(*dst)); } } +#endif // WEBP_REDUCE_CSP static void YuvToRgbaLine(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst, int length) { v16u8 R, G, B; - const v16u8 A = (v16u8)__msa_ldi_b(0xff); + const v16u8 A = (v16u8)__msa_ldi_b(ALPHAVAL); while (length >= 16) { CALC_RGB16(y, u, v, R, G, B); STORE16_4(R, G, B, A, dst); @@ -402,7 +406,7 @@ static void YuvToRgbaLine(const uint8_t* y, const uint8_t* u, static void YuvToBgraLine(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst, int length) { v16u8 R, G, B; - const v16u8 A = (v16u8)__msa_ldi_b(0xff); + const v16u8 A = (v16u8)__msa_ldi_b(ALPHAVAL); while (length >= 16) { CALC_RGB16(y, u, v, R, G, B); STORE16_4(B, G, R, A, dst); @@ -427,10 +431,11 @@ static void YuvToBgraLine(const uint8_t* y, const uint8_t* u, } } +#if !defined(WEBP_REDUCE_CSP) static void YuvToArgbLine(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst, int length) { v16u8 R, G, B; - const v16u8 A = (v16u8)__msa_ldi_b(0xff); + const v16u8 A = (v16u8)__msa_ldi_b(ALPHAVAL); while (length >= 16) { CALC_RGB16(y, u, v, R, G, B); STORE16_4(A, R, G, B, dst); @@ -459,11 +464,11 @@ static void YuvToRgba4444Line(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst, int length) { v16u8 R, G, B, RG, BA, tmp0, tmp1; while (length >= 16) { - #ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) CALC_RGBA4444(y, u, v, BA, RG, 16, dst); - #else +#else CALC_RGBA4444(y, u, v, RG, BA, 16, dst); - #endif +#endif y += 16; u += 16; v += 16; @@ -473,7 +478,7 @@ static void YuvToRgba4444Line(const uint8_t* y, const uint8_t* u, if (length > 8) { uint8_t temp[2 * 16] = { 0 }; memcpy(temp, y, length * sizeof(*temp)); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) CALC_RGBA4444(temp, u, v, BA, RG, 16, temp); #else CALC_RGBA4444(temp, u, v, RG, BA, 16, temp); @@ -482,7 +487,7 @@ static void YuvToRgba4444Line(const uint8_t* y, const uint8_t* u, } else if (length > 0) { uint8_t temp[2 * 8] = { 0 }; memcpy(temp, y, length * sizeof(*temp)); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) CALC_RGBA4444(temp, u, v, BA, RG, 8, temp); #else CALC_RGBA4444(temp, u, v, RG, BA, 8, temp); @@ -495,11 +500,11 @@ static void YuvToRgb565Line(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst, int length) { v16u8 R, G, B, RG, GB, tmp0, tmp1; while (length >= 16) { - #ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) CALC_RGB565(y, u, v, GB, RG, 16, dst); - #else +#else CALC_RGB565(y, u, v, RG, GB, 16, dst); - #endif +#endif y += 16; u += 16; v += 16; @@ -509,7 +514,7 @@ static void YuvToRgb565Line(const uint8_t* y, const uint8_t* u, if (length > 8) { uint8_t temp[2 * 16] = { 0 }; memcpy(temp, y, length * sizeof(*temp)); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) CALC_RGB565(temp, u, v, GB, RG, 16, temp); #else CALC_RGB565(temp, u, v, RG, GB, 16, temp); @@ -518,7 +523,7 @@ static void YuvToRgb565Line(const uint8_t* y, const uint8_t* u, } else if (length > 0) { uint8_t temp[2 * 8] = { 0 }; memcpy(temp, y, length * sizeof(*temp)); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) CALC_RGB565(temp, u, v, GB, RG, 8, temp); #else CALC_RGB565(temp, u, v, RG, GB, 8, temp); @@ -526,6 +531,7 @@ static void YuvToRgb565Line(const uint8_t* y, const uint8_t* u, memcpy(dst, temp, length * 2 * sizeof(*dst)); } } +#endif // WEBP_REDUCE_CSP #define UPSAMPLE_32PIXELS(a, b, c, d) do { \ v16u8 s = __msa_aver_u_b(a, d); \ @@ -570,9 +576,9 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bot_y, \ const uint32_t l_uv = ((cur_u[0]) | ((cur_v[0]) << 16)); \ const uint32_t uv0 = (3 * tl_uv + l_uv + 0x00020002u) >> 2; \ const uint8_t* ptop_y = &top_y[1]; \ - uint8_t *ptop_dst = top_dst + XSTEP; \ + uint8_t* ptop_dst = top_dst + XSTEP; \ const uint8_t* pbot_y = &bot_y[1]; \ - uint8_t *pbot_dst = bot_dst + XSTEP; \ + uint8_t* pbot_dst = bot_dst + XSTEP; \ \ FUNC(top_y[0], uv0 & 0xff, (uv0 >> 16), top_dst); \ if (bot_y != NULL) { \ @@ -640,13 +646,15 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bot_y, \ } \ } -UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) -UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleRgbaLinePair, YuvToRgba, 4) UPSAMPLE_FUNC(UpsampleBgraLinePair, YuvToBgra, 4) +#if !defined(WEBP_REDUCE_CSP) +UPSAMPLE_FUNC(UpsampleRgbLinePair, YuvToRgb, 3) +UPSAMPLE_FUNC(UpsampleBgrLinePair, YuvToBgr, 3) UPSAMPLE_FUNC(UpsampleArgbLinePair, YuvToArgb, 4) UPSAMPLE_FUNC(UpsampleRgba4444LinePair, YuvToRgba4444, 2) UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP //------------------------------------------------------------------------------ // Entry point @@ -656,17 +664,19 @@ extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; extern void WebPInitUpsamplersMSA(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersMSA(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING diff --git a/Pods/libwebp/src/dsp/upsampling_neon.c b/Pods/libwebp/src/dsp/upsampling_neon.c index d371a83..6ba71a7 100644 --- a/Pods/libwebp/src/dsp/upsampling_neon.c +++ b/Pods/libwebp/src/dsp/upsampling_neon.c @@ -12,15 +12,15 @@ // Author: mans@mansr.com (Mans Rullgard) // Based on SSE code by: somnath@google.com (Somnath Banerjee) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_NEON) #include #include #include -#include "./neon.h" -#include "./yuv.h" +#include "src/dsp/neon.h" +#include "src/dsp/yuv.h" #ifdef FANCY_UPSAMPLING @@ -58,8 +58,8 @@ } while (0) // Turn the macro into a function for reducing code-size when non-critical -static void Upsample16Pixels(const uint8_t *r1, const uint8_t *r2, - uint8_t *out) { +static void Upsample16Pixels_NEON(const uint8_t* r1, const uint8_t* r2, + uint8_t* out) { UPSAMPLE_16PIXELS(r1, r2, out); } @@ -70,7 +70,7 @@ static void Upsample16Pixels(const uint8_t *r1, const uint8_t *r2, /* replicate last byte */ \ memset(r1 + (num_pixels), r1[(num_pixels) - 1], 9 - (num_pixels)); \ memset(r2 + (num_pixels), r2[(num_pixels) - 1], 9 - (num_pixels)); \ - Upsample16Pixels(r1, r2, out); \ + Upsample16Pixels_NEON(r1, r2, out); \ } //----------------------------------------------------------------------------- @@ -190,14 +190,14 @@ static const int16_t kCoeffs1[4] = { 19077, 26149, 6419, 13320 }; } #define NEON_UPSAMPLE_FUNC(FUNC_NAME, FMT, XSTEP) \ -static void FUNC_NAME(const uint8_t *top_y, const uint8_t *bottom_y, \ - const uint8_t *top_u, const uint8_t *top_v, \ - const uint8_t *cur_u, const uint8_t *cur_v, \ - uint8_t *top_dst, uint8_t *bottom_dst, int len) { \ +static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ + const uint8_t* top_u, const uint8_t* top_v, \ + const uint8_t* cur_u, const uint8_t* cur_v, \ + uint8_t* top_dst, uint8_t* bottom_dst, int len) { \ int block; \ /* 16 byte aligned array to cache reconstructed u and v */ \ uint8_t uv_buf[2 * 32 + 15]; \ - uint8_t *const r_uv = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \ + uint8_t* const r_uv = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \ const int uv_len = (len + 1) >> 1; \ /* 9 pixels must be read-able for each block */ \ const int num_blocks = (uv_len - 1) >> 3; \ @@ -243,13 +243,15 @@ static void FUNC_NAME(const uint8_t *top_y, const uint8_t *bottom_y, \ } // NEON variants of the fancy upsampler. -NEON_UPSAMPLE_FUNC(UpsampleRgbLinePair, Rgb, 3) -NEON_UPSAMPLE_FUNC(UpsampleBgrLinePair, Bgr, 3) -NEON_UPSAMPLE_FUNC(UpsampleRgbaLinePair, Rgba, 4) -NEON_UPSAMPLE_FUNC(UpsampleBgraLinePair, Bgra, 4) -NEON_UPSAMPLE_FUNC(UpsampleArgbLinePair, Argb, 4) -NEON_UPSAMPLE_FUNC(UpsampleRgba4444LinePair, Rgba4444, 2) -NEON_UPSAMPLE_FUNC(UpsampleRgb565LinePair, Rgb565, 2) +NEON_UPSAMPLE_FUNC(UpsampleRgbaLinePair_NEON, Rgba, 4) +NEON_UPSAMPLE_FUNC(UpsampleBgraLinePair_NEON, Bgra, 4) +#if !defined(WEBP_REDUCE_CSP) +NEON_UPSAMPLE_FUNC(UpsampleRgbLinePair_NEON, Rgb, 3) +NEON_UPSAMPLE_FUNC(UpsampleBgrLinePair_NEON, Bgr, 3) +NEON_UPSAMPLE_FUNC(UpsampleArgbLinePair_NEON, Argb, 4) +NEON_UPSAMPLE_FUNC(UpsampleRgba4444LinePair_NEON, Rgba4444, 2) +NEON_UPSAMPLE_FUNC(UpsampleRgb565LinePair_NEON, Rgb565, 2) +#endif // WEBP_REDUCE_CSP //------------------------------------------------------------------------------ // Entry point @@ -259,17 +261,19 @@ extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; extern void WebPInitUpsamplersNEON(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersNEON(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; - WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; - WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; - WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; - WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; - WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; - WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; + WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_NEON; + WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair_NEON; + WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_NEON; + WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_NEON; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_NEON; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_NEON; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_NEON; + WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair_NEON; + WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair_NEON; + WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair_NEON; + WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair_NEON; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING diff --git a/Pods/libwebp/src/dsp/upsampling_sse2.c b/Pods/libwebp/src/dsp/upsampling_sse2.c index b5b6689..340f1e2 100644 --- a/Pods/libwebp/src/dsp/upsampling_sse2.c +++ b/Pods/libwebp/src/dsp/upsampling_sse2.c @@ -11,14 +11,14 @@ // // Author: somnath@google.com (Somnath Banerjee) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_SSE2) #include #include #include -#include "./yuv.h" +#include "src/dsp/yuv.h" #ifdef FANCY_UPSAMPLING @@ -83,13 +83,13 @@ GET_M(ad, s, diag2); /* diag2 = (3a + b + c + 3d) / 8 */ \ \ /* pack the alternate pixels */ \ - PACK_AND_STORE(a, b, diag1, diag2, out + 0); /* store top */ \ - PACK_AND_STORE(c, d, diag2, diag1, out + 2 * 32); /* store bottom */ \ + PACK_AND_STORE(a, b, diag1, diag2, (out) + 0); /* store top */ \ + PACK_AND_STORE(c, d, diag2, diag1, (out) + 2 * 32); /* store bottom */ \ } // Turn the macro into a function for reducing code-size when non-critical -static void Upsample32Pixels(const uint8_t r1[], const uint8_t r2[], - uint8_t* const out) { +static void Upsample32Pixels_SSE2(const uint8_t r1[], const uint8_t r2[], + uint8_t* const out) { UPSAMPLE_32PIXELS(r1, r2, out); } @@ -101,30 +101,15 @@ static void Upsample32Pixels(const uint8_t r1[], const uint8_t r2[], memset(r1 + (num_pixels), r1[(num_pixels) - 1], 17 - (num_pixels)); \ memset(r2 + (num_pixels), r2[(num_pixels) - 1], 17 - (num_pixels)); \ /* using the shared function instead of the macro saves ~3k code size */ \ - Upsample32Pixels(r1, r2, out); \ -} - -#define CONVERT2RGB(FUNC, XSTEP, top_y, bottom_y, \ - top_dst, bottom_dst, cur_x, num_pixels) { \ - int n; \ - for (n = 0; n < (num_pixels); ++n) { \ - FUNC(top_y[(cur_x) + n], r_u[n], r_v[n], \ - top_dst + ((cur_x) + n) * XSTEP); \ - } \ - if (bottom_y != NULL) { \ - for (n = 0; n < (num_pixels); ++n) { \ - FUNC(bottom_y[(cur_x) + n], r_u[64 + n], r_v[64 + n], \ - bottom_dst + ((cur_x) + n) * XSTEP); \ - } \ - } \ + Upsample32Pixels_SSE2(r1, r2, out); \ } #define CONVERT2RGB_32(FUNC, XSTEP, top_y, bottom_y, \ top_dst, bottom_dst, cur_x) do { \ - FUNC##32(top_y + (cur_x), r_u, r_v, top_dst + (cur_x) * XSTEP); \ - if (bottom_y != NULL) { \ - FUNC##32(bottom_y + (cur_x), r_u + 64, r_v + 64, \ - bottom_dst + (cur_x) * XSTEP); \ + FUNC##32_SSE2((top_y) + (cur_x), r_u, r_v, (top_dst) + (cur_x) * (XSTEP)); \ + if ((bottom_y) != NULL) { \ + FUNC##32_SSE2((bottom_y) + (cur_x), r_u + 64, r_v + 64, \ + (bottom_dst) + (cur_x) * (XSTEP)); \ } \ } while (0) @@ -135,7 +120,7 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ uint8_t* top_dst, uint8_t* bottom_dst, int len) { \ int uv_pos, pos; \ /* 16byte-aligned array to cache reconstructed u and v */ \ - uint8_t uv_buf[4 * 32 + 15]; \ + uint8_t uv_buf[14 * 32 + 15] = { 0 }; \ uint8_t* const r_u = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \ uint8_t* const r_v = r_u + 32; \ \ @@ -160,22 +145,36 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ } \ if (len > 1) { \ const int left_over = ((len + 1) >> 1) - (pos >> 1); \ + uint8_t* const tmp_top_dst = r_u + 4 * 32; \ + uint8_t* const tmp_bottom_dst = tmp_top_dst + 4 * 32; \ + uint8_t* const tmp_top = tmp_bottom_dst + 4 * 32; \ + uint8_t* const tmp_bottom = (bottom_y == NULL) ? NULL : tmp_top + 32; \ assert(left_over > 0); \ UPSAMPLE_LAST_BLOCK(top_u + uv_pos, cur_u + uv_pos, left_over, r_u); \ UPSAMPLE_LAST_BLOCK(top_v + uv_pos, cur_v + uv_pos, left_over, r_v); \ - CONVERT2RGB(FUNC, XSTEP, top_y, bottom_y, top_dst, bottom_dst, \ - pos, len - pos); \ + memcpy(tmp_top, top_y + pos, len - pos); \ + if (bottom_y != NULL) memcpy(tmp_bottom, bottom_y + pos, len - pos); \ + CONVERT2RGB_32(FUNC, XSTEP, tmp_top, tmp_bottom, tmp_top_dst, \ + tmp_bottom_dst, 0); \ + memcpy(top_dst + pos * (XSTEP), tmp_top_dst, (len - pos) * (XSTEP)); \ + if (bottom_y != NULL) { \ + memcpy(bottom_dst + pos * (XSTEP), tmp_bottom_dst, \ + (len - pos) * (XSTEP)); \ + } \ } \ } // SSE2 variants of the fancy upsampler. -SSE2_UPSAMPLE_FUNC(UpsampleRgbLinePair, VP8YuvToRgb, 3) -SSE2_UPSAMPLE_FUNC(UpsampleBgrLinePair, VP8YuvToBgr, 3) -SSE2_UPSAMPLE_FUNC(UpsampleRgbaLinePair, VP8YuvToRgba, 4) -SSE2_UPSAMPLE_FUNC(UpsampleBgraLinePair, VP8YuvToBgra, 4) -SSE2_UPSAMPLE_FUNC(UpsampleArgbLinePair, VP8YuvToArgb, 4) -SSE2_UPSAMPLE_FUNC(UpsampleRgba4444LinePair, VP8YuvToRgba4444, 2) -SSE2_UPSAMPLE_FUNC(UpsampleRgb565LinePair, VP8YuvToRgb565, 2) +SSE2_UPSAMPLE_FUNC(UpsampleRgbaLinePair_SSE2, VP8YuvToRgba, 4) +SSE2_UPSAMPLE_FUNC(UpsampleBgraLinePair_SSE2, VP8YuvToBgra, 4) + +#if !defined(WEBP_REDUCE_CSP) +SSE2_UPSAMPLE_FUNC(UpsampleRgbLinePair_SSE2, VP8YuvToRgb, 3) +SSE2_UPSAMPLE_FUNC(UpsampleBgrLinePair_SSE2, VP8YuvToBgr, 3) +SSE2_UPSAMPLE_FUNC(UpsampleArgbLinePair_SSE2, VP8YuvToArgb, 4) +SSE2_UPSAMPLE_FUNC(UpsampleRgba4444LinePair_SSE2, VP8YuvToRgba4444, 2) +SSE2_UPSAMPLE_FUNC(UpsampleRgb565LinePair_SSE2, VP8YuvToRgb565, 2) +#endif // WEBP_REDUCE_CSP #undef GET_M #undef PACK_AND_STORE @@ -193,17 +192,19 @@ extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; extern void WebPInitUpsamplersSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersSSE2(void) { - WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair; - WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair; - WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair; - WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair; - WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair; - WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair; - WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair; - WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair; - WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair; + WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_SSE2; + WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair_SSE2; + WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair_SSE2; + WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair_SSE2; +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_SSE2; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_SSE2; + WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair_SSE2; + WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair_SSE2; + WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair_SSE2; + WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair_SSE2; + WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair_SSE2; +#endif // WEBP_REDUCE_CSP } #endif // FANCY_UPSAMPLING @@ -213,29 +214,46 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersSSE2(void) { extern WebPYUV444Converter WebPYUV444Converters[/* MODE_LAST */]; extern void WebPInitYUV444ConvertersSSE2(void); -#define YUV444_FUNC(FUNC_NAME, CALL, XSTEP) \ -extern void WebP##FUNC_NAME##C(const uint8_t* y, const uint8_t* u, \ - const uint8_t* v, uint8_t* dst, int len); \ +#define YUV444_FUNC(FUNC_NAME, CALL, CALL_C, XSTEP) \ +extern void CALL_C(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ + uint8_t* dst, int len); \ static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ uint8_t* dst, int len) { \ int i; \ const int max_len = len & ~31; \ - for (i = 0; i < max_len; i += 32) CALL(y + i, u + i, v + i, dst + i * XSTEP);\ + for (i = 0; i < max_len; i += 32) { \ + CALL(y + i, u + i, v + i, dst + i * (XSTEP)); \ + } \ if (i < len) { /* C-fallback */ \ - WebP##FUNC_NAME##C(y + i, u + i, v + i, dst + i * XSTEP, len - i); \ + CALL_C(y + i, u + i, v + i, dst + i * (XSTEP), len - i); \ } \ } -YUV444_FUNC(Yuv444ToRgba, VP8YuvToRgba32, 4); -YUV444_FUNC(Yuv444ToBgra, VP8YuvToBgra32, 4); -YUV444_FUNC(Yuv444ToRgb, VP8YuvToRgb32, 3); -YUV444_FUNC(Yuv444ToBgr, VP8YuvToBgr32, 3); +YUV444_FUNC(Yuv444ToRgba_SSE2, VP8YuvToRgba32_SSE2, WebPYuv444ToRgba_C, 4); +YUV444_FUNC(Yuv444ToBgra_SSE2, VP8YuvToBgra32_SSE2, WebPYuv444ToBgra_C, 4); +#if !defined(WEBP_REDUCE_CSP) +YUV444_FUNC(Yuv444ToRgb_SSE2, VP8YuvToRgb32_SSE2, WebPYuv444ToRgb_C, 3); +YUV444_FUNC(Yuv444ToBgr_SSE2, VP8YuvToBgr32_SSE2, WebPYuv444ToBgr_C, 3); +YUV444_FUNC(Yuv444ToArgb_SSE2, VP8YuvToArgb32_SSE2, WebPYuv444ToArgb_C, 4) +YUV444_FUNC(Yuv444ToRgba4444_SSE2, VP8YuvToRgba444432_SSE2, \ + WebPYuv444ToRgba4444_C, 2) +YUV444_FUNC(Yuv444ToRgb565_SSE2, VP8YuvToRgb56532_SSE2, WebPYuv444ToRgb565_C, 2) +#endif // WEBP_REDUCE_CSP WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersSSE2(void) { - WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba; - WebPYUV444Converters[MODE_BGRA] = Yuv444ToBgra; - WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb; - WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr; + WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba_SSE2; + WebPYUV444Converters[MODE_BGRA] = Yuv444ToBgra_SSE2; + WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba_SSE2; + WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra_SSE2; +#if !defined(WEBP_REDUCE_CSP) + WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb_SSE2; + WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr_SSE2; + WebPYUV444Converters[MODE_ARGB] = Yuv444ToArgb_SSE2; + WebPYUV444Converters[MODE_RGBA_4444] = Yuv444ToRgba4444_SSE2; + WebPYUV444Converters[MODE_RGB_565] = Yuv444ToRgb565_SSE2; + WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb_SSE2; + WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444_SSE2; +#endif // WEBP_REDUCE_CSP } #else diff --git a/Pods/libwebp/src/dsp/upsampling_sse41.c b/Pods/libwebp/src/dsp/upsampling_sse41.c new file mode 100644 index 0000000..648d456 --- /dev/null +++ b/Pods/libwebp/src/dsp/upsampling_sse41.c @@ -0,0 +1,239 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// SSE41 version of YUV to RGB upsampling functions. +// +// Author: somnath@google.com (Somnath Banerjee) + +#include "src/dsp/dsp.h" + +#if defined(WEBP_USE_SSE41) + +#include +#include +#include +#include "src/dsp/yuv.h" + +#ifdef FANCY_UPSAMPLING + +#if !defined(WEBP_REDUCE_CSP) + +// We compute (9*a + 3*b + 3*c + d + 8) / 16 as follows +// u = (9*a + 3*b + 3*c + d + 8) / 16 +// = (a + (a + 3*b + 3*c + d) / 8 + 1) / 2 +// = (a + m + 1) / 2 +// where m = (a + 3*b + 3*c + d) / 8 +// = ((a + b + c + d) / 2 + b + c) / 4 +// +// Let's say k = (a + b + c + d) / 4. +// We can compute k as +// k = (s + t + 1) / 2 - ((a^d) | (b^c) | (s^t)) & 1 +// where s = (a + d + 1) / 2 and t = (b + c + 1) / 2 +// +// Then m can be written as +// m = (k + t + 1) / 2 - (((b^c) & (s^t)) | (k^t)) & 1 + +// Computes out = (k + in + 1) / 2 - ((ij & (s^t)) | (k^in)) & 1 +#define GET_M(ij, in, out) do { \ + const __m128i tmp0 = _mm_avg_epu8(k, (in)); /* (k + in + 1) / 2 */ \ + const __m128i tmp1 = _mm_and_si128((ij), st); /* (ij) & (s^t) */ \ + const __m128i tmp2 = _mm_xor_si128(k, (in)); /* (k^in) */ \ + const __m128i tmp3 = _mm_or_si128(tmp1, tmp2); /* ((ij) & (s^t)) | (k^in) */\ + const __m128i tmp4 = _mm_and_si128(tmp3, one); /* & 1 -> lsb_correction */ \ + (out) = _mm_sub_epi8(tmp0, tmp4); /* (k + in + 1) / 2 - lsb_correction */ \ +} while (0) + +// pack and store two alternating pixel rows +#define PACK_AND_STORE(a, b, da, db, out) do { \ + const __m128i t_a = _mm_avg_epu8(a, da); /* (9a + 3b + 3c + d + 8) / 16 */ \ + const __m128i t_b = _mm_avg_epu8(b, db); /* (3a + 9b + c + 3d + 8) / 16 */ \ + const __m128i t_1 = _mm_unpacklo_epi8(t_a, t_b); \ + const __m128i t_2 = _mm_unpackhi_epi8(t_a, t_b); \ + _mm_store_si128(((__m128i*)(out)) + 0, t_1); \ + _mm_store_si128(((__m128i*)(out)) + 1, t_2); \ +} while (0) + +// Loads 17 pixels each from rows r1 and r2 and generates 32 pixels. +#define UPSAMPLE_32PIXELS(r1, r2, out) { \ + const __m128i one = _mm_set1_epi8(1); \ + const __m128i a = _mm_loadu_si128((const __m128i*)&(r1)[0]); \ + const __m128i b = _mm_loadu_si128((const __m128i*)&(r1)[1]); \ + const __m128i c = _mm_loadu_si128((const __m128i*)&(r2)[0]); \ + const __m128i d = _mm_loadu_si128((const __m128i*)&(r2)[1]); \ + \ + const __m128i s = _mm_avg_epu8(a, d); /* s = (a + d + 1) / 2 */ \ + const __m128i t = _mm_avg_epu8(b, c); /* t = (b + c + 1) / 2 */ \ + const __m128i st = _mm_xor_si128(s, t); /* st = s^t */ \ + \ + const __m128i ad = _mm_xor_si128(a, d); /* ad = a^d */ \ + const __m128i bc = _mm_xor_si128(b, c); /* bc = b^c */ \ + \ + const __m128i t1 = _mm_or_si128(ad, bc); /* (a^d) | (b^c) */ \ + const __m128i t2 = _mm_or_si128(t1, st); /* (a^d) | (b^c) | (s^t) */ \ + const __m128i t3 = _mm_and_si128(t2, one); /* (a^d) | (b^c) | (s^t) & 1 */ \ + const __m128i t4 = _mm_avg_epu8(s, t); \ + const __m128i k = _mm_sub_epi8(t4, t3); /* k = (a + b + c + d) / 4 */ \ + __m128i diag1, diag2; \ + \ + GET_M(bc, t, diag1); /* diag1 = (a + 3b + 3c + d) / 8 */ \ + GET_M(ad, s, diag2); /* diag2 = (3a + b + c + 3d) / 8 */ \ + \ + /* pack the alternate pixels */ \ + PACK_AND_STORE(a, b, diag1, diag2, (out) + 0); /* store top */ \ + PACK_AND_STORE(c, d, diag2, diag1, (out) + 2 * 32); /* store bottom */ \ +} + +// Turn the macro into a function for reducing code-size when non-critical +static void Upsample32Pixels_SSE41(const uint8_t r1[], const uint8_t r2[], + uint8_t* const out) { + UPSAMPLE_32PIXELS(r1, r2, out); +} + +#define UPSAMPLE_LAST_BLOCK(tb, bb, num_pixels, out) { \ + uint8_t r1[17], r2[17]; \ + memcpy(r1, (tb), (num_pixels)); \ + memcpy(r2, (bb), (num_pixels)); \ + /* replicate last byte */ \ + memset(r1 + (num_pixels), r1[(num_pixels) - 1], 17 - (num_pixels)); \ + memset(r2 + (num_pixels), r2[(num_pixels) - 1], 17 - (num_pixels)); \ + /* using the shared function instead of the macro saves ~3k code size */ \ + Upsample32Pixels_SSE41(r1, r2, out); \ +} + +#define CONVERT2RGB_32(FUNC, XSTEP, top_y, bottom_y, \ + top_dst, bottom_dst, cur_x) do { \ + FUNC##32_SSE41((top_y) + (cur_x), r_u, r_v, (top_dst) + (cur_x) * (XSTEP)); \ + if ((bottom_y) != NULL) { \ + FUNC##32_SSE41((bottom_y) + (cur_x), r_u + 64, r_v + 64, \ + (bottom_dst) + (cur_x) * (XSTEP)); \ + } \ +} while (0) + +#define SSE4_UPSAMPLE_FUNC(FUNC_NAME, FUNC, XSTEP) \ +static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \ + const uint8_t* top_u, const uint8_t* top_v, \ + const uint8_t* cur_u, const uint8_t* cur_v, \ + uint8_t* top_dst, uint8_t* bottom_dst, int len) { \ + int uv_pos, pos; \ + /* 16byte-aligned array to cache reconstructed u and v */ \ + uint8_t uv_buf[14 * 32 + 15] = { 0 }; \ + uint8_t* const r_u = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \ + uint8_t* const r_v = r_u + 32; \ + \ + assert(top_y != NULL); \ + { /* Treat the first pixel in regular way */ \ + const int u_diag = ((top_u[0] + cur_u[0]) >> 1) + 1; \ + const int v_diag = ((top_v[0] + cur_v[0]) >> 1) + 1; \ + const int u0_t = (top_u[0] + u_diag) >> 1; \ + const int v0_t = (top_v[0] + v_diag) >> 1; \ + FUNC(top_y[0], u0_t, v0_t, top_dst); \ + if (bottom_y != NULL) { \ + const int u0_b = (cur_u[0] + u_diag) >> 1; \ + const int v0_b = (cur_v[0] + v_diag) >> 1; \ + FUNC(bottom_y[0], u0_b, v0_b, bottom_dst); \ + } \ + } \ + /* For UPSAMPLE_32PIXELS, 17 u/v values must be read-able for each block */ \ + for (pos = 1, uv_pos = 0; pos + 32 + 1 <= len; pos += 32, uv_pos += 16) { \ + UPSAMPLE_32PIXELS(top_u + uv_pos, cur_u + uv_pos, r_u); \ + UPSAMPLE_32PIXELS(top_v + uv_pos, cur_v + uv_pos, r_v); \ + CONVERT2RGB_32(FUNC, XSTEP, top_y, bottom_y, top_dst, bottom_dst, pos); \ + } \ + if (len > 1) { \ + const int left_over = ((len + 1) >> 1) - (pos >> 1); \ + uint8_t* const tmp_top_dst = r_u + 4 * 32; \ + uint8_t* const tmp_bottom_dst = tmp_top_dst + 4 * 32; \ + uint8_t* const tmp_top = tmp_bottom_dst + 4 * 32; \ + uint8_t* const tmp_bottom = (bottom_y == NULL) ? NULL : tmp_top + 32; \ + assert(left_over > 0); \ + UPSAMPLE_LAST_BLOCK(top_u + uv_pos, cur_u + uv_pos, left_over, r_u); \ + UPSAMPLE_LAST_BLOCK(top_v + uv_pos, cur_v + uv_pos, left_over, r_v); \ + memcpy(tmp_top, top_y + pos, len - pos); \ + if (bottom_y != NULL) memcpy(tmp_bottom, bottom_y + pos, len - pos); \ + CONVERT2RGB_32(FUNC, XSTEP, tmp_top, tmp_bottom, tmp_top_dst, \ + tmp_bottom_dst, 0); \ + memcpy(top_dst + pos * (XSTEP), tmp_top_dst, (len - pos) * (XSTEP)); \ + if (bottom_y != NULL) { \ + memcpy(bottom_dst + pos * (XSTEP), tmp_bottom_dst, \ + (len - pos) * (XSTEP)); \ + } \ + } \ +} + +// SSE4 variants of the fancy upsampler. +SSE4_UPSAMPLE_FUNC(UpsampleRgbLinePair_SSE41, VP8YuvToRgb, 3) +SSE4_UPSAMPLE_FUNC(UpsampleBgrLinePair_SSE41, VP8YuvToBgr, 3) + +#undef GET_M +#undef PACK_AND_STORE +#undef UPSAMPLE_32PIXELS +#undef UPSAMPLE_LAST_BLOCK +#undef CONVERT2RGB +#undef CONVERT2RGB_32 +#undef SSE4_UPSAMPLE_FUNC + +#endif // WEBP_REDUCE_CSP + +//------------------------------------------------------------------------------ +// Entry point + +extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; + +extern void WebPInitUpsamplersSSE41(void); + +WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersSSE41(void) { +#if !defined(WEBP_REDUCE_CSP) + WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_SSE41; + WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_SSE41; +#endif // WEBP_REDUCE_CSP +} + +#endif // FANCY_UPSAMPLING + +//------------------------------------------------------------------------------ + +extern WebPYUV444Converter WebPYUV444Converters[/* MODE_LAST */]; +extern void WebPInitYUV444ConvertersSSE41(void); + +#define YUV444_FUNC(FUNC_NAME, CALL, CALL_C, XSTEP) \ +extern void CALL_C(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ + uint8_t* dst, int len); \ +static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \ + uint8_t* dst, int len) { \ + int i; \ + const int max_len = len & ~31; \ + for (i = 0; i < max_len; i += 32) { \ + CALL(y + i, u + i, v + i, dst + i * (XSTEP)); \ + } \ + if (i < len) { /* C-fallback */ \ + CALL_C(y + i, u + i, v + i, dst + i * (XSTEP), len - i); \ + } \ +} + +#if !defined(WEBP_REDUCE_CSP) +YUV444_FUNC(Yuv444ToRgb_SSE41, VP8YuvToRgb32_SSE41, WebPYuv444ToRgb_C, 3); +YUV444_FUNC(Yuv444ToBgr_SSE41, VP8YuvToBgr32_SSE41, WebPYuv444ToBgr_C, 3); +#endif // WEBP_REDUCE_CSP + +WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersSSE41(void) { +#if !defined(WEBP_REDUCE_CSP) + WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb_SSE41; + WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr_SSE41; +#endif // WEBP_REDUCE_CSP +} + +#else + +WEBP_DSP_INIT_STUB(WebPInitYUV444ConvertersSSE41) + +#endif // WEBP_USE_SSE41 + +#if !(defined(FANCY_UPSAMPLING) && defined(WEBP_USE_SSE41)) +WEBP_DSP_INIT_STUB(WebPInitUpsamplersSSE41) +#endif diff --git a/Pods/libwebp/src/dsp/yuv.c b/Pods/libwebp/src/dsp/yuv.c index dd7d9de..14e67fc 100644 --- a/Pods/libwebp/src/dsp/yuv.c +++ b/Pods/libwebp/src/dsp/yuv.c @@ -11,63 +11,11 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./yuv.h" +#include "src/dsp/yuv.h" +#include #include -#if defined(WEBP_YUV_USE_TABLE) - -static int done = 0; - -static WEBP_INLINE uint8_t clip(int v, int max_value) { - return v < 0 ? 0 : v > max_value ? max_value : v; -} - -int16_t VP8kVToR[256], VP8kUToB[256]; -int32_t VP8kVToG[256], VP8kUToG[256]; -uint8_t VP8kClip[YUV_RANGE_MAX - YUV_RANGE_MIN]; -uint8_t VP8kClip4Bits[YUV_RANGE_MAX - YUV_RANGE_MIN]; - -WEBP_TSAN_IGNORE_FUNCTION void VP8YUVInit(void) { - int i; - if (done) { - return; - } -#ifndef USE_YUVj - for (i = 0; i < 256; ++i) { - VP8kVToR[i] = (89858 * (i - 128) + YUV_HALF) >> YUV_FIX; - VP8kUToG[i] = -22014 * (i - 128) + YUV_HALF; - VP8kVToG[i] = -45773 * (i - 128); - VP8kUToB[i] = (113618 * (i - 128) + YUV_HALF) >> YUV_FIX; - } - for (i = YUV_RANGE_MIN; i < YUV_RANGE_MAX; ++i) { - const int k = ((i - 16) * 76283 + YUV_HALF) >> YUV_FIX; - VP8kClip[i - YUV_RANGE_MIN] = clip(k, 255); - VP8kClip4Bits[i - YUV_RANGE_MIN] = clip((k + 8) >> 4, 15); - } -#else - for (i = 0; i < 256; ++i) { - VP8kVToR[i] = (91881 * (i - 128) + YUV_HALF) >> YUV_FIX; - VP8kUToG[i] = -22554 * (i - 128) + YUV_HALF; - VP8kVToG[i] = -46802 * (i - 128); - VP8kUToB[i] = (116130 * (i - 128) + YUV_HALF) >> YUV_FIX; - } - for (i = YUV_RANGE_MIN; i < YUV_RANGE_MAX; ++i) { - const int k = i; - VP8kClip[i - YUV_RANGE_MIN] = clip(k, 255); - VP8kClip4Bits[i - YUV_RANGE_MIN] = clip((k + 8) >> 4, 15); - } -#endif - - done = 1; -} - -#else - -WEBP_TSAN_IGNORE_FUNCTION void VP8YUVInit(void) {} - -#endif // WEBP_YUV_USE_TABLE - //----------------------------------------------------------------------------- // Plain-C version @@ -75,14 +23,14 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8YUVInit(void) {} static void FUNC_NAME(const uint8_t* y, \ const uint8_t* u, const uint8_t* v, \ uint8_t* dst, int len) { \ - const uint8_t* const end = dst + (len & ~1) * XSTEP; \ + const uint8_t* const end = dst + (len & ~1) * (XSTEP); \ while (dst != end) { \ FUNC(y[0], u[0], v[0], dst); \ - FUNC(y[1], u[0], v[0], dst + XSTEP); \ + FUNC(y[1], u[0], v[0], dst + (XSTEP)); \ y += 2; \ ++u; \ ++v; \ - dst += 2 * XSTEP; \ + dst += 2 * (XSTEP); \ } \ if (len & 1) { \ FUNC(y[0], u[0], v[0], dst); \ @@ -123,15 +71,11 @@ void WebPSamplerProcessPlane(const uint8_t* y, int y_stride, WebPSamplerRowFunc WebPSamplers[MODE_LAST]; extern void WebPInitSamplersSSE2(void); +extern void WebPInitSamplersSSE41(void); extern void WebPInitSamplersMIPS32(void); extern void WebPInitSamplersMIPSdspR2(void); -static volatile VP8CPUInfo yuv_last_cpuinfo_used = - (VP8CPUInfo)&yuv_last_cpuinfo_used; - -WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) { - if (yuv_last_cpuinfo_used == VP8GetCPUInfo) return; - +WEBP_DSP_INIT_FUNC(WebPInitSamplers) { WebPSamplers[MODE_RGB] = YuvToRgbRow; WebPSamplers[MODE_RGBA] = YuvToRgbaRow; WebPSamplers[MODE_BGR] = YuvToBgrRow; @@ -151,6 +95,11 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) { WebPInitSamplersSSE2(); } #endif // WEBP_USE_SSE2 +#if defined(WEBP_USE_SSE41) + if (VP8GetCPUInfo(kSSE4_1)) { + WebPInitSamplersSSE41(); + } +#endif // WEBP_USE_SSE41 #if defined(WEBP_USE_MIPS32) if (VP8GetCPUInfo(kMIPS32)) { WebPInitSamplersMIPS32(); @@ -162,13 +111,12 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) { } #endif // WEBP_USE_MIPS_DSP_R2 } - yuv_last_cpuinfo_used = VP8GetCPUInfo; } //----------------------------------------------------------------------------- // ARGB -> YUV converters -static void ConvertARGBToY(const uint32_t* argb, uint8_t* y, int width) { +static void ConvertARGBToY_C(const uint32_t* argb, uint8_t* y, int width) { int i; for (i = 0; i < width; ++i) { const uint32_t p = argb[i]; @@ -220,14 +168,14 @@ void WebPConvertARGBToUV_C(const uint32_t* argb, uint8_t* u, uint8_t* v, //----------------------------------------------------------------------------- -static void ConvertRGB24ToY(const uint8_t* rgb, uint8_t* y, int width) { +static void ConvertRGB24ToY_C(const uint8_t* rgb, uint8_t* y, int width) { int i; for (i = 0; i < width; ++i, rgb += 3) { y[i] = VP8RGBToY(rgb[0], rgb[1], rgb[2], YUV_HALF); } } -static void ConvertBGR24ToY(const uint8_t* bgr, uint8_t* y, int width) { +static void ConvertBGR24ToY_C(const uint8_t* bgr, uint8_t* y, int width) { int i; for (i = 0; i < width; ++i, bgr += 3) { y[i] = VP8RGBToY(bgr[2], bgr[1], bgr[0], YUV_HALF); @@ -246,6 +194,7 @@ void WebPConvertRGBA32ToUV_C(const uint16_t* rgb, //----------------------------------------------------------------------------- +#if !WEBP_NEON_OMIT_C_CODE #define MAX_Y ((1 << 10) - 1) // 10b precision over 16b-arithmetic static uint16_t clip_y(int v) { return (v < 0) ? 0 : (v > MAX_Y) ? MAX_Y : (uint16_t)v; @@ -283,6 +232,7 @@ static void SharpYUVFilterRow_C(const int16_t* A, const int16_t* B, int len, out[2 * i + 1] = clip_y(best_y[2 * i + 1] + v1); } } +#endif // !WEBP_NEON_OMIT_C_CODE #undef MAX_Y @@ -304,26 +254,26 @@ void (*WebPSharpYUVUpdateRGB)(const int16_t* ref, const int16_t* src, void (*WebPSharpYUVFilterRow)(const int16_t* A, const int16_t* B, int len, const uint16_t* best_y, uint16_t* out); -static volatile VP8CPUInfo rgba_to_yuv_last_cpuinfo_used = - (VP8CPUInfo)&rgba_to_yuv_last_cpuinfo_used; - extern void WebPInitConvertARGBToYUVSSE2(void); +extern void WebPInitConvertARGBToYUVSSE41(void); +extern void WebPInitConvertARGBToYUVNEON(void); extern void WebPInitSharpYUVSSE2(void); +extern void WebPInitSharpYUVNEON(void); -WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUV(void) { - if (rgba_to_yuv_last_cpuinfo_used == VP8GetCPUInfo) return; - - WebPConvertARGBToY = ConvertARGBToY; +WEBP_DSP_INIT_FUNC(WebPInitConvertARGBToYUV) { + WebPConvertARGBToY = ConvertARGBToY_C; WebPConvertARGBToUV = WebPConvertARGBToUV_C; - WebPConvertRGB24ToY = ConvertRGB24ToY; - WebPConvertBGR24ToY = ConvertBGR24ToY; + WebPConvertRGB24ToY = ConvertRGB24ToY_C; + WebPConvertBGR24ToY = ConvertBGR24ToY_C; WebPConvertRGBA32ToUV = WebPConvertRGBA32ToUV_C; +#if !WEBP_NEON_OMIT_C_CODE WebPSharpYUVUpdateY = SharpYUVUpdateY_C; WebPSharpYUVUpdateRGB = SharpYUVUpdateRGB_C; WebPSharpYUVFilterRow = SharpYUVFilterRow_C; +#endif if (VP8GetCPUInfo != NULL) { #if defined(WEBP_USE_SSE2) @@ -332,6 +282,27 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUV(void) { WebPInitSharpYUVSSE2(); } #endif // WEBP_USE_SSE2 +#if defined(WEBP_USE_SSE41) + if (VP8GetCPUInfo(kSSE4_1)) { + WebPInitConvertARGBToYUVSSE41(); + } +#endif // WEBP_USE_SSE41 + } + +#if defined(WEBP_USE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { + WebPInitConvertARGBToYUVNEON(); + WebPInitSharpYUVNEON(); } - rgba_to_yuv_last_cpuinfo_used = VP8GetCPUInfo; +#endif // WEBP_USE_NEON + + assert(WebPConvertARGBToY != NULL); + assert(WebPConvertARGBToUV != NULL); + assert(WebPConvertRGB24ToY != NULL); + assert(WebPConvertBGR24ToY != NULL); + assert(WebPConvertRGBA32ToUV != NULL); + assert(WebPSharpYUVUpdateY != NULL); + assert(WebPSharpYUVUpdateRGB != NULL); + assert(WebPSharpYUVFilterRow != NULL); } diff --git a/Pods/libwebp/src/dsp/yuv.h b/Pods/libwebp/src/dsp/yuv.h index 1d33b58..c12be1d 100644 --- a/Pods/libwebp/src/dsp/yuv.h +++ b/Pods/libwebp/src/dsp/yuv.h @@ -35,18 +35,8 @@ #ifndef WEBP_DSP_YUV_H_ #define WEBP_DSP_YUV_H_ -#include "./dsp.h" -#include "../dec/vp8_dec.h" - -#if defined(WEBP_EXPERIMENTAL_FEATURES) -// Do NOT activate this feature for real compression. This is only experimental! -// This flag is for comparison purpose against JPEG's "YUVj" natural colorspace. -// This colorspace is close to Rec.601's Y'CbCr model with the notable -// difference of allowing larger range for luma/chroma. -// See http://en.wikipedia.org/wiki/YCbCr#JPEG_conversion paragraph, and its -// difference with http://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.601_conversion -// #define USE_YUVj -#endif +#include "src/dsp/dsp.h" +#include "src/dec/vp8_dec.h" //------------------------------------------------------------------------------ // YUV -> RGB conversion @@ -58,12 +48,8 @@ extern "C" { enum { YUV_FIX = 16, // fixed-point precision for RGB->YUV YUV_HALF = 1 << (YUV_FIX - 1), - YUV_MASK = (256 << YUV_FIX) - 1, - YUV_RANGE_MIN = -227, // min value of r/g/b output - YUV_RANGE_MAX = 256 + 226, // max value of r/g/b output YUV_FIX2 = 6, // fixed-point precision for YUV->RGB - YUV_HALF2 = 1 << YUV_FIX2 >> 1, YUV_MASK2 = (256 << YUV_FIX2) - 1 }; @@ -111,7 +97,7 @@ static WEBP_INLINE void VP8YuvToRgb565(int y, int u, int v, const int b = VP8YUVToB(y, u); // 5 usable bits const int rg = (r & 0xf8) | (g >> 5); const int gb = ((g << 3) & 0xe0) | (b >> 3); -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) rgb[0] = gb; rgb[1] = rg; #else @@ -127,7 +113,7 @@ static WEBP_INLINE void VP8YuvToRgba4444(int y, int u, int v, const int b = VP8YUVToB(y, u); // 4 usable bits const int rg = (r & 0xf0) | (g >> 4); const int ba = (b & 0xf0) | 0x0f; // overwrite the lower 4 bits -#ifdef WEBP_SWAP_16BIT_CSP +#if (WEBP_SWAP_16BIT_CSP == 1) argb[0] = ba; argb[1] = rg; #else @@ -157,32 +143,42 @@ static WEBP_INLINE void VP8YuvToRgba(uint8_t y, uint8_t u, uint8_t v, rgba[3] = 0xff; } -// Must be called before everything, to initialize the tables. -void VP8YUVInit(void); - //----------------------------------------------------------------------------- // SSE2 extra functions (mostly for upsampling_sse2.c) #if defined(WEBP_USE_SSE2) // Process 32 pixels and store the result (16b, 24b or 32b per pixel) in *dst. -void VP8YuvToRgba32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst); -void VP8YuvToRgb32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst); -void VP8YuvToBgra32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst); -void VP8YuvToBgr32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst); -void VP8YuvToArgb32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst); -void VP8YuvToRgba444432(const uint8_t* y, const uint8_t* u, const uint8_t* v, +void VP8YuvToRgba32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); +void VP8YuvToRgb32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); +void VP8YuvToBgra32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); +void VP8YuvToBgr32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, uint8_t* dst); -void VP8YuvToRgb56532(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst); +void VP8YuvToArgb32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); +void VP8YuvToRgba444432_SSE2(const uint8_t* y, const uint8_t* u, + const uint8_t* v, uint8_t* dst); +void VP8YuvToRgb56532_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); #endif // WEBP_USE_SSE2 +//----------------------------------------------------------------------------- +// SSE41 extra functions (mostly for upsampling_sse41.c) + +#if defined(WEBP_USE_SSE41) + +// Process 32 pixels and store the result (16b, 24b or 32b per pixel) in *dst. +void VP8YuvToRgb32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); +void VP8YuvToBgr32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst); + +#endif // WEBP_USE_SSE41 + //------------------------------------------------------------------------------ // RGB -> YUV conversion @@ -192,8 +188,6 @@ static WEBP_INLINE int VP8ClipUV(int uv, int rounding) { return ((uv & ~0xff) == 0) ? uv : (uv < 0) ? 0 : 255; } -#ifndef USE_YUVj - static WEBP_INLINE int VP8RGBToY(int r, int g, int b, int rounding) { const int luma = 16839 * r + 33059 * g + 6420 * b; return (luma + rounding + (16 << YUV_FIX)) >> YUV_FIX; // no need to clip @@ -209,30 +203,8 @@ static WEBP_INLINE int VP8RGBToV(int r, int g, int b, int rounding) { return VP8ClipUV(v, rounding); } -#else - -// This JPEG-YUV colorspace, only for comparison! -// These are also 16bit precision coefficients from Rec.601, but with full -// [0..255] output range. -static WEBP_INLINE int VP8RGBToY(int r, int g, int b, int rounding) { - const int luma = 19595 * r + 38470 * g + 7471 * b; - return (luma + rounding) >> YUV_FIX; // no need to clip -} - -static WEBP_INLINE int VP8RGBToU(int r, int g, int b, int rounding) { - const int u = -11058 * r - 21710 * g + 32768 * b; - return VP8ClipUV(u, rounding); -} - -static WEBP_INLINE int VP8RGBToV(int r, int g, int b, int rounding) { - const int v = 32768 * r - 27439 * g - 5329 * b; - return VP8ClipUV(v, rounding); -} - -#endif // USE_YUVj - #ifdef __cplusplus } // extern "C" #endif -#endif /* WEBP_DSP_YUV_H_ */ +#endif // WEBP_DSP_YUV_H_ diff --git a/Pods/libwebp/src/dsp/yuv_mips32.c b/Pods/libwebp/src/dsp/yuv_mips32.c index e61aac5..9d0a887 100644 --- a/Pods/libwebp/src/dsp/yuv_mips32.c +++ b/Pods/libwebp/src/dsp/yuv_mips32.c @@ -12,11 +12,11 @@ // Author(s): Djordje Pesut (djordje.pesut@imgtec.com) // Jovan Zelincevic (jovan.zelincevic@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS32) -#include "./yuv.h" +#include "src/dsp/yuv.h" //------------------------------------------------------------------------------ // simple point-sampling @@ -77,10 +77,10 @@ static void FUNC_NAME(const uint8_t* y, \ } \ } -ROW_FUNC(YuvToRgbRow, 3, 0, 1, 2, 0) -ROW_FUNC(YuvToRgbaRow, 4, 0, 1, 2, 3) -ROW_FUNC(YuvToBgrRow, 3, 2, 1, 0, 0) -ROW_FUNC(YuvToBgraRow, 4, 2, 1, 0, 3) +ROW_FUNC(YuvToRgbRow_MIPS32, 3, 0, 1, 2, 0) +ROW_FUNC(YuvToRgbaRow_MIPS32, 4, 0, 1, 2, 3) +ROW_FUNC(YuvToBgrRow_MIPS32, 3, 2, 1, 0, 0) +ROW_FUNC(YuvToBgraRow_MIPS32, 4, 2, 1, 0, 3) #undef ROW_FUNC @@ -90,10 +90,10 @@ ROW_FUNC(YuvToBgraRow, 4, 2, 1, 0, 3) extern void WebPInitSamplersMIPS32(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersMIPS32(void) { - WebPSamplers[MODE_RGB] = YuvToRgbRow; - WebPSamplers[MODE_RGBA] = YuvToRgbaRow; - WebPSamplers[MODE_BGR] = YuvToBgrRow; - WebPSamplers[MODE_BGRA] = YuvToBgraRow; + WebPSamplers[MODE_RGB] = YuvToRgbRow_MIPS32; + WebPSamplers[MODE_RGBA] = YuvToRgbaRow_MIPS32; + WebPSamplers[MODE_BGR] = YuvToBgrRow_MIPS32; + WebPSamplers[MODE_BGRA] = YuvToBgraRow_MIPS32; } #else // !WEBP_USE_MIPS32 diff --git a/Pods/libwebp/src/dsp/yuv_mips_dsp_r2.c b/Pods/libwebp/src/dsp/yuv_mips_dsp_r2.c index 1720d41..cc8afcc 100644 --- a/Pods/libwebp/src/dsp/yuv_mips_dsp_r2.c +++ b/Pods/libwebp/src/dsp/yuv_mips_dsp_r2.c @@ -12,11 +12,11 @@ // Author(s): Branimir Vasic (branimir.vasic@imgtec.com) // Djordje Pesut (djordje.pesut@imgtec.com) -#include "./dsp.h" +#include "src/dsp/dsp.h" #if defined(WEBP_USE_MIPS_DSP_R2) -#include "./yuv.h" +#include "src/dsp/yuv.h" //------------------------------------------------------------------------------ // simple point-sampling @@ -105,10 +105,10 @@ static void FUNC_NAME(const uint8_t* y, \ } \ } -ROW_FUNC(YuvToRgbRow, 3, 0, 1, 2, 0) -ROW_FUNC(YuvToRgbaRow, 4, 0, 1, 2, 3) -ROW_FUNC(YuvToBgrRow, 3, 2, 1, 0, 0) -ROW_FUNC(YuvToBgraRow, 4, 2, 1, 0, 3) +ROW_FUNC(YuvToRgbRow_MIPSdspR2, 3, 0, 1, 2, 0) +ROW_FUNC(YuvToRgbaRow_MIPSdspR2, 4, 0, 1, 2, 3) +ROW_FUNC(YuvToBgrRow_MIPSdspR2, 3, 2, 1, 0, 0) +ROW_FUNC(YuvToBgraRow_MIPSdspR2, 4, 2, 1, 0, 3) #undef ROW_FUNC #undef ASM_CLOBBER_LIST @@ -121,10 +121,10 @@ ROW_FUNC(YuvToBgraRow, 4, 2, 1, 0, 3) extern void WebPInitSamplersMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersMIPSdspR2(void) { - WebPSamplers[MODE_RGB] = YuvToRgbRow; - WebPSamplers[MODE_RGBA] = YuvToRgbaRow; - WebPSamplers[MODE_BGR] = YuvToBgrRow; - WebPSamplers[MODE_BGRA] = YuvToBgraRow; + WebPSamplers[MODE_RGB] = YuvToRgbRow_MIPSdspR2; + WebPSamplers[MODE_RGBA] = YuvToRgbaRow_MIPSdspR2; + WebPSamplers[MODE_BGR] = YuvToBgrRow_MIPSdspR2; + WebPSamplers[MODE_BGRA] = YuvToBgraRow_MIPSdspR2; } #else // !WEBP_USE_MIPS_DSP_R2 diff --git a/Pods/libwebp/src/dsp/yuv_neon.c b/Pods/libwebp/src/dsp/yuv_neon.c new file mode 100644 index 0000000..a34d602 --- /dev/null +++ b/Pods/libwebp/src/dsp/yuv_neon.c @@ -0,0 +1,288 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// YUV->RGB conversion functions +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "src/dsp/yuv.h" + +#if defined(WEBP_USE_NEON) + +#include +#include + +#include "src/dsp/neon.h" + +//----------------------------------------------------------------------------- + +static uint8x8_t ConvertRGBToY_NEON(const uint8x8_t R, + const uint8x8_t G, + const uint8x8_t B) { + const uint16x8_t r = vmovl_u8(R); + const uint16x8_t g = vmovl_u8(G); + const uint16x8_t b = vmovl_u8(B); + const uint16x4_t r_lo = vget_low_u16(r); + const uint16x4_t r_hi = vget_high_u16(r); + const uint16x4_t g_lo = vget_low_u16(g); + const uint16x4_t g_hi = vget_high_u16(g); + const uint16x4_t b_lo = vget_low_u16(b); + const uint16x4_t b_hi = vget_high_u16(b); + const uint32x4_t tmp0_lo = vmull_n_u16( r_lo, 16839u); + const uint32x4_t tmp0_hi = vmull_n_u16( r_hi, 16839u); + const uint32x4_t tmp1_lo = vmlal_n_u16(tmp0_lo, g_lo, 33059u); + const uint32x4_t tmp1_hi = vmlal_n_u16(tmp0_hi, g_hi, 33059u); + const uint32x4_t tmp2_lo = vmlal_n_u16(tmp1_lo, b_lo, 6420u); + const uint32x4_t tmp2_hi = vmlal_n_u16(tmp1_hi, b_hi, 6420u); + const uint16x8_t Y1 = vcombine_u16(vrshrn_n_u32(tmp2_lo, 16), + vrshrn_n_u32(tmp2_hi, 16)); + const uint16x8_t Y2 = vaddq_u16(Y1, vdupq_n_u16(16)); + return vqmovn_u16(Y2); +} + +static void ConvertRGB24ToY_NEON(const uint8_t* rgb, uint8_t* y, int width) { + int i; + for (i = 0; i + 8 <= width; i += 8, rgb += 3 * 8) { + const uint8x8x3_t RGB = vld3_u8(rgb); + const uint8x8_t Y = ConvertRGBToY_NEON(RGB.val[0], RGB.val[1], RGB.val[2]); + vst1_u8(y + i, Y); + } + for (; i < width; ++i, rgb += 3) { // left-over + y[i] = VP8RGBToY(rgb[0], rgb[1], rgb[2], YUV_HALF); + } +} + +static void ConvertBGR24ToY_NEON(const uint8_t* bgr, uint8_t* y, int width) { + int i; + for (i = 0; i + 8 <= width; i += 8, bgr += 3 * 8) { + const uint8x8x3_t BGR = vld3_u8(bgr); + const uint8x8_t Y = ConvertRGBToY_NEON(BGR.val[2], BGR.val[1], BGR.val[0]); + vst1_u8(y + i, Y); + } + for (; i < width; ++i, bgr += 3) { // left-over + y[i] = VP8RGBToY(bgr[2], bgr[1], bgr[0], YUV_HALF); + } +} + +static void ConvertARGBToY_NEON(const uint32_t* argb, uint8_t* y, int width) { + int i; + for (i = 0; i + 8 <= width; i += 8) { + const uint8x8x4_t RGB = vld4_u8((const uint8_t*)&argb[i]); + const uint8x8_t Y = ConvertRGBToY_NEON(RGB.val[2], RGB.val[1], RGB.val[0]); + vst1_u8(y + i, Y); + } + for (; i < width; ++i) { // left-over + const uint32_t p = argb[i]; + y[i] = VP8RGBToY((p >> 16) & 0xff, (p >> 8) & 0xff, (p >> 0) & 0xff, + YUV_HALF); + } +} + +//----------------------------------------------------------------------------- + +// computes: DST_s16 = [(C0 * r + C1 * g + C2 * b) >> 16] + CST +#define MULTIPLY_16b_PREAMBLE(r, g, b) \ + const int16x4_t r_lo = vreinterpret_s16_u16(vget_low_u16(r)); \ + const int16x4_t r_hi = vreinterpret_s16_u16(vget_high_u16(r)); \ + const int16x4_t g_lo = vreinterpret_s16_u16(vget_low_u16(g)); \ + const int16x4_t g_hi = vreinterpret_s16_u16(vget_high_u16(g)); \ + const int16x4_t b_lo = vreinterpret_s16_u16(vget_low_u16(b)); \ + const int16x4_t b_hi = vreinterpret_s16_u16(vget_high_u16(b)) + +#define MULTIPLY_16b(C0, C1, C2, CST, DST_s16) do { \ + const int32x4_t tmp0_lo = vmull_n_s16( r_lo, C0); \ + const int32x4_t tmp0_hi = vmull_n_s16( r_hi, C0); \ + const int32x4_t tmp1_lo = vmlal_n_s16(tmp0_lo, g_lo, C1); \ + const int32x4_t tmp1_hi = vmlal_n_s16(tmp0_hi, g_hi, C1); \ + const int32x4_t tmp2_lo = vmlal_n_s16(tmp1_lo, b_lo, C2); \ + const int32x4_t tmp2_hi = vmlal_n_s16(tmp1_hi, b_hi, C2); \ + const int16x8_t tmp3 = vcombine_s16(vshrn_n_s32(tmp2_lo, 16), \ + vshrn_n_s32(tmp2_hi, 16)); \ + DST_s16 = vaddq_s16(tmp3, vdupq_n_s16(CST)); \ +} while (0) + +// This needs to be a macro, since (128 << SHIFT) needs to be an immediate. +#define CONVERT_RGB_TO_UV(r, g, b, SHIFT, U_DST, V_DST) do { \ + MULTIPLY_16b_PREAMBLE(r, g, b); \ + MULTIPLY_16b(-9719, -19081, 28800, 128 << SHIFT, U_DST); \ + MULTIPLY_16b(28800, -24116, -4684, 128 << SHIFT, V_DST); \ +} while (0) + +static void ConvertRGBA32ToUV_NEON(const uint16_t* rgb, + uint8_t* u, uint8_t* v, int width) { + int i; + for (i = 0; i + 8 <= width; i += 8, rgb += 4 * 8) { + const uint16x8x4_t RGB = vld4q_u16((const uint16_t*)rgb); + int16x8_t U, V; + CONVERT_RGB_TO_UV(RGB.val[0], RGB.val[1], RGB.val[2], 2, U, V); + vst1_u8(u + i, vqrshrun_n_s16(U, 2)); + vst1_u8(v + i, vqrshrun_n_s16(V, 2)); + } + for (; i < width; i += 1, rgb += 4) { + const int r = rgb[0], g = rgb[1], b = rgb[2]; + u[i] = VP8RGBToU(r, g, b, YUV_HALF << 2); + v[i] = VP8RGBToV(r, g, b, YUV_HALF << 2); + } +} + +static void ConvertARGBToUV_NEON(const uint32_t* argb, uint8_t* u, uint8_t* v, + int src_width, int do_store) { + int i; + for (i = 0; i + 16 <= src_width; i += 16, u += 8, v += 8) { + const uint8x16x4_t RGB = vld4q_u8((const uint8_t*)&argb[i]); + const uint16x8_t R = vpaddlq_u8(RGB.val[2]); // pair-wise adds + const uint16x8_t G = vpaddlq_u8(RGB.val[1]); + const uint16x8_t B = vpaddlq_u8(RGB.val[0]); + int16x8_t U_tmp, V_tmp; + CONVERT_RGB_TO_UV(R, G, B, 1, U_tmp, V_tmp); + { + const uint8x8_t U = vqrshrun_n_s16(U_tmp, 1); + const uint8x8_t V = vqrshrun_n_s16(V_tmp, 1); + if (do_store) { + vst1_u8(u, U); + vst1_u8(v, V); + } else { + const uint8x8_t prev_u = vld1_u8(u); + const uint8x8_t prev_v = vld1_u8(v); + vst1_u8(u, vrhadd_u8(U, prev_u)); + vst1_u8(v, vrhadd_u8(V, prev_v)); + } + } + } + if (i < src_width) { // left-over + WebPConvertARGBToUV_C(argb + i, u, v, src_width - i, do_store); + } +} + + +//------------------------------------------------------------------------------ + +extern void WebPInitConvertARGBToYUVNEON(void); + +WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUVNEON(void) { + WebPConvertRGB24ToY = ConvertRGB24ToY_NEON; + WebPConvertBGR24ToY = ConvertBGR24ToY_NEON; + WebPConvertARGBToY = ConvertARGBToY_NEON; + WebPConvertARGBToUV = ConvertARGBToUV_NEON; + WebPConvertRGBA32ToUV = ConvertRGBA32ToUV_NEON; +} + +//------------------------------------------------------------------------------ + +#define MAX_Y ((1 << 10) - 1) // 10b precision over 16b-arithmetic +static uint16_t clip_y_NEON(int v) { + return (v < 0) ? 0 : (v > MAX_Y) ? MAX_Y : (uint16_t)v; +} + +static uint64_t SharpYUVUpdateY_NEON(const uint16_t* ref, const uint16_t* src, + uint16_t* dst, int len) { + int i; + const int16x8_t zero = vdupq_n_s16(0); + const int16x8_t max = vdupq_n_s16(MAX_Y); + uint64x2_t sum = vdupq_n_u64(0); + uint64_t diff; + + for (i = 0; i + 8 <= len; i += 8) { + const int16x8_t A = vreinterpretq_s16_u16(vld1q_u16(ref + i)); + const int16x8_t B = vreinterpretq_s16_u16(vld1q_u16(src + i)); + const int16x8_t C = vreinterpretq_s16_u16(vld1q_u16(dst + i)); + const int16x8_t D = vsubq_s16(A, B); // diff_y + const int16x8_t F = vaddq_s16(C, D); // new_y + const uint16x8_t H = + vreinterpretq_u16_s16(vmaxq_s16(vminq_s16(F, max), zero)); + const int16x8_t I = vabsq_s16(D); // abs(diff_y) + vst1q_u16(dst + i, H); + sum = vpadalq_u32(sum, vpaddlq_u16(vreinterpretq_u16_s16(I))); + } + diff = vgetq_lane_u64(sum, 0) + vgetq_lane_u64(sum, 1); + for (; i < len; ++i) { + const int diff_y = ref[i] - src[i]; + const int new_y = (int)(dst[i]) + diff_y; + dst[i] = clip_y_NEON(new_y); + diff += (uint64_t)(abs(diff_y)); + } + return diff; +} + +static void SharpYUVUpdateRGB_NEON(const int16_t* ref, const int16_t* src, + int16_t* dst, int len) { + int i; + for (i = 0; i + 8 <= len; i += 8) { + const int16x8_t A = vld1q_s16(ref + i); + const int16x8_t B = vld1q_s16(src + i); + const int16x8_t C = vld1q_s16(dst + i); + const int16x8_t D = vsubq_s16(A, B); // diff_uv + const int16x8_t E = vaddq_s16(C, D); // new_uv + vst1q_s16(dst + i, E); + } + for (; i < len; ++i) { + const int diff_uv = ref[i] - src[i]; + dst[i] += diff_uv; + } +} + +static void SharpYUVFilterRow_NEON(const int16_t* A, const int16_t* B, int len, + const uint16_t* best_y, uint16_t* out) { + int i; + const int16x8_t max = vdupq_n_s16(MAX_Y); + const int16x8_t zero = vdupq_n_s16(0); + for (i = 0; i + 8 <= len; i += 8) { + const int16x8_t a0 = vld1q_s16(A + i + 0); + const int16x8_t a1 = vld1q_s16(A + i + 1); + const int16x8_t b0 = vld1q_s16(B + i + 0); + const int16x8_t b1 = vld1q_s16(B + i + 1); + const int16x8_t a0b1 = vaddq_s16(a0, b1); + const int16x8_t a1b0 = vaddq_s16(a1, b0); + const int16x8_t a0a1b0b1 = vaddq_s16(a0b1, a1b0); // A0+A1+B0+B1 + const int16x8_t a0b1_2 = vaddq_s16(a0b1, a0b1); // 2*(A0+B1) + const int16x8_t a1b0_2 = vaddq_s16(a1b0, a1b0); // 2*(A1+B0) + const int16x8_t c0 = vshrq_n_s16(vaddq_s16(a0b1_2, a0a1b0b1), 3); + const int16x8_t c1 = vshrq_n_s16(vaddq_s16(a1b0_2, a0a1b0b1), 3); + const int16x8_t d0 = vaddq_s16(c1, a0); + const int16x8_t d1 = vaddq_s16(c0, a1); + const int16x8_t e0 = vrshrq_n_s16(d0, 1); + const int16x8_t e1 = vrshrq_n_s16(d1, 1); + const int16x8x2_t f = vzipq_s16(e0, e1); + const int16x8_t g0 = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i + 0)); + const int16x8_t g1 = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i + 8)); + const int16x8_t h0 = vaddq_s16(g0, f.val[0]); + const int16x8_t h1 = vaddq_s16(g1, f.val[1]); + const int16x8_t i0 = vmaxq_s16(vminq_s16(h0, max), zero); + const int16x8_t i1 = vmaxq_s16(vminq_s16(h1, max), zero); + vst1q_u16(out + 2 * i + 0, vreinterpretq_u16_s16(i0)); + vst1q_u16(out + 2 * i + 8, vreinterpretq_u16_s16(i1)); + } + for (; i < len; ++i) { + const int a0b1 = A[i + 0] + B[i + 1]; + const int a1b0 = A[i + 1] + B[i + 0]; + const int a0a1b0b1 = a0b1 + a1b0 + 8; + const int v0 = (8 * A[i + 0] + 2 * a1b0 + a0a1b0b1) >> 4; + const int v1 = (8 * A[i + 1] + 2 * a0b1 + a0a1b0b1) >> 4; + out[2 * i + 0] = clip_y_NEON(best_y[2 * i + 0] + v0); + out[2 * i + 1] = clip_y_NEON(best_y[2 * i + 1] + v1); + } +} +#undef MAX_Y + +//------------------------------------------------------------------------------ + +extern void WebPInitSharpYUVNEON(void); + +WEBP_TSAN_IGNORE_FUNCTION void WebPInitSharpYUVNEON(void) { + WebPSharpYUVUpdateY = SharpYUVUpdateY_NEON; + WebPSharpYUVUpdateRGB = SharpYUVUpdateRGB_NEON; + WebPSharpYUVFilterRow = SharpYUVFilterRow_NEON; +} + +#else // !WEBP_USE_NEON + +WEBP_DSP_INIT_STUB(WebPInitConvertARGBToYUVNEON) +WEBP_DSP_INIT_STUB(WebPInitSharpYUVNEON) + +#endif // WEBP_USE_NEON diff --git a/Pods/libwebp/src/dsp/yuv_sse2.c b/Pods/libwebp/src/dsp/yuv_sse2.c index e33c2bb..baa48d5 100644 --- a/Pods/libwebp/src/dsp/yuv_sse2.c +++ b/Pods/libwebp/src/dsp/yuv_sse2.c @@ -11,11 +11,11 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./yuv.h" +#include "src/dsp/yuv.h" #if defined(WEBP_USE_SSE2) -#include "./common_sse2.h" +#include "src/dsp/common_sse2.h" #include #include @@ -26,12 +26,12 @@ // R = (19077 * y + 26149 * v - 14234) >> 6 // G = (19077 * y - 6419 * u - 13320 * v + 8708) >> 6 // B = (19077 * y + 33050 * u - 17685) >> 6 -static void ConvertYUV444ToRGB(const __m128i* const Y0, - const __m128i* const U0, - const __m128i* const V0, - __m128i* const R, - __m128i* const G, - __m128i* const B) { +static void ConvertYUV444ToRGB_SSE2(const __m128i* const Y0, + const __m128i* const U0, + const __m128i* const V0, + __m128i* const R, + __m128i* const G, + __m128i* const B) { const __m128i k19077 = _mm_set1_epi16(19077); const __m128i k26149 = _mm_set1_epi16(26149); const __m128i k14234 = _mm_set1_epi16(14234); @@ -66,13 +66,13 @@ static void ConvertYUV444ToRGB(const __m128i* const Y0, } // Load the bytes into the *upper* part of 16b words. That's "<< 8", basically. -static WEBP_INLINE __m128i Load_HI_16(const uint8_t* src) { +static WEBP_INLINE __m128i Load_HI_16_SSE2(const uint8_t* src) { const __m128i zero = _mm_setzero_si128(); return _mm_unpacklo_epi8(zero, _mm_loadl_epi64((const __m128i*)src)); } // Load and replicate the U/V samples -static WEBP_INLINE __m128i Load_UV_HI_8(const uint8_t* src) { +static WEBP_INLINE __m128i Load_UV_HI_8_SSE2(const uint8_t* src) { const __m128i zero = _mm_setzero_si128(); const __m128i tmp0 = _mm_cvtsi32_si128(*(const uint32_t*)src); const __m128i tmp1 = _mm_unpacklo_epi8(zero, tmp0); @@ -80,29 +80,33 @@ static WEBP_INLINE __m128i Load_UV_HI_8(const uint8_t* src) { } // Convert 32 samples of YUV444 to R/G/B -static void YUV444ToRGB(const uint8_t* const y, - const uint8_t* const u, - const uint8_t* const v, - __m128i* const R, __m128i* const G, __m128i* const B) { - const __m128i Y0 = Load_HI_16(y), U0 = Load_HI_16(u), V0 = Load_HI_16(v); - ConvertYUV444ToRGB(&Y0, &U0, &V0, R, G, B); +static void YUV444ToRGB_SSE2(const uint8_t* const y, + const uint8_t* const u, + const uint8_t* const v, + __m128i* const R, __m128i* const G, + __m128i* const B) { + const __m128i Y0 = Load_HI_16_SSE2(y), U0 = Load_HI_16_SSE2(u), + V0 = Load_HI_16_SSE2(v); + ConvertYUV444ToRGB_SSE2(&Y0, &U0, &V0, R, G, B); } // Convert 32 samples of YUV420 to R/G/B -static void YUV420ToRGB(const uint8_t* const y, - const uint8_t* const u, - const uint8_t* const v, - __m128i* const R, __m128i* const G, __m128i* const B) { - const __m128i Y0 = Load_HI_16(y), U0 = Load_UV_HI_8(u), V0 = Load_UV_HI_8(v); - ConvertYUV444ToRGB(&Y0, &U0, &V0, R, G, B); +static void YUV420ToRGB_SSE2(const uint8_t* const y, + const uint8_t* const u, + const uint8_t* const v, + __m128i* const R, __m128i* const G, + __m128i* const B) { + const __m128i Y0 = Load_HI_16_SSE2(y), U0 = Load_UV_HI_8_SSE2(u), + V0 = Load_UV_HI_8_SSE2(v); + ConvertYUV444ToRGB_SSE2(&Y0, &U0, &V0, R, G, B); } // Pack R/G/B/A results into 32b output. -static WEBP_INLINE void PackAndStore4(const __m128i* const R, - const __m128i* const G, - const __m128i* const B, - const __m128i* const A, - uint8_t* const dst) { +static WEBP_INLINE void PackAndStore4_SSE2(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + const __m128i* const A, + uint8_t* const dst) { const __m128i rb = _mm_packus_epi16(*R, *B); const __m128i ga = _mm_packus_epi16(*G, *A); const __m128i rg = _mm_unpacklo_epi8(rb, ga); @@ -114,12 +118,12 @@ static WEBP_INLINE void PackAndStore4(const __m128i* const R, } // Pack R/G/B/A results into 16b output. -static WEBP_INLINE void PackAndStore4444(const __m128i* const R, - const __m128i* const G, - const __m128i* const B, - const __m128i* const A, - uint8_t* const dst) { -#if !defined(WEBP_SWAP_16BIT_CSP) +static WEBP_INLINE void PackAndStore4444_SSE2(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + const __m128i* const A, + uint8_t* const dst) { +#if (WEBP_SWAP_16BIT_CSP == 0) const __m128i rg0 = _mm_packus_epi16(*R, *G); const __m128i ba0 = _mm_packus_epi16(*B, *A); #else @@ -136,10 +140,10 @@ static WEBP_INLINE void PackAndStore4444(const __m128i* const R, } // Pack R/G/B results into 16b output. -static WEBP_INLINE void PackAndStore565(const __m128i* const R, - const __m128i* const G, - const __m128i* const B, - uint8_t* const dst) { +static WEBP_INLINE void PackAndStore565_SSE2(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + uint8_t* const dst) { const __m128i r0 = _mm_packus_epi16(*R, *R); const __m128i g0 = _mm_packus_epi16(*G, *G); const __m128i b0 = _mm_packus_epi16(*B, *B); @@ -149,7 +153,7 @@ static WEBP_INLINE void PackAndStore565(const __m128i* const R, const __m128i g2 = _mm_slli_epi16(_mm_and_si128(g0, _mm_set1_epi8(0x1c)), 3); const __m128i rg = _mm_or_si128(r1, g1); const __m128i gb = _mm_or_si128(g2, b1); -#if !defined(WEBP_SWAP_16BIT_CSP) +#if (WEBP_SWAP_16BIT_CSP == 0) const __m128i rgb565 = _mm_unpacklo_epi8(rg, gb); #else const __m128i rgb565 = _mm_unpacklo_epi8(gb, rg); @@ -160,10 +164,10 @@ static WEBP_INLINE void PackAndStore565(const __m128i* const R, // Pack the planar buffers // rrrr... rrrr... gggg... gggg... bbbb... bbbb.... // triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ... -static WEBP_INLINE void PlanarTo24b(__m128i* const in0, __m128i* const in1, - __m128i* const in2, __m128i* const in3, - __m128i* const in4, __m128i* const in5, - uint8_t* const rgb) { +static WEBP_INLINE void PlanarTo24b_SSE2(__m128i* const in0, __m128i* const in1, + __m128i* const in2, __m128i* const in3, + __m128i* const in4, __m128i* const in5, + uint8_t* const rgb) { // The input is 6 registers of sixteen 8b but for the sake of explanation, // let's take 6 registers of four 8b values. // To pack, we will keep taking one every two 8b integer and move it @@ -176,7 +180,7 @@ static WEBP_INLINE void PlanarTo24b(__m128i* const in0, __m128i* const in1, // Repeat the same permutations twice more: // r0r4g0g4 | b0b4r1r5 | g1g5b1b5 | r2r6g2g6 | b2b6r3r7 | g3g7b3b7 // r0g0b0r1 | g1b1r2g2 | b2r3g3b3 | r4g4b4r5 | g5b5r6g6 | b6r7g7b7 - VP8PlanarTo24b(in0, in1, in2, in3, in4, in5); + VP8PlanarTo24b_SSE2(in0, in1, in2, in3, in4, in5); _mm_storeu_si128((__m128i*)(rgb + 0), *in0); _mm_storeu_si128((__m128i*)(rgb + 16), *in1); @@ -186,69 +190,69 @@ static WEBP_INLINE void PlanarTo24b(__m128i* const in0, __m128i* const in1, _mm_storeu_si128((__m128i*)(rgb + 80), *in5); } -void VP8YuvToRgba32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToRgba32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n < 32; n += 8, dst += 32) { __m128i R, G, B; - YUV444ToRGB(y + n, u + n, v + n, &R, &G, &B); - PackAndStore4(&R, &G, &B, &kAlpha, dst); + YUV444ToRGB_SSE2(y + n, u + n, v + n, &R, &G, &B); + PackAndStore4_SSE2(&R, &G, &B, &kAlpha, dst); } } -void VP8YuvToBgra32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToBgra32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n < 32; n += 8, dst += 32) { __m128i R, G, B; - YUV444ToRGB(y + n, u + n, v + n, &R, &G, &B); - PackAndStore4(&B, &G, &R, &kAlpha, dst); + YUV444ToRGB_SSE2(y + n, u + n, v + n, &R, &G, &B); + PackAndStore4_SSE2(&B, &G, &R, &kAlpha, dst); } } -void VP8YuvToArgb32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToArgb32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n < 32; n += 8, dst += 32) { __m128i R, G, B; - YUV444ToRGB(y + n, u + n, v + n, &R, &G, &B); - PackAndStore4(&kAlpha, &R, &G, &B, dst); + YUV444ToRGB_SSE2(y + n, u + n, v + n, &R, &G, &B); + PackAndStore4_SSE2(&kAlpha, &R, &G, &B, dst); } } -void VP8YuvToRgba444432(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToRgba444432_SSE2(const uint8_t* y, const uint8_t* u, + const uint8_t* v, uint8_t* dst) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n < 32; n += 8, dst += 16) { __m128i R, G, B; - YUV444ToRGB(y + n, u + n, v + n, &R, &G, &B); - PackAndStore4444(&R, &G, &B, &kAlpha, dst); + YUV444ToRGB_SSE2(y + n, u + n, v + n, &R, &G, &B); + PackAndStore4444_SSE2(&R, &G, &B, &kAlpha, dst); } } -void VP8YuvToRgb56532(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToRgb56532_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { int n; for (n = 0; n < 32; n += 8, dst += 16) { __m128i R, G, B; - YUV444ToRGB(y + n, u + n, v + n, &R, &G, &B); - PackAndStore565(&R, &G, &B, dst); + YUV444ToRGB_SSE2(y + n, u + n, v + n, &R, &G, &B); + PackAndStore565_SSE2(&R, &G, &B, dst); } } -void VP8YuvToRgb32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToRgb32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; __m128i rgb0, rgb1, rgb2, rgb3, rgb4, rgb5; - YUV444ToRGB(y + 0, u + 0, v + 0, &R0, &G0, &B0); - YUV444ToRGB(y + 8, u + 8, v + 8, &R1, &G1, &B1); - YUV444ToRGB(y + 16, u + 16, v + 16, &R2, &G2, &B2); - YUV444ToRGB(y + 24, u + 24, v + 24, &R3, &G3, &B3); + YUV444ToRGB_SSE2(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV444ToRGB_SSE2(y + 8, u + 8, v + 8, &R1, &G1, &B1); + YUV444ToRGB_SSE2(y + 16, u + 16, v + 16, &R2, &G2, &B2); + YUV444ToRGB_SSE2(y + 24, u + 24, v + 24, &R3, &G3, &B3); // Cast to 8b and store as RRRRGGGGBBBB. rgb0 = _mm_packus_epi16(R0, R1); @@ -259,18 +263,18 @@ void VP8YuvToRgb32(const uint8_t* y, const uint8_t* u, const uint8_t* v, rgb5 = _mm_packus_epi16(B2, B3); // Pack as RGBRGBRGBRGB. - PlanarTo24b(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst); + PlanarTo24b_SSE2(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst); } -void VP8YuvToBgr32(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst) { +void VP8YuvToBgr32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; __m128i bgr0, bgr1, bgr2, bgr3, bgr4, bgr5; - YUV444ToRGB(y + 0, u + 0, v + 0, &R0, &G0, &B0); - YUV444ToRGB(y + 8, u + 8, v + 8, &R1, &G1, &B1); - YUV444ToRGB(y + 16, u + 16, v + 16, &R2, &G2, &B2); - YUV444ToRGB(y + 24, u + 24, v + 24, &R3, &G3, &B3); + YUV444ToRGB_SSE2(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV444ToRGB_SSE2(y + 8, u + 8, v + 8, &R1, &G1, &B1); + YUV444ToRGB_SSE2(y + 16, u + 16, v + 16, &R2, &G2, &B2); + YUV444ToRGB_SSE2(y + 24, u + 24, v + 24, &R3, &G3, &B3); // Cast to 8b and store as BBBBGGGGRRRR. bgr0 = _mm_packus_epi16(B0, B1); @@ -281,20 +285,21 @@ void VP8YuvToBgr32(const uint8_t* y, const uint8_t* u, const uint8_t* v, bgr5= _mm_packus_epi16(R2, R3); // Pack as BGRBGRBGRBGR. - PlanarTo24b(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst); + PlanarTo24b_SSE2(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst); } //----------------------------------------------------------------------------- // Arbitrary-length row conversion functions -static void YuvToRgbaRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len) { +static void YuvToRgbaRow_SSE2(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n + 8 <= len; n += 8, dst += 32) { __m128i R, G, B; - YUV420ToRGB(y, u, v, &R, &G, &B); - PackAndStore4(&R, &G, &B, &kAlpha, dst); + YUV420ToRGB_SSE2(y, u, v, &R, &G, &B); + PackAndStore4_SSE2(&R, &G, &B, &kAlpha, dst); y += 8; u += 4; v += 4; @@ -308,14 +313,15 @@ static void YuvToRgbaRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, } } -static void YuvToBgraRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len) { +static void YuvToBgraRow_SSE2(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n + 8 <= len; n += 8, dst += 32) { __m128i R, G, B; - YUV420ToRGB(y, u, v, &R, &G, &B); - PackAndStore4(&B, &G, &R, &kAlpha, dst); + YUV420ToRGB_SSE2(y, u, v, &R, &G, &B); + PackAndStore4_SSE2(&B, &G, &R, &kAlpha, dst); y += 8; u += 4; v += 4; @@ -329,14 +335,15 @@ static void YuvToBgraRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, } } -static void YuvToArgbRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len) { +static void YuvToArgbRow_SSE2(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { const __m128i kAlpha = _mm_set1_epi16(255); int n; for (n = 0; n + 8 <= len; n += 8, dst += 32) { __m128i R, G, B; - YUV420ToRGB(y, u, v, &R, &G, &B); - PackAndStore4(&kAlpha, &R, &G, &B, dst); + YUV420ToRGB_SSE2(y, u, v, &R, &G, &B); + PackAndStore4_SSE2(&kAlpha, &R, &G, &B, dst); y += 8; u += 4; v += 4; @@ -350,17 +357,18 @@ static void YuvToArgbRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, } } -static void YuvToRgbRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len) { +static void YuvToRgbRow_SSE2(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { int n; for (n = 0; n + 32 <= len; n += 32, dst += 32 * 3) { __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; __m128i rgb0, rgb1, rgb2, rgb3, rgb4, rgb5; - YUV420ToRGB(y + 0, u + 0, v + 0, &R0, &G0, &B0); - YUV420ToRGB(y + 8, u + 4, v + 4, &R1, &G1, &B1); - YUV420ToRGB(y + 16, u + 8, v + 8, &R2, &G2, &B2); - YUV420ToRGB(y + 24, u + 12, v + 12, &R3, &G3, &B3); + YUV420ToRGB_SSE2(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV420ToRGB_SSE2(y + 8, u + 4, v + 4, &R1, &G1, &B1); + YUV420ToRGB_SSE2(y + 16, u + 8, v + 8, &R2, &G2, &B2); + YUV420ToRGB_SSE2(y + 24, u + 12, v + 12, &R3, &G3, &B3); // Cast to 8b and store as RRRRGGGGBBBB. rgb0 = _mm_packus_epi16(R0, R1); @@ -371,7 +379,7 @@ static void YuvToRgbRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, rgb5 = _mm_packus_epi16(B2, B3); // Pack as RGBRGBRGBRGB. - PlanarTo24b(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst); + PlanarTo24b_SSE2(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst); y += 32; u += 16; @@ -386,17 +394,18 @@ static void YuvToRgbRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, } } -static void YuvToBgrRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len) { +static void YuvToBgrRow_SSE2(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { int n; for (n = 0; n + 32 <= len; n += 32, dst += 32 * 3) { __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; __m128i bgr0, bgr1, bgr2, bgr3, bgr4, bgr5; - YUV420ToRGB(y + 0, u + 0, v + 0, &R0, &G0, &B0); - YUV420ToRGB(y + 8, u + 4, v + 4, &R1, &G1, &B1); - YUV420ToRGB(y + 16, u + 8, v + 8, &R2, &G2, &B2); - YUV420ToRGB(y + 24, u + 12, v + 12, &R3, &G3, &B3); + YUV420ToRGB_SSE2(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV420ToRGB_SSE2(y + 8, u + 4, v + 4, &R1, &G1, &B1); + YUV420ToRGB_SSE2(y + 16, u + 8, v + 8, &R2, &G2, &B2); + YUV420ToRGB_SSE2(y + 24, u + 12, v + 12, &R3, &G3, &B3); // Cast to 8b and store as BBBBGGGGRRRR. bgr0 = _mm_packus_epi16(B0, B1); @@ -407,7 +416,7 @@ static void YuvToBgrRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, bgr5 = _mm_packus_epi16(R2, R3); // Pack as BGRBGRBGRBGR. - PlanarTo24b(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst); + PlanarTo24b_SSE2(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst); y += 32; u += 16; @@ -428,11 +437,11 @@ static void YuvToBgrRow(const uint8_t* y, const uint8_t* u, const uint8_t* v, extern void WebPInitSamplersSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersSSE2(void) { - WebPSamplers[MODE_RGB] = YuvToRgbRow; - WebPSamplers[MODE_RGBA] = YuvToRgbaRow; - WebPSamplers[MODE_BGR] = YuvToBgrRow; - WebPSamplers[MODE_BGRA] = YuvToBgraRow; - WebPSamplers[MODE_ARGB] = YuvToArgbRow; + WebPSamplers[MODE_RGB] = YuvToRgbRow_SSE2; + WebPSamplers[MODE_RGBA] = YuvToRgbaRow_SSE2; + WebPSamplers[MODE_BGR] = YuvToBgrRow_SSE2; + WebPSamplers[MODE_BGRA] = YuvToBgraRow_SSE2; + WebPSamplers[MODE_ARGB] = YuvToArgbRow_SSE2; } //------------------------------------------------------------------------------ @@ -445,7 +454,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersSSE2(void) { // Function that inserts a value of the second half of the in buffer in between // every two char of the first half. -static WEBP_INLINE void RGB24PackedToPlanarHelper( +static WEBP_INLINE void RGB24PackedToPlanarHelper_SSE2( const __m128i* const in /*in[6]*/, __m128i* const out /*out[6]*/) { out[0] = _mm_unpacklo_epi8(in[0], in[3]); out[1] = _mm_unpackhi_epi8(in[0], in[3]); @@ -458,8 +467,8 @@ static WEBP_INLINE void RGB24PackedToPlanarHelper( // Unpack the 8b input rgbrgbrgbrgb ... as contiguous registers: // rrrr... rrrr... gggg... gggg... bbbb... bbbb.... // Similar to PlanarTo24bHelper(), but in reverse order. -static WEBP_INLINE void RGB24PackedToPlanar(const uint8_t* const rgb, - __m128i* const out /*out[6]*/) { +static WEBP_INLINE void RGB24PackedToPlanar_SSE2( + const uint8_t* const rgb, __m128i* const out /*out[6]*/) { __m128i tmp[6]; tmp[0] = _mm_loadu_si128((const __m128i*)(rgb + 0)); tmp[1] = _mm_loadu_si128((const __m128i*)(rgb + 16)); @@ -468,22 +477,22 @@ static WEBP_INLINE void RGB24PackedToPlanar(const uint8_t* const rgb, tmp[4] = _mm_loadu_si128((const __m128i*)(rgb + 64)); tmp[5] = _mm_loadu_si128((const __m128i*)(rgb + 80)); - RGB24PackedToPlanarHelper(tmp, out); - RGB24PackedToPlanarHelper(out, tmp); - RGB24PackedToPlanarHelper(tmp, out); - RGB24PackedToPlanarHelper(out, tmp); - RGB24PackedToPlanarHelper(tmp, out); + RGB24PackedToPlanarHelper_SSE2(tmp, out); + RGB24PackedToPlanarHelper_SSE2(out, tmp); + RGB24PackedToPlanarHelper_SSE2(tmp, out); + RGB24PackedToPlanarHelper_SSE2(out, tmp); + RGB24PackedToPlanarHelper_SSE2(tmp, out); } // Convert 8 packed ARGB to r[], g[], b[] -static WEBP_INLINE void RGB32PackedToPlanar(const uint32_t* const argb, - __m128i* const rgb /*in[6]*/) { +static WEBP_INLINE void RGB32PackedToPlanar_SSE2(const uint32_t* const argb, + __m128i* const rgb /*in[6]*/) { const __m128i zero = _mm_setzero_si128(); __m128i a0 = LOAD_16(argb + 0); __m128i a1 = LOAD_16(argb + 4); __m128i a2 = LOAD_16(argb + 8); __m128i a3 = LOAD_16(argb + 12); - VP8L32bToPlanar(&a0, &a1, &a2, &a3); + VP8L32bToPlanar_SSE2(&a0, &a1, &a2, &a3); rgb[0] = _mm_unpacklo_epi8(a1, zero); rgb[1] = _mm_unpackhi_epi8(a1, zero); rgb[2] = _mm_unpacklo_epi8(a2, zero); @@ -511,10 +520,10 @@ static WEBP_INLINE void RGB32PackedToPlanar(const uint32_t* const argb, } while (0) #define MK_CST_16(A, B) _mm_set_epi16((B), (A), (B), (A), (B), (A), (B), (A)) -static WEBP_INLINE void ConvertRGBToY(const __m128i* const R, - const __m128i* const G, - const __m128i* const B, - __m128i* const Y) { +static WEBP_INLINE void ConvertRGBToY_SSE2(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + __m128i* const Y) { const __m128i kRG_y = MK_CST_16(16839, 33059 - 16384); const __m128i kGB_y = MK_CST_16(16384, 6420); const __m128i kHALF_Y = _mm_set1_epi32((16 << YUV_FIX) + YUV_HALF); @@ -526,10 +535,11 @@ static WEBP_INLINE void ConvertRGBToY(const __m128i* const R, TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_y, kGB_y, kHALF_Y, YUV_FIX, *Y); } -static WEBP_INLINE void ConvertRGBToUV(const __m128i* const R, - const __m128i* const G, - const __m128i* const B, - __m128i* const U, __m128i* const V) { +static WEBP_INLINE void ConvertRGBToUV_SSE2(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + __m128i* const U, + __m128i* const V) { const __m128i kRG_u = MK_CST_16(-9719, -19081); const __m128i kGB_u = MK_CST_16(0, 28800); const __m128i kRG_v = MK_CST_16(28800, 0); @@ -549,14 +559,14 @@ static WEBP_INLINE void ConvertRGBToUV(const __m128i* const R, #undef MK_CST_16 #undef TRANSFORM -static void ConvertRGB24ToY(const uint8_t* rgb, uint8_t* y, int width) { +static void ConvertRGB24ToY_SSE2(const uint8_t* rgb, uint8_t* y, int width) { const int max_width = width & ~31; int i; for (i = 0; i < max_width; rgb += 3 * 16 * 2) { __m128i rgb_plane[6]; int j; - RGB24PackedToPlanar(rgb, rgb_plane); + RGB24PackedToPlanar_SSE2(rgb, rgb_plane); for (j = 0; j < 2; ++j, i += 16) { const __m128i zero = _mm_setzero_si128(); @@ -566,13 +576,13 @@ static void ConvertRGB24ToY(const uint8_t* rgb, uint8_t* y, int width) { r = _mm_unpacklo_epi8(rgb_plane[0 + j], zero); g = _mm_unpacklo_epi8(rgb_plane[2 + j], zero); b = _mm_unpacklo_epi8(rgb_plane[4 + j], zero); - ConvertRGBToY(&r, &g, &b, &Y0); + ConvertRGBToY_SSE2(&r, &g, &b, &Y0); // Convert to 16-bit Y. r = _mm_unpackhi_epi8(rgb_plane[0 + j], zero); g = _mm_unpackhi_epi8(rgb_plane[2 + j], zero); b = _mm_unpackhi_epi8(rgb_plane[4 + j], zero); - ConvertRGBToY(&r, &g, &b, &Y1); + ConvertRGBToY_SSE2(&r, &g, &b, &Y1); // Cast to 8-bit and store. STORE_16(_mm_packus_epi16(Y0, Y1), y + i); @@ -583,14 +593,14 @@ static void ConvertRGB24ToY(const uint8_t* rgb, uint8_t* y, int width) { } } -static void ConvertBGR24ToY(const uint8_t* bgr, uint8_t* y, int width) { +static void ConvertBGR24ToY_SSE2(const uint8_t* bgr, uint8_t* y, int width) { const int max_width = width & ~31; int i; for (i = 0; i < max_width; bgr += 3 * 16 * 2) { __m128i bgr_plane[6]; int j; - RGB24PackedToPlanar(bgr, bgr_plane); + RGB24PackedToPlanar_SSE2(bgr, bgr_plane); for (j = 0; j < 2; ++j, i += 16) { const __m128i zero = _mm_setzero_si128(); @@ -600,13 +610,13 @@ static void ConvertBGR24ToY(const uint8_t* bgr, uint8_t* y, int width) { b = _mm_unpacklo_epi8(bgr_plane[0 + j], zero); g = _mm_unpacklo_epi8(bgr_plane[2 + j], zero); r = _mm_unpacklo_epi8(bgr_plane[4 + j], zero); - ConvertRGBToY(&r, &g, &b, &Y0); + ConvertRGBToY_SSE2(&r, &g, &b, &Y0); // Convert to 16-bit Y. b = _mm_unpackhi_epi8(bgr_plane[0 + j], zero); g = _mm_unpackhi_epi8(bgr_plane[2 + j], zero); r = _mm_unpackhi_epi8(bgr_plane[4 + j], zero); - ConvertRGBToY(&r, &g, &b, &Y1); + ConvertRGBToY_SSE2(&r, &g, &b, &Y1); // Cast to 8-bit and store. STORE_16(_mm_packus_epi16(Y0, Y1), y + i); @@ -617,14 +627,14 @@ static void ConvertBGR24ToY(const uint8_t* bgr, uint8_t* y, int width) { } } -static void ConvertARGBToY(const uint32_t* argb, uint8_t* y, int width) { +static void ConvertARGBToY_SSE2(const uint32_t* argb, uint8_t* y, int width) { const int max_width = width & ~15; int i; for (i = 0; i < max_width; i += 16) { __m128i Y0, Y1, rgb[6]; - RGB32PackedToPlanar(&argb[i], rgb); - ConvertRGBToY(&rgb[0], &rgb[2], &rgb[4], &Y0); - ConvertRGBToY(&rgb[1], &rgb[3], &rgb[5], &Y1); + RGB32PackedToPlanar_SSE2(&argb[i], rgb); + ConvertRGBToY_SSE2(&rgb[0], &rgb[2], &rgb[4], &Y0); + ConvertRGBToY_SSE2(&rgb[1], &rgb[3], &rgb[5], &Y1); STORE_16(_mm_packus_epi16(Y0, Y1), y + i); } for (; i < width; ++i) { // left-over @@ -636,31 +646,33 @@ static void ConvertARGBToY(const uint32_t* argb, uint8_t* y, int width) { // Horizontal add (doubled) of two 16b values, result is 16b. // in: A | B | C | D | ... -> out: 2*(A+B) | 2*(C+D) | ... -static void HorizontalAddPack(const __m128i* const A, const __m128i* const B, - __m128i* const out) { +static void HorizontalAddPack_SSE2(const __m128i* const A, + const __m128i* const B, + __m128i* const out) { const __m128i k2 = _mm_set1_epi16(2); const __m128i C = _mm_madd_epi16(*A, k2); const __m128i D = _mm_madd_epi16(*B, k2); *out = _mm_packs_epi32(C, D); } -static void ConvertARGBToUV(const uint32_t* argb, uint8_t* u, uint8_t* v, - int src_width, int do_store) { +static void ConvertARGBToUV_SSE2(const uint32_t* argb, + uint8_t* u, uint8_t* v, + int src_width, int do_store) { const int max_width = src_width & ~31; int i; for (i = 0; i < max_width; i += 32, u += 16, v += 16) { __m128i rgb[6], U0, V0, U1, V1; - RGB32PackedToPlanar(&argb[i], rgb); - HorizontalAddPack(&rgb[0], &rgb[1], &rgb[0]); - HorizontalAddPack(&rgb[2], &rgb[3], &rgb[2]); - HorizontalAddPack(&rgb[4], &rgb[5], &rgb[4]); - ConvertRGBToUV(&rgb[0], &rgb[2], &rgb[4], &U0, &V0); - - RGB32PackedToPlanar(&argb[i + 16], rgb); - HorizontalAddPack(&rgb[0], &rgb[1], &rgb[0]); - HorizontalAddPack(&rgb[2], &rgb[3], &rgb[2]); - HorizontalAddPack(&rgb[4], &rgb[5], &rgb[4]); - ConvertRGBToUV(&rgb[0], &rgb[2], &rgb[4], &U1, &V1); + RGB32PackedToPlanar_SSE2(&argb[i], rgb); + HorizontalAddPack_SSE2(&rgb[0], &rgb[1], &rgb[0]); + HorizontalAddPack_SSE2(&rgb[2], &rgb[3], &rgb[2]); + HorizontalAddPack_SSE2(&rgb[4], &rgb[5], &rgb[4]); + ConvertRGBToUV_SSE2(&rgb[0], &rgb[2], &rgb[4], &U0, &V0); + + RGB32PackedToPlanar_SSE2(&argb[i + 16], rgb); + HorizontalAddPack_SSE2(&rgb[0], &rgb[1], &rgb[0]); + HorizontalAddPack_SSE2(&rgb[2], &rgb[3], &rgb[2]); + HorizontalAddPack_SSE2(&rgb[4], &rgb[5], &rgb[4]); + ConvertRGBToUV_SSE2(&rgb[0], &rgb[2], &rgb[4], &U1, &V1); U0 = _mm_packus_epi16(U0, U1); V0 = _mm_packus_epi16(V0, V1); @@ -679,10 +691,9 @@ static void ConvertARGBToUV(const uint32_t* argb, uint8_t* u, uint8_t* v, } // Convert 16 packed ARGB 16b-values to r[], g[], b[] -static WEBP_INLINE void RGBA32PackedToPlanar_16b(const uint16_t* const rgbx, - __m128i* const r, - __m128i* const g, - __m128i* const b) { +static WEBP_INLINE void RGBA32PackedToPlanar_16b_SSE2( + const uint16_t* const rgbx, + __m128i* const r, __m128i* const g, __m128i* const b) { const __m128i in0 = LOAD_16(rgbx + 0); // r0 | g0 | b0 |x| r1 | g1 | b1 |x const __m128i in1 = LOAD_16(rgbx + 8); // r2 | g2 | b2 |x| r3 | g3 | b3 |x const __m128i in2 = LOAD_16(rgbx + 16); // r4 | ... @@ -701,16 +712,16 @@ static WEBP_INLINE void RGBA32PackedToPlanar_16b(const uint16_t* const rgbx, *b = _mm_unpacklo_epi64(B1, B3); } -static void ConvertRGBA32ToUV(const uint16_t* rgb, - uint8_t* u, uint8_t* v, int width) { +static void ConvertRGBA32ToUV_SSE2(const uint16_t* rgb, + uint8_t* u, uint8_t* v, int width) { const int max_width = width & ~15; const uint16_t* const last_rgb = rgb + 4 * max_width; while (rgb < last_rgb) { __m128i r, g, b, U0, V0, U1, V1; - RGBA32PackedToPlanar_16b(rgb + 0, &r, &g, &b); - ConvertRGBToUV(&r, &g, &b, &U0, &V0); - RGBA32PackedToPlanar_16b(rgb + 32, &r, &g, &b); - ConvertRGBToUV(&r, &g, &b, &U1, &V1); + RGBA32PackedToPlanar_16b_SSE2(rgb + 0, &r, &g, &b); + ConvertRGBToUV_SSE2(&r, &g, &b, &U0, &V0); + RGBA32PackedToPlanar_16b_SSE2(rgb + 32, &r, &g, &b); + ConvertRGBToUV_SSE2(&r, &g, &b, &U1, &V1); STORE_16(_mm_packus_epi16(U0, U1), u); STORE_16(_mm_packus_epi16(V0, V1), v); u += 16; @@ -727,13 +738,13 @@ static void ConvertRGBA32ToUV(const uint16_t* rgb, extern void WebPInitConvertARGBToYUVSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUVSSE2(void) { - WebPConvertARGBToY = ConvertARGBToY; - WebPConvertARGBToUV = ConvertARGBToUV; + WebPConvertARGBToY = ConvertARGBToY_SSE2; + WebPConvertARGBToUV = ConvertARGBToUV_SSE2; - WebPConvertRGB24ToY = ConvertRGB24ToY; - WebPConvertBGR24ToY = ConvertBGR24ToY; + WebPConvertRGB24ToY = ConvertRGB24ToY_SSE2; + WebPConvertBGR24ToY = ConvertBGR24ToY_SSE2; - WebPConvertRGBA32ToUV = ConvertRGBA32ToUV; + WebPConvertRGBA32ToUV = ConvertRGBA32ToUV_SSE2; } //------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/dsp/yuv_sse41.c b/Pods/libwebp/src/dsp/yuv_sse41.c new file mode 100644 index 0000000..579d1f7 --- /dev/null +++ b/Pods/libwebp/src/dsp/yuv_sse41.c @@ -0,0 +1,613 @@ +// Copyright 2014 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// YUV->RGB conversion functions +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "src/dsp/yuv.h" + +#if defined(WEBP_USE_SSE41) + +#include "src/dsp/common_sse41.h" +#include +#include + +//----------------------------------------------------------------------------- +// Convert spans of 32 pixels to various RGB formats for the fancy upsampler. + +// These constants are 14b fixed-point version of ITU-R BT.601 constants. +// R = (19077 * y + 26149 * v - 14234) >> 6 +// G = (19077 * y - 6419 * u - 13320 * v + 8708) >> 6 +// B = (19077 * y + 33050 * u - 17685) >> 6 +static void ConvertYUV444ToRGB_SSE41(const __m128i* const Y0, + const __m128i* const U0, + const __m128i* const V0, + __m128i* const R, + __m128i* const G, + __m128i* const B) { + const __m128i k19077 = _mm_set1_epi16(19077); + const __m128i k26149 = _mm_set1_epi16(26149); + const __m128i k14234 = _mm_set1_epi16(14234); + // 33050 doesn't fit in a signed short: only use this with unsigned arithmetic + const __m128i k33050 = _mm_set1_epi16((short)33050); + const __m128i k17685 = _mm_set1_epi16(17685); + const __m128i k6419 = _mm_set1_epi16(6419); + const __m128i k13320 = _mm_set1_epi16(13320); + const __m128i k8708 = _mm_set1_epi16(8708); + + const __m128i Y1 = _mm_mulhi_epu16(*Y0, k19077); + + const __m128i R0 = _mm_mulhi_epu16(*V0, k26149); + const __m128i R1 = _mm_sub_epi16(Y1, k14234); + const __m128i R2 = _mm_add_epi16(R1, R0); + + const __m128i G0 = _mm_mulhi_epu16(*U0, k6419); + const __m128i G1 = _mm_mulhi_epu16(*V0, k13320); + const __m128i G2 = _mm_add_epi16(Y1, k8708); + const __m128i G3 = _mm_add_epi16(G0, G1); + const __m128i G4 = _mm_sub_epi16(G2, G3); + + // be careful with the saturated *unsigned* arithmetic here! + const __m128i B0 = _mm_mulhi_epu16(*U0, k33050); + const __m128i B1 = _mm_adds_epu16(B0, Y1); + const __m128i B2 = _mm_subs_epu16(B1, k17685); + + // use logical shift for B2, which can be larger than 32767 + *R = _mm_srai_epi16(R2, 6); // range: [-14234, 30815] + *G = _mm_srai_epi16(G4, 6); // range: [-10953, 27710] + *B = _mm_srli_epi16(B2, 6); // range: [0, 34238] +} + +// Load the bytes into the *upper* part of 16b words. That's "<< 8", basically. +static WEBP_INLINE __m128i Load_HI_16_SSE41(const uint8_t* src) { + const __m128i zero = _mm_setzero_si128(); + return _mm_unpacklo_epi8(zero, _mm_loadl_epi64((const __m128i*)src)); +} + +// Load and replicate the U/V samples +static WEBP_INLINE __m128i Load_UV_HI_8_SSE41(const uint8_t* src) { + const __m128i zero = _mm_setzero_si128(); + const __m128i tmp0 = _mm_cvtsi32_si128(*(const uint32_t*)src); + const __m128i tmp1 = _mm_unpacklo_epi8(zero, tmp0); + return _mm_unpacklo_epi16(tmp1, tmp1); // replicate samples +} + +// Convert 32 samples of YUV444 to R/G/B +static void YUV444ToRGB_SSE41(const uint8_t* const y, + const uint8_t* const u, + const uint8_t* const v, + __m128i* const R, __m128i* const G, + __m128i* const B) { + const __m128i Y0 = Load_HI_16_SSE41(y), U0 = Load_HI_16_SSE41(u), + V0 = Load_HI_16_SSE41(v); + ConvertYUV444ToRGB_SSE41(&Y0, &U0, &V0, R, G, B); +} + +// Convert 32 samples of YUV420 to R/G/B +static void YUV420ToRGB_SSE41(const uint8_t* const y, + const uint8_t* const u, + const uint8_t* const v, + __m128i* const R, __m128i* const G, + __m128i* const B) { + const __m128i Y0 = Load_HI_16_SSE41(y), U0 = Load_UV_HI_8_SSE41(u), + V0 = Load_UV_HI_8_SSE41(v); + ConvertYUV444ToRGB_SSE41(&Y0, &U0, &V0, R, G, B); +} + +// Pack the planar buffers +// rrrr... rrrr... gggg... gggg... bbbb... bbbb.... +// triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ... +static WEBP_INLINE void PlanarTo24b_SSE41( + __m128i* const in0, __m128i* const in1, __m128i* const in2, + __m128i* const in3, __m128i* const in4, __m128i* const in5, + uint8_t* const rgb) { + // The input is 6 registers of sixteen 8b but for the sake of explanation, + // let's take 6 registers of four 8b values. + // To pack, we will keep taking one every two 8b integer and move it + // around as follows: + // Input: + // r0r1r2r3 | r4r5r6r7 | g0g1g2g3 | g4g5g6g7 | b0b1b2b3 | b4b5b6b7 + // Split the 6 registers in two sets of 3 registers: the first set as the even + // 8b bytes, the second the odd ones: + // r0r2r4r6 | g0g2g4g6 | b0b2b4b6 | r1r3r5r7 | g1g3g5g7 | b1b3b5b7 + // Repeat the same permutations twice more: + // r0r4g0g4 | b0b4r1r5 | g1g5b1b5 | r2r6g2g6 | b2b6r3r7 | g3g7b3b7 + // r0g0b0r1 | g1b1r2g2 | b2r3g3b3 | r4g4b4r5 | g5b5r6g6 | b6r7g7b7 + VP8PlanarTo24b_SSE41(in0, in1, in2, in3, in4, in5); + + _mm_storeu_si128((__m128i*)(rgb + 0), *in0); + _mm_storeu_si128((__m128i*)(rgb + 16), *in1); + _mm_storeu_si128((__m128i*)(rgb + 32), *in2); + _mm_storeu_si128((__m128i*)(rgb + 48), *in3); + _mm_storeu_si128((__m128i*)(rgb + 64), *in4); + _mm_storeu_si128((__m128i*)(rgb + 80), *in5); +} + +void VP8YuvToRgb32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { + __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; + __m128i rgb0, rgb1, rgb2, rgb3, rgb4, rgb5; + + YUV444ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV444ToRGB_SSE41(y + 8, u + 8, v + 8, &R1, &G1, &B1); + YUV444ToRGB_SSE41(y + 16, u + 16, v + 16, &R2, &G2, &B2); + YUV444ToRGB_SSE41(y + 24, u + 24, v + 24, &R3, &G3, &B3); + + // Cast to 8b and store as RRRRGGGGBBBB. + rgb0 = _mm_packus_epi16(R0, R1); + rgb1 = _mm_packus_epi16(R2, R3); + rgb2 = _mm_packus_epi16(G0, G1); + rgb3 = _mm_packus_epi16(G2, G3); + rgb4 = _mm_packus_epi16(B0, B1); + rgb5 = _mm_packus_epi16(B2, B3); + + // Pack as RGBRGBRGBRGB. + PlanarTo24b_SSE41(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst); +} + +void VP8YuvToBgr32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v, + uint8_t* dst) { + __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; + __m128i bgr0, bgr1, bgr2, bgr3, bgr4, bgr5; + + YUV444ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV444ToRGB_SSE41(y + 8, u + 8, v + 8, &R1, &G1, &B1); + YUV444ToRGB_SSE41(y + 16, u + 16, v + 16, &R2, &G2, &B2); + YUV444ToRGB_SSE41(y + 24, u + 24, v + 24, &R3, &G3, &B3); + + // Cast to 8b and store as BBBBGGGGRRRR. + bgr0 = _mm_packus_epi16(B0, B1); + bgr1 = _mm_packus_epi16(B2, B3); + bgr2 = _mm_packus_epi16(G0, G1); + bgr3 = _mm_packus_epi16(G2, G3); + bgr4 = _mm_packus_epi16(R0, R1); + bgr5= _mm_packus_epi16(R2, R3); + + // Pack as BGRBGRBGRBGR. + PlanarTo24b_SSE41(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst); +} + +//----------------------------------------------------------------------------- +// Arbitrary-length row conversion functions + +static void YuvToRgbRow_SSE41(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { + int n; + for (n = 0; n + 32 <= len; n += 32, dst += 32 * 3) { + __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; + __m128i rgb0, rgb1, rgb2, rgb3, rgb4, rgb5; + + YUV420ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV420ToRGB_SSE41(y + 8, u + 4, v + 4, &R1, &G1, &B1); + YUV420ToRGB_SSE41(y + 16, u + 8, v + 8, &R2, &G2, &B2); + YUV420ToRGB_SSE41(y + 24, u + 12, v + 12, &R3, &G3, &B3); + + // Cast to 8b and store as RRRRGGGGBBBB. + rgb0 = _mm_packus_epi16(R0, R1); + rgb1 = _mm_packus_epi16(R2, R3); + rgb2 = _mm_packus_epi16(G0, G1); + rgb3 = _mm_packus_epi16(G2, G3); + rgb4 = _mm_packus_epi16(B0, B1); + rgb5 = _mm_packus_epi16(B2, B3); + + // Pack as RGBRGBRGBRGB. + PlanarTo24b_SSE41(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst); + + y += 32; + u += 16; + v += 16; + } + for (; n < len; ++n) { // Finish off + VP8YuvToRgb(y[0], u[0], v[0], dst); + dst += 3; + y += 1; + u += (n & 1); + v += (n & 1); + } +} + +static void YuvToBgrRow_SSE41(const uint8_t* y, + const uint8_t* u, const uint8_t* v, + uint8_t* dst, int len) { + int n; + for (n = 0; n + 32 <= len; n += 32, dst += 32 * 3) { + __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3; + __m128i bgr0, bgr1, bgr2, bgr3, bgr4, bgr5; + + YUV420ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0); + YUV420ToRGB_SSE41(y + 8, u + 4, v + 4, &R1, &G1, &B1); + YUV420ToRGB_SSE41(y + 16, u + 8, v + 8, &R2, &G2, &B2); + YUV420ToRGB_SSE41(y + 24, u + 12, v + 12, &R3, &G3, &B3); + + // Cast to 8b and store as BBBBGGGGRRRR. + bgr0 = _mm_packus_epi16(B0, B1); + bgr1 = _mm_packus_epi16(B2, B3); + bgr2 = _mm_packus_epi16(G0, G1); + bgr3 = _mm_packus_epi16(G2, G3); + bgr4 = _mm_packus_epi16(R0, R1); + bgr5 = _mm_packus_epi16(R2, R3); + + // Pack as BGRBGRBGRBGR. + PlanarTo24b_SSE41(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst); + + y += 32; + u += 16; + v += 16; + } + for (; n < len; ++n) { // Finish off + VP8YuvToBgr(y[0], u[0], v[0], dst); + dst += 3; + y += 1; + u += (n & 1); + v += (n & 1); + } +} + +//------------------------------------------------------------------------------ +// Entry point + +extern void WebPInitSamplersSSE41(void); + +WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersSSE41(void) { + WebPSamplers[MODE_RGB] = YuvToRgbRow_SSE41; + WebPSamplers[MODE_BGR] = YuvToBgrRow_SSE41; +} + +//------------------------------------------------------------------------------ +// RGB24/32 -> YUV converters + +// Load eight 16b-words from *src. +#define LOAD_16(src) _mm_loadu_si128((const __m128i*)(src)) +// Store either 16b-words into *dst +#define STORE_16(V, dst) _mm_storeu_si128((__m128i*)(dst), (V)) + +#define WEBP_SSE41_SHUFF(OUT) do { \ + const __m128i tmp0 = _mm_shuffle_epi8(A0, shuff0); \ + const __m128i tmp1 = _mm_shuffle_epi8(A1, shuff1); \ + const __m128i tmp2 = _mm_shuffle_epi8(A2, shuff2); \ + const __m128i tmp3 = _mm_shuffle_epi8(A3, shuff0); \ + const __m128i tmp4 = _mm_shuffle_epi8(A4, shuff1); \ + const __m128i tmp5 = _mm_shuffle_epi8(A5, shuff2); \ + \ + /* OR everything to get one channel */ \ + const __m128i tmp6 = _mm_or_si128(tmp0, tmp1); \ + const __m128i tmp7 = _mm_or_si128(tmp3, tmp4); \ + out[OUT + 0] = _mm_or_si128(tmp6, tmp2); \ + out[OUT + 1] = _mm_or_si128(tmp7, tmp5); \ +} while (0); + +// Unpack the 8b input rgbrgbrgbrgb ... as contiguous registers: +// rrrr... rrrr... gggg... gggg... bbbb... bbbb.... +// Similar to PlanarTo24bHelper(), but in reverse order. +static WEBP_INLINE void RGB24PackedToPlanar_SSE41( + const uint8_t* const rgb, __m128i* const out /*out[6]*/) { + const __m128i A0 = _mm_loadu_si128((const __m128i*)(rgb + 0)); + const __m128i A1 = _mm_loadu_si128((const __m128i*)(rgb + 16)); + const __m128i A2 = _mm_loadu_si128((const __m128i*)(rgb + 32)); + const __m128i A3 = _mm_loadu_si128((const __m128i*)(rgb + 48)); + const __m128i A4 = _mm_loadu_si128((const __m128i*)(rgb + 64)); + const __m128i A5 = _mm_loadu_si128((const __m128i*)(rgb + 80)); + + // Compute RR. + { + const __m128i shuff0 = _mm_set_epi8( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 12, 9, 6, 3, 0); + const __m128i shuff1 = _mm_set_epi8( + -1, -1, -1, -1, -1, 14, 11, 8, 5, 2, -1, -1, -1, -1, -1, -1); + const __m128i shuff2 = _mm_set_epi8( + 13, 10, 7, 4, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + WEBP_SSE41_SHUFF(0) + } + // Compute GG. + { + const __m128i shuff0 = _mm_set_epi8( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, 10, 7, 4, 1); + const __m128i shuff1 = _mm_set_epi8( + -1, -1, -1, -1, -1, 15, 12, 9, 6, 3, 0, -1, -1, -1, -1, -1); + const __m128i shuff2 = _mm_set_epi8( + 14, 11, 8, 5, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + WEBP_SSE41_SHUFF(2) + } + // Compute BB. + { + const __m128i shuff0 = _mm_set_epi8( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, 11, 8, 5, 2); + const __m128i shuff1 = _mm_set_epi8( + -1, -1, -1, -1, -1, -1, 13, 10, 7, 4, 1, -1, -1, -1, -1, -1); + const __m128i shuff2 = _mm_set_epi8( + 15, 12, 9, 6, 3, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + WEBP_SSE41_SHUFF(4) + } +} + +#undef WEBP_SSE41_SHUFF + +// Convert 8 packed ARGB to r[], g[], b[] +static WEBP_INLINE void RGB32PackedToPlanar_SSE41( + const uint32_t* const argb, __m128i* const rgb /*in[6]*/) { + const __m128i zero = _mm_setzero_si128(); + __m128i a0 = LOAD_16(argb + 0); + __m128i a1 = LOAD_16(argb + 4); + __m128i a2 = LOAD_16(argb + 8); + __m128i a3 = LOAD_16(argb + 12); + VP8L32bToPlanar_SSE41(&a0, &a1, &a2, &a3); + rgb[0] = _mm_unpacklo_epi8(a1, zero); + rgb[1] = _mm_unpackhi_epi8(a1, zero); + rgb[2] = _mm_unpacklo_epi8(a2, zero); + rgb[3] = _mm_unpackhi_epi8(a2, zero); + rgb[4] = _mm_unpacklo_epi8(a3, zero); + rgb[5] = _mm_unpackhi_epi8(a3, zero); +} + +// This macro computes (RG * MULT_RG + GB * MULT_GB + ROUNDER) >> DESCALE_FIX +// It's a macro and not a function because we need to use immediate values with +// srai_epi32, e.g. +#define TRANSFORM(RG_LO, RG_HI, GB_LO, GB_HI, MULT_RG, MULT_GB, \ + ROUNDER, DESCALE_FIX, OUT) do { \ + const __m128i V0_lo = _mm_madd_epi16(RG_LO, MULT_RG); \ + const __m128i V0_hi = _mm_madd_epi16(RG_HI, MULT_RG); \ + const __m128i V1_lo = _mm_madd_epi16(GB_LO, MULT_GB); \ + const __m128i V1_hi = _mm_madd_epi16(GB_HI, MULT_GB); \ + const __m128i V2_lo = _mm_add_epi32(V0_lo, V1_lo); \ + const __m128i V2_hi = _mm_add_epi32(V0_hi, V1_hi); \ + const __m128i V3_lo = _mm_add_epi32(V2_lo, ROUNDER); \ + const __m128i V3_hi = _mm_add_epi32(V2_hi, ROUNDER); \ + const __m128i V5_lo = _mm_srai_epi32(V3_lo, DESCALE_FIX); \ + const __m128i V5_hi = _mm_srai_epi32(V3_hi, DESCALE_FIX); \ + (OUT) = _mm_packs_epi32(V5_lo, V5_hi); \ +} while (0) + +#define MK_CST_16(A, B) _mm_set_epi16((B), (A), (B), (A), (B), (A), (B), (A)) +static WEBP_INLINE void ConvertRGBToY_SSE41(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + __m128i* const Y) { + const __m128i kRG_y = MK_CST_16(16839, 33059 - 16384); + const __m128i kGB_y = MK_CST_16(16384, 6420); + const __m128i kHALF_Y = _mm_set1_epi32((16 << YUV_FIX) + YUV_HALF); + + const __m128i RG_lo = _mm_unpacklo_epi16(*R, *G); + const __m128i RG_hi = _mm_unpackhi_epi16(*R, *G); + const __m128i GB_lo = _mm_unpacklo_epi16(*G, *B); + const __m128i GB_hi = _mm_unpackhi_epi16(*G, *B); + TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_y, kGB_y, kHALF_Y, YUV_FIX, *Y); +} + +static WEBP_INLINE void ConvertRGBToUV_SSE41(const __m128i* const R, + const __m128i* const G, + const __m128i* const B, + __m128i* const U, + __m128i* const V) { + const __m128i kRG_u = MK_CST_16(-9719, -19081); + const __m128i kGB_u = MK_CST_16(0, 28800); + const __m128i kRG_v = MK_CST_16(28800, 0); + const __m128i kGB_v = MK_CST_16(-24116, -4684); + const __m128i kHALF_UV = _mm_set1_epi32(((128 << YUV_FIX) + YUV_HALF) << 2); + + const __m128i RG_lo = _mm_unpacklo_epi16(*R, *G); + const __m128i RG_hi = _mm_unpackhi_epi16(*R, *G); + const __m128i GB_lo = _mm_unpacklo_epi16(*G, *B); + const __m128i GB_hi = _mm_unpackhi_epi16(*G, *B); + TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_u, kGB_u, + kHALF_UV, YUV_FIX + 2, *U); + TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_v, kGB_v, + kHALF_UV, YUV_FIX + 2, *V); +} + +#undef MK_CST_16 +#undef TRANSFORM + +static void ConvertRGB24ToY_SSE41(const uint8_t* rgb, uint8_t* y, int width) { + const int max_width = width & ~31; + int i; + for (i = 0; i < max_width; rgb += 3 * 16 * 2) { + __m128i rgb_plane[6]; + int j; + + RGB24PackedToPlanar_SSE41(rgb, rgb_plane); + + for (j = 0; j < 2; ++j, i += 16) { + const __m128i zero = _mm_setzero_si128(); + __m128i r, g, b, Y0, Y1; + + // Convert to 16-bit Y. + r = _mm_unpacklo_epi8(rgb_plane[0 + j], zero); + g = _mm_unpacklo_epi8(rgb_plane[2 + j], zero); + b = _mm_unpacklo_epi8(rgb_plane[4 + j], zero); + ConvertRGBToY_SSE41(&r, &g, &b, &Y0); + + // Convert to 16-bit Y. + r = _mm_unpackhi_epi8(rgb_plane[0 + j], zero); + g = _mm_unpackhi_epi8(rgb_plane[2 + j], zero); + b = _mm_unpackhi_epi8(rgb_plane[4 + j], zero); + ConvertRGBToY_SSE41(&r, &g, &b, &Y1); + + // Cast to 8-bit and store. + STORE_16(_mm_packus_epi16(Y0, Y1), y + i); + } + } + for (; i < width; ++i, rgb += 3) { // left-over + y[i] = VP8RGBToY(rgb[0], rgb[1], rgb[2], YUV_HALF); + } +} + +static void ConvertBGR24ToY_SSE41(const uint8_t* bgr, uint8_t* y, int width) { + const int max_width = width & ~31; + int i; + for (i = 0; i < max_width; bgr += 3 * 16 * 2) { + __m128i bgr_plane[6]; + int j; + + RGB24PackedToPlanar_SSE41(bgr, bgr_plane); + + for (j = 0; j < 2; ++j, i += 16) { + const __m128i zero = _mm_setzero_si128(); + __m128i r, g, b, Y0, Y1; + + // Convert to 16-bit Y. + b = _mm_unpacklo_epi8(bgr_plane[0 + j], zero); + g = _mm_unpacklo_epi8(bgr_plane[2 + j], zero); + r = _mm_unpacklo_epi8(bgr_plane[4 + j], zero); + ConvertRGBToY_SSE41(&r, &g, &b, &Y0); + + // Convert to 16-bit Y. + b = _mm_unpackhi_epi8(bgr_plane[0 + j], zero); + g = _mm_unpackhi_epi8(bgr_plane[2 + j], zero); + r = _mm_unpackhi_epi8(bgr_plane[4 + j], zero); + ConvertRGBToY_SSE41(&r, &g, &b, &Y1); + + // Cast to 8-bit and store. + STORE_16(_mm_packus_epi16(Y0, Y1), y + i); + } + } + for (; i < width; ++i, bgr += 3) { // left-over + y[i] = VP8RGBToY(bgr[2], bgr[1], bgr[0], YUV_HALF); + } +} + +static void ConvertARGBToY_SSE41(const uint32_t* argb, uint8_t* y, int width) { + const int max_width = width & ~15; + int i; + for (i = 0; i < max_width; i += 16) { + __m128i Y0, Y1, rgb[6]; + RGB32PackedToPlanar_SSE41(&argb[i], rgb); + ConvertRGBToY_SSE41(&rgb[0], &rgb[2], &rgb[4], &Y0); + ConvertRGBToY_SSE41(&rgb[1], &rgb[3], &rgb[5], &Y1); + STORE_16(_mm_packus_epi16(Y0, Y1), y + i); + } + for (; i < width; ++i) { // left-over + const uint32_t p = argb[i]; + y[i] = VP8RGBToY((p >> 16) & 0xff, (p >> 8) & 0xff, (p >> 0) & 0xff, + YUV_HALF); + } +} + +// Horizontal add (doubled) of two 16b values, result is 16b. +// in: A | B | C | D | ... -> out: 2*(A+B) | 2*(C+D) | ... +static void HorizontalAddPack_SSE41(const __m128i* const A, + const __m128i* const B, + __m128i* const out) { + const __m128i k2 = _mm_set1_epi16(2); + const __m128i C = _mm_madd_epi16(*A, k2); + const __m128i D = _mm_madd_epi16(*B, k2); + *out = _mm_packs_epi32(C, D); +} + +static void ConvertARGBToUV_SSE41(const uint32_t* argb, + uint8_t* u, uint8_t* v, + int src_width, int do_store) { + const int max_width = src_width & ~31; + int i; + for (i = 0; i < max_width; i += 32, u += 16, v += 16) { + __m128i rgb[6], U0, V0, U1, V1; + RGB32PackedToPlanar_SSE41(&argb[i], rgb); + HorizontalAddPack_SSE41(&rgb[0], &rgb[1], &rgb[0]); + HorizontalAddPack_SSE41(&rgb[2], &rgb[3], &rgb[2]); + HorizontalAddPack_SSE41(&rgb[4], &rgb[5], &rgb[4]); + ConvertRGBToUV_SSE41(&rgb[0], &rgb[2], &rgb[4], &U0, &V0); + + RGB32PackedToPlanar_SSE41(&argb[i + 16], rgb); + HorizontalAddPack_SSE41(&rgb[0], &rgb[1], &rgb[0]); + HorizontalAddPack_SSE41(&rgb[2], &rgb[3], &rgb[2]); + HorizontalAddPack_SSE41(&rgb[4], &rgb[5], &rgb[4]); + ConvertRGBToUV_SSE41(&rgb[0], &rgb[2], &rgb[4], &U1, &V1); + + U0 = _mm_packus_epi16(U0, U1); + V0 = _mm_packus_epi16(V0, V1); + if (!do_store) { + const __m128i prev_u = LOAD_16(u); + const __m128i prev_v = LOAD_16(v); + U0 = _mm_avg_epu8(U0, prev_u); + V0 = _mm_avg_epu8(V0, prev_v); + } + STORE_16(U0, u); + STORE_16(V0, v); + } + if (i < src_width) { // left-over + WebPConvertARGBToUV_C(argb + i, u, v, src_width - i, do_store); + } +} + +// Convert 16 packed ARGB 16b-values to r[], g[], b[] +static WEBP_INLINE void RGBA32PackedToPlanar_16b_SSE41( + const uint16_t* const rgbx, + __m128i* const r, __m128i* const g, __m128i* const b) { + const __m128i in0 = LOAD_16(rgbx + 0); // r0 | g0 | b0 |x| r1 | g1 | b1 |x + const __m128i in1 = LOAD_16(rgbx + 8); // r2 | g2 | b2 |x| r3 | g3 | b3 |x + const __m128i in2 = LOAD_16(rgbx + 16); // r4 | ... + const __m128i in3 = LOAD_16(rgbx + 24); // r6 | ... + // aarrggbb as 16-bit. + const __m128i shuff0 = + _mm_set_epi8(-1, -1, -1, -1, 13, 12, 5, 4, 11, 10, 3, 2, 9, 8, 1, 0); + const __m128i shuff1 = + _mm_set_epi8(13, 12, 5, 4, -1, -1, -1, -1, 11, 10, 3, 2, 9, 8, 1, 0); + const __m128i A0 = _mm_shuffle_epi8(in0, shuff0); + const __m128i A1 = _mm_shuffle_epi8(in1, shuff1); + const __m128i A2 = _mm_shuffle_epi8(in2, shuff0); + const __m128i A3 = _mm_shuffle_epi8(in3, shuff1); + // R0R1G0G1 + // B0B1**** + // R2R3G2G3 + // B2B3**** + // (OR is used to free port 5 for the unpack) + const __m128i B0 = _mm_unpacklo_epi32(A0, A1); + const __m128i B1 = _mm_or_si128(A0, A1); + const __m128i B2 = _mm_unpacklo_epi32(A2, A3); + const __m128i B3 = _mm_or_si128(A2, A3); + // Gather the channels. + *r = _mm_unpacklo_epi64(B0, B2); + *g = _mm_unpackhi_epi64(B0, B2); + *b = _mm_unpackhi_epi64(B1, B3); +} + +static void ConvertRGBA32ToUV_SSE41(const uint16_t* rgb, + uint8_t* u, uint8_t* v, int width) { + const int max_width = width & ~15; + const uint16_t* const last_rgb = rgb + 4 * max_width; + while (rgb < last_rgb) { + __m128i r, g, b, U0, V0, U1, V1; + RGBA32PackedToPlanar_16b_SSE41(rgb + 0, &r, &g, &b); + ConvertRGBToUV_SSE41(&r, &g, &b, &U0, &V0); + RGBA32PackedToPlanar_16b_SSE41(rgb + 32, &r, &g, &b); + ConvertRGBToUV_SSE41(&r, &g, &b, &U1, &V1); + STORE_16(_mm_packus_epi16(U0, U1), u); + STORE_16(_mm_packus_epi16(V0, V1), v); + u += 16; + v += 16; + rgb += 2 * 32; + } + if (max_width < width) { // left-over + WebPConvertRGBA32ToUV_C(rgb, u, v, width - max_width); + } +} + +//------------------------------------------------------------------------------ + +extern void WebPInitConvertARGBToYUVSSE41(void); + +WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUVSSE41(void) { + WebPConvertARGBToY = ConvertARGBToY_SSE41; + WebPConvertARGBToUV = ConvertARGBToUV_SSE41; + + WebPConvertRGB24ToY = ConvertRGB24ToY_SSE41; + WebPConvertBGR24ToY = ConvertBGR24ToY_SSE41; + + WebPConvertRGBA32ToUV = ConvertRGBA32ToUV_SSE41; +} + +//------------------------------------------------------------------------------ + +#else // !WEBP_USE_SSE41 + +WEBP_DSP_INIT_STUB(WebPInitSamplersSSE41) +WEBP_DSP_INIT_STUB(WebPInitConvertARGBToYUVSSE41) + +#endif // WEBP_USE_SSE41 diff --git a/Pods/libwebp/src/enc/Makefile.am b/Pods/libwebp/src/enc/Makefile.am new file mode 100644 index 0000000..27d5228 --- /dev/null +++ b/Pods/libwebp/src/enc/Makefile.am @@ -0,0 +1,42 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +noinst_LTLIBRARIES = libwebpencode.la + +libwebpencode_la_SOURCES = +libwebpencode_la_SOURCES += alpha_enc.c +libwebpencode_la_SOURCES += analysis_enc.c +libwebpencode_la_SOURCES += backward_references_cost_enc.c +libwebpencode_la_SOURCES += backward_references_enc.c +libwebpencode_la_SOURCES += backward_references_enc.h +libwebpencode_la_SOURCES += config_enc.c +libwebpencode_la_SOURCES += cost_enc.c +libwebpencode_la_SOURCES += cost_enc.h +libwebpencode_la_SOURCES += filter_enc.c +libwebpencode_la_SOURCES += frame_enc.c +libwebpencode_la_SOURCES += histogram_enc.c +libwebpencode_la_SOURCES += histogram_enc.h +libwebpencode_la_SOURCES += iterator_enc.c +libwebpencode_la_SOURCES += near_lossless_enc.c +libwebpencode_la_SOURCES += picture_enc.c +libwebpencode_la_SOURCES += picture_csp_enc.c +libwebpencode_la_SOURCES += picture_psnr_enc.c +libwebpencode_la_SOURCES += picture_rescale_enc.c +libwebpencode_la_SOURCES += picture_tools_enc.c +libwebpencode_la_SOURCES += predictor_enc.c +libwebpencode_la_SOURCES += quant_enc.c +libwebpencode_la_SOURCES += syntax_enc.c +libwebpencode_la_SOURCES += token_enc.c +libwebpencode_la_SOURCES += tree_enc.c +libwebpencode_la_SOURCES += vp8i_enc.h +libwebpencode_la_SOURCES += vp8l_enc.c +libwebpencode_la_SOURCES += vp8li_enc.h +libwebpencode_la_SOURCES += webp_enc.c + +libwebpencodeinclude_HEADERS = +libwebpencodeinclude_HEADERS += ../webp/encode.h +libwebpencodeinclude_HEADERS += ../webp/types.h +noinst_HEADERS = +noinst_HEADERS += ../webp/format_constants.h + +libwebpencode_la_LDFLAGS = -lm +libwebpencode_la_CPPFLAGS = $(AM_CPPFLAGS) +libwebpencodeincludedir = $(includedir)/webp diff --git a/Pods/libwebp/src/enc/alpha_enc.c b/Pods/libwebp/src/enc/alpha_enc.c index 5a2c931..dce9ca9 100644 --- a/Pods/libwebp/src/enc/alpha_enc.c +++ b/Pods/libwebp/src/enc/alpha_enc.c @@ -14,12 +14,12 @@ #include #include -#include "./vp8i_enc.h" -#include "../dsp/dsp.h" -#include "../utils/filters_utils.h" -#include "../utils/quant_levels_utils.h" -#include "../utils/utils.h" -#include "../webp/format_constants.h" +#include "src/enc/vp8i_enc.h" +#include "src/dsp/dsp.h" +#include "src/utils/filters_utils.h" +#include "src/utils/quant_levels_utils.h" +#include "src/utils/utils.h" +#include "src/webp/format_constants.h" // ----------------------------------------------------------------------------- // Encodes the given alpha data via specified compression method 'method'. @@ -44,11 +44,11 @@ // invalid quality or method, or // memory allocation for the compressed data fails. -#include "../enc/vp8li_enc.h" +#include "src/enc/vp8li_enc.h" static int EncodeLossless(const uint8_t* const data, int width, int height, int effort_level, // in [0..6] range - VP8LBitWriter* const bw, + int use_quality_100, VP8LBitWriter* const bw, WebPAuxStats* const stats) { int ok = 0; WebPConfig config; @@ -76,7 +76,10 @@ static int EncodeLossless(const uint8_t* const data, int width, int height, // Set a low default quality for encoding alpha. Ensure that Alpha quality at // lower methods (3 and below) is less than the threshold for triggering // costly 'BackwardReferencesTraceBackwards'. - config.quality = 8.f * effort_level; + // If the alpha quality is set to 100 and the method to 6, allow for a high + // lossless quality to trigger the cruncher. + config.quality = + (use_quality_100 && effort_level == 6) ? 100 : 8.f * effort_level; assert(config.quality >= 0 && config.quality <= 100.f); // TODO(urvang): Temporary fix to avoid generating images that trigger @@ -134,7 +137,7 @@ static int EncodeAlphaInternal(const uint8_t* const data, int width, int height, if (method != ALPHA_NO_COMPRESSION) { ok = VP8LBitWriterInit(&tmp_bw, data_size >> 3); ok = ok && EncodeLossless(alpha_src, width, height, effort_level, - &tmp_bw, &result->stats); + !reduce_levels, &tmp_bw, &result->stats); if (ok) { output = VP8LBitWriterFinish(&tmp_bw); output_size = VP8LBitWriterNumBytes(&tmp_bw); @@ -264,6 +267,7 @@ static int ApplyFiltersAndEncode(const uint8_t* alpha, int width, int height, reduce_levels, effort_level, NULL, &best); } if (ok) { +#if !defined(WEBP_DISABLE_STATS) if (stats != NULL) { stats->lossless_features = best.stats.lossless_features; stats->histogram_bits = best.stats.histogram_bits; @@ -274,6 +278,9 @@ static int ApplyFiltersAndEncode(const uint8_t* alpha, int width, int height, stats->lossless_hdr_size = best.stats.lossless_hdr_size; stats->lossless_data_size = best.stats.lossless_data_size; } +#else + (void)stats; +#endif *output_size = VP8BitWriterSize(&best.bw); *output = VP8BitWriterBuf(&best.bw); } else { @@ -339,10 +346,12 @@ static int EncodeAlpha(VP8Encoder* const enc, ok = ApplyFiltersAndEncode(quant_alpha, width, height, data_size, method, filter, reduce_levels, effort_level, output, output_size, pic->stats); +#if !defined(WEBP_DISABLE_STATS) if (pic->stats != NULL) { // need stats? pic->stats->coded_size += (int)(*output_size); enc->sse_[3] = sse; } +#endif } WebPSafeFree(quant_alpha); @@ -352,7 +361,8 @@ static int EncodeAlpha(VP8Encoder* const enc, //------------------------------------------------------------------------------ // Main calls -static int CompressAlphaJob(VP8Encoder* const enc, void* dummy) { +static int CompressAlphaJob(void* arg1, void* dummy) { + VP8Encoder* const enc = (VP8Encoder*)arg1; const WebPConfig* config = enc->config_; uint8_t* alpha_data = NULL; size_t alpha_size = 0; @@ -385,7 +395,7 @@ void VP8EncInitAlpha(VP8Encoder* const enc) { WebPGetWorkerInterface()->Init(worker); worker->data1 = enc; worker->data2 = NULL; - worker->hook = (WebPWorkerHook)CompressAlphaJob; + worker->hook = CompressAlphaJob; } } diff --git a/Pods/libwebp/src/enc/analysis_enc.c b/Pods/libwebp/src/enc/analysis_enc.c index dce159b..687757a 100644 --- a/Pods/libwebp/src/enc/analysis_enc.c +++ b/Pods/libwebp/src/enc/analysis_enc.c @@ -15,9 +15,9 @@ #include #include -#include "./vp8i_enc.h" -#include "./cost_enc.h" -#include "../utils/utils.h" +#include "src/enc/vp8i_enc.h" +#include "src/enc/cost_enc.h" +#include "src/utils/utils.h" #define MAX_ITERS_K_MEANS 6 @@ -434,7 +434,9 @@ typedef struct { } SegmentJob; // main work call -static int DoSegmentsJob(SegmentJob* const job, VP8EncIterator* const it) { +static int DoSegmentsJob(void* arg1, void* arg2) { + SegmentJob* const job = (SegmentJob*)arg1; + VP8EncIterator* const it = (VP8EncIterator*)arg2; int ok = 1; if (!VP8IteratorIsDone(it)) { uint8_t tmp[32 + WEBP_ALIGN_CST]; @@ -456,13 +458,13 @@ static void MergeJobs(const SegmentJob* const src, SegmentJob* const dst) { dst->uv_alpha += src->uv_alpha; } -// initialize the job struct with some TODOs +// initialize the job struct with some tasks to perform static void InitSegmentJob(VP8Encoder* const enc, SegmentJob* const job, int start_row, int end_row) { WebPGetWorkerInterface()->Init(&job->worker); job->worker.data1 = job; job->worker.data2 = &job->it; - job->worker.hook = (WebPWorkerHook)DoSegmentsJob; + job->worker.hook = DoSegmentsJob; VP8IteratorInit(enc, &job->it); VP8IteratorSetRow(&job->it, start_row); VP8IteratorSetCountDown(&job->it, (end_row - start_row) * enc->mb_w_); diff --git a/Pods/libwebp/src/enc/backward_references_cost_enc.c b/Pods/libwebp/src/enc/backward_references_cost_enc.c new file mode 100644 index 0000000..516abd7 --- /dev/null +++ b/Pods/libwebp/src/enc/backward_references_cost_enc.c @@ -0,0 +1,790 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Improves a given set of backward references by analyzing its bit cost. +// The algorithm is similar to the Zopfli compression algorithm but tailored to +// images. +// +// Author: Vincent Rabaud (vrabaud@google.com) +// + +#include + +#include "src/enc/backward_references_enc.h" +#include "src/enc/histogram_enc.h" +#include "src/dsp/lossless_common.h" +#include "src/utils/color_cache_utils.h" +#include "src/utils/utils.h" + +#define VALUES_IN_BYTE 256 + +extern void VP8LClearBackwardRefs(VP8LBackwardRefs* const refs); +extern int VP8LDistanceToPlaneCode(int xsize, int dist); +extern void VP8LBackwardRefsCursorAdd(VP8LBackwardRefs* const refs, + const PixOrCopy v); + +typedef struct { + double alpha_[VALUES_IN_BYTE]; + double red_[VALUES_IN_BYTE]; + double blue_[VALUES_IN_BYTE]; + double distance_[NUM_DISTANCE_CODES]; + double* literal_; +} CostModel; + +static void ConvertPopulationCountTableToBitEstimates( + int num_symbols, const uint32_t population_counts[], double output[]) { + uint32_t sum = 0; + int nonzeros = 0; + int i; + for (i = 0; i < num_symbols; ++i) { + sum += population_counts[i]; + if (population_counts[i] > 0) { + ++nonzeros; + } + } + if (nonzeros <= 1) { + memset(output, 0, num_symbols * sizeof(*output)); + } else { + const double logsum = VP8LFastLog2(sum); + for (i = 0; i < num_symbols; ++i) { + output[i] = logsum - VP8LFastLog2(population_counts[i]); + } + } +} + +static int CostModelBuild(CostModel* const m, int xsize, int cache_bits, + const VP8LBackwardRefs* const refs) { + int ok = 0; + VP8LRefsCursor c = VP8LRefsCursorInit(refs); + VP8LHistogram* const histo = VP8LAllocateHistogram(cache_bits); + if (histo == NULL) goto Error; + + // The following code is similar to VP8LHistogramCreate but converts the + // distance to plane code. + VP8LHistogramInit(histo, cache_bits, /*init_arrays=*/ 1); + while (VP8LRefsCursorOk(&c)) { + VP8LHistogramAddSinglePixOrCopy(histo, c.cur_pos, VP8LDistanceToPlaneCode, + xsize); + VP8LRefsCursorNext(&c); + } + + ConvertPopulationCountTableToBitEstimates( + VP8LHistogramNumCodes(histo->palette_code_bits_), + histo->literal_, m->literal_); + ConvertPopulationCountTableToBitEstimates( + VALUES_IN_BYTE, histo->red_, m->red_); + ConvertPopulationCountTableToBitEstimates( + VALUES_IN_BYTE, histo->blue_, m->blue_); + ConvertPopulationCountTableToBitEstimates( + VALUES_IN_BYTE, histo->alpha_, m->alpha_); + ConvertPopulationCountTableToBitEstimates( + NUM_DISTANCE_CODES, histo->distance_, m->distance_); + ok = 1; + + Error: + VP8LFreeHistogram(histo); + return ok; +} + +static WEBP_INLINE double GetLiteralCost(const CostModel* const m, uint32_t v) { + return m->alpha_[v >> 24] + + m->red_[(v >> 16) & 0xff] + + m->literal_[(v >> 8) & 0xff] + + m->blue_[v & 0xff]; +} + +static WEBP_INLINE double GetCacheCost(const CostModel* const m, uint32_t idx) { + const int literal_idx = VALUES_IN_BYTE + NUM_LENGTH_CODES + idx; + return m->literal_[literal_idx]; +} + +static WEBP_INLINE double GetLengthCost(const CostModel* const m, + uint32_t length) { + int code, extra_bits; + VP8LPrefixEncodeBits(length, &code, &extra_bits); + return m->literal_[VALUES_IN_BYTE + code] + extra_bits; +} + +static WEBP_INLINE double GetDistanceCost(const CostModel* const m, + uint32_t distance) { + int code, extra_bits; + VP8LPrefixEncodeBits(distance, &code, &extra_bits); + return m->distance_[code] + extra_bits; +} + +static WEBP_INLINE void AddSingleLiteralWithCostModel( + const uint32_t* const argb, VP8LColorCache* const hashers, + const CostModel* const cost_model, int idx, int use_color_cache, + float prev_cost, float* const cost, uint16_t* const dist_array) { + double cost_val = prev_cost; + const uint32_t color = argb[idx]; + const int ix = use_color_cache ? VP8LColorCacheContains(hashers, color) : -1; + if (ix >= 0) { + // use_color_cache is true and hashers contains color + const double mul0 = 0.68; + cost_val += GetCacheCost(cost_model, ix) * mul0; + } else { + const double mul1 = 0.82; + if (use_color_cache) VP8LColorCacheInsert(hashers, color); + cost_val += GetLiteralCost(cost_model, color) * mul1; + } + if (cost[idx] > cost_val) { + cost[idx] = (float)cost_val; + dist_array[idx] = 1; // only one is inserted. + } +} + +// ----------------------------------------------------------------------------- +// CostManager and interval handling + +// Empirical value to avoid high memory consumption but good for performance. +#define COST_CACHE_INTERVAL_SIZE_MAX 500 + +// To perform backward reference every pixel at index index_ is considered and +// the cost for the MAX_LENGTH following pixels computed. Those following pixels +// at index index_ + k (k from 0 to MAX_LENGTH) have a cost of: +// cost_ = distance cost at index + GetLengthCost(cost_model, k) +// and the minimum value is kept. GetLengthCost(cost_model, k) is cached in an +// array of size MAX_LENGTH. +// Instead of performing MAX_LENGTH comparisons per pixel, we keep track of the +// minimal values using intervals of constant cost. +// An interval is defined by the index_ of the pixel that generated it and +// is only useful in a range of indices from start_ to end_ (exclusive), i.e. +// it contains the minimum value for pixels between start_ and end_. +// Intervals are stored in a linked list and ordered by start_. When a new +// interval has a better value, old intervals are split or removed. There are +// therefore no overlapping intervals. +typedef struct CostInterval CostInterval; +struct CostInterval { + float cost_; + int start_; + int end_; + int index_; + CostInterval* previous_; + CostInterval* next_; +}; + +// The GetLengthCost(cost_model, k) are cached in a CostCacheInterval. +typedef struct { + double cost_; + int start_; + int end_; // Exclusive. +} CostCacheInterval; + +// This structure is in charge of managing intervals and costs. +// It caches the different CostCacheInterval, caches the different +// GetLengthCost(cost_model, k) in cost_cache_ and the CostInterval's (whose +// count_ is limited by COST_CACHE_INTERVAL_SIZE_MAX). +#define COST_MANAGER_MAX_FREE_LIST 10 +typedef struct { + CostInterval* head_; + int count_; // The number of stored intervals. + CostCacheInterval* cache_intervals_; + size_t cache_intervals_size_; + double cost_cache_[MAX_LENGTH]; // Contains the GetLengthCost(cost_model, k). + float* costs_; + uint16_t* dist_array_; + // Most of the time, we only need few intervals -> use a free-list, to avoid + // fragmentation with small allocs in most common cases. + CostInterval intervals_[COST_MANAGER_MAX_FREE_LIST]; + CostInterval* free_intervals_; + // These are regularly malloc'd remains. This list can't grow larger than than + // size COST_CACHE_INTERVAL_SIZE_MAX - COST_MANAGER_MAX_FREE_LIST, note. + CostInterval* recycled_intervals_; +} CostManager; + +static void CostIntervalAddToFreeList(CostManager* const manager, + CostInterval* const interval) { + interval->next_ = manager->free_intervals_; + manager->free_intervals_ = interval; +} + +static int CostIntervalIsInFreeList(const CostManager* const manager, + const CostInterval* const interval) { + return (interval >= &manager->intervals_[0] && + interval <= &manager->intervals_[COST_MANAGER_MAX_FREE_LIST - 1]); +} + +static void CostManagerInitFreeList(CostManager* const manager) { + int i; + manager->free_intervals_ = NULL; + for (i = 0; i < COST_MANAGER_MAX_FREE_LIST; ++i) { + CostIntervalAddToFreeList(manager, &manager->intervals_[i]); + } +} + +static void DeleteIntervalList(CostManager* const manager, + const CostInterval* interval) { + while (interval != NULL) { + const CostInterval* const next = interval->next_; + if (!CostIntervalIsInFreeList(manager, interval)) { + WebPSafeFree((void*)interval); + } // else: do nothing + interval = next; + } +} + +static void CostManagerClear(CostManager* const manager) { + if (manager == NULL) return; + + WebPSafeFree(manager->costs_); + WebPSafeFree(manager->cache_intervals_); + + // Clear the interval lists. + DeleteIntervalList(manager, manager->head_); + manager->head_ = NULL; + DeleteIntervalList(manager, manager->recycled_intervals_); + manager->recycled_intervals_ = NULL; + + // Reset pointers, count_ and cache_intervals_size_. + memset(manager, 0, sizeof(*manager)); + CostManagerInitFreeList(manager); +} + +static int CostManagerInit(CostManager* const manager, + uint16_t* const dist_array, int pix_count, + const CostModel* const cost_model) { + int i; + const int cost_cache_size = (pix_count > MAX_LENGTH) ? MAX_LENGTH : pix_count; + + manager->costs_ = NULL; + manager->cache_intervals_ = NULL; + manager->head_ = NULL; + manager->recycled_intervals_ = NULL; + manager->count_ = 0; + manager->dist_array_ = dist_array; + CostManagerInitFreeList(manager); + + // Fill in the cost_cache_. + manager->cache_intervals_size_ = 1; + manager->cost_cache_[0] = GetLengthCost(cost_model, 0); + for (i = 1; i < cost_cache_size; ++i) { + manager->cost_cache_[i] = GetLengthCost(cost_model, i); + // Get the number of bound intervals. + if (manager->cost_cache_[i] != manager->cost_cache_[i - 1]) { + ++manager->cache_intervals_size_; + } + } + + // With the current cost model, we usually have below 20 intervals. + // The worst case scenario with a cost model would be if every length has a + // different cost, hence MAX_LENGTH but that is impossible with the current + // implementation that spirals around a pixel. + assert(manager->cache_intervals_size_ <= MAX_LENGTH); + manager->cache_intervals_ = (CostCacheInterval*)WebPSafeMalloc( + manager->cache_intervals_size_, sizeof(*manager->cache_intervals_)); + if (manager->cache_intervals_ == NULL) { + CostManagerClear(manager); + return 0; + } + + // Fill in the cache_intervals_. + { + CostCacheInterval* cur = manager->cache_intervals_; + + // Consecutive values in cost_cache_ are compared and if a big enough + // difference is found, a new interval is created and bounded. + cur->start_ = 0; + cur->end_ = 1; + cur->cost_ = manager->cost_cache_[0]; + for (i = 1; i < cost_cache_size; ++i) { + const double cost_val = manager->cost_cache_[i]; + if (cost_val != cur->cost_) { + ++cur; + // Initialize an interval. + cur->start_ = i; + cur->cost_ = cost_val; + } + cur->end_ = i + 1; + } + } + + manager->costs_ = (float*)WebPSafeMalloc(pix_count, sizeof(*manager->costs_)); + if (manager->costs_ == NULL) { + CostManagerClear(manager); + return 0; + } + // Set the initial costs_ high for every pixel as we will keep the minimum. + for (i = 0; i < pix_count; ++i) manager->costs_[i] = 1e38f; + + return 1; +} + +// Given the cost and the position that define an interval, update the cost at +// pixel 'i' if it is smaller than the previously computed value. +static WEBP_INLINE void UpdateCost(CostManager* const manager, int i, + int position, float cost) { + const int k = i - position; + assert(k >= 0 && k < MAX_LENGTH); + + if (manager->costs_[i] > cost) { + manager->costs_[i] = cost; + manager->dist_array_[i] = k + 1; + } +} + +// Given the cost and the position that define an interval, update the cost for +// all the pixels between 'start' and 'end' excluded. +static WEBP_INLINE void UpdateCostPerInterval(CostManager* const manager, + int start, int end, int position, + float cost) { + int i; + for (i = start; i < end; ++i) UpdateCost(manager, i, position, cost); +} + +// Given two intervals, make 'prev' be the previous one of 'next' in 'manager'. +static WEBP_INLINE void ConnectIntervals(CostManager* const manager, + CostInterval* const prev, + CostInterval* const next) { + if (prev != NULL) { + prev->next_ = next; + } else { + manager->head_ = next; + } + + if (next != NULL) next->previous_ = prev; +} + +// Pop an interval in the manager. +static WEBP_INLINE void PopInterval(CostManager* const manager, + CostInterval* const interval) { + if (interval == NULL) return; + + ConnectIntervals(manager, interval->previous_, interval->next_); + if (CostIntervalIsInFreeList(manager, interval)) { + CostIntervalAddToFreeList(manager, interval); + } else { // recycle regularly malloc'd intervals too + interval->next_ = manager->recycled_intervals_; + manager->recycled_intervals_ = interval; + } + --manager->count_; + assert(manager->count_ >= 0); +} + +// Update the cost at index i by going over all the stored intervals that +// overlap with i. +// If 'do_clean_intervals' is set to something different than 0, intervals that +// end before 'i' will be popped. +static WEBP_INLINE void UpdateCostAtIndex(CostManager* const manager, int i, + int do_clean_intervals) { + CostInterval* current = manager->head_; + + while (current != NULL && current->start_ <= i) { + CostInterval* const next = current->next_; + if (current->end_ <= i) { + if (do_clean_intervals) { + // We have an outdated interval, remove it. + PopInterval(manager, current); + } + } else { + UpdateCost(manager, i, current->index_, current->cost_); + } + current = next; + } +} + +// Given a current orphan interval and its previous interval, before +// it was orphaned (which can be NULL), set it at the right place in the list +// of intervals using the start_ ordering and the previous interval as a hint. +static WEBP_INLINE void PositionOrphanInterval(CostManager* const manager, + CostInterval* const current, + CostInterval* previous) { + assert(current != NULL); + + if (previous == NULL) previous = manager->head_; + while (previous != NULL && current->start_ < previous->start_) { + previous = previous->previous_; + } + while (previous != NULL && previous->next_ != NULL && + previous->next_->start_ < current->start_) { + previous = previous->next_; + } + + if (previous != NULL) { + ConnectIntervals(manager, current, previous->next_); + } else { + ConnectIntervals(manager, current, manager->head_); + } + ConnectIntervals(manager, previous, current); +} + +// Insert an interval in the list contained in the manager by starting at +// interval_in as a hint. The intervals are sorted by start_ value. +static WEBP_INLINE void InsertInterval(CostManager* const manager, + CostInterval* const interval_in, + float cost, int position, int start, + int end) { + CostInterval* interval_new; + + if (start >= end) return; + if (manager->count_ >= COST_CACHE_INTERVAL_SIZE_MAX) { + // Serialize the interval if we cannot store it. + UpdateCostPerInterval(manager, start, end, position, cost); + return; + } + if (manager->free_intervals_ != NULL) { + interval_new = manager->free_intervals_; + manager->free_intervals_ = interval_new->next_; + } else if (manager->recycled_intervals_ != NULL) { + interval_new = manager->recycled_intervals_; + manager->recycled_intervals_ = interval_new->next_; + } else { // malloc for good + interval_new = (CostInterval*)WebPSafeMalloc(1, sizeof(*interval_new)); + if (interval_new == NULL) { + // Write down the interval if we cannot create it. + UpdateCostPerInterval(manager, start, end, position, cost); + return; + } + } + + interval_new->cost_ = cost; + interval_new->index_ = position; + interval_new->start_ = start; + interval_new->end_ = end; + PositionOrphanInterval(manager, interval_new, interval_in); + + ++manager->count_; +} + +// Given a new cost interval defined by its start at position, its length value +// and distance_cost, add its contributions to the previous intervals and costs. +// If handling the interval or one of its subintervals becomes to heavy, its +// contribution is added to the costs right away. +static WEBP_INLINE void PushInterval(CostManager* const manager, + double distance_cost, int position, + int len) { + size_t i; + CostInterval* interval = manager->head_; + CostInterval* interval_next; + const CostCacheInterval* const cost_cache_intervals = + manager->cache_intervals_; + // If the interval is small enough, no need to deal with the heavy + // interval logic, just serialize it right away. This constant is empirical. + const int kSkipDistance = 10; + + if (len < kSkipDistance) { + int j; + for (j = position; j < position + len; ++j) { + const int k = j - position; + float cost_tmp; + assert(k >= 0 && k < MAX_LENGTH); + cost_tmp = (float)(distance_cost + manager->cost_cache_[k]); + + if (manager->costs_[j] > cost_tmp) { + manager->costs_[j] = cost_tmp; + manager->dist_array_[j] = k + 1; + } + } + return; + } + + for (i = 0; i < manager->cache_intervals_size_ && + cost_cache_intervals[i].start_ < len; + ++i) { + // Define the intersection of the ith interval with the new one. + int start = position + cost_cache_intervals[i].start_; + const int end = position + (cost_cache_intervals[i].end_ > len + ? len + : cost_cache_intervals[i].end_); + const float cost = (float)(distance_cost + cost_cache_intervals[i].cost_); + + for (; interval != NULL && interval->start_ < end; + interval = interval_next) { + interval_next = interval->next_; + + // Make sure we have some overlap + if (start >= interval->end_) continue; + + if (cost >= interval->cost_) { + // When intervals are represented, the lower, the better. + // [**********************************************************[ + // start end + // [----------------------------------[ + // interval->start_ interval->end_ + // If we are worse than what we already have, add whatever we have so + // far up to interval. + const int start_new = interval->end_; + InsertInterval(manager, interval, cost, position, start, + interval->start_); + start = start_new; + if (start >= end) break; + continue; + } + + if (start <= interval->start_) { + if (interval->end_ <= end) { + // [----------------------------------[ + // interval->start_ interval->end_ + // [**************************************************************[ + // start end + // We can safely remove the old interval as it is fully included. + PopInterval(manager, interval); + } else { + // [------------------------------------[ + // interval->start_ interval->end_ + // [*****************************[ + // start end + interval->start_ = end; + break; + } + } else { + if (end < interval->end_) { + // [--------------------------------------------------------------[ + // interval->start_ interval->end_ + // [*****************************[ + // start end + // We have to split the old interval as it fully contains the new one. + const int end_original = interval->end_; + interval->end_ = start; + InsertInterval(manager, interval, interval->cost_, interval->index_, + end, end_original); + interval = interval->next_; + break; + } else { + // [------------------------------------[ + // interval->start_ interval->end_ + // [*****************************[ + // start end + interval->end_ = start; + } + } + } + // Insert the remaining interval from start to end. + InsertInterval(manager, interval, cost, position, start, end); + } +} + +static int BackwardReferencesHashChainDistanceOnly( + int xsize, int ysize, const uint32_t* const argb, int cache_bits, + const VP8LHashChain* const hash_chain, const VP8LBackwardRefs* const refs, + uint16_t* const dist_array) { + int i; + int ok = 0; + int cc_init = 0; + const int pix_count = xsize * ysize; + const int use_color_cache = (cache_bits > 0); + const size_t literal_array_size = + sizeof(double) * (NUM_LITERAL_CODES + NUM_LENGTH_CODES + + ((cache_bits > 0) ? (1 << cache_bits) : 0)); + const size_t cost_model_size = sizeof(CostModel) + literal_array_size; + CostModel* const cost_model = + (CostModel*)WebPSafeCalloc(1ULL, cost_model_size); + VP8LColorCache hashers; + CostManager* cost_manager = + (CostManager*)WebPSafeMalloc(1ULL, sizeof(*cost_manager)); + int offset_prev = -1, len_prev = -1; + double offset_cost = -1; + int first_offset_is_constant = -1; // initialized with 'impossible' value + int reach = 0; + + if (cost_model == NULL || cost_manager == NULL) goto Error; + + cost_model->literal_ = (double*)(cost_model + 1); + if (use_color_cache) { + cc_init = VP8LColorCacheInit(&hashers, cache_bits); + if (!cc_init) goto Error; + } + + if (!CostModelBuild(cost_model, xsize, cache_bits, refs)) { + goto Error; + } + + if (!CostManagerInit(cost_manager, dist_array, pix_count, cost_model)) { + goto Error; + } + + // We loop one pixel at a time, but store all currently best points to + // non-processed locations from this point. + dist_array[0] = 0; + // Add first pixel as literal. + AddSingleLiteralWithCostModel(argb, &hashers, cost_model, 0, use_color_cache, + 0.f, cost_manager->costs_, dist_array); + + for (i = 1; i < pix_count; ++i) { + const float prev_cost = cost_manager->costs_[i - 1]; + int offset, len; + VP8LHashChainFindCopy(hash_chain, i, &offset, &len); + + // Try adding the pixel as a literal. + AddSingleLiteralWithCostModel(argb, &hashers, cost_model, i, + use_color_cache, prev_cost, + cost_manager->costs_, dist_array); + + // If we are dealing with a non-literal. + if (len >= 2) { + if (offset != offset_prev) { + const int code = VP8LDistanceToPlaneCode(xsize, offset); + offset_cost = GetDistanceCost(cost_model, code); + first_offset_is_constant = 1; + PushInterval(cost_manager, prev_cost + offset_cost, i, len); + } else { + assert(offset_cost >= 0); + assert(len_prev >= 0); + assert(first_offset_is_constant == 0 || first_offset_is_constant == 1); + // Instead of considering all contributions from a pixel i by calling: + // PushInterval(cost_manager, prev_cost + offset_cost, i, len); + // we optimize these contributions in case offset_cost stays the same + // for consecutive pixels. This describes a set of pixels similar to a + // previous set (e.g. constant color regions). + if (first_offset_is_constant) { + reach = i - 1 + len_prev - 1; + first_offset_is_constant = 0; + } + + if (i + len - 1 > reach) { + // We can only be go further with the same offset if the previous + // length was maxed, hence len_prev == len == MAX_LENGTH. + // TODO(vrabaud), bump i to the end right away (insert cache and + // update cost). + // TODO(vrabaud), check if one of the points in between does not have + // a lower cost. + // Already consider the pixel at "reach" to add intervals that are + // better than whatever we add. + int offset_j, len_j = 0; + int j; + assert(len == MAX_LENGTH || len == pix_count - i); + // Figure out the last consecutive pixel within [i, reach + 1] with + // the same offset. + for (j = i; j <= reach; ++j) { + VP8LHashChainFindCopy(hash_chain, j + 1, &offset_j, &len_j); + if (offset_j != offset) { + VP8LHashChainFindCopy(hash_chain, j, &offset_j, &len_j); + break; + } + } + // Update the cost at j - 1 and j. + UpdateCostAtIndex(cost_manager, j - 1, 0); + UpdateCostAtIndex(cost_manager, j, 0); + + PushInterval(cost_manager, cost_manager->costs_[j - 1] + offset_cost, + j, len_j); + reach = j + len_j - 1; + } + } + } + + UpdateCostAtIndex(cost_manager, i, 1); + offset_prev = offset; + len_prev = len; + } + + ok = !refs->error_; +Error: + if (cc_init) VP8LColorCacheClear(&hashers); + CostManagerClear(cost_manager); + WebPSafeFree(cost_model); + WebPSafeFree(cost_manager); + return ok; +} + +// We pack the path at the end of *dist_array and return +// a pointer to this part of the array. Example: +// dist_array = [1x2xx3x2] => packed [1x2x1232], chosen_path = [1232] +static void TraceBackwards(uint16_t* const dist_array, + int dist_array_size, + uint16_t** const chosen_path, + int* const chosen_path_size) { + uint16_t* path = dist_array + dist_array_size; + uint16_t* cur = dist_array + dist_array_size - 1; + while (cur >= dist_array) { + const int k = *cur; + --path; + *path = k; + cur -= k; + } + *chosen_path = path; + *chosen_path_size = (int)(dist_array + dist_array_size - path); +} + +static int BackwardReferencesHashChainFollowChosenPath( + const uint32_t* const argb, int cache_bits, + const uint16_t* const chosen_path, int chosen_path_size, + const VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs) { + const int use_color_cache = (cache_bits > 0); + int ix; + int i = 0; + int ok = 0; + int cc_init = 0; + VP8LColorCache hashers; + + if (use_color_cache) { + cc_init = VP8LColorCacheInit(&hashers, cache_bits); + if (!cc_init) goto Error; + } + + VP8LClearBackwardRefs(refs); + for (ix = 0; ix < chosen_path_size; ++ix) { + const int len = chosen_path[ix]; + if (len != 1) { + int k; + const int offset = VP8LHashChainFindOffset(hash_chain, i); + VP8LBackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(offset, len)); + if (use_color_cache) { + for (k = 0; k < len; ++k) { + VP8LColorCacheInsert(&hashers, argb[i + k]); + } + } + i += len; + } else { + PixOrCopy v; + const int idx = + use_color_cache ? VP8LColorCacheContains(&hashers, argb[i]) : -1; + if (idx >= 0) { + // use_color_cache is true and hashers contains argb[i] + // push pixel as a color cache index + v = PixOrCopyCreateCacheIdx(idx); + } else { + if (use_color_cache) VP8LColorCacheInsert(&hashers, argb[i]); + v = PixOrCopyCreateLiteral(argb[i]); + } + VP8LBackwardRefsCursorAdd(refs, v); + ++i; + } + } + ok = !refs->error_; + Error: + if (cc_init) VP8LColorCacheClear(&hashers); + return ok; +} + +// Returns 1 on success. +extern int VP8LBackwardReferencesTraceBackwards( + int xsize, int ysize, const uint32_t* const argb, int cache_bits, + const VP8LHashChain* const hash_chain, + const VP8LBackwardRefs* const refs_src, VP8LBackwardRefs* const refs_dst); +int VP8LBackwardReferencesTraceBackwards(int xsize, int ysize, + const uint32_t* const argb, + int cache_bits, + const VP8LHashChain* const hash_chain, + const VP8LBackwardRefs* const refs_src, + VP8LBackwardRefs* const refs_dst) { + int ok = 0; + const int dist_array_size = xsize * ysize; + uint16_t* chosen_path = NULL; + int chosen_path_size = 0; + uint16_t* dist_array = + (uint16_t*)WebPSafeMalloc(dist_array_size, sizeof(*dist_array)); + + if (dist_array == NULL) goto Error; + + if (!BackwardReferencesHashChainDistanceOnly( + xsize, ysize, argb, cache_bits, hash_chain, refs_src, dist_array)) { + goto Error; + } + TraceBackwards(dist_array, dist_array_size, &chosen_path, &chosen_path_size); + if (!BackwardReferencesHashChainFollowChosenPath( + argb, cache_bits, chosen_path, chosen_path_size, hash_chain, + refs_dst)) { + goto Error; + } + ok = 1; + Error: + WebPSafeFree(dist_array); + return ok; +} diff --git a/Pods/libwebp/src/enc/backward_references_enc.c b/Pods/libwebp/src/enc/backward_references_enc.c index 7c0559f..d445b40 100644 --- a/Pods/libwebp/src/enc/backward_references_enc.c +++ b/Pods/libwebp/src/enc/backward_references_enc.c @@ -13,35 +13,24 @@ #include #include -#include "./backward_references_enc.h" -#include "./histogram_enc.h" -#include "../dsp/lossless.h" -#include "../dsp/lossless_common.h" -#include "../dsp/dsp.h" -#include "../utils/color_cache_utils.h" -#include "../utils/utils.h" - -#define VALUES_IN_BYTE 256 +#include "src/enc/backward_references_enc.h" +#include "src/enc/histogram_enc.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" +#include "src/dsp/dsp.h" +#include "src/utils/color_cache_utils.h" +#include "src/utils/utils.h" #define MIN_BLOCK_SIZE 256 // minimum block size for backward references #define MAX_ENTROPY (1e30f) // 1M window (4M bytes) minus 120 special codes for short distances. -#define WINDOW_SIZE_BITS 20 #define WINDOW_SIZE ((1 << WINDOW_SIZE_BITS) - 120) // Minimum number of pixels for which it is cheaper to encode a // distance + length instead of each pixel as a literal. #define MIN_LENGTH 4 -// If you change this, you need MAX_LENGTH_BITS + WINDOW_SIZE_BITS <= 32 as it -// is used in VP8LHashChain. -#define MAX_LENGTH_BITS 12 -// We want the max value to be attainable and stored in MAX_LENGTH_BITS bits. -#define MAX_LENGTH ((1 << MAX_LENGTH_BITS) - 1) -#if MAX_LENGTH_BITS + WINDOW_SIZE_BITS > 32 -#error "MAX_LENGTH_BITS + WINDOW_SIZE_BITS > 32" -#endif // ----------------------------------------------------------------------------- @@ -56,7 +45,8 @@ static const uint8_t plane_to_code_lut[128] = { 119, 116, 111, 106, 97, 88, 84, 74, 72, 75, 85, 89, 98, 107, 112, 117 }; -static int DistanceToPlaneCode(int xsize, int dist) { +extern int VP8LDistanceToPlaneCode(int xsize, int dist); +int VP8LDistanceToPlaneCode(int xsize, int dist) { const int yoffset = dist / xsize; const int xoffset = dist - yoffset * xsize; if (xoffset <= 8 && yoffset < 8) { @@ -91,7 +81,8 @@ struct PixOrCopyBlock { int size_; // currently used size }; -static void ClearBackwardRefs(VP8LBackwardRefs* const refs) { +extern void VP8LClearBackwardRefs(VP8LBackwardRefs* const refs); +void VP8LClearBackwardRefs(VP8LBackwardRefs* const refs) { assert(refs != NULL); if (refs->tail_ != NULL) { *refs->tail_ = refs->free_blocks_; // recycle all blocks at once @@ -104,7 +95,7 @@ static void ClearBackwardRefs(VP8LBackwardRefs* const refs) { void VP8LBackwardRefsClear(VP8LBackwardRefs* const refs) { assert(refs != NULL); - ClearBackwardRefs(refs); + VP8LClearBackwardRefs(refs); while (refs->free_blocks_ != NULL) { PixOrCopyBlock* const next = refs->free_blocks_->next_; WebPSafeFree(refs->free_blocks_); @@ -163,8 +154,10 @@ static PixOrCopyBlock* BackwardRefsNewBlock(VP8LBackwardRefs* const refs) { return b; } -static WEBP_INLINE void BackwardRefsCursorAdd(VP8LBackwardRefs* const refs, - const PixOrCopy v) { +extern void VP8LBackwardRefsCursorAdd(VP8LBackwardRefs* const refs, + const PixOrCopy v); +void VP8LBackwardRefsCursorAdd(VP8LBackwardRefs* const refs, + const PixOrCopy v) { PixOrCopyBlock* b = refs->last_block_; if (b == NULL || b->size_ == refs->block_size_) { b = BackwardRefsNewBlock(refs); @@ -173,21 +166,6 @@ static WEBP_INLINE void BackwardRefsCursorAdd(VP8LBackwardRefs* const refs, b->start_[b->size_++] = v; } -int VP8LBackwardRefsCopy(const VP8LBackwardRefs* const src, - VP8LBackwardRefs* const dst) { - const PixOrCopyBlock* b = src->refs_; - ClearBackwardRefs(dst); - assert(src->block_size_ == dst->block_size_); - while (b != NULL) { - PixOrCopyBlock* const new_b = BackwardRefsNewBlock(dst); - if (new_b == NULL) return 0; // dst->error_ is set - memcpy(new_b->start_, b->start_, b->size_ * sizeof(*b->start_)); - new_b->size_ = b->size_; - b = b->next_; - } - return 1; -} - // ----------------------------------------------------------------------------- // Hash chains @@ -213,13 +191,14 @@ void VP8LHashChainClear(VP8LHashChain* const p) { // ----------------------------------------------------------------------------- -#define HASH_MULTIPLIER_HI (0xc6a4a793ULL) -#define HASH_MULTIPLIER_LO (0x5bd1e996ULL) +static const uint32_t kHashMultiplierHi = 0xc6a4a793u; +static const uint32_t kHashMultiplierLo = 0x5bd1e996u; -static WEBP_INLINE uint32_t GetPixPairHash64(const uint32_t* const argb) { +static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE +uint32_t GetPixPairHash64(const uint32_t* const argb) { uint32_t key; - key = (argb[1] * HASH_MULTIPLIER_HI) & 0xffffffffu; - key += (argb[0] * HASH_MULTIPLIER_LO) & 0xffffffffu; + key = argb[1] * kHashMultiplierHi; + key += argb[0] * kHashMultiplierLo; key = key >> (32 - HASH_BITS); return key; } @@ -411,24 +390,6 @@ int VP8LHashChainFill(VP8LHashChain* const p, int quality, return 1; } -static WEBP_INLINE int HashChainFindOffset(const VP8LHashChain* const p, - const int base_position) { - return p->offset_length_[base_position] >> MAX_LENGTH_BITS; -} - -static WEBP_INLINE int HashChainFindLength(const VP8LHashChain* const p, - const int base_position) { - return p->offset_length_[base_position] & ((1U << MAX_LENGTH_BITS) - 1); -} - -static WEBP_INLINE void HashChainFindCopy(const VP8LHashChain* const p, - int base_position, - int* const offset_ptr, - int* const length_ptr) { - *offset_ptr = HashChainFindOffset(p, base_position); - *length_ptr = HashChainFindLength(p, base_position); -} - static WEBP_INLINE void AddSingleLiteral(uint32_t pixel, int use_color_cache, VP8LColorCache* const hashers, VP8LBackwardRefs* const refs) { @@ -444,7 +405,7 @@ static WEBP_INLINE void AddSingleLiteral(uint32_t pixel, int use_color_cache, } else { v = PixOrCopyCreateLiteral(pixel); } - BackwardRefsCursorAdd(refs, v); + VP8LBackwardRefsCursorAdd(refs, v); } static int BackwardReferencesRle(int xsize, int ysize, @@ -458,7 +419,7 @@ static int BackwardReferencesRle(int xsize, int ysize, if (use_color_cache && !VP8LColorCacheInit(&hashers, cache_bits)) { return 0; } - ClearBackwardRefs(refs); + VP8LClearBackwardRefs(refs); // Add first pixel as literal. AddSingleLiteral(argb[0], use_color_cache, &hashers, refs); i = 1; @@ -468,13 +429,13 @@ static int BackwardReferencesRle(int xsize, int ysize, const int prev_row_len = (i < xsize) ? 0 : FindMatchLength(argb + i, argb + i - xsize, 0, max_len); if (rle_len >= prev_row_len && rle_len >= MIN_LENGTH) { - BackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(1, rle_len)); + VP8LBackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(1, rle_len)); // We don't need to update the color cache here since it is always the // same pixel being copied, and that does not change the color cache // state. i += rle_len; } else if (prev_row_len >= MIN_LENGTH) { - BackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(xsize, prev_row_len)); + VP8LBackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(xsize, prev_row_len)); if (use_color_cache) { for (k = 0; k < prev_row_len; ++k) { VP8LColorCacheInsert(&hashers, argb[i + k]); @@ -506,17 +467,18 @@ static int BackwardReferencesLz77(int xsize, int ysize, cc_init = VP8LColorCacheInit(&hashers, cache_bits); if (!cc_init) goto Error; } - ClearBackwardRefs(refs); + VP8LClearBackwardRefs(refs); for (i = 0; i < pix_count;) { // Alternative#1: Code the pixels starting at 'i' using backward reference. int offset = 0; int len = 0; int j; - HashChainFindCopy(hash_chain, i, &offset, &len); + VP8LHashChainFindCopy(hash_chain, i, &offset, &len); if (len >= MIN_LENGTH) { const int len_ini = len; int max_reach = 0; - assert(i + len < pix_count); + const int j_max = + (i + len_ini >= pix_count) ? pix_count - 1 : i + len_ini; // Only start from what we have not checked already. i_last_check = (i > i_last_check) ? i : i_last_check; // We know the best match for the current pixel but we try to find the @@ -525,13 +487,14 @@ static int BackwardReferencesLz77(int xsize, int ysize, // [i,i+len) + [i+len, length of best match at i+len) // while we check if we can use: // [i,j) (where j<=i+len) + [j, length of best match at j) - for (j = i_last_check + 1; j <= i + len_ini; ++j) { - const int len_j = HashChainFindLength(hash_chain, j); + for (j = i_last_check + 1; j <= j_max; ++j) { + const int len_j = VP8LHashChainFindLength(hash_chain, j); const int reach = j + (len_j >= MIN_LENGTH ? len_j : 1); // 1 for single literal. if (reach > max_reach) { len = j - i; max_reach = reach; + if (max_reach >= pix_count) break; } } } else { @@ -542,7 +505,7 @@ static int BackwardReferencesLz77(int xsize, int ysize, if (len == 1) { AddSingleLiteral(argb[i], use_color_cache, &hashers, refs); } else { - BackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(offset, len)); + VP8LBackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(offset, len)); if (use_color_cache) { for (j = i; j < i + len; ++j) VP8LColorCacheInsert(&hashers, argb[j]); } @@ -556,1051 +519,268 @@ static int BackwardReferencesLz77(int xsize, int ysize, return ok; } -// ----------------------------------------------------------------------------- - -typedef struct { - double alpha_[VALUES_IN_BYTE]; - double red_[VALUES_IN_BYTE]; - double blue_[VALUES_IN_BYTE]; - double distance_[NUM_DISTANCE_CODES]; - double* literal_; -} CostModel; - -static int BackwardReferencesTraceBackwards( - int xsize, int ysize, const uint32_t* const argb, int quality, - int cache_bits, const VP8LHashChain* const hash_chain, - VP8LBackwardRefs* const refs); - -static void ConvertPopulationCountTableToBitEstimates( - int num_symbols, const uint32_t population_counts[], double output[]) { - uint32_t sum = 0; - int nonzeros = 0; - int i; - for (i = 0; i < num_symbols; ++i) { - sum += population_counts[i]; - if (population_counts[i] > 0) { - ++nonzeros; - } - } - if (nonzeros <= 1) { - memset(output, 0, num_symbols * sizeof(*output)); - } else { - const double logsum = VP8LFastLog2(sum); - for (i = 0; i < num_symbols; ++i) { - output[i] = logsum - VP8LFastLog2(population_counts[i]); - } - } -} - -static int CostModelBuild(CostModel* const m, int cache_bits, - VP8LBackwardRefs* const refs) { - int ok = 0; - VP8LHistogram* const histo = VP8LAllocateHistogram(cache_bits); - if (histo == NULL) goto Error; - - VP8LHistogramCreate(histo, refs, cache_bits); - - ConvertPopulationCountTableToBitEstimates( - VP8LHistogramNumCodes(histo->palette_code_bits_), - histo->literal_, m->literal_); - ConvertPopulationCountTableToBitEstimates( - VALUES_IN_BYTE, histo->red_, m->red_); - ConvertPopulationCountTableToBitEstimates( - VALUES_IN_BYTE, histo->blue_, m->blue_); - ConvertPopulationCountTableToBitEstimates( - VALUES_IN_BYTE, histo->alpha_, m->alpha_); - ConvertPopulationCountTableToBitEstimates( - NUM_DISTANCE_CODES, histo->distance_, m->distance_); - ok = 1; - - Error: - VP8LFreeHistogram(histo); - return ok; -} - -static WEBP_INLINE double GetLiteralCost(const CostModel* const m, uint32_t v) { - return m->alpha_[v >> 24] + - m->red_[(v >> 16) & 0xff] + - m->literal_[(v >> 8) & 0xff] + - m->blue_[v & 0xff]; -} - -static WEBP_INLINE double GetCacheCost(const CostModel* const m, uint32_t idx) { - const int literal_idx = VALUES_IN_BYTE + NUM_LENGTH_CODES + idx; - return m->literal_[literal_idx]; -} - -static WEBP_INLINE double GetLengthCost(const CostModel* const m, - uint32_t length) { - int code, extra_bits; - VP8LPrefixEncodeBits(length, &code, &extra_bits); - return m->literal_[VALUES_IN_BYTE + code] + extra_bits; -} - -static WEBP_INLINE double GetDistanceCost(const CostModel* const m, - uint32_t distance) { - int code, extra_bits; - VP8LPrefixEncodeBits(distance, &code, &extra_bits); - return m->distance_[code] + extra_bits; -} - -static void AddSingleLiteralWithCostModel(const uint32_t* const argb, - VP8LColorCache* const hashers, - const CostModel* const cost_model, - int idx, int use_color_cache, - double prev_cost, float* const cost, - uint16_t* const dist_array) { - double cost_val = prev_cost; - const uint32_t color = argb[0]; - const int ix = use_color_cache ? VP8LColorCacheContains(hashers, color) : -1; - if (ix >= 0) { - // use_color_cache is true and hashers contains color - const double mul0 = 0.68; - cost_val += GetCacheCost(cost_model, ix) * mul0; - } else { - const double mul1 = 0.82; - if (use_color_cache) VP8LColorCacheInsert(hashers, color); - cost_val += GetLiteralCost(cost_model, color) * mul1; - } - if (cost[idx] > cost_val) { - cost[idx] = (float)cost_val; - dist_array[idx] = 1; // only one is inserted. - } -} - -// ----------------------------------------------------------------------------- -// CostManager and interval handling - -// Empirical value to avoid high memory consumption but good for performance. -#define COST_CACHE_INTERVAL_SIZE_MAX 100 - -// To perform backward reference every pixel at index index_ is considered and -// the cost for the MAX_LENGTH following pixels computed. Those following pixels -// at index index_ + k (k from 0 to MAX_LENGTH) have a cost of: -// distance_cost_ at index_ + GetLengthCost(cost_model, k) -// (named cost) (named cached cost) -// and the minimum value is kept. GetLengthCost(cost_model, k) is cached in an -// array of size MAX_LENGTH. -// Instead of performing MAX_LENGTH comparisons per pixel, we keep track of the -// minimal values using intervals, for which lower_ and upper_ bounds are kept. -// An interval is defined by the index_ of the pixel that generated it and -// is only useful in a range of indices from start_ to end_ (exclusive), i.e. -// it contains the minimum value for pixels between start_ and end_. -// Intervals are stored in a linked list and ordered by start_. When a new -// interval has a better minimum, old intervals are split or removed. -typedef struct CostInterval CostInterval; -struct CostInterval { - double lower_; - double upper_; - int start_; - int end_; - double distance_cost_; - int index_; - CostInterval* previous_; - CostInterval* next_; -}; - -// The GetLengthCost(cost_model, k) part of the costs is also bounded for -// efficiency in a set of intervals of a different type. -// If those intervals are small enough, they are not used for comparison and -// written into the costs right away. -typedef struct { - double lower_; // Lower bound of the interval. - double upper_; // Upper bound of the interval. - int start_; - int end_; // Exclusive. - int do_write_; // If !=0, the interval is saved to cost instead of being kept - // for comparison. -} CostCacheInterval; - -// This structure is in charge of managing intervals and costs. -// It caches the different CostCacheInterval, caches the different -// GetLengthCost(cost_model, k) in cost_cache_ and the CostInterval's (whose -// count_ is limited by COST_CACHE_INTERVAL_SIZE_MAX). -#define COST_MANAGER_MAX_FREE_LIST 10 -typedef struct { - CostInterval* head_; - int count_; // The number of stored intervals. - CostCacheInterval* cache_intervals_; - size_t cache_intervals_size_; - double cost_cache_[MAX_LENGTH]; // Contains the GetLengthCost(cost_model, k). - double min_cost_cache_; // The minimum value in cost_cache_[1:]. - double max_cost_cache_; // The maximum value in cost_cache_[1:]. - float* costs_; - uint16_t* dist_array_; - // Most of the time, we only need few intervals -> use a free-list, to avoid - // fragmentation with small allocs in most common cases. - CostInterval intervals_[COST_MANAGER_MAX_FREE_LIST]; - CostInterval* free_intervals_; - // These are regularly malloc'd remains. This list can't grow larger than than - // size COST_CACHE_INTERVAL_SIZE_MAX - COST_MANAGER_MAX_FREE_LIST, note. - CostInterval* recycled_intervals_; - // Buffer used in BackwardReferencesHashChainDistanceOnly to store the ends - // of the intervals that can have impacted the cost at a pixel. - int* interval_ends_; - int interval_ends_size_; -} CostManager; - -static int IsCostCacheIntervalWritable(int start, int end) { - // 100 is the length for which we consider an interval for comparison, and not - // for writing. - // The first intervals are very small and go in increasing size. This constant - // helps merging them into one big interval (up to index 150/200 usually from - // which intervals start getting much bigger). - // This value is empirical. - return (end - start + 1 < 100); -} - -static void CostIntervalAddToFreeList(CostManager* const manager, - CostInterval* const interval) { - interval->next_ = manager->free_intervals_; - manager->free_intervals_ = interval; -} - -static int CostIntervalIsInFreeList(const CostManager* const manager, - const CostInterval* const interval) { - return (interval >= &manager->intervals_[0] && - interval <= &manager->intervals_[COST_MANAGER_MAX_FREE_LIST - 1]); -} - -static void CostManagerInitFreeList(CostManager* const manager) { - int i; - manager->free_intervals_ = NULL; - for (i = 0; i < COST_MANAGER_MAX_FREE_LIST; ++i) { - CostIntervalAddToFreeList(manager, &manager->intervals_[i]); - } -} - -static void DeleteIntervalList(CostManager* const manager, - const CostInterval* interval) { - while (interval != NULL) { - const CostInterval* const next = interval->next_; - if (!CostIntervalIsInFreeList(manager, interval)) { - WebPSafeFree((void*)interval); - } // else: do nothing - interval = next; - } -} - -static void CostManagerClear(CostManager* const manager) { - if (manager == NULL) return; - - WebPSafeFree(manager->costs_); - WebPSafeFree(manager->cache_intervals_); - WebPSafeFree(manager->interval_ends_); - - // Clear the interval lists. - DeleteIntervalList(manager, manager->head_); - manager->head_ = NULL; - DeleteIntervalList(manager, manager->recycled_intervals_); - manager->recycled_intervals_ = NULL; - - // Reset pointers, count_ and cache_intervals_size_. - memset(manager, 0, sizeof(*manager)); - CostManagerInitFreeList(manager); -} - -static int CostManagerInit(CostManager* const manager, - uint16_t* const dist_array, int pix_count, - const CostModel* const cost_model) { +// Compute an LZ77 by forcing matches to happen within a given distance cost. +// We therefore limit the algorithm to the lowest 32 values in the PlaneCode +// definition. +#define WINDOW_OFFSETS_SIZE_MAX 32 +static int BackwardReferencesLz77Box(int xsize, int ysize, + const uint32_t* const argb, int cache_bits, + const VP8LHashChain* const hash_chain_best, + VP8LHashChain* hash_chain, + VP8LBackwardRefs* const refs) { int i; - const int cost_cache_size = (pix_count > MAX_LENGTH) ? MAX_LENGTH : pix_count; - // This constant is tied to the cost_model we use. - // Empirically, differences between intervals is usually of more than 1. - const double min_cost_diff = 0.1; - - manager->costs_ = NULL; - manager->cache_intervals_ = NULL; - manager->interval_ends_ = NULL; - manager->head_ = NULL; - manager->recycled_intervals_ = NULL; - manager->count_ = 0; - manager->dist_array_ = dist_array; - CostManagerInitFreeList(manager); - - // Fill in the cost_cache_. - manager->cache_intervals_size_ = 1; - manager->cost_cache_[0] = 0; - for (i = 1; i < cost_cache_size; ++i) { - manager->cost_cache_[i] = GetLengthCost(cost_model, i); - // Get an approximation of the number of bound intervals. - if (fabs(manager->cost_cache_[i] - manager->cost_cache_[i - 1]) > - min_cost_diff) { - ++manager->cache_intervals_size_; - } - // Compute the minimum of cost_cache_. - if (i == 1) { - manager->min_cost_cache_ = manager->cost_cache_[1]; - manager->max_cost_cache_ = manager->cost_cache_[1]; - } else if (manager->cost_cache_[i] < manager->min_cost_cache_) { - manager->min_cost_cache_ = manager->cost_cache_[i]; - } else if (manager->cost_cache_[i] > manager->max_cost_cache_) { - manager->max_cost_cache_ = manager->cost_cache_[i]; - } - } - - // With the current cost models, we have 15 intervals, so we are safe by - // setting a maximum of COST_CACHE_INTERVAL_SIZE_MAX. - if (manager->cache_intervals_size_ > COST_CACHE_INTERVAL_SIZE_MAX) { - manager->cache_intervals_size_ = COST_CACHE_INTERVAL_SIZE_MAX; - } - manager->cache_intervals_ = (CostCacheInterval*)WebPSafeMalloc( - manager->cache_intervals_size_, sizeof(*manager->cache_intervals_)); - if (manager->cache_intervals_ == NULL) { - CostManagerClear(manager); - return 0; - } - - // Fill in the cache_intervals_. - { - double cost_prev = -1e38f; // unprobably low initial value - CostCacheInterval* prev = NULL; - CostCacheInterval* cur = manager->cache_intervals_; - const CostCacheInterval* const end = - manager->cache_intervals_ + manager->cache_intervals_size_; - - // Consecutive values in cost_cache_ are compared and if a big enough - // difference is found, a new interval is created and bounded. - for (i = 0; i < cost_cache_size; ++i) { - const double cost_val = manager->cost_cache_[i]; - if (i == 0 || - (fabs(cost_val - cost_prev) > min_cost_diff && cur + 1 < end)) { - if (i > 1) { - const int is_writable = - IsCostCacheIntervalWritable(cur->start_, cur->end_); - // Merge with the previous interval if both are writable. - if (is_writable && cur != manager->cache_intervals_ && - prev->do_write_) { - // Update the previous interval. - prev->end_ = cur->end_; - if (cur->lower_ < prev->lower_) { - prev->lower_ = cur->lower_; - } else if (cur->upper_ > prev->upper_) { - prev->upper_ = cur->upper_; - } - } else { - cur->do_write_ = is_writable; - prev = cur; - ++cur; - } - } - // Initialize an interval. - cur->start_ = i; - cur->do_write_ = 0; - cur->lower_ = cost_val; - cur->upper_ = cost_val; - } else { - // Update the current interval bounds. - if (cost_val < cur->lower_) { - cur->lower_ = cost_val; - } else if (cost_val > cur->upper_) { - cur->upper_ = cost_val; - } - } - cur->end_ = i + 1; - cost_prev = cost_val; + const int pix_count = xsize * ysize; + uint16_t* counts; + int window_offsets[WINDOW_OFFSETS_SIZE_MAX] = {0}; + int window_offsets_new[WINDOW_OFFSETS_SIZE_MAX] = {0}; + int window_offsets_size = 0; + int window_offsets_new_size = 0; + uint16_t* const counts_ini = + (uint16_t*)WebPSafeMalloc(xsize * ysize, sizeof(*counts_ini)); + int best_offset_prev = -1, best_length_prev = -1; + if (counts_ini == NULL) return 0; + + // counts[i] counts how many times a pixel is repeated starting at position i. + i = pix_count - 2; + counts = counts_ini + i; + counts[1] = 1; + for (; i >= 0; --i, --counts) { + if (argb[i] == argb[i + 1]) { + // Max out the counts to MAX_LENGTH. + counts[0] = counts[1] + (counts[1] != MAX_LENGTH); + } else { + counts[0] = 1; } - manager->cache_intervals_size_ = cur + 1 - manager->cache_intervals_; } - manager->costs_ = (float*)WebPSafeMalloc(pix_count, sizeof(*manager->costs_)); - if (manager->costs_ == NULL) { - CostManagerClear(manager); - return 0; - } - // Set the initial costs_ high for every pixel as we will keep the minimum. - for (i = 0; i < pix_count; ++i) manager->costs_[i] = 1e38f; - - // The cost at pixel is influenced by the cost intervals from previous pixels. - // Let us take the specific case where the offset is the same (which actually - // happens a lot in case of uniform regions). - // pixel i contributes to j>i a cost of: offset cost + cost_cache_[j-i] - // pixel i+1 contributes to j>i a cost of: 2*offset cost + cost_cache_[j-i-1] - // pixel i+2 contributes to j>i a cost of: 3*offset cost + cost_cache_[j-i-2] - // and so on. - // A pixel i influences the following length(j) < MAX_LENGTH pixels. What is - // the value of j such that pixel i + j cannot influence any of those pixels? - // This value is such that: - // max of cost_cache_ < j*offset cost + min of cost_cache_ - // (pixel i + j 's cost cannot beat the worst cost given by pixel i). - // This value will be used to optimize the cost computation in - // BackwardReferencesHashChainDistanceOnly. + // Figure out the window offsets around a pixel. They are stored in a + // spiraling order around the pixel as defined by VP8LDistanceToPlaneCode. { - // The offset cost is computed in GetDistanceCost and has a minimum value of - // the minimum in cost_model->distance_. The case where the offset cost is 0 - // will be dealt with differently later so we are only interested in the - // minimum non-zero offset cost. - double offset_cost_min = 0.; - int size; - for (i = 0; i < NUM_DISTANCE_CODES; ++i) { - if (cost_model->distance_[i] != 0) { - if (offset_cost_min == 0.) { - offset_cost_min = cost_model->distance_[i]; - } else if (cost_model->distance_[i] < offset_cost_min) { - offset_cost_min = cost_model->distance_[i]; - } + int x, y; + for (y = 0; y <= 6; ++y) { + for (x = -6; x <= 6; ++x) { + const int offset = y * xsize + x; + int plane_code; + // Ignore offsets that bring us after the pixel. + if (offset <= 0) continue; + plane_code = VP8LDistanceToPlaneCode(xsize, offset) - 1; + if (plane_code >= WINDOW_OFFSETS_SIZE_MAX) continue; + window_offsets[plane_code] = offset; } } - // In case all the cost_model->distance_ is 0, the next non-zero cost we - // can have is from the extra bit in GetDistanceCost, hence 1. - if (offset_cost_min < 1.) offset_cost_min = 1.; - - size = 1 + (int)ceil((manager->max_cost_cache_ - manager->min_cost_cache_) / - offset_cost_min); - // Empirically, we usually end up with a value below 100. - if (size > MAX_LENGTH) size = MAX_LENGTH; - - manager->interval_ends_ = - (int*)WebPSafeMalloc(size, sizeof(*manager->interval_ends_)); - if (manager->interval_ends_ == NULL) { - CostManagerClear(manager); - return 0; - } - manager->interval_ends_size_ = size; - } - - return 1; -} - -// Given the distance_cost for pixel 'index', update the cost at pixel 'i' if it -// is smaller than the previously computed value. -static WEBP_INLINE void UpdateCost(CostManager* const manager, int i, int index, - double distance_cost) { - int k = i - index; - double cost_tmp; - assert(k >= 0 && k < MAX_LENGTH); - cost_tmp = distance_cost + manager->cost_cache_[k]; - - if (manager->costs_[i] > cost_tmp) { - manager->costs_[i] = (float)cost_tmp; - manager->dist_array_[i] = k + 1; - } -} - -// Given the distance_cost for pixel 'index', update the cost for all the pixels -// between 'start' and 'end' excluded. -static WEBP_INLINE void UpdateCostPerInterval(CostManager* const manager, - int start, int end, int index, - double distance_cost) { - int i; - for (i = start; i < end; ++i) UpdateCost(manager, i, index, distance_cost); -} - -// Given two intervals, make 'prev' be the previous one of 'next' in 'manager'. -static WEBP_INLINE void ConnectIntervals(CostManager* const manager, - CostInterval* const prev, - CostInterval* const next) { - if (prev != NULL) { - prev->next_ = next; - } else { - manager->head_ = next; - } - - if (next != NULL) next->previous_ = prev; -} - -// Pop an interval in the manager. -static WEBP_INLINE void PopInterval(CostManager* const manager, - CostInterval* const interval) { - CostInterval* const next = interval->next_; - - if (interval == NULL) return; - - ConnectIntervals(manager, interval->previous_, next); - if (CostIntervalIsInFreeList(manager, interval)) { - CostIntervalAddToFreeList(manager, interval); - } else { // recycle regularly malloc'd intervals too - interval->next_ = manager->recycled_intervals_; - manager->recycled_intervals_ = interval; - } - --manager->count_; - assert(manager->count_ >= 0); -} - -// Update the cost at index i by going over all the stored intervals that -// overlap with i. -static WEBP_INLINE void UpdateCostPerIndex(CostManager* const manager, int i) { - CostInterval* current = manager->head_; - - while (current != NULL && current->start_ <= i) { - if (current->end_ <= i) { - // We have an outdated interval, remove it. - CostInterval* next = current->next_; - PopInterval(manager, current); - current = next; - } else { - UpdateCost(manager, i, current->index_, current->distance_cost_); - current = current->next_; - } - } -} - -// Given a current orphan interval and its previous interval, before -// it was orphaned (which can be NULL), set it at the right place in the list -// of intervals using the start_ ordering and the previous interval as a hint. -static WEBP_INLINE void PositionOrphanInterval(CostManager* const manager, - CostInterval* const current, - CostInterval* previous) { - assert(current != NULL); - - if (previous == NULL) previous = manager->head_; - while (previous != NULL && current->start_ < previous->start_) { - previous = previous->previous_; - } - while (previous != NULL && previous->next_ != NULL && - previous->next_->start_ < current->start_) { - previous = previous->next_; - } - - if (previous != NULL) { - ConnectIntervals(manager, current, previous->next_); - } else { - ConnectIntervals(manager, current, manager->head_); - } - ConnectIntervals(manager, previous, current); -} - -// Insert an interval in the list contained in the manager by starting at -// interval_in as a hint. The intervals are sorted by start_ value. -static WEBP_INLINE void InsertInterval(CostManager* const manager, - CostInterval* const interval_in, - double distance_cost, double lower, - double upper, int index, int start, - int end) { - CostInterval* interval_new; - - if (IsCostCacheIntervalWritable(start, end) || - manager->count_ >= COST_CACHE_INTERVAL_SIZE_MAX) { - // Write down the interval if it is too small. - UpdateCostPerInterval(manager, start, end, index, distance_cost); - return; - } - if (manager->free_intervals_ != NULL) { - interval_new = manager->free_intervals_; - manager->free_intervals_ = interval_new->next_; - } else if (manager->recycled_intervals_ != NULL) { - interval_new = manager->recycled_intervals_; - manager->recycled_intervals_ = interval_new->next_; - } else { // malloc for good - interval_new = (CostInterval*)WebPSafeMalloc(1, sizeof(*interval_new)); - if (interval_new == NULL) { - // Write down the interval if we cannot create it. - UpdateCostPerInterval(manager, start, end, index, distance_cost); - return; - } - } - - interval_new->distance_cost_ = distance_cost; - interval_new->lower_ = lower; - interval_new->upper_ = upper; - interval_new->index_ = index; - interval_new->start_ = start; - interval_new->end_ = end; - PositionOrphanInterval(manager, interval_new, interval_in); - - ++manager->count_; -} - -// When an interval has its start_ or end_ modified, it needs to be -// repositioned in the linked list. -static WEBP_INLINE void RepositionInterval(CostManager* const manager, - CostInterval* const interval) { - if (IsCostCacheIntervalWritable(interval->start_, interval->end_)) { - // Maybe interval has been resized and is small enough to be removed. - UpdateCostPerInterval(manager, interval->start_, interval->end_, - interval->index_, interval->distance_cost_); - PopInterval(manager, interval); - return; - } - - // Early exit if interval is at the right spot. - if ((interval->previous_ == NULL || - interval->previous_->start_ <= interval->start_) && - (interval->next_ == NULL || - interval->start_ <= interval->next_->start_)) { - return; - } - - ConnectIntervals(manager, interval->previous_, interval->next_); - PositionOrphanInterval(manager, interval, interval->previous_); -} - -// Given a new cost interval defined by its start at index, its last value and -// distance_cost, add its contributions to the previous intervals and costs. -// If handling the interval or one of its subintervals becomes to heavy, its -// contribution is added to the costs right away. -static WEBP_INLINE void PushInterval(CostManager* const manager, - double distance_cost, int index, - int last) { - size_t i; - CostInterval* interval = manager->head_; - CostInterval* interval_next; - const CostCacheInterval* const cost_cache_intervals = - manager->cache_intervals_; - - for (i = 0; i < manager->cache_intervals_size_ && - cost_cache_intervals[i].start_ < last; - ++i) { - // Define the intersection of the ith interval with the new one. - int start = index + cost_cache_intervals[i].start_; - const int end = index + (cost_cache_intervals[i].end_ > last - ? last - : cost_cache_intervals[i].end_); - const double lower_in = cost_cache_intervals[i].lower_; - const double upper_in = cost_cache_intervals[i].upper_; - const double lower_full_in = distance_cost + lower_in; - const double upper_full_in = distance_cost + upper_in; - - if (cost_cache_intervals[i].do_write_) { - UpdateCostPerInterval(manager, start, end, index, distance_cost); - continue; + // For narrow images, not all plane codes are reached, so remove those. + for (i = 0; i < WINDOW_OFFSETS_SIZE_MAX; ++i) { + if (window_offsets[i] == 0) continue; + window_offsets[window_offsets_size++] = window_offsets[i]; } - - for (; interval != NULL && interval->start_ < end && start < end; - interval = interval_next) { - const double lower_full_interval = - interval->distance_cost_ + interval->lower_; - const double upper_full_interval = - interval->distance_cost_ + interval->upper_; - - interval_next = interval->next_; - - // Make sure we have some overlap - if (start >= interval->end_) continue; - - if (lower_full_in >= upper_full_interval) { - // When intervals are represented, the lower, the better. - // [**********************************************************] - // start end - // [----------------------------------] - // interval->start_ interval->end_ - // If we are worse than what we already have, add whatever we have so - // far up to interval. - const int start_new = interval->end_; - InsertInterval(manager, interval, distance_cost, lower_in, upper_in, - index, start, interval->start_); - start = start_new; - continue; + // Given a pixel P, find the offsets that reach pixels unreachable from P-1 + // with any of the offsets in window_offsets[]. + for (i = 0; i < window_offsets_size; ++i) { + int j; + int is_reachable = 0; + for (j = 0; j < window_offsets_size && !is_reachable; ++j) { + is_reachable |= (window_offsets[i] == window_offsets[j] + 1); } - - // We know the two intervals intersect. - if (upper_full_in >= lower_full_interval) { - // There is no clear cut on which is best, so let's keep both. - // [*********[*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*]***********] - // start interval->start_ interval->end_ end - // OR - // [*********[*-*-*-*-*-*-*-*-*-*-*-]----------------------] - // start interval->start_ end interval->end_ - const int end_new = (interval->end_ <= end) ? interval->end_ : end; - InsertInterval(manager, interval, distance_cost, lower_in, upper_in, - index, start, end_new); - start = end_new; - } else if (start <= interval->start_ && interval->end_ <= end) { - // [----------------------------------] - // interval->start_ interval->end_ - // [**************************************************************] - // start end - // We can safely remove the old interval as it is fully included. - PopInterval(manager, interval); - } else { - if (interval->start_ <= start && end <= interval->end_) { - // [--------------------------------------------------------------] - // interval->start_ interval->end_ - // [*****************************] - // start end - // We have to split the old interval as it fully contains the new one. - const int end_original = interval->end_; - interval->end_ = start; - InsertInterval(manager, interval, interval->distance_cost_, - interval->lower_, interval->upper_, interval->index_, - end, end_original); - } else if (interval->start_ < start) { - // [------------------------------------] - // interval->start_ interval->end_ - // [*****************************] - // start end - interval->end_ = start; - } else { - // [------------------------------------] - // interval->start_ interval->end_ - // [*****************************] - // start end - interval->start_ = end; - } - - // The interval has been modified, we need to reposition it or write it. - RepositionInterval(manager, interval); + if (!is_reachable) { + window_offsets_new[window_offsets_new_size] = window_offsets[i]; + ++window_offsets_new_size; } } - // Insert the remaining interval from start to end. - InsertInterval(manager, interval, distance_cost, lower_in, upper_in, index, - start, end); - } -} - -static int BackwardReferencesHashChainDistanceOnly( - int xsize, int ysize, const uint32_t* const argb, int quality, - int cache_bits, const VP8LHashChain* const hash_chain, - VP8LBackwardRefs* const refs, uint16_t* const dist_array) { - int i; - int ok = 0; - int cc_init = 0; - const int pix_count = xsize * ysize; - const int use_color_cache = (cache_bits > 0); - const size_t literal_array_size = sizeof(double) * - (NUM_LITERAL_CODES + NUM_LENGTH_CODES + - ((cache_bits > 0) ? (1 << cache_bits) : 0)); - const size_t cost_model_size = sizeof(CostModel) + literal_array_size; - CostModel* const cost_model = - (CostModel*)WebPSafeCalloc(1ULL, cost_model_size); - VP8LColorCache hashers; - const int skip_length = 32 + quality; - const int skip_min_distance_code = 2; - CostManager* cost_manager = - (CostManager*)WebPSafeMalloc(1ULL, sizeof(*cost_manager)); - - if (cost_model == NULL || cost_manager == NULL) goto Error; - - cost_model->literal_ = (double*)(cost_model + 1); - if (use_color_cache) { - cc_init = VP8LColorCacheInit(&hashers, cache_bits); - if (!cc_init) goto Error; } - if (!CostModelBuild(cost_model, cache_bits, refs)) { - goto Error; - } - - if (!CostManagerInit(cost_manager, dist_array, pix_count, cost_model)) { - goto Error; - } - - // We loop one pixel at a time, but store all currently best points to - // non-processed locations from this point. - dist_array[0] = 0; - // Add first pixel as literal. - AddSingleLiteralWithCostModel(argb + 0, &hashers, cost_model, 0, - use_color_cache, 0.0, cost_manager->costs_, - dist_array); - - for (i = 1; i < pix_count - 1; ++i) { - int offset = 0, len = 0; - double prev_cost = cost_manager->costs_[i - 1]; - HashChainFindCopy(hash_chain, i, &offset, &len); - if (len >= 2) { - // If we are dealing with a non-literal. - const int code = DistanceToPlaneCode(xsize, offset); - const double offset_cost = GetDistanceCost(cost_model, code); - const int first_i = i; - int j_max = 0, interval_ends_index = 0; - const int is_offset_zero = (offset_cost == 0.); - - if (!is_offset_zero) { - j_max = (int)ceil( - (cost_manager->max_cost_cache_ - cost_manager->min_cost_cache_) / - offset_cost); - if (j_max < 1) { - j_max = 1; - } else if (j_max > cost_manager->interval_ends_size_ - 1) { - // This could only happen in the case of MAX_LENGTH. - j_max = cost_manager->interval_ends_size_ - 1; + hash_chain->offset_length_[0] = 0; + for (i = 1; i < pix_count; ++i) { + int ind; + int best_length = VP8LHashChainFindLength(hash_chain_best, i); + int best_offset; + int do_compute = 1; + + if (best_length >= MAX_LENGTH) { + // Do not recompute the best match if we already have a maximal one in the + // window. + best_offset = VP8LHashChainFindOffset(hash_chain_best, i); + for (ind = 0; ind < window_offsets_size; ++ind) { + if (best_offset == window_offsets[ind]) { + do_compute = 0; + break; } - } // else j_max is unused anyway. - - // Instead of considering all contributions from a pixel i by calling: - // PushInterval(cost_manager, prev_cost + offset_cost, i, len); - // we optimize these contributions in case offset_cost stays the same for - // consecutive pixels. This describes a set of pixels similar to a - // previous set (e.g. constant color regions). - for (; i < pix_count - 1; ++i) { - int offset_next, len_next; - prev_cost = cost_manager->costs_[i - 1]; - - if (is_offset_zero) { - // No optimization can be made so we just push all of the - // contributions from i. - PushInterval(cost_manager, prev_cost, i, len); - } else { - // j_max is chosen as the smallest j such that: - // max of cost_cache_ < j*offset cost + min of cost_cache_ - // Therefore, the pixel influenced by i-j_max, cannot be influenced - // by i. Only the costs after the end of what i contributed need to be - // updated. cost_manager->interval_ends_ is a circular buffer that - // stores those ends. - const double distance_cost = prev_cost + offset_cost; - int j = cost_manager->interval_ends_[interval_ends_index]; - if (i - first_i <= j_max || - !IsCostCacheIntervalWritable(j, i + len)) { - PushInterval(cost_manager, distance_cost, i, len); - } else { - for (; j < i + len; ++j) { - UpdateCost(cost_manager, j, i, distance_cost); - } - } - // Store the new end in the circular buffer. - assert(interval_ends_index < cost_manager->interval_ends_size_); - cost_manager->interval_ends_[interval_ends_index] = i + len; - if (++interval_ends_index > j_max) interval_ends_index = 0; - } - - // Check whether i is the last pixel to consider, as it is handled - // differently. - if (i + 1 >= pix_count - 1) break; - HashChainFindCopy(hash_chain, i + 1, &offset_next, &len_next); - if (offset_next != offset) break; - len = len_next; - UpdateCostPerIndex(cost_manager, i); - AddSingleLiteralWithCostModel(argb + i, &hashers, cost_model, i, - use_color_cache, prev_cost, - cost_manager->costs_, dist_array); } - // Submit the last pixel. - UpdateCostPerIndex(cost_manager, i + 1); - - // This if is for speedup only. It roughly doubles the speed, and - // makes compression worse by .1 %. - if (len >= skip_length && code <= skip_min_distance_code) { - // Long copy for short distances, let's skip the middle - // lookups for better copies. - // 1) insert the hashes. - if (use_color_cache) { - int k; - for (k = 0; k < len; ++k) { - VP8LColorCacheInsert(&hashers, argb[i + k]); + } + if (do_compute) { + // Figure out if we should use the offset/length from the previous pixel + // as an initial guess and therefore only inspect the offsets in + // window_offsets_new[]. + const int use_prev = + (best_length_prev > 1) && (best_length_prev < MAX_LENGTH); + const int num_ind = + use_prev ? window_offsets_new_size : window_offsets_size; + best_length = use_prev ? best_length_prev - 1 : 0; + best_offset = use_prev ? best_offset_prev : 0; + // Find the longest match in a window around the pixel. + for (ind = 0; ind < num_ind; ++ind) { + int curr_length = 0; + int j = i; + int j_offset = + use_prev ? i - window_offsets_new[ind] : i - window_offsets[ind]; + if (j_offset < 0 || argb[j_offset] != argb[i]) continue; + // The longest match is the sum of how many times each pixel is + // repeated. + do { + const int counts_j_offset = counts_ini[j_offset]; + const int counts_j = counts_ini[j]; + if (counts_j_offset != counts_j) { + curr_length += + (counts_j_offset < counts_j) ? counts_j_offset : counts_j; + break; + } + // The same color is repeated counts_pos times at j_offset and j. + curr_length += counts_j_offset; + j_offset += counts_j_offset; + j += counts_j_offset; + } while (curr_length <= MAX_LENGTH && j < pix_count && + argb[j_offset] == argb[j]); + if (best_length < curr_length) { + best_offset = + use_prev ? window_offsets_new[ind] : window_offsets[ind]; + if (curr_length >= MAX_LENGTH) { + best_length = MAX_LENGTH; + break; + } else { + best_length = curr_length; } - } - // 2) jump. - { - const int i_next = i + len - 1; // for loop does ++i, thus -1 here. - for (; i <= i_next; ++i) UpdateCostPerIndex(cost_manager, i + 1); - i = i_next; - } - goto next_symbol; - } - if (len > 2) { - // Also try the smallest interval possible (size 2). - double cost_total = - prev_cost + offset_cost + GetLengthCost(cost_model, 1); - if (cost_manager->costs_[i + 1] > cost_total) { - cost_manager->costs_[i + 1] = (float)cost_total; - dist_array[i + 1] = 2; } } - } else { - // The pixel is added as a single literal so just update the costs. - UpdateCostPerIndex(cost_manager, i + 1); } - AddSingleLiteralWithCostModel(argb + i, &hashers, cost_model, i, - use_color_cache, prev_cost, - cost_manager->costs_, dist_array); - - next_symbol: ; - } - // Handle the last pixel. - if (i == (pix_count - 1)) { - AddSingleLiteralWithCostModel( - argb + i, &hashers, cost_model, i, use_color_cache, - cost_manager->costs_[pix_count - 2], cost_manager->costs_, dist_array); - } - - ok = !refs->error_; - Error: - if (cc_init) VP8LColorCacheClear(&hashers); - CostManagerClear(cost_manager); - WebPSafeFree(cost_model); - WebPSafeFree(cost_manager); - return ok; -} - -// We pack the path at the end of *dist_array and return -// a pointer to this part of the array. Example: -// dist_array = [1x2xx3x2] => packed [1x2x1232], chosen_path = [1232] -static void TraceBackwards(uint16_t* const dist_array, - int dist_array_size, - uint16_t** const chosen_path, - int* const chosen_path_size) { - uint16_t* path = dist_array + dist_array_size; - uint16_t* cur = dist_array + dist_array_size - 1; - while (cur >= dist_array) { - const int k = *cur; - --path; - *path = k; - cur -= k; - } - *chosen_path = path; - *chosen_path_size = (int)(dist_array + dist_array_size - path); -} - -static int BackwardReferencesHashChainFollowChosenPath( - const uint32_t* const argb, int cache_bits, - const uint16_t* const chosen_path, int chosen_path_size, - const VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs) { - const int use_color_cache = (cache_bits > 0); - int ix; - int i = 0; - int ok = 0; - int cc_init = 0; - VP8LColorCache hashers; - - if (use_color_cache) { - cc_init = VP8LColorCacheInit(&hashers, cache_bits); - if (!cc_init) goto Error; - } - - ClearBackwardRefs(refs); - for (ix = 0; ix < chosen_path_size; ++ix) { - const int len = chosen_path[ix]; - if (len != 1) { - int k; - const int offset = HashChainFindOffset(hash_chain, i); - BackwardRefsCursorAdd(refs, PixOrCopyCreateCopy(offset, len)); - if (use_color_cache) { - for (k = 0; k < len; ++k) { - VP8LColorCacheInsert(&hashers, argb[i + k]); - } - } - i += len; + assert(i + best_length <= pix_count); + assert(best_length <= MAX_LENGTH); + if (best_length <= MIN_LENGTH) { + hash_chain->offset_length_[i] = 0; + best_offset_prev = 0; + best_length_prev = 0; } else { - PixOrCopy v; - const int idx = - use_color_cache ? VP8LColorCacheContains(&hashers, argb[i]) : -1; - if (idx >= 0) { - // use_color_cache is true and hashers contains argb[i] - // push pixel as a color cache index - v = PixOrCopyCreateCacheIdx(idx); - } else { - if (use_color_cache) VP8LColorCacheInsert(&hashers, argb[i]); - v = PixOrCopyCreateLiteral(argb[i]); - } - BackwardRefsCursorAdd(refs, v); - ++i; + hash_chain->offset_length_[i] = + (best_offset << MAX_LENGTH_BITS) | (uint32_t)best_length; + best_offset_prev = best_offset; + best_length_prev = best_length; } } - ok = !refs->error_; - Error: - if (cc_init) VP8LColorCacheClear(&hashers); - return ok; -} + hash_chain->offset_length_[0] = 0; + WebPSafeFree(counts_ini); -// Returns 1 on success. -static int BackwardReferencesTraceBackwards( - int xsize, int ysize, const uint32_t* const argb, int quality, - int cache_bits, const VP8LHashChain* const hash_chain, - VP8LBackwardRefs* const refs) { - int ok = 0; - const int dist_array_size = xsize * ysize; - uint16_t* chosen_path = NULL; - int chosen_path_size = 0; - uint16_t* dist_array = - (uint16_t*)WebPSafeMalloc(dist_array_size, sizeof(*dist_array)); - - if (dist_array == NULL) goto Error; - - if (!BackwardReferencesHashChainDistanceOnly( - xsize, ysize, argb, quality, cache_bits, hash_chain, - refs, dist_array)) { - goto Error; - } - TraceBackwards(dist_array, dist_array_size, &chosen_path, &chosen_path_size); - if (!BackwardReferencesHashChainFollowChosenPath( - argb, cache_bits, chosen_path, chosen_path_size, hash_chain, refs)) { - goto Error; - } - ok = 1; - Error: - WebPSafeFree(dist_array); - return ok; + return BackwardReferencesLz77(xsize, ysize, argb, cache_bits, hash_chain, + refs); } +// ----------------------------------------------------------------------------- + static void BackwardReferences2DLocality(int xsize, const VP8LBackwardRefs* const refs) { VP8LRefsCursor c = VP8LRefsCursorInit(refs); while (VP8LRefsCursorOk(&c)) { if (PixOrCopyIsCopy(c.cur_pos)) { const int dist = c.cur_pos->argb_or_distance; - const int transformed_dist = DistanceToPlaneCode(xsize, dist); + const int transformed_dist = VP8LDistanceToPlaneCode(xsize, dist); c.cur_pos->argb_or_distance = transformed_dist; } VP8LRefsCursorNext(&c); } } -// Computes the entropies for a color cache size (in bits) between 0 (unused) -// and cache_bits_max (inclusive). -// Returns 1 on success, 0 in case of allocation error. -static int ComputeCacheEntropies(const uint32_t* argb, - const VP8LBackwardRefs* const refs, - int cache_bits_max, double entropies[]) { +// Evaluate optimal cache bits for the local color cache. +// The input *best_cache_bits sets the maximum cache bits to use (passing 0 +// implies disabling the local color cache). The local color cache is also +// disabled for the lower (<= 25) quality. +// Returns 0 in case of memory error. +static int CalculateBestCacheSize(const uint32_t* argb, int quality, + const VP8LBackwardRefs* const refs, + int* const best_cache_bits) { + int i; + const int cache_bits_max = (quality <= 25) ? 0 : *best_cache_bits; + double entropy_min = MAX_ENTROPY; int cc_init[MAX_COLOR_CACHE_BITS + 1] = { 0 }; VP8LColorCache hashers[MAX_COLOR_CACHE_BITS + 1]; VP8LRefsCursor c = VP8LRefsCursorInit(refs); VP8LHistogram* histos[MAX_COLOR_CACHE_BITS + 1] = { NULL }; int ok = 0; - int i; + assert(cache_bits_max >= 0 && cache_bits_max <= MAX_COLOR_CACHE_BITS); + + if (cache_bits_max == 0) { + *best_cache_bits = 0; + // Local color cache is disabled. + return 1; + } + + // Allocate data. for (i = 0; i <= cache_bits_max; ++i) { histos[i] = VP8LAllocateHistogram(i); if (histos[i] == NULL) goto Error; + VP8LHistogramInit(histos[i], i, /*init_arrays=*/ 1); if (i == 0) continue; cc_init[i] = VP8LColorCacheInit(&hashers[i], i); if (!cc_init[i]) goto Error; } - assert(cache_bits_max >= 0); - // Do not use the color cache for cache_bits=0. + // Find the cache_bits giving the lowest entropy. The search is done in a + // brute-force way as the function (entropy w.r.t cache_bits) can be + // anything in practice. while (VP8LRefsCursorOk(&c)) { - VP8LHistogramAddSinglePixOrCopy(histos[0], c.cur_pos); - VP8LRefsCursorNext(&c); - } - if (cache_bits_max > 0) { - c = VP8LRefsCursorInit(refs); - while (VP8LRefsCursorOk(&c)) { - const PixOrCopy* const v = c.cur_pos; - if (PixOrCopyIsLiteral(v)) { - const uint32_t pix = *argb++; - // The keys of the caches can be derived from the longest one. - int key = HashPix(pix, 32 - cache_bits_max); - for (i = cache_bits_max; i >= 1; --i, key >>= 1) { - if (VP8LColorCacheLookup(&hashers[i], key) == pix) { - ++histos[i]->literal_[NUM_LITERAL_CODES + NUM_LENGTH_CODES + key]; - } else { - VP8LColorCacheSet(&hashers[i], key, pix); - ++histos[i]->blue_[pix & 0xff]; - ++histos[i]->literal_[(pix >> 8) & 0xff]; - ++histos[i]->red_[(pix >> 16) & 0xff]; - ++histos[i]->alpha_[pix >> 24]; - } - } - } else { - // Update the histograms for distance/length. - int len = PixOrCopyLength(v); - int code_dist, code_len, extra_bits; - uint32_t argb_prev = *argb ^ 0xffffffffu; - VP8LPrefixEncodeBits(len, &code_len, &extra_bits); - VP8LPrefixEncodeBits(PixOrCopyDistance(v), &code_dist, &extra_bits); - for (i = 1; i <= cache_bits_max; ++i) { - ++histos[i]->literal_[NUM_LITERAL_CODES + code_len]; - ++histos[i]->distance_[code_dist]; + const PixOrCopy* const v = c.cur_pos; + if (PixOrCopyIsLiteral(v)) { + const uint32_t pix = *argb++; + const uint32_t a = (pix >> 24) & 0xff; + const uint32_t r = (pix >> 16) & 0xff; + const uint32_t g = (pix >> 8) & 0xff; + const uint32_t b = (pix >> 0) & 0xff; + // The keys of the caches can be derived from the longest one. + int key = VP8LHashPix(pix, 32 - cache_bits_max); + // Do not use the color cache for cache_bits = 0. + ++histos[0]->blue_[b]; + ++histos[0]->literal_[g]; + ++histos[0]->red_[r]; + ++histos[0]->alpha_[a]; + // Deal with cache_bits > 0. + for (i = cache_bits_max; i >= 1; --i, key >>= 1) { + if (VP8LColorCacheLookup(&hashers[i], key) == pix) { + ++histos[i]->literal_[NUM_LITERAL_CODES + NUM_LENGTH_CODES + key]; + } else { + VP8LColorCacheSet(&hashers[i], key, pix); + ++histos[i]->blue_[b]; + ++histos[i]->literal_[g]; + ++histos[i]->red_[r]; + ++histos[i]->alpha_[a]; } - // Update the colors caches. - do { - if (*argb != argb_prev) { - // Efficiency: insert only if the color changes. - int key = HashPix(*argb, 32 - cache_bits_max); - for (i = cache_bits_max; i >= 1; --i, key >>= 1) { - hashers[i].colors_[key] = *argb; - } - argb_prev = *argb; - } - argb++; - } while (--len != 0); } - VP8LRefsCursorNext(&c); + } else { + // We should compute the contribution of the (distance,length) + // histograms but those are the same independently from the cache size. + // As those constant contributions are in the end added to the other + // histogram contributions, we can safely ignore them. + int len = PixOrCopyLength(v); + uint32_t argb_prev = *argb ^ 0xffffffffu; + // Update the color caches. + do { + if (*argb != argb_prev) { + // Efficiency: insert only if the color changes. + int key = VP8LHashPix(*argb, 32 - cache_bits_max); + for (i = cache_bits_max; i >= 1; --i, key >>= 1) { + hashers[i].colors_[key] = *argb; + } + argb_prev = *argb; + } + argb++; + } while (--len != 0); } + VP8LRefsCursorNext(&c); } + for (i = 0; i <= cache_bits_max; ++i) { - entropies[i] = VP8LHistogramEstimateBits(histos[i]); + const double entropy = VP8LHistogramEstimateBits(histos[i]); + if (i == 0 || entropy < entropy_min) { + entropy_min = entropy; + *best_cache_bits = i; + } } ok = 1; Error: @@ -1611,50 +791,6 @@ static int ComputeCacheEntropies(const uint32_t* argb, return ok; } -// Evaluate optimal cache bits for the local color cache. -// The input *best_cache_bits sets the maximum cache bits to use (passing 0 -// implies disabling the local color cache). The local color cache is also -// disabled for the lower (<= 25) quality. -// Returns 0 in case of memory error. -static int CalculateBestCacheSize(const uint32_t* const argb, - int xsize, int ysize, int quality, - const VP8LHashChain* const hash_chain, - VP8LBackwardRefs* const refs, - int* const lz77_computed, - int* const best_cache_bits) { - int i; - int cache_bits_high = (quality <= 25) ? 0 : *best_cache_bits; - double entropy_min = MAX_ENTROPY; - double entropies[MAX_COLOR_CACHE_BITS + 1]; - - assert(cache_bits_high <= MAX_COLOR_CACHE_BITS); - - *lz77_computed = 0; - if (cache_bits_high == 0) { - *best_cache_bits = 0; - // Local color cache is disabled. - return 1; - } - // Compute LZ77 with no cache (0 bits), as the ideal LZ77 with a color cache - // is not that different in practice. - if (!BackwardReferencesLz77(xsize, ysize, argb, 0, hash_chain, refs)) { - return 0; - } - // Find the cache_bits giving the lowest entropy. The search is done in a - // brute-force way as the function (entropy w.r.t cache_bits) can be - // anything in practice. - if (!ComputeCacheEntropies(argb, refs, cache_bits_high, entropies)) { - return 0; - } - for (i = 0; i <= cache_bits_high; ++i) { - if (i == 0 || entropies[i] < entropy_min) { - entropy_min = entropies[i]; - *best_cache_bits = i; - } - } - return 1; -} - // Update (in-place) backward references for specified cache_bits. static int BackwardRefsWithLocalCache(const uint32_t* const argb, int cache_bits, @@ -1693,8 +829,7 @@ static int BackwardRefsWithLocalCache(const uint32_t* const argb, static VP8LBackwardRefs* GetBackwardReferencesLowEffort( int width, int height, const uint32_t* const argb, int* const cache_bits, const VP8LHashChain* const hash_chain, - VP8LBackwardRefs refs_array[2]) { - VP8LBackwardRefs* refs_lz77 = &refs_array[0]; + VP8LBackwardRefs* const refs_lz77) { *cache_bits = 0; if (!BackwardReferencesLz77(width, height, argb, 0, hash_chain, refs_lz77)) { return NULL; @@ -1703,98 +838,108 @@ static VP8LBackwardRefs* GetBackwardReferencesLowEffort( return refs_lz77; } +extern int VP8LBackwardReferencesTraceBackwards( + int xsize, int ysize, const uint32_t* const argb, int cache_bits, + const VP8LHashChain* const hash_chain, + const VP8LBackwardRefs* const refs_src, VP8LBackwardRefs* const refs_dst); static VP8LBackwardRefs* GetBackwardReferences( int width, int height, const uint32_t* const argb, int quality, - int* const cache_bits, const VP8LHashChain* const hash_chain, - VP8LBackwardRefs refs_array[2]) { - int lz77_is_useful; - int lz77_computed; - double bit_cost_lz77, bit_cost_rle; - VP8LBackwardRefs* best = NULL; - VP8LBackwardRefs* refs_lz77 = &refs_array[0]; - VP8LBackwardRefs* refs_rle = &refs_array[1]; + int lz77_types_to_try, int* const cache_bits, + const VP8LHashChain* const hash_chain, VP8LBackwardRefs* best, + VP8LBackwardRefs* worst) { + const int cache_bits_initial = *cache_bits; + double bit_cost_best = -1; VP8LHistogram* histo = NULL; + int lz77_type, lz77_type_best = 0; + VP8LHashChain hash_chain_box; + memset(&hash_chain_box, 0, sizeof(hash_chain_box)); - if (!CalculateBestCacheSize(argb, width, height, quality, hash_chain, - refs_lz77, &lz77_computed, cache_bits)) { - goto Error; - } + histo = VP8LAllocateHistogram(MAX_COLOR_CACHE_BITS); + if (histo == NULL) goto Error; - if (lz77_computed) { - // Transform refs_lz77 for the optimized cache_bits. - if (*cache_bits > 0) { - if (!BackwardRefsWithLocalCache(argb, *cache_bits, refs_lz77)) { - goto Error; - } + for (lz77_type = 1; lz77_types_to_try; + lz77_types_to_try &= ~lz77_type, lz77_type <<= 1) { + int res = 0; + double bit_cost; + int cache_bits_tmp = cache_bits_initial; + if ((lz77_types_to_try & lz77_type) == 0) continue; + switch (lz77_type) { + case kLZ77RLE: + res = BackwardReferencesRle(width, height, argb, 0, worst); + break; + case kLZ77Standard: + // Compute LZ77 with no cache (0 bits), as the ideal LZ77 with a color + // cache is not that different in practice. + res = BackwardReferencesLz77(width, height, argb, 0, hash_chain, worst); + break; + case kLZ77Box: + if (!VP8LHashChainInit(&hash_chain_box, width * height)) goto Error; + res = BackwardReferencesLz77Box(width, height, argb, 0, hash_chain, + &hash_chain_box, worst); + break; + default: + assert(0); } - } else { - if (!BackwardReferencesLz77(width, height, argb, *cache_bits, hash_chain, - refs_lz77)) { + if (!res) goto Error; + + // Next, try with a color cache and update the references. + if (!CalculateBestCacheSize(argb, quality, worst, &cache_bits_tmp)) { goto Error; } - } - - if (!BackwardReferencesRle(width, height, argb, *cache_bits, refs_rle)) { - goto Error; - } - - histo = VP8LAllocateHistogram(*cache_bits); - if (histo == NULL) goto Error; - - { - // Evaluate LZ77 coding. - VP8LHistogramCreate(histo, refs_lz77, *cache_bits); - bit_cost_lz77 = VP8LHistogramEstimateBits(histo); - // Evaluate RLE coding. - VP8LHistogramCreate(histo, refs_rle, *cache_bits); - bit_cost_rle = VP8LHistogramEstimateBits(histo); - // Decide if LZ77 is useful. - lz77_is_useful = (bit_cost_lz77 < bit_cost_rle); - } - - // Choose appropriate backward reference. - if (lz77_is_useful) { - // TraceBackwards is costly. Don't execute it at lower quality. - const int try_lz77_trace_backwards = (quality >= 25); - best = refs_lz77; // default guess: lz77 is better - if (try_lz77_trace_backwards) { - VP8LBackwardRefs* const refs_trace = refs_rle; - if (!VP8LBackwardRefsCopy(refs_lz77, refs_trace)) { - best = NULL; + if (cache_bits_tmp > 0) { + if (!BackwardRefsWithLocalCache(argb, cache_bits_tmp, worst)) { goto Error; } - if (BackwardReferencesTraceBackwards(width, height, argb, quality, - *cache_bits, hash_chain, - refs_trace)) { - double bit_cost_trace; - // Evaluate LZ77 coding. - VP8LHistogramCreate(histo, refs_trace, *cache_bits); - bit_cost_trace = VP8LHistogramEstimateBits(histo); - if (bit_cost_trace < bit_cost_lz77) { - best = refs_trace; - } - } } - } else { - best = refs_rle; + + // Keep the best backward references. + VP8LHistogramCreate(histo, worst, cache_bits_tmp); + bit_cost = VP8LHistogramEstimateBits(histo); + if (lz77_type_best == 0 || bit_cost < bit_cost_best) { + VP8LBackwardRefs* const tmp = worst; + worst = best; + best = tmp; + bit_cost_best = bit_cost; + *cache_bits = cache_bits_tmp; + lz77_type_best = lz77_type; + } + } + assert(lz77_type_best > 0); + + // Improve on simple LZ77 but only for high quality (TraceBackwards is + // costly). + if ((lz77_type_best == kLZ77Standard || lz77_type_best == kLZ77Box) && + quality >= 25) { + const VP8LHashChain* const hash_chain_tmp = + (lz77_type_best == kLZ77Standard) ? hash_chain : &hash_chain_box; + if (VP8LBackwardReferencesTraceBackwards(width, height, argb, *cache_bits, + hash_chain_tmp, best, worst)) { + double bit_cost_trace; + VP8LHistogramCreate(histo, worst, *cache_bits); + bit_cost_trace = VP8LHistogramEstimateBits(histo); + if (bit_cost_trace < bit_cost_best) best = worst; + } } BackwardReferences2DLocality(width, best); - Error: +Error: + VP8LHashChainClear(&hash_chain_box); VP8LFreeHistogram(histo); return best; } VP8LBackwardRefs* VP8LGetBackwardReferences( int width, int height, const uint32_t* const argb, int quality, - int low_effort, int* const cache_bits, - const VP8LHashChain* const hash_chain, VP8LBackwardRefs refs_array[2]) { + int low_effort, int lz77_types_to_try, int* const cache_bits, + const VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs_tmp1, + VP8LBackwardRefs* const refs_tmp2) { if (low_effort) { return GetBackwardReferencesLowEffort(width, height, argb, cache_bits, - hash_chain, refs_array); + hash_chain, refs_tmp1); } else { - return GetBackwardReferences(width, height, argb, quality, cache_bits, - hash_chain, refs_array); + return GetBackwardReferences(width, height, argb, quality, + lz77_types_to_try, cache_bits, hash_chain, + refs_tmp1, refs_tmp2); } } diff --git a/Pods/libwebp/src/enc/backward_references_enc.h b/Pods/libwebp/src/enc/backward_references_enc.h index 3a19aa7..103ddfd 100644 --- a/Pods/libwebp/src/enc/backward_references_enc.h +++ b/Pods/libwebp/src/enc/backward_references_enc.h @@ -10,13 +10,13 @@ // Author: Jyrki Alakuijala (jyrki@google.com) // -#ifndef WEBP_ENC_BACKWARD_REFERENCES_H_ -#define WEBP_ENC_BACKWARD_REFERENCES_H_ +#ifndef WEBP_ENC_BACKWARD_REFERENCES_ENC_H_ +#define WEBP_ENC_BACKWARD_REFERENCES_ENC_H_ #include #include -#include "../webp/types.h" -#include "../webp/format_constants.h" +#include "src/webp/types.h" +#include "src/webp/format_constants.h" #ifdef __cplusplus extern "C" { @@ -91,11 +91,6 @@ static WEBP_INLINE uint32_t PixOrCopyLength(const PixOrCopy* const p) { return p->len; } -static WEBP_INLINE uint32_t PixOrCopyArgb(const PixOrCopy* const p) { - assert(p->mode == kLiteral); - return p->argb_or_distance; -} - static WEBP_INLINE uint32_t PixOrCopyCacheIdx(const PixOrCopy* const p) { assert(p->mode == kCacheIdx); assert(p->argb_or_distance < (1U << MAX_COLOR_CACHE_BITS)); @@ -113,6 +108,16 @@ static WEBP_INLINE uint32_t PixOrCopyDistance(const PixOrCopy* const p) { #define HASH_BITS 18 #define HASH_SIZE (1 << HASH_BITS) +// If you change this, you need MAX_LENGTH_BITS + WINDOW_SIZE_BITS <= 32 as it +// is used in VP8LHashChain. +#define MAX_LENGTH_BITS 12 +#define WINDOW_SIZE_BITS 20 +// We want the max value to be attainable and stored in MAX_LENGTH_BITS bits. +#define MAX_LENGTH ((1 << MAX_LENGTH_BITS) - 1) +#if MAX_LENGTH_BITS + WINDOW_SIZE_BITS > 32 +#error "MAX_LENGTH_BITS + WINDOW_SIZE_BITS > 32" +#endif + typedef struct VP8LHashChain VP8LHashChain; struct VP8LHashChain { // The 20 most significant bits contain the offset at which the best match @@ -134,6 +139,24 @@ int VP8LHashChainFill(VP8LHashChain* const p, int quality, int low_effort); void VP8LHashChainClear(VP8LHashChain* const p); // release memory +static WEBP_INLINE int VP8LHashChainFindOffset(const VP8LHashChain* const p, + const int base_position) { + return p->offset_length_[base_position] >> MAX_LENGTH_BITS; +} + +static WEBP_INLINE int VP8LHashChainFindLength(const VP8LHashChain* const p, + const int base_position) { + return p->offset_length_[base_position] & ((1U << MAX_LENGTH_BITS) - 1); +} + +static WEBP_INLINE void VP8LHashChainFindCopy(const VP8LHashChain* const p, + int base_position, + int* const offset_ptr, + int* const length_ptr) { + *offset_ptr = VP8LHashChainFindOffset(p, base_position); + *length_ptr = VP8LHashChainFindLength(p, base_position); +} + // ----------------------------------------------------------------------------- // VP8LBackwardRefs (block-based backward-references storage) @@ -158,9 +181,6 @@ struct VP8LBackwardRefs { void VP8LBackwardRefsInit(VP8LBackwardRefs* const refs, int block_size); // Release memory for backward references. void VP8LBackwardRefsClear(VP8LBackwardRefs* const refs); -// Copies the 'src' backward refs to the 'dst'. Returns 0 in case of error. -int VP8LBackwardRefsCopy(const VP8LBackwardRefs* const src, - VP8LBackwardRefs* const dst); // Cursor for iterating on references content typedef struct { @@ -189,6 +209,12 @@ static WEBP_INLINE void VP8LRefsCursorNext(VP8LRefsCursor* const c) { // ----------------------------------------------------------------------------- // Main entry points +enum VP8LLZ77Type { + kLZ77Standard = 1, + kLZ77RLE = 2, + kLZ77Box = 4 +}; + // Evaluates best possible backward references for specified quality. // The input cache_bits to 'VP8LGetBackwardReferences' sets the maximum cache // bits to use (passing 0 implies disabling the local color cache). @@ -197,11 +223,12 @@ static WEBP_INLINE void VP8LRefsCursorNext(VP8LRefsCursor* const c) { // refs[0] or refs[1]. VP8LBackwardRefs* VP8LGetBackwardReferences( int width, int height, const uint32_t* const argb, int quality, - int low_effort, int* const cache_bits, - const VP8LHashChain* const hash_chain, VP8LBackwardRefs refs[2]); + int low_effort, int lz77_types_to_try, int* const cache_bits, + const VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs_tmp1, + VP8LBackwardRefs* const refs_tmp2); #ifdef __cplusplus } #endif -#endif // WEBP_ENC_BACKWARD_REFERENCES_H_ +#endif // WEBP_ENC_BACKWARD_REFERENCES_ENC_H_ diff --git a/Pods/libwebp/src/enc/config_enc.c b/Pods/libwebp/src/enc/config_enc.c index 4589dc0..9d48289 100644 --- a/Pods/libwebp/src/enc/config_enc.c +++ b/Pods/libwebp/src/enc/config_enc.c @@ -12,10 +12,10 @@ // Author: Skal (pascal.massimino@gmail.com) #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif -#include "../webp/encode.h" +#include "src/webp/encode.h" //------------------------------------------------------------------------------ // WebPConfig diff --git a/Pods/libwebp/src/enc/cost_enc.c b/Pods/libwebp/src/enc/cost_enc.c index c823f5a..48fd9bc 100644 --- a/Pods/libwebp/src/enc/cost_enc.c +++ b/Pods/libwebp/src/enc/cost_enc.c @@ -11,7 +11,7 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./cost_enc.h" +#include "src/enc/cost_enc.h" //------------------------------------------------------------------------------ // Level cost tables diff --git a/Pods/libwebp/src/enc/cost_enc.h b/Pods/libwebp/src/enc/cost_enc.h index 99e4b37..a4b177b 100644 --- a/Pods/libwebp/src/enc/cost_enc.h +++ b/Pods/libwebp/src/enc/cost_enc.h @@ -11,12 +11,12 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_ENC_COST_H_ -#define WEBP_ENC_COST_H_ +#ifndef WEBP_ENC_COST_ENC_H_ +#define WEBP_ENC_COST_ENC_H_ #include #include -#include "./vp8i_enc.h" +#include "src/enc/vp8i_enc.h" #ifdef __cplusplus extern "C" { @@ -79,4 +79,4 @@ extern const uint16_t VP8FixedCostsI4[NUM_BMODES][NUM_BMODES][NUM_BMODES]; } // extern "C" #endif -#endif /* WEBP_ENC_COST_H_ */ +#endif // WEBP_ENC_COST_ENC_H_ diff --git a/Pods/libwebp/src/enc/delta_palettization_enc.c b/Pods/libwebp/src/enc/delta_palettization_enc.c deleted file mode 100644 index eaf0f05..0000000 --- a/Pods/libwebp/src/enc/delta_palettization_enc.c +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the COPYING file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// ----------------------------------------------------------------------------- -// -// Author: Mislav Bradac (mislavm@google.com) -// - -#include "./delta_palettization_enc.h" - -#ifdef WEBP_EXPERIMENTAL_FEATURES -#include "../webp/types.h" -#include "../dsp/lossless.h" - -#define MK_COL(r, g, b) (((r) << 16) + ((g) << 8) + (b)) - -// Format allows palette up to 256 entries, but more palette entries produce -// bigger entropy. In the future it will probably be useful to add more entries -// that are far from the origin of the palette or choose remaining entries -// dynamically. -#define DELTA_PALETTE_SIZE 226 - -// Palette used for delta_palettization. Entries are roughly sorted by distance -// of their signed equivalents from the origin. -static const uint32_t kDeltaPalette[DELTA_PALETTE_SIZE] = { - MK_COL(0u, 0u, 0u), - MK_COL(255u, 255u, 255u), - MK_COL(1u, 1u, 1u), - MK_COL(254u, 254u, 254u), - MK_COL(2u, 2u, 2u), - MK_COL(4u, 4u, 4u), - MK_COL(252u, 252u, 252u), - MK_COL(250u, 0u, 0u), - MK_COL(0u, 250u, 0u), - MK_COL(0u, 0u, 250u), - MK_COL(6u, 0u, 0u), - MK_COL(0u, 6u, 0u), - MK_COL(0u, 0u, 6u), - MK_COL(0u, 0u, 248u), - MK_COL(0u, 0u, 8u), - MK_COL(0u, 248u, 0u), - MK_COL(0u, 248u, 248u), - MK_COL(0u, 248u, 8u), - MK_COL(0u, 8u, 0u), - MK_COL(0u, 8u, 248u), - MK_COL(0u, 8u, 8u), - MK_COL(8u, 8u, 8u), - MK_COL(248u, 0u, 0u), - MK_COL(248u, 0u, 248u), - MK_COL(248u, 0u, 8u), - MK_COL(248u, 248u, 0u), - MK_COL(248u, 8u, 0u), - MK_COL(8u, 0u, 0u), - MK_COL(8u, 0u, 248u), - MK_COL(8u, 0u, 8u), - MK_COL(8u, 248u, 0u), - MK_COL(8u, 8u, 0u), - MK_COL(23u, 23u, 23u), - MK_COL(13u, 13u, 13u), - MK_COL(232u, 232u, 232u), - MK_COL(244u, 244u, 244u), - MK_COL(245u, 245u, 250u), - MK_COL(50u, 50u, 50u), - MK_COL(204u, 204u, 204u), - MK_COL(236u, 236u, 236u), - MK_COL(16u, 16u, 16u), - MK_COL(240u, 16u, 16u), - MK_COL(16u, 240u, 16u), - MK_COL(240u, 240u, 16u), - MK_COL(16u, 16u, 240u), - MK_COL(240u, 16u, 240u), - MK_COL(16u, 240u, 240u), - MK_COL(240u, 240u, 240u), - MK_COL(0u, 0u, 232u), - MK_COL(0u, 232u, 0u), - MK_COL(232u, 0u, 0u), - MK_COL(0u, 0u, 24u), - MK_COL(0u, 24u, 0u), - MK_COL(24u, 0u, 0u), - MK_COL(32u, 32u, 32u), - MK_COL(224u, 32u, 32u), - MK_COL(32u, 224u, 32u), - MK_COL(224u, 224u, 32u), - MK_COL(32u, 32u, 224u), - MK_COL(224u, 32u, 224u), - MK_COL(32u, 224u, 224u), - MK_COL(224u, 224u, 224u), - MK_COL(0u, 0u, 176u), - MK_COL(0u, 0u, 80u), - MK_COL(0u, 176u, 0u), - MK_COL(0u, 176u, 176u), - MK_COL(0u, 176u, 80u), - MK_COL(0u, 80u, 0u), - MK_COL(0u, 80u, 176u), - MK_COL(0u, 80u, 80u), - MK_COL(176u, 0u, 0u), - MK_COL(176u, 0u, 176u), - MK_COL(176u, 0u, 80u), - MK_COL(176u, 176u, 0u), - MK_COL(176u, 80u, 0u), - MK_COL(80u, 0u, 0u), - MK_COL(80u, 0u, 176u), - MK_COL(80u, 0u, 80u), - MK_COL(80u, 176u, 0u), - MK_COL(80u, 80u, 0u), - MK_COL(0u, 0u, 152u), - MK_COL(0u, 0u, 104u), - MK_COL(0u, 152u, 0u), - MK_COL(0u, 152u, 152u), - MK_COL(0u, 152u, 104u), - MK_COL(0u, 104u, 0u), - MK_COL(0u, 104u, 152u), - MK_COL(0u, 104u, 104u), - MK_COL(152u, 0u, 0u), - MK_COL(152u, 0u, 152u), - MK_COL(152u, 0u, 104u), - MK_COL(152u, 152u, 0u), - MK_COL(152u, 104u, 0u), - MK_COL(104u, 0u, 0u), - MK_COL(104u, 0u, 152u), - MK_COL(104u, 0u, 104u), - MK_COL(104u, 152u, 0u), - MK_COL(104u, 104u, 0u), - MK_COL(216u, 216u, 216u), - MK_COL(216u, 216u, 40u), - MK_COL(216u, 216u, 176u), - MK_COL(216u, 216u, 80u), - MK_COL(216u, 40u, 216u), - MK_COL(216u, 40u, 40u), - MK_COL(216u, 40u, 176u), - MK_COL(216u, 40u, 80u), - MK_COL(216u, 176u, 216u), - MK_COL(216u, 176u, 40u), - MK_COL(216u, 176u, 176u), - MK_COL(216u, 176u, 80u), - MK_COL(216u, 80u, 216u), - MK_COL(216u, 80u, 40u), - MK_COL(216u, 80u, 176u), - MK_COL(216u, 80u, 80u), - MK_COL(40u, 216u, 216u), - MK_COL(40u, 216u, 40u), - MK_COL(40u, 216u, 176u), - MK_COL(40u, 216u, 80u), - MK_COL(40u, 40u, 216u), - MK_COL(40u, 40u, 40u), - MK_COL(40u, 40u, 176u), - MK_COL(40u, 40u, 80u), - MK_COL(40u, 176u, 216u), - MK_COL(40u, 176u, 40u), - MK_COL(40u, 176u, 176u), - MK_COL(40u, 176u, 80u), - MK_COL(40u, 80u, 216u), - MK_COL(40u, 80u, 40u), - MK_COL(40u, 80u, 176u), - MK_COL(40u, 80u, 80u), - MK_COL(80u, 216u, 216u), - MK_COL(80u, 216u, 40u), - MK_COL(80u, 216u, 176u), - MK_COL(80u, 216u, 80u), - MK_COL(80u, 40u, 216u), - MK_COL(80u, 40u, 40u), - MK_COL(80u, 40u, 176u), - MK_COL(80u, 40u, 80u), - MK_COL(80u, 176u, 216u), - MK_COL(80u, 176u, 40u), - MK_COL(80u, 176u, 176u), - MK_COL(80u, 176u, 80u), - MK_COL(80u, 80u, 216u), - MK_COL(80u, 80u, 40u), - MK_COL(80u, 80u, 176u), - MK_COL(80u, 80u, 80u), - MK_COL(0u, 0u, 192u), - MK_COL(0u, 0u, 64u), - MK_COL(0u, 0u, 128u), - MK_COL(0u, 192u, 0u), - MK_COL(0u, 192u, 192u), - MK_COL(0u, 192u, 64u), - MK_COL(0u, 192u, 128u), - MK_COL(0u, 64u, 0u), - MK_COL(0u, 64u, 192u), - MK_COL(0u, 64u, 64u), - MK_COL(0u, 64u, 128u), - MK_COL(0u, 128u, 0u), - MK_COL(0u, 128u, 192u), - MK_COL(0u, 128u, 64u), - MK_COL(0u, 128u, 128u), - MK_COL(176u, 216u, 216u), - MK_COL(176u, 216u, 40u), - MK_COL(176u, 216u, 176u), - MK_COL(176u, 216u, 80u), - MK_COL(176u, 40u, 216u), - MK_COL(176u, 40u, 40u), - MK_COL(176u, 40u, 176u), - MK_COL(176u, 40u, 80u), - MK_COL(176u, 176u, 216u), - MK_COL(176u, 176u, 40u), - MK_COL(176u, 176u, 176u), - MK_COL(176u, 176u, 80u), - MK_COL(176u, 80u, 216u), - MK_COL(176u, 80u, 40u), - MK_COL(176u, 80u, 176u), - MK_COL(176u, 80u, 80u), - MK_COL(192u, 0u, 0u), - MK_COL(192u, 0u, 192u), - MK_COL(192u, 0u, 64u), - MK_COL(192u, 0u, 128u), - MK_COL(192u, 192u, 0u), - MK_COL(192u, 192u, 192u), - MK_COL(192u, 192u, 64u), - MK_COL(192u, 192u, 128u), - MK_COL(192u, 64u, 0u), - MK_COL(192u, 64u, 192u), - MK_COL(192u, 64u, 64u), - MK_COL(192u, 64u, 128u), - MK_COL(192u, 128u, 0u), - MK_COL(192u, 128u, 192u), - MK_COL(192u, 128u, 64u), - MK_COL(192u, 128u, 128u), - MK_COL(64u, 0u, 0u), - MK_COL(64u, 0u, 192u), - MK_COL(64u, 0u, 64u), - MK_COL(64u, 0u, 128u), - MK_COL(64u, 192u, 0u), - MK_COL(64u, 192u, 192u), - MK_COL(64u, 192u, 64u), - MK_COL(64u, 192u, 128u), - MK_COL(64u, 64u, 0u), - MK_COL(64u, 64u, 192u), - MK_COL(64u, 64u, 64u), - MK_COL(64u, 64u, 128u), - MK_COL(64u, 128u, 0u), - MK_COL(64u, 128u, 192u), - MK_COL(64u, 128u, 64u), - MK_COL(64u, 128u, 128u), - MK_COL(128u, 0u, 0u), - MK_COL(128u, 0u, 192u), - MK_COL(128u, 0u, 64u), - MK_COL(128u, 0u, 128u), - MK_COL(128u, 192u, 0u), - MK_COL(128u, 192u, 192u), - MK_COL(128u, 192u, 64u), - MK_COL(128u, 192u, 128u), - MK_COL(128u, 64u, 0u), - MK_COL(128u, 64u, 192u), - MK_COL(128u, 64u, 64u), - MK_COL(128u, 64u, 128u), - MK_COL(128u, 128u, 0u), - MK_COL(128u, 128u, 192u), - MK_COL(128u, 128u, 64u), - MK_COL(128u, 128u, 128u), -}; - -#undef MK_COL - -//------------------------------------------------------------------------------ -// TODO(skal): move the functions to dsp/lossless.c when the correct -// granularity is found. For now, we'll just copy-paste some useful bits -// here instead. - -// In-place sum of each component with mod 256. -static WEBP_INLINE void AddPixelsEq(uint32_t* a, uint32_t b) { - const uint32_t alpha_and_green = (*a & 0xff00ff00u) + (b & 0xff00ff00u); - const uint32_t red_and_blue = (*a & 0x00ff00ffu) + (b & 0x00ff00ffu); - *a = (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); -} - -static WEBP_INLINE uint32_t Clip255(uint32_t a) { - if (a < 256) { - return a; - } - // return 0, when a is a negative integer. - // return 255, when a is positive. - return ~a >> 24; -} - -// Delta palettization functions. -static WEBP_INLINE int Square(int x) { - return x * x; -} - -static WEBP_INLINE uint32_t Intensity(uint32_t a) { - return - 30 * ((a >> 16) & 0xff) + - 59 * ((a >> 8) & 0xff) + - 11 * ((a >> 0) & 0xff); -} - -static uint32_t CalcDist(uint32_t predicted_value, uint32_t actual_value, - uint32_t palette_entry) { - int i; - uint32_t distance = 0; - AddPixelsEq(&predicted_value, palette_entry); - for (i = 0; i < 32; i += 8) { - const int32_t av = (actual_value >> i) & 0xff; - const int32_t pv = (predicted_value >> i) & 0xff; - distance += Square(pv - av); - } - // We sum square of intensity difference with factor 10, but because Intensity - // returns 100 times real intensity we need to multiply differences of colors - // by 1000. - distance *= 1000u; - distance += Square(Intensity(predicted_value) - - Intensity(actual_value)); - return distance; -} - -static uint32_t Predict(int x, int y, uint32_t* image) { - const uint32_t t = (y == 0) ? ARGB_BLACK : image[x]; - const uint32_t l = (x == 0) ? ARGB_BLACK : image[x - 1]; - const uint32_t p = - (((((t >> 24) & 0xff) + ((l >> 24) & 0xff)) / 2) << 24) + - (((((t >> 16) & 0xff) + ((l >> 16) & 0xff)) / 2) << 16) + - (((((t >> 8) & 0xff) + ((l >> 8) & 0xff)) / 2) << 8) + - (((((t >> 0) & 0xff) + ((l >> 0) & 0xff)) / 2) << 0); - if (x == 0 && y == 0) return ARGB_BLACK; - if (x == 0) return t; - if (y == 0) return l; - return p; -} - -static WEBP_INLINE int AddSubtractComponentFullWithCoefficient( - int a, int b, int c) { - return Clip255(a + ((b - c) >> 2)); -} - -static WEBP_INLINE uint32_t ClampedAddSubtractFullWithCoefficient( - uint32_t c0, uint32_t c1, uint32_t c2) { - const int a = AddSubtractComponentFullWithCoefficient( - c0 >> 24, c1 >> 24, c2 >> 24); - const int r = AddSubtractComponentFullWithCoefficient((c0 >> 16) & 0xff, - (c1 >> 16) & 0xff, - (c2 >> 16) & 0xff); - const int g = AddSubtractComponentFullWithCoefficient((c0 >> 8) & 0xff, - (c1 >> 8) & 0xff, - (c2 >> 8) & 0xff); - const int b = AddSubtractComponentFullWithCoefficient( - c0 & 0xff, c1 & 0xff, c2 & 0xff); - return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b; -} - -//------------------------------------------------------------------------------ - -// Find palette entry with minimum error from difference of actual pixel value -// and predicted pixel value. Propagate error of pixel to its top and left pixel -// in src array. Write predicted_value + palette_entry to new_image. Return -// index of best palette entry. -static int FindBestPaletteEntry(uint32_t src, uint32_t predicted_value, - const uint32_t palette[], int palette_size) { - int i; - int idx = 0; - uint32_t best_distance = CalcDist(predicted_value, src, palette[0]); - for (i = 1; i < palette_size; ++i) { - const uint32_t distance = CalcDist(predicted_value, src, palette[i]); - if (distance < best_distance) { - best_distance = distance; - idx = i; - } - } - return idx; -} - -static void ApplyBestPaletteEntry(int x, int y, - uint32_t new_value, uint32_t palette_value, - uint32_t* src, int src_stride, - uint32_t* new_image) { - AddPixelsEq(&new_value, palette_value); - if (x > 0) { - src[x - 1] = ClampedAddSubtractFullWithCoefficient(src[x - 1], - new_value, src[x]); - } - if (y > 0) { - src[x - src_stride] = - ClampedAddSubtractFullWithCoefficient(src[x - src_stride], - new_value, src[x]); - } - new_image[x] = new_value; -} - -//------------------------------------------------------------------------------ -// Main entry point - -static WebPEncodingError ApplyDeltaPalette(uint32_t* src, uint32_t* dst, - uint32_t src_stride, - uint32_t dst_stride, - const uint32_t* palette, - int palette_size, - int width, int height, - int num_passes) { - int x, y; - WebPEncodingError err = VP8_ENC_OK; - uint32_t* new_image = (uint32_t*)WebPSafeMalloc(width, sizeof(*new_image)); - uint8_t* const tmp_row = (uint8_t*)WebPSafeMalloc(width, sizeof(*tmp_row)); - if (new_image == NULL || tmp_row == NULL) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - - while (num_passes--) { - uint32_t* cur_src = src; - uint32_t* cur_dst = dst; - for (y = 0; y < height; ++y) { - for (x = 0; x < width; ++x) { - const uint32_t predicted_value = Predict(x, y, new_image); - tmp_row[x] = FindBestPaletteEntry(cur_src[x], predicted_value, - palette, palette_size); - ApplyBestPaletteEntry(x, y, predicted_value, palette[tmp_row[x]], - cur_src, src_stride, new_image); - } - for (x = 0; x < width; ++x) { - cur_dst[x] = palette[tmp_row[x]]; - } - cur_src += src_stride; - cur_dst += dst_stride; - } - } - Error: - WebPSafeFree(new_image); - WebPSafeFree(tmp_row); - return err; -} - -// replaces enc->argb_ by a palettizable approximation of it, -// and generates optimal enc->palette_[] -WebPEncodingError WebPSearchOptimalDeltaPalette(VP8LEncoder* const enc) { - const WebPPicture* const pic = enc->pic_; - uint32_t* src = pic->argb; - uint32_t* dst = enc->argb_; - const int width = pic->width; - const int height = pic->height; - - WebPEncodingError err = VP8_ENC_OK; - memcpy(enc->palette_, kDeltaPalette, sizeof(kDeltaPalette)); - enc->palette_[DELTA_PALETTE_SIZE - 1] = src[0] - 0xff000000u; - enc->palette_size_ = DELTA_PALETTE_SIZE; - err = ApplyDeltaPalette(src, dst, pic->argb_stride, enc->current_width_, - enc->palette_, enc->palette_size_, - width, height, 2); - if (err != VP8_ENC_OK) goto Error; - - Error: - return err; -} - -#else // !WEBP_EXPERIMENTAL_FEATURES - -WebPEncodingError WebPSearchOptimalDeltaPalette(VP8LEncoder* const enc) { - (void)enc; - return VP8_ENC_ERROR_INVALID_CONFIGURATION; -} - -#endif // WEBP_EXPERIMENTAL_FEATURES diff --git a/Pods/libwebp/src/enc/delta_palettization_enc.h b/Pods/libwebp/src/enc/delta_palettization_enc.h deleted file mode 100644 index 63048ec..0000000 --- a/Pods/libwebp/src/enc/delta_palettization_enc.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the COPYING file in the root of the source -// tree. An additional intellectual property rights grant can be found -// in the file PATENTS. All contributing project authors may -// be found in the AUTHORS file in the root of the source tree. -// ----------------------------------------------------------------------------- -// -// Author: Mislav Bradac (mislavm@google.com) -// - -#ifndef WEBP_ENC_DELTA_PALETTIZATION_H_ -#define WEBP_ENC_DELTA_PALETTIZATION_H_ - -#include "../webp/encode.h" -#include "../enc/vp8li_enc.h" - -// Replaces enc->argb_[] input by a palettizable approximation of it, -// and generates optimal enc->palette_[]. -// This function can revert enc->use_palette_ / enc->use_predict_ flag -// if delta-palettization is not producing expected saving. -WebPEncodingError WebPSearchOptimalDeltaPalette(VP8LEncoder* const enc); - -#endif // WEBP_ENC_DELTA_PALETTIZATION_H_ diff --git a/Pods/libwebp/src/enc/filter_enc.c b/Pods/libwebp/src/enc/filter_enc.c index 4bc3672..580800b 100644 --- a/Pods/libwebp/src/enc/filter_enc.c +++ b/Pods/libwebp/src/enc/filter_enc.c @@ -12,8 +12,8 @@ // Author: somnath@google.com (Somnath Banerjee) #include -#include "./vp8i_enc.h" -#include "../dsp/dsp.h" +#include "src/enc/vp8i_enc.h" +#include "src/dsp/dsp.h" // This table gives, for a given sharpness, the filtering strength to be // used (at least) in order to filter a given edge step delta. @@ -65,6 +65,8 @@ int VP8FilterStrengthFromDelta(int sharpness, int delta) { //------------------------------------------------------------------------------ // Paragraph 15.4: compute the inner-edge filtering strength +#if !defined(WEBP_REDUCE_SIZE) + static int GetILevel(int sharpness, int level) { if (sharpness > 0) { if (sharpness > 4) { @@ -129,11 +131,14 @@ static double GetMBSSIM(const uint8_t* yuv1, const uint8_t* yuv2) { return sum; } +#endif // !defined(WEBP_REDUCE_SIZE) + //------------------------------------------------------------------------------ // Exposed APIs: Encoder should call the following 3 functions to adjust // loop filter strength void VP8InitFilter(VP8EncIterator* const it) { +#if !defined(WEBP_REDUCE_SIZE) if (it->lf_stats_ != NULL) { int s, i; for (s = 0; s < NUM_MB_SEGMENTS; s++) { @@ -143,9 +148,13 @@ void VP8InitFilter(VP8EncIterator* const it) { } VP8SSIMDspInit(); } +#else + (void)it; +#endif } void VP8StoreFilterStats(VP8EncIterator* const it) { +#if !defined(WEBP_REDUCE_SIZE) int d; VP8Encoder* const enc = it->enc_; const int s = it->mb_->segment_; @@ -177,10 +186,14 @@ void VP8StoreFilterStats(VP8EncIterator* const it) { DoFilter(it, level); (*it->lf_stats_)[s][level] += GetMBSSIM(it->yuv_in_, it->yuv_out2_); } +#else // defined(WEBP_REDUCE_SIZE) + (void)it; +#endif // !defined(WEBP_REDUCE_SIZE) } void VP8AdjustFilterStrength(VP8EncIterator* const it) { VP8Encoder* const enc = it->enc_; +#if !defined(WEBP_REDUCE_SIZE) if (it->lf_stats_ != NULL) { int s; for (s = 0; s < NUM_MB_SEGMENTS; s++) { @@ -196,7 +209,10 @@ void VP8AdjustFilterStrength(VP8EncIterator* const it) { } enc->dqm_[s].fstrength_ = best_level; } - } else if (enc->config_->filter_strength > 0) { + return; + } +#endif // !defined(WEBP_REDUCE_SIZE) + if (enc->config_->filter_strength > 0) { int max_level = 0; int s; for (s = 0; s < NUM_MB_SEGMENTS; s++) { diff --git a/Pods/libwebp/src/enc/frame_enc.c b/Pods/libwebp/src/enc/frame_enc.c index abef523..1aec376 100644 --- a/Pods/libwebp/src/enc/frame_enc.c +++ b/Pods/libwebp/src/enc/frame_enc.c @@ -14,10 +14,10 @@ #include #include -#include "./cost_enc.h" -#include "./vp8i_enc.h" -#include "../dsp/dsp.h" -#include "../webp/format_constants.h" // RIFF constants +#include "src/enc/cost_enc.h" +#include "src/enc/vp8i_enc.h" +#include "src/dsp/dsp.h" +#include "src/webp/format_constants.h" // RIFF constants #define SEGMENT_VISU 0 #define DEBUG_SEARCH 0 // useful to track search convergence @@ -198,13 +198,15 @@ static void SetSegmentProbas(VP8Encoder* const enc) { for (n = 0; n < enc->mb_w_ * enc->mb_h_; ++n) { const VP8MBInfo* const mb = &enc->mb_info_[n]; - p[mb->segment_]++; + ++p[mb->segment_]; } +#if !defined(WEBP_DISABLE_STATS) if (enc->pic_->stats != NULL) { for (n = 0; n < NUM_MB_SEGMENTS; ++n) { enc->pic_->stats->segment_size[n] = p[n]; } } +#endif if (enc->segment_hdr_.num_segments_ > 1) { uint8_t* const probas = enc->proba_.segments_; probas[0] = GetProba(p[0] + p[1], p[2] + p[3]); @@ -452,6 +454,8 @@ static int RecordTokens(VP8EncIterator* const it, const VP8ModeScore* const rd, //------------------------------------------------------------------------------ // ExtraInfo map / Debug function +#if !defined(WEBP_DISABLE_STATS) + #if SEGMENT_VISU static void SetBlock(uint8_t* p, int value, int size) { int y; @@ -516,6 +520,34 @@ static void StoreSideInfo(const VP8EncIterator* const it) { #endif } +static void ResetSideInfo(const VP8EncIterator* const it) { + VP8Encoder* const enc = it->enc_; + WebPPicture* const pic = enc->pic_; + if (pic->stats != NULL) { + memset(enc->block_count_, 0, sizeof(enc->block_count_)); + } + ResetSSE(enc); +} +#else // defined(WEBP_DISABLE_STATS) +static void ResetSSE(VP8Encoder* const enc) { + (void)enc; +} +static void StoreSideInfo(const VP8EncIterator* const it) { + VP8Encoder* const enc = it->enc_; + WebPPicture* const pic = enc->pic_; + if (pic->extra_info != NULL) { + if (it->x_ == 0 && it->y_ == 0) { // only do it once, at start + memset(pic->extra_info, 0, + enc->mb_w_ * enc->mb_h_ * sizeof(*pic->extra_info)); + } + } +} + +static void ResetSideInfo(const VP8EncIterator* const it) { + (void)it; +} +#endif // !defined(WEBP_DISABLE_STATS) + static double GetPSNR(uint64_t mse, uint64_t size) { return (mse > 0 && size > 0) ? 10. * log10(255. * 255. * size / mse) : 99; } @@ -552,7 +584,7 @@ static uint64_t OneStatPass(VP8Encoder* const enc, VP8RDLevel rd_opt, VP8IteratorImport(&it, NULL); if (VP8Decimate(&it, &info, rd_opt)) { // Just record the number of skips and act like skip_proba is not used. - enc->proba_.nb_skip_++; + ++enc->proba_.nb_skip_; } RecordResiduals(&it, &info); size += info.R + info.H; @@ -640,7 +672,7 @@ static int StatLoop(VP8Encoder* const enc) { // Main loops // -static const int kAverageBytesPerMB[8] = { 50, 24, 16, 9, 7, 5, 3, 2 }; +static const uint8_t kAverageBytesPerMB[8] = { 50, 24, 16, 9, 7, 5, 3, 2 }; static int PreLoopInitialize(VP8Encoder* const enc) { int p; @@ -670,6 +702,7 @@ static int PostLoopFinalize(VP8EncIterator* const it, int ok) { } if (ok) { // All good. Finish up. +#if !defined(WEBP_DISABLE_STATS) if (enc->pic_->stats != NULL) { // finalize byte counters... int i, s; for (i = 0; i <= 2; ++i) { @@ -678,6 +711,7 @@ static int PostLoopFinalize(VP8EncIterator* const it, int ok) { } } } +#endif VP8AdjustFilterStrength(it); // ...and store filter stats. } else { // Something bad happened -> need to do some memory cleanup. @@ -821,6 +855,9 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { if (enc->max_i4_header_bits_ > 0 && size_p0 > PARTITION0_SIZE_LIMIT) { ++num_pass_left; enc->max_i4_header_bits_ >>= 1; // strengthen header bit limitation... + if (is_last_pass) { + ResetSideInfo(&it); + } continue; // ...and start over } if (is_last_pass) { @@ -851,4 +888,3 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { #endif // DISABLE_TOKEN_BUFFER //------------------------------------------------------------------------------ - diff --git a/Pods/libwebp/src/enc/histogram_enc.c b/Pods/libwebp/src/enc/histogram_enc.c index 808b6f7..a4e6bf3 100644 --- a/Pods/libwebp/src/enc/histogram_enc.c +++ b/Pods/libwebp/src/enc/histogram_enc.c @@ -10,16 +10,16 @@ // Author: Jyrki Alakuijala (jyrki@google.com) // #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif #include -#include "./backward_references_enc.h" -#include "./histogram_enc.h" -#include "../dsp/lossless.h" -#include "../dsp/lossless_common.h" -#include "../utils/utils.h" +#include "src/enc/backward_references_enc.h" +#include "src/enc/histogram_enc.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" +#include "src/utils/utils.h" #define MAX_COST 1.e38 @@ -51,10 +51,12 @@ static void HistogramCopy(const VP8LHistogram* const src, VP8LHistogram* const dst) { uint32_t* const dst_literal = dst->literal_; const int dst_cache_bits = dst->palette_code_bits_; + const int literal_size = VP8LHistogramNumCodes(dst_cache_bits); const int histo_size = VP8LGetHistogramSize(dst_cache_bits); assert(src->palette_code_bits_ == dst_cache_bits); memcpy(dst, src, histo_size); dst->literal_ = dst_literal; + memcpy(dst->literal_, src->literal_, literal_size * sizeof(*dst->literal_)); } int VP8LGetHistogramSize(int cache_bits) { @@ -76,7 +78,7 @@ void VP8LHistogramStoreRefs(const VP8LBackwardRefs* const refs, VP8LHistogram* const histo) { VP8LRefsCursor c = VP8LRefsCursorInit(refs); while (VP8LRefsCursorOk(&c)) { - VP8LHistogramAddSinglePixOrCopy(histo, c.cur_pos); + VP8LHistogramAddSinglePixOrCopy(histo, c.cur_pos, NULL, 0); VP8LRefsCursorNext(&c); } } @@ -91,9 +93,19 @@ void VP8LHistogramCreate(VP8LHistogram* const p, VP8LHistogramStoreRefs(refs, p); } -void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits) { +void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits, + int init_arrays) { p->palette_code_bits_ = palette_code_bits; - HistogramClear(p); + if (init_arrays) { + HistogramClear(p); + } else { + p->trivial_symbol_ = 0; + p->bit_cost_ = 0.; + p->literal_cost_ = 0.; + p->red_cost_ = 0.; + p->blue_cost_ = 0.; + memset(p->is_used_, 0, sizeof(p->is_used_)); + } } VP8LHistogram* VP8LAllocateHistogram(int cache_bits) { @@ -104,41 +116,90 @@ VP8LHistogram* VP8LAllocateHistogram(int cache_bits) { histo = (VP8LHistogram*)memory; // literal_ won't necessary be aligned. histo->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram)); - VP8LHistogramInit(histo, cache_bits); + VP8LHistogramInit(histo, cache_bits, /*init_arrays=*/ 0); return histo; } +// Resets the pointers of the histograms to point to the bit buffer in the set. +static void HistogramSetResetPointers(VP8LHistogramSet* const set, + int cache_bits) { + int i; + const int histo_size = VP8LGetHistogramSize(cache_bits); + uint8_t* memory = (uint8_t*) (set->histograms); + memory += set->max_size * sizeof(*set->histograms); + for (i = 0; i < set->max_size; ++i) { + memory = (uint8_t*) WEBP_ALIGN(memory); + set->histograms[i] = (VP8LHistogram*) memory; + // literal_ won't necessary be aligned. + set->histograms[i]->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram)); + memory += histo_size; + } +} + +// Returns the total size of the VP8LHistogramSet. +static size_t HistogramSetTotalSize(int size, int cache_bits) { + const int histo_size = VP8LGetHistogramSize(cache_bits); + return (sizeof(VP8LHistogramSet) + size * (sizeof(VP8LHistogram*) + + histo_size + WEBP_ALIGN_CST)); +} + VP8LHistogramSet* VP8LAllocateHistogramSet(int size, int cache_bits) { int i; VP8LHistogramSet* set; - const int histo_size = VP8LGetHistogramSize(cache_bits); - const size_t total_size = - sizeof(*set) + size * (sizeof(*set->histograms) + - histo_size + WEBP_ALIGN_CST); + const size_t total_size = HistogramSetTotalSize(size, cache_bits); uint8_t* memory = (uint8_t*)WebPSafeMalloc(total_size, sizeof(*memory)); if (memory == NULL) return NULL; set = (VP8LHistogramSet*)memory; memory += sizeof(*set); set->histograms = (VP8LHistogram**)memory; - memory += size * sizeof(*set->histograms); set->max_size = size; set->size = size; + HistogramSetResetPointers(set, cache_bits); for (i = 0; i < size; ++i) { - memory = (uint8_t*)WEBP_ALIGN(memory); - set->histograms[i] = (VP8LHistogram*)memory; - // literal_ won't necessary be aligned. - set->histograms[i]->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram)); - VP8LHistogramInit(set->histograms[i], cache_bits); - memory += histo_size; + VP8LHistogramInit(set->histograms[i], cache_bits, /*init_arrays=*/ 0); } return set; } +void VP8LHistogramSetClear(VP8LHistogramSet* const set) { + int i; + const int cache_bits = set->histograms[0]->palette_code_bits_; + const int size = set->max_size; + const size_t total_size = HistogramSetTotalSize(size, cache_bits); + uint8_t* memory = (uint8_t*)set; + + memset(memory, 0, total_size); + memory += sizeof(*set); + set->histograms = (VP8LHistogram**)memory; + set->max_size = size; + set->size = size; + HistogramSetResetPointers(set, cache_bits); + for (i = 0; i < size; ++i) { + set->histograms[i]->palette_code_bits_ = cache_bits; + } +} + +// Removes the histogram 'i' from 'set' by setting it to NULL. +static void HistogramSetRemoveHistogram(VP8LHistogramSet* const set, int i, + int* const num_used) { + assert(set->histograms[i] != NULL); + set->histograms[i] = NULL; + --*num_used; + // If we remove the last valid one, shrink until the next valid one. + if (i == set->size - 1) { + while (set->size >= 1 && set->histograms[set->size - 1] == NULL) { + --set->size; + } + } +} + // ----------------------------------------------------------------------------- void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo, - const PixOrCopy* const v) { + const PixOrCopy* const v, + int (*const distance_modifier)(int, int), + int distance_modifier_arg0) { if (PixOrCopyIsLiteral(v)) { ++histo->alpha_[PixOrCopyLiteral(v, 3)]; ++histo->red_[PixOrCopyLiteral(v, 2)]; @@ -152,7 +213,13 @@ void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo, int code, extra_bits; VP8LPrefixEncodeBits(PixOrCopyLength(v), &code, &extra_bits); ++histo->literal_[NUM_LITERAL_CODES + code]; - VP8LPrefixEncodeBits(PixOrCopyDistance(v), &code, &extra_bits); + if (distance_modifier == NULL) { + VP8LPrefixEncodeBits(PixOrCopyDistance(v), &code, &extra_bits); + } else { + VP8LPrefixEncodeBits( + distance_modifier(distance_modifier_arg0, PixOrCopyDistance(v)), + &code, &extra_bits); + } ++histo->distance_[code]; } } @@ -192,14 +259,9 @@ static WEBP_INLINE double BitsEntropyRefine(const VP8LBitEntropy* entropy) { } } -double VP8LBitsEntropy(const uint32_t* const array, int n, - uint32_t* const trivial_symbol) { +double VP8LBitsEntropy(const uint32_t* const array, int n) { VP8LBitEntropy entropy; VP8LBitsEntropyUnrefined(array, n, &entropy); - if (trivial_symbol != NULL) { - *trivial_symbol = - (entropy.nonzeros == 1) ? entropy.nonzero_code : VP8L_NON_TRIVIAL_SYM; - } return BitsEntropyRefine(&entropy); } @@ -234,7 +296,8 @@ static double FinalHuffmanCost(const VP8LStreaks* const stats) { // Get the symbol entropy for the distribution 'population'. // Set 'trivial_sym', if there's only one symbol present in the distribution. static double PopulationCost(const uint32_t* const population, int length, - uint32_t* const trivial_sym) { + uint32_t* const trivial_sym, + uint8_t* const is_used) { VP8LBitEntropy bit_entropy; VP8LStreaks stats; VP8LGetEntropyUnrefined(population, length, &bit_entropy, &stats); @@ -242,6 +305,8 @@ static double PopulationCost(const uint32_t* const population, int length, *trivial_sym = (bit_entropy.nonzeros == 1) ? bit_entropy.nonzero_code : VP8L_NON_TRIVIAL_SYM; } + // The histogram is used if there is at least one non-zero streak. + *is_used = (stats.streaks[1][0] != 0 || stats.streaks[1][1] != 0); return BitsEntropyRefine(&bit_entropy) + FinalHuffmanCost(&stats); } @@ -250,7 +315,9 @@ static double PopulationCost(const uint32_t* const population, int length, // non-zero: both the zero-th one, or both the last one. static WEBP_INLINE double GetCombinedEntropy(const uint32_t* const X, const uint32_t* const Y, - int length, int trivial_at_end) { + int length, int is_X_used, + int is_Y_used, + int trivial_at_end) { VP8LStreaks stats; if (trivial_at_end) { // This configuration is due to palettization that transforms an indexed @@ -259,28 +326,43 @@ static WEBP_INLINE double GetCombinedEntropy(const uint32_t* const X, // Only FinalHuffmanCost needs to be evaluated. memset(&stats, 0, sizeof(stats)); // Deal with the non-zero value at index 0 or length-1. - stats.streaks[1][0] += 1; + stats.streaks[1][0] = 1; // Deal with the following/previous zero streak. - stats.counts[0] += 1; - stats.streaks[0][1] += length - 1; + stats.counts[0] = 1; + stats.streaks[0][1] = length - 1; return FinalHuffmanCost(&stats); } else { VP8LBitEntropy bit_entropy; - VP8LGetCombinedEntropyUnrefined(X, Y, length, &bit_entropy, &stats); + if (is_X_used) { + if (is_Y_used) { + VP8LGetCombinedEntropyUnrefined(X, Y, length, &bit_entropy, &stats); + } else { + VP8LGetEntropyUnrefined(X, length, &bit_entropy, &stats); + } + } else { + if (is_Y_used) { + VP8LGetEntropyUnrefined(Y, length, &bit_entropy, &stats); + } else { + memset(&stats, 0, sizeof(stats)); + stats.counts[0] = 1; + stats.streaks[0][length > 3] = length; + VP8LBitEntropyInit(&bit_entropy); + } + } return BitsEntropyRefine(&bit_entropy) + FinalHuffmanCost(&stats); } } // Estimates the Entropy + Huffman + other block overhead size cost. -double VP8LHistogramEstimateBits(const VP8LHistogram* const p) { +double VP8LHistogramEstimateBits(VP8LHistogram* const p) { return - PopulationCost( - p->literal_, VP8LHistogramNumCodes(p->palette_code_bits_), NULL) - + PopulationCost(p->red_, NUM_LITERAL_CODES, NULL) - + PopulationCost(p->blue_, NUM_LITERAL_CODES, NULL) - + PopulationCost(p->alpha_, NUM_LITERAL_CODES, NULL) - + PopulationCost(p->distance_, NUM_DISTANCE_CODES, NULL) + PopulationCost(p->literal_, VP8LHistogramNumCodes(p->palette_code_bits_), + NULL, &p->is_used_[0]) + + PopulationCost(p->red_, NUM_LITERAL_CODES, NULL, &p->is_used_[1]) + + PopulationCost(p->blue_, NUM_LITERAL_CODES, NULL, &p->is_used_[2]) + + PopulationCost(p->alpha_, NUM_LITERAL_CODES, NULL, &p->is_used_[3]) + + PopulationCost(p->distance_, NUM_DISTANCE_CODES, NULL, &p->is_used_[4]) + VP8LExtraCost(p->literal_ + NUM_LITERAL_CODES, NUM_LENGTH_CODES) + VP8LExtraCost(p->distance_, NUM_DISTANCE_CODES); } @@ -296,7 +378,8 @@ static int GetCombinedHistogramEntropy(const VP8LHistogram* const a, int trivial_at_end = 0; assert(a->palette_code_bits_ == b->palette_code_bits_); *cost += GetCombinedEntropy(a->literal_, b->literal_, - VP8LHistogramNumCodes(palette_code_bits), 0); + VP8LHistogramNumCodes(palette_code_bits), + a->is_used_[0], b->is_used_[0], 0); *cost += VP8LExtraCostCombined(a->literal_ + NUM_LITERAL_CODES, b->literal_ + NUM_LITERAL_CODES, NUM_LENGTH_CODES); @@ -316,19 +399,23 @@ static int GetCombinedHistogramEntropy(const VP8LHistogram* const a, } *cost += - GetCombinedEntropy(a->red_, b->red_, NUM_LITERAL_CODES, trivial_at_end); + GetCombinedEntropy(a->red_, b->red_, NUM_LITERAL_CODES, a->is_used_[1], + b->is_used_[1], trivial_at_end); if (*cost > cost_threshold) return 0; *cost += - GetCombinedEntropy(a->blue_, b->blue_, NUM_LITERAL_CODES, trivial_at_end); + GetCombinedEntropy(a->blue_, b->blue_, NUM_LITERAL_CODES, a->is_used_[2], + b->is_used_[2], trivial_at_end); if (*cost > cost_threshold) return 0; - *cost += GetCombinedEntropy(a->alpha_, b->alpha_, NUM_LITERAL_CODES, - trivial_at_end); + *cost += + GetCombinedEntropy(a->alpha_, b->alpha_, NUM_LITERAL_CODES, + a->is_used_[3], b->is_used_[3], trivial_at_end); if (*cost > cost_threshold) return 0; *cost += - GetCombinedEntropy(a->distance_, b->distance_, NUM_DISTANCE_CODES, 0); + GetCombinedEntropy(a->distance_, b->distance_, NUM_DISTANCE_CODES, + a->is_used_[4], b->is_used_[4], 0); *cost += VP8LExtraCostCombined(a->distance_, b->distance_, NUM_DISTANCE_CODES); if (*cost > cost_threshold) return 0; @@ -374,7 +461,9 @@ static double HistogramAddEval(const VP8LHistogram* const a, static double HistogramAddThresh(const VP8LHistogram* const a, const VP8LHistogram* const b, double cost_threshold) { - double cost = -a->bit_cost_; + double cost; + assert(a != NULL && b != NULL); + cost = -a->bit_cost_; GetCombinedHistogramEntropy(a, b, cost_threshold, &cost); return cost; } @@ -416,16 +505,19 @@ static void UpdateDominantCostRange( static void UpdateHistogramCost(VP8LHistogram* const h) { uint32_t alpha_sym, red_sym, blue_sym; const double alpha_cost = - PopulationCost(h->alpha_, NUM_LITERAL_CODES, &alpha_sym); + PopulationCost(h->alpha_, NUM_LITERAL_CODES, &alpha_sym, + &h->is_used_[3]); const double distance_cost = - PopulationCost(h->distance_, NUM_DISTANCE_CODES, NULL) + + PopulationCost(h->distance_, NUM_DISTANCE_CODES, NULL, &h->is_used_[4]) + VP8LExtraCost(h->distance_, NUM_DISTANCE_CODES); const int num_codes = VP8LHistogramNumCodes(h->palette_code_bits_); - h->literal_cost_ = PopulationCost(h->literal_, num_codes, NULL) + - VP8LExtraCost(h->literal_ + NUM_LITERAL_CODES, - NUM_LENGTH_CODES); - h->red_cost_ = PopulationCost(h->red_, NUM_LITERAL_CODES, &red_sym); - h->blue_cost_ = PopulationCost(h->blue_, NUM_LITERAL_CODES, &blue_sym); + h->literal_cost_ = + PopulationCost(h->literal_, num_codes, NULL, &h->is_used_[0]) + + VP8LExtraCost(h->literal_ + NUM_LITERAL_CODES, NUM_LENGTH_CODES); + h->red_cost_ = + PopulationCost(h->red_, NUM_LITERAL_CODES, &red_sym, &h->is_used_[1]); + h->blue_cost_ = + PopulationCost(h->blue_, NUM_LITERAL_CODES, &blue_sym, &h->is_used_[2]); h->bit_cost_ = h->literal_cost_ + h->red_cost_ + h->blue_cost_ + alpha_cost + distance_cost; if ((alpha_sym | red_sym | blue_sym) == VP8L_NON_TRIVIAL_SYM) { @@ -470,10 +562,11 @@ static void HistogramBuild( VP8LHistogram** const histograms = image_histo->histograms; VP8LRefsCursor c = VP8LRefsCursorInit(backward_refs); assert(histo_bits > 0); + VP8LHistogramSetClear(image_histo); while (VP8LRefsCursorOk(&c)) { const PixOrCopy* const v = c.cur_pos; const int ix = (y >> histo_bits) * histo_xsize + (x >> histo_bits); - VP8LHistogramAddSinglePixOrCopy(histograms[ix], v); + VP8LHistogramAddSinglePixOrCopy(histograms[ix], v, NULL, 0); x += PixOrCopyLength(v); while (x >= xsize) { x -= xsize; @@ -484,17 +577,37 @@ static void HistogramBuild( } // Copies the histograms and computes its bit_cost. -static void HistogramCopyAndAnalyze( - VP8LHistogramSet* const orig_histo, VP8LHistogramSet* const image_histo) { - int i; - const int histo_size = orig_histo->size; +static const uint16_t kInvalidHistogramSymbol = (uint16_t)(-1); +static void HistogramCopyAndAnalyze(VP8LHistogramSet* const orig_histo, + VP8LHistogramSet* const image_histo, + int* const num_used, + uint16_t* const histogram_symbols) { + int i, cluster_id; + int num_used_orig = *num_used; VP8LHistogram** const orig_histograms = orig_histo->histograms; VP8LHistogram** const histograms = image_histo->histograms; - for (i = 0; i < histo_size; ++i) { + assert(image_histo->max_size == orig_histo->max_size); + for (cluster_id = 0, i = 0; i < orig_histo->max_size; ++i) { VP8LHistogram* const histo = orig_histograms[i]; UpdateHistogramCost(histo); - // Copy histograms from orig_histo[] to image_histo[]. - HistogramCopy(histo, histograms[i]); + + // Skip the histogram if it is completely empty, which can happen for tiles + // with no information (when they are skipped because of LZ77). + if (!histo->is_used_[0] && !histo->is_used_[1] && !histo->is_used_[2] + && !histo->is_used_[3] && !histo->is_used_[4]) { + // The first histogram is always used. If an histogram is empty, we set + // its id to be the same as the previous one: this will improve + // compressibility for later LZ77. + assert(i > 0); + HistogramSetRemoveHistogram(image_histo, i, num_used); + HistogramSetRemoveHistogram(orig_histo, i, &num_used_orig); + histogram_symbols[i] = kInvalidHistogramSymbol; + } else { + // Copy histograms from orig_histo[] to image_histo[]. + HistogramCopy(histo, histograms[i]); + histogram_symbols[i] = cluster_id++; + assert(cluster_id <= image_histo->max_size); + } } } @@ -511,28 +624,33 @@ static void HistogramAnalyzeEntropyBin(VP8LHistogramSet* const image_histo, // Analyze the dominant (literal, red and blue) entropy costs. for (i = 0; i < histo_size; ++i) { + if (histograms[i] == NULL) continue; UpdateDominantCostRange(histograms[i], &cost_range); } // bin-hash histograms on three of the dominant (literal, red and blue) // symbol costs and store the resulting bin_id for each histogram. for (i = 0; i < histo_size; ++i) { + // bin_map[i] is not set to a special value as its use will later be guarded + // by another (histograms[i] == NULL). + if (histograms[i] == NULL) continue; bin_map[i] = GetHistoBinIndex(histograms[i], &cost_range, low_effort); } } -// Compact image_histo[] by merging some histograms with same bin_id together if -// it's advantageous. -static VP8LHistogram* HistogramCombineEntropyBin( - VP8LHistogramSet* const image_histo, - VP8LHistogram* cur_combo, - const uint16_t* const bin_map, int bin_map_size, int num_bins, - double combine_cost_factor, int low_effort) { +// Merges some histograms with same bin_id together if it's advantageous. +// Sets the remaining histograms to NULL. +static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo, + int* num_used, + const uint16_t* const clusters, + uint16_t* const cluster_mappings, + VP8LHistogram* cur_combo, + const uint16_t* const bin_map, + int num_bins, + double combine_cost_factor, + int low_effort) { VP8LHistogram** const histograms = image_histo->histograms; int idx; - // Work in-place: processed histograms are put at the beginning of - // image_histo[]. At the end, we just have to truncate the array. - int size = 0; struct { int16_t first; // position of the histogram that accumulates all // histograms with the same bin_id @@ -545,16 +663,19 @@ static VP8LHistogram* HistogramCombineEntropyBin( bin_info[idx].num_combine_failures = 0; } - for (idx = 0; idx < bin_map_size; ++idx) { - const int bin_id = bin_map[idx]; - const int first = bin_info[bin_id].first; - assert(size <= idx); + // By default, a cluster matches itself. + for (idx = 0; idx < *num_used; ++idx) cluster_mappings[idx] = idx; + for (idx = 0; idx < image_histo->size; ++idx) { + int bin_id, first; + if (histograms[idx] == NULL) continue; + bin_id = bin_map[idx]; + first = bin_info[bin_id].first; if (first == -1) { - // just move histogram #idx to its final position - histograms[size] = histograms[idx]; - bin_info[bin_id].first = size++; + bin_info[bin_id].first = idx; } else if (low_effort) { HistogramAdd(histograms[idx], histograms[first], histograms[first]); + HistogramSetRemoveHistogram(image_histo, idx, num_used); + cluster_mappings[clusters[idx]] = clusters[first]; } else { // try to merge #idx into #first (both share the same bin_id) const double bit_cost = histograms[idx]->bit_cost_; @@ -577,30 +698,28 @@ static VP8LHistogram* HistogramCombineEntropyBin( bin_info[bin_id].num_combine_failures >= max_combine_failures) { // move the (better) merged histogram to its final slot HistogramSwap(&cur_combo, &histograms[first]); + HistogramSetRemoveHistogram(image_histo, idx, num_used); + cluster_mappings[clusters[idx]] = clusters[first]; } else { - histograms[size++] = histograms[idx]; ++bin_info[bin_id].num_combine_failures; } - } else { - histograms[size++] = histograms[idx]; } } } - image_histo->size = size; if (low_effort) { // for low_effort case, update the final cost when everything is merged - for (idx = 0; idx < size; ++idx) { + for (idx = 0; idx < image_histo->size; ++idx) { + if (histograms[idx] == NULL) continue; UpdateHistogramCost(histograms[idx]); } } - return cur_combo; } +// Implement a Lehmer random number generator with a multiplicative constant of +// 48271 and a modulo constant of 2^31 - 1. static uint32_t MyRand(uint32_t* const seed) { - *seed = (*seed * 16807ull) & 0xffffffffu; - if (*seed == 0) { - *seed = 1; - } + *seed = (uint32_t)(((uint64_t)(*seed) * 48271u) % 2147483647u); + assert(*seed > 0); return *seed; } @@ -621,16 +740,9 @@ typedef struct { int max_size; } HistoQueue; -static int HistoQueueInit(HistoQueue* const histo_queue, const int max_index) { +static int HistoQueueInit(HistoQueue* const histo_queue, const int max_size) { histo_queue->size = 0; - // max_index^2 for the queue size is safe. If you look at - // HistogramCombineGreedy, and imagine that UpdateQueueFront always pushes - // data to the queue, you insert at most: - // - max_index*(max_index-1)/2 (the first two for loops) - // - max_index - 1 in the last for loop at the first iteration of the while - // loop, max_index - 2 at the second iteration ... therefore - // max_index*(max_index-1)/2 overall too - histo_queue->max_size = max_index * max_index; + histo_queue->max_size = max_size; // We allocate max_size + 1 because the last element at index "size" is // used as temporary data (and it could be up to max_size). histo_queue->queue = (HistogramPair*)WebPSafeMalloc( @@ -641,249 +753,319 @@ static int HistoQueueInit(HistoQueue* const histo_queue, const int max_index) { static void HistoQueueClear(HistoQueue* const histo_queue) { assert(histo_queue != NULL); WebPSafeFree(histo_queue->queue); + histo_queue->size = 0; + histo_queue->max_size = 0; } -static void SwapHistogramPairs(HistogramPair *p1, - HistogramPair *p2) { - const HistogramPair tmp = *p1; - *p1 = *p2; - *p2 = tmp; +// Pop a specific pair in the queue by replacing it with the last one +// and shrinking the queue. +static void HistoQueuePopPair(HistoQueue* const histo_queue, + HistogramPair* const pair) { + assert(pair >= histo_queue->queue && + pair < (histo_queue->queue + histo_queue->size)); + assert(histo_queue->size > 0); + *pair = histo_queue->queue[histo_queue->size - 1]; + --histo_queue->size; } -// Given a valid priority queue in range [0, queue_size) this function checks -// whether histo_queue[queue_size] should be accepted and swaps it with the -// front if it is smaller. Otherwise, it leaves it as is. -static void UpdateQueueFront(HistoQueue* const histo_queue) { - if (histo_queue->queue[histo_queue->size].cost_diff >= 0) return; - - if (histo_queue->queue[histo_queue->size].cost_diff < - histo_queue->queue[0].cost_diff) { - SwapHistogramPairs(histo_queue->queue, - histo_queue->queue + histo_queue->size); +// Check whether a pair in the queue should be updated as head or not. +static void HistoQueueUpdateHead(HistoQueue* const histo_queue, + HistogramPair* const pair) { + assert(pair->cost_diff < 0.); + assert(pair >= histo_queue->queue && + pair < (histo_queue->queue + histo_queue->size)); + assert(histo_queue->size > 0); + if (pair->cost_diff < histo_queue->queue[0].cost_diff) { + // Replace the best pair. + const HistogramPair tmp = histo_queue->queue[0]; + histo_queue->queue[0] = *pair; + *pair = tmp; } - ++histo_queue->size; - - // We cannot add more elements than the capacity. - // The allocation adds an extra element to the official capacity so that - // histo_queue->queue[histo_queue->max_size] is read/written within bound. - assert(histo_queue->size <= histo_queue->max_size); } -// ----------------------------------------------------------------------------- - -static void PreparePair(VP8LHistogram** histograms, int idx1, int idx2, - HistogramPair* const pair) { - VP8LHistogram* h1; - VP8LHistogram* h2; - double sum_cost; +// Update the cost diff and combo of a pair of histograms. This needs to be +// called when the the histograms have been merged with a third one. +static void HistoQueueUpdatePair(const VP8LHistogram* const h1, + const VP8LHistogram* const h2, + double threshold, + HistogramPair* const pair) { + const double sum_cost = h1->bit_cost_ + h2->bit_cost_; + pair->cost_combo = 0.; + GetCombinedHistogramEntropy(h1, h2, sum_cost + threshold, &pair->cost_combo); + pair->cost_diff = pair->cost_combo - sum_cost; +} +// Create a pair from indices "idx1" and "idx2" provided its cost +// is inferior to "threshold", a negative entropy. +// It returns the cost of the pair, or 0. if it superior to threshold. +static double HistoQueuePush(HistoQueue* const histo_queue, + VP8LHistogram** const histograms, int idx1, + int idx2, double threshold) { + const VP8LHistogram* h1; + const VP8LHistogram* h2; + HistogramPair pair; + + // Stop here if the queue is full. + if (histo_queue->size == histo_queue->max_size) return 0.; + assert(threshold <= 0.); if (idx1 > idx2) { const int tmp = idx2; idx2 = idx1; idx1 = tmp; } - pair->idx1 = idx1; - pair->idx2 = idx2; + pair.idx1 = idx1; + pair.idx2 = idx2; h1 = histograms[idx1]; h2 = histograms[idx2]; - sum_cost = h1->bit_cost_ + h2->bit_cost_; - pair->cost_combo = 0.; - GetCombinedHistogramEntropy(h1, h2, sum_cost, &pair->cost_combo); - pair->cost_diff = pair->cost_combo - sum_cost; + + HistoQueueUpdatePair(h1, h2, threshold, &pair); + + // Do not even consider the pair if it does not improve the entropy. + if (pair.cost_diff >= threshold) return 0.; + + histo_queue->queue[histo_queue->size++] = pair; + HistoQueueUpdateHead(histo_queue, &histo_queue->queue[histo_queue->size - 1]); + + return pair.cost_diff; } +// ----------------------------------------------------------------------------- + // Combines histograms by continuously choosing the one with the highest cost // reduction. -static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo) { +static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo, + int* const num_used) { int ok = 0; - int image_histo_size = image_histo->size; + const int image_histo_size = image_histo->size; int i, j; VP8LHistogram** const histograms = image_histo->histograms; - // Indexes of remaining histograms. - int* const clusters = - (int*)WebPSafeMalloc(image_histo_size, sizeof(*clusters)); // Priority queue of histogram pairs. HistoQueue histo_queue; - if (!HistoQueueInit(&histo_queue, image_histo_size) || clusters == NULL) { + // image_histo_size^2 for the queue size is safe. If you look at + // HistogramCombineGreedy, and imagine that UpdateQueueFront always pushes + // data to the queue, you insert at most: + // - image_histo_size*(image_histo_size-1)/2 (the first two for loops) + // - image_histo_size - 1 in the last for loop at the first iteration of + // the while loop, image_histo_size - 2 at the second iteration ... + // therefore image_histo_size*(image_histo_size-1)/2 overall too + if (!HistoQueueInit(&histo_queue, image_histo_size * image_histo_size)) { goto End; } for (i = 0; i < image_histo_size; ++i) { - // Initialize clusters indexes. - clusters[i] = i; + if (image_histo->histograms[i] == NULL) continue; for (j = i + 1; j < image_histo_size; ++j) { - // Initialize positions array. - PreparePair(histograms, i, j, &histo_queue.queue[histo_queue.size]); - UpdateQueueFront(&histo_queue); + // Initialize queue. + if (image_histo->histograms[j] == NULL) continue; + HistoQueuePush(&histo_queue, histograms, i, j, 0.); } } - while (image_histo_size > 1 && histo_queue.size > 0) { - HistogramPair* copy_to; + while (histo_queue.size > 0) { const int idx1 = histo_queue.queue[0].idx1; const int idx2 = histo_queue.queue[0].idx2; HistogramAdd(histograms[idx2], histograms[idx1], histograms[idx1]); histograms[idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; + // Remove merged histogram. - for (i = 0; i + 1 < image_histo_size; ++i) { - if (clusters[i] >= idx2) { - clusters[i] = clusters[i + 1]; - } - } - --image_histo_size; + HistogramSetRemoveHistogram(image_histo, idx2, num_used); - // Remove pairs intersecting the just combined best pair. This will - // therefore pop the head of the queue. - copy_to = histo_queue.queue; - for (i = 0; i < histo_queue.size; ++i) { + // Remove pairs intersecting the just combined best pair. + for (i = 0; i < histo_queue.size;) { HistogramPair* const p = histo_queue.queue + i; if (p->idx1 == idx1 || p->idx2 == idx1 || p->idx1 == idx2 || p->idx2 == idx2) { - // Do not copy the invalid pair. - continue; - } - if (p->cost_diff < histo_queue.queue[0].cost_diff) { - // Replace the top of the queue if we found better. - SwapHistogramPairs(histo_queue.queue, p); + HistoQueuePopPair(&histo_queue, p); + } else { + HistoQueueUpdateHead(&histo_queue, p); + ++i; } - SwapHistogramPairs(copy_to, p); - ++copy_to; } - histo_queue.size = (int)(copy_to - histo_queue.queue); // Push new pairs formed with combined histogram to the queue. - for (i = 0; i < image_histo_size; ++i) { - if (clusters[i] != idx1) { - PreparePair(histograms, idx1, clusters[i], - &histo_queue.queue[histo_queue.size]); - UpdateQueueFront(&histo_queue); - } - } - } - // Move remaining histograms to the beginning of the array. - for (i = 0; i < image_histo_size; ++i) { - if (i != clusters[i]) { // swap the two histograms - HistogramSwap(&histograms[i], &histograms[clusters[i]]); + for (i = 0; i < image_histo->size; ++i) { + if (i == idx1 || image_histo->histograms[i] == NULL) continue; + HistoQueuePush(&histo_queue, image_histo->histograms, idx1, i, 0.); } } - image_histo->size = image_histo_size; ok = 1; End: - WebPSafeFree(clusters); HistoQueueClear(&histo_queue); return ok; } -static void HistogramCombineStochastic(VP8LHistogramSet* const image_histo, - VP8LHistogram* tmp_histo, - VP8LHistogram* best_combo, - int quality, int min_cluster_size) { - int iter; - uint32_t seed = 0; +// Perform histogram aggregation using a stochastic approach. +// 'do_greedy' is set to 1 if a greedy approach needs to be performed +// afterwards, 0 otherwise. +static int PairComparison(const void* idx1, const void* idx2) { + // To be used with bsearch: <0 when *idx1<*idx2, >0 if >, 0 when ==. + return (*(int*) idx1 - *(int*) idx2); +} +static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo, + int* const num_used, int min_cluster_size, + int* const do_greedy) { + int j, iter; + uint32_t seed = 1; int tries_with_no_success = 0; - int image_histo_size = image_histo->size; - const int iter_mult = (quality < 25) ? 2 : 2 + (quality - 25) / 8; - const int outer_iters = image_histo_size * iter_mult; - const int num_pairs = image_histo_size / 2; + const int outer_iters = *num_used; const int num_tries_no_success = outer_iters / 2; - int idx2_max = image_histo_size - 1; - int do_brute_dorce = 0; VP8LHistogram** const histograms = image_histo->histograms; + // Priority queue of histogram pairs. Its size of 'kHistoQueueSize' + // impacts the quality of the compression and the speed: the smaller the + // faster but the worse for the compression. + HistoQueue histo_queue; + const int kHistoQueueSize = 9; + int ok = 0; + // mapping from an index in image_histo with no NULL histogram to the full + // blown image_histo. + int* mappings; + + if (*num_used < min_cluster_size) { + *do_greedy = 1; + return 1; + } + + mappings = (int*) WebPSafeMalloc(*num_used, sizeof(*mappings)); + if (mappings == NULL) return 0; + if (!HistoQueueInit(&histo_queue, kHistoQueueSize)) goto End; + // Fill the initial mapping. + for (j = 0, iter = 0; iter < image_histo->size; ++iter) { + if (histograms[iter] == NULL) continue; + mappings[j++] = iter; + } + assert(j == *num_used); // Collapse similar histograms in 'image_histo'. - ++min_cluster_size; for (iter = 0; - iter < outer_iters && image_histo_size >= min_cluster_size; + iter < outer_iters && *num_used >= min_cluster_size && + ++tries_with_no_success < num_tries_no_success; ++iter) { - double best_cost_diff = 0.; + int* mapping_index; + double best_cost = + (histo_queue.size == 0) ? 0. : histo_queue.queue[0].cost_diff; int best_idx1 = -1, best_idx2 = 1; - int j; - int num_tries = - (num_pairs < image_histo_size) ? num_pairs : image_histo_size; - // Use a brute force approach if: - // - stochastic has not worked for a while and - // - if the number of iterations for brute force is less than the number of - // iterations if we never find a match ever again stochastically (hence - // num_tries times the number of remaining outer iterations). - do_brute_dorce = - (tries_with_no_success > 10) && - (idx2_max * (idx2_max + 1) < 2 * num_tries * (outer_iters - iter)); - if (do_brute_dorce) num_tries = idx2_max; - - seed += iter; - for (j = 0; j < num_tries; ++j) { - double curr_cost_diff; - // Choose two histograms at random and try to combine them. - uint32_t idx1, idx2; - if (do_brute_dorce) { - // Use a brute force approach. - idx1 = (uint32_t)j; - idx2 = (uint32_t)idx2_max; - } else { - const uint32_t tmp = (j & 7) + 1; - const uint32_t diff = - (tmp < 3) ? tmp : MyRand(&seed) % (image_histo_size - 1); - idx1 = MyRand(&seed) % image_histo_size; - idx2 = (idx1 + diff + 1) % image_histo_size; - if (idx1 == idx2) { - continue; - } - } - - // Calculate cost reduction on combining. - curr_cost_diff = HistogramAddEval(histograms[idx1], histograms[idx2], - tmp_histo, best_cost_diff); - if (curr_cost_diff < best_cost_diff) { // found a better pair? - HistogramSwap(&best_combo, &tmp_histo); - best_cost_diff = curr_cost_diff; - best_idx1 = idx1; - best_idx2 = idx2; + const uint32_t rand_range = (*num_used - 1) * (*num_used); + // (*num_used) / 2 was chosen empirically. Less means faster but worse + // compression. + const int num_tries = (*num_used) / 2; + + // Pick random samples. + for (j = 0; *num_used >= 2 && j < num_tries; ++j) { + double curr_cost; + // Choose two different histograms at random and try to combine them. + const uint32_t tmp = MyRand(&seed) % rand_range; + uint32_t idx1 = tmp / (*num_used - 1); + uint32_t idx2 = tmp % (*num_used - 1); + if (idx2 >= idx1) ++idx2; + idx1 = mappings[idx1]; + idx2 = mappings[idx2]; + + // Calculate cost reduction on combination. + curr_cost = + HistoQueuePush(&histo_queue, histograms, idx1, idx2, best_cost); + if (curr_cost < 0) { // found a better pair? + best_cost = curr_cost; + // Empty the queue if we reached full capacity. + if (histo_queue.size == histo_queue.max_size) break; } } - if (do_brute_dorce) --idx2_max; - - if (best_idx1 >= 0) { - HistogramSwap(&best_combo, &histograms[best_idx1]); - // swap best_idx2 slot with last one (which is now unused) - --image_histo_size; - if (idx2_max >= image_histo_size) idx2_max = image_histo_size - 1; - if (best_idx2 != image_histo_size) { - HistogramSwap(&histograms[image_histo_size], &histograms[best_idx2]); - histograms[image_histo_size] = NULL; + if (histo_queue.size == 0) continue; + + // Get the best histograms. + best_idx1 = histo_queue.queue[0].idx1; + best_idx2 = histo_queue.queue[0].idx2; + assert(best_idx1 < best_idx2); + // Pop best_idx2 from mappings. + mapping_index = (int*) bsearch(&best_idx2, mappings, *num_used, + sizeof(best_idx2), &PairComparison); + assert(mapping_index != NULL); + memmove(mapping_index, mapping_index + 1, sizeof(*mapping_index) * + ((*num_used) - (mapping_index - mappings) - 1)); + // Merge the histograms and remove best_idx2 from the queue. + HistogramAdd(histograms[best_idx2], histograms[best_idx1], + histograms[best_idx1]); + histograms[best_idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; + HistogramSetRemoveHistogram(image_histo, best_idx2, num_used); + // Parse the queue and update each pair that deals with best_idx1, + // best_idx2 or image_histo_size. + for (j = 0; j < histo_queue.size;) { + HistogramPair* const p = histo_queue.queue + j; + const int is_idx1_best = p->idx1 == best_idx1 || p->idx1 == best_idx2; + const int is_idx2_best = p->idx2 == best_idx1 || p->idx2 == best_idx2; + int do_eval = 0; + // The front pair could have been duplicated by a random pick so + // check for it all the time nevertheless. + if (is_idx1_best && is_idx2_best) { + HistoQueuePopPair(&histo_queue, p); + continue; } - tries_with_no_success = 0; - } - if (++tries_with_no_success >= num_tries_no_success || idx2_max == 0) { - break; + // Any pair containing one of the two best indices should only refer to + // best_idx1. Its cost should also be updated. + if (is_idx1_best) { + p->idx1 = best_idx1; + do_eval = 1; + } else if (is_idx2_best) { + p->idx2 = best_idx1; + do_eval = 1; + } + // Make sure the index order is respected. + if (p->idx1 > p->idx2) { + const int tmp = p->idx2; + p->idx2 = p->idx1; + p->idx1 = tmp; + } + if (do_eval) { + // Re-evaluate the cost of an updated pair. + HistoQueueUpdatePair(histograms[p->idx1], histograms[p->idx2], 0., p); + if (p->cost_diff >= 0.) { + HistoQueuePopPair(&histo_queue, p); + continue; + } + } + HistoQueueUpdateHead(&histo_queue, p); + ++j; } + tries_with_no_success = 0; } - image_histo->size = image_histo_size; + *do_greedy = (*num_used <= min_cluster_size); + ok = 1; + +End: + HistoQueueClear(&histo_queue); + WebPSafeFree(mappings); + return ok; } // ----------------------------------------------------------------------------- // Histogram refinement // Find the best 'out' histogram for each of the 'in' histograms. +// At call-time, 'out' contains the histograms of the clusters. // Note: we assume that out[]->bit_cost_ is already up-to-date. static void HistogramRemap(const VP8LHistogramSet* const in, - const VP8LHistogramSet* const out, + VP8LHistogramSet* const out, uint16_t* const symbols) { int i; VP8LHistogram** const in_histo = in->histograms; VP8LHistogram** const out_histo = out->histograms; - const int in_size = in->size; + const int in_size = out->max_size; const int out_size = out->size; if (out_size > 1) { for (i = 0; i < in_size; ++i) { int best_out = 0; double best_bits = MAX_COST; int k; + if (in_histo[i] == NULL) { + // Arbitrarily set to the previous value if unused to help future LZ77. + symbols[i] = symbols[i - 1]; + continue; + } for (k = 0; k < out_size; ++k) { - const double cur_bits = - HistogramAddThresh(out_histo[k], in_histo[i], best_bits); + double cur_bits; + cur_bits = HistogramAddThresh(out_histo[k], in_histo[i], best_bits); if (k == 0 || cur_bits < best_bits) { best_bits = cur_bits; best_out = k; @@ -899,12 +1081,13 @@ static void HistogramRemap(const VP8LHistogramSet* const in, } // Recompute each out based on raw and symbols. - for (i = 0; i < out_size; ++i) { - HistogramClear(out_histo[i]); - } + VP8LHistogramSetClear(out); + out->size = out_size; for (i = 0; i < in_size; ++i) { - const int idx = symbols[i]; + int idx; + if (in_histo[i] == NULL) continue; + idx = symbols[i]; HistogramAdd(in_histo[i], out_histo[idx], out_histo[idx]); } } @@ -920,12 +1103,76 @@ static double GetCombineCostFactor(int histo_size, int quality) { return combine_cost_factor; } +// Given a HistogramSet 'set', the mapping of clusters 'cluster_mapping' and the +// current assignment of the cells in 'symbols', merge the clusters and +// assign the smallest possible clusters values. +static void OptimizeHistogramSymbols(const VP8LHistogramSet* const set, + uint16_t* const cluster_mappings, + int num_clusters, + uint16_t* const cluster_mappings_tmp, + uint16_t* const symbols) { + int i, cluster_max; + int do_continue = 1; + // First, assign the lowest cluster to each pixel. + while (do_continue) { + do_continue = 0; + for (i = 0; i < num_clusters; ++i) { + int k; + k = cluster_mappings[i]; + while (k != cluster_mappings[k]) { + cluster_mappings[k] = cluster_mappings[cluster_mappings[k]]; + k = cluster_mappings[k]; + } + if (k != cluster_mappings[i]) { + do_continue = 1; + cluster_mappings[i] = k; + } + } + } + // Create a mapping from a cluster id to its minimal version. + cluster_max = 0; + memset(cluster_mappings_tmp, 0, + set->max_size * sizeof(*cluster_mappings_tmp)); + assert(cluster_mappings[0] == 0); + // Re-map the ids. + for (i = 0; i < set->max_size; ++i) { + int cluster; + if (symbols[i] == kInvalidHistogramSymbol) continue; + cluster = cluster_mappings[symbols[i]]; + assert(symbols[i] < num_clusters); + if (cluster > 0 && cluster_mappings_tmp[cluster] == 0) { + ++cluster_max; + cluster_mappings_tmp[cluster] = cluster_max; + } + symbols[i] = cluster_mappings_tmp[cluster]; + } + + // Make sure all cluster values are used. + cluster_max = 0; + for (i = 0; i < set->max_size; ++i) { + if (symbols[i] == kInvalidHistogramSymbol) continue; + if (symbols[i] <= cluster_max) continue; + ++cluster_max; + assert(symbols[i] == cluster_max); + } +} + +static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) { + uint32_t size; + int i; + for (i = 0, size = 0; i < image_histo->size; ++i) { + if (image_histo->histograms[i] == NULL) continue; + image_histo->histograms[size++] = image_histo->histograms[i]; + } + image_histo->size = size; +} + int VP8LGetHistoImageSymbols(int xsize, int ysize, const VP8LBackwardRefs* const refs, int quality, int low_effort, int histo_bits, int cache_bits, VP8LHistogramSet* const image_histo, - VP8LHistogramSet* const tmp_histos, + VP8LHistogram* const tmp_histo, uint16_t* const histogram_symbols) { int ok = 0; const int histo_xsize = histo_bits ? VP8LSubSampleSize(xsize, histo_bits) : 1; @@ -933,35 +1180,41 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize, const int image_histo_raw_size = histo_xsize * histo_ysize; VP8LHistogramSet* const orig_histo = VP8LAllocateHistogramSet(image_histo_raw_size, cache_bits); - VP8LHistogram* cur_combo; // Don't attempt linear bin-partition heuristic for // histograms of small sizes (as bin_map will be very sparse) and // maximum quality q==100 (to preserve the compression gains at that level). const int entropy_combine_num_bins = low_effort ? NUM_PARTITIONS : BIN_SIZE; - const int entropy_combine = - (orig_histo->size > entropy_combine_num_bins * 2) && (quality < 100); - - if (orig_histo == NULL) goto Error; + int entropy_combine; + uint16_t* const map_tmp = + WebPSafeMalloc(2 * image_histo_raw_size, sizeof(map_tmp)); + uint16_t* const cluster_mappings = map_tmp + image_histo_raw_size; + int num_used = image_histo_raw_size; + if (orig_histo == NULL || map_tmp == NULL) goto Error; // Construct the histograms from backward references. HistogramBuild(xsize, histo_bits, refs, orig_histo); // Copies the histograms and computes its bit_cost. - HistogramCopyAndAnalyze(orig_histo, image_histo); + // histogram_symbols is optimized + HistogramCopyAndAnalyze(orig_histo, image_histo, &num_used, + histogram_symbols); + + entropy_combine = + (num_used > entropy_combine_num_bins * 2) && (quality < 100); - cur_combo = tmp_histos->histograms[1]; // pick up working slot if (entropy_combine) { - const int bin_map_size = orig_histo->size; - // Reuse histogram_symbols storage. By definition, it's guaranteed to be ok. - uint16_t* const bin_map = histogram_symbols; + uint16_t* const bin_map = map_tmp; const double combine_cost_factor = GetCombineCostFactor(image_histo_raw_size, quality); + const uint32_t num_clusters = num_used; - HistogramAnalyzeEntropyBin(orig_histo, bin_map, low_effort); + HistogramAnalyzeEntropyBin(image_histo, bin_map, low_effort); // Collapse histograms with similar entropy. - cur_combo = HistogramCombineEntropyBin(image_histo, cur_combo, - bin_map, bin_map_size, - entropy_combine_num_bins, - combine_cost_factor, low_effort); + HistogramCombineEntropyBin(image_histo, &num_used, histogram_symbols, + cluster_mappings, tmp_histo, bin_map, + entropy_combine_num_bins, combine_cost_factor, + low_effort); + OptimizeHistogramSymbols(image_histo, cluster_mappings, num_clusters, + map_tmp, histogram_symbols); } // Don't combine the histograms using stochastic and greedy heuristics for @@ -970,21 +1223,27 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize, const float x = quality / 100.f; // cubic ramp between 1 and MAX_HISTO_GREEDY: const int threshold_size = (int)(1 + (x * x * x) * (MAX_HISTO_GREEDY - 1)); - HistogramCombineStochastic(image_histo, tmp_histos->histograms[0], - cur_combo, quality, threshold_size); - if ((image_histo->size <= threshold_size) && - !HistogramCombineGreedy(image_histo)) { + int do_greedy; + if (!HistogramCombineStochastic(image_histo, &num_used, threshold_size, + &do_greedy)) { goto Error; } + if (do_greedy) { + RemoveEmptyHistograms(image_histo); + if (!HistogramCombineGreedy(image_histo, &num_used)) { + goto Error; + } + } } - // TODO(vikasa): Optimize HistogramRemap for low-effort compression mode also. // Find the optimal map from original histograms to the final ones. + RemoveEmptyHistograms(image_histo); HistogramRemap(orig_histo, image_histo, histogram_symbols); ok = 1; Error: VP8LFreeHistogramSet(orig_histo); + WebPSafeFree(map_tmp); return ok; } diff --git a/Pods/libwebp/src/enc/histogram_enc.h b/Pods/libwebp/src/enc/histogram_enc.h index a9d258a..54c2d21 100644 --- a/Pods/libwebp/src/enc/histogram_enc.h +++ b/Pods/libwebp/src/enc/histogram_enc.h @@ -11,14 +11,14 @@ // // Models the histograms of literal and distance codes. -#ifndef WEBP_ENC_HISTOGRAM_H_ -#define WEBP_ENC_HISTOGRAM_H_ +#ifndef WEBP_ENC_HISTOGRAM_ENC_H_ +#define WEBP_ENC_HISTOGRAM_ENC_H_ #include -#include "./backward_references_enc.h" -#include "../webp/format_constants.h" -#include "../webp/types.h" +#include "src/enc/backward_references_enc.h" +#include "src/webp/format_constants.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -44,6 +44,7 @@ typedef struct { double literal_cost_; // Cached values of dominant entropy costs: double red_cost_; // literal, red & blue. double blue_cost_; + uint8_t is_used_[5]; // 5 for literal, red, blue, alpha, distance } VP8LHistogram; // Collection of histograms with fixed capacity, allocated as one @@ -67,7 +68,9 @@ void VP8LHistogramCreate(VP8LHistogram* const p, int VP8LGetHistogramSize(int palette_code_bits); // Set the palette_code_bits and reset the stats. -void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits); +// If init_arrays is true, the arrays are also filled with 0's. +void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits, + int init_arrays); // Collect all the references into a histogram (without reset) void VP8LHistogramStoreRefs(const VP8LBackwardRefs* const refs, @@ -83,6 +86,9 @@ void VP8LFreeHistogramSet(VP8LHistogramSet* const histo); // using 'cache_bits'. Return NULL in case of memory error. VP8LHistogramSet* VP8LAllocateHistogramSet(int size, int cache_bits); +// Set the histograms in set to 0. +void VP8LHistogramSetClear(VP8LHistogramSet* const set); + // Allocate and initialize histogram object with specified 'cache_bits'. // Returns NULL in case of memory error. // Special case of VP8LAllocateHistogramSet, with size equals 1. @@ -90,7 +96,9 @@ VP8LHistogram* VP8LAllocateHistogram(int cache_bits); // Accumulate a token 'v' into a histogram. void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo, - const PixOrCopy* const v); + const PixOrCopy* const v, + int (*const distance_modifier)(int, int), + int distance_modifier_arg0); static WEBP_INLINE int VP8LHistogramNumCodes(int palette_code_bits) { return NUM_LITERAL_CODES + NUM_LENGTH_CODES + @@ -103,21 +111,18 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize, int quality, int low_effort, int histogram_bits, int cache_bits, VP8LHistogramSet* const image_in, - VP8LHistogramSet* const tmp_histos, + VP8LHistogram* const tmp_histo, uint16_t* const histogram_symbols); // Returns the entropy for the symbols in the input array. -// Also sets trivial_symbol to the code value, if the array has only one code -// value. Otherwise, set it to VP8L_NON_TRIVIAL_SYM. -double VP8LBitsEntropy(const uint32_t* const array, int n, - uint32_t* const trivial_symbol); +double VP8LBitsEntropy(const uint32_t* const array, int n); // Estimate how many bits the combined entropy of literals and distance // approximately maps to. -double VP8LHistogramEstimateBits(const VP8LHistogram* const p); +double VP8LHistogramEstimateBits(VP8LHistogram* const p); #ifdef __cplusplus } #endif -#endif // WEBP_ENC_HISTOGRAM_H_ +#endif // WEBP_ENC_HISTOGRAM_ENC_H_ diff --git a/Pods/libwebp/src/enc/iterator_enc.c b/Pods/libwebp/src/enc/iterator_enc.c index e48d30b..29f91d8 100644 --- a/Pods/libwebp/src/enc/iterator_enc.c +++ b/Pods/libwebp/src/enc/iterator_enc.c @@ -13,7 +13,7 @@ #include -#include "./vp8i_enc.h" +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // VP8Iterator @@ -26,6 +26,9 @@ static void InitLeft(VP8EncIterator* const it) { memset(it->u_left_, 129, 8); memset(it->v_left_, 129, 8); it->left_nz_[8] = 0; + if (it->top_derr_ != NULL) { + memset(&it->left_derr_, 0, sizeof(it->left_derr_)); + } } static void InitTop(VP8EncIterator* const it) { @@ -33,6 +36,9 @@ static void InitTop(VP8EncIterator* const it) { const size_t top_size = enc->mb_w_ * 16; memset(enc->y_top_, 127, 2 * top_size); memset(enc->nz_, 0, enc->mb_w_ * sizeof(*enc->nz_)); + if (enc->top_derr_ != NULL) { + memset(enc->top_derr_, 0, enc->mb_w_ * sizeof(*enc->top_derr_)); + } } void VP8IteratorSetRow(VP8EncIterator* const it, int y) { @@ -76,6 +82,7 @@ void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) { it->y_left_ = (uint8_t*)WEBP_ALIGN(it->yuv_left_mem_ + 1); it->u_left_ = it->y_left_ + 16 + 16; it->v_left_ = it->u_left_ + 16; + it->top_derr_ = enc->top_derr_; VP8IteratorReset(it); } @@ -121,7 +128,7 @@ static void ImportLine(const uint8_t* src, int src_stride, for (; i < total_len; ++i) dst[i] = dst[len - 1]; } -void VP8IteratorImport(VP8EncIterator* const it, uint8_t* tmp_32) { +void VP8IteratorImport(VP8EncIterator* const it, uint8_t* const tmp_32) { const VP8Encoder* const enc = it->enc_; const int x = it->x_, y = it->y_; const WebPPicture* const pic = enc->pic_; @@ -450,4 +457,3 @@ int VP8IteratorRotateI4(VP8EncIterator* const it, } //------------------------------------------------------------------------------ - diff --git a/Pods/libwebp/src/enc/near_lossless_enc.c b/Pods/libwebp/src/enc/near_lossless_enc.c index 2bd03ab..5517a7e 100644 --- a/Pods/libwebp/src/enc/near_lossless_enc.c +++ b/Pods/libwebp/src/enc/near_lossless_enc.c @@ -17,18 +17,20 @@ #include #include -#include "../dsp/lossless_common.h" -#include "../utils/utils.h" -#include "./vp8i_enc.h" +#include "src/dsp/lossless_common.h" +#include "src/utils/utils.h" +#include "src/enc/vp8li_enc.h" + +#if (WEBP_NEAR_LOSSLESS == 1) #define MIN_DIM_FOR_NEAR_LOSSLESS 64 #define MAX_LIMIT_BITS 5 // Quantizes the value up or down to a multiple of 1<> 1) + ((a >> bits) & 1); +static uint32_t FindClosestDiscretized(uint32_t a, int bits) { + const uint32_t mask = (1u << bits) - 1; + const uint32_t biased = a + (mask >> 1) + ((a >> bits) & 1); assert(bits > 0); if (biased > 0xff) return 0xff; return biased & ~mask; @@ -69,22 +71,30 @@ static int IsSmooth(const uint32_t* const prev_row, } // Adjusts pixel values of image with given maximum error. -static void NearLossless(int xsize, int ysize, uint32_t* argb, - int limit_bits, uint32_t* copy_buffer) { +static void NearLossless(int xsize, int ysize, const uint32_t* argb_src, + int stride, int limit_bits, uint32_t* copy_buffer, + uint32_t* argb_dst) { int x, y; const int limit = 1 << limit_bits; uint32_t* prev_row = copy_buffer; uint32_t* curr_row = prev_row + xsize; uint32_t* next_row = curr_row + xsize; - memcpy(copy_buffer, argb, xsize * 2 * sizeof(argb[0])); + memcpy(curr_row, argb_src, xsize * sizeof(argb_src[0])); + memcpy(next_row, argb_src + stride, xsize * sizeof(argb_src[0])); - for (y = 1; y < ysize - 1; ++y) { - uint32_t* const curr_argb_row = argb + y * xsize; - uint32_t* const next_argb_row = curr_argb_row + xsize; - memcpy(next_row, next_argb_row, xsize * sizeof(argb[0])); - for (x = 1; x < xsize - 1; ++x) { - if (!IsSmooth(prev_row, curr_row, next_row, x, limit)) { - curr_argb_row[x] = ClosestDiscretizedArgb(curr_row[x], limit_bits); + for (y = 0; y < ysize; ++y, argb_src += stride, argb_dst += xsize) { + if (y == 0 || y == ysize - 1) { + memcpy(argb_dst, argb_src, xsize * sizeof(argb_src[0])); + } else { + memcpy(next_row, argb_src + stride, xsize * sizeof(argb_src[0])); + argb_dst[0] = argb_src[0]; + argb_dst[xsize - 1] = argb_src[xsize - 1]; + for (x = 1; x < xsize - 1; ++x) { + if (IsSmooth(prev_row, curr_row, next_row, x, limit)) { + argb_dst[x] = curr_row[x]; + } else { + argb_dst[x] = ClosestDiscretizedArgb(curr_row[x], limit_bits); + } } } { @@ -97,26 +107,45 @@ static void NearLossless(int xsize, int ysize, uint32_t* argb, } } -int VP8ApplyNearLossless(int xsize, int ysize, uint32_t* argb, int quality) { +int VP8ApplyNearLossless(const WebPPicture* const picture, int quality, + uint32_t* const argb_dst) { int i; + const int xsize = picture->width; + const int ysize = picture->height; + const int stride = picture->argb_stride; uint32_t* const copy_buffer = (uint32_t*)WebPSafeMalloc(xsize * 3, sizeof(*copy_buffer)); const int limit_bits = VP8LNearLosslessBits(quality); - assert(argb != NULL); - assert(limit_bits >= 0); + assert(argb_dst != NULL); + assert(limit_bits > 0); assert(limit_bits <= MAX_LIMIT_BITS); if (copy_buffer == NULL) { return 0; } // For small icon images, don't attempt to apply near-lossless compression. - if (xsize < MIN_DIM_FOR_NEAR_LOSSLESS && ysize < MIN_DIM_FOR_NEAR_LOSSLESS) { + if ((xsize < MIN_DIM_FOR_NEAR_LOSSLESS && + ysize < MIN_DIM_FOR_NEAR_LOSSLESS) || + ysize < 3) { + for (i = 0; i < ysize; ++i) { + memcpy(argb_dst + i * xsize, picture->argb + i * picture->argb_stride, + xsize * sizeof(*argb_dst)); + } WebPSafeFree(copy_buffer); return 1; } - for (i = limit_bits; i != 0; --i) { - NearLossless(xsize, ysize, argb, i, copy_buffer); + NearLossless(xsize, ysize, picture->argb, stride, limit_bits, copy_buffer, + argb_dst); + for (i = limit_bits - 1; i != 0; --i) { + NearLossless(xsize, ysize, argb_dst, xsize, i, copy_buffer, argb_dst); } WebPSafeFree(copy_buffer); return 1; } +#else // (WEBP_NEAR_LOSSLESS == 1) + +// Define a stub to suppress compiler warnings. +extern void VP8LNearLosslessStub(void); +void VP8LNearLosslessStub(void) {} + +#endif // (WEBP_NEAR_LOSSLESS == 1) diff --git a/Pods/libwebp/src/enc/picture_csp_enc.c b/Pods/libwebp/src/enc/picture_csp_enc.c index e5d1c75..718e014 100644 --- a/Pods/libwebp/src/enc/picture_csp_enc.c +++ b/Pods/libwebp/src/enc/picture_csp_enc.c @@ -15,10 +15,12 @@ #include #include -#include "./vp8i_enc.h" -#include "../utils/random_utils.h" -#include "../utils/utils.h" -#include "../dsp/yuv.h" +#include "src/enc/vp8i_enc.h" +#include "src/utils/random_utils.h" +#include "src/utils/utils.h" +#include "src/dsp/dsp.h" +#include "src/dsp/lossless.h" +#include "src/dsp/yuv.h" // Uncomment to disable gamma-compression during RGB->U/V averaging #define USE_GAMMA_COMPRESSION @@ -26,11 +28,15 @@ // If defined, use table to compute x / alpha. #define USE_INVERSE_ALPHA_TABLE -static const union { - uint32_t argb; - uint8_t bytes[4]; -} test_endian = { 0xff000000u }; -#define ALPHA_IS_LAST (test_endian.bytes[3] == 0xff) +#ifdef WORDS_BIGENDIAN +// uint32_t 0xff000000 is 0xff,00,00,00 in memory +#define CHANNEL_OFFSET(i) (i) +#else +// uint32_t 0xff000000 is 0x00,00,00,ff in memory +#define CHANNEL_OFFSET(i) (3-(i)) +#endif + +#define ALPHA_OFFSET CHANNEL_OFFSET(0) //------------------------------------------------------------------------------ // Detection of non-trivial transparency @@ -39,12 +45,15 @@ static const union { static int CheckNonOpaque(const uint8_t* alpha, int width, int height, int x_step, int y_step) { if (alpha == NULL) return 0; - while (height-- > 0) { - int x; - for (x = 0; x < width * x_step; x += x_step) { - if (alpha[x] != 0xff) return 1; // TODO(skal): check 4/8 bytes at a time. + WebPInitAlphaProcessing(); + if (x_step == 1) { + for (; height-- > 0; alpha += y_step) { + if (WebPHasAlpha8b(alpha, width)) return 1; + } + } else { + for (; height-- > 0; alpha += y_step) { + if (WebPHasAlpha32b(alpha, width)) return 1; } - alpha += y_step; } return 0; } @@ -56,15 +65,10 @@ int WebPPictureHasTransparency(const WebPPicture* picture) { return CheckNonOpaque(picture->a, picture->width, picture->height, 1, picture->a_stride); } else { - int x, y; - const uint32_t* argb = picture->argb; - if (argb == NULL) return 0; - for (y = 0; y < picture->height; ++y) { - for (x = 0; x < picture->width; ++x) { - if (argb[x] < 0xff000000u) return 1; // test any alpha values != 0xff - } - argb += picture->argb_stride; - } + const int alpha_offset = ALPHA_OFFSET; + return CheckNonOpaque((const uint8_t*)picture->argb + alpha_offset, + picture->width, picture->height, + 4, picture->argb_stride * sizeof(*picture->argb)); } return 0; } @@ -126,7 +130,7 @@ static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) { #else -static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTables(void) {} +static void InitGammaTables(void) {} static WEBP_INLINE uint32_t GammaToLinear(uint8_t v) { return v; } static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) { return (int)(base_value << shift); @@ -170,29 +174,33 @@ typedef uint16_t fixed_y_t; // unsigned type with extra SFIX precision for W #if defined(USE_GAMMA_COMPRESSION) -// float variant of gamma-correction -// We use tables of different size and precision for the Rec709 +// We use tables of different size and precision for the Rec709 / BT2020 // transfer function. #define kGammaF (1./0.45) -static float kGammaToLinearTabF[MAX_Y_T + 1]; // size scales with Y_FIX -static float kLinearToGammaTabF[kGammaTabSize + 2]; -static volatile int kGammaTablesFOk = 0; - -static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) { - if (!kGammaTablesFOk) { +static uint32_t kLinearToGammaTabS[kGammaTabSize + 2]; +#define GAMMA_TO_LINEAR_BITS 14 +static uint32_t kGammaToLinearTabS[MAX_Y_T + 1]; // size scales with Y_FIX +static volatile int kGammaTablesSOk = 0; + +static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesS(void) { + assert(2 * GAMMA_TO_LINEAR_BITS < 32); // we use uint32_t intermediate values + if (!kGammaTablesSOk) { int v; const double norm = 1. / MAX_Y_T; const double scale = 1. / kGammaTabSize; - const double a = 0.099; - const double thresh = 0.018; + const double a = 0.09929682680944; + const double thresh = 0.018053968510807; + const double final_scale = 1 << GAMMA_TO_LINEAR_BITS; for (v = 0; v <= MAX_Y_T; ++v) { const double g = norm * v; + double value; if (g <= thresh * 4.5) { - kGammaToLinearTabF[v] = (float)(g / 4.5); + value = g / 4.5; } else { const double a_rec = 1. / (1. + a); - kGammaToLinearTabF[v] = (float)pow(a_rec * (g + a), kGammaF); + value = pow(a_rec * (g + a), kGammaF); } + kGammaToLinearTabS[v] = (uint32_t)(value * final_scale + .5); } for (v = 0; v <= kGammaTabSize; ++v) { const double g = scale * v; @@ -202,37 +210,44 @@ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) { } else { value = (1. + a) * pow(g, 1. / kGammaF) - a; } - kLinearToGammaTabF[v] = (float)(MAX_Y_T * value); + // we already incorporate the 1/2 rounding constant here + kLinearToGammaTabS[v] = + (uint32_t)(MAX_Y_T * value) + (1 << GAMMA_TO_LINEAR_BITS >> 1); } // to prevent small rounding errors to cause read-overflow: - kLinearToGammaTabF[kGammaTabSize + 1] = kLinearToGammaTabF[kGammaTabSize]; - kGammaTablesFOk = 1; + kLinearToGammaTabS[kGammaTabSize + 1] = kLinearToGammaTabS[kGammaTabSize]; + kGammaTablesSOk = 1; } } -static WEBP_INLINE float GammaToLinearF(int v) { - return kGammaToLinearTabF[v]; +// return value has a fixed-point precision of GAMMA_TO_LINEAR_BITS +static WEBP_INLINE uint32_t GammaToLinearS(int v) { + return kGammaToLinearTabS[v]; } -static WEBP_INLINE int LinearToGammaF(float value) { - const float v = value * kGammaTabSize; - const int tab_pos = (int)v; - const float x = v - (float)tab_pos; // fractional part - const float v0 = kLinearToGammaTabF[tab_pos + 0]; - const float v1 = kLinearToGammaTabF[tab_pos + 1]; - const float y = v1 * x + v0 * (1.f - x); // interpolate - return (int)(y + .5); +static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) { + // 'value' is in GAMMA_TO_LINEAR_BITS fractional precision + const uint32_t v = value * kGammaTabSize; + const uint32_t tab_pos = v >> GAMMA_TO_LINEAR_BITS; + // fractional part, in GAMMA_TO_LINEAR_BITS fixed-point precision + const uint32_t x = v - (tab_pos << GAMMA_TO_LINEAR_BITS); // fractional part + // v0 / v1 are in GAMMA_TO_LINEAR_BITS fixed-point precision (range [0..1]) + const uint32_t v0 = kLinearToGammaTabS[tab_pos + 0]; + const uint32_t v1 = kLinearToGammaTabS[tab_pos + 1]; + // Final interpolation. Note that rounding is already included. + const uint32_t v2 = (v1 - v0) * x; // note: v1 >= v0. + const uint32_t result = v0 + (v2 >> GAMMA_TO_LINEAR_BITS); + return result; } #else -static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {} -static WEBP_INLINE float GammaToLinearF(int v) { - const float norm = 1.f / MAX_Y_T; - return norm * v; +static void InitGammaTablesS(void) {} +static WEBP_INLINE uint32_t GammaToLinearS(int v) { + return (v << GAMMA_TO_LINEAR_BITS) / MAX_Y_T; } -static WEBP_INLINE int LinearToGammaF(float value) { - return (int)(MAX_Y_T * value + .5); +static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) { + return (MAX_Y_T * value) >> GAMMA_TO_LINEAR_BITS; } #endif // USE_GAMMA_COMPRESSION @@ -254,26 +269,22 @@ static int RGBToGray(int r, int g, int b) { return (luma >> YUV_FIX); } -static float RGBToGrayF(float r, float g, float b) { - return (float)(0.2126 * r + 0.7152 * g + 0.0722 * b); -} - -static int ScaleDown(int a, int b, int c, int d) { - const float A = GammaToLinearF(a); - const float B = GammaToLinearF(b); - const float C = GammaToLinearF(c); - const float D = GammaToLinearF(d); - return LinearToGammaF(0.25f * (A + B + C + D)); +static uint32_t ScaleDown(int a, int b, int c, int d) { + const uint32_t A = GammaToLinearS(a); + const uint32_t B = GammaToLinearS(b); + const uint32_t C = GammaToLinearS(c); + const uint32_t D = GammaToLinearS(d); + return LinearToGammaS((A + B + C + D + 2) >> 2); } static WEBP_INLINE void UpdateW(const fixed_y_t* src, fixed_y_t* dst, int w) { int i; for (i = 0; i < w; ++i) { - const float R = GammaToLinearF(src[0 * w + i]); - const float G = GammaToLinearF(src[1 * w + i]); - const float B = GammaToLinearF(src[2 * w + i]); - const float Y = RGBToGrayF(R, G, B); - dst[i] = (fixed_y_t)LinearToGammaF(Y); + const uint32_t R = GammaToLinearS(src[0 * w + i]); + const uint32_t G = GammaToLinearS(src[1 * w + i]); + const uint32_t B = GammaToLinearS(src[2 * w + i]); + const uint32_t Y = RGBToGray(R, G, B); + dst[i] = (fixed_y_t)LinearToGammaS(Y); } } @@ -856,7 +867,6 @@ static int ImportYUVAFromRGBA(const uint8_t* r_ptr, return 0; } if (has_alpha) { - WebPInitAlphaProcessing(); assert(step == 4); #if defined(USE_GAMMA_COMPRESSION) && defined(USE_INVERSE_ALPHA_TABLE) assert(kAlphaFix + kGammaFix <= 31); @@ -864,7 +874,7 @@ static int ImportYUVAFromRGBA(const uint8_t* r_ptr, } if (use_iterative_conversion) { - InitGammaTablesF(); + InitGammaTablesS(); if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) { return 0; } @@ -991,10 +1001,10 @@ static int PictureARGBToYUVA(WebPPicture* picture, WebPEncCSP colorspace, return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION); } else { const uint8_t* const argb = (const uint8_t*)picture->argb; - const uint8_t* const r = ALPHA_IS_LAST ? argb + 2 : argb + 1; - const uint8_t* const g = ALPHA_IS_LAST ? argb + 1 : argb + 2; - const uint8_t* const b = ALPHA_IS_LAST ? argb + 0 : argb + 3; - const uint8_t* const a = ALPHA_IS_LAST ? argb + 3 : argb + 0; + const uint8_t* const a = argb + CHANNEL_OFFSET(0); + const uint8_t* const r = argb + CHANNEL_OFFSET(1); + const uint8_t* const g = argb + CHANNEL_OFFSET(2); + const uint8_t* const b = argb + CHANNEL_OFFSET(3); picture->colorspace = WEBP_YUV420; return ImportYUVAFromRGBA(r, g, b, a, 4, 4 * picture->argb_stride, @@ -1044,8 +1054,9 @@ int WebPPictureYUVAToARGB(WebPPicture* picture) { const int height = picture->height; const int argb_stride = 4 * picture->argb_stride; uint8_t* dst = (uint8_t*)picture->argb; - const uint8_t *cur_u = picture->u, *cur_v = picture->v, *cur_y = picture->y; - WebPUpsampleLinePairFunc upsample = WebPGetLinePairConverter(ALPHA_IS_LAST); + const uint8_t* cur_u = picture->u, *cur_v = picture->v, *cur_y = picture->y; + WebPUpsampleLinePairFunc upsample = + WebPGetLinePairConverter(ALPHA_OFFSET > 0); // First row, with replicated top samples. upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v, dst, NULL, width); @@ -1085,40 +1096,59 @@ int WebPPictureYUVAToARGB(WebPPicture* picture) { // automatic import / conversion static int Import(WebPPicture* const picture, - const uint8_t* const rgb, int rgb_stride, + const uint8_t* rgb, int rgb_stride, int step, int swap_rb, int import_alpha) { int y; + // swap_rb -> b,g,r,a , !swap_rb -> r,g,b,a const uint8_t* r_ptr = rgb + (swap_rb ? 2 : 0); const uint8_t* g_ptr = rgb + 1; const uint8_t* b_ptr = rgb + (swap_rb ? 0 : 2); - const uint8_t* a_ptr = import_alpha ? rgb + 3 : NULL; const int width = picture->width; const int height = picture->height; if (!picture->use_argb) { + const uint8_t* a_ptr = import_alpha ? rgb + 3 : NULL; return ImportYUVAFromRGBA(r_ptr, g_ptr, b_ptr, a_ptr, step, rgb_stride, 0.f /* no dithering */, 0, picture); } if (!WebPPictureAlloc(picture)) return 0; - VP8EncDspARGBInit(); + VP8LDspInit(); + WebPInitAlphaProcessing(); if (import_alpha) { + // dst[] byte order is {a,r,g,b} for big-endian, {b,g,r,a} for little endian uint32_t* dst = picture->argb; + const int do_copy = (ALPHA_OFFSET == 3) && swap_rb; assert(step == 4); - for (y = 0; y < height; ++y) { - VP8PackARGB(a_ptr, r_ptr, g_ptr, b_ptr, width, dst); - a_ptr += rgb_stride; - r_ptr += rgb_stride; - g_ptr += rgb_stride; - b_ptr += rgb_stride; - dst += picture->argb_stride; + if (do_copy) { + for (y = 0; y < height; ++y) { + memcpy(dst, rgb, width * 4); + rgb += rgb_stride; + dst += picture->argb_stride; + } + } else { + for (y = 0; y < height; ++y) { +#ifdef WORDS_BIGENDIAN + // BGRA or RGBA input order. + const uint8_t* a_ptr = rgb + 3; + WebPPackARGB(a_ptr, r_ptr, g_ptr, b_ptr, width, dst); + r_ptr += rgb_stride; + g_ptr += rgb_stride; + b_ptr += rgb_stride; +#else + // RGBA input order. Need to swap R and B. + VP8LConvertBGRAToRGBA((const uint32_t*)rgb, width, (uint8_t*)dst); +#endif + rgb += rgb_stride; + dst += picture->argb_stride; + } } } else { uint32_t* dst = picture->argb; assert(step >= 3); for (y = 0; y < height; ++y) { - VP8PackRGB(r_ptr, g_ptr, b_ptr, width, step, dst); + WebPPackRGB(r_ptr, g_ptr, b_ptr, width, step, dst); r_ptr += rgb_stride; g_ptr += rgb_stride; b_ptr += rgb_stride; @@ -1130,12 +1160,7 @@ static int Import(WebPPicture* const picture, // Public API -int WebPPictureImportRGB(WebPPicture* picture, - const uint8_t* rgb, int rgb_stride) { - return (picture != NULL && rgb != NULL) - ? Import(picture, rgb, rgb_stride, 3, 0, 0) - : 0; -} +#if !defined(WEBP_REDUCE_CSP) int WebPPictureImportBGR(WebPPicture* picture, const uint8_t* rgb, int rgb_stride) { @@ -1144,31 +1169,41 @@ int WebPPictureImportBGR(WebPPicture* picture, : 0; } -int WebPPictureImportRGBA(WebPPicture* picture, +int WebPPictureImportBGRA(WebPPicture* picture, const uint8_t* rgba, int rgba_stride) { return (picture != NULL && rgba != NULL) - ? Import(picture, rgba, rgba_stride, 4, 0, 1) + ? Import(picture, rgba, rgba_stride, 4, 1, 1) : 0; } -int WebPPictureImportBGRA(WebPPicture* picture, + +int WebPPictureImportBGRX(WebPPicture* picture, const uint8_t* rgba, int rgba_stride) { return (picture != NULL && rgba != NULL) - ? Import(picture, rgba, rgba_stride, 4, 1, 1) + ? Import(picture, rgba, rgba_stride, 4, 1, 0) : 0; } -int WebPPictureImportRGBX(WebPPicture* picture, +#endif // WEBP_REDUCE_CSP + +int WebPPictureImportRGB(WebPPicture* picture, + const uint8_t* rgb, int rgb_stride) { + return (picture != NULL && rgb != NULL) + ? Import(picture, rgb, rgb_stride, 3, 0, 0) + : 0; +} + +int WebPPictureImportRGBA(WebPPicture* picture, const uint8_t* rgba, int rgba_stride) { return (picture != NULL && rgba != NULL) - ? Import(picture, rgba, rgba_stride, 4, 0, 0) + ? Import(picture, rgba, rgba_stride, 4, 0, 1) : 0; } -int WebPPictureImportBGRX(WebPPicture* picture, +int WebPPictureImportRGBX(WebPPicture* picture, const uint8_t* rgba, int rgba_stride) { return (picture != NULL && rgba != NULL) - ? Import(picture, rgba, rgba_stride, 4, 1, 0) + ? Import(picture, rgba, rgba_stride, 4, 0, 0) : 0; } diff --git a/Pods/libwebp/src/enc/picture_enc.c b/Pods/libwebp/src/enc/picture_enc.c index dfa6651..c691622 100644 --- a/Pods/libwebp/src/enc/picture_enc.c +++ b/Pods/libwebp/src/enc/picture_enc.c @@ -14,9 +14,9 @@ #include #include -#include "./vp8i_enc.h" -#include "../dsp/dsp.h" -#include "../utils/utils.h" +#include "src/enc/vp8i_enc.h" +#include "src/dsp/dsp.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // WebPPicture @@ -76,13 +76,12 @@ int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height) { return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION); } // allocate a new buffer. - memory = WebPSafeMalloc(argb_size, sizeof(*picture->argb)); + memory = WebPSafeMalloc(argb_size + WEBP_ALIGN_CST, sizeof(*picture->argb)); if (memory == NULL) { return WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY); } - // TODO(skal): align plane to cache line? picture->memory_argb_ = memory; - picture->argb = (uint32_t*)memory; + picture->argb = (uint32_t*)WEBP_ALIGN(memory); picture->argb_stride = width; return 1; } @@ -92,8 +91,8 @@ int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height) { (WebPEncCSP)((int)picture->colorspace & WEBP_CSP_UV_MASK); const int has_alpha = (int)picture->colorspace & WEBP_CSP_ALPHA_BIT; const int y_stride = width; - const int uv_width = (width + 1) >> 1; - const int uv_height = (height + 1) >> 1; + const int uv_width = (int)(((int64_t)width + 1) >> 1); + const int uv_height = (int)(((int64_t)height + 1) >> 1); const int uv_stride = uv_width; int a_width, a_stride; uint64_t y_size, uv_size, a_size, total_size; @@ -118,8 +117,8 @@ int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height) { total_size = y_size + a_size + 2 * uv_size; // Security and validation checks - if (width <= 0 || height <= 0 || // luma/alpha param error - uv_width < 0 || uv_height < 0) { // u/v param error + if (width <= 0 || height <= 0 || // luma/alpha param error + uv_width <= 0 || uv_height <= 0) { // u/v param error return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION); } // allocate a new buffer. @@ -271,9 +270,11 @@ size_t NAME(const uint8_t* in, int w, int h, int bps, float q, \ } ENCODE_FUNC(WebPEncodeRGB, WebPPictureImportRGB) -ENCODE_FUNC(WebPEncodeBGR, WebPPictureImportBGR) ENCODE_FUNC(WebPEncodeRGBA, WebPPictureImportRGBA) +#if !defined(WEBP_REDUCE_CSP) +ENCODE_FUNC(WebPEncodeBGR, WebPPictureImportBGR) ENCODE_FUNC(WebPEncodeBGRA, WebPPictureImportBGRA) +#endif // WEBP_REDUCE_CSP #undef ENCODE_FUNC @@ -284,9 +285,11 @@ size_t NAME(const uint8_t* in, int w, int h, int bps, uint8_t** out) { \ } LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessRGB, WebPPictureImportRGB) -LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessBGR, WebPPictureImportBGR) LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessRGBA, WebPPictureImportRGBA) +#if !defined(WEBP_REDUCE_CSP) +LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessBGR, WebPPictureImportBGR) LOSSLESS_ENCODE_FUNC(WebPEncodeLosslessBGRA, WebPPictureImportBGRA) +#endif // WEBP_REDUCE_CSP #undef LOSSLESS_ENCODE_FUNC diff --git a/Pods/libwebp/src/enc/picture_psnr_enc.c b/Pods/libwebp/src/enc/picture_psnr_enc.c index 9c0b229..1a2f0be 100644 --- a/Pods/libwebp/src/enc/picture_psnr_enc.c +++ b/Pods/libwebp/src/enc/picture_psnr_enc.c @@ -11,11 +11,16 @@ // // Author: Skal (pascal.massimino@gmail.com) +#include "src/webp/encode.h" + +#if !(defined(WEBP_DISABLE_STATS) || defined(WEBP_REDUCE_SIZE)) + #include #include -#include "./vp8i_enc.h" -#include "../utils/utils.h" +#include "src/dsp/dsp.h" +#include "src/enc/vp8i_enc.h" +#include "src/utils/utils.h" typedef double (*AccumulateFunc)(const uint8_t* src, int src_stride, const uint8_t* ref, int ref_stride, @@ -165,6 +170,12 @@ int WebPPlaneDistortion(const uint8_t* src, size_t src_stride, return 1; } +#ifdef WORDS_BIGENDIAN +#define BLUE_OFFSET 3 // uint32_t 0x000000ff is 0x00,00,00,ff in memory +#else +#define BLUE_OFFSET 0 // uint32_t 0x000000ff is 0xff,00,00,00 in memory +#endif + int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref, int type, float results[5]) { int w, h, c; @@ -191,8 +202,10 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref, float distortion; const size_t stride0 = 4 * (size_t)p0.argb_stride; const size_t stride1 = 4 * (size_t)p1.argb_stride; - if (!WebPPlaneDistortion((const uint8_t*)p0.argb + c, stride0, - (const uint8_t*)p1.argb + c, stride1, + // results are reported as BGRA + const int offset = c ^ BLUE_OFFSET; + if (!WebPPlaneDistortion((const uint8_t*)p0.argb + offset, stride0, + (const uint8_t*)p1.argb + offset, stride1, w, h, 4, type, &distortion, results + c)) { goto Error; } @@ -210,4 +223,36 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref, return ok; } -//------------------------------------------------------------------------------ +#undef BLUE_OFFSET + +#else // defined(WEBP_DISABLE_STATS) +int WebPPlaneDistortion(const uint8_t* src, size_t src_stride, + const uint8_t* ref, size_t ref_stride, + int width, int height, size_t x_step, + int type, float* distortion, float* result) { + (void)src; + (void)src_stride; + (void)ref; + (void)ref_stride; + (void)width; + (void)height; + (void)x_step; + (void)type; + if (distortion == NULL || result == NULL) return 0; + *distortion = 0.f; + *result = 0.f; + return 1; +} + +int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref, + int type, float results[5]) { + int i; + (void)src; + (void)ref; + (void)type; + if (results == NULL) return 0; + for (i = 0; i < 5; ++i) results[i] = 0.f; + return 1; +} + +#endif // !defined(WEBP_DISABLE_STATS) diff --git a/Pods/libwebp/src/enc/picture_rescale_enc.c b/Pods/libwebp/src/enc/picture_rescale_enc.c index 0b7181c..58a6ae7 100644 --- a/Pods/libwebp/src/enc/picture_rescale_enc.c +++ b/Pods/libwebp/src/enc/picture_rescale_enc.c @@ -11,12 +11,16 @@ // // Author: Skal (pascal.massimino@gmail.com) +#include "src/webp/encode.h" + +#if !defined(WEBP_REDUCE_SIZE) + #include #include -#include "./vp8i_enc.h" -#include "../utils/rescaler_utils.h" -#include "../utils/utils.h" +#include "src/enc/vp8i_enc.h" +#include "src/utils/rescaler_utils.h" +#include "src/utils/utils.h" #define HALVE(x) (((x) + 1) >> 1) @@ -261,4 +265,45 @@ int WebPPictureRescale(WebPPicture* pic, int width, int height) { return 1; } -//------------------------------------------------------------------------------ +#else // defined(WEBP_REDUCE_SIZE) + +int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst) { + (void)src; + (void)dst; + return 0; +} + +int WebPPictureIsView(const WebPPicture* picture) { + (void)picture; + return 0; +} + +int WebPPictureView(const WebPPicture* src, + int left, int top, int width, int height, + WebPPicture* dst) { + (void)src; + (void)left; + (void)top; + (void)width; + (void)height; + (void)dst; + return 0; +} + +int WebPPictureCrop(WebPPicture* pic, + int left, int top, int width, int height) { + (void)pic; + (void)left; + (void)top; + (void)width; + (void)height; + return 0; +} + +int WebPPictureRescale(WebPPicture* pic, int width, int height) { + (void)pic; + (void)width; + (void)height; + return 0; +} +#endif // !defined(WEBP_REDUCE_SIZE) diff --git a/Pods/libwebp/src/enc/picture_tools_enc.c b/Pods/libwebp/src/enc/picture_tools_enc.c index 895df51..d0e8a49 100644 --- a/Pods/libwebp/src/enc/picture_tools_enc.c +++ b/Pods/libwebp/src/enc/picture_tools_enc.c @@ -13,32 +13,15 @@ #include -#include "./vp8i_enc.h" -#include "../dsp/yuv.h" - -static WEBP_INLINE uint32_t MakeARGB32(int r, int g, int b) { - return (0xff000000u | (r << 16) | (g << 8) | b); -} +#include "src/enc/vp8i_enc.h" +#include "src/dsp/yuv.h" //------------------------------------------------------------------------------ // Helper: clean up fully transparent area to help compressibility. #define SIZE 8 #define SIZE2 (SIZE / 2) -static int is_transparent_area(const uint8_t* ptr, int stride, int size) { - int y, x; - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - if (ptr[x]) { - return 0; - } - } - ptr += stride; - } - return 1; -} - -static int is_transparent_argb_area(const uint32_t* ptr, int stride, int size) { +static int IsTransparentARGBArea(const uint32_t* ptr, int stride, int size) { int y, x; for (y = 0; y < size; ++y) { for (x = 0; x < size; ++x) { @@ -51,7 +34,7 @@ static int is_transparent_argb_area(const uint32_t* ptr, int stride, int size) { return 1; } -static void flatten(uint8_t* ptr, int v, int stride, int size) { +static void Flatten(uint8_t* ptr, int v, int stride, int size) { int y; for (y = 0; y < size; ++y) { memset(ptr, v, size); @@ -59,7 +42,7 @@ static void flatten(uint8_t* ptr, int v, int stride, int size) { } } -static void flatten_argb(uint32_t* ptr, uint32_t v, int stride, int size) { +static void FlattenARGB(uint32_t* ptr, uint32_t v, int stride, int size) { int x, y; for (y = 0; y < size; ++y) { for (x = 0; x < size; ++x) ptr[x] = v; @@ -67,54 +50,114 @@ static void flatten_argb(uint32_t* ptr, uint32_t v, int stride, int size) { } } +// Smoothen the luma components of transparent pixels. Return true if the whole +// block is transparent. +static int SmoothenBlock(const uint8_t* a_ptr, int a_stride, uint8_t* y_ptr, + int y_stride, int width, int height) { + int sum = 0, count = 0; + int x, y; + const uint8_t* alpha_ptr = a_ptr; + uint8_t* luma_ptr = y_ptr; + for (y = 0; y < height; ++y) { + for (x = 0; x < width; ++x) { + if (alpha_ptr[x] != 0) { + ++count; + sum += luma_ptr[x]; + } + } + alpha_ptr += a_stride; + luma_ptr += y_stride; + } + if (count > 0 && count < width * height) { + const uint8_t avg_u8 = (uint8_t)(sum / count); + alpha_ptr = a_ptr; + luma_ptr = y_ptr; + for (y = 0; y < height; ++y) { + for (x = 0; x < width; ++x) { + if (alpha_ptr[x] == 0) luma_ptr[x] = avg_u8; + } + alpha_ptr += a_stride; + luma_ptr += y_stride; + } + } + return (count == 0); +} + void WebPCleanupTransparentArea(WebPPicture* pic) { int x, y, w, h; if (pic == NULL) return; w = pic->width / SIZE; h = pic->height / SIZE; - // note: we ignore the left-overs on right/bottom + // note: we ignore the left-overs on right/bottom, except for SmoothenBlock(). if (pic->use_argb) { uint32_t argb_value = 0; for (y = 0; y < h; ++y) { int need_reset = 1; for (x = 0; x < w; ++x) { const int off = (y * pic->argb_stride + x) * SIZE; - if (is_transparent_argb_area(pic->argb + off, pic->argb_stride, SIZE)) { + if (IsTransparentARGBArea(pic->argb + off, pic->argb_stride, SIZE)) { if (need_reset) { argb_value = pic->argb[off]; need_reset = 0; } - flatten_argb(pic->argb + off, argb_value, pic->argb_stride, SIZE); + FlattenARGB(pic->argb + off, argb_value, pic->argb_stride, SIZE); } else { need_reset = 1; } } } } else { - const uint8_t* const a_ptr = pic->a; + const int width = pic->width; + const int height = pic->height; + const int y_stride = pic->y_stride; + const int uv_stride = pic->uv_stride; + const int a_stride = pic->a_stride; + uint8_t* y_ptr = pic->y; + uint8_t* u_ptr = pic->u; + uint8_t* v_ptr = pic->v; + const uint8_t* a_ptr = pic->a; int values[3] = { 0 }; - if (a_ptr == NULL) return; // nothing to do - for (y = 0; y < h; ++y) { + if (a_ptr == NULL || y_ptr == NULL || u_ptr == NULL || v_ptr == NULL) { + return; + } + for (y = 0; y + SIZE <= height; y += SIZE) { int need_reset = 1; - for (x = 0; x < w; ++x) { - const int off_a = (y * pic->a_stride + x) * SIZE; - const int off_y = (y * pic->y_stride + x) * SIZE; - const int off_uv = (y * pic->uv_stride + x) * SIZE2; - if (is_transparent_area(a_ptr + off_a, pic->a_stride, SIZE)) { + for (x = 0; x + SIZE <= width; x += SIZE) { + if (SmoothenBlock(a_ptr + x, a_stride, y_ptr + x, y_stride, + SIZE, SIZE)) { if (need_reset) { - values[0] = pic->y[off_y]; - values[1] = pic->u[off_uv]; - values[2] = pic->v[off_uv]; + values[0] = y_ptr[x]; + values[1] = u_ptr[x >> 1]; + values[2] = v_ptr[x >> 1]; need_reset = 0; } - flatten(pic->y + off_y, values[0], pic->y_stride, SIZE); - flatten(pic->u + off_uv, values[1], pic->uv_stride, SIZE2); - flatten(pic->v + off_uv, values[2], pic->uv_stride, SIZE2); + Flatten(y_ptr + x, values[0], y_stride, SIZE); + Flatten(u_ptr + (x >> 1), values[1], uv_stride, SIZE2); + Flatten(v_ptr + (x >> 1), values[2], uv_stride, SIZE2); } else { need_reset = 1; } } + if (x < width) { + SmoothenBlock(a_ptr + x, a_stride, y_ptr + x, y_stride, + width - x, SIZE); + } + a_ptr += SIZE * a_stride; + y_ptr += SIZE * y_stride; + u_ptr += SIZE2 * uv_stride; + v_ptr += SIZE2 * uv_stride; + } + if (y < height) { + const int sub_height = height - y; + for (x = 0; x + SIZE <= width; x += SIZE) { + SmoothenBlock(a_ptr + x, a_stride, y_ptr + x, y_stride, + SIZE, sub_height); + } + if (x < width) { + SmoothenBlock(a_ptr + x, a_stride, y_ptr + x, y_stride, + width - x, sub_height); + } } } } @@ -144,9 +187,13 @@ void WebPCleanupTransparentAreaLossless(WebPPicture* const pic) { // Blend color and remove transparency info #define BLEND(V0, V1, ALPHA) \ - ((((V0) * (255 - (ALPHA)) + (V1) * (ALPHA)) * 0x101) >> 16) + ((((V0) * (255 - (ALPHA)) + (V1) * (ALPHA)) * 0x101 + 256) >> 16) #define BLEND_10BIT(V0, V1, ALPHA) \ - ((((V0) * (1020 - (ALPHA)) + (V1) * (ALPHA)) * 0x101) >> 18) + ((((V0) * (1020 - (ALPHA)) + (V1) * (ALPHA)) * 0x101 + 1024) >> 18) + +static WEBP_INLINE uint32_t MakeARGB32(int r, int g, int b) { + return (0xff000000u | (r << 16) | (g << 8) | b); +} void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb) { const int red = (background_rgb >> 16) & 0xff; @@ -161,39 +208,44 @@ void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb) { const int U0 = VP8RGBToU(4 * red, 4 * green, 4 * blue, 4 * YUV_HALF); const int V0 = VP8RGBToV(4 * red, 4 * green, 4 * blue, 4 * YUV_HALF); const int has_alpha = pic->colorspace & WEBP_CSP_ALPHA_BIT; - if (!has_alpha || pic->a == NULL) return; // nothing to do + uint8_t* y_ptr = pic->y; + uint8_t* u_ptr = pic->u; + uint8_t* v_ptr = pic->v; + uint8_t* a_ptr = pic->a; + if (!has_alpha || a_ptr == NULL) return; // nothing to do for (y = 0; y < pic->height; ++y) { // Luma blending - uint8_t* const y_ptr = pic->y + y * pic->y_stride; - uint8_t* const a_ptr = pic->a + y * pic->a_stride; for (x = 0; x < pic->width; ++x) { - const int alpha = a_ptr[x]; + const uint8_t alpha = a_ptr[x]; if (alpha < 0xff) { - y_ptr[x] = BLEND(Y0, y_ptr[x], a_ptr[x]); + y_ptr[x] = BLEND(Y0, y_ptr[x], alpha); } } // Chroma blending every even line if ((y & 1) == 0) { - uint8_t* const u = pic->u + (y >> 1) * pic->uv_stride; - uint8_t* const v = pic->v + (y >> 1) * pic->uv_stride; uint8_t* const a_ptr2 = (y + 1 == pic->height) ? a_ptr : a_ptr + pic->a_stride; for (x = 0; x < uv_width; ++x) { // Average four alpha values into a single blending weight. // TODO(skal): might lead to visible contouring. Can we do better? - const int alpha = + const uint32_t alpha = a_ptr[2 * x + 0] + a_ptr[2 * x + 1] + a_ptr2[2 * x + 0] + a_ptr2[2 * x + 1]; - u[x] = BLEND_10BIT(U0, u[x], alpha); - v[x] = BLEND_10BIT(V0, v[x], alpha); + u_ptr[x] = BLEND_10BIT(U0, u_ptr[x], alpha); + v_ptr[x] = BLEND_10BIT(V0, v_ptr[x], alpha); } if (pic->width & 1) { // rightmost pixel - const int alpha = 2 * (a_ptr[2 * x + 0] + a_ptr2[2 * x + 0]); - u[x] = BLEND_10BIT(U0, u[x], alpha); - v[x] = BLEND_10BIT(V0, v[x], alpha); + const uint32_t alpha = 2 * (a_ptr[2 * x + 0] + a_ptr2[2 * x + 0]); + u_ptr[x] = BLEND_10BIT(U0, u_ptr[x], alpha); + v_ptr[x] = BLEND_10BIT(V0, v_ptr[x], alpha); } + } else { + u_ptr += pic->uv_stride; + v_ptr += pic->uv_stride; } - memset(a_ptr, 0xff, pic->width); + memset(a_ptr, 0xff, pic->width); // reset alpha value to opaque + a_ptr += pic->a_stride; + y_ptr += pic->y_stride; } } else { uint32_t* argb = pic->argb; diff --git a/Pods/libwebp/src/enc/predictor_enc.c b/Pods/libwebp/src/enc/predictor_enc.c index 0639b74..2e6762e 100644 --- a/Pods/libwebp/src/enc/predictor_enc.c +++ b/Pods/libwebp/src/enc/predictor_enc.c @@ -14,9 +14,9 @@ // Urvang Joshi (urvang@google.com) // Vincent Rabaud (vrabaud@google.com) -#include "../dsp/lossless.h" -#include "../dsp/lossless_common.h" -#include "./vp8li_enc.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" +#include "src/enc/vp8li_enc.h" #define MAX_DIFF_COST (1e30f) @@ -26,7 +26,6 @@ static const uint32_t kMaskAlpha = 0xff000000; // Mostly used to reduce code size + readability static WEBP_INLINE int GetMin(int a, int b) { return (a > b) ? b : a; } -static WEBP_INLINE int GetMax(int a, int b) { return (a < b) ? b : a; } //------------------------------------------------------------------------------ // Methods to calculate Entropy (Shannon). @@ -90,6 +89,9 @@ static WEBP_INLINE void PredictBatch(int mode, int x_start, int y, } } +#if (WEBP_NEAR_LOSSLESS == 1) +static WEBP_INLINE int GetMax(int a, int b) { return (a < b) ? b : a; } + static int MaxDiffBetweenPixels(uint32_t p1, uint32_t p2) { const int diff_a = abs((int)(p1 >> 24) - (int)(p2 >> 24)); const int diff_r = abs((int)((p1 >> 16) & 0xff) - (int)((p2 >> 16) & 0xff)); @@ -175,6 +177,10 @@ static uint8_t NearLosslessComponent(uint8_t value, uint8_t predict, } } +static WEBP_INLINE uint8_t NearLosslessDiff(uint8_t a, uint8_t b) { + return (uint8_t)((((int)(a) - (int)(b))) & 0xff); +} + // Quantize every component of the difference between the actual pixel value and // its prediction to a multiple of a quantization (a power of 2, not larger than // max_quantization which is a power of 2, smaller than max_diff). Take care if @@ -196,7 +202,7 @@ static uint32_t NearLossless(uint32_t value, uint32_t predict, } if ((value >> 24) == 0 || (value >> 24) == 0xff) { // Preserve transparency of fully transparent or fully opaque pixels. - a = ((value >> 24) - (predict >> 24)) & 0xff; + a = NearLosslessDiff((value >> 24) & 0xff, (predict >> 24) & 0xff); } else { a = NearLosslessComponent(value >> 24, predict >> 24, 0xff, quantization); } @@ -209,15 +215,16 @@ static uint32_t NearLossless(uint32_t value, uint32_t predict, // The amount by which green has been adjusted during quantization. It is // subtracted from red and blue for compensation, to avoid accumulating two // quantization errors in them. - green_diff = (new_green - (value >> 8)) & 0xff; + green_diff = NearLosslessDiff(new_green, (value >> 8) & 0xff); } - r = NearLosslessComponent(((value >> 16) - green_diff) & 0xff, + r = NearLosslessComponent(NearLosslessDiff((value >> 16) & 0xff, green_diff), (predict >> 16) & 0xff, 0xff - new_green, quantization); - b = NearLosslessComponent((value - green_diff) & 0xff, predict & 0xff, - 0xff - new_green, quantization); + b = NearLosslessComponent(NearLosslessDiff(value & 0xff, green_diff), + predict & 0xff, 0xff - new_green, quantization); return ((uint32_t)a << 24) | ((uint32_t)r << 16) | ((uint32_t)g << 8) | b; } +#endif // (WEBP_NEAR_LOSSLESS == 1) // Stores the difference between the pixel and its prediction in "out". // In case of a lossy encoding, updates the source image to avoid propagating @@ -244,6 +251,7 @@ static WEBP_INLINE void GetResidual( } else { predict = pred_func(current_row[x - 1], upper_row + x); } +#if (WEBP_NEAR_LOSSLESS == 1) if (max_quantization == 1 || mode == 0 || y == 0 || y == height - 1 || x == 0 || x == width - 1) { residual = VP8LSubPixels(current_row[x], predict); @@ -254,6 +262,13 @@ static WEBP_INLINE void GetResidual( current_row[x] = VP8LAddPixels(predict, residual); // x is never 0 here so we do not need to update upper_row like below. } +#else + (void)max_diffs; + (void)height; + (void)max_quantization; + (void)used_subtract_green; + residual = VP8LSubPixels(current_row[x], predict); +#endif if ((current_row[x] & kMaskAlpha) == 0) { // If alpha is 0, cleanup RGB. We can choose the RGB values of the // residual for best compression. The prediction of alpha itself can be @@ -296,11 +311,12 @@ static int GetBestPredictorForTile(int width, int height, const int max_x = GetMin(tile_size, width - start_x); // Whether there exist columns just outside the tile. const int have_left = (start_x > 0); - const int have_right = (max_x < width - start_x); // Position and size of the strip covering the tile and adjacent columns if // they exist. const int context_start_x = start_x - have_left; - const int context_width = max_x + have_left + have_right; +#if (WEBP_NEAR_LOSSLESS == 1) + const int context_width = max_x + have_left + (max_x < width - start_x); +#endif const int tiles_per_row = VP8LSubSampleSize(width, bits); // Prediction modes of the left and above neighbor tiles. const int left_mode = (tile_x > 0) ? @@ -352,10 +368,12 @@ static int GetBestPredictorForTile(int width, int height, memcpy(current_row + context_start_x, argb + y * width + context_start_x, sizeof(*argb) * (max_x + have_left + (y + 1 < height))); +#if (WEBP_NEAR_LOSSLESS == 1) if (max_quantization > 1 && y >= 1 && y + 1 < height) { MaxDiffsForRow(context_width, width, argb + y * width + context_start_x, max_diffs + context_start_x, used_subtract_green); } +#endif GetResidual(width, height, upper_row, current_row, max_diffs, mode, start_x, start_x + max_x, y, max_quantization, exact, @@ -405,7 +423,9 @@ static void CopyImageWithPrediction(int width, int height, uint32_t* upper_row = argb_scratch; uint32_t* current_row = upper_row + width + 1; uint8_t* current_max_diffs = (uint8_t*)(current_row + width + 1); +#if (WEBP_NEAR_LOSSLESS == 1) uint8_t* lower_max_diffs = current_max_diffs + width; +#endif int y; for (y = 0; y < height; ++y) { @@ -420,6 +440,7 @@ static void CopyImageWithPrediction(int width, int height, PredictBatch(kPredLowEffort, 0, y, width, current_row, upper_row, argb + y * width); } else { +#if (WEBP_NEAR_LOSSLESS == 1) if (max_quantization > 1) { // Compute max_diffs for the lower row now, because that needs the // contents of argb for the current row, which we will overwrite with @@ -432,6 +453,7 @@ static void CopyImageWithPrediction(int width, int height, used_subtract_green); } } +#endif for (x = 0; x < width;) { const int mode = (modes[(y >> bits) * tiles_per_row + (x >> bits)] >> 8) & 0xff; @@ -565,7 +587,7 @@ static void GetBestGreenToRed( } } } - best_tx->green_to_red_ = green_to_red_best; + best_tx->green_to_red_ = (green_to_red_best & 0xff); } static float GetPredictionCostCrossColorBlue( @@ -644,8 +666,8 @@ static void GetBestGreenRedToBlue( break; // out of iter-loop. } } - best_tx->green_to_blue_ = green_to_blue_best; - best_tx->red_to_blue_ = red_to_blue_best; + best_tx->green_to_blue_ = green_to_blue_best & 0xff; + best_tx->red_to_blue_ = red_to_blue_best & 0xff; } #undef kGreenRedToBlueMaxIters #undef kGreenRedToBlueNumAxis diff --git a/Pods/libwebp/src/enc/quant_enc.c b/Pods/libwebp/src/enc/quant_enc.c index b118fb2..01eb565 100644 --- a/Pods/libwebp/src/enc/quant_enc.c +++ b/Pods/libwebp/src/enc/quant_enc.c @@ -15,8 +15,9 @@ #include #include // for abs() -#include "./vp8i_enc.h" -#include "./cost_enc.h" +#include "src/dsp/quant.h" +#include "src/enc/vp8i_enc.h" +#include "src/enc/cost_enc.h" #define DO_TRELLIS_I4 1 #define DO_TRELLIS_I16 1 // not a huge gain, but ok at low bitrate. @@ -32,7 +33,7 @@ // number of non-zero coeffs below which we consider the block very flat // (and apply a penalty to complex predictions) -#define FLATNESS_LIMIT_I16 10 // I16 mode +#define FLATNESS_LIMIT_I16 0 // I16 mode (special case) #define FLATNESS_LIMIT_I4 3 // I4 mode #define FLATNESS_LIMIT_UV 2 // UV mode #define FLATNESS_PENALTY 140 // roughly ~1bit per block @@ -457,11 +458,11 @@ void VP8SetSegmentParams(VP8Encoder* const enc, float quality) { // Form the predictions in cache // Must be ordered using {DC_PRED, TM_PRED, V_PRED, H_PRED} as index -const int VP8I16ModeOffsets[4] = { I16DC16, I16TM16, I16VE16, I16HE16 }; -const int VP8UVModeOffsets[4] = { C8DC8, C8TM8, C8VE8, C8HE8 }; +const uint16_t VP8I16ModeOffsets[4] = { I16DC16, I16TM16, I16VE16, I16HE16 }; +const uint16_t VP8UVModeOffsets[4] = { C8DC8, C8TM8, C8VE8, C8HE8 }; // Must be indexed using {B_DC_PRED -> B_HU_PRED} as index -const int VP8I4ModeOffsets[NUM_BMODES] = { +const uint16_t VP8I4ModeOffsets[NUM_BMODES] = { I4DC4, I4TM4, I4VE4, I4HE4, I4RD4, I4VR4, I4LD4, I4VL4, I4HD4, I4HU4 }; @@ -492,14 +493,14 @@ void VP8MakeIntra4Preds(const VP8EncIterator* const it) { // |YYYY|....| 12 // +----+----+ -const int VP8Scan[16] = { // Luma +const uint16_t VP8Scan[16] = { // Luma 0 + 0 * BPS, 4 + 0 * BPS, 8 + 0 * BPS, 12 + 0 * BPS, 0 + 4 * BPS, 4 + 4 * BPS, 8 + 4 * BPS, 12 + 4 * BPS, 0 + 8 * BPS, 4 + 8 * BPS, 8 + 8 * BPS, 12 + 8 * BPS, 0 + 12 * BPS, 4 + 12 * BPS, 8 + 12 * BPS, 12 + 12 * BPS, }; -static const int VP8ScanUV[4 + 4] = { +static const uint16_t VP8ScanUV[4 + 4] = { 0 + 0 * BPS, 4 + 0 * BPS, 0 + 4 * BPS, 4 + 4 * BPS, // U 8 + 0 * BPS, 12 + 0 * BPS, 8 + 4 * BPS, 12 + 4 * BPS // V }; @@ -826,6 +827,85 @@ static int ReconstructIntra4(VP8EncIterator* const it, return nz; } +//------------------------------------------------------------------------------ +// DC-error diffusion + +// Diffusion weights. We under-correct a bit (15/16th of the error is actually +// diffused) to avoid 'rainbow' chessboard pattern of blocks at q~=0. +#define C1 7 // fraction of error sent to the 4x4 block below +#define C2 8 // fraction of error sent to the 4x4 block on the right +#define DSHIFT 4 +#define DSCALE 1 // storage descaling, needed to make the error fit int8_t + +// Quantize as usual, but also compute and return the quantization error. +// Error is already divided by DSHIFT. +static int QuantizeSingle(int16_t* const v, const VP8Matrix* const mtx) { + int V = *v; + const int sign = (V < 0); + if (sign) V = -V; + if (V > (int)mtx->zthresh_[0]) { + const int qV = QUANTDIV(V, mtx->iq_[0], mtx->bias_[0]) * mtx->q_[0]; + const int err = (V - qV); + *v = sign ? -qV : qV; + return (sign ? -err : err) >> DSCALE; + } + *v = 0; + return (sign ? -V : V) >> DSCALE; +} + +static void CorrectDCValues(const VP8EncIterator* const it, + const VP8Matrix* const mtx, + int16_t tmp[][16], VP8ModeScore* const rd) { + // | top[0] | top[1] + // --------+--------+--------- + // left[0] | tmp[0] tmp[1] <-> err0 err1 + // left[1] | tmp[2] tmp[3] err2 err3 + // + // Final errors {err1,err2,err3} are preserved and later restored + // as top[]/left[] on the next block. + int ch; + for (ch = 0; ch <= 1; ++ch) { + const int8_t* const top = it->top_derr_[it->x_][ch]; + const int8_t* const left = it->left_derr_[ch]; + int16_t (* const c)[16] = &tmp[ch * 4]; + int err0, err1, err2, err3; + c[0][0] += (C1 * top[0] + C2 * left[0]) >> (DSHIFT - DSCALE); + err0 = QuantizeSingle(&c[0][0], mtx); + c[1][0] += (C1 * top[1] + C2 * err0) >> (DSHIFT - DSCALE); + err1 = QuantizeSingle(&c[1][0], mtx); + c[2][0] += (C1 * err0 + C2 * left[1]) >> (DSHIFT - DSCALE); + err2 = QuantizeSingle(&c[2][0], mtx); + c[3][0] += (C1 * err1 + C2 * err2) >> (DSHIFT - DSCALE); + err3 = QuantizeSingle(&c[3][0], mtx); + // error 'err' is bounded by mtx->q_[0] which is 132 at max. Hence + // err >> DSCALE will fit in an int8_t type if DSCALE>=1. + assert(abs(err1) <= 127 && abs(err2) <= 127 && abs(err3) <= 127); + rd->derr[ch][0] = (int8_t)err1; + rd->derr[ch][1] = (int8_t)err2; + rd->derr[ch][2] = (int8_t)err3; + } +} + +static void StoreDiffusionErrors(VP8EncIterator* const it, + const VP8ModeScore* const rd) { + int ch; + for (ch = 0; ch <= 1; ++ch) { + int8_t* const top = it->top_derr_[it->x_][ch]; + int8_t* const left = it->left_derr_[ch]; + left[0] = rd->derr[ch][0]; // restore err1 + left[1] = 3 * rd->derr[ch][2] >> 2; // ... 3/4th of err3 + top[0] = rd->derr[ch][1]; // ... err2 + top[1] = rd->derr[ch][2] - left[1]; // ... 1/4th of err3. + } +} + +#undef C1 +#undef C2 +#undef DSHIFT +#undef DSCALE + +//------------------------------------------------------------------------------ + static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd, uint8_t* const yuv_out, int mode) { const VP8Encoder* const enc = it->enc_; @@ -839,6 +919,8 @@ static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd, for (n = 0; n < 8; n += 2) { VP8FTransform2(src + VP8ScanUV[n], ref + VP8ScanUV[n], tmp[n]); } + if (it->top_derr_ != NULL) CorrectDCValues(it, &dqm->uv_, tmp, rd); + if (DO_TRELLIS_UV && it->do_trellis_) { int ch, x, y; for (ch = 0, n = 0; ch <= 2; ch += 2) { @@ -896,19 +978,6 @@ static void SwapOut(VP8EncIterator* const it) { SwapPtr(&it->yuv_out_, &it->yuv_out2_); } -static score_t IsFlat(const int16_t* levels, int num_blocks, score_t thresh) { - score_t score = 0; - while (num_blocks-- > 0) { // TODO(skal): refine positional scoring? - int i; - for (i = 1; i < 16; ++i) { // omit DC, we're only interested in AC - score += (levels[i] != 0); - if (score > thresh) return 0; - } - levels += 16; - } - return 1; -} - static void PickBestIntra16(VP8EncIterator* const it, VP8ModeScore* rd) { const int kNumBlocks = 16; VP8SegmentInfo* const dqm = &it->enc_->dqm_[it->mb_->segment_]; @@ -919,6 +988,7 @@ static void PickBestIntra16(VP8EncIterator* const it, VP8ModeScore* rd) { VP8ModeScore* rd_cur = &rd_tmp; VP8ModeScore* rd_best = rd; int mode; + int is_flat = IsFlatSource16(it->yuv_in_ + Y_OFF_ENC); rd->mode_i16 = -1; for (mode = 0; mode < NUM_PRED_MODES; ++mode) { @@ -934,10 +1004,14 @@ static void PickBestIntra16(VP8EncIterator* const it, VP8ModeScore* rd) { tlambda ? MULT_8B(tlambda, VP8TDisto16x16(src, tmp_dst, kWeightY)) : 0; rd_cur->H = VP8FixedCostsI16[mode]; rd_cur->R = VP8GetCostLuma16(it, rd_cur); - if (mode > 0 && - IsFlat(rd_cur->y_ac_levels[0], kNumBlocks, FLATNESS_LIMIT_I16)) { - // penalty to avoid flat area to be mispredicted by complex mode - rd_cur->R += FLATNESS_PENALTY * kNumBlocks; + if (is_flat) { + // refine the first impression (which was in pixel space) + is_flat = IsFlat(rd_cur->y_ac_levels[0], kNumBlocks, FLATNESS_LIMIT_I16); + if (is_flat) { + // Block is very flat. We put emphasis on the distortion being very low! + rd_cur->D *= 2; + rd_cur->SD *= 2; + } } // Since we always examine Intra16 first, we can overwrite *rd directly. @@ -1018,7 +1092,8 @@ static int PickBestIntra4(VP8EncIterator* const it, VP8ModeScore* const rd) { : 0; rd_tmp.H = mode_costs[mode]; - // Add flatness penalty + // Add flatness penalty, to avoid flat area to be mispredicted + // by a complex mode. if (mode > 0 && IsFlat(tmp_levels, kNumBlocks, FLATNESS_LIMIT_I4)) { rd_tmp.R = FLATNESS_PENALTY * kNumBlocks; } else { @@ -1101,6 +1176,9 @@ static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) { CopyScore(&rd_best, &rd_uv); rd->mode_uv = mode; memcpy(rd->uv_levels, rd_uv.uv_levels, sizeof(rd->uv_levels)); + if (it->top_derr_ != NULL) { + memcpy(rd->derr, rd_uv.derr, sizeof(rd_uv.derr)); + } SwapPtr(&dst, &tmp_dst); } } @@ -1109,6 +1187,9 @@ static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) { if (dst != dst0) { // copy 16x8 block if needed VP8Copy16x8(dst, dst0); } + if (it->top_derr_ != NULL) { // store diffusion errors for next block + StoreDiffusionErrors(it, rd); + } } //------------------------------------------------------------------------------ @@ -1162,16 +1243,24 @@ static void RefineUsingDistortion(VP8EncIterator* const it, const uint8_t* const src = it->yuv_in_ + Y_OFF_ENC; for (mode = 0; mode < NUM_PRED_MODES; ++mode) { const uint8_t* const ref = it->yuv_p_ + VP8I16ModeOffsets[mode]; - const score_t score = VP8SSE16x16(src, ref) * RD_DISTO_MULT + const score_t score = (score_t)VP8SSE16x16(src, ref) * RD_DISTO_MULT + VP8FixedCostsI16[mode] * lambda_d_i16; if (mode > 0 && VP8FixedCostsI16[mode] > bit_limit) { continue; } + if (score < best_score) { best_mode = mode; best_score = score; } } + if (it->x_ == 0 || it->y_ == 0) { + // avoid starting a checkerboard resonance from the border. See bug #432. + if (IsFlatSource16(src)) { + best_mode = (it->x_ == 0) ? 0 : 2; + try_both_modes = 0; // stick to i16 + } + } VP8SetIntra16Mode(it, best_mode); // we'll reconstruct later, if i16 mode actually gets selected } diff --git a/Pods/libwebp/src/enc/syntax_enc.c b/Pods/libwebp/src/enc/syntax_enc.c index 90665bd..a9e5a6c 100644 --- a/Pods/libwebp/src/enc/syntax_enc.c +++ b/Pods/libwebp/src/enc/syntax_enc.c @@ -13,10 +13,10 @@ #include -#include "../utils/utils.h" -#include "../webp/format_constants.h" // RIFF constants -#include "../webp/mux_types.h" // ALPHA_FLAG -#include "./vp8i_enc.h" +#include "src/utils/utils.h" +#include "src/webp/format_constants.h" // RIFF constants +#include "src/webp/mux_types.h" // ALPHA_FLAG +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // Helper functions @@ -289,11 +289,17 @@ static int GeneratePartition0(VP8Encoder* const enc) { pos3 = VP8BitWriterPos(bw); +#if !defined(WEBP_DISABLE_STATS) if (enc->pic_->stats) { enc->pic_->stats->header_bytes[0] = (int)((pos2 - pos1 + 7) >> 3); enc->pic_->stats->header_bytes[1] = (int)((pos3 - pos2 + 7) >> 3); enc->pic_->stats->alpha_data_size = (int)enc->alpha_data_size_; } +#else + (void)pos1; + (void)pos2; + (void)pos3; +#endif if (bw->error_) { return WebPEncodingSetError(enc->pic_, VP8_ENC_ERROR_OUT_OF_MEMORY); } diff --git a/Pods/libwebp/src/enc/token_enc.c b/Pods/libwebp/src/enc/token_enc.c index 02a0d72..3a2192a 100644 --- a/Pods/libwebp/src/enc/token_enc.c +++ b/Pods/libwebp/src/enc/token_enc.c @@ -20,9 +20,9 @@ #include #include -#include "./cost_enc.h" -#include "./vp8i_enc.h" -#include "../utils/utils.h" +#include "src/enc/cost_enc.h" +#include "src/enc/vp8i_enc.h" +#include "src/utils/utils.h" #if !defined(DISABLE_TOKEN_BUFFER) @@ -194,39 +194,6 @@ int VP8RecordCoeffTokens(int ctx, const struct VP8Residual* const res, #undef TOKEN_ID -//------------------------------------------------------------------------------ -// This function works, but isn't currently used. Saved for later. - -#if 0 - -static void Record(int bit, proba_t* const stats) { - proba_t p = *stats; - if (p >= 0xffff0000u) { // an overflow is inbound. - p = ((p + 1u) >> 1) & 0x7fff7fffu; // -> divide the stats by 2. - } - // record bit count (lower 16 bits) and increment total count (upper 16 bits). - p += 0x00010000u + bit; - *stats = p; -} - -void VP8TokenToStats(const VP8TBuffer* const b, proba_t* const stats) { - const VP8Tokens* p = b->pages_; - while (p != NULL) { - const int N = (p->next_ == NULL) ? b->left_ : 0; - int n = MAX_NUM_TOKEN; - const token_t* const tokens = TOKEN_DATA(p); - while (n-- > N) { - const token_t token = tokens[n]; - if (!(token & FIXED_PROBA_BIT)) { - Record((token >> 15) & 1, stats + (token & 0x3fffu)); - } - } - p = p->next_; - } -} - -#endif // 0 - //------------------------------------------------------------------------------ // Final coding pass, with known probabilities @@ -283,8 +250,9 @@ size_t VP8EstimateTokenSize(VP8TBuffer* const b, const uint8_t* const probas) { #else // DISABLE_TOKEN_BUFFER -void VP8TBufferInit(VP8TBuffer* const b) { +void VP8TBufferInit(VP8TBuffer* const b, int page_size) { (void)b; + (void)page_size; } void VP8TBufferClear(VP8TBuffer* const b) { (void)b; diff --git a/Pods/libwebp/src/enc/tree_enc.c b/Pods/libwebp/src/enc/tree_enc.c index 2c40fe7..64ed283 100644 --- a/Pods/libwebp/src/enc/tree_enc.c +++ b/Pods/libwebp/src/enc/tree_enc.c @@ -11,7 +11,7 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./vp8i_enc.h" +#include "src/enc/vp8i_enc.h" //------------------------------------------------------------------------------ // Default probabilities diff --git a/Pods/libwebp/src/enc/vp8i_enc.h b/Pods/libwebp/src/enc/vp8i_enc.h index 93c95ec..fedcaee 100644 --- a/Pods/libwebp/src/enc/vp8i_enc.h +++ b/Pods/libwebp/src/enc/vp8i_enc.h @@ -11,16 +11,16 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_ENC_VP8ENCI_H_ -#define WEBP_ENC_VP8ENCI_H_ +#ifndef WEBP_ENC_VP8I_ENC_H_ +#define WEBP_ENC_VP8I_ENC_H_ #include // for memcpy() -#include "../dec/common_dec.h" -#include "../dsp/dsp.h" -#include "../utils/bit_writer_utils.h" -#include "../utils/thread_utils.h" -#include "../utils/utils.h" -#include "../webp/encode.h" +#include "src/dec/common_dec.h" +#include "src/dsp/dsp.h" +#include "src/utils/bit_writer_utils.h" +#include "src/utils/thread_utils.h" +#include "src/utils/utils.h" +#include "src/webp/encode.h" #ifdef __cplusplus extern "C" { @@ -30,8 +30,8 @@ extern "C" { // Various defines and enums // version numbers -#define ENC_MAJ_VERSION 0 -#define ENC_MIN_VERSION 6 +#define ENC_MAJ_VERSION 1 +#define ENC_MIN_VERSION 1 #define ENC_REV_VERSION 0 enum { MAX_LF_LEVELS = 64, // Maximum loop filter level @@ -75,10 +75,10 @@ typedef enum { // Rate-distortion optimization levels #define U_OFF_ENC (16) #define V_OFF_ENC (16 + 8) -extern const int VP8Scan[16]; // in quant.c -extern const int VP8UVModeOffsets[4]; // in analyze.c -extern const int VP8I16ModeOffsets[4]; -extern const int VP8I4ModeOffsets[NUM_BMODES]; +extern const uint16_t VP8Scan[16]; +extern const uint16_t VP8UVModeOffsets[4]; +extern const uint16_t VP8I16ModeOffsets[4]; +extern const uint16_t VP8I4ModeOffsets[NUM_BMODES]; // Layout of prediction blocks // intra 16x16 @@ -120,6 +120,9 @@ static WEBP_INLINE int QUANTDIV(uint32_t n, uint32_t iQ, uint32_t B) { // Uncomment the following to remove token-buffer code: // #define DISABLE_TOKEN_BUFFER +// quality below which error-diffusion is enabled +#define ERROR_DIFFUSION_QUALITY 98 + //------------------------------------------------------------------------------ // Headers @@ -201,6 +204,8 @@ typedef struct { score_t i4_penalty_; // penalty for using Intra4 } VP8SegmentInfo; +typedef int8_t DError[2 /* u/v */][2 /* top or left */]; + // Handy transient struct to accumulate score and info during RD-optimization // and mode evaluation. typedef struct { @@ -213,6 +218,7 @@ typedef struct { uint8_t modes_i4[16]; // mode numbers for intra4 predictions int mode_uv; // mode number of chroma prediction uint32_t nz; // non-zero blocks + int8_t derr[2][3]; // DC diffusion errors for U/V for blocks #1/2/3 } VP8ModeScore; // Iterator structure to iterate through macroblocks, pointing to the @@ -242,6 +248,9 @@ typedef struct { int count_down0_; // starting counter value (for progress) int percent0_; // saved initial progress percent + DError left_derr_; // left error diffusion (u/v) + DError* top_derr_; // top diffusion error - NULL if disabled + uint8_t* y_left_; // left luma samples (addressable from index -1 to 15). uint8_t* u_left_; // left u samples (addressable from index -1 to 7) uint8_t* v_left_; // left v samples (addressable from index -1 to 7) @@ -269,7 +278,7 @@ int VP8IteratorIsDone(const VP8EncIterator* const it); // Import uncompressed samples from source. // If tmp_32 is not NULL, import boundary samples too. // tmp_32 is a 32-bytes scratch buffer that must be aligned in memory. -void VP8IteratorImport(VP8EncIterator* const it, uint8_t* tmp_32); +void VP8IteratorImport(VP8EncIterator* const it, uint8_t* const tmp_32); // export decimated samples void VP8IteratorExport(const VP8EncIterator* const it); // go to next macroblock. Returns false if not finished. @@ -330,9 +339,6 @@ int VP8RecordCoeffTokens(int ctx, const struct VP8Residual* const res, // Estimate the final coded size given a set of 'probas'. size_t VP8EstimateTokenSize(VP8TBuffer* const b, const uint8_t* const probas); -// unused for now -void VP8TokenToStats(const VP8TBuffer* const b, proba_t* const stats); - #endif // !DISABLE_TOKEN_BUFFER //------------------------------------------------------------------------------ @@ -404,6 +410,7 @@ struct VP8Encoder { uint8_t* uv_top_; // top u/v samples. // U and V are packed into 16 bytes (8 U + 8 V) LFStats* lf_stats_; // autofilter stats (if NULL, autofilter is off) + DError* top_derr_; // diffusion error (NULL if disabled) }; //------------------------------------------------------------------------------ @@ -502,19 +509,10 @@ int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height); // compressibility (no guarantee, though). Assumes that pic->use_argb is true. void WebPCleanupTransparentAreaLossless(WebPPicture* const pic); - // in near_lossless.c -// Near lossless preprocessing in RGB color-space. -int VP8ApplyNearLossless(int xsize, int ysize, uint32_t* argb, int quality); -// Near lossless adjustment for predictors. -void VP8ApplyNearLosslessPredict(int xsize, int ysize, int pred_bits, - const uint32_t* argb_orig, - uint32_t* argb, uint32_t* argb_scratch, - const uint32_t* const transform_data, - int quality, int subtract_green); //------------------------------------------------------------------------------ #ifdef __cplusplus } // extern "C" #endif -#endif /* WEBP_ENC_VP8ENCI_H_ */ +#endif // WEBP_ENC_VP8I_ENC_H_ diff --git a/Pods/libwebp/src/enc/vp8l_enc.c b/Pods/libwebp/src/enc/vp8l_enc.c index b1a793d..2efd403 100644 --- a/Pods/libwebp/src/enc/vp8l_enc.c +++ b/Pods/libwebp/src/enc/vp8l_enc.c @@ -15,20 +15,17 @@ #include #include -#include "./backward_references_enc.h" -#include "./histogram_enc.h" -#include "./vp8i_enc.h" -#include "./vp8li_enc.h" -#include "../dsp/lossless.h" -#include "../dsp/lossless_common.h" -#include "../utils/bit_writer_utils.h" -#include "../utils/huffman_encode_utils.h" -#include "../utils/utils.h" -#include "../webp/format_constants.h" - -#include "./delta_palettization_enc.h" - -#define PALETTE_KEY_RIGHT_SHIFT 22 // Key for 1K buffer. +#include "src/enc/backward_references_enc.h" +#include "src/enc/histogram_enc.h" +#include "src/enc/vp8i_enc.h" +#include "src/enc/vp8li_enc.h" +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" +#include "src/utils/bit_writer_utils.h" +#include "src/utils/huffman_encode_utils.h" +#include "src/utils/utils.h" +#include "src/webp/format_constants.h" + // Maximum number of histogram images (sub-blocks). #define MAX_HUFF_IMAGE_SIZE 2600 @@ -128,7 +125,10 @@ static int AnalyzeAndCreatePalette(const WebPPicture* const pic, uint32_t palette[MAX_PALETTE_SIZE], int* const palette_size) { const int num_colors = WebPGetColorPalette(pic, palette); - if (num_colors > MAX_PALETTE_SIZE) return 0; + if (num_colors > MAX_PALETTE_SIZE) { + *palette_size = 0; + return 0; + } *palette_size = num_colors; qsort(palette, num_colors, sizeof(*palette), PaletteCompareColorsForQsort); if (!low_effort && PaletteHasNonMonotonousDeltas(palette, num_colors)) { @@ -188,22 +188,33 @@ static WEBP_INLINE uint32_t HashPix(uint32_t pix) { static int AnalyzeEntropy(const uint32_t* argb, int width, int height, int argb_stride, int use_palette, + int palette_size, int transform_bits, EntropyIx* const min_entropy_ix, int* const red_and_blue_always_zero) { // Allocate histogram set with cache_bits = 0. - uint32_t* const histo = - (uint32_t*)WebPSafeCalloc(kHistoTotal, sizeof(*histo) * 256); + uint32_t* histo; + + if (use_palette && palette_size <= 16) { + // In the case of small palettes, we pack 2, 4 or 8 pixels together. In + // practice, small palettes are better than any other transform. + *min_entropy_ix = kPalette; + *red_and_blue_always_zero = 1; + return 1; + } + histo = (uint32_t*)WebPSafeCalloc(kHistoTotal, sizeof(*histo) * 256); if (histo != NULL) { int i, x, y; - const uint32_t* prev_row = argb; - const uint32_t* curr_row = argb + argb_stride; - for (y = 1; y < height; ++y) { - uint32_t prev_pix = curr_row[0]; - for (x = 1; x < width; ++x) { + const uint32_t* prev_row = NULL; + const uint32_t* curr_row = argb; + uint32_t pix_prev = argb[0]; // Skip the first pixel. + for (y = 0; y < height; ++y) { + for (x = 0; x < width; ++x) { const uint32_t pix = curr_row[x]; - const uint32_t pix_diff = VP8LSubPixels(pix, prev_pix); - if ((pix_diff == 0) || (pix == prev_row[x])) continue; - prev_pix = pix; + const uint32_t pix_diff = VP8LSubPixels(pix, pix_prev); + pix_prev = pix; + if ((pix_diff == 0) || (prev_row != NULL && pix == prev_row[x])) { + continue; + } AddSingle(pix, &histo[kHistoAlpha * 256], &histo[kHistoRed * 256], @@ -246,7 +257,7 @@ static int AnalyzeEntropy(const uint32_t* argb, ++histo[kHistoAlphaPred * 256]; for (j = 0; j < kHistoTotal; ++j) { - entropy_comp[j] = VP8LBitsEntropy(&histo[j * 256], 256, NULL); + entropy_comp[j] = VP8LBitsEntropy(&histo[j * 256], 256); } entropy[kDirect] = entropy_comp[kHistoAlpha] + entropy_comp[kHistoRed] + @@ -264,8 +275,24 @@ static int AnalyzeEntropy(const uint32_t* argb, entropy_comp[kHistoRedPredSubGreen] + entropy_comp[kHistoGreenPred] + entropy_comp[kHistoBluePredSubGreen]; - // Palette mode seems more efficient in a breakeven case. Bias with 1.0. - entropy[kPalette] = entropy_comp[kHistoPalette] - 1.0; + entropy[kPalette] = entropy_comp[kHistoPalette]; + + // When including transforms, there is an overhead in bits from + // storing them. This overhead is small but matters for small images. + // For spatial, there are 14 transformations. + entropy[kSpatial] += VP8LSubSampleSize(width, transform_bits) * + VP8LSubSampleSize(height, transform_bits) * + VP8LFastLog2(14); + // For color transforms: 24 as only 3 channels are considered in a + // ColorTransformElement. + entropy[kSpatialSubGreen] += VP8LSubSampleSize(width, transform_bits) * + VP8LSubSampleSize(height, transform_bits) * + VP8LFastLog2(24); + // For palettes, add the cost of storing the palette. + // We empirically estimate the cost of a compressed entry as 8 bits. + // The palette is differential-coded when compressed hence a much + // lower cost than sizeof(uint32_t)*8. + entropy[kPalette] += palette_size * 8; *min_entropy_ix = kDirect; for (k = kDirect + 1; k <= last_mode_to_analyze; ++k) { @@ -273,6 +300,7 @@ static int AnalyzeEntropy(const uint32_t* argb, *min_entropy_ix = (EntropyIx)k; } } + assert((int)*min_entropy_ix <= last_mode_to_analyze); *red_and_blue_always_zero = 1; // Let's check if the histogram of the chosen entropy mode has // non-zero red and blue values. If all are zero, we can later skip @@ -325,60 +353,94 @@ static int GetTransformBits(int method, int histo_bits) { return res; } -static int AnalyzeAndInit(VP8LEncoder* const enc) { +// Set of parameters to be used in each iteration of the cruncher. +#define CRUNCH_CONFIGS_LZ77_MAX 2 +typedef struct { + int entropy_idx_; + int lz77s_types_to_try_[CRUNCH_CONFIGS_LZ77_MAX]; + int lz77s_types_to_try_size_; +} CrunchConfig; + +#define CRUNCH_CONFIGS_MAX kNumEntropyIx + +static int EncoderAnalyze(VP8LEncoder* const enc, + CrunchConfig crunch_configs[CRUNCH_CONFIGS_MAX], + int* const crunch_configs_size, + int* const red_and_blue_always_zero) { const WebPPicture* const pic = enc->pic_; const int width = pic->width; const int height = pic->height; - const int pix_cnt = width * height; const WebPConfig* const config = enc->config_; const int method = config->method; const int low_effort = (config->method == 0); - // we round the block size up, so we're guaranteed to have - // at max MAX_REFS_BLOCK_PER_IMAGE blocks used: - int refs_block_size = (pix_cnt - 1) / MAX_REFS_BLOCK_PER_IMAGE + 1; + int i; + int use_palette; + int n_lz77s; assert(pic != NULL && pic->argb != NULL); - enc->use_cross_color_ = 0; - enc->use_predict_ = 0; - enc->use_subtract_green_ = 0; - enc->use_palette_ = + use_palette = AnalyzeAndCreatePalette(pic, low_effort, enc->palette_, &enc->palette_size_); - // TODO(jyrki): replace the decision to be based on an actual estimate - // of entropy, or even spatial variance of entropy. - enc->histo_bits_ = GetHistoBits(method, enc->use_palette_, + // Empirical bit sizes. + enc->histo_bits_ = GetHistoBits(method, use_palette, pic->width, pic->height); enc->transform_bits_ = GetTransformBits(method, enc->histo_bits_); if (low_effort) { // AnalyzeEntropy is somewhat slow. - enc->use_predict_ = !enc->use_palette_; - enc->use_subtract_green_ = !enc->use_palette_; - enc->use_cross_color_ = 0; + crunch_configs[0].entropy_idx_ = use_palette ? kPalette : kSpatialSubGreen; + n_lz77s = 1; + *crunch_configs_size = 1; } else { - int red_and_blue_always_zero; EntropyIx min_entropy_ix; - if (!AnalyzeEntropy(pic->argb, width, height, pic->argb_stride, - enc->use_palette_, &min_entropy_ix, - &red_and_blue_always_zero)) { + // Try out multiple LZ77 on images with few colors. + n_lz77s = (enc->palette_size_ > 0 && enc->palette_size_ <= 16) ? 2 : 1; + if (!AnalyzeEntropy(pic->argb, width, height, pic->argb_stride, use_palette, + enc->palette_size_, enc->transform_bits_, + &min_entropy_ix, red_and_blue_always_zero)) { return 0; } - enc->use_palette_ = (min_entropy_ix == kPalette); - enc->use_subtract_green_ = - (min_entropy_ix == kSubGreen) || (min_entropy_ix == kSpatialSubGreen); - enc->use_predict_ = - (min_entropy_ix == kSpatial) || (min_entropy_ix == kSpatialSubGreen); - enc->use_cross_color_ = red_and_blue_always_zero ? 0 : enc->use_predict_; + if (method == 6 && config->quality == 100) { + // Go brute force on all transforms. + *crunch_configs_size = 0; + for (i = 0; i < kNumEntropyIx; ++i) { + if (i != kPalette || use_palette) { + assert(*crunch_configs_size < CRUNCH_CONFIGS_MAX); + crunch_configs[(*crunch_configs_size)++].entropy_idx_ = i; + } + } + } else { + // Only choose the guessed best transform. + *crunch_configs_size = 1; + crunch_configs[0].entropy_idx_ = min_entropy_ix; + } } + // Fill in the different LZ77s. + assert(n_lz77s <= CRUNCH_CONFIGS_LZ77_MAX); + for (i = 0; i < *crunch_configs_size; ++i) { + int j; + for (j = 0; j < n_lz77s; ++j) { + crunch_configs[i].lz77s_types_to_try_[j] = + (j == 0) ? kLZ77Standard | kLZ77RLE : kLZ77Box; + } + crunch_configs[i].lz77s_types_to_try_size_ = n_lz77s; + } + return 1; +} +static int EncoderInit(VP8LEncoder* const enc) { + const WebPPicture* const pic = enc->pic_; + const int width = pic->width; + const int height = pic->height; + const int pix_cnt = width * height; + // we round the block size up, so we're guaranteed to have + // at most MAX_REFS_BLOCK_PER_IMAGE blocks used: + const int refs_block_size = (pix_cnt - 1) / MAX_REFS_BLOCK_PER_IMAGE + 1; + int i; if (!VP8LHashChainInit(&enc->hash_chain_, pix_cnt)) return 0; - // palette-friendly input typically uses less literals - // -> reduce block size a bit - if (enc->use_palette_) refs_block_size /= 2; - VP8LBackwardRefsInit(&enc->refs_[0], refs_block_size); - VP8LBackwardRefsInit(&enc->refs_[1], refs_block_size); + for (i = 0; i < 3; ++i) VP8LBackwardRefsInit(&enc->refs_[i], refs_block_size); return 1; } @@ -400,6 +462,7 @@ static int GetHuffBitLengthsAndCodes( for (i = 0; i < histogram_image_size; ++i) { const VP8LHistogram* const histo = histogram_image->histograms[i]; HuffmanTreeCode* const codes = &huffman_codes[5 * i]; + assert(histo != NULL); for (k = 0; k < 5; ++k) { const int num_symbols = (k == 0) ? VP8LHistogramNumCodes(histo->palette_code_bits_) : @@ -571,11 +634,16 @@ static void StoreFullHuffmanCode(VP8LBitWriter* const bw, length = write_trimmed_length ? trimmed_length : num_tokens; VP8LPutBits(bw, write_trimmed_length, 1); if (write_trimmed_length) { - const int nbits = VP8LBitsLog2Ceiling(trimmed_length - 1); - const int nbitpairs = (nbits == 0) ? 1 : (nbits + 1) / 2; - VP8LPutBits(bw, nbitpairs - 1, 3); - assert(trimmed_length >= 2); - VP8LPutBits(bw, trimmed_length - 2, nbitpairs * 2); + if (trimmed_length == 2) { + VP8LPutBits(bw, 0, 3 + 2); // nbitpairs=1, trimmed_length=2 + } else { + const int nbits = BitsLog2Floor(trimmed_length - 2); + const int nbitpairs = nbits / 2 + 1; + assert(trimmed_length > 2); + assert(nbitpairs - 1 < 8); + VP8LPutBits(bw, nbitpairs - 1, 3); + VP8LPutBits(bw, trimmed_length - 2, nbitpairs * 2); + } } StoreHuffmanTreeToBitMask(bw, tokens, length, &huffman_code); } @@ -642,7 +710,7 @@ static WEBP_INLINE void WriteHuffmanCodeWithExtraBits( static WebPEncodingError StoreImageToBitMask( VP8LBitWriter* const bw, int width, int histo_bits, - VP8LBackwardRefs* const refs, + const VP8LBackwardRefs* const refs, const uint16_t* histogram_symbols, const HuffmanTreeCode* const huffman_codes) { const int histo_xsize = histo_bits ? VP8LSubSampleSize(width, histo_bits) : 1; @@ -665,7 +733,7 @@ static WebPEncodingError StoreImageToBitMask( codes = huffman_codes + 5 * histogram_ix; } if (PixOrCopyIsLiteral(v)) { - static const int order[] = { 1, 2, 0, 3 }; + static const uint8_t order[] = { 1, 2, 0, 3 }; int k; for (k = 0; k < 4; ++k) { const int code = PixOrCopyLiteral(v, order[k]); @@ -686,7 +754,6 @@ static WebPEncodingError StoreImageToBitMask( // Don't write the distance with the extra bits code since // the distance can be up to 18 bits of extra bits, and the prefix // 15 bits, totaling to 33, and our PutBits only supports up to 32 bits. - // TODO(jyrki): optimize this further. VP8LPrefixEncode(distance, &code, &n_bits, &bits); WriteHuffmanCode(bw, codes + 4, code); VP8LPutBits(bw, bits, n_bits); @@ -705,7 +772,8 @@ static WebPEncodingError StoreImageToBitMask( static WebPEncodingError EncodeImageNoHuffman(VP8LBitWriter* const bw, const uint32_t* const argb, VP8LHashChain* const hash_chain, - VP8LBackwardRefs refs_array[2], + VP8LBackwardRefs* const refs_tmp1, + VP8LBackwardRefs* const refs_tmp2, int width, int height, int quality, int low_effort) { int i; @@ -730,8 +798,9 @@ static WebPEncodingError EncodeImageNoHuffman(VP8LBitWriter* const bw, err = VP8_ENC_ERROR_OUT_OF_MEMORY; goto Error; } - refs = VP8LGetBackwardReferences(width, height, argb, quality, 0, &cache_bits, - hash_chain, refs_array); + refs = VP8LGetBackwardReferences(width, height, argb, quality, 0, + kLZ77Standard | kLZ77RLE, &cache_bits, + hash_chain, refs_tmp1, refs_tmp2); if (refs == NULL) { err = VP8_ENC_ERROR_OUT_OF_MEMORY; goto Error; @@ -741,6 +810,7 @@ static WebPEncodingError EncodeImageNoHuffman(VP8LBitWriter* const bw, err = VP8_ENC_ERROR_OUT_OF_MEMORY; goto Error; } + VP8LHistogramSetClear(histogram_image); // Build histogram image and symbols from backward references. VP8LHistogramStoreRefs(refs, histogram_image->histograms[0]); @@ -788,39 +858,37 @@ static WebPEncodingError EncodeImageNoHuffman(VP8LBitWriter* const bw, return err; } -static WebPEncodingError EncodeImageInternal(VP8LBitWriter* const bw, - const uint32_t* const argb, - VP8LHashChain* const hash_chain, - VP8LBackwardRefs refs_array[2], - int width, int height, int quality, - int low_effort, - int use_cache, int* cache_bits, - int histogram_bits, - size_t init_byte_position, - int* const hdr_size, - int* const data_size) { +static WebPEncodingError EncodeImageInternal( + VP8LBitWriter* const bw, const uint32_t* const argb, + VP8LHashChain* const hash_chain, VP8LBackwardRefs refs_array[3], int width, + int height, int quality, int low_effort, int use_cache, + const CrunchConfig* const config, int* cache_bits, int histogram_bits, + size_t init_byte_position, int* const hdr_size, int* const data_size) { WebPEncodingError err = VP8_ENC_OK; const uint32_t histogram_image_xysize = VP8LSubSampleSize(width, histogram_bits) * VP8LSubSampleSize(height, histogram_bits); VP8LHistogramSet* histogram_image = NULL; - VP8LHistogramSet* tmp_histos = NULL; + VP8LHistogram* tmp_histo = NULL; int histogram_image_size = 0; size_t bit_array_size = 0; - HuffmanTree* huff_tree = NULL; + HuffmanTree* const huff_tree = (HuffmanTree*)WebPSafeMalloc( + 3ULL * CODE_LENGTH_CODES, sizeof(*huff_tree)); HuffmanTreeToken* tokens = NULL; HuffmanTreeCode* huffman_codes = NULL; - VP8LBackwardRefs refs; - VP8LBackwardRefs* best_refs; + VP8LBackwardRefs* refs_best; + VP8LBackwardRefs* refs_tmp; uint16_t* const histogram_symbols = (uint16_t*)WebPSafeMalloc(histogram_image_xysize, sizeof(*histogram_symbols)); + int lz77s_idx; + VP8LBitWriter bw_init = *bw, bw_best; + int hdr_size_tmp; assert(histogram_bits >= MIN_HUFFMAN_BITS); assert(histogram_bits <= MAX_HUFFMAN_BITS); assert(hdr_size != NULL); assert(data_size != NULL); - VP8LBackwardRefsInit(&refs, refs_array[0].block_size_); if (histogram_symbols == NULL) { err = VP8_ENC_ERROR_OUT_OF_MEMORY; goto Error; @@ -836,142 +904,162 @@ static WebPEncodingError EncodeImageInternal(VP8LBitWriter* const bw, // 'best_refs' is the reference to the best backward refs and points to one // of refs_array[0] or refs_array[1]. // Calculate backward references from ARGB image. - if (!VP8LHashChainFill(hash_chain, quality, argb, width, height, - low_effort)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - best_refs = VP8LGetBackwardReferences(width, height, argb, quality, - low_effort, cache_bits, hash_chain, - refs_array); - if (best_refs == NULL || !VP8LBackwardRefsCopy(best_refs, &refs)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - histogram_image = - VP8LAllocateHistogramSet(histogram_image_xysize, *cache_bits); - tmp_histos = VP8LAllocateHistogramSet(2, *cache_bits); - if (histogram_image == NULL || tmp_histos == NULL) { + if (huff_tree == NULL || + !VP8LHashChainFill(hash_chain, quality, argb, width, height, + low_effort) || + !VP8LBitWriterInit(&bw_best, 0) || + (config->lz77s_types_to_try_size_ > 1 && + !VP8LBitWriterClone(bw, &bw_best))) { err = VP8_ENC_ERROR_OUT_OF_MEMORY; goto Error; } + for (lz77s_idx = 0; lz77s_idx < config->lz77s_types_to_try_size_; + ++lz77s_idx) { + refs_best = VP8LGetBackwardReferences( + width, height, argb, quality, low_effort, + config->lz77s_types_to_try_[lz77s_idx], cache_bits, hash_chain, + &refs_array[0], &refs_array[1]); + if (refs_best == NULL) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + // Keep the best references aside and use the other element from the first + // two as a temporary for later usage. + refs_tmp = &refs_array[refs_best == &refs_array[0] ? 1 : 0]; + + histogram_image = + VP8LAllocateHistogramSet(histogram_image_xysize, *cache_bits); + tmp_histo = VP8LAllocateHistogram(*cache_bits); + if (histogram_image == NULL || tmp_histo == NULL) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } - // Build histogram image and symbols from backward references. - if (!VP8LGetHistoImageSymbols(width, height, &refs, quality, low_effort, - histogram_bits, *cache_bits, histogram_image, - tmp_histos, histogram_symbols)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - // Create Huffman bit lengths and codes for each histogram image. - histogram_image_size = histogram_image->size; - bit_array_size = 5 * histogram_image_size; - huffman_codes = (HuffmanTreeCode*)WebPSafeCalloc(bit_array_size, - sizeof(*huffman_codes)); - // Note: some histogram_image entries may point to tmp_histos[], so the latter - // need to outlive the following call to GetHuffBitLengthsAndCodes(). - if (huffman_codes == NULL || - !GetHuffBitLengthsAndCodes(histogram_image, huffman_codes)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - // Free combined histograms. - VP8LFreeHistogramSet(histogram_image); - histogram_image = NULL; + // Build histogram image and symbols from backward references. + if (!VP8LGetHistoImageSymbols(width, height, refs_best, quality, low_effort, + histogram_bits, *cache_bits, histogram_image, + tmp_histo, histogram_symbols)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + // Create Huffman bit lengths and codes for each histogram image. + histogram_image_size = histogram_image->size; + bit_array_size = 5 * histogram_image_size; + huffman_codes = (HuffmanTreeCode*)WebPSafeCalloc(bit_array_size, + sizeof(*huffman_codes)); + // Note: some histogram_image entries may point to tmp_histos[], so the + // latter need to outlive the following call to GetHuffBitLengthsAndCodes(). + if (huffman_codes == NULL || + !GetHuffBitLengthsAndCodes(histogram_image, huffman_codes)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + // Free combined histograms. + VP8LFreeHistogramSet(histogram_image); + histogram_image = NULL; - // Free scratch histograms. - VP8LFreeHistogramSet(tmp_histos); - tmp_histos = NULL; + // Free scratch histograms. + VP8LFreeHistogram(tmp_histo); + tmp_histo = NULL; - // Color Cache parameters. - if (*cache_bits > 0) { - VP8LPutBits(bw, 1, 1); - VP8LPutBits(bw, *cache_bits, 4); - } else { - VP8LPutBits(bw, 0, 1); - } + // Color Cache parameters. + if (*cache_bits > 0) { + VP8LPutBits(bw, 1, 1); + VP8LPutBits(bw, *cache_bits, 4); + } else { + VP8LPutBits(bw, 0, 1); + } - // Huffman image + meta huffman. - { - const int write_histogram_image = (histogram_image_size > 1); - VP8LPutBits(bw, write_histogram_image, 1); - if (write_histogram_image) { - uint32_t* const histogram_argb = - (uint32_t*)WebPSafeMalloc(histogram_image_xysize, - sizeof(*histogram_argb)); - int max_index = 0; - uint32_t i; - if (histogram_argb == NULL) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - for (i = 0; i < histogram_image_xysize; ++i) { - const int symbol_index = histogram_symbols[i] & 0xffff; - histogram_argb[i] = (symbol_index << 8); - if (symbol_index >= max_index) { - max_index = symbol_index + 1; + // Huffman image + meta huffman. + { + const int write_histogram_image = (histogram_image_size > 1); + VP8LPutBits(bw, write_histogram_image, 1); + if (write_histogram_image) { + uint32_t* const histogram_argb = + (uint32_t*)WebPSafeMalloc(histogram_image_xysize, + sizeof(*histogram_argb)); + int max_index = 0; + uint32_t i; + if (histogram_argb == NULL) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + for (i = 0; i < histogram_image_xysize; ++i) { + const int symbol_index = histogram_symbols[i] & 0xffff; + histogram_argb[i] = (symbol_index << 8); + if (symbol_index >= max_index) { + max_index = symbol_index + 1; + } } + histogram_image_size = max_index; + + VP8LPutBits(bw, histogram_bits - 2, 3); + err = EncodeImageNoHuffman( + bw, histogram_argb, hash_chain, refs_tmp, &refs_array[2], + VP8LSubSampleSize(width, histogram_bits), + VP8LSubSampleSize(height, histogram_bits), quality, low_effort); + WebPSafeFree(histogram_argb); + if (err != VP8_ENC_OK) goto Error; } - histogram_image_size = max_index; - - VP8LPutBits(bw, histogram_bits - 2, 3); - err = EncodeImageNoHuffman(bw, histogram_argb, hash_chain, refs_array, - VP8LSubSampleSize(width, histogram_bits), - VP8LSubSampleSize(height, histogram_bits), - quality, low_effort); - WebPSafeFree(histogram_argb); - if (err != VP8_ENC_OK) goto Error; } - } - // Store Huffman codes. - { - int i; - int max_tokens = 0; - huff_tree = (HuffmanTree*)WebPSafeMalloc(3ULL * CODE_LENGTH_CODES, - sizeof(*huff_tree)); - if (huff_tree == NULL) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } - // Find maximum number of symbols for the huffman tree-set. - for (i = 0; i < 5 * histogram_image_size; ++i) { - HuffmanTreeCode* const codes = &huffman_codes[i]; - if (max_tokens < codes->num_symbols) { - max_tokens = codes->num_symbols; + // Store Huffman codes. + { + int i; + int max_tokens = 0; + // Find maximum number of symbols for the huffman tree-set. + for (i = 0; i < 5 * histogram_image_size; ++i) { + HuffmanTreeCode* const codes = &huffman_codes[i]; + if (max_tokens < codes->num_symbols) { + max_tokens = codes->num_symbols; + } + } + tokens = (HuffmanTreeToken*)WebPSafeMalloc(max_tokens, sizeof(*tokens)); + if (tokens == NULL) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + for (i = 0; i < 5 * histogram_image_size; ++i) { + HuffmanTreeCode* const codes = &huffman_codes[i]; + StoreHuffmanCode(bw, huff_tree, tokens, codes); + ClearHuffmanTreeIfOnlyOneSymbol(codes); } } - tokens = (HuffmanTreeToken*)WebPSafeMalloc(max_tokens, - sizeof(*tokens)); - if (tokens == NULL) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; + // Store actual literals. + hdr_size_tmp = (int)(VP8LBitWriterNumBytes(bw) - init_byte_position); + err = StoreImageToBitMask(bw, width, histogram_bits, refs_best, + histogram_symbols, huffman_codes); + // Keep track of the smallest image so far. + if (lz77s_idx == 0 || + VP8LBitWriterNumBytes(bw) < VP8LBitWriterNumBytes(&bw_best)) { + *hdr_size = hdr_size_tmp; + *data_size = + (int)(VP8LBitWriterNumBytes(bw) - init_byte_position - *hdr_size); + VP8LBitWriterSwap(bw, &bw_best); } - for (i = 0; i < 5 * histogram_image_size; ++i) { - HuffmanTreeCode* const codes = &huffman_codes[i]; - StoreHuffmanCode(bw, huff_tree, tokens, codes); - ClearHuffmanTreeIfOnlyOneSymbol(codes); + // Reset the bit writer for the following iteration if any. + if (config->lz77s_types_to_try_size_ > 1) VP8LBitWriterReset(&bw_init, bw); + WebPSafeFree(tokens); + tokens = NULL; + if (huffman_codes != NULL) { + WebPSafeFree(huffman_codes->codes); + WebPSafeFree(huffman_codes); + huffman_codes = NULL; } } - - *hdr_size = (int)(VP8LBitWriterNumBytes(bw) - init_byte_position); - // Store actual literals. - err = StoreImageToBitMask(bw, width, histogram_bits, &refs, - histogram_symbols, huffman_codes); - *data_size = - (int)(VP8LBitWriterNumBytes(bw) - init_byte_position - *hdr_size); + VP8LBitWriterSwap(bw, &bw_best); Error: WebPSafeFree(tokens); WebPSafeFree(huff_tree); VP8LFreeHistogramSet(histogram_image); - VP8LFreeHistogramSet(tmp_histos); - VP8LBackwardRefsClear(&refs); + VP8LFreeHistogram(tmp_histo); if (huffman_codes != NULL) { WebPSafeFree(huffman_codes->codes); WebPSafeFree(huffman_codes); } WebPSafeFree(histogram_symbols); + VP8LBitWriterWipeOut(&bw_best); return err; } @@ -1005,11 +1093,11 @@ static WebPEncodingError ApplyPredictFilter(const VP8LEncoder* const enc, VP8LPutBits(bw, PREDICTOR_TRANSFORM, 2); assert(pred_bits >= 2); VP8LPutBits(bw, pred_bits - 2, 3); - return EncodeImageNoHuffman(bw, enc->transform_data_, - (VP8LHashChain*)&enc->hash_chain_, - (VP8LBackwardRefs*)enc->refs_, // cast const away - transform_width, transform_height, - quality, low_effort); + return EncodeImageNoHuffman( + bw, enc->transform_data_, (VP8LHashChain*)&enc->hash_chain_, + (VP8LBackwardRefs*)&enc->refs_[0], // cast const away + (VP8LBackwardRefs*)&enc->refs_[1], transform_width, transform_height, + quality, low_effort); } static WebPEncodingError ApplyCrossColorFilter(const VP8LEncoder* const enc, @@ -1026,11 +1114,11 @@ static WebPEncodingError ApplyCrossColorFilter(const VP8LEncoder* const enc, VP8LPutBits(bw, CROSS_COLOR_TRANSFORM, 2); assert(ccolor_transform_bits >= 2); VP8LPutBits(bw, ccolor_transform_bits - 2, 3); - return EncodeImageNoHuffman(bw, enc->transform_data_, - (VP8LHashChain*)&enc->hash_chain_, - (VP8LBackwardRefs*)enc->refs_, // cast const away - transform_width, transform_height, - quality, low_effort); + return EncodeImageNoHuffman( + bw, enc->transform_data_, (VP8LHashChain*)&enc->hash_chain_, + (VP8LBackwardRefs*)&enc->refs_[0], // cast const away + (VP8LBackwardRefs*)&enc->refs_[1], transform_width, transform_height, + quality, low_effort); } // ----------------------------------------------------------------------------- @@ -1144,6 +1232,7 @@ static WebPEncodingError AllocateTransformBuffer(VP8LEncoder* const enc, } enc->transform_mem_ = mem; enc->transform_mem_size_ = (size_t)mem_size; + enc->argb_content_ = kEncoderNone; } enc->argb_ = mem; mem = (uint32_t*)WEBP_ALIGN(mem + image_size); @@ -1161,14 +1250,22 @@ static WebPEncodingError MakeInputImageCopy(VP8LEncoder* const enc) { const WebPPicture* const picture = enc->pic_; const int width = picture->width; const int height = picture->height; - int y; + err = AllocateTransformBuffer(enc, width, height); if (err != VP8_ENC_OK) return err; - for (y = 0; y < height; ++y) { - memcpy(enc->argb_ + y * width, - picture->argb + y * picture->argb_stride, - width * sizeof(*enc->argb_)); + if (enc->argb_content_ == kEncoderARGB) return VP8_ENC_OK; + + { + uint32_t* dst = enc->argb_; + const uint32_t* src = picture->argb; + int y; + for (y = 0; y < height; ++y) { + memcpy(dst, src, width * sizeof(*dst)); + dst += width; + src += picture->argb_stride; + } } + enc->argb_content_ = kEncoderARGB; assert(enc->current_width_ == width); return VP8_ENC_OK; } @@ -1215,12 +1312,13 @@ static WEBP_INLINE uint32_t ApplyPaletteHash0(uint32_t color) { static WEBP_INLINE uint32_t ApplyPaletteHash1(uint32_t color) { // Forget about alpha. - return ((color & 0x00ffffffu) * 4222244071u) >> (32 - PALETTE_INV_SIZE_BITS); + return ((uint32_t)((color & 0x00ffffffu) * 4222244071ull)) >> + (32 - PALETTE_INV_SIZE_BITS); } static WEBP_INLINE uint32_t ApplyPaletteHash2(uint32_t color) { // Forget about alpha. - return (color & 0x00ffffffu) * ((1u << 31) - 1) >> + return ((uint32_t)((color & 0x00ffffffu) * ((1ull << 31) - 1))) >> (32 - PALETTE_INV_SIZE_BITS); } @@ -1346,6 +1444,7 @@ static WebPEncodingError MapImageFromPalette(VP8LEncoder* const enc, err = ApplyPalette(src, src_stride, enc->argb_, enc->current_width_, palette, palette_size, width, height, xbits); + enc->argb_content_ = kEncoderPalette; return err; } @@ -1364,52 +1463,11 @@ static WebPEncodingError EncodePalette(VP8LBitWriter* const bw, int low_effort, tmp_palette[i] = VP8LSubPixels(palette[i], palette[i - 1]); } tmp_palette[0] = palette[0]; - return EncodeImageNoHuffman(bw, tmp_palette, &enc->hash_chain_, enc->refs_, - palette_size, 1, 20 /* quality */, low_effort); -} - -#ifdef WEBP_EXPERIMENTAL_FEATURES - -static WebPEncodingError EncodeDeltaPalettePredictorImage( - VP8LBitWriter* const bw, VP8LEncoder* const enc, int quality, - int low_effort) { - const WebPPicture* const pic = enc->pic_; - const int width = pic->width; - const int height = pic->height; - - const int pred_bits = 5; - const int transform_width = VP8LSubSampleSize(width, pred_bits); - const int transform_height = VP8LSubSampleSize(height, pred_bits); - const int pred = 7; // default is Predictor7 (Top/Left Average) - const int tiles_per_row = VP8LSubSampleSize(width, pred_bits); - const int tiles_per_col = VP8LSubSampleSize(height, pred_bits); - uint32_t* predictors; - int tile_x, tile_y; - WebPEncodingError err = VP8_ENC_OK; - - predictors = (uint32_t*)WebPSafeMalloc(tiles_per_col * tiles_per_row, - sizeof(*predictors)); - if (predictors == NULL) return VP8_ENC_ERROR_OUT_OF_MEMORY; - - for (tile_y = 0; tile_y < tiles_per_col; ++tile_y) { - for (tile_x = 0; tile_x < tiles_per_row; ++tile_x) { - predictors[tile_y * tiles_per_row + tile_x] = 0xff000000u | (pred << 8); - } - } - - VP8LPutBits(bw, TRANSFORM_PRESENT, 1); - VP8LPutBits(bw, PREDICTOR_TRANSFORM, 2); - VP8LPutBits(bw, pred_bits - 2, 3); - err = EncodeImageNoHuffman(bw, predictors, &enc->hash_chain_, - (VP8LBackwardRefs*)enc->refs_, // cast const away - transform_width, transform_height, - quality, low_effort); - WebPSafeFree(predictors); - return err; + return EncodeImageNoHuffman(bw, tmp_palette, &enc->hash_chain_, + &enc->refs_[0], &enc->refs_[1], palette_size, 1, + 20 /* quality */, low_effort); } -#endif // WEBP_EXPERIMENTAL_FEATURES - // ----------------------------------------------------------------------------- // VP8LEncoder @@ -1422,6 +1480,7 @@ static VP8LEncoder* VP8LEncoderNew(const WebPConfig* const config, } enc->config_ = config; enc->pic_ = picture; + enc->argb_content_ = kEncoderNone; VP8LEncDspInit(); @@ -1430,9 +1489,9 @@ static VP8LEncoder* VP8LEncoderNew(const WebPConfig* const config, static void VP8LEncoderDelete(VP8LEncoder* enc) { if (enc != NULL) { + int i; VP8LHashChainClear(&enc->hash_chain_); - VP8LBackwardRefsClear(&enc->refs_[0]); - VP8LBackwardRefsClear(&enc->refs_[1]); + for (i = 0; i < 3; ++i) VP8LBackwardRefsClear(&enc->refs_[i]); ClearTransformBuffer(enc); WebPSafeFree(enc); } @@ -1441,134 +1500,324 @@ static void VP8LEncoderDelete(VP8LEncoder* enc) { // ----------------------------------------------------------------------------- // Main call -WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, - const WebPPicture* const picture, - VP8LBitWriter* const bw, int use_cache) { +typedef struct { + const WebPConfig* config_; + const WebPPicture* picture_; + VP8LBitWriter* bw_; + VP8LEncoder* enc_; + int use_cache_; + CrunchConfig crunch_configs_[CRUNCH_CONFIGS_MAX]; + int num_crunch_configs_; + int red_and_blue_always_zero_; + WebPEncodingError err_; + WebPAuxStats* stats_; +} StreamEncodeContext; + +static int EncodeStreamHook(void* input, void* data2) { + StreamEncodeContext* const params = (StreamEncodeContext*)input; + const WebPConfig* const config = params->config_; + const WebPPicture* const picture = params->picture_; + VP8LBitWriter* const bw = params->bw_; + VP8LEncoder* const enc = params->enc_; + const int use_cache = params->use_cache_; + const CrunchConfig* const crunch_configs = params->crunch_configs_; + const int num_crunch_configs = params->num_crunch_configs_; + const int red_and_blue_always_zero = params->red_and_blue_always_zero_; +#if !defined(WEBP_DISABLE_STATS) + WebPAuxStats* const stats = params->stats_; +#endif WebPEncodingError err = VP8_ENC_OK; const int quality = (int)config->quality; const int low_effort = (config->method == 0); +#if (WEBP_NEAR_LOSSLESS == 1) const int width = picture->width; +#endif const int height = picture->height; - VP8LEncoder* const enc = VP8LEncoderNew(config, picture); const size_t byte_position = VP8LBitWriterNumBytes(bw); +#if (WEBP_NEAR_LOSSLESS == 1) int use_near_lossless = 0; +#endif int hdr_size = 0; int data_size = 0; int use_delta_palette = 0; + int idx; + size_t best_size = 0; + VP8LBitWriter bw_init = *bw, bw_best; + (void)data2; - if (enc == NULL) { + if (!VP8LBitWriterInit(&bw_best, 0) || + (num_crunch_configs > 1 && !VP8LBitWriterClone(bw, &bw_best))) { err = VP8_ENC_ERROR_OUT_OF_MEMORY; goto Error; } - // --------------------------------------------------------------------------- - // Analyze image (entropy, num_palettes etc) - - if (!AnalyzeAndInit(enc)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; - } + for (idx = 0; idx < num_crunch_configs; ++idx) { + const int entropy_idx = crunch_configs[idx].entropy_idx_; + enc->use_palette_ = (entropy_idx == kPalette); + enc->use_subtract_green_ = + (entropy_idx == kSubGreen) || (entropy_idx == kSpatialSubGreen); + enc->use_predict_ = + (entropy_idx == kSpatial) || (entropy_idx == kSpatialSubGreen); + if (low_effort) { + enc->use_cross_color_ = 0; + } else { + enc->use_cross_color_ = red_and_blue_always_zero ? 0 : enc->use_predict_; + } + // Reset any parameter in the encoder that is set in the previous iteration. + enc->cache_bits_ = 0; + VP8LBackwardRefsClear(&enc->refs_[0]); + VP8LBackwardRefsClear(&enc->refs_[1]); - // Apply near-lossless preprocessing. - use_near_lossless = - (config->near_lossless < 100) && !enc->use_palette_ && !enc->use_predict_; - if (use_near_lossless) { - if (!VP8ApplyNearLossless(width, height, picture->argb, - config->near_lossless)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; - goto Error; +#if (WEBP_NEAR_LOSSLESS == 1) + // Apply near-lossless preprocessing. + use_near_lossless = (config->near_lossless < 100) && !enc->use_palette_ && + !enc->use_predict_; + if (use_near_lossless) { + err = AllocateTransformBuffer(enc, width, height); + if (err != VP8_ENC_OK) goto Error; + if ((enc->argb_content_ != kEncoderNearLossless) && + !VP8ApplyNearLossless(picture, config->near_lossless, enc->argb_)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + enc->argb_content_ = kEncoderNearLossless; + } else { + enc->argb_content_ = kEncoderNone; } - } +#else + enc->argb_content_ = kEncoderNone; +#endif -#ifdef WEBP_EXPERIMENTAL_FEATURES - if (config->use_delta_palette) { - enc->use_predict_ = 1; - enc->use_cross_color_ = 0; - enc->use_subtract_green_ = 0; - enc->use_palette_ = 1; - err = MakeInputImageCopy(enc); - if (err != VP8_ENC_OK) goto Error; - err = WebPSearchOptimalDeltaPalette(enc); - if (err != VP8_ENC_OK) goto Error; + // Encode palette if (enc->use_palette_) { - err = AllocateTransformBuffer(enc, width, height); + err = EncodePalette(bw, low_effort, enc); if (err != VP8_ENC_OK) goto Error; - err = EncodeDeltaPalettePredictorImage(bw, enc, quality, low_effort); + err = MapImageFromPalette(enc, use_delta_palette); if (err != VP8_ENC_OK) goto Error; - use_delta_palette = 1; + // If using a color cache, do not have it bigger than the number of + // colors. + if (use_cache && enc->palette_size_ < (1 << MAX_COLOR_CACHE_BITS)) { + enc->cache_bits_ = BitsLog2Floor(enc->palette_size_) + 1; + } } - } -#endif // WEBP_EXPERIMENTAL_FEATURES + if (!use_delta_palette) { + // In case image is not packed. + if (enc->argb_content_ != kEncoderNearLossless && + enc->argb_content_ != kEncoderPalette) { + err = MakeInputImageCopy(enc); + if (err != VP8_ENC_OK) goto Error; + } - // Encode palette - if (enc->use_palette_) { - err = EncodePalette(bw, low_effort, enc); - if (err != VP8_ENC_OK) goto Error; - err = MapImageFromPalette(enc, use_delta_palette); - if (err != VP8_ENC_OK) goto Error; - // If using a color cache, do not have it bigger than the number of colors. - if (use_cache && enc->palette_size_ < (1 << MAX_COLOR_CACHE_BITS)) { - enc->cache_bits_ = BitsLog2Floor(enc->palette_size_) + 1; - } - } - if (!use_delta_palette) { - // In case image is not packed. - if (enc->argb_ == NULL) { - err = MakeInputImageCopy(enc); - if (err != VP8_ENC_OK) goto Error; + // ----------------------------------------------------------------------- + // Apply transforms and write transform data. + + if (enc->use_subtract_green_) { + ApplySubtractGreen(enc, enc->current_width_, height, bw); + } + + if (enc->use_predict_) { + err = ApplyPredictFilter(enc, enc->current_width_, height, quality, + low_effort, enc->use_subtract_green_, bw); + if (err != VP8_ENC_OK) goto Error; + } + + if (enc->use_cross_color_) { + err = ApplyCrossColorFilter(enc, enc->current_width_, height, quality, + low_effort, bw); + if (err != VP8_ENC_OK) goto Error; + } } + VP8LPutBits(bw, !TRANSFORM_PRESENT, 1); // No more transforms. + // ------------------------------------------------------------------------- - // Apply transforms and write transform data. + // Encode and write the transformed image. + err = EncodeImageInternal(bw, enc->argb_, &enc->hash_chain_, enc->refs_, + enc->current_width_, height, quality, low_effort, + use_cache, &crunch_configs[idx], + &enc->cache_bits_, enc->histo_bits_, + byte_position, &hdr_size, &data_size); + if (err != VP8_ENC_OK) goto Error; - if (enc->use_subtract_green_) { - ApplySubtractGreen(enc, enc->current_width_, height, bw); + // If we are better than what we already have. + if (idx == 0 || VP8LBitWriterNumBytes(bw) < best_size) { + best_size = VP8LBitWriterNumBytes(bw); + // Store the BitWriter. + VP8LBitWriterSwap(bw, &bw_best); +#if !defined(WEBP_DISABLE_STATS) + // Update the stats. + if (stats != NULL) { + stats->lossless_features = 0; + if (enc->use_predict_) stats->lossless_features |= 1; + if (enc->use_cross_color_) stats->lossless_features |= 2; + if (enc->use_subtract_green_) stats->lossless_features |= 4; + if (enc->use_palette_) stats->lossless_features |= 8; + stats->histogram_bits = enc->histo_bits_; + stats->transform_bits = enc->transform_bits_; + stats->cache_bits = enc->cache_bits_; + stats->palette_size = enc->palette_size_; + stats->lossless_size = (int)(best_size - byte_position); + stats->lossless_hdr_size = hdr_size; + stats->lossless_data_size = data_size; + } +#endif } + // Reset the bit writer for the following iteration if any. + if (num_crunch_configs > 1) VP8LBitWriterReset(&bw_init, bw); + } + VP8LBitWriterSwap(&bw_best, bw); - if (enc->use_predict_) { - err = ApplyPredictFilter(enc, enc->current_width_, height, quality, - low_effort, enc->use_subtract_green_, bw); - if (err != VP8_ENC_OK) goto Error; - } +Error: + VP8LBitWriterWipeOut(&bw_best); + params->err_ = err; + // The hook should return false in case of error. + return (err == VP8_ENC_OK); +} - if (enc->use_cross_color_) { - err = ApplyCrossColorFilter(enc, enc->current_width_, - height, quality, low_effort, bw); - if (err != VP8_ENC_OK) goto Error; - } +WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, + const WebPPicture* const picture, + VP8LBitWriter* const bw_main, + int use_cache) { + WebPEncodingError err = VP8_ENC_OK; + VP8LEncoder* const enc_main = VP8LEncoderNew(config, picture); + VP8LEncoder* enc_side = NULL; + CrunchConfig crunch_configs[CRUNCH_CONFIGS_MAX]; + int num_crunch_configs_main, num_crunch_configs_side = 0; + int idx; + int red_and_blue_always_zero = 0; + WebPWorker worker_main, worker_side; + StreamEncodeContext params_main, params_side; + // The main thread uses picture->stats, the side thread uses stats_side. + WebPAuxStats stats_side; + VP8LBitWriter bw_side; + const WebPWorkerInterface* const worker_interface = WebPGetWorkerInterface(); + int ok_main; + + // Analyze image (entropy, num_palettes etc) + if (enc_main == NULL || + !EncoderAnalyze(enc_main, crunch_configs, &num_crunch_configs_main, + &red_and_blue_always_zero) || + !EncoderInit(enc_main) || !VP8LBitWriterInit(&bw_side, 0)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; } - VP8LPutBits(bw, !TRANSFORM_PRESENT, 1); // No more transforms. + // Split the configs between the main and side threads (if any). + if (config->thread_level > 0) { + num_crunch_configs_side = num_crunch_configs_main / 2; + for (idx = 0; idx < num_crunch_configs_side; ++idx) { + params_side.crunch_configs_[idx] = + crunch_configs[num_crunch_configs_main - num_crunch_configs_side + + idx]; + } + params_side.num_crunch_configs_ = num_crunch_configs_side; + } + num_crunch_configs_main -= num_crunch_configs_side; + for (idx = 0; idx < num_crunch_configs_main; ++idx) { + params_main.crunch_configs_[idx] = crunch_configs[idx]; + } + params_main.num_crunch_configs_ = num_crunch_configs_main; - // --------------------------------------------------------------------------- - // Encode and write the transformed image. - err = EncodeImageInternal(bw, enc->argb_, &enc->hash_chain_, enc->refs_, - enc->current_width_, height, quality, low_effort, - use_cache, &enc->cache_bits_, enc->histo_bits_, - byte_position, &hdr_size, &data_size); - if (err != VP8_ENC_OK) goto Error; + // Fill in the parameters for the thread workers. + { + const int params_size = (num_crunch_configs_side > 0) ? 2 : 1; + for (idx = 0; idx < params_size; ++idx) { + // Create the parameters for each worker. + WebPWorker* const worker = (idx == 0) ? &worker_main : &worker_side; + StreamEncodeContext* const param = + (idx == 0) ? ¶ms_main : ¶ms_side; + param->config_ = config; + param->picture_ = picture; + param->use_cache_ = use_cache; + param->red_and_blue_always_zero_ = red_and_blue_always_zero; + if (idx == 0) { + param->stats_ = picture->stats; + param->bw_ = bw_main; + param->enc_ = enc_main; + } else { + param->stats_ = (picture->stats == NULL) ? NULL : &stats_side; + // Create a side bit writer. + if (!VP8LBitWriterClone(bw_main, &bw_side)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + param->bw_ = &bw_side; + // Create a side encoder. + enc_side = VP8LEncoderNew(config, picture); + if (enc_side == NULL || !EncoderInit(enc_side)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } + // Copy the values that were computed for the main encoder. + enc_side->histo_bits_ = enc_main->histo_bits_; + enc_side->transform_bits_ = enc_main->transform_bits_; + enc_side->palette_size_ = enc_main->palette_size_; + memcpy(enc_side->palette_, enc_main->palette_, + sizeof(enc_main->palette_)); + param->enc_ = enc_side; + } + // Create the workers. + worker_interface->Init(worker); + worker->data1 = param; + worker->data2 = NULL; + worker->hook = EncodeStreamHook; + } + } - if (picture->stats != NULL) { - WebPAuxStats* const stats = picture->stats; - stats->lossless_features = 0; - if (enc->use_predict_) stats->lossless_features |= 1; - if (enc->use_cross_color_) stats->lossless_features |= 2; - if (enc->use_subtract_green_) stats->lossless_features |= 4; - if (enc->use_palette_) stats->lossless_features |= 8; - stats->histogram_bits = enc->histo_bits_; - stats->transform_bits = enc->transform_bits_; - stats->cache_bits = enc->cache_bits_; - stats->palette_size = enc->palette_size_; - stats->lossless_size = (int)(VP8LBitWriterNumBytes(bw) - byte_position); - stats->lossless_hdr_size = hdr_size; - stats->lossless_data_size = data_size; + // Start the second thread if needed. + if (num_crunch_configs_side != 0) { + if (!worker_interface->Reset(&worker_side)) { + err = VP8_ENC_ERROR_OUT_OF_MEMORY; + goto Error; + } +#if !defined(WEBP_DISABLE_STATS) + // This line is here and not in the param initialization above to remove a + // Clang static analyzer warning. + if (picture->stats != NULL) { + memcpy(&stats_side, picture->stats, sizeof(stats_side)); + } +#endif + // This line is only useful to remove a Clang static analyzer warning. + params_side.err_ = VP8_ENC_OK; + worker_interface->Launch(&worker_side); + } + // Execute the main thread. + worker_interface->Execute(&worker_main); + ok_main = worker_interface->Sync(&worker_main); + worker_interface->End(&worker_main); + if (num_crunch_configs_side != 0) { + // Wait for the second thread. + const int ok_side = worker_interface->Sync(&worker_side); + worker_interface->End(&worker_side); + if (!ok_main || !ok_side) { + err = ok_main ? params_side.err_ : params_main.err_; + goto Error; + } + if (VP8LBitWriterNumBytes(&bw_side) < VP8LBitWriterNumBytes(bw_main)) { + VP8LBitWriterSwap(bw_main, &bw_side); +#if !defined(WEBP_DISABLE_STATS) + if (picture->stats != NULL) { + memcpy(picture->stats, &stats_side, sizeof(*picture->stats)); + } +#endif + } + } else { + if (!ok_main) { + err = params_main.err_; + goto Error; + } } - Error: - VP8LEncoderDelete(enc); +Error: + VP8LBitWriterWipeOut(&bw_side); + VP8LEncoderDelete(enc_main); + VP8LEncoderDelete(enc_side); return err; } +#undef CRUNCH_CONFIGS_MAX +#undef CRUNCH_CONFIGS_LZ77_MAX + int VP8LEncodeImage(const WebPConfig* const config, const WebPPicture* const picture) { int width, height; @@ -1633,7 +1882,6 @@ int VP8LEncodeImage(const WebPConfig* const config, err = VP8LEncodeStream(config, picture, &bw, 1 /*use_cache*/); if (err != VP8_ENC_OK) goto Error; - // TODO(skal): have a fine-grained progress report in VP8LEncodeStream(). if (!WebPReportProgress(picture, 90, &percent)) goto UserAbort; // Finish the RIFF chunk. @@ -1642,11 +1890,13 @@ int VP8LEncodeImage(const WebPConfig* const config, if (!WebPReportProgress(picture, 100, &percent)) goto UserAbort; +#if !defined(WEBP_DISABLE_STATS) // Save size. if (picture->stats != NULL) { picture->stats->coded_size += (int)coded_size; picture->stats->lossless_size = (int)coded_size; } +#endif if (picture->extra_info != NULL) { const int mb_w = (width + 15) >> 4; diff --git a/Pods/libwebp/src/enc/vp8li_enc.h b/Pods/libwebp/src/enc/vp8li_enc.h index 8c5fbcb..d2d0fc5 100644 --- a/Pods/libwebp/src/enc/vp8li_enc.h +++ b/Pods/libwebp/src/enc/vp8li_enc.h @@ -11,14 +11,23 @@ // // Author: Vikas Arora (vikaas.arora@gmail.com) -#ifndef WEBP_ENC_VP8LI_H_ -#define WEBP_ENC_VP8LI_H_ +#ifndef WEBP_ENC_VP8LI_ENC_H_ +#define WEBP_ENC_VP8LI_ENC_H_ -#include "./backward_references_enc.h" -#include "./histogram_enc.h" -#include "../utils/bit_writer_utils.h" -#include "../webp/encode.h" -#include "../webp/format_constants.h" +#ifdef HAVE_CONFIG_H +#include "src/webp/config.h" +#endif +// Either WEBP_NEAR_LOSSLESS is defined as 0 in config.h when compiling to +// disable near-lossless, or it is enabled by default. +#ifndef WEBP_NEAR_LOSSLESS +#define WEBP_NEAR_LOSSLESS 1 +#endif + +#include "src/enc/backward_references_enc.h" +#include "src/enc/histogram_enc.h" +#include "src/utils/bit_writer_utils.h" +#include "src/webp/encode.h" +#include "src/webp/format_constants.h" #ifdef __cplusplus extern "C" { @@ -27,16 +36,24 @@ extern "C" { // maximum value of transform_bits_ in VP8LEncoder. #define MAX_TRANSFORM_BITS 6 +typedef enum { + kEncoderNone = 0, + kEncoderARGB, + kEncoderNearLossless, + kEncoderPalette +} VP8LEncoderARGBContent; + typedef struct { const WebPConfig* config_; // user configuration and parameters const WebPPicture* pic_; // input picture. - uint32_t* argb_; // Transformed argb image data. - uint32_t* argb_scratch_; // Scratch memory for argb rows - // (used for prediction). - uint32_t* transform_data_; // Scratch memory for transform data. - uint32_t* transform_mem_; // Currently allocated memory. - size_t transform_mem_size_; // Currently allocated memory size. + uint32_t* argb_; // Transformed argb image data. + VP8LEncoderARGBContent argb_content_; // Content type of the argb buffer. + uint32_t* argb_scratch_; // Scratch memory for argb rows + // (used for prediction). + uint32_t* transform_data_; // Scratch memory for transform data. + uint32_t* transform_mem_; // Currently allocated memory. + size_t transform_mem_size_; // Currently allocated memory size. int current_width_; // Corresponds to packed image width. @@ -54,8 +71,7 @@ typedef struct { uint32_t palette_[MAX_PALETTE_SIZE]; // Some 'scratch' (potentially large) objects. - struct VP8LBackwardRefs refs_[2]; // Backward Refs array corresponding to - // LZ77 & RLE coding. + struct VP8LBackwardRefs refs_[3]; // Backward Refs array for temporaries. VP8LHashChain hash_chain_; // HashChain data for constructing // backward references. } VP8LEncoder; @@ -75,6 +91,13 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, const WebPPicture* const picture, VP8LBitWriter* const bw, int use_cache); +#if (WEBP_NEAR_LOSSLESS == 1) +// in near_lossless.c +// Near lossless preprocessing in RGB color-space. +int VP8ApplyNearLossless(const WebPPicture* const picture, int quality, + uint32_t* const argb_dst); +#endif + //------------------------------------------------------------------------------ // Image transforms in predictor.c. @@ -92,4 +115,4 @@ void VP8LColorSpaceTransform(int width, int height, int bits, int quality, } // extern "C" #endif -#endif /* WEBP_ENC_VP8LI_H_ */ +#endif // WEBP_ENC_VP8LI_ENC_H_ diff --git a/Pods/libwebp/src/enc/webp_enc.c b/Pods/libwebp/src/enc/webp_enc.c index f18461e..9f4b10c 100644 --- a/Pods/libwebp/src/enc/webp_enc.c +++ b/Pods/libwebp/src/enc/webp_enc.c @@ -16,10 +16,10 @@ #include #include -#include "./cost_enc.h" -#include "./vp8i_enc.h" -#include "./vp8li_enc.h" -#include "../utils/utils.h" +#include "src/enc/cost_enc.h" +#include "src/enc/vp8i_enc.h" +#include "src/enc/vp8li_enc.h" +#include "src/utils/utils.h" // #define PRINT_MEMORY_INFO @@ -159,12 +159,16 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config, + WEBP_ALIGN_CST; // align all const size_t lf_stats_size = config->autofilter ? sizeof(*enc->lf_stats_) + WEBP_ALIGN_CST : 0; + const size_t top_derr_size = + (config->quality <= ERROR_DIFFUSION_QUALITY || config->pass > 1) ? + mb_w * sizeof(*enc->top_derr_) : 0; uint8_t* mem; const uint64_t size = (uint64_t)sizeof(*enc) // main struct + WEBP_ALIGN_CST // cache alignment + info_size // modes info + preds_size // prediction modes + samples_size // top/left samples + + top_derr_size // top diffusion error + nz_size // coeff context bits + lf_stats_size; // autofilter stats @@ -175,11 +179,12 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config, " info: %ld\n" " preds: %ld\n" " top samples: %ld\n" + " top diffusion: %ld\n" " non-zero: %ld\n" " lf-stats: %ld\n" " total: %ld\n", sizeof(*enc) + WEBP_ALIGN_CST, info_size, - preds_size, samples_size, nz_size, lf_stats_size, size); + preds_size, samples_size, top_derr_size, nz_size, lf_stats_size, size); printf("Transient object sizes:\n" " VP8EncIterator: %ld\n" " VP8ModeScore: %ld\n" @@ -207,7 +212,7 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config, enc->preds_w_ = preds_w; enc->mb_info_ = (VP8MBInfo*)mem; mem += info_size; - enc->preds_ = ((uint8_t*)mem) + 1 + enc->preds_w_; + enc->preds_ = mem + 1 + enc->preds_w_; mem += preds_size; enc->nz_ = 1 + (uint32_t*)WEBP_ALIGN(mem); mem += nz_size; @@ -216,9 +221,11 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config, // top samples (all 16-aligned) mem = (uint8_t*)WEBP_ALIGN(mem); - enc->y_top_ = (uint8_t*)mem; + enc->y_top_ = mem; enc->uv_top_ = enc->y_top_ + top_stride; mem += 2 * top_stride; + enc->top_derr_ = top_derr_size ? (DError*)mem : NULL; + mem += top_derr_size; assert(mem <= (uint8_t*)enc + size); enc->config_ = config; @@ -256,6 +263,7 @@ static int DeleteVP8Encoder(VP8Encoder* enc) { //------------------------------------------------------------------------------ +#if !defined(WEBP_DISABLE_STATS) static double GetPSNR(uint64_t err, uint64_t size) { return (err > 0 && size > 0) ? 10. * log10(255. * 255. * size / err) : 99.; } @@ -270,8 +278,10 @@ static void FinalizePSNR(const VP8Encoder* const enc) { stats->PSNR[3] = (float)GetPSNR(sse[0] + sse[1] + sse[2], size * 3 / 2); stats->PSNR[4] = (float)GetPSNR(sse[3], size); } +#endif // !defined(WEBP_DISABLE_STATS) static void StoreStats(VP8Encoder* const enc) { +#if !defined(WEBP_DISABLE_STATS) WebPAuxStats* const stats = enc->pic_->stats; if (stats != NULL) { int i, s; @@ -288,7 +298,9 @@ static void StoreStats(VP8Encoder* const enc) { stats->block_count[i] = enc->block_count_[i]; } } +#else // defined(WEBP_DISABLE_STATS) WebPReportProgress(enc->pic_, 100, &enc->percent_); // done! +#endif // !defined(WEBP_DISABLE_STATS) } int WebPEncodingSetError(const WebPPicture* const pic, @@ -336,10 +348,6 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) { if (!config->lossless) { VP8Encoder* enc = NULL; - if (!config->exact) { - WebPCleanupTransparentArea(pic); - } - if (pic->use_argb || pic->y == NULL || pic->u == NULL || pic->v == NULL) { // Make sure we have YUVA samples. if (config->use_sharp_yuv || (config->preprocessing & 4)) { @@ -361,6 +369,10 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) { } } + if (!config->exact) { + WebPCleanupTransparentArea(pic); + } + enc = InitVP8Encoder(config, pic); if (enc == NULL) return 0; // pic->error is already set. // Note: each of the tasks below account for 20% in the progress report. diff --git a/Pods/libwebp/src/libwebp.pc.in b/Pods/libwebp/src/libwebp.pc.in new file mode 100644 index 0000000..733bb6d --- /dev/null +++ b/Pods/libwebp/src/libwebp.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libwebp +Description: Library for the WebP graphics format +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lwebp +Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ diff --git a/Pods/libwebp/src/libwebp.rc b/Pods/libwebp/src/libwebp.rc new file mode 100644 index 0000000..78dccc9 --- /dev/null +++ b/Pods/libwebp/src/libwebp.rc @@ -0,0 +1,41 @@ +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,1,0 + PRODUCTVERSION 1,0,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Google, Inc." + VALUE "FileDescription", "libwebp DLL" + VALUE "FileVersion", "1.1.0" + VALUE "InternalName", "libwebp.dll" + VALUE "LegalCopyright", "Copyright (C) 2019" + VALUE "OriginalFilename", "libwebp.dll" + VALUE "ProductName", "WebP Image Codec" + VALUE "ProductVersion", "1.1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources diff --git a/Pods/libwebp/src/libwebpdecoder.pc.in b/Pods/libwebp/src/libwebpdecoder.pc.in new file mode 100644 index 0000000..3ef647a --- /dev/null +++ b/Pods/libwebp/src/libwebpdecoder.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libwebpdecoder +Description: Library for the WebP graphics format (decode only) +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lwebpdecoder +Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ diff --git a/Pods/libwebp/src/libwebpdecoder.rc b/Pods/libwebp/src/libwebpdecoder.rc new file mode 100644 index 0000000..bf0cffd --- /dev/null +++ b/Pods/libwebp/src/libwebpdecoder.rc @@ -0,0 +1,41 @@ +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,1,0 + PRODUCTVERSION 1,0,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Google, Inc." + VALUE "FileDescription", "libwebpdecoder DLL" + VALUE "FileVersion", "1.1.0" + VALUE "InternalName", "libwebpdecoder.dll" + VALUE "LegalCopyright", "Copyright (C) 2019" + VALUE "OriginalFilename", "libwebpdecoder.dll" + VALUE "ProductName", "WebP Image Decoder" + VALUE "ProductVersion", "1.1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources diff --git a/Pods/libwebp/src/mux/Makefile.am b/Pods/libwebp/src/mux/Makefile.am new file mode 100644 index 0000000..5480296 --- /dev/null +++ b/Pods/libwebp/src/mux/Makefile.am @@ -0,0 +1,22 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +lib_LTLIBRARIES = libwebpmux.la + +libwebpmux_la_SOURCES = +libwebpmux_la_SOURCES += anim_encode.c +libwebpmux_la_SOURCES += animi.h +libwebpmux_la_SOURCES += muxedit.c +libwebpmux_la_SOURCES += muxi.h +libwebpmux_la_SOURCES += muxinternal.c +libwebpmux_la_SOURCES += muxread.c + +libwebpmuxinclude_HEADERS = +libwebpmuxinclude_HEADERS += ../webp/mux.h +libwebpmuxinclude_HEADERS += ../webp/mux_types.h +libwebpmuxinclude_HEADERS += ../webp/types.h +noinst_HEADERS = +noinst_HEADERS += ../webp/format_constants.h + +libwebpmux_la_LIBADD = ../libwebp.la +libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:5:0 -lm +libwebpmuxincludedir = $(includedir)/webp +pkgconfig_DATA = libwebpmux.pc diff --git a/Pods/libwebp/src/mux/anim_encode.c b/Pods/libwebp/src/mux/anim_encode.c index 6066388..7be9906 100644 --- a/Pods/libwebp/src/mux/anim_encode.c +++ b/Pods/libwebp/src/mux/anim_encode.c @@ -16,12 +16,12 @@ #include #include // for abs() -#include "../mux/animi.h" -#include "../utils/utils.h" -#include "../webp/decode.h" -#include "../webp/encode.h" -#include "../webp/format_constants.h" -#include "../webp/mux.h" +#include "src/mux/animi.h" +#include "src/utils/utils.h" +#include "src/webp/decode.h" +#include "src/webp/encode.h" +#include "src/webp/format_constants.h" +#include "src/webp/mux.h" #if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf _snprintf @@ -35,7 +35,7 @@ // Stores frame rectangle dimensions. typedef struct { int x_offset_, y_offset_, width_, height_; -} FrameRect; +} FrameRectangle; // Used to store two candidates of encoded data for an animation frame. One of // the two will be chosen later. @@ -50,7 +50,7 @@ struct WebPAnimEncoder { const int canvas_height_; // Canvas height. const WebPAnimEncoderOptions options_; // Global encoding options. - FrameRect prev_rect_; // Previous WebP frame rectangle. + FrameRectangle prev_rect_; // Previous WebP frame rectangle. WebPConfig last_config_; // Cached in case a re-encode is needed. WebPConfig last_config_reversed_; // If 'last_config_' uses lossless, then // this config uses lossy and vice versa; @@ -206,7 +206,7 @@ static void ClearRectangle(WebPPicture* const picture, } static void WebPUtilClearPic(WebPPicture* const picture, - const FrameRect* const rect) { + const FrameRectangle* const rect) { if (rect != NULL) { ClearRectangle(picture, rect->x_offset_, rect->y_offset_, rect->width_, rect->height_); @@ -400,7 +400,7 @@ static WEBP_INLINE int ComparePixelsLossy(const uint32_t* src, int src_step, return 1; } -static int IsEmptyRect(const FrameRect* const rect) { +static int IsEmptyRect(const FrameRectangle* const rect) { return (rect->width_ == 0) || (rect->height_ == 0); } @@ -413,7 +413,7 @@ static int QualityToMaxDiff(float quality) { // Assumes that an initial valid guess of change rectangle 'rect' is passed. static void MinimizeChangeRectangle(const WebPPicture* const src, const WebPPicture* const dst, - FrameRect* const rect, + FrameRectangle* const rect, int is_lossless, float quality) { int i, j; const ComparePixelsFunc compare_pixels = @@ -498,7 +498,7 @@ static void MinimizeChangeRectangle(const WebPPicture* const src, } // Snap rectangle to even offsets (and adjust dimensions if needed). -static WEBP_INLINE void SnapToEvenOffsets(FrameRect* const rect) { +static WEBP_INLINE void SnapToEvenOffsets(FrameRectangle* const rect) { rect->width_ += (rect->x_offset_ & 1); rect->height_ += (rect->y_offset_ & 1); rect->x_offset_ &= ~1; @@ -508,9 +508,9 @@ static WEBP_INLINE void SnapToEvenOffsets(FrameRect* const rect) { typedef struct { int should_try_; // Should try this set of parameters. int empty_rect_allowed_; // Frame with empty rectangle can be skipped. - FrameRect rect_ll_; // Frame rectangle for lossless compression. + FrameRectangle rect_ll_; // Frame rectangle for lossless compression. WebPPicture sub_frame_ll_; // Sub-frame pic for lossless compression. - FrameRect rect_lossy_; // Frame rectangle for lossy compression. + FrameRectangle rect_lossy_; // Frame rectangle for lossy compression. // Could be smaller than rect_ll_ as pixels // with small diffs can be ignored. WebPPicture sub_frame_lossy_; // Sub-frame pic for lossless compression. @@ -538,7 +538,8 @@ static void SubFrameParamsFree(SubFrameParams* const params) { static int GetSubRect(const WebPPicture* const prev_canvas, const WebPPicture* const curr_canvas, int is_key_frame, int is_first_frame, int empty_rect_allowed, - int is_lossless, float quality, FrameRect* const rect, + int is_lossless, float quality, + FrameRectangle* const rect, WebPPicture* const sub_frame) { if (!is_key_frame || is_first_frame) { // Optimize frame rectangle. // Note: This behaves as expected for first frame, as 'prev_canvas' is @@ -594,7 +595,7 @@ int WebPAnimEncoderRefineRect( const WebPPicture* const prev_canvas, const WebPPicture* const curr_canvas, int is_lossless, float quality, int* const x_offset, int* const y_offset, int* const width, int* const height) { - FrameRect rect; + FrameRectangle rect; const int right = clip(*x_offset + *width, 0, curr_canvas->width); const int left = clip(*x_offset, 0, curr_canvas->width - 1); const int bottom = clip(*y_offset + *height, 0, curr_canvas->height); @@ -620,7 +621,7 @@ int WebPAnimEncoderRefineRect( } static void DisposeFrameRectangle(int dispose_method, - const FrameRect* const rect, + const FrameRectangle* const rect, WebPPicture* const curr_canvas) { assert(rect != NULL); if (dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) { @@ -628,13 +629,13 @@ static void DisposeFrameRectangle(int dispose_method, } } -static uint32_t RectArea(const FrameRect* const rect) { +static uint32_t RectArea(const FrameRectangle* const rect) { return (uint32_t)rect->width_ * rect->height_; } static int IsLosslessBlendingPossible(const WebPPicture* const src, const WebPPicture* const dst, - const FrameRect* const rect) { + const FrameRectangle* const rect) { int i, j; assert(src->width == dst->width && src->height == dst->height); assert(rect->x_offset_ + rect->width_ <= dst->width); @@ -656,7 +657,7 @@ static int IsLosslessBlendingPossible(const WebPPicture* const src, static int IsLossyBlendingPossible(const WebPPicture* const src, const WebPPicture* const dst, - const FrameRect* const rect, + const FrameRectangle* const rect, float quality) { const int max_allowed_diff_lossy = QualityToMaxDiff(quality); int i, j; @@ -683,7 +684,7 @@ static int IsLossyBlendingPossible(const WebPPicture* const src, // transparent pixels. // Returns true if at least one pixel gets modified. static int IncreaseTransparency(const WebPPicture* const src, - const FrameRect* const rect, + const FrameRectangle* const rect, WebPPicture* const dst) { int i, j; int modified = 0; @@ -709,7 +710,7 @@ static int IncreaseTransparency(const WebPPicture* const src, // Assumes lossy compression is being used. // Returns true if at least one pixel gets modified. static int FlattenSimilarBlocks(const WebPPicture* const src, - const FrameRect* const rect, + const FrameRectangle* const rect, WebPPicture* const dst, float quality) { const int max_allowed_diff_lossy = QualityToMaxDiff(quality); int i, j; @@ -778,13 +779,13 @@ static int EncodeFrame(const WebPConfig* const config, WebPPicture* const pic, typedef struct { WebPMemoryWriter mem_; WebPMuxFrameInfo info_; - FrameRect rect_; + FrameRectangle rect_; int evaluate_; // True if this candidate should be evaluated. } Candidate; // Generates a candidate encoded frame given a picture and metadata. static WebPEncodingError EncodeCandidate(WebPPicture* const sub_frame, - const FrameRect* const rect, + const FrameRectangle* const rect, const WebPConfig* const encoder_config, int use_blending, Candidate* const candidate) { @@ -958,7 +959,7 @@ static int IncreasePreviousDuration(WebPAnimEncoder* const enc, int duration) { if (new_duration >= MAX_DURATION) { // Special case. // Separate out previous frame from earlier merged frames to avoid overflow. // We add a 1x1 transparent frame for the previous frame, with blending on. - const FrameRect rect = { 0, 0, 1, 1 }; + const FrameRectangle rect = { 0, 0, 1, 1 }; const uint8_t lossless_1x1_bytes[] = { 0x52, 0x49, 0x46, 0x46, 0x14, 0x00, 0x00, 0x00, 0x57, 0x45, 0x42, 0x50, 0x56, 0x50, 0x38, 0x4c, 0x08, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, @@ -1223,7 +1224,7 @@ static int CacheFrame(WebPAnimEncoder* const enc, enc->prev_candidate_undecided_ = 0; } else { int64_t curr_delta; - FrameRect prev_rect_key, prev_rect_sub; + FrameRectangle prev_rect_key, prev_rect_sub; // Add this as a frame rectangle to enc. error_code = SetFrame(enc, config, 0, encoded_frame, &frame_skipped); @@ -1535,7 +1536,8 @@ int WebPAnimEncoderAssemble(WebPAnimEncoder* enc, WebPData* webp_data) { if (!enc->got_null_frame_ && enc->in_frame_count_ > 1 && enc->count_ > 0) { // set duration of the last frame to be avg of durations of previous frames. - const double delta_time = enc->prev_timestamp_ - enc->first_timestamp_; + const double delta_time = + (uint32_t)enc->prev_timestamp_ - enc->first_timestamp_; const int average_duration = (int)(delta_time / (enc->in_frame_count_ - 1)); if (!IncreasePreviousDuration(enc, average_duration)) { return 0; diff --git a/Pods/libwebp/src/mux/animi.h b/Pods/libwebp/src/mux/animi.h index cecaf1f..34c45ba 100644 --- a/Pods/libwebp/src/mux/animi.h +++ b/Pods/libwebp/src/mux/animi.h @@ -14,7 +14,7 @@ #ifndef WEBP_MUX_ANIMI_H_ #define WEBP_MUX_ANIMI_H_ -#include "../webp/mux.h" +#include "src/webp/mux.h" #ifdef __cplusplus extern "C" { @@ -40,4 +40,4 @@ int WebPAnimEncoderRefineRect( } // extern "C" #endif -#endif /* WEBP_MUX_ANIMI_H_ */ +#endif // WEBP_MUX_ANIMI_H_ diff --git a/Pods/libwebp/src/mux/libwebpmux.pc.in b/Pods/libwebp/src/mux/libwebpmux.pc.in new file mode 100644 index 0000000..a96fac7 --- /dev/null +++ b/Pods/libwebp/src/mux/libwebpmux.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libwebpmux +Description: Library for manipulating the WebP graphics format container +Version: @PACKAGE_VERSION@ +Requires: libwebp >= 0.2.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lwebpmux +Libs.private: -lm diff --git a/Pods/libwebp/src/mux/libwebpmux.rc b/Pods/libwebp/src/mux/libwebpmux.rc new file mode 100644 index 0000000..84503cb --- /dev/null +++ b/Pods/libwebp/src/mux/libwebpmux.rc @@ -0,0 +1,41 @@ +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,1,0 + PRODUCTVERSION 1,0,1,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Google, Inc." + VALUE "FileDescription", "libwebpmux DLL" + VALUE "FileVersion", "1.1.0" + VALUE "InternalName", "libwebpmux.dll" + VALUE "LegalCopyright", "Copyright (C) 2019" + VALUE "OriginalFilename", "libwebpmux.dll" + VALUE "ProductName", "WebP Image Muxer" + VALUE "ProductVersion", "1.1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources diff --git a/Pods/libwebp/src/mux/muxedit.c b/Pods/libwebp/src/mux/muxedit.c index d2c5305..ccf14b2 100644 --- a/Pods/libwebp/src/mux/muxedit.c +++ b/Pods/libwebp/src/mux/muxedit.c @@ -13,8 +13,8 @@ // Vikas (vikasa@google.com) #include -#include "./muxi.h" -#include "../utils/utils.h" +#include "src/mux/muxi.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // Life of a mux object. @@ -69,12 +69,12 @@ void WebPMuxDelete(WebPMux* mux) { if (idx == (INDEX)) { \ err = ChunkAssignData(&chunk, data, copy_data, tag); \ if (err == WEBP_MUX_OK) { \ - err = ChunkSetNth(&chunk, (LIST), nth); \ + err = ChunkSetHead(&chunk, (LIST)); \ } \ return err; \ } -static WebPMuxError MuxSet(WebPMux* const mux, uint32_t tag, uint32_t nth, +static WebPMuxError MuxSet(WebPMux* const mux, uint32_t tag, const WebPData* const data, int copy_data) { WebPChunk chunk; WebPMuxError err = WEBP_MUX_NOT_FOUND; @@ -190,7 +190,7 @@ WebPMuxError WebPMuxSetChunk(WebPMux* mux, const char fourcc[4], if (err != WEBP_MUX_OK && err != WEBP_MUX_NOT_FOUND) return err; // Add the given chunk. - return MuxSet(mux, tag, 1, chunk_data, copy_data); + return MuxSet(mux, tag, chunk_data, copy_data); } // Creates a chunk from given 'data' and sets it as 1st chunk in 'chunk_list'. @@ -202,7 +202,7 @@ static WebPMuxError AddDataToChunkList( ChunkInit(&chunk); err = ChunkAssignData(&chunk, data, copy_data, tag); if (err != WEBP_MUX_OK) goto Err; - err = ChunkSetNth(&chunk, chunk_list, 1); + err = ChunkSetHead(&chunk, chunk_list); if (err != WEBP_MUX_OK) goto Err; return WEBP_MUX_OK; Err: @@ -266,14 +266,14 @@ WebPMuxError WebPMuxPushFrame(WebPMux* mux, const WebPMuxFrameInfo* info, int copy_data) { WebPMuxImage wpi; WebPMuxError err; - const WebPData* const bitstream = &info->bitstream; // Sanity checks. if (mux == NULL || info == NULL) return WEBP_MUX_INVALID_ARGUMENT; if (info->id != WEBP_CHUNK_ANMF) return WEBP_MUX_INVALID_ARGUMENT; - if (bitstream->bytes == NULL || bitstream->size > MAX_CHUNK_PAYLOAD) { + if (info->bitstream.bytes == NULL || + info->bitstream.size > MAX_CHUNK_PAYLOAD) { return WEBP_MUX_INVALID_ARGUMENT; } @@ -287,7 +287,7 @@ WebPMuxError WebPMuxPushFrame(WebPMux* mux, const WebPMuxFrameInfo* info, } MuxImageInit(&wpi); - err = SetAlphaAndImageChunks(bitstream, copy_data, &wpi); + err = SetAlphaAndImageChunks(&info->bitstream, copy_data, &wpi); if (err != WEBP_MUX_OK) goto Err; assert(wpi.img_ != NULL); // As SetAlphaAndImageChunks() was successful. @@ -342,7 +342,7 @@ WebPMuxError WebPMuxSetAnimationParams(WebPMux* mux, // Set the animation parameters. PutLE32(data, params->bgcolor); PutLE16(data + 4, params->loop_count); - return MuxSet(mux, kChunks[IDX_ANIM].tag, 1, &anim, 1); + return MuxSet(mux, kChunks[IDX_ANIM].tag, &anim, 1); } WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux, @@ -540,7 +540,7 @@ static WebPMuxError CreateVP8XChunk(WebPMux* const mux) { PutLE24(data + 4, width - 1); // canvas width. PutLE24(data + 7, height - 1); // canvas height. - return MuxSet(mux, kChunks[IDX_VP8X].tag, 1, &vp8x, 1); + return MuxSet(mux, kChunks[IDX_VP8X].tag, &vp8x, 1); } // Cleans up 'mux' by removing any unnecessary chunks. diff --git a/Pods/libwebp/src/mux/muxi.h b/Pods/libwebp/src/mux/muxi.h index e6606aa..ad3e1bd 100644 --- a/Pods/libwebp/src/mux/muxi.h +++ b/Pods/libwebp/src/mux/muxi.h @@ -14,10 +14,11 @@ #ifndef WEBP_MUX_MUXI_H_ #define WEBP_MUX_MUXI_H_ +#include #include -#include "../dec/vp8i_dec.h" -#include "../dec/vp8li_dec.h" -#include "../webp/mux.h" +#include "src/dec/vp8i_dec.h" +#include "src/dec/vp8li_dec.h" +#include "src/webp/mux.h" #ifdef __cplusplus extern "C" { @@ -26,8 +27,8 @@ extern "C" { //------------------------------------------------------------------------------ // Defines and constants. -#define MUX_MAJ_VERSION 0 -#define MUX_MIN_VERSION 4 +#define MUX_MAJ_VERSION 1 +#define MUX_MIN_VERSION 1 #define MUX_REV_VERSION 0 // Chunk object. @@ -126,11 +127,14 @@ WebPChunk* ChunkSearchList(WebPChunk* first, uint32_t nth, uint32_t tag); WebPMuxError ChunkAssignData(WebPChunk* chunk, const WebPData* const data, int copy_data, uint32_t tag); -// Sets 'chunk' at nth position in the 'chunk_list'. -// nth = 0 has the special meaning "last of the list". +// Sets 'chunk' as the only element in 'chunk_list' if it is empty. // On success ownership is transferred from 'chunk' to the 'chunk_list'. -WebPMuxError ChunkSetNth(WebPChunk* chunk, WebPChunk** chunk_list, - uint32_t nth); +WebPMuxError ChunkSetHead(WebPChunk* const chunk, WebPChunk** const chunk_list); +// Sets 'chunk' at last position in the 'chunk_list'. +// On success ownership is transferred from 'chunk' to the 'chunk_list'. +// *chunk_list also points towards the last valid element of the initial +// *chunk_list. +WebPMuxError ChunkAppend(WebPChunk* const chunk, WebPChunk*** const chunk_list); // Releases chunk and returns chunk->next_. WebPChunk* ChunkRelease(WebPChunk* const chunk); @@ -143,13 +147,13 @@ void ChunkListDelete(WebPChunk** const chunk_list); // Returns size of the chunk including chunk header and padding byte (if any). static WEBP_INLINE size_t SizeWithPadding(size_t chunk_size) { + assert(chunk_size <= MAX_CHUNK_PAYLOAD); return CHUNK_HEADER_SIZE + ((chunk_size + 1) & ~1U); } // Size of a chunk including header and padding. static WEBP_INLINE size_t ChunkDiskSize(const WebPChunk* chunk) { const size_t data_size = chunk->data_.size; - assert(data_size < MAX_CHUNK_PAYLOAD); return SizeWithPadding(data_size); } @@ -227,4 +231,4 @@ WebPMuxError MuxValidate(const WebPMux* const mux); } // extern "C" #endif -#endif /* WEBP_MUX_MUXI_H_ */ +#endif // WEBP_MUX_MUXI_H_ diff --git a/Pods/libwebp/src/mux/muxinternal.c b/Pods/libwebp/src/mux/muxinternal.c index 387b57e..b9ee671 100644 --- a/Pods/libwebp/src/mux/muxinternal.c +++ b/Pods/libwebp/src/mux/muxinternal.c @@ -13,8 +13,8 @@ // Vikas (vikasa@google.com) #include -#include "./muxi.h" -#include "../utils/utils.h" +#include "src/mux/muxi.h" +#include "src/utils/utils.h" #define UNDEFINED_CHUNK_SIZE ((uint32_t)(-1)) @@ -111,27 +111,6 @@ WebPChunk* ChunkSearchList(WebPChunk* first, uint32_t nth, uint32_t tag) { return ((nth > 0) && (iter > 0)) ? NULL : first; } -// Outputs a pointer to 'prev_chunk->next_', -// where 'prev_chunk' is the pointer to the chunk at position (nth - 1). -// Returns true if nth chunk was found. -static int ChunkSearchListToSet(WebPChunk** chunk_list, uint32_t nth, - WebPChunk*** const location) { - uint32_t count = 0; - assert(chunk_list != NULL); - *location = chunk_list; - - while (*chunk_list != NULL) { - WebPChunk* const cur_chunk = *chunk_list; - ++count; - if (count == nth) return 1; // Found. - chunk_list = &cur_chunk->next_; - *location = chunk_list; - } - - // *chunk_list is ok to be NULL if adding at last location. - return (nth == 0 || (count == nth - 1)) ? 1 : 0; -} - //------------------------------------------------------------------------------ // Chunk writer methods. @@ -156,11 +135,12 @@ WebPMuxError ChunkAssignData(WebPChunk* chunk, const WebPData* const data, return WEBP_MUX_OK; } -WebPMuxError ChunkSetNth(WebPChunk* chunk, WebPChunk** chunk_list, - uint32_t nth) { +WebPMuxError ChunkSetHead(WebPChunk* const chunk, + WebPChunk** const chunk_list) { WebPChunk* new_chunk; - if (!ChunkSearchListToSet(chunk_list, nth, &chunk_list)) { + assert(chunk_list != NULL); + if (*chunk_list != NULL) { return WEBP_MUX_NOT_FOUND; } @@ -168,11 +148,26 @@ WebPMuxError ChunkSetNth(WebPChunk* chunk, WebPChunk** chunk_list, if (new_chunk == NULL) return WEBP_MUX_MEMORY_ERROR; *new_chunk = *chunk; chunk->owner_ = 0; - new_chunk->next_ = *chunk_list; + new_chunk->next_ = NULL; *chunk_list = new_chunk; return WEBP_MUX_OK; } +WebPMuxError ChunkAppend(WebPChunk* const chunk, + WebPChunk*** const chunk_list) { + assert(chunk_list != NULL && *chunk_list != NULL); + + if (**chunk_list == NULL) { + ChunkSetHead(chunk, *chunk_list); + } else { + WebPChunk* last_chunk = **chunk_list; + while (last_chunk->next_ != NULL) last_chunk = last_chunk->next_; + ChunkSetHead(chunk, &last_chunk->next_); + *chunk_list = &last_chunk->next_; + } + return WEBP_MUX_OK; +} + //------------------------------------------------------------------------------ // Chunk deletion method(s). @@ -232,9 +227,11 @@ void MuxImageInit(WebPMuxImage* const wpi) { WebPMuxImage* MuxImageRelease(WebPMuxImage* const wpi) { WebPMuxImage* next; if (wpi == NULL) return NULL; - ChunkDelete(wpi->header_); - ChunkDelete(wpi->alpha_); - ChunkDelete(wpi->img_); + // There should be at most one chunk of header_, alpha_, img_ but we call + // ChunkListDelete to be safe + ChunkListDelete(&wpi->header_); + ChunkListDelete(&wpi->alpha_); + ChunkListDelete(&wpi->img_); ChunkListDelete(&wpi->unknown_); next = wpi->next_; @@ -504,6 +501,20 @@ WebPMuxError MuxValidate(const WebPMux* const mux) { if (!has_animation && (num_anim == 1 || num_frames > 0)) { return WEBP_MUX_INVALID_ARGUMENT; } + if (!has_animation) { + const WebPMuxImage* images = mux->images_; + // There can be only one image. + if (images == NULL || images->next_ != NULL) { + return WEBP_MUX_INVALID_ARGUMENT; + } + // Size must match. + if (mux->canvas_width_ > 0) { + if (images->width_ != mux->canvas_width_ || + images->height_ != mux->canvas_height_) { + return WEBP_MUX_INVALID_ARGUMENT; + } + } + } } // Verify either VP8X chunk is present OR there is only one elem in @@ -515,6 +526,7 @@ WebPMuxError MuxValidate(const WebPMux* const mux) { if (num_vp8x == 0 && num_images != 1) return WEBP_MUX_INVALID_ARGUMENT; // ALPHA_FLAG & alpha chunk(s) are consistent. + // Note: ALPHA_FLAG can be set when there is actually no Alpha data present. if (MuxHasAlpha(mux->images_)) { if (num_vp8x > 0) { // VP8X chunk is present, so it should contain ALPHA_FLAG. @@ -525,8 +537,6 @@ WebPMuxError MuxValidate(const WebPMux* const mux) { if (err != WEBP_MUX_OK) return err; if (num_alpha > 0) return WEBP_MUX_INVALID_ARGUMENT; } - } else { // Mux doesn't need alpha. So, ALPHA_FLAG should NOT be present. - if (flags & ALPHA_FLAG) return WEBP_MUX_INVALID_ARGUMENT; } return WEBP_MUX_OK; diff --git a/Pods/libwebp/src/mux/muxread.c b/Pods/libwebp/src/mux/muxread.c index 410acd9..ae3b876 100644 --- a/Pods/libwebp/src/mux/muxread.c +++ b/Pods/libwebp/src/mux/muxread.c @@ -13,8 +13,8 @@ // Vikas (vikasa@google.com) #include -#include "./muxi.h" -#include "../utils/utils.h" +#include "src/mux/muxi.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // Helper method(s). @@ -43,7 +43,7 @@ static WebPMuxError MuxGet(const WebPMux* const mux, CHUNK_INDEX idx, SWITCH_ID_LIST(IDX_ANIM, mux->anim_); SWITCH_ID_LIST(IDX_EXIF, mux->exif_); SWITCH_ID_LIST(IDX_XMP, mux->xmp_); - SWITCH_ID_LIST(IDX_UNKNOWN, mux->unknown_); + assert(idx != IDX_UNKNOWN); return WEBP_MUX_NOT_FOUND; } #undef SWITCH_ID_LIST @@ -59,6 +59,7 @@ static WebPMuxError ChunkVerifyAndAssign(WebPChunk* chunk, // Sanity checks. if (data_size < CHUNK_HEADER_SIZE) return WEBP_MUX_NOT_ENOUGH_DATA; chunk_size = GetLE32(data + TAG_SIZE); + if (chunk_size > MAX_CHUNK_PAYLOAD) return WEBP_MUX_BAD_DATA; { const size_t chunk_disk_size = SizeWithPadding(chunk_size); @@ -99,9 +100,10 @@ static int MuxImageParse(const WebPChunk* const chunk, int copy_data, WebPMuxImage* const wpi) { const uint8_t* bytes = chunk->data_.bytes; size_t size = chunk->data_.size; - const uint8_t* const last = bytes + size; + const uint8_t* const last = (bytes == NULL) ? NULL : bytes + size; WebPChunk subchunk; size_t subchunk_size; + WebPChunk** unknown_chunk_list = &wpi->unknown_; ChunkInit(&subchunk); assert(chunk->tag_ == kChunks[IDX_ANMF].tag); @@ -116,7 +118,7 @@ static int MuxImageParse(const WebPChunk* const chunk, int copy_data, if (size < hdr_size) goto Fail; ChunkAssignData(&subchunk, &temp, copy_data, chunk->tag_); } - ChunkSetNth(&subchunk, &wpi->header_, 1); + ChunkSetHead(&subchunk, &wpi->header_); wpi->is_partial_ = 1; // Waiting for ALPH and/or VP8/VP8L chunks. // Rest of the chunks. @@ -133,18 +135,23 @@ static int MuxImageParse(const WebPChunk* const chunk, int copy_data, switch (ChunkGetIdFromTag(subchunk.tag_)) { case WEBP_CHUNK_ALPHA: if (wpi->alpha_ != NULL) goto Fail; // Consecutive ALPH chunks. - if (ChunkSetNth(&subchunk, &wpi->alpha_, 1) != WEBP_MUX_OK) goto Fail; + if (ChunkSetHead(&subchunk, &wpi->alpha_) != WEBP_MUX_OK) goto Fail; wpi->is_partial_ = 1; // Waiting for a VP8 chunk. break; case WEBP_CHUNK_IMAGE: - if (ChunkSetNth(&subchunk, &wpi->img_, 1) != WEBP_MUX_OK) goto Fail; + if (wpi->img_ != NULL) goto Fail; // Only 1 image chunk allowed. + if (ChunkSetHead(&subchunk, &wpi->img_) != WEBP_MUX_OK) goto Fail; if (!MuxImageFinalize(wpi)) goto Fail; wpi->is_partial_ = 0; // wpi is completely filled. break; case WEBP_CHUNK_UNKNOWN: - if (wpi->is_partial_) goto Fail; // Encountered an unknown chunk - // before some image chunks. - if (ChunkSetNth(&subchunk, &wpi->unknown_, 0) != WEBP_MUX_OK) goto Fail; + if (wpi->is_partial_) { + goto Fail; // Encountered an unknown chunk + // before some image chunks. + } + if (ChunkAppend(&subchunk, &unknown_chunk_list) != WEBP_MUX_OK) { + goto Fail; + } break; default: goto Fail; @@ -175,6 +182,9 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, const uint8_t* data; size_t size; WebPChunk chunk; + // Stores the end of the chunk lists so that it is faster to append data to + // their ends. + WebPChunk** chunk_list_ends[WEBP_CHUNK_NIL + 1] = { NULL }; ChunkInit(&chunk); // Sanity checks. @@ -187,7 +197,7 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, size = bitstream->size; if (data == NULL) return NULL; - if (size < RIFF_HEADER_SIZE) return NULL; + if (size < RIFF_HEADER_SIZE + CHUNK_HEADER_SIZE) return NULL; if (GetLE32(data + 0) != MKFOURCC('R', 'I', 'F', 'F') || GetLE32(data + CHUNK_HEADER_SIZE) != MKFOURCC('W', 'E', 'B', 'P')) { return NULL; @@ -196,8 +206,6 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, mux = WebPMuxNew(); if (mux == NULL) return NULL; - if (size < RIFF_HEADER_SIZE + TAG_SIZE) goto Err; - tag = GetLE32(data + RIFF_HEADER_SIZE); if (tag != kChunks[IDX_VP8].tag && tag != kChunks[IDX_VP8L].tag && @@ -205,13 +213,17 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, goto Err; // First chunk should be VP8, VP8L or VP8X. } - riff_size = SizeWithPadding(GetLE32(data + TAG_SIZE)); - if (riff_size > MAX_CHUNK_PAYLOAD || riff_size > size) { - goto Err; - } else { - if (riff_size < size) { // Redundant data after last chunk. - size = riff_size; // To make sure we don't read any data beyond mux_size. - } + riff_size = GetLE32(data + TAG_SIZE); + if (riff_size > MAX_CHUNK_PAYLOAD) goto Err; + + // Note this padding is historical and differs from demux.c which does not + // pad the file size. + riff_size = SizeWithPadding(riff_size); + if (riff_size < CHUNK_HEADER_SIZE) goto Err; + if (riff_size > size) goto Err; + // There's no point in reading past the end of the RIFF chunk. + if (size > riff_size + CHUNK_HEADER_SIZE) { + size = riff_size + CHUNK_HEADER_SIZE; } end = data + size; @@ -226,7 +238,6 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, while (data != end) { size_t data_size; WebPChunkId id; - WebPChunk** chunk_list; if (ChunkVerifyAndAssign(&chunk, data, size, riff_size, copy_data) != WEBP_MUX_OK) { goto Err; @@ -236,11 +247,11 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, switch (id) { case WEBP_CHUNK_ALPHA: if (wpi->alpha_ != NULL) goto Err; // Consecutive ALPH chunks. - if (ChunkSetNth(&chunk, &wpi->alpha_, 1) != WEBP_MUX_OK) goto Err; + if (ChunkSetHead(&chunk, &wpi->alpha_) != WEBP_MUX_OK) goto Err; wpi->is_partial_ = 1; // Waiting for a VP8 chunk. break; case WEBP_CHUNK_IMAGE: - if (ChunkSetNth(&chunk, &wpi->img_, 1) != WEBP_MUX_OK) goto Err; + if (ChunkSetHead(&chunk, &wpi->img_) != WEBP_MUX_OK) goto Err; if (!MuxImageFinalize(wpi)) goto Err; wpi->is_partial_ = 0; // wpi is completely filled. PushImage: @@ -257,9 +268,13 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, default: // A non-image chunk. if (wpi->is_partial_) goto Err; // Encountered a non-image chunk before // getting all chunks of an image. - chunk_list = MuxGetChunkListFromId(mux, id); // List to add this chunk. - if (ChunkSetNth(&chunk, chunk_list, 0) != WEBP_MUX_OK) goto Err; + if (chunk_list_ends[id] == NULL) { + chunk_list_ends[id] = + MuxGetChunkListFromId(mux, id); // List to add this chunk. + } + if (ChunkAppend(&chunk, &chunk_list_ends[id]) != WEBP_MUX_OK) goto Err; if (id == WEBP_CHUNK_VP8X) { // grab global specs + if (data_size < CHUNK_HEADER_SIZE + VP8X_CHUNK_SIZE) goto Err; mux->canvas_width_ = GetLE24(data + 12) + 1; mux->canvas_height_ = GetLE24(data + 15) + 1; } @@ -270,6 +285,9 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data, ChunkInit(&chunk); } + // Incomplete image. + if (wpi->is_partial_) goto Err; + // Validate mux if complete. if (MuxValidate(mux) != WEBP_MUX_OK) goto Err; @@ -382,6 +400,10 @@ static WebPMuxError SynthesizeBitstream(const WebPMuxImage* const wpi, uint8_t* const data = (uint8_t*)WebPSafeMalloc(1ULL, size); if (data == NULL) return WEBP_MUX_MEMORY_ERROR; + // There should be at most one alpha_ chunk and exactly one img_ chunk. + assert(wpi->alpha_ == NULL || wpi->alpha_->next_ == NULL); + assert(wpi->img_ != NULL && wpi->img_->next_ == NULL); + // Main RIFF header. dst = MuxEmitRiffHeader(data, size); diff --git a/Pods/libwebp/src/utils/Makefile.am b/Pods/libwebp/src/utils/Makefile.am new file mode 100644 index 0000000..fbb0fe7 --- /dev/null +++ b/Pods/libwebp/src/utils/Makefile.am @@ -0,0 +1,51 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +noinst_LTLIBRARIES = libwebputils.la + +if BUILD_LIBWEBPDECODER + noinst_LTLIBRARIES += libwebputilsdecode.la +endif + +common_HEADERS = ../webp/types.h +commondir = $(includedir)/webp + +noinst_HEADERS = +noinst_HEADERS += ../dsp/dsp.h +noinst_HEADERS += ../webp/decode.h +noinst_HEADERS += ../webp/encode.h +noinst_HEADERS += ../webp/format_constants.h + +COMMON_SOURCES = +COMMON_SOURCES += bit_reader_utils.c +COMMON_SOURCES += bit_reader_utils.h +COMMON_SOURCES += bit_reader_inl_utils.h +COMMON_SOURCES += color_cache_utils.c +COMMON_SOURCES += color_cache_utils.h +COMMON_SOURCES += endian_inl_utils.h +COMMON_SOURCES += filters_utils.c +COMMON_SOURCES += filters_utils.h +COMMON_SOURCES += huffman_utils.c +COMMON_SOURCES += huffman_utils.h +COMMON_SOURCES += quant_levels_dec_utils.c +COMMON_SOURCES += quant_levels_dec_utils.h +COMMON_SOURCES += rescaler_utils.c +COMMON_SOURCES += rescaler_utils.h +COMMON_SOURCES += random_utils.c +COMMON_SOURCES += random_utils.h +COMMON_SOURCES += thread_utils.c +COMMON_SOURCES += thread_utils.h +COMMON_SOURCES += utils.c +COMMON_SOURCES += utils.h + +ENC_SOURCES = +ENC_SOURCES += bit_writer_utils.c +ENC_SOURCES += bit_writer_utils.h +ENC_SOURCES += huffman_encode_utils.c +ENC_SOURCES += huffman_encode_utils.h +ENC_SOURCES += quant_levels_utils.c +ENC_SOURCES += quant_levels_utils.h + +libwebputils_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES) + +if BUILD_LIBWEBPDECODER + libwebputilsdecode_la_SOURCES = $(COMMON_SOURCES) +endif diff --git a/Pods/libwebp/src/utils/bit_reader_inl_utils.h b/Pods/libwebp/src/utils/bit_reader_inl_utils.h index fd7fb04..46b3880 100644 --- a/Pods/libwebp/src/utils/bit_reader_inl_utils.h +++ b/Pods/libwebp/src/utils/bit_reader_inl_utils.h @@ -13,19 +13,19 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_UTILS_BIT_READER_INL_H_ -#define WEBP_UTILS_BIT_READER_INL_H_ +#ifndef WEBP_UTILS_BIT_READER_INL_UTILS_H_ +#define WEBP_UTILS_BIT_READER_INL_UTILS_H_ #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif #include // for memcpy -#include "../dsp/dsp.h" -#include "./bit_reader_utils.h" -#include "./endian_inl_utils.h" -#include "./utils.h" +#include "src/dsp/dsp.h" +#include "src/utils/bit_reader_utils.h" +#include "src/utils/endian_inl_utils.h" +#include "src/utils/utils.h" #ifdef __cplusplus extern "C" { @@ -104,7 +104,8 @@ void VP8LoadNewBytes(VP8BitReader* const br) { } // Read a bit with proba 'prob'. Speed-critical function! -static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, int prob) { +static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, + int prob, const char label[]) { // Don't move this declaration! It makes a big speed difference to store // 'range' *before* calling VP8LoadNewBytes(), even if this function doesn't // alter br->range_ value. @@ -129,13 +130,14 @@ static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, int prob) { br->bits_ -= shift; } br->range_ = range - 1; + BT_TRACK(br); return bit; } } // simplified version of VP8GetBit() for prob=0x80 (note shift is always 1 here) static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE -int VP8GetSigned(VP8BitReader* const br, int v) { +int VP8GetSigned(VP8BitReader* const br, int v, const char label[]) { if (br->bits_ < 0) { VP8LoadNewBytes(br); } @@ -148,11 +150,13 @@ int VP8GetSigned(VP8BitReader* const br, int v) { br->range_ += mask; br->range_ |= 1; br->value_ -= (bit_t)((split + 1) & mask) << pos; + BT_TRACK(br); return (v ^ mask) - mask; } } -static WEBP_INLINE int VP8GetBitAlt(VP8BitReader* const br, int prob) { +static WEBP_INLINE int VP8GetBitAlt(VP8BitReader* const br, + int prob, const char label[]) { // Don't move this declaration! It makes a big speed difference to store // 'range' *before* calling VP8LoadNewBytes(), even if this function doesn't // alter br->range_ value. @@ -179,6 +183,7 @@ static WEBP_INLINE int VP8GetBitAlt(VP8BitReader* const br, int prob) { br->bits_ -= shift; } br->range_ = range; + BT_TRACK(br); return bit; } } @@ -187,4 +192,4 @@ static WEBP_INLINE int VP8GetBitAlt(VP8BitReader* const br, int prob) { } // extern "C" #endif -#endif // WEBP_UTILS_BIT_READER_INL_H_ +#endif // WEBP_UTILS_BIT_READER_INL_UTILS_H_ diff --git a/Pods/libwebp/src/utils/bit_reader_utils.c b/Pods/libwebp/src/utils/bit_reader_utils.c index c3157e8..857cd60 100644 --- a/Pods/libwebp/src/utils/bit_reader_utils.c +++ b/Pods/libwebp/src/utils/bit_reader_utils.c @@ -12,11 +12,11 @@ // Author: Skal (pascal.massimino@gmail.com) #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif -#include "./bit_reader_inl_utils.h" -#include "../utils/utils.h" +#include "src/utils/bit_reader_inl_utils.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // VP8BitReader @@ -102,17 +102,18 @@ void VP8LoadFinalBytes(VP8BitReader* const br) { //------------------------------------------------------------------------------ // Higher-level calls -uint32_t VP8GetValue(VP8BitReader* const br, int bits) { +uint32_t VP8GetValue(VP8BitReader* const br, int bits, const char label[]) { uint32_t v = 0; while (bits-- > 0) { - v |= VP8GetBit(br, 0x80) << bits; + v |= VP8GetBit(br, 0x80, label) << bits; } return v; } -int32_t VP8GetSignedValue(VP8BitReader* const br, int bits) { - const int value = VP8GetValue(br, bits); - return VP8Get(br) ? -value : value; +int32_t VP8GetSignedValue(VP8BitReader* const br, int bits, + const char label[]) { + const int value = VP8GetValue(br, bits, label); + return VP8Get(br, label) ? -value : value; } //------------------------------------------------------------------------------ @@ -220,3 +221,78 @@ uint32_t VP8LReadBits(VP8LBitReader* const br, int n_bits) { } //------------------------------------------------------------------------------ +// Bit-tracing tool + +#if (BITTRACE > 0) + +#include // for atexit() +#include +#include + +#define MAX_NUM_LABELS 32 +static struct { + const char* label; + int size; + int count; +} kLabels[MAX_NUM_LABELS]; + +static int last_label = 0; +static int last_pos = 0; +static const uint8_t* buf_start = NULL; +static int init_done = 0; + +static void PrintBitTraces(void) { + int i; + int scale = 1; + int total = 0; + const char* units = "bits"; +#if (BITTRACE == 2) + scale = 8; + units = "bytes"; +#endif + for (i = 0; i < last_label; ++i) total += kLabels[i].size; + if (total < 1) total = 1; // avoid rounding errors + printf("=== Bit traces ===\n"); + for (i = 0; i < last_label; ++i) { + const int skip = 16 - (int)strlen(kLabels[i].label); + const int value = (kLabels[i].size + scale - 1) / scale; + assert(skip > 0); + printf("%s \%*s: %6d %s \t[%5.2f%%] [count: %7d]\n", + kLabels[i].label, skip, "", value, units, + 100.f * kLabels[i].size / total, + kLabels[i].count); + } + total = (total + scale - 1) / scale; + printf("Total: %d %s\n", total, units); +} + +void BitTrace(const struct VP8BitReader* const br, const char label[]) { + int i, pos; + if (!init_done) { + memset(kLabels, 0, sizeof(kLabels)); + atexit(PrintBitTraces); + buf_start = br->buf_; + init_done = 1; + } + pos = (int)(br->buf_ - buf_start) * 8 - br->bits_; + // if there's a too large jump, we've changed partition -> reset counter + if (abs(pos - last_pos) > 32) { + buf_start = br->buf_; + pos = 0; + last_pos = 0; + } + if (br->range_ >= 0x7f) pos += kVP8Log2Range[br->range_ - 0x7f]; + for (i = 0; i < last_label; ++i) { + if (!strcmp(label, kLabels[i].label)) break; + } + if (i == MAX_NUM_LABELS) abort(); // overflow! + kLabels[i].label = label; + kLabels[i].size += pos - last_pos; + kLabels[i].count += 1; + if (i == last_label) ++last_label; + last_pos = pos; +} + +#endif // BITTRACE > 0 + +//------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/utils/bit_reader_utils.h b/Pods/libwebp/src/utils/bit_reader_utils.h index ec3426c..e64156e 100644 --- a/Pods/libwebp/src/utils/bit_reader_utils.h +++ b/Pods/libwebp/src/utils/bit_reader_utils.h @@ -12,14 +12,35 @@ // Author: Skal (pascal.massimino@gmail.com) // Vikas Arora (vikaas.arora@gmail.com) -#ifndef WEBP_UTILS_BIT_READER_H_ -#define WEBP_UTILS_BIT_READER_H_ +#ifndef WEBP_UTILS_BIT_READER_UTILS_H_ +#define WEBP_UTILS_BIT_READER_UTILS_H_ #include #ifdef _MSC_VER #include // _byteswap_ulong #endif -#include "../webp/types.h" +#include "src/webp/types.h" + +// Warning! This macro triggers quite some MACRO wizardry around func signature! +#if !defined(BITTRACE) +#define BITTRACE 0 // 0 = off, 1 = print bits, 2 = print bytes +#endif + +#if (BITTRACE > 0) +struct VP8BitReader; +extern void BitTrace(const struct VP8BitReader* const br, const char label[]); +#define BT_TRACK(br) BitTrace(br, label) +#define VP8Get(BR, L) VP8GetValue(BR, 1, L) +#else +#define BT_TRACK(br) +// We'll REMOVE the 'const char label[]' from all signatures and calls (!!): +#define VP8GetValue(BR, N, L) VP8GetValue(BR, N) +#define VP8Get(BR, L) VP8GetValue(BR, 1, L) +#define VP8GetSignedValue(BR, N, L) VP8GetSignedValue(BR, N) +#define VP8GetBit(BR, P, L) VP8GetBit(BR, P) +#define VP8GetBitAlt(BR, P, L) VP8GetBitAlt(BR, P) +#define VP8GetSigned(BR, V, L) VP8GetSigned(BR, V) +#endif #ifdef __cplusplus extern "C" { @@ -92,17 +113,15 @@ void VP8BitReaderSetBuffer(VP8BitReader* const br, void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset); // return the next value made of 'num_bits' bits -uint32_t VP8GetValue(VP8BitReader* const br, int num_bits); -static WEBP_INLINE uint32_t VP8Get(VP8BitReader* const br) { - return VP8GetValue(br, 1); -} +uint32_t VP8GetValue(VP8BitReader* const br, int num_bits, const char label[]); // return the next value with sign-extension. -int32_t VP8GetSignedValue(VP8BitReader* const br, int num_bits); +int32_t VP8GetSignedValue(VP8BitReader* const br, int num_bits, + const char label[]); // bit_reader_inl.h will implement the following methods: -// static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, int prob) -// static WEBP_INLINE int VP8GetSigned(VP8BitReader* const br, int v) +// static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, int prob, ...) +// static WEBP_INLINE int VP8GetSigned(VP8BitReader* const br, int v, ...) // and should be included by the .c files that actually need them. // This is to avoid recompiling the whole library whenever this file is touched, // and also allowing platform-specific ad-hoc hacks. @@ -155,9 +174,10 @@ static WEBP_INLINE int VP8LIsEndOfStream(const VP8LBitReader* const br) { // For jumping over a number of bits in the bit stream when accessed with // VP8LPrefetchBits and VP8LFillBitWindow. +// This function does *not* set br->eos_, since it's speed-critical. +// Use with extreme care! static WEBP_INLINE void VP8LSetBitPos(VP8LBitReader* const br, int val) { br->bit_pos_ = val; - br->eos_ = VP8LIsEndOfStream(br); } // Advances the read buffer by 4 bytes to make room for reading next 32 bits. @@ -171,4 +191,4 @@ static WEBP_INLINE void VP8LFillBitWindow(VP8LBitReader* const br) { } // extern "C" #endif -#endif /* WEBP_UTILS_BIT_READER_H_ */ +#endif // WEBP_UTILS_BIT_READER_UTILS_H_ diff --git a/Pods/libwebp/src/utils/bit_writer_utils.c b/Pods/libwebp/src/utils/bit_writer_utils.c index ab0c49d..bef0e31 100644 --- a/Pods/libwebp/src/utils/bit_writer_utils.c +++ b/Pods/libwebp/src/utils/bit_writer_utils.c @@ -16,9 +16,9 @@ #include // for memcpy() #include -#include "./bit_writer_utils.h" -#include "./endian_inl_utils.h" -#include "./utils.h" +#include "src/utils/bit_writer_utils.h" +#include "src/utils/endian_inl_utils.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // VP8BitWriter @@ -70,7 +70,7 @@ static void Flush(VP8BitWriter* const bw) { const int value = (bits & 0x100) ? 0x00 : 0xff; for (; bw->run_ > 0; --bw->run_) bw->buf_[pos++] = value; } - bw->buf_[pos++] = bits; + bw->buf_[pos++] = bits & 0xff; bw->pos_ = pos; } else { bw->run_++; // delay writing of bytes 0xff, pending eventual carry. @@ -239,6 +239,19 @@ int VP8LBitWriterInit(VP8LBitWriter* const bw, size_t expected_size) { return VP8LBitWriterResize(bw, expected_size); } +int VP8LBitWriterClone(const VP8LBitWriter* const src, + VP8LBitWriter* const dst) { + const size_t current_size = src->cur_ - src->buf_; + assert(src->cur_ >= src->buf_ && src->cur_ <= src->end_); + if (!VP8LBitWriterResize(dst, current_size)) return 0; + memcpy(dst->buf_, src->buf_, current_size); + dst->bits_ = src->bits_; + dst->used_ = src->used_; + dst->error_ = src->error_; + dst->cur_ = dst->buf_ + current_size; + return 1; +} + void VP8LBitWriterWipeOut(VP8LBitWriter* const bw) { if (bw != NULL) { WebPSafeFree(bw->buf_); @@ -246,6 +259,21 @@ void VP8LBitWriterWipeOut(VP8LBitWriter* const bw) { } } +void VP8LBitWriterReset(const VP8LBitWriter* const bw_init, + VP8LBitWriter* const bw) { + bw->bits_ = bw_init->bits_; + bw->used_ = bw_init->used_; + bw->cur_ = bw->buf_ + (bw_init->cur_ - bw_init->buf_); + assert(bw->cur_ <= bw->end_); + bw->error_ = bw_init->error_; +} + +void VP8LBitWriterSwap(VP8LBitWriter* const src, VP8LBitWriter* const dst) { + const VP8LBitWriter tmp = *src; + *src = *dst; + *dst = tmp; +} + void VP8LPutBitsFlushBits(VP8LBitWriter* const bw) { // If needed, make some room by flushing some bits out. if (bw->cur_ + VP8L_WRITER_BYTES > bw->end_) { diff --git a/Pods/libwebp/src/utils/bit_writer_utils.h b/Pods/libwebp/src/utils/bit_writer_utils.h index 9c02bbc..b9d5102 100644 --- a/Pods/libwebp/src/utils/bit_writer_utils.h +++ b/Pods/libwebp/src/utils/bit_writer_utils.h @@ -11,10 +11,10 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_UTILS_BIT_WRITER_H_ -#define WEBP_UTILS_BIT_WRITER_H_ +#ifndef WEBP_UTILS_BIT_WRITER_UTILS_H_ +#define WEBP_UTILS_BIT_WRITER_UTILS_H_ -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -100,16 +100,24 @@ typedef struct { int error_; } VP8LBitWriter; -static WEBP_INLINE size_t VP8LBitWriterNumBytes(VP8LBitWriter* const bw) { +static WEBP_INLINE size_t VP8LBitWriterNumBytes(const VP8LBitWriter* const bw) { return (bw->cur_ - bw->buf_) + ((bw->used_ + 7) >> 3); } // Returns false in case of memory allocation error. int VP8LBitWriterInit(VP8LBitWriter* const bw, size_t expected_size); +// Returns false in case of memory allocation error. +int VP8LBitWriterClone(const VP8LBitWriter* const src, + VP8LBitWriter* const dst); // Finalize the bitstream coding. Returns a pointer to the internal buffer. uint8_t* VP8LBitWriterFinish(VP8LBitWriter* const bw); // Release any pending memory and zeroes the object. void VP8LBitWriterWipeOut(VP8LBitWriter* const bw); +// Resets the cursor of the BitWriter bw to when it was like in bw_init. +void VP8LBitWriterReset(const VP8LBitWriter* const bw_init, + VP8LBitWriter* const bw); +// Swaps the memory held by two BitWriters. +void VP8LBitWriterSwap(VP8LBitWriter* const src, VP8LBitWriter* const dst); // Internal function for VP8LPutBits flushing 32 bits from the written state. void VP8LPutBitsFlushBits(VP8LBitWriter* const bw); @@ -143,4 +151,4 @@ static WEBP_INLINE void VP8LPutBits(VP8LBitWriter* const bw, } // extern "C" #endif -#endif /* WEBP_UTILS_BIT_WRITER_H_ */ +#endif // WEBP_UTILS_BIT_WRITER_UTILS_H_ diff --git a/Pods/libwebp/src/utils/color_cache_utils.c b/Pods/libwebp/src/utils/color_cache_utils.c index 0172590..b09f538 100644 --- a/Pods/libwebp/src/utils/color_cache_utils.c +++ b/Pods/libwebp/src/utils/color_cache_utils.c @@ -14,8 +14,8 @@ #include #include #include -#include "./color_cache_utils.h" -#include "./utils.h" +#include "src/utils/color_cache_utils.h" +#include "src/utils/utils.h" //------------------------------------------------------------------------------ // VP8LColorCache. diff --git a/Pods/libwebp/src/utils/color_cache_utils.h b/Pods/libwebp/src/utils/color_cache_utils.h index c373e6b..b45d47c 100644 --- a/Pods/libwebp/src/utils/color_cache_utils.h +++ b/Pods/libwebp/src/utils/color_cache_utils.h @@ -12,10 +12,13 @@ // Authors: Jyrki Alakuijala (jyrki@google.com) // Urvang Joshi (urvang@google.com) -#ifndef WEBP_UTILS_COLOR_CACHE_H_ -#define WEBP_UTILS_COLOR_CACHE_H_ +#ifndef WEBP_UTILS_COLOR_CACHE_UTILS_H_ +#define WEBP_UTILS_COLOR_CACHE_UTILS_H_ -#include "../webp/types.h" +#include + +#include "src/dsp/dsp.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -23,15 +26,16 @@ extern "C" { // Main color cache struct. typedef struct { - uint32_t *colors_; // color entries + uint32_t* colors_; // color entries int hash_shift_; // Hash shift: 32 - hash_bits_. int hash_bits_; } VP8LColorCache; -static const uint64_t kHashMul = 0x1e35a7bdull; +static const uint32_t kHashMul = 0x1e35a7bdu; -static WEBP_INLINE int HashPix(uint32_t argb, int shift) { - return (int)(((argb * kHashMul) & 0xffffffffu) >> shift); +static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE +int VP8LHashPix(uint32_t argb, int shift) { + return (int)((argb * kHashMul) >> shift); } static WEBP_INLINE uint32_t VP8LColorCacheLookup( @@ -48,19 +52,19 @@ static WEBP_INLINE void VP8LColorCacheSet(const VP8LColorCache* const cc, static WEBP_INLINE void VP8LColorCacheInsert(const VP8LColorCache* const cc, uint32_t argb) { - const int key = HashPix(argb, cc->hash_shift_); + const int key = VP8LHashPix(argb, cc->hash_shift_); cc->colors_[key] = argb; } static WEBP_INLINE int VP8LColorCacheGetIndex(const VP8LColorCache* const cc, uint32_t argb) { - return HashPix(argb, cc->hash_shift_); + return VP8LHashPix(argb, cc->hash_shift_); } // Return the key if cc contains argb, and -1 otherwise. static WEBP_INLINE int VP8LColorCacheContains(const VP8LColorCache* const cc, uint32_t argb) { - const int key = HashPix(argb, cc->hash_shift_); + const int key = VP8LHashPix(argb, cc->hash_shift_); return (cc->colors_[key] == argb) ? key : -1; } @@ -82,4 +86,4 @@ void VP8LColorCacheClear(VP8LColorCache* const color_cache); } #endif -#endif // WEBP_UTILS_COLOR_CACHE_H_ +#endif // WEBP_UTILS_COLOR_CACHE_UTILS_H_ diff --git a/Pods/libwebp/src/utils/endian_inl_utils.h b/Pods/libwebp/src/utils/endian_inl_utils.h index e11260f..3630a29 100644 --- a/Pods/libwebp/src/utils/endian_inl_utils.h +++ b/Pods/libwebp/src/utils/endian_inl_utils.h @@ -9,22 +9,15 @@ // // Endian related functions. -#ifndef WEBP_UTILS_ENDIAN_INL_H_ -#define WEBP_UTILS_ENDIAN_INL_H_ +#ifndef WEBP_UTILS_ENDIAN_INL_UTILS_H_ +#define WEBP_UTILS_ENDIAN_INL_UTILS_H_ #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif -#include "../dsp/dsp.h" -#include "../webp/types.h" - -// some endian fix (e.g.: mips-gcc doesn't define __BIG_ENDIAN__) -#if !defined(WORDS_BIGENDIAN) && \ - (defined(__BIG_ENDIAN__) || defined(_M_PPC) || \ - (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))) -#define WORDS_BIGENDIAN -#endif +#include "src/dsp/dsp.h" +#include "src/webp/types.h" #if defined(WORDS_BIGENDIAN) #define HToLE32 BSwap32 @@ -97,4 +90,4 @@ static WEBP_INLINE uint64_t BSwap64(uint64_t x) { #endif // HAVE_BUILTIN_BSWAP64 } -#endif // WEBP_UTILS_ENDIAN_INL_H_ +#endif // WEBP_UTILS_ENDIAN_INL_UTILS_H_ diff --git a/Pods/libwebp/src/utils/filters_utils.c b/Pods/libwebp/src/utils/filters_utils.c index 49c1d18..bbc2c34 100644 --- a/Pods/libwebp/src/utils/filters_utils.c +++ b/Pods/libwebp/src/utils/filters_utils.c @@ -11,7 +11,7 @@ // // Author: Urvang (urvang@google.com) -#include "./filters_utils.h" +#include "src/utils/filters_utils.h" #include #include diff --git a/Pods/libwebp/src/utils/filters_utils.h b/Pods/libwebp/src/utils/filters_utils.h index 088b132..61da66e 100644 --- a/Pods/libwebp/src/utils/filters_utils.h +++ b/Pods/libwebp/src/utils/filters_utils.h @@ -11,11 +11,11 @@ // // Author: Urvang (urvang@google.com) -#ifndef WEBP_UTILS_FILTERS_H_ -#define WEBP_UTILS_FILTERS_H_ +#ifndef WEBP_UTILS_FILTERS_UTILS_H_ +#define WEBP_UTILS_FILTERS_UTILS_H_ -#include "../webp/types.h" -#include "../dsp/dsp.h" +#include "src/webp/types.h" +#include "src/dsp/dsp.h" #ifdef __cplusplus extern "C" { @@ -29,4 +29,4 @@ WEBP_FILTER_TYPE WebPEstimateBestFilter(const uint8_t* data, } // extern "C" #endif -#endif /* WEBP_UTILS_FILTERS_H_ */ +#endif // WEBP_UTILS_FILTERS_UTILS_H_ diff --git a/Pods/libwebp/src/utils/huffman_encode_utils.c b/Pods/libwebp/src/utils/huffman_encode_utils.c index f950465..6f3b1bb 100644 --- a/Pods/libwebp/src/utils/huffman_encode_utils.c +++ b/Pods/libwebp/src/utils/huffman_encode_utils.c @@ -14,9 +14,9 @@ #include #include #include -#include "./huffman_encode_utils.h" -#include "./utils.h" -#include "../webp/format_constants.h" +#include "src/utils/huffman_encode_utils.h" +#include "src/utils/utils.h" +#include "src/webp/format_constants.h" // ----------------------------------------------------------------------------- // Util function to optimize the symbol map for RLE coding diff --git a/Pods/libwebp/src/utils/huffman_encode_utils.h b/Pods/libwebp/src/utils/huffman_encode_utils.h index a157165..3e6763c 100644 --- a/Pods/libwebp/src/utils/huffman_encode_utils.h +++ b/Pods/libwebp/src/utils/huffman_encode_utils.h @@ -11,10 +11,10 @@ // // Entropy encoding (Huffman) for webp lossless -#ifndef WEBP_UTILS_HUFFMAN_ENCODE_H_ -#define WEBP_UTILS_HUFFMAN_ENCODE_H_ +#ifndef WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ +#define WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -57,4 +57,4 @@ void VP8LCreateHuffmanTree(uint32_t* const histogram, int tree_depth_limit, } #endif -#endif // WEBP_UTILS_HUFFMAN_ENCODE_H_ +#endif // WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ diff --git a/Pods/libwebp/src/utils/huffman_utils.c b/Pods/libwebp/src/utils/huffman_utils.c index 008b5d7..0cba0fb 100644 --- a/Pods/libwebp/src/utils/huffman_utils.c +++ b/Pods/libwebp/src/utils/huffman_utils.c @@ -14,9 +14,9 @@ #include #include #include -#include "./huffman_utils.h" -#include "./utils.h" -#include "../webp/format_constants.h" +#include "src/utils/huffman_utils.h" +#include "src/utils/utils.h" +#include "src/webp/format_constants.h" // Huffman data read via DecodeImageStream is represented in two (red and green) // bytes. @@ -91,7 +91,8 @@ static int BuildHuffmanTable(HuffmanCode* const root_table, int root_bits, assert(code_lengths_size != 0); assert(code_lengths != NULL); - assert(root_table != NULL); + assert((root_table != NULL && sorted != NULL) || + (root_table == NULL && sorted == NULL)); assert(root_bits > 0); // Build histogram of code lengths. @@ -120,16 +121,22 @@ static int BuildHuffmanTable(HuffmanCode* const root_table, int root_bits, for (symbol = 0; symbol < code_lengths_size; ++symbol) { const int symbol_code_length = code_lengths[symbol]; if (code_lengths[symbol] > 0) { - sorted[offset[symbol_code_length]++] = symbol; + if (sorted != NULL) { + sorted[offset[symbol_code_length]++] = symbol; + } else { + offset[symbol_code_length]++; + } } } // Special case code with only one value. if (offset[MAX_ALLOWED_CODE_LENGTH] == 1) { - HuffmanCode code; - code.bits = 0; - code.value = (uint16_t)sorted[0]; - ReplicateValue(table, 1, total_size, code); + if (sorted != NULL) { + HuffmanCode code; + code.bits = 0; + code.value = (uint16_t)sorted[0]; + ReplicateValue(table, 1, total_size, code); + } return total_size; } @@ -151,6 +158,7 @@ static int BuildHuffmanTable(HuffmanCode* const root_table, int root_bits, if (num_open < 0) { return 0; } + if (root_table == NULL) continue; for (; count[len] > 0; --count[len]) { HuffmanCode code; code.bits = (uint8_t)len; @@ -169,6 +177,7 @@ static int BuildHuffmanTable(HuffmanCode* const root_table, int root_bits, if (num_open < 0) { return 0; } + if (root_table == NULL) continue; for (; count[len] > 0; --count[len]) { HuffmanCode code; if ((key & mask) != low) { @@ -206,7 +215,10 @@ int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits, const int code_lengths[], int code_lengths_size) { int total_size; assert(code_lengths_size <= MAX_CODE_LENGTHS_SIZE); - if (code_lengths_size <= SORTED_SIZE_CUTOFF) { + if (root_table == NULL) { + total_size = BuildHuffmanTable(NULL, root_bits, + code_lengths, code_lengths_size, NULL); + } else if (code_lengths_size <= SORTED_SIZE_CUTOFF) { // use local stack-allocated array. uint16_t sorted[SORTED_SIZE_CUTOFF]; total_size = BuildHuffmanTable(root_table, root_bits, diff --git a/Pods/libwebp/src/utils/huffman_utils.h b/Pods/libwebp/src/utils/huffman_utils.h index c6dd6aa..13b7ad1 100644 --- a/Pods/libwebp/src/utils/huffman_utils.h +++ b/Pods/libwebp/src/utils/huffman_utils.h @@ -11,12 +11,12 @@ // // Author: Urvang Joshi (urvang@google.com) -#ifndef WEBP_UTILS_HUFFMAN_H_ -#define WEBP_UTILS_HUFFMAN_H_ +#ifndef WEBP_UTILS_HUFFMAN_UTILS_H_ +#define WEBP_UTILS_HUFFMAN_UTILS_H_ #include -#include "../webp/format_constants.h" -#include "../webp/types.h" +#include "src/webp/format_constants.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -78,6 +78,8 @@ void VP8LHtreeGroupsFree(HTreeGroup* const htree_groups); // the huffman table. // Returns built table size or 0 in case of error (invalid tree or // memory error). +// If root_table is NULL, it returns 0 if a lookup cannot be built, something +// > 0 otherwise (but not the table size). int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits, const int code_lengths[], int code_lengths_size); @@ -85,4 +87,4 @@ int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits, } // extern "C" #endif -#endif // WEBP_UTILS_HUFFMAN_H_ +#endif // WEBP_UTILS_HUFFMAN_UTILS_H_ diff --git a/Pods/libwebp/src/utils/quant_levels_dec_utils.c b/Pods/libwebp/src/utils/quant_levels_dec_utils.c index d4d23d3..f65b6cd 100644 --- a/Pods/libwebp/src/utils/quant_levels_dec_utils.c +++ b/Pods/libwebp/src/utils/quant_levels_dec_utils.c @@ -14,11 +14,11 @@ // // Author: Skal (pascal.massimino@gmail.com) -#include "./quant_levels_dec_utils.h" +#include "src/utils/quant_levels_dec_utils.h" #include // for memset -#include "./utils.h" +#include "src/utils/utils.h" // #define USE_DITHERING // uncomment to enable ordered dithering (not vital) @@ -71,10 +71,11 @@ typedef struct { //------------------------------------------------------------------------------ -#define CLIP_MASK (int)(~0U << (8 + DFIX)) +#define CLIP_8b_MASK (int)(~0U << (8 + DFIX)) static WEBP_INLINE uint8_t clip_8b(int v) { - return (!(v & CLIP_MASK)) ? (uint8_t)(v >> DFIX) : (v < 0) ? 0u : 255u; + return (!(v & CLIP_8b_MASK)) ? (uint8_t)(v >> DFIX) : (v < 0) ? 0u : 255u; } +#undef CLIP_8b_MASK // vertical accumulation static void VFilter(SmoothParams* const p) { @@ -260,9 +261,15 @@ static void CleanupParams(SmoothParams* const p) { int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride, int strength) { - const int radius = 4 * strength / 100; + int radius = 4 * strength / 100; + if (strength < 0 || strength > 100) return 0; if (data == NULL || width <= 0 || height <= 0) return 0; // bad params + + // limit the filter size to not exceed the image dimensions + if (2 * radius + 1 > width) radius = (width - 1) >> 1; + if (2 * radius + 1 > height) radius = (height - 1) >> 1; + if (radius > 0) { SmoothParams p; memset(&p, 0, sizeof(p)); diff --git a/Pods/libwebp/src/utils/quant_levels_dec_utils.h b/Pods/libwebp/src/utils/quant_levels_dec_utils.h index 59a1349..327f19f 100644 --- a/Pods/libwebp/src/utils/quant_levels_dec_utils.h +++ b/Pods/libwebp/src/utils/quant_levels_dec_utils.h @@ -11,10 +11,10 @@ // // Author: Vikas Arora (vikasa@google.com) -#ifndef WEBP_UTILS_QUANT_LEVELS_DEC_H_ -#define WEBP_UTILS_QUANT_LEVELS_DEC_H_ +#ifndef WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ +#define WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -32,4 +32,4 @@ int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride, } // extern "C" #endif -#endif /* WEBP_UTILS_QUANT_LEVELS_DEC_H_ */ +#endif // WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ diff --git a/Pods/libwebp/src/utils/quant_levels_utils.c b/Pods/libwebp/src/utils/quant_levels_utils.c index 73174e8..d65ad3c 100644 --- a/Pods/libwebp/src/utils/quant_levels_utils.c +++ b/Pods/libwebp/src/utils/quant_levels_utils.c @@ -14,7 +14,7 @@ #include -#include "./quant_levels_utils.h" +#include "src/utils/quant_levels_utils.h" #define NUM_SYMBOLS 256 diff --git a/Pods/libwebp/src/utils/quant_levels_utils.h b/Pods/libwebp/src/utils/quant_levels_utils.h index 1cb5a32..9ee3ea0 100644 --- a/Pods/libwebp/src/utils/quant_levels_utils.h +++ b/Pods/libwebp/src/utils/quant_levels_utils.h @@ -11,12 +11,12 @@ // // Author: Vikas Arora (vikasa@google.com) -#ifndef WEBP_UTILS_QUANT_LEVELS_H_ -#define WEBP_UTILS_QUANT_LEVELS_H_ +#ifndef WEBP_UTILS_QUANT_LEVELS_UTILS_H_ +#define WEBP_UTILS_QUANT_LEVELS_UTILS_H_ #include -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -33,4 +33,4 @@ int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels, } // extern "C" #endif -#endif /* WEBP_UTILS_QUANT_LEVELS_H_ */ +#endif // WEBP_UTILS_QUANT_LEVELS_UTILS_H_ diff --git a/Pods/libwebp/src/utils/random_utils.c b/Pods/libwebp/src/utils/random_utils.c index 9f1e415..7edb3fe 100644 --- a/Pods/libwebp/src/utils/random_utils.c +++ b/Pods/libwebp/src/utils/random_utils.c @@ -12,7 +12,7 @@ // Author: Skal (pascal.massimino@gmail.com) #include -#include "./random_utils.h" +#include "src/utils/random_utils.h" //------------------------------------------------------------------------------ diff --git a/Pods/libwebp/src/utils/random_utils.h b/Pods/libwebp/src/utils/random_utils.h index c392a61..a5006f8 100644 --- a/Pods/libwebp/src/utils/random_utils.h +++ b/Pods/libwebp/src/utils/random_utils.h @@ -11,11 +11,11 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_UTILS_RANDOM_H_ -#define WEBP_UTILS_RANDOM_H_ +#ifndef WEBP_UTILS_RANDOM_UTILS_H_ +#define WEBP_UTILS_RANDOM_UTILS_H_ #include -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -60,4 +60,4 @@ static WEBP_INLINE int VP8RandomBits(VP8Random* const rg, int num_bits) { } // extern "C" #endif -#endif /* WEBP_UTILS_RANDOM_H_ */ +#endif // WEBP_UTILS_RANDOM_UTILS_H_ diff --git a/Pods/libwebp/src/utils/rescaler_utils.c b/Pods/libwebp/src/utils/rescaler_utils.c index 0d1f80d..4bcae24 100644 --- a/Pods/libwebp/src/utils/rescaler_utils.c +++ b/Pods/libwebp/src/utils/rescaler_utils.c @@ -14,8 +14,8 @@ #include #include #include -#include "../dsp/dsp.h" -#include "./rescaler_utils.h" +#include "src/dsp/dsp.h" +#include "src/utils/rescaler_utils.h" //------------------------------------------------------------------------------ @@ -84,12 +84,14 @@ int WebPRescalerGetScaledDimensions(int src_width, int src_height, int height = *scaled_height; // if width is unspecified, scale original proportionally to height ratio. - if (width == 0) { - width = (src_width * height + src_height / 2) / src_height; + if (width == 0 && src_height > 0) { + width = + (int)(((uint64_t)src_width * height + src_height - 1) / src_height); } // if height is unspecified, scale original proportionally to width ratio. - if (height == 0) { - height = (src_height * width + src_width / 2) / src_width; + if (height == 0 && src_width > 0) { + height = + (int)(((uint64_t)src_height * width + src_width - 1) / src_width); } // Check if the overall dimensions still make sense. if (width <= 0 || height <= 0) { diff --git a/Pods/libwebp/src/utils/rescaler_utils.h b/Pods/libwebp/src/utils/rescaler_utils.h index 98b01a7..ca41e42 100644 --- a/Pods/libwebp/src/utils/rescaler_utils.h +++ b/Pods/libwebp/src/utils/rescaler_utils.h @@ -11,14 +11,14 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_UTILS_RESCALER_H_ -#define WEBP_UTILS_RESCALER_H_ +#ifndef WEBP_UTILS_RESCALER_UTILS_H_ +#define WEBP_UTILS_RESCALER_UTILS_H_ #ifdef __cplusplus extern "C" { #endif -#include "../webp/types.h" +#include "src/webp/types.h" #define WEBP_RESCALER_RFIX 32 // fixed-point precision for multiplies #define WEBP_RESCALER_ONE (1ull << WEBP_RESCALER_RFIX) @@ -98,4 +98,4 @@ int WebPRescalerHasPendingOutput(const WebPRescaler* const rescaler) { } // extern "C" #endif -#endif /* WEBP_UTILS_RESCALER_H_ */ +#endif // WEBP_UTILS_RESCALER_UTILS_H_ diff --git a/Pods/libwebp/src/utils/thread_utils.c b/Pods/libwebp/src/utils/thread_utils.c index 1729060..4e470e1 100644 --- a/Pods/libwebp/src/utils/thread_utils.c +++ b/Pods/libwebp/src/utils/thread_utils.c @@ -13,8 +13,8 @@ #include #include // for memset() -#include "./thread_utils.h" -#include "./utils.h" +#include "src/utils/thread_utils.h" +#include "src/utils/utils.h" #ifdef WEBP_USE_THREAD @@ -50,11 +50,11 @@ typedef struct { #endif // _WIN32 -struct WebPWorkerImpl { +typedef struct { pthread_mutex_t mutex_; pthread_cond_t condition_; pthread_t thread_; -}; +} WebPWorkerImpl; #if defined(_WIN32) @@ -73,7 +73,7 @@ struct WebPWorkerImpl { #endif static int pthread_create(pthread_t* const thread, const void* attr, - unsigned int (__stdcall *start)(void*), void* arg) { + unsigned int (__stdcall* start)(void*), void* arg) { (void)attr; #ifdef USE_CREATE_THREAD *thread = CreateThread(NULL, /* lpThreadAttributes */ @@ -201,25 +201,28 @@ static int pthread_cond_wait(pthread_cond_t* const condition, //------------------------------------------------------------------------------ -static void Execute(WebPWorker* const worker); // Forward declaration. - static THREADFN ThreadLoop(void* ptr) { WebPWorker* const worker = (WebPWorker*)ptr; + WebPWorkerImpl* const impl = (WebPWorkerImpl*)worker->impl_; int done = 0; while (!done) { - pthread_mutex_lock(&worker->impl_->mutex_); + pthread_mutex_lock(&impl->mutex_); while (worker->status_ == OK) { // wait in idling mode - pthread_cond_wait(&worker->impl_->condition_, &worker->impl_->mutex_); + pthread_cond_wait(&impl->condition_, &impl->mutex_); } if (worker->status_ == WORK) { - Execute(worker); + WebPGetWorkerInterface()->Execute(worker); worker->status_ = OK; } else if (worker->status_ == NOT_OK) { // finish the worker done = 1; } // signal to the main thread that we're done (for Sync()) - pthread_cond_signal(&worker->impl_->condition_); - pthread_mutex_unlock(&worker->impl_->mutex_); + // Note the associated mutex does not need to be held when signaling the + // condition. Unlocking the mutex first may improve performance in some + // implementations, avoiding the case where the waiting thread can't + // reacquire the mutex when woken. + pthread_mutex_unlock(&impl->mutex_); + pthread_cond_signal(&impl->condition_); } return THREAD_RETURN(NULL); // Thread is finished } @@ -229,21 +232,28 @@ static void ChangeState(WebPWorker* const worker, WebPWorkerStatus new_status) { // No-op when attempting to change state on a thread that didn't come up. // Checking status_ without acquiring the lock first would result in a data // race. - if (worker->impl_ == NULL) return; + WebPWorkerImpl* const impl = (WebPWorkerImpl*)worker->impl_; + if (impl == NULL) return; - pthread_mutex_lock(&worker->impl_->mutex_); + pthread_mutex_lock(&impl->mutex_); if (worker->status_ >= OK) { // wait for the worker to finish while (worker->status_ != OK) { - pthread_cond_wait(&worker->impl_->condition_, &worker->impl_->mutex_); + pthread_cond_wait(&impl->condition_, &impl->mutex_); } // assign new status and release the working thread if needed if (new_status != OK) { worker->status_ = new_status; - pthread_cond_signal(&worker->impl_->condition_); + // Note the associated mutex does not need to be held when signaling the + // condition. Unlocking the mutex first may improve performance in some + // implementations, avoiding the case where the waiting thread can't + // reacquire the mutex when woken. + pthread_mutex_unlock(&impl->mutex_); + pthread_cond_signal(&impl->condition_); + return; } } - pthread_mutex_unlock(&worker->impl_->mutex_); + pthread_mutex_unlock(&impl->mutex_); } #endif // WEBP_USE_THREAD @@ -268,26 +278,28 @@ static int Reset(WebPWorker* const worker) { worker->had_error = 0; if (worker->status_ < OK) { #ifdef WEBP_USE_THREAD - worker->impl_ = (WebPWorkerImpl*)WebPSafeCalloc(1, sizeof(*worker->impl_)); + WebPWorkerImpl* const impl = + (WebPWorkerImpl*)WebPSafeCalloc(1, sizeof(WebPWorkerImpl)); + worker->impl_ = (void*)impl; if (worker->impl_ == NULL) { return 0; } - if (pthread_mutex_init(&worker->impl_->mutex_, NULL)) { + if (pthread_mutex_init(&impl->mutex_, NULL)) { goto Error; } - if (pthread_cond_init(&worker->impl_->condition_, NULL)) { - pthread_mutex_destroy(&worker->impl_->mutex_); + if (pthread_cond_init(&impl->condition_, NULL)) { + pthread_mutex_destroy(&impl->mutex_); goto Error; } - pthread_mutex_lock(&worker->impl_->mutex_); - ok = !pthread_create(&worker->impl_->thread_, NULL, ThreadLoop, worker); + pthread_mutex_lock(&impl->mutex_); + ok = !pthread_create(&impl->thread_, NULL, ThreadLoop, worker); if (ok) worker->status_ = OK; - pthread_mutex_unlock(&worker->impl_->mutex_); + pthread_mutex_unlock(&impl->mutex_); if (!ok) { - pthread_mutex_destroy(&worker->impl_->mutex_); - pthread_cond_destroy(&worker->impl_->condition_); + pthread_mutex_destroy(&impl->mutex_); + pthread_cond_destroy(&impl->condition_); Error: - WebPSafeFree(worker->impl_); + WebPSafeFree(impl); worker->impl_ = NULL; return 0; } @@ -318,11 +330,12 @@ static void Launch(WebPWorker* const worker) { static void End(WebPWorker* const worker) { #ifdef WEBP_USE_THREAD if (worker->impl_ != NULL) { + WebPWorkerImpl* const impl = (WebPWorkerImpl*)worker->impl_; ChangeState(worker, NOT_OK); - pthread_join(worker->impl_->thread_, NULL); - pthread_mutex_destroy(&worker->impl_->mutex_); - pthread_cond_destroy(&worker->impl_->condition_); - WebPSafeFree(worker->impl_); + pthread_join(impl->thread_, NULL); + pthread_mutex_destroy(&impl->mutex_); + pthread_cond_destroy(&impl->condition_); + WebPSafeFree(impl); worker->impl_ = NULL; } #else diff --git a/Pods/libwebp/src/utils/thread_utils.h b/Pods/libwebp/src/utils/thread_utils.h index 8408311..29ad49f 100644 --- a/Pods/libwebp/src/utils/thread_utils.h +++ b/Pods/libwebp/src/utils/thread_utils.h @@ -11,14 +11,14 @@ // // Author: Skal (pascal.massimino@gmail.com) -#ifndef WEBP_UTILS_THREAD_H_ -#define WEBP_UTILS_THREAD_H_ +#ifndef WEBP_UTILS_THREAD_UTILS_H_ +#define WEBP_UTILS_THREAD_UTILS_H_ #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif -#include "../webp/types.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -35,12 +35,9 @@ typedef enum { // arguments (data1 and data2), and should return false in case of error. typedef int (*WebPWorkerHook)(void*, void*); -// Platform-dependent implementation details for the worker. -typedef struct WebPWorkerImpl WebPWorkerImpl; - // Synchronization object used to launch job in the worker thread typedef struct { - WebPWorkerImpl* impl_; + void* impl_; // platform-dependent implementation worker details WebPWorkerStatus status_; WebPWorkerHook hook; // hook to call void* data1; // first argument passed to 'hook' @@ -78,11 +75,11 @@ typedef struct { // decoding takes place. The contents of the interface struct are copied, it // is safe to free the corresponding memory after this call. This function is // not thread-safe. Return false in case of invalid pointer or methods. -WEBP_EXTERN(int) WebPSetWorkerInterface( +WEBP_EXTERN int WebPSetWorkerInterface( const WebPWorkerInterface* const winterface); // Retrieve the currently set thread worker interface. -WEBP_EXTERN(const WebPWorkerInterface*) WebPGetWorkerInterface(void); +WEBP_EXTERN const WebPWorkerInterface* WebPGetWorkerInterface(void); //------------------------------------------------------------------------------ @@ -90,4 +87,4 @@ WEBP_EXTERN(const WebPWorkerInterface*) WebPGetWorkerInterface(void); } // extern "C" #endif -#endif /* WEBP_UTILS_THREAD_H_ */ +#endif // WEBP_UTILS_THREAD_UTILS_H_ diff --git a/Pods/libwebp/src/utils/utils.c b/Pods/libwebp/src/utils/utils.c index 504d924..764f752 100644 --- a/Pods/libwebp/src/utils/utils.c +++ b/Pods/libwebp/src/utils/utils.c @@ -13,10 +13,11 @@ #include #include // for memcpy() -#include "../webp/decode.h" -#include "../webp/encode.h" -#include "../webp/format_constants.h" // for MAX_PALETTE_SIZE -#include "./utils.h" +#include "src/webp/decode.h" +#include "src/webp/encode.h" +#include "src/webp/format_constants.h" // for MAX_PALETTE_SIZE +#include "src/utils/color_cache_utils.h" +#include "src/utils/utils.h" // If PRINT_MEM_INFO is defined, extra info (like total memory used, number of // alloc/free etc) is printed. For debugging/tuning purpose only (it's slow, @@ -215,9 +216,14 @@ void WebPSafeFree(void* const ptr) { free(ptr); } -// Public API function. +// Public API functions. + +void* WebPMalloc(size_t size) { + return WebPSafeMalloc(1, size); +} + void WebPFree(void* ptr) { - free(ptr); + WebPSafeFree(ptr); } //------------------------------------------------------------------------------ @@ -252,7 +258,6 @@ int WebPGetColorPalette(const WebPPicture* const pic, uint32_t* const palette) { int num_colors = 0; uint8_t in_use[COLOR_HASH_SIZE] = { 0 }; uint32_t colors[COLOR_HASH_SIZE]; - static const uint64_t kHashMul = 0x1e35a7bdull; const uint32_t* argb = pic->argb; const int width = pic->width; const int height = pic->height; @@ -267,7 +272,7 @@ int WebPGetColorPalette(const WebPPicture* const pic, uint32_t* const palette) { continue; } last_pix = argb[x]; - key = ((last_pix * kHashMul) & 0xffffffffu) >> COLOR_HASH_RIGHT_SHIFT; + key = VP8LHashPix(last_pix, COLOR_HASH_RIGHT_SHIFT); while (1) { if (!in_use[key]) { colors[key] = last_pix; diff --git a/Pods/libwebp/src/utils/utils.h b/Pods/libwebp/src/utils/utils.h index 3ab4590..2a3ec92 100644 --- a/Pods/libwebp/src/utils/utils.h +++ b/Pods/libwebp/src/utils/utils.h @@ -16,14 +16,14 @@ #define WEBP_UTILS_UTILS_H_ #ifdef HAVE_CONFIG_H -#include "../webp/config.h" +#include "src/webp/config.h" #endif #include #include -#include "../dsp/dsp.h" -#include "../webp/types.h" +#include "src/dsp/dsp.h" +#include "src/webp/types.h" #ifdef __cplusplus extern "C" { @@ -48,13 +48,13 @@ extern "C" { // somewhere (like: malloc(num_pixels * sizeof(*something))). That's why this // safe malloc() borrows the signature from calloc(), pointing at the dangerous // underlying multiply involved. -WEBP_EXTERN(void*) WebPSafeMalloc(uint64_t nmemb, size_t size); +WEBP_EXTERN void* WebPSafeMalloc(uint64_t nmemb, size_t size); // Note that WebPSafeCalloc() expects the second argument type to be 'size_t' // in order to favor the "calloc(num_foo, sizeof(foo))" pattern. -WEBP_EXTERN(void*) WebPSafeCalloc(uint64_t nmemb, size_t size); +WEBP_EXTERN void* WebPSafeCalloc(uint64_t nmemb, size_t size); // Companion deallocation function to the above allocations. -WEBP_EXTERN(void) WebPSafeFree(void* const ptr); +WEBP_EXTERN void WebPSafeFree(void* const ptr); //------------------------------------------------------------------------------ // Alignment @@ -66,7 +66,7 @@ WEBP_EXTERN(void) WebPSafeFree(void* const ptr); // memcpy() is the safe way of moving potentially unaligned 32b memory. static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) { uint32_t A; - memcpy(&A, (const int*)ptr, sizeof(A)); + memcpy(&A, ptr, sizeof(A)); return A; } static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { @@ -92,14 +92,14 @@ static WEBP_INLINE uint32_t GetLE32(const uint8_t* const data) { // Store 16, 24 or 32 bits in little-endian order. static WEBP_INLINE void PutLE16(uint8_t* const data, int val) { assert(val < (1 << 16)); - data[0] = (val >> 0); - data[1] = (val >> 8); + data[0] = (val >> 0) & 0xff; + data[1] = (val >> 8) & 0xff; } static WEBP_INLINE void PutLE24(uint8_t* const data, int val) { assert(val < (1 << 24)); PutLE16(data, val & 0xffff); - data[2] = (val >> 16); + data[2] = (val >> 16) & 0xff; } static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) { @@ -107,19 +107,6 @@ static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) { PutLE16(data + 2, (int)(val >> 16)); } -// Returns 31 ^ clz(n) = log2(n). This is the default C-implementation, either -// based on table or not. Can be used as fallback if clz() is not available. -#define WEBP_NEED_LOG_TABLE_8BIT -extern const uint8_t WebPLogTable8bit[256]; -static WEBP_INLINE int WebPLog2FloorC(uint32_t n) { - int log = 0; - while (n >= 256) { - log += 8; - n >>= 8; - } - return log + WebPLogTable8bit[n]; -} - // Returns (int)floor(log2(n)). n must be > 0. // use GNU builtins where available. #if defined(__GNUC__) && \ @@ -138,6 +125,19 @@ static WEBP_INLINE int BitsLog2Floor(uint32_t n) { return first_set_bit; } #else // default: use the C-version. +// Returns 31 ^ clz(n) = log2(n). This is the default C-implementation, either +// based on table or not. Can be used as fallback if clz() is not available. +#define WEBP_NEED_LOG_TABLE_8BIT +extern const uint8_t WebPLogTable8bit[256]; +static WEBP_INLINE int WebPLog2FloorC(uint32_t n) { + int log_value = 0; + while (n >= 256) { + log_value += 8; + n >>= 8; + } + return log_value + WebPLogTable8bit[n]; +} + static WEBP_INLINE int BitsLog2Floor(uint32_t n) { return WebPLog2FloorC(n); } #endif @@ -147,14 +147,14 @@ static WEBP_INLINE int BitsLog2Floor(uint32_t n) { return WebPLog2FloorC(n); } struct WebPPicture; // Copy width x height pixels from 'src' to 'dst' honoring the strides. -WEBP_EXTERN(void) WebPCopyPlane(const uint8_t* src, int src_stride, - uint8_t* dst, int dst_stride, - int width, int height); +WEBP_EXTERN void WebPCopyPlane(const uint8_t* src, int src_stride, + uint8_t* dst, int dst_stride, + int width, int height); // Copy ARGB pixels from 'src' to 'dst' honoring strides. 'src' and 'dst' are // assumed to be already allocated and using ARGB data. -WEBP_EXTERN(void) WebPCopyPixels(const struct WebPPicture* const src, - struct WebPPicture* const dst); +WEBP_EXTERN void WebPCopyPixels(const struct WebPPicture* const src, + struct WebPPicture* const dst); //------------------------------------------------------------------------------ // Unique colors. @@ -166,8 +166,8 @@ WEBP_EXTERN(void) WebPCopyPixels(const struct WebPPicture* const src, // MAX_PALETTE_SIZE, also outputs the actual unique colors into 'palette'. // Note: 'palette' is assumed to be an array already allocated with at least // MAX_PALETTE_SIZE elements. -WEBP_EXTERN(int) WebPGetColorPalette(const struct WebPPicture* const pic, - uint32_t* const palette); +WEBP_EXTERN int WebPGetColorPalette(const struct WebPPicture* const pic, + uint32_t* const palette); //------------------------------------------------------------------------------ @@ -175,4 +175,4 @@ WEBP_EXTERN(int) WebPGetColorPalette(const struct WebPPicture* const pic, } // extern "C" #endif -#endif /* WEBP_UTILS_UTILS_H_ */ +#endif // WEBP_UTILS_UTILS_H_ diff --git a/Pods/libwebp/src/webp/decode.h b/Pods/libwebp/src/webp/decode.h index 4c5e74a..80dd0ef 100644 --- a/Pods/libwebp/src/webp/decode.h +++ b/Pods/libwebp/src/webp/decode.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define WEBP_DECODER_ABI_VERSION 0x0208 // MAJOR(8b) + MINOR(8b) +#define WEBP_DECODER_ABI_VERSION 0x0209 // MAJOR(8b) + MINOR(8b) // Note: forward declaring enumerations is not allowed in (strict) C and C++, // the types are left here for reference. @@ -36,39 +36,45 @@ typedef struct WebPDecoderConfig WebPDecoderConfig; // Return the decoder's version number, packed in hexadecimal using 8bits for // each of major/minor/revision. E.g: v2.5.7 is 0x020507. -WEBP_EXTERN(int) WebPGetDecoderVersion(void); +WEBP_EXTERN int WebPGetDecoderVersion(void); // Retrieve basic header information: width, height. // This function will also validate the header, returning true on success, // false otherwise. '*width' and '*height' are only valid on successful return. // Pointers 'width' and 'height' can be passed NULL if deemed irrelevant. -WEBP_EXTERN(int) WebPGetInfo(const uint8_t* data, size_t data_size, - int* width, int* height); +// Note: The following chunk sequences (before the raw VP8/VP8L data) are +// considered valid by this function: +// RIFF + VP8(L) +// RIFF + VP8X + (optional chunks) + VP8(L) +// ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose. +// VP8(L) <-- Not a valid WebP format: only allowed for internal purpose. +WEBP_EXTERN int WebPGetInfo(const uint8_t* data, size_t data_size, + int* width, int* height); // Decodes WebP images pointed to by 'data' and returns RGBA samples, along // with the dimensions in *width and *height. The ordering of samples in // memory is R, G, B, A, R, G, B, A... in scan order (endian-independent). // The returned pointer should be deleted calling WebPFree(). // Returns NULL in case of error. -WEBP_EXTERN(uint8_t*) WebPDecodeRGBA(const uint8_t* data, size_t data_size, - int* width, int* height); +WEBP_EXTERN uint8_t* WebPDecodeRGBA(const uint8_t* data, size_t data_size, + int* width, int* height); // Same as WebPDecodeRGBA, but returning A, R, G, B, A, R, G, B... ordered data. -WEBP_EXTERN(uint8_t*) WebPDecodeARGB(const uint8_t* data, size_t data_size, - int* width, int* height); +WEBP_EXTERN uint8_t* WebPDecodeARGB(const uint8_t* data, size_t data_size, + int* width, int* height); // Same as WebPDecodeRGBA, but returning B, G, R, A, B, G, R, A... ordered data. -WEBP_EXTERN(uint8_t*) WebPDecodeBGRA(const uint8_t* data, size_t data_size, - int* width, int* height); +WEBP_EXTERN uint8_t* WebPDecodeBGRA(const uint8_t* data, size_t data_size, + int* width, int* height); // Same as WebPDecodeRGBA, but returning R, G, B, R, G, B... ordered data. // If the bitstream contains transparency, it is ignored. -WEBP_EXTERN(uint8_t*) WebPDecodeRGB(const uint8_t* data, size_t data_size, - int* width, int* height); +WEBP_EXTERN uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size, + int* width, int* height); // Same as WebPDecodeRGB, but returning B, G, R, B, G, R... ordered data. -WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, size_t data_size, - int* width, int* height); +WEBP_EXTERN uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size, + int* width, int* height); // Decode WebP images pointed to by 'data' to Y'UV format(*). The pointer @@ -80,13 +86,10 @@ WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, size_t data_size, // have a common stride returned as '*uv_stride'. // Return NULL in case of error. // (*) Also named Y'CbCr. See: http://en.wikipedia.org/wiki/YCbCr -WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, size_t data_size, - int* width, int* height, - uint8_t** u, uint8_t** v, - int* stride, int* uv_stride); - -// Releases memory returned by the WebPDecode*() functions above. -WEBP_EXTERN(void) WebPFree(void* ptr); +WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size, + int* width, int* height, + uint8_t** u, uint8_t** v, + int* stride, int* uv_stride); // These five functions are variants of the above ones, that decode the image // directly into a pre-allocated buffer 'output_buffer'. The maximum storage @@ -96,22 +99,22 @@ WEBP_EXTERN(void) WebPFree(void* ptr); // The parameter 'output_stride' specifies the distance (in bytes) // between scanlines. Hence, output_buffer_size is expected to be at least // output_stride x picture-height. -WEBP_EXTERN(uint8_t*) WebPDecodeRGBAInto( +WEBP_EXTERN uint8_t* WebPDecodeRGBAInto( const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride); -WEBP_EXTERN(uint8_t*) WebPDecodeARGBInto( +WEBP_EXTERN uint8_t* WebPDecodeARGBInto( const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride); -WEBP_EXTERN(uint8_t*) WebPDecodeBGRAInto( +WEBP_EXTERN uint8_t* WebPDecodeBGRAInto( const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride); // RGB and BGR variants. Here too the transparency information, if present, // will be dropped and ignored. -WEBP_EXTERN(uint8_t*) WebPDecodeRGBInto( +WEBP_EXTERN uint8_t* WebPDecodeRGBInto( const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride); -WEBP_EXTERN(uint8_t*) WebPDecodeBGRInto( +WEBP_EXTERN uint8_t* WebPDecodeBGRInto( const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride); @@ -122,7 +125,7 @@ WEBP_EXTERN(uint8_t*) WebPDecodeBGRInto( // 'u_size' and 'v_size' respectively. // Pointer to the luma plane ('*luma') is returned or NULL if an error occurred // during decoding (or because some buffers were found to be too small). -WEBP_EXTERN(uint8_t*) WebPDecodeYUVInto( +WEBP_EXTERN uint8_t* WebPDecodeYUVInto( const uint8_t* data, size_t data_size, uint8_t* luma, size_t luma_size, int luma_stride, uint8_t* u, size_t u_size, int u_stride, @@ -213,7 +216,7 @@ struct WebPDecBuffer { }; // Internal, version-checked, entry point -WEBP_EXTERN(int) WebPInitDecBufferInternal(WebPDecBuffer*, int); +WEBP_EXTERN int WebPInitDecBufferInternal(WebPDecBuffer*, int); // Initialize the structure as empty. Must be called before any other use. // Returns false in case of version mismatch @@ -223,7 +226,7 @@ static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) { // Free any memory associated with the buffer. Must always be called last. // Note: doesn't free the 'buffer' structure itself. -WEBP_EXTERN(void) WebPFreeDecBuffer(WebPDecBuffer* buffer); +WEBP_EXTERN void WebPFreeDecBuffer(WebPDecBuffer* buffer); //------------------------------------------------------------------------------ // Enumeration of the status codes @@ -277,7 +280,7 @@ typedef enum VP8StatusCode { // within valid bounds. // All other fields of WebPDecBuffer MUST remain constant between calls. // Returns NULL if the allocation failed. -WEBP_EXTERN(WebPIDecoder*) WebPINewDecoder(WebPDecBuffer* output_buffer); +WEBP_EXTERN WebPIDecoder* WebPINewDecoder(WebPDecBuffer* output_buffer); // This function allocates and initializes an incremental-decoder object, which // will output the RGB/A samples specified by 'csp' into a preallocated @@ -289,7 +292,7 @@ WEBP_EXTERN(WebPIDecoder*) WebPINewDecoder(WebPDecBuffer* output_buffer); // colorspace 'csp' is taken into account for allocating this buffer. All other // parameters are ignored. // Returns NULL if the allocation failed, or if some parameters are invalid. -WEBP_EXTERN(WebPIDecoder*) WebPINewRGB( +WEBP_EXTERN WebPIDecoder* WebPINewRGB( WEBP_CSP_MODE csp, uint8_t* output_buffer, size_t output_buffer_size, int output_stride); @@ -304,7 +307,7 @@ WEBP_EXTERN(WebPIDecoder*) WebPINewRGB( // In this case, the output buffer will be automatically allocated (using // MODE_YUVA) when decoding starts. All parameters are then ignored. // Returns NULL if the allocation failed or if a parameter is invalid. -WEBP_EXTERN(WebPIDecoder*) WebPINewYUVA( +WEBP_EXTERN WebPIDecoder* WebPINewYUVA( uint8_t* luma, size_t luma_size, int luma_stride, uint8_t* u, size_t u_size, int u_stride, uint8_t* v, size_t v_size, int v_stride, @@ -312,19 +315,19 @@ WEBP_EXTERN(WebPIDecoder*) WebPINewYUVA( // Deprecated version of the above, without the alpha plane. // Kept for backward compatibility. -WEBP_EXTERN(WebPIDecoder*) WebPINewYUV( +WEBP_EXTERN WebPIDecoder* WebPINewYUV( uint8_t* luma, size_t luma_size, int luma_stride, uint8_t* u, size_t u_size, int u_stride, uint8_t* v, size_t v_size, int v_stride); // Deletes the WebPIDecoder object and associated memory. Must always be called // if WebPINewDecoder, WebPINewRGB or WebPINewYUV succeeded. -WEBP_EXTERN(void) WebPIDelete(WebPIDecoder* idec); +WEBP_EXTERN void WebPIDelete(WebPIDecoder* idec); // Copies and decodes the next available data. Returns VP8_STATUS_OK when // the image is successfully decoded. Returns VP8_STATUS_SUSPENDED when more // data is expected. Returns error in other cases. -WEBP_EXTERN(VP8StatusCode) WebPIAppend( +WEBP_EXTERN VP8StatusCode WebPIAppend( WebPIDecoder* idec, const uint8_t* data, size_t data_size); // A variant of the above function to be used when data buffer contains @@ -332,7 +335,7 @@ WEBP_EXTERN(VP8StatusCode) WebPIAppend( // to the internal memory. // Note that the value of the 'data' pointer can change between calls to // WebPIUpdate, for instance when the data buffer is resized to fit larger data. -WEBP_EXTERN(VP8StatusCode) WebPIUpdate( +WEBP_EXTERN VP8StatusCode WebPIUpdate( WebPIDecoder* idec, const uint8_t* data, size_t data_size); // Returns the RGB/A image decoded so far. Returns NULL if output params @@ -340,15 +343,16 @@ WEBP_EXTERN(VP8StatusCode) WebPIUpdate( // specified during call to WebPINewDecoder() or WebPINewRGB(). // *last_y is the index of last decoded row in raster scan order. Some pointers // (*last_y, *width etc.) can be NULL if corresponding information is not -// needed. -WEBP_EXTERN(uint8_t*) WebPIDecGetRGB( +// needed. The values in these pointers are only valid on successful (non-NULL) +// return. +WEBP_EXTERN uint8_t* WebPIDecGetRGB( const WebPIDecoder* idec, int* last_y, int* width, int* height, int* stride); // Same as above function to get a YUVA image. Returns pointer to the luma // plane or NULL in case of error. If there is no alpha information // the alpha pointer '*a' will be returned NULL. -WEBP_EXTERN(uint8_t*) WebPIDecGetYUVA( +WEBP_EXTERN uint8_t* WebPIDecGetYUVA( const WebPIDecoder* idec, int* last_y, uint8_t** u, uint8_t** v, uint8_t** a, int* width, int* height, int* stride, int* uv_stride, int* a_stride); @@ -368,7 +372,7 @@ static WEBP_INLINE uint8_t* WebPIDecGetYUV( // Returns NULL in case the incremental decoder object is in an invalid state. // Otherwise returns the pointer to the internal representation. This structure // is read-only, tied to WebPIDecoder's lifespan and should not be modified. -WEBP_EXTERN(const WebPDecBuffer*) WebPIDecodedArea( +WEBP_EXTERN const WebPDecBuffer* WebPIDecodedArea( const WebPIDecoder* idec, int* left, int* top, int* width, int* height); //------------------------------------------------------------------------------ @@ -416,7 +420,7 @@ struct WebPBitstreamFeatures { }; // Internal, version-checked, entry point -WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( +WEBP_EXTERN VP8StatusCode WebPGetFeaturesInternal( const uint8_t*, size_t, WebPBitstreamFeatures*, int); // Retrieve features from the bitstream. The *features structure is filled @@ -424,6 +428,12 @@ WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( // Returns VP8_STATUS_OK when the features are successfully retrieved. Returns // VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieve the // features from headers. Returns error in other cases. +// Note: The following chunk sequences (before the raw VP8/VP8L data) are +// considered valid by this function: +// RIFF + VP8(L) +// RIFF + VP8X + (optional chunks) + VP8(L) +// ALPH + VP8 <-- Not a valid WebP format: only allowed for internal purpose. +// VP8(L) <-- Not a valid WebP format: only allowed for internal purpose. static WEBP_INLINE VP8StatusCode WebPGetFeatures( const uint8_t* data, size_t data_size, WebPBitstreamFeatures* features) { @@ -457,7 +467,7 @@ struct WebPDecoderConfig { }; // Internal, version-checked, entry point -WEBP_EXTERN(int) WebPInitDecoderConfigInternal(WebPDecoderConfig*, int); +WEBP_EXTERN int WebPInitDecoderConfigInternal(WebPDecoderConfig*, int); // Initialize the configuration as empty. This function must always be // called first, unless WebPGetFeatures() is to be called. @@ -477,17 +487,17 @@ static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* config) { // The return WebPIDecoder object must always be deleted calling WebPIDelete(). // Returns NULL in case of error (and config->status will then reflect // the error condition, if available). -WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, size_t data_size, - WebPDecoderConfig* config); +WEBP_EXTERN WebPIDecoder* WebPIDecode(const uint8_t* data, size_t data_size, + WebPDecoderConfig* config); // Non-incremental version. This version decodes the full data at once, taking // 'config' into account. Returns decoding status (which should be VP8_STATUS_OK // if the decoding was successful). Note that 'config' cannot be NULL. -WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, size_t data_size, - WebPDecoderConfig* config); +WEBP_EXTERN VP8StatusCode WebPDecode(const uint8_t* data, size_t data_size, + WebPDecoderConfig* config); #ifdef __cplusplus } // extern "C" #endif -#endif /* WEBP_WEBP_DECODE_H_ */ +#endif // WEBP_WEBP_DECODE_H_ diff --git a/Pods/libwebp/src/webp/demux.h b/Pods/libwebp/src/webp/demux.h index 454f691..846eeb1 100644 --- a/Pods/libwebp/src/webp/demux.h +++ b/Pods/libwebp/src/webp/demux.h @@ -71,7 +71,7 @@ typedef struct WebPAnimDecoderOptions WebPAnimDecoderOptions; // Returns the version number of the demux library, packed in hexadecimal using // 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507. -WEBP_EXTERN(int) WebPGetDemuxVersion(void); +WEBP_EXTERN int WebPGetDemuxVersion(void); //------------------------------------------------------------------------------ // Life of a Demux object @@ -85,7 +85,7 @@ typedef enum WebPDemuxState { } WebPDemuxState; // Internal, version-checked, entry point -WEBP_EXTERN(WebPDemuxer*) WebPDemuxInternal( +WEBP_EXTERN WebPDemuxer* WebPDemuxInternal( const WebPData*, int, WebPDemuxState*, int); // Parses the full WebP file given by 'data'. For single images the WebP file @@ -109,27 +109,32 @@ static WEBP_INLINE WebPDemuxer* WebPDemuxPartial( } // Frees memory associated with 'dmux'. -WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* dmux); +WEBP_EXTERN void WebPDemuxDelete(WebPDemuxer* dmux); //------------------------------------------------------------------------------ // Data/information extraction. typedef enum WebPFormatFeature { - WEBP_FF_FORMAT_FLAGS, // Extended format flags present in the 'VP8X' chunk. + WEBP_FF_FORMAT_FLAGS, // bit-wise combination of WebPFeatureFlags + // corresponding to the 'VP8X' chunk (if present). WEBP_FF_CANVAS_WIDTH, WEBP_FF_CANVAS_HEIGHT, - WEBP_FF_LOOP_COUNT, - WEBP_FF_BACKGROUND_COLOR, - WEBP_FF_FRAME_COUNT // Number of frames present in the demux object. - // In case of a partial demux, this is the number of - // frames seen so far, with the last frame possibly - // being partial. + WEBP_FF_LOOP_COUNT, // only relevant for animated file + WEBP_FF_BACKGROUND_COLOR, // idem. + WEBP_FF_FRAME_COUNT // Number of frames present in the demux object. + // In case of a partial demux, this is the number + // of frames seen so far, with the last frame + // possibly being partial. } WebPFormatFeature; // Get the 'feature' value from the 'dmux'. // NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial() // returned a state > WEBP_DEMUX_PARSING_HEADER. -WEBP_EXTERN(uint32_t) WebPDemuxGetI( +// If 'feature' is WEBP_FF_FORMAT_FLAGS, the returned value is a bit-wise +// combination of WebPFeatureFlags values. +// If 'feature' is WEBP_FF_LOOP_COUNT, WEBP_FF_BACKGROUND_COLOR, the returned +// value is only meaningful if the bitstream is animated. +WEBP_EXTERN uint32_t WebPDemuxGetI( const WebPDemuxer* dmux, WebPFormatFeature feature); //------------------------------------------------------------------------------ @@ -159,20 +164,20 @@ struct WebPIterator { // Returns false if 'dmux' is NULL or frame 'frame_number' is not present. // Call WebPDemuxReleaseIterator() when use of the iterator is complete. // NOTE: 'dmux' must persist for the lifetime of 'iter'. -WEBP_EXTERN(int) WebPDemuxGetFrame( +WEBP_EXTERN int WebPDemuxGetFrame( const WebPDemuxer* dmux, int frame_number, WebPIterator* iter); // Sets 'iter->fragment' to point to the next ('iter->frame_num' + 1) or // previous ('iter->frame_num' - 1) frame. These functions do not loop. // Returns true on success, false otherwise. -WEBP_EXTERN(int) WebPDemuxNextFrame(WebPIterator* iter); -WEBP_EXTERN(int) WebPDemuxPrevFrame(WebPIterator* iter); +WEBP_EXTERN int WebPDemuxNextFrame(WebPIterator* iter); +WEBP_EXTERN int WebPDemuxPrevFrame(WebPIterator* iter); // Releases any memory associated with 'iter'. // Must be called before any subsequent calls to WebPDemuxGetChunk() on the same // iter. Also, must be called before destroying the associated WebPDemuxer with // WebPDemuxDelete(). -WEBP_EXTERN(void) WebPDemuxReleaseIterator(WebPIterator* iter); +WEBP_EXTERN void WebPDemuxReleaseIterator(WebPIterator* iter); //------------------------------------------------------------------------------ // Chunk iteration. @@ -197,20 +202,20 @@ struct WebPChunkIterator { // payloads are accessed through WebPDemuxGetFrame() and related functions. // Call WebPDemuxReleaseChunkIterator() when use of the iterator is complete. // NOTE: 'dmux' must persist for the lifetime of the iterator. -WEBP_EXTERN(int) WebPDemuxGetChunk(const WebPDemuxer* dmux, - const char fourcc[4], int chunk_number, - WebPChunkIterator* iter); +WEBP_EXTERN int WebPDemuxGetChunk(const WebPDemuxer* dmux, + const char fourcc[4], int chunk_number, + WebPChunkIterator* iter); // Sets 'iter->chunk' to point to the next ('iter->chunk_num' + 1) or previous // ('iter->chunk_num' - 1) chunk. These functions do not loop. // Returns true on success, false otherwise. -WEBP_EXTERN(int) WebPDemuxNextChunk(WebPChunkIterator* iter); -WEBP_EXTERN(int) WebPDemuxPrevChunk(WebPChunkIterator* iter); +WEBP_EXTERN int WebPDemuxNextChunk(WebPChunkIterator* iter); +WEBP_EXTERN int WebPDemuxPrevChunk(WebPChunkIterator* iter); // Releases any memory associated with 'iter'. // Must be called before destroying the associated WebPDemuxer with // WebPDemuxDelete(). -WEBP_EXTERN(void) WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter); +WEBP_EXTERN void WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter); //------------------------------------------------------------------------------ // WebPAnimDecoder API @@ -252,7 +257,7 @@ struct WebPAnimDecoderOptions { }; // Internal, version-checked, entry point. -WEBP_EXTERN(int) WebPAnimDecoderOptionsInitInternal( +WEBP_EXTERN int WebPAnimDecoderOptionsInitInternal( WebPAnimDecoderOptions*, int); // Should always be called, to initialize a fresh WebPAnimDecoderOptions @@ -266,7 +271,7 @@ static WEBP_INLINE int WebPAnimDecoderOptionsInit( } // Internal, version-checked, entry point. -WEBP_EXTERN(WebPAnimDecoder*) WebPAnimDecoderNewInternal( +WEBP_EXTERN WebPAnimDecoder* WebPAnimDecoderNewInternal( const WebPData*, const WebPAnimDecoderOptions*, int); // Creates and initializes a WebPAnimDecoder object. @@ -301,8 +306,8 @@ struct WebPAnimInfo { // info - (out) global information fetched from the animation. // Returns: // True on success. -WEBP_EXTERN(int) WebPAnimDecoderGetInfo(const WebPAnimDecoder* dec, - WebPAnimInfo* info); +WEBP_EXTERN int WebPAnimDecoderGetInfo(const WebPAnimDecoder* dec, + WebPAnimInfo* info); // Fetch the next frame from 'dec' based on options supplied to // WebPAnimDecoderNew(). This will be a fully reconstructed canvas of size @@ -316,8 +321,8 @@ WEBP_EXTERN(int) WebPAnimDecoderGetInfo(const WebPAnimDecoder* dec, // Returns: // False if any of the arguments are NULL, or if there is a parsing or // decoding error, or if there are no more frames. Otherwise, returns true. -WEBP_EXTERN(int) WebPAnimDecoderGetNext(WebPAnimDecoder* dec, - uint8_t** buf, int* timestamp); +WEBP_EXTERN int WebPAnimDecoderGetNext(WebPAnimDecoder* dec, + uint8_t** buf, int* timestamp); // Check if there are more frames left to decode. // Parameters: @@ -325,7 +330,7 @@ WEBP_EXTERN(int) WebPAnimDecoderGetNext(WebPAnimDecoder* dec, // Returns: // True if 'dec' is not NULL and some frames are yet to be decoded. // Otherwise, returns false. -WEBP_EXTERN(int) WebPAnimDecoderHasMoreFrames(const WebPAnimDecoder* dec); +WEBP_EXTERN int WebPAnimDecoderHasMoreFrames(const WebPAnimDecoder* dec); // Resets the WebPAnimDecoder object, so that next call to // WebPAnimDecoderGetNext() will restart decoding from 1st frame. This would be @@ -333,7 +338,7 @@ WEBP_EXTERN(int) WebPAnimDecoderHasMoreFrames(const WebPAnimDecoder* dec); // info.loop_count times) without destroying and recreating the 'dec' object. // Parameters: // dec - (in/out) decoder instance to be reset -WEBP_EXTERN(void) WebPAnimDecoderReset(WebPAnimDecoder* dec); +WEBP_EXTERN void WebPAnimDecoderReset(WebPAnimDecoder* dec); // Grab the internal demuxer object. // Getting the demuxer object can be useful if one wants to use operations only @@ -343,16 +348,16 @@ WEBP_EXTERN(void) WebPAnimDecoderReset(WebPAnimDecoder* dec); // // Parameters: // dec - (in) decoder instance from which the demuxer object is to be fetched. -WEBP_EXTERN(const WebPDemuxer*) WebPAnimDecoderGetDemuxer( +WEBP_EXTERN const WebPDemuxer* WebPAnimDecoderGetDemuxer( const WebPAnimDecoder* dec); // Deletes the WebPAnimDecoder object. // Parameters: // dec - (in/out) decoder instance to be deleted -WEBP_EXTERN(void) WebPAnimDecoderDelete(WebPAnimDecoder* dec); +WEBP_EXTERN void WebPAnimDecoderDelete(WebPAnimDecoder* dec); #ifdef __cplusplus } // extern "C" #endif -#endif /* WEBP_WEBP_DEMUX_H_ */ +#endif // WEBP_WEBP_DEMUX_H_ diff --git a/Pods/libwebp/src/webp/encode.h b/Pods/libwebp/src/webp/encode.h index 35fde1d..655166e 100644 --- a/Pods/libwebp/src/webp/encode.h +++ b/Pods/libwebp/src/webp/encode.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define WEBP_ENCODER_ABI_VERSION 0x020e // MAJOR(8b) + MINOR(8b) +#define WEBP_ENCODER_ABI_VERSION 0x020f // MAJOR(8b) + MINOR(8b) // Note: forward declaring enumerations is not allowed in (strict) C and C++, // the types are left here for reference. @@ -35,7 +35,7 @@ typedef struct WebPMemoryWriter WebPMemoryWriter; // Return the encoder's version number, packed in hexadecimal using 8bits for // each of major/minor/revision. E.g: v2.5.7 is 0x020507. -WEBP_EXTERN(int) WebPGetEncoderVersion(void); +WEBP_EXTERN int WebPGetEncoderVersion(void); //------------------------------------------------------------------------------ // One-stop-shop call! No questions asked: @@ -46,37 +46,38 @@ WEBP_EXTERN(int) WebPGetEncoderVersion(void); // These functions compress using the lossy format, and the quality_factor // can go from 0 (smaller output, lower quality) to 100 (best quality, // larger output). -WEBP_EXTERN(size_t) WebPEncodeRGB(const uint8_t* rgb, +WEBP_EXTERN size_t WebPEncodeRGB(const uint8_t* rgb, + int width, int height, int stride, + float quality_factor, uint8_t** output); +WEBP_EXTERN size_t WebPEncodeBGR(const uint8_t* bgr, + int width, int height, int stride, + float quality_factor, uint8_t** output); +WEBP_EXTERN size_t WebPEncodeRGBA(const uint8_t* rgba, int width, int height, int stride, float quality_factor, uint8_t** output); -WEBP_EXTERN(size_t) WebPEncodeBGR(const uint8_t* bgr, +WEBP_EXTERN size_t WebPEncodeBGRA(const uint8_t* bgra, int width, int height, int stride, float quality_factor, uint8_t** output); -WEBP_EXTERN(size_t) WebPEncodeRGBA(const uint8_t* rgba, - int width, int height, int stride, - float quality_factor, uint8_t** output); -WEBP_EXTERN(size_t) WebPEncodeBGRA(const uint8_t* bgra, - int width, int height, int stride, - float quality_factor, uint8_t** output); // These functions are the equivalent of the above, but compressing in a // lossless manner. Files are usually larger than lossy format, but will // not suffer any compression loss. -WEBP_EXTERN(size_t) WebPEncodeLosslessRGB(const uint8_t* rgb, +// Note these functions, like the lossy versions, use the library's default +// settings. For lossless this means 'exact' is disabled. RGB values in +// transparent areas will be modified to improve compression. To avoid this, +// use WebPEncode() and set WebPConfig::exact to 1. +WEBP_EXTERN size_t WebPEncodeLosslessRGB(const uint8_t* rgb, + int width, int height, int stride, + uint8_t** output); +WEBP_EXTERN size_t WebPEncodeLosslessBGR(const uint8_t* bgr, + int width, int height, int stride, + uint8_t** output); +WEBP_EXTERN size_t WebPEncodeLosslessRGBA(const uint8_t* rgba, int width, int height, int stride, uint8_t** output); -WEBP_EXTERN(size_t) WebPEncodeLosslessBGR(const uint8_t* bgr, +WEBP_EXTERN size_t WebPEncodeLosslessBGRA(const uint8_t* bgra, int width, int height, int stride, uint8_t** output); -WEBP_EXTERN(size_t) WebPEncodeLosslessRGBA(const uint8_t* rgba, - int width, int height, int stride, - uint8_t** output); -WEBP_EXTERN(size_t) WebPEncodeLosslessBGRA(const uint8_t* bgra, - int width, int height, int stride, - uint8_t** output); - -// Releases memory returned by the WebPEncode*() functions above. -WEBP_EXTERN(void) WebPFree(void* ptr); //------------------------------------------------------------------------------ // Coding parameters @@ -93,12 +94,15 @@ typedef enum WebPImageHint { // Compression parameters. struct WebPConfig { int lossless; // Lossless encoding (0=lossy(default), 1=lossless). - float quality; // between 0 (smallest file) and 100 (biggest) + float quality; // between 0 and 100. For lossy, 0 gives the smallest + // size and 100 the largest. For lossless, this + // parameter is the amount of effort put into the + // compression: 0 is the fastest but gives larger + // files compared to the slowest, but best, 100. int method; // quality/speed trade-off (0=fast, 6=slower-better) WebPImageHint image_hint; // Hint for image type (lossless only for now). - // Parameters related to lossy compression only: int target_size; // if non-zero, set the desired target size in bytes. // Takes precedence over the 'compression' parameter. float target_PSNR; // if non-zero, specifies the minimal distortion to @@ -159,7 +163,7 @@ typedef enum WebPPreset { } WebPPreset; // Internal, version-checked, entry point -WEBP_EXTERN(int) WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int); +WEBP_EXTERN int WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int); // Should always be called, to initialize a fresh WebPConfig structure before // modification. Returns false in case of version mismatch. WebPConfigInit() @@ -186,15 +190,15 @@ static WEBP_INLINE int WebPConfigPreset(WebPConfig* config, // speed and final compressed size. // This function will overwrite several fields from config: 'method', 'quality' // and 'lossless'. Returns false in case of parameter error. -WEBP_EXTERN(int) WebPConfigLosslessPreset(WebPConfig* config, int level); +WEBP_EXTERN int WebPConfigLosslessPreset(WebPConfig* config, int level); // Returns true if 'config' is non-NULL and all configuration parameters are // within their valid ranges. -WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* config); +WEBP_EXTERN int WebPValidateConfig(const WebPConfig* config); //------------------------------------------------------------------------------ // Input / Output -// Structure for storing auxiliary statistics (mostly for lossy encoding). +// Structure for storing auxiliary statistics. struct WebPAuxStats { int coded_size; // final size @@ -242,16 +246,16 @@ struct WebPMemoryWriter { }; // The following must be called first before any use. -WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer); +WEBP_EXTERN void WebPMemoryWriterInit(WebPMemoryWriter* writer); // The following must be called to deallocate writer->mem memory. The 'writer' // object itself is not deallocated. -WEBP_EXTERN(void) WebPMemoryWriterClear(WebPMemoryWriter* writer); +WEBP_EXTERN void WebPMemoryWriterClear(WebPMemoryWriter* writer); // The custom writer to be used with WebPMemoryWriter as custom_ptr. Upon // completion, writer.mem and writer.size will hold the coded data. // writer.mem must be freed by calling WebPMemoryWriterClear. -WEBP_EXTERN(int) WebPMemoryWrite(const uint8_t* data, size_t data_size, - const WebPPicture* picture); +WEBP_EXTERN int WebPMemoryWrite(const uint8_t* data, size_t data_size, + const WebPPicture* picture); // Progress hook, called from time to time to report progress. It can return // false to request an abort of the encoding process, or true otherwise if @@ -299,7 +303,7 @@ struct WebPPicture { // YUV input (mostly used for input to lossy compression) WebPEncCSP colorspace; // colorspace: should be YUV420 for now (=Y'CbCr). int width, height; // dimensions (less or equal to WEBP_MAX_DIMENSION) - uint8_t *y, *u, *v; // pointers to luma/chroma planes. + uint8_t* y, *u, *v; // pointers to luma/chroma planes. int y_stride, uv_stride; // luma/chroma strides. uint8_t* a; // pointer to the alpha plane int a_stride; // stride of the alpha plane @@ -343,7 +347,7 @@ struct WebPPicture { uint32_t pad3[3]; // padding for later use // Unused for now - uint8_t *pad4, *pad5; + uint8_t* pad4, *pad5; uint32_t pad6[8]; // padding for later use // PRIVATE FIELDS @@ -354,7 +358,7 @@ struct WebPPicture { }; // Internal, version-checked, entry point -WEBP_EXTERN(int) WebPPictureInitInternal(WebPPicture*, int); +WEBP_EXTERN int WebPPictureInitInternal(WebPPicture*, int); // Should always be called, to initialize the structure. Returns false in case // of version mismatch. WebPPictureInit() must have succeeded before using the @@ -371,20 +375,20 @@ static WEBP_INLINE int WebPPictureInit(WebPPicture* picture) { // Allocate y/u/v buffers as per colorspace/width/height specification. // Note! This function will free the previous buffer if needed. // Returns false in case of memory error. -WEBP_EXTERN(int) WebPPictureAlloc(WebPPicture* picture); +WEBP_EXTERN int WebPPictureAlloc(WebPPicture* picture); // Release the memory allocated by WebPPictureAlloc() or WebPPictureImport*(). // Note that this function does _not_ free the memory used by the 'picture' // object itself. // Besides memory (which is reclaimed) all other fields of 'picture' are // preserved. -WEBP_EXTERN(void) WebPPictureFree(WebPPicture* picture); +WEBP_EXTERN void WebPPictureFree(WebPPicture* picture); // Copy the pixels of *src into *dst, using WebPPictureAlloc. Upon return, *dst // will fully own the copied pixels (this is not a view). The 'dst' picture need // not be initialized as its content is overwritten. // Returns false in case of memory allocation error. -WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst); +WEBP_EXTERN int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst); // Compute the single distortion for packed planes of samples. // 'src' will be compared to 'ref', and the raw distortion stored into @@ -393,19 +397,19 @@ WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst); // 'x_step' is the horizontal stride (in bytes) between samples. // 'src/ref_stride' is the byte distance between rows. // Returns false in case of error (bad parameter, memory allocation error, ...). -WEBP_EXTERN(int) WebPPlaneDistortion(const uint8_t* src, size_t src_stride, - const uint8_t* ref, size_t ref_stride, - int width, int height, - size_t x_step, - int type, // 0 = PSNR, 1 = SSIM, 2 = LSIM - float* distortion, float* result); +WEBP_EXTERN int WebPPlaneDistortion(const uint8_t* src, size_t src_stride, + const uint8_t* ref, size_t ref_stride, + int width, int height, + size_t x_step, + int type, // 0 = PSNR, 1 = SSIM, 2 = LSIM + float* distortion, float* result); // Compute PSNR, SSIM or LSIM distortion metric between two pictures. Results // are in dB, stored in result[] in the B/G/R/A/All order. The distortion is // always performed using ARGB samples. Hence if the input is YUV(A), the // picture will be internally converted to ARGB (just for the measurement). // Warning: this function is rather CPU-intensive. -WEBP_EXTERN(int) WebPPictureDistortion( +WEBP_EXTERN int WebPPictureDistortion( const WebPPicture* src, const WebPPicture* ref, int metric_type, // 0 = PSNR, 1 = SSIM, 2 = LSIM float result[5]); @@ -418,8 +422,8 @@ WEBP_EXTERN(int) WebPPictureDistortion( // must be fully be comprised inside the 'src' source picture. If the source // picture uses the YUV420 colorspace, the top and left coordinates will be // snapped to even values. -WEBP_EXTERN(int) WebPPictureCrop(WebPPicture* picture, - int left, int top, int width, int height); +WEBP_EXTERN int WebPPictureCrop(WebPPicture* picture, + int left, int top, int width, int height); // Extracts a view from 'src' picture into 'dst'. The rectangle for the view // is defined by the top-left corner pixel coordinates (left, top) as well @@ -432,42 +436,42 @@ WEBP_EXTERN(int) WebPPictureCrop(WebPPicture* picture, // with WebPPictureInit() if it is different from 'src', since its content will // be overwritten. // Returns false in case of memory allocation error or invalid parameters. -WEBP_EXTERN(int) WebPPictureView(const WebPPicture* src, - int left, int top, int width, int height, - WebPPicture* dst); +WEBP_EXTERN int WebPPictureView(const WebPPicture* src, + int left, int top, int width, int height, + WebPPicture* dst); // Returns true if the 'picture' is actually a view and therefore does // not own the memory for pixels. -WEBP_EXTERN(int) WebPPictureIsView(const WebPPicture* picture); +WEBP_EXTERN int WebPPictureIsView(const WebPPicture* picture); // Rescale a picture to new dimension width x height. // If either 'width' or 'height' (but not both) is 0 the corresponding // dimension will be calculated preserving the aspect ratio. // No gamma correction is applied. // Returns false in case of error (invalid parameter or insufficient memory). -WEBP_EXTERN(int) WebPPictureRescale(WebPPicture* pic, int width, int height); +WEBP_EXTERN int WebPPictureRescale(WebPPicture* pic, int width, int height); // Colorspace conversion function to import RGB samples. // Previous buffer will be free'd, if any. // *rgb buffer should have a size of at least height * rgb_stride. // Returns false in case of memory error. -WEBP_EXTERN(int) WebPPictureImportRGB( +WEBP_EXTERN int WebPPictureImportRGB( WebPPicture* picture, const uint8_t* rgb, int rgb_stride); // Same, but for RGBA buffer. -WEBP_EXTERN(int) WebPPictureImportRGBA( +WEBP_EXTERN int WebPPictureImportRGBA( WebPPicture* picture, const uint8_t* rgba, int rgba_stride); // Same, but for RGBA buffer. Imports the RGB direct from the 32-bit format // input buffer ignoring the alpha channel. Avoids needing to copy the data // to a temporary 24-bit RGB buffer to import the RGB only. -WEBP_EXTERN(int) WebPPictureImportRGBX( +WEBP_EXTERN int WebPPictureImportRGBX( WebPPicture* picture, const uint8_t* rgbx, int rgbx_stride); // Variants of the above, but taking BGR(A|X) input. -WEBP_EXTERN(int) WebPPictureImportBGR( +WEBP_EXTERN int WebPPictureImportBGR( WebPPicture* picture, const uint8_t* bgr, int bgr_stride); -WEBP_EXTERN(int) WebPPictureImportBGRA( +WEBP_EXTERN int WebPPictureImportBGRA( WebPPicture* picture, const uint8_t* bgra, int bgra_stride); -WEBP_EXTERN(int) WebPPictureImportBGRX( +WEBP_EXTERN int WebPPictureImportBGRX( WebPPicture* picture, const uint8_t* bgrx, int bgrx_stride); // Converts picture->argb data to the YUV420A format. The 'colorspace' @@ -476,14 +480,14 @@ WEBP_EXTERN(int) WebPPictureImportBGRX( // non-opaque transparent values is detected, and 'colorspace' will be // adjusted accordingly. Note that this method is lossy. // Returns false in case of error. -WEBP_EXTERN(int) WebPPictureARGBToYUVA(WebPPicture* picture, - WebPEncCSP /*colorspace = WEBP_YUV420*/); +WEBP_EXTERN int WebPPictureARGBToYUVA(WebPPicture* picture, + WebPEncCSP /*colorspace = WEBP_YUV420*/); // Same as WebPPictureARGBToYUVA(), but the conversion is done using // pseudo-random dithering with a strength 'dithering' between // 0.0 (no dithering) and 1.0 (maximum dithering). This is useful // for photographic picture. -WEBP_EXTERN(int) WebPPictureARGBToYUVADithered( +WEBP_EXTERN int WebPPictureARGBToYUVADithered( WebPPicture* picture, WebPEncCSP colorspace, float dithering); // Performs 'sharp' RGBA->YUVA420 downsampling and colorspace conversion. @@ -491,9 +495,9 @@ WEBP_EXTERN(int) WebPPictureARGBToYUVADithered( // method is roughly 2x slower than WebPPictureARGBToYUVA() but produces better // and sharper YUV representation. // Returns false in case of error. -WEBP_EXTERN(int) WebPPictureSharpARGBToYUVA(WebPPicture* picture); +WEBP_EXTERN int WebPPictureSharpARGBToYUVA(WebPPicture* picture); // kept for backward compatibility: -WEBP_EXTERN(int) WebPPictureSmartARGBToYUVA(WebPPicture* picture); +WEBP_EXTERN int WebPPictureSmartARGBToYUVA(WebPPicture* picture); // Converts picture->yuv to picture->argb and sets picture->use_argb to true. // The input format must be YUV_420 or YUV_420A. The conversion from YUV420 to @@ -501,22 +505,22 @@ WEBP_EXTERN(int) WebPPictureSmartARGBToYUVA(WebPPicture* picture); // Note that the use of this colorspace is discouraged if one has access to the // raw ARGB samples, since using YUV420 is comparatively lossy. // Returns false in case of error. -WEBP_EXTERN(int) WebPPictureYUVAToARGB(WebPPicture* picture); +WEBP_EXTERN int WebPPictureYUVAToARGB(WebPPicture* picture); // Helper function: given a width x height plane of RGBA or YUV(A) samples -// clean-up the YUV or RGB samples under fully transparent area, to help -// compressibility (no guarantee, though). -WEBP_EXTERN(void) WebPCleanupTransparentArea(WebPPicture* picture); +// clean-up or smoothen the YUV or RGB samples under fully transparent area, +// to help compressibility (no guarantee, though). +WEBP_EXTERN void WebPCleanupTransparentArea(WebPPicture* picture); // Scan the picture 'picture' for the presence of non fully opaque alpha values. // Returns true in such case. Otherwise returns false (indicating that the // alpha plane can be ignored altogether e.g.). -WEBP_EXTERN(int) WebPPictureHasTransparency(const WebPPicture* picture); +WEBP_EXTERN int WebPPictureHasTransparency(const WebPPicture* picture); // Remove the transparency information (if present) by blending the color with // the background color 'background_rgb' (specified as 24bit RGB triplet). // After this call, all alpha values are reset to 0xff. -WEBP_EXTERN(void) WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb); +WEBP_EXTERN void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb); //------------------------------------------------------------------------------ // Main call @@ -531,7 +535,7 @@ WEBP_EXTERN(void) WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb); // the former for lossy encoding, and the latter for lossless encoding // (when config.lossless is true). Automatic conversion from one format to // another is provided but they both incur some loss. -WEBP_EXTERN(int) WebPEncode(const WebPConfig* config, WebPPicture* picture); +WEBP_EXTERN int WebPEncode(const WebPConfig* config, WebPPicture* picture); //------------------------------------------------------------------------------ @@ -539,4 +543,4 @@ WEBP_EXTERN(int) WebPEncode(const WebPConfig* config, WebPPicture* picture); } // extern "C" #endif -#endif /* WEBP_WEBP_ENCODE_H_ */ +#endif // WEBP_WEBP_ENCODE_H_ diff --git a/Pods/libwebp/src/webp/format_constants.h b/Pods/libwebp/src/webp/format_constants.h index 329fc8a..eca6981 100644 --- a/Pods/libwebp/src/webp/format_constants.h +++ b/Pods/libwebp/src/webp/format_constants.h @@ -84,4 +84,4 @@ typedef enum { // overflow a uint32_t. #define MAX_CHUNK_PAYLOAD (~0U - CHUNK_HEADER_SIZE - 1) -#endif /* WEBP_WEBP_FORMAT_CONSTANTS_H_ */ +#endif // WEBP_WEBP_FORMAT_CONSTANTS_H_ diff --git a/Pods/libwebp/src/webp/mux.h b/Pods/libwebp/src/webp/mux.h index daccc65..7d27489 100644 --- a/Pods/libwebp/src/webp/mux.h +++ b/Pods/libwebp/src/webp/mux.h @@ -57,7 +57,7 @@ extern "C" { WebPMuxGetChunk(mux, "ICCP", &icc_profile); // ... (Consume icc_data). WebPMuxDelete(mux); - free(data); + WebPFree(data); */ // Note: forward declaring enumerations is not allowed in (strict) C and C++, @@ -98,13 +98,13 @@ typedef enum WebPChunkId { // Returns the version number of the mux library, packed in hexadecimal using // 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507. -WEBP_EXTERN(int) WebPGetMuxVersion(void); +WEBP_EXTERN int WebPGetMuxVersion(void); //------------------------------------------------------------------------------ // Life of a Mux object // Internal, version-checked, entry point -WEBP_EXTERN(WebPMux*) WebPNewInternal(int); +WEBP_EXTERN WebPMux* WebPNewInternal(int); // Creates an empty mux object. // Returns: @@ -117,13 +117,13 @@ static WEBP_INLINE WebPMux* WebPMuxNew(void) { // Deletes the mux object. // Parameters: // mux - (in/out) object to be deleted -WEBP_EXTERN(void) WebPMuxDelete(WebPMux* mux); +WEBP_EXTERN void WebPMuxDelete(WebPMux* mux); //------------------------------------------------------------------------------ // Mux creation. // Internal, version-checked, entry point -WEBP_EXTERN(WebPMux*) WebPMuxCreateInternal(const WebPData*, int, int); +WEBP_EXTERN WebPMux* WebPMuxCreateInternal(const WebPData*, int, int); // Creates a mux object from raw data given in WebP RIFF format. // Parameters: @@ -160,7 +160,7 @@ static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* bitstream, // or if fourcc corresponds to an image chunk. // WEBP_MUX_MEMORY_ERROR - on memory allocation error. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxSetChunk( +WEBP_EXTERN WebPMuxError WebPMuxSetChunk( WebPMux* mux, const char fourcc[4], const WebPData* chunk_data, int copy_data); @@ -176,7 +176,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetChunk( // or if fourcc corresponds to an image chunk. // WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given id. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxGetChunk( +WEBP_EXTERN WebPMuxError WebPMuxGetChunk( const WebPMux* mux, const char fourcc[4], WebPData* chunk_data); // Deletes the chunk with the given 'fourcc' from the mux object. @@ -189,7 +189,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetChunk( // or if fourcc corresponds to an image chunk. // WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given fourcc. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxDeleteChunk( +WEBP_EXTERN WebPMuxError WebPMuxDeleteChunk( WebPMux* mux, const char fourcc[4]); //------------------------------------------------------------------------------ @@ -222,7 +222,7 @@ struct WebPMuxFrameInfo { // WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or bitstream is NULL. // WEBP_MUX_MEMORY_ERROR - on memory allocation error. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxSetImage( +WEBP_EXTERN WebPMuxError WebPMuxSetImage( WebPMux* mux, const WebPData* bitstream, int copy_data); // Adds a frame at the end of the mux object. @@ -241,11 +241,11 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetImage( // or if content of 'frame' is invalid. // WEBP_MUX_MEMORY_ERROR - on memory allocation error. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxPushFrame( +WEBP_EXTERN WebPMuxError WebPMuxPushFrame( WebPMux* mux, const WebPMuxFrameInfo* frame, int copy_data); // Gets the nth frame from the mux object. -// The content of 'frame->bitstream' is allocated using malloc(), and NOT +// The content of 'frame->bitstream' is allocated using WebPMalloc(), and NOT // owned by the 'mux' object. It MUST be deallocated by the caller by calling // WebPDataClear(). // nth=0 has a special meaning - last position. @@ -259,7 +259,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxPushFrame( // WEBP_MUX_BAD_DATA - if nth frame chunk in mux is invalid. // WEBP_MUX_MEMORY_ERROR - on memory allocation error. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame( +WEBP_EXTERN WebPMuxError WebPMuxGetFrame( const WebPMux* mux, uint32_t nth, WebPMuxFrameInfo* frame); // Deletes a frame from the mux object. @@ -272,7 +272,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame( // WEBP_MUX_NOT_FOUND - If there are less than nth frames in the mux object // before deletion. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxDeleteFrame(WebPMux* mux, uint32_t nth); +WEBP_EXTERN WebPMuxError WebPMuxDeleteFrame(WebPMux* mux, uint32_t nth); //------------------------------------------------------------------------------ // Animation. @@ -296,7 +296,7 @@ struct WebPMuxAnimParams { // WEBP_MUX_INVALID_ARGUMENT - if mux or params is NULL. // WEBP_MUX_MEMORY_ERROR - on memory allocation error. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxSetAnimationParams( +WEBP_EXTERN WebPMuxError WebPMuxSetAnimationParams( WebPMux* mux, const WebPMuxAnimParams* params); // Gets the animation parameters from the mux object. @@ -307,7 +307,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetAnimationParams( // WEBP_MUX_INVALID_ARGUMENT - if mux or params is NULL. // WEBP_MUX_NOT_FOUND - if ANIM chunk is not present in mux object. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams( +WEBP_EXTERN WebPMuxError WebPMuxGetAnimationParams( const WebPMux* mux, WebPMuxAnimParams* params); //------------------------------------------------------------------------------ @@ -328,8 +328,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams( // WEBP_MUX_INVALID_ARGUMENT - if mux is NULL; or // width or height are invalid or out of bounds // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxSetCanvasSize(WebPMux* mux, - int width, int height); +WEBP_EXTERN WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux, + int width, int height); // Gets the canvas size from the mux object. // Note: This method assumes that the VP8X chunk, if present, is up-to-date. @@ -343,8 +343,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetCanvasSize(WebPMux* mux, // WEBP_MUX_INVALID_ARGUMENT - if mux, width or height is NULL. // WEBP_MUX_BAD_DATA - if VP8X/VP8/VP8L chunk or canvas size is invalid. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxGetCanvasSize(const WebPMux* mux, - int* width, int* height); +WEBP_EXTERN WebPMuxError WebPMuxGetCanvasSize(const WebPMux* mux, + int* width, int* height); // Gets the feature flags from the mux object. // Note: This method assumes that the VP8X chunk, if present, is up-to-date. @@ -359,8 +359,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetCanvasSize(const WebPMux* mux, // WEBP_MUX_INVALID_ARGUMENT - if mux or flags is NULL. // WEBP_MUX_BAD_DATA - if VP8X/VP8/VP8L chunk or canvas size is invalid. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* mux, - uint32_t* flags); +WEBP_EXTERN WebPMuxError WebPMuxGetFeatures(const WebPMux* mux, + uint32_t* flags); // Gets number of chunks with the given 'id' in the mux object. // Parameters: @@ -370,16 +370,16 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* mux, // Returns: // WEBP_MUX_INVALID_ARGUMENT - if mux, or num_elements is NULL. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* mux, - WebPChunkId id, int* num_elements); +WEBP_EXTERN WebPMuxError WebPMuxNumChunks(const WebPMux* mux, + WebPChunkId id, int* num_elements); // Assembles all chunks in WebP RIFF format and returns in 'assembled_data'. // This function also validates the mux object. // Note: The content of 'assembled_data' will be ignored and overwritten. -// Also, the content of 'assembled_data' is allocated using malloc(), and NOT -// owned by the 'mux' object. It MUST be deallocated by the caller by calling -// WebPDataClear(). It's always safe to call WebPDataClear() upon return, -// even in case of error. +// Also, the content of 'assembled_data' is allocated using WebPMalloc(), and +// NOT owned by the 'mux' object. It MUST be deallocated by the caller by +// calling WebPDataClear(). It's always safe to call WebPDataClear() upon +// return, even in case of error. // Parameters: // mux - (in/out) object whose chunks are to be assembled // assembled_data - (out) assembled WebP data @@ -388,8 +388,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* mux, // WEBP_MUX_INVALID_ARGUMENT - if mux or assembled_data is NULL. // WEBP_MUX_MEMORY_ERROR - on memory allocation error. // WEBP_MUX_OK - on success. -WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* mux, - WebPData* assembled_data); +WEBP_EXTERN WebPMuxError WebPMuxAssemble(WebPMux* mux, + WebPData* assembled_data); //------------------------------------------------------------------------------ // WebPAnimEncoder API @@ -442,7 +442,7 @@ struct WebPAnimEncoderOptions { }; // Internal, version-checked, entry point. -WEBP_EXTERN(int) WebPAnimEncoderOptionsInitInternal( +WEBP_EXTERN int WebPAnimEncoderOptionsInitInternal( WebPAnimEncoderOptions*, int); // Should always be called, to initialize a fresh WebPAnimEncoderOptions @@ -455,7 +455,7 @@ static WEBP_INLINE int WebPAnimEncoderOptionsInit( } // Internal, version-checked, entry point. -WEBP_EXTERN(WebPAnimEncoder*) WebPAnimEncoderNewInternal( +WEBP_EXTERN WebPAnimEncoder* WebPAnimEncoderNewInternal( int, int, const WebPAnimEncoderOptions*, int); // Creates and initializes a WebPAnimEncoder object. @@ -490,7 +490,7 @@ static WEBP_INLINE WebPAnimEncoder* WebPAnimEncoderNew( // Returns: // On error, returns false and frame->error_code is set appropriately. // Otherwise, returns true. -WEBP_EXTERN(int) WebPAnimEncoderAdd( +WEBP_EXTERN int WebPAnimEncoderAdd( WebPAnimEncoder* enc, struct WebPPicture* frame, int timestamp_ms, const struct WebPConfig* config); @@ -503,8 +503,8 @@ WEBP_EXTERN(int) WebPAnimEncoderAdd( // webp_data - (out) generated WebP bitstream. // Returns: // True on success. -WEBP_EXTERN(int) WebPAnimEncoderAssemble(WebPAnimEncoder* enc, - WebPData* webp_data); +WEBP_EXTERN int WebPAnimEncoderAssemble(WebPAnimEncoder* enc, + WebPData* webp_data); // Get error string corresponding to the most recent call using 'enc'. The // returned string is owned by 'enc' and is valid only until the next call to @@ -514,12 +514,12 @@ WEBP_EXTERN(int) WebPAnimEncoderAssemble(WebPAnimEncoder* enc, // Returns: // NULL if 'enc' is NULL. Otherwise, returns the error string if the last call // to 'enc' had an error, or an empty string if the last call was a success. -WEBP_EXTERN(const char*) WebPAnimEncoderGetError(WebPAnimEncoder* enc); +WEBP_EXTERN const char* WebPAnimEncoderGetError(WebPAnimEncoder* enc); // Deletes the WebPAnimEncoder object. // Parameters: // enc - (in/out) object to be deleted -WEBP_EXTERN(void) WebPAnimEncoderDelete(WebPAnimEncoder* enc); +WEBP_EXTERN void WebPAnimEncoderDelete(WebPAnimEncoder* enc); //------------------------------------------------------------------------------ @@ -527,4 +527,4 @@ WEBP_EXTERN(void) WebPAnimEncoderDelete(WebPAnimEncoder* enc); } // extern "C" #endif -#endif /* WEBP_WEBP_MUX_H_ */ +#endif // WEBP_WEBP_MUX_H_ diff --git a/Pods/libwebp/src/webp/mux_types.h b/Pods/libwebp/src/webp/mux_types.h index b37e2c6..2fe8195 100644 --- a/Pods/libwebp/src/webp/mux_types.h +++ b/Pods/libwebp/src/webp/mux_types.h @@ -14,7 +14,6 @@ #ifndef WEBP_WEBP_MUX_TYPES_H_ #define WEBP_WEBP_MUX_TYPES_H_ -#include // free() #include // memset() #include "./types.h" @@ -56,6 +55,7 @@ typedef enum WebPMuxAnimBlend { // Data type used to describe 'raw' data, e.g., chunk data // (ICC profile, metadata) and WebP compressed image data. +// 'bytes' memory must be allocated using WebPMalloc() and such. struct WebPData { const uint8_t* bytes; size_t size; @@ -68,11 +68,11 @@ static WEBP_INLINE void WebPDataInit(WebPData* webp_data) { } } -// Clears the contents of the 'webp_data' object by calling free(). Does not -// deallocate the object itself. +// Clears the contents of the 'webp_data' object by calling WebPFree(). +// Does not deallocate the object itself. static WEBP_INLINE void WebPDataClear(WebPData* webp_data) { if (webp_data != NULL) { - free((void*)webp_data->bytes); + WebPFree((void*)webp_data->bytes); WebPDataInit(webp_data); } } @@ -83,7 +83,7 @@ static WEBP_INLINE int WebPDataCopy(const WebPData* src, WebPData* dst) { if (src == NULL || dst == NULL) return 0; WebPDataInit(dst); if (src->bytes != NULL && src->size != 0) { - dst->bytes = (uint8_t*)malloc(src->size); + dst->bytes = (uint8_t*)WebPMalloc(src->size); if (dst->bytes == NULL) return 0; memcpy((void*)dst->bytes, src->bytes, src->size); dst->size = src->size; @@ -95,4 +95,4 @@ static WEBP_INLINE int WebPDataCopy(const WebPData* src, WebPData* dst) { } // extern "C" #endif -#endif /* WEBP_WEBP_MUX_TYPES_H_ */ +#endif // WEBP_WEBP_MUX_TYPES_H_ diff --git a/Pods/libwebp/src/webp/types.h b/Pods/libwebp/src/webp/types.h index 98fff35..cfb43cc 100644 --- a/Pods/libwebp/src/webp/types.h +++ b/Pods/libwebp/src/webp/types.h @@ -7,7 +7,7 @@ // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // -// Common types +// Common types + memory wrappers // // Author: Skal (pascal.massimino@gmail.com) @@ -17,7 +17,7 @@ #include // for size_t #ifndef _MSC_VER -#include +#include #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) #define WEBP_INLINE inline @@ -40,13 +40,29 @@ typedef long long int int64_t; // This explicitly marks library functions and allows for changing the // signature for e.g., Windows DLL builds. # if defined(__GNUC__) && __GNUC__ >= 4 -# define WEBP_EXTERN(type) extern __attribute__ ((visibility ("default"))) type +# define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) # else -# define WEBP_EXTERN(type) extern type +# define WEBP_EXTERN extern # endif /* __GNUC__ >= 4 */ #endif /* WEBP_EXTERN */ // Macro to check ABI compatibility (same major revision number) #define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) -#endif /* WEBP_WEBP_TYPES_H_ */ +#ifdef __cplusplus +extern "C" { +#endif + +// Allocates 'size' bytes of memory. Returns NULL upon error. Memory +// must be deallocated by calling WebPFree(). This function is made available +// by the core 'libwebp' library. +WEBP_EXTERN void* WebPMalloc(size_t size); + +// Releases memory returned by the WebPDecode*() functions (from decode.h). +WEBP_EXTERN void WebPFree(void* ptr); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_WEBP_TYPES_H_ diff --git a/Pods/libwebp/src/webp/types.h.bak b/Pods/libwebp/src/webp/types.h.bak new file mode 100644 index 0000000..47f7f2b --- /dev/null +++ b/Pods/libwebp/src/webp/types.h.bak @@ -0,0 +1,68 @@ +// Copyright 2010 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Common types + memory wrappers +// +// Author: Skal (pascal.massimino@gmail.com) + +#ifndef WEBP_WEBP_TYPES_H_ +#define WEBP_WEBP_TYPES_H_ + +#include // for size_t + +#ifndef _MSC_VER +#include +#if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +#define WEBP_INLINE inline +#else +#define WEBP_INLINE +#endif +#else +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; +typedef long long int int64_t; +#define WEBP_INLINE __forceinline +#endif /* _MSC_VER */ + +#ifndef WEBP_EXTERN +// This explicitly marks library functions and allows for changing the +// signature for e.g., Windows DLL builds. +# if defined(__GNUC__) && __GNUC__ >= 4 +# define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) +# else +# define WEBP_EXTERN extern +# endif /* __GNUC__ >= 4 */ +#endif /* WEBP_EXTERN */ + +// Macro to check ABI compatibility (same major revision number) +#define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) + +#ifdef __cplusplus +extern "C" { +#endif + +// Allocates 'size' bytes of memory. Returns NULL upon error. Memory +// must be deallocated by calling WebPFree(). This function is made available +// by the core 'libwebp' library. +WEBP_EXTERN void* WebPMalloc(size_t size); + +// Releases memory returned by the WebPDecode*() functions (from decode.h). +WEBP_EXTERN void WebPFree(void* ptr); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_WEBP_TYPES_H_ From c73054c43a07e6d799ffd955995f1a9f8e324e93 Mon Sep 17 00:00:00 2001 From: jk Date: Mon, 28 Sep 2020 19:21:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 已兼容webp动图 --- .../UserInterfaceState.xcuserstate | Bin 51165 -> 51061 bytes README.md | 123 +++++++----------- 2 files changed, 48 insertions(+), 75 deletions(-) diff --git a/BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate b/BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate index d9e567b5a9f755cc0030d3860c4fbe7e319dacde..8dd4930e68a003a4c05d35a00cec876b03aae4d1 100644 GIT binary patch delta 20356 zcmaKz2V4|K|Nn1icK5a&97Pco5vd}*NfGHFMFf!|MVio<)1nB4 z8*m5Szy}0_5D*H&z-SN+V!#YA6U+j$!5lCbWP*7h3(NgK1AU<%^oId35C*|fFbqb)aWEbxz;rkf zX26+n7R-aoVLmK?D_|ikg2k`|mcli#5>~-#*Z>=0C)@zL;CA>OJOxj~pWqpI7M_FW z;RSdRUV_)4;x~8;-i8n1BlstL0bjzu;RjMqYLVKc4yjA_A^VbgWIs}$G$2h#Q__sI zBCSbh(uEvOdXe5_3>iztk>kmDGJ#AalgJ5VGMP?JBd3!y$V_q`nN8-9x#SWupDZA2 z$vU#0Y#D81M!q25lb^{i6irDfhLTfSlsRQV4W%rpVU!hRP1#VklpW0IwUElDmQspkR324C6;mpzj9N#PQ*~55wS)Se z+DYxAc2j$(z0^KxKlKB3m^w+FqE1s6sEgFE)OG3xb(4BPJ)}NSpQ$g@S6V_7G@v0( z(iF|oa$1Ylru)(Qv=KdoHl~NsRkD`O=5IU3|qo8BxSUQfLKqu3a z=_&M7dK#Tc&!Y?JBD$C^p-btN^eTEay@p;(m(#U$9o<5=(wpeb^cH$6{Vlzl-b0_K zFVGk1OY~*>3VoHnM*mFzLf@qC(+}u}^fUT7{g!@5zo-9_N~DBTPufqaFYPZKARQ<* zkPeb645fpmCemS2E2*{AQR*ZeA@!7wlzK^nq@$!0q{-40X{t0$nl7Cv&5%x#PL@uW zW=iKt7fBaOmr9pO^Q6nA`O=lrRnk^zo3vfpA?=iIkakHoN;gS2OSegPOZQ0kN)Jg7 zOHWBpOMjA{k)D-am0puRm;NFBQ~E;sQXzdMeJy<>eJgz@{lE|mU>JsFv>0thhtXyF zFb2#Z#))xeT$tgEE91tvGak$c#*^`3Mls>c7$%m9W5zS7Od9hIvxr&DWHUKTF0+JD zFiHk7%b60Ulv&A?G3%IGrjDs+8kk0=li9!=WDYThnInwxQRW!)BXgWN!JK5yFqfHM znd{6w=05X)dCvU7ykXul?^NfhK8k*$*g>ozJCwC#hp|?y6FZXiV!c@( z)|d5T{n>DK3>(2lvI%S=o5W6Fr?6AmY3wXElU>R#WAoVMY(87Wma;3^HSAipoULIS z*k*Psdzd}K9%YZQKeET!6YNR$6nlof$KGcjun*Zs>|+J{gni2X&OT$muwOX|M{t0H z9LZ4}&FOM|xW1eo*N@ZZ47tIa8E4K}b2gkUXUDm4?%XIYm)yJy*jiI=C&|c5WxP zm)pnf=MHg)xwG6k?mTyayU1PTu5mZH-?+QnJ?=607xy>!f&0jP;y&{{FYq#6gV*Hc zd|zIV@5k%&1Np(cB|nUJ;9Yq)-jny?efdB>gb(Gz_y|6dAInGah8EbcH@bUqMeW z5C#dxg0)~H*a~ifyWk-xd<0)1P#7yj3FCxlAx20MQiU`jU6?8?5)?wdP$U!!s|1x$ zAyf)ALak6I)C3QKHcVzEbCNl`%iLt1vOrmwY^*Fs7B8D1OO~a}7ReUN zvSm54T-g$tLZ*}<*-}})tW>6wmC0&kwX#-On{0!sjPW8~s4g?bI@=NW9)S}G{Eomg z1pYwa&+VD)c+PLT@<-(jLReE**ZBTAeZpH7u-5%-YOsM=!`&&8z zXJxx`q_RWVskD;Y%SX$JOA?txL!t>hfTyHyBN(CVY6K&d8&yV@=6b#$K+?BKavS(7 z{gj)UB=lAIQB035{IVdX{TCA?k6PSTYRkPqv%@Ck5A1Usp`+6Yc7uXTf+0~bZG^BC-B z5$qBM`=uLfjwP@63%H>MyN9*e`0ZyWp7!b`RVK55Pn42s{Q)z*F$M@}}}P z;ZeK{8RY?zkk^c<_if727&TX4;Z8{ z7^I<8+?0=%Pr5fNIVE@K!Gao4jW2`^A zu?|}4=@~(jZY*ewv0h;;sE@J!5V6KWOX!5L;4o+ft)UIHg?7*$IzUI|8|7Q&JLP-j zU&_CgACw=JpE{wl8VkA+zlc(Up32W^EJR3@m7>-VLG^$Ii(nzjFTG%+MX+$mK5{uu6KAK-pP4Z$ zD=cHyc2<=|> zwIaI;mWdl8bP%Dd-eZ12PWRS(J**WiP=g4(uS0~MXaT(@*eY6}S+qbu(E@E^J@vbt zyTqQ?-w3y;X*Y|s14Qq(DI>)a-LyO40g?85xD)PzyWt+V7w&`m;SY!~K*S(K7$RaY zB8(6*1QEuFFhPWACp_3gd$fo41R~6OX)SwcZM$iM;AN5a3L?yVX@3@Ju|VK;$v#9_ zC`Tes>?)YlQa^VI{JLKZd`HEVtoPr5_@!MV99xi_L#|TT58f zd#P9Ot=a%@L<89U`y{miK9ZDZfKTu<`~ts{5|SVR2}u$W4v26>gcBm15#fS};fQcW zgc~B>uL1nA0bGbt{V_i|01+d4_{l+-pEM)~iyI<55rGXL z?y_XUet*qYKCMVIT;*8 z#8}bQQTPlixslwg7jz~$TLhhji0DRg4kBVi(Eel=xv<;UA zAeX99k%*e`kE5ch$ra>U5w(ykB8$lqvXop&t|C{HYY>ryhzW>DMnnoCa81(?k&cLo zh{)(9RXwN`>gYwTN5rIF)M>rpYqr{{?ILLhA}05ec8R1L$xY&hh$)Des@`K(POjg} z`W^Yb$hrd&(;La1h?t>f-An$UX5BBc&J<}5imbC#YvOf=bo8Emj69)+J}yGf`A4yC z=(FU{BJ?@(Jb8hPzWS{V08^KZRS@azx}Kq5u&q5K)MTB19A;q6878os@wZkusu&P{xv-lqn)s_99|M zlp~@-)Nmz+bS45QdrV2;w!f-}l5)nBlnZbcH$<#fc6RTuW7qX?Ql69-=Aw_B+|(XC}7OR&hYPIb-8Tt9+}Qj?AqNvr;G6q6>7r_x2zcq)NPq>`u! zR5F!9rBYb0SeCd8s6|8_BI*&*fQUv!G$Eq7lbYB=It9FKhRhtDvhQ*yU7#2#c-V*+^k)Z&1UQP^;9i zD@E8Y5oe7EyHOS5J4nBRs#e2RiLhJ#aa43`1GPbfZKRs0W~zm1rP`==s)NFY{uUA2 z5V0K*-ys6Gn(q;TTg@&+?CzwxdSJIuTXAo)lfs4e^uqpth$CXxf@#%*+hFQ|NP7?w zdwXe*h_pwkW8#Jgtl$0WJ*IV*8~4)wM4c6B&miJJBXtfD2fHOqU81gH9_q3v;X|T? zuZg|x;qG4dM}J-Y->5rk-rFLtI0mM!i9OX}QN{_6sFxz|W9kX@l=_`|Mm?wgp#G#@ zAmTV8P9WkWB2FRVG$MXN1itfGM4aoSUiI+4Q@2#=10s4x!-%-t+fsi~`mCbW4sG;JnA|B9jMK_c|e-Te=3O%KP^v<+=b+tK#41MNsV(ay9B zB5ok!CL(@A#4SYNTi_UkJANDz?sw9zYHE4}7(|bh?4-RB@u1hsPn25_@rUT-KfAGm z=r9o*_gxQroJ>cE*pZTbbd(sO9*Gg^aramwNj{;s+T-a25jq|bPaEk(MEov7N75;D zx=3@IP7?+FOr*&WX`cW0U}MBin4IZV|=Z}l^c6|^gP9qy_ela?@(LgJ8TUgjb~j?zyAQURk%p_G(TQd%mNGE!E`Nip6a1Pl=vjDQgWLl7`VzytwP1k5_6 zGBv7H3k;I#NOnpwo_UYs!7!|TU?-B=caw%ljWDScU%{fs?^07tDm9auiyHz%5wKM6 zl~!6%Chyb3Dz%Z?VOFUv0#=PudjzaiM3lL{v(#0@xh)-z^$%>YkfrWe|G-vtEy7UW zTk6*hEAg$Vd|qh?E&s8Mr8R6h|$DWdwTe6S%3q(y4fLJ@V; zKaPs1tEJT<>Kf@9*OSg!qTM-!7i@IGz{Z6_=+z^OHAV$5%sN>|ey|DYF zcv#se-H$+Aqx1j*<3-qnBhnw$u*XE$coFA>2%GR(U$2o6_H;x1_hFcMwQLAPs?Z1STSofxsjL zCL=HffvKI+dp!nuBz-J>f(?Qbd((OiG82JJ1m=kb$x^pz>3h*2e<3iv*B~E7gM6Zn ziW>rW+_O);$4Vz8J@sZFLt%R`Bm%P<85)7vs>pbAeU6cJ+k+8Adx)cIMpJCIb5-VX z=K6gZ{ccvKpU67@A4kP8H)F^Q#jwm^#)uih7&9h}DPzW%GZqM7aeafpA_NvAkc~hN z0=Wn*K|s;TSgK(e8}-v8 z*2rLu<%ukM5sWydWFp1zv>b;gW*qLQLB6`9hG%;X5zi#4p%O)?71)8yI8g%m-BFoI zXJ(2}6PXNV5;K{Z!c1kRG1HkD2oxbuj6ewjr3kDLx4^$>IkI9nk zWN&42)9%Krb72<}#It0qqdo1Z?^1i(_U&X8u zvGH9i8=18TRCT+soT*Z~uu^nkwaBwxwh&*Ezp}RW*#!Qw-ON_i-=;jxaTC%q1w!!4DPiWnHLCr*T}p=V2A2R@-W4F7C(k< zVE$tMW-<1-5S^S*$-?g2{X0SLu-bCOx1a9GLc)d_xBV97s z6i5bNWT#6s*%|E2?FJLS@2j|dQ4%YOV`sB-lER}#&(BItn~~w4nw8p&znUvahzXAp zKlRpo9=lj#(}pcHpIyMZvfr>cN?|+QMc^Jb6$1AWc+keW17|juT>_lN4*LRr>IDxG zc#P*dI+aGr@*%Oh#jc+4FA|^3%+y8A z>?%o>BtibPdv1bNv5t)rZ6*AN<11K2mBgm|+eWq;f#*sib=lf~msNk!$T~LQ6V)GD zBsm)hBSMSNC;AXWiGf6a!hje+3{lQkMk_OvNy_EQ>B`BM&JzsZxMKh!25RGQ1;?&KQ3}WVk$O}zr@|&-G@JH z*UN>(FoW!DYX=7xJFCIg4tCDDR)e$chda4h4Ys#;aLdhAd;2sybBq?{zukLDD52=b zuu8xxB}!5$)lzCIDW#rVqUHQ-i(G%GoeTWQDvw! za2)O~YGQiEqIvQ7b#~gcjP$H|F(&CVQs>QUa&}QNN}~ z6cXyKl;Ie}s}>?>IwI0>Y}7c_Hsob2S86G>ljZ-H;Z-_Ijg9>S;>P29#7>^07HN!Ze}BZ7w`doAP|hgi+I976kfWs3@pb> zbqetko&Df2UW#)S&n-O$FYzLr4|oC27ify7V%%Ufo}X9*vtcf*#ku>#cvZ}0cpcuv zOJeT8Pk8Z5f1FLWB;C{z1P}`K8%ajbYtIWAkHGET7;%;rlZos(_B?xmy~ti-FSA$J ztL!xdJ|gf5fzJqhLEtNb5(EhZ0fMkoV#@x?UT1HxH`(9VTUhdUlo|+<2+l`v0fLJV zT#R6j(hDM}PzB^|8U37nD>kA(*gx49>`V3)`Ug1U_yzIGqgpn`!eMw~H@D%=nR z@iBZmJ*Cn3*x8xW=gmn?&*(81XTe#Dg@z*7uaO&upuTEO!Ke&-&hg(DbV6{TGN|{2 z;hd|)rlCP;)cb`8=Ob2p1n0?(U8$k&ECWxv^XnH;#+uVz^i?jvLR#a|sBVB4~!7If51l;!0W~h%0G@ zpf!Rv2-+fOw~7 zYPmYDo@?M5C7N6l*DSdz8OybC?W$MBE`tIP^k$S;ul@)IUd9DFxeZ(ww^1@ya)sNh z3M{c0=O-TaxrmQ#<-X;%jmNQSURLJRS(6d;jheY&rkdtEZb!0Q^IzRlRCkGH?mO;# zNdgW&>d)$;ySUw|TP6Kq6Sqfov&0krz#UK-lp5nSqED%n?Gf&T2zZn`#{I}0M=%({ z5ClUJ3~S*|a;Lb{+(`sSBN&e082m<6Q#uu1;x4P0l|!|D=6)5m^$UU#joftvBUQpm z16Hj1E$%jVM>S=oArpn**fCmU$M#h#`vXF*I=IG6_C*zZO8=siapjxb+*S5#bednR zCdgCIb^TRu)|l{(3HVszfaatL$>KrPt5rH0{~7&N`fI;;#7p#6ZxEa&ihQ~XRD?ix-a|E}!iX55np^WAC|YclVY~=2OMeDF|k(q*d1PN&HmY(D}(c zwn;96OH}?Zqo z55eUK;`mU2;0go_5iCNm7{L+*OE+U4#4qKS@p*5e3#MW%%2A1UDeqh2X*M2G#Y1Rz2S+*1G}0)s1`;f@@S~)(`Y-V;!6LcD@6_ zwFp-Jd%($e@px*zncv87;x{9xLU{5Xu50GEV$E$suw2wzh03fZ)MO8j6EXi?@Bpsq zAq1;LZC9(-)fn-|`4f2ckelQRe^Pa*W@uDxckAI#^FJkoM|H~~A~kDD6MsgM@Xs&e z$IQu?6+CNPYTCSi=#f9qU%-02gfrg|SH7`Zj}0o%TKDj4lALD#XZ{!dR|GL<3&Lvx z{-wj4v>+;`S)3z))Bm&a_X_B)T0pI80pUQ=r}xMs^%1-`wfo=2mk0H`M>zjI9l?5^B?$+ zJRSpVL~s*=*z#Li_%HldS`Y{Xw<3t=iEzb#Q0=Yr?#~E#IM5=n0w?f-fZ(?XV%Ka( z@H3>p$2O|7>cwg{5Uonw^<3bxf2+YD`AvJlw#B{2Huzax0BoA9A>=Kn`{S-8?m_!Qw4I{zY^f!99@c+RC+xGvlf zFx&$KA0hboUx>nKdb#KloJ}CHV{r-~W@^SlzuB|0GH1`2k&$Whe|lMXqK1C*PiStI z7+q#{N0**HNO&cD!VfUQYvGOXR(L187yc6d7Cs0c5qyT=a|HiD5RW-tAovo&R|vjF z@J*-iS)JCC5i%e-C)p{Z5PaK{)`Ra6{HVke5(s|k&SCnKLN1mf^V>oY|Av;>;fW{O_axl@9D~S27nIKV;atUvd1nD07!+$~pbxTP6x3 z50N^(f+)a(_@5K6y>(nETPk9n^L%~9D7QFFdb$`5E zeH8BZqJ>!8mn8^ELNZ>mz6LKv|3hYgSCXg5=Hu1k%Vc?Y#rP_`QhcLqx9qU&nC!Uh zr0iGOec2zf53*0PFB%dJpb@PxL1Vhc91TULMwZ4Rjckov4TVO5#!8JwjlCL2HSTNt zuE}c}XDrTRD*Tk?YCz@p@td zxglQ8W-K?Ao6FthBjh9H-f~~LzdTSrN**E)lZVTv%Zucj<>%#ZwEAm})JoFIQD`mK zTA@{>Rid>{t4^yyt4XUxt4*szYlGHCtxZ~cwDxNq&^oMjRO?5rds;8F-fF$q`djOZ zwnQ6fliG4^Lv0J~q1wZ=ZM27LkI)X#9;+RzJzhIOJ4HK9d!qIv?HStH+AFk+wM(^E zYp>NV({9vm)^62q*S?|sMEjZcAKEXqWv{j0>S*co*BPK=pkt}Z-fXXh$7wq2bbit~ zt8-rGqRwTVtE#=5%@ta@y1IRJjde|R&2@+BF4tYFTc%sCTdDh|577tqq54Ss6!ac75!ZU6TJ$N}^KW&k%}{(z+e@&@D&STT?us57w7K)r$b17{D+8MtJia^TW| zzYKgh@bSQ>1D_d;H<)BF#bBDj41*&E=M63zTsF8m$Z3$zAiqHYgMtj9q1;g0P}i`p zVYy+mVXI-gVdvmJgNF<@8EiJ#VzA=Q;6Dbx82oDR8>1;k^Nm&*6&aNntu$I~wAQH1 zsNAU1sM=_g(H5g`jkX)@FxqLf+i0)Rexn0Mhm3wR`aHyFh~JROLrRByJLLS3KZpD^ zr}f$<~bC&s@UKR5o<1elN} zv1oq5rZ-G)nLajs zYWm*vlj#>Ti5X=kHDk?qv;Jo0X6|Mq%to4doB5jgn+2MUG7B*aGfOs0HA^?kFq>>P z)oi-iOtaZ$bIsc`PlNQ2rwYK&E!RjO6GRfg4MtEpDgt!7%yw#udTG!gh+R56*+SS_K zdW7{zYj0~`Yk%uN>+#kJ)=AdM)~VJLttVMev7Tl<(|WeGqQtt(`keJkn?5!kHpwZWaPTHKd`Pt^W&2Kh$Z0_4Uw1u{E+dj7aZ2Q|9 z+77Wbu{E=GwjFNkZyRhIY8!4FWgBf9XB%%j)pmhxp>2unD%-WT>uf7+*W1?FHrlq> z?zG)wyU+Fq+k>`86t>4~kK3NK{mJ&M?eBJ+osC_DU6x(7-4Av*?LOI4_KZDmFSGA! zZ)iWn-qha0ewe+ry{)~y{YZNsdw=^N`w;su`>FN|?6d8c*emUq+pn-MvM;e;Z(nEM zWxv&aoBa;^J@)(T57-~FKW~52{)PQ(`*-$#+kdkE>Hr)l2gX6cI}CC#axiuoC`0ox@It>yCt@siVJRy5kJT*^ZfxS&q4m`HqE-#f~c-S39nC zEORV(Y<6sO>~!4dxW(~X$Fq*t9dA3{b$sCX)bW|)pN=n`Bu>yt?$pOg&#AwYp_7r5 ziIbU=vy-n=v{Rf@g2HKnQ>xQMr^!y!oMt-Baa!h-@3g|H$f?9>mD3t0mD4(>N~db4 zolaMsJ~$6__I94+T;$y8e8TyH^JV92&c8U{b^hJ?59gQ8Z=Byd|Ly$I`Lhe>B6E?u z=(zNC>F46?;_DLR65GIO$waYt~zg<4Md>$?t4u%^JA2~d2c;4`i z;b(`xa@BIRb9Hka;p*k;;~L@`YDC4$910T0@p>ZIj&1w*SmJO zZgSn?y3KW`>u%S5u0Ob*aXqha{l)d6>+i15U0=Aqb$##p!S$0H@7B+4n4688y_=KU za5r~1Pd9HjKes@)@otH36WmhV(%drKCc8~_o9;HtZH`;1+eWwZZm-1!^*?P!_&jtW3X5M5szaY$30GZ{N!=g4Z88Ljs_z}4ynnxTT@z9g<)bP~u)b;G^ zY3OO;In2}A)6Ubu)5+7v)88}5GsJVW!gGx049`WLOFWV1GS3yB#h#^}t32yG8$CCB zZui{bxyy6E=K;^do<}_|dEWMX?fK60Z_iJjUq^zG)JSF|KT>0)(MXe#W+N>|T8^|H zX*bewr1MDEk?td7M=lsyJ#yd3+g`MnrB|@m6tB5nSzZgh7I`i8D)w6Gwc1PNwa%-; zOHt+3=GE!7(QAv>Hm~ozE_nUsb%E)2TfE!7 zJH3DOe&ECU4D%V|GvBAmXP3`4pW8n7d>;BdR`|U1`QY=}SKd^A&vceFyp) z`VR3m^)>hP_l@+8@s0CM@J;be^Ud&`?7P5sk#Dx|3g1%SRlaL|D}1YbYkcc`H~H@I zJ>z@c_mb~b-(P%h_}=op>-)g>vF}IUFMbj~;79sN{Ww3FpQfL-pRS+1UxZ(lU%B5N zKgDf-(%;zM*FV%h+&|Jk%0JOR!+(nZbpKiYbN%P}&-Y*GpXXoTU*uovzuJGT{}%s! z{)haJ`v2&E+W)NodH;+4cl_`BKllIO|22RJAOqL{K0qTt9$*+?72p-%8xRmMDj+l< zJRmY)TtI9wezc*&#!Tp1cgUy161`i8% z3ib^44)zTW2o4Gk4h{_-9ULE=6r2*A9y}>{O7QaFwZRp^RlzmEjls>qZNVMEJA?NG z?+ZQ|d^Y%e@TK6NgMSUa8GI}FkKm6X8X;OCx*>WY{S_ewA%jDVL(D>khKvaD3h@c? z3ke7r6%rZ}9ug4}6%rki8L}p1N6591kD*4P0ihE^mxY#ut_ocnS{7Ox+7{Xw+7-Gv z^xM$wp*unkhaL+(5qdiGZ0PyW=b;}$zlMP@GK>uq!ZgCk(BX5kj$ z&f%`%9^oUyeZu|1Q^IG4XNJ!YUl^Vft_Vlr%fi=&uM4kJgm;B+4c`{NBYaQzzVHL# zhr-W?-wb~d{yO|!_}}55!oQ9IW2iCA7=Fy4F-BvI$C!>WA7eSjYK-j|`!P;qT*gF= z$sAKYX4jY-5g@`WA|PU7#LS2}5%VJEM=Xgbh$xCEjaVI_idYv>8Brb49bUYVC0}kqe!zzi^yS-){!G3gCi3o zlOxk2Ga{!%PLG@wIX5yZa$#gqWNGB8$Tg9w$nwal$ePHy$i~R#$b*r$#=^0tV}r-e z9;+I=ZR~}yzmB~*_V(DjV}Bp}X6*a1AI5%;l0<dd;JJD3MNwi;d zSoE0avC-qAlcFa@PmP`tt(YC18J!iqAo`o=<^$W#Po?ViLsCIj|qwii5VRe5fc>?6Ei+0 zF(x@CGiH9w!k9%d*)dCEP)uG-eoSFZaZE?d@tEIZWwG|Lv9Z~))v>!3v4>-i#h!>g z6?-Z6M(nNFyRi>qAICn8eIENE_H&#h4#v@OOq^+)L)`E3=fpMeaV&mfD z(&IAXGUFD;EsD#DLvhRE^5a&-Rm8Q#?Tp(Kw?FP++>y8+<4(r?6n8G}V%&qc$8k^N zp2htU_cHEv+}pVKaUbG7jn^Nqa2=mGe#!Wz@h8SVi|6Al;~nE&;@#ps;{D@C$B&7R zjE{7(Y3FTKvrTIq{kCtKw_o8{=Ez+v2<8H^*;{-xhx;{%HJ#_^a_h$6t@X z9e+3eLHwimcL^||Z-Rcpzy!mDAql1l774==Y!d7f{1bu_f)hd$MkhohL?y&165u`6Ne^_PMncgoLH7vkyxErlh~TLIq}=X?-F+=?n&I2_(S5s#50NK z6E7uRP5dSCdg5P6R1%jYBxxq;CiP9yPa2S9nPi>hlH{5ckQ9;>mNX`5TvANZ_@soS zX-Nx{ijqo`Rwt>F%9E;+YLe=cnvxW)NxPEvChbo;kaQ^NXwr{KCz4Jjok=>E^lSn@ z!FEFAg!vQJPdG5)w+Ww<>0~xpNY+T!OCFp&B-td{EZHL2GI@Bid$MP;cd}n{Kyq60 z?BuNE1<8w&mn18bmnAPxE=#URZb|M;?n>UAyghkG@~-4P$tRPqCjXLrBl%YH-Q@d< z5ie-v*id~9hic5-H%7_%N6yKD9l=zgSl$4aTl!+;mQ>LZNOqr81FJ*qp z!W5KJnbMrHFXddy!<3Jy@>GjdpVZjYsj1ni`%;gjo=UxvdN=h+>a)~8Q(vY2o%$*D zYZ^!+(}t&wO`D#Um8M8rnzlS`MOty%$~48Aw7Rs`w2ri{w9RQd(srfoP5UA3VA_*( zy>!3yu=J?(N$K;_7pLc@E7O;y7p0e`uTEE`uS>5>Z%A)T-=4lFeSiAF^dsq~($A!y zPrsCYCH=SbJLzvG5)+w;{6vk3S`+(C958XvM5Bqu6RjpXP8>1OfANdOuNQyH=CZZ2 z`(>LdvK_LWvt6@2vPWk7Wcz1FW{=B`$sV7bm^~poB|9yRs5?ZHb*O`e~v+p zS&ns%Lry?WcurEz#GFYvvvV?YvT_#Yp3@bZspv`xtH@I=WDJ4zM1DJ3M!6Zfb5(?vC7ROZqKwS~6})(z4cN9m{qsJF)Eava`!BEW5ny+Ol7l z-CTBi*}Y}&mi@Kt`$Z&ExWfJk304==xyPv&do z56m~rAChmHZ;?MN-zDEI-y`2M-#gzgKOjFgALV!E@5(=yeiU6)Y|&C{Pp?loqTmP!+5zXewwfXenqb z*k15M!J&eq1;-0c6`U#fx!`)iZv}S>?iV~Nc(Oucg~N*Y6?rS#SNyo*(u!v*{#@~D z#oHBst@ya&OCeE67D@}bLRq1_aA=`bp>3f

yHzLifTEg(C~S3w;X%3P%-&6pk;P zTe!TizHm?BmBN>bB6*Qvkz>)QqQs)CqTHe-MX0E#sJLilQAJU0QB%>DqVI}!7VRlI zP;|KHSkdvKdqppcz7$J~xnfzdyjZ7rVDX@0qhga{^Wve!zQw7x*eOYK(Mwzl~eOX7@_OkEGc9-odJ5YAG z>`dADvWsPx%dVCET6UxC&ANf>BG%1aSFx^PUHiHX>o%?1x^DZr)9Zd)_io+Sa-m$O zd|3OBBer6kyp`Nv9)4*#rGAvD-KtjtGHNkx#C*I{fb8wPb!{O>QoM_G_8!N zjILBxmR7b_Zm!&0`9tNQ%A=LXD^FHFuY6bezVbsAtddvhRQ0XWuNqKgP~}lIs%msq zL{(H(TvdEkV%3DI1yz-bs@AH*RmZAMRGqFmTXmu8a@Dn}U#o6b-LAS<^|0zm)w620 zny=QV)~eR6)~nX99#B1~dT_OIwORGhYO89SYP;%;>J`;B)$P@%s(-Hjz54TdVZFop z==IarFI&HP{gL(O*I!zHb^R~vZ>;}q{j2pKYa}(WhOS|2`qmiK46ZS*QJB?O*VxrK z)Hv4+uL-CbTa!^UyXKpk=19%?n)@~HYd+M% zTFqMB+QGHMYQ1ayY6EM7Yr|^8Yn8QywX17YwdJ){wd-p;YP)JT*M3`jp!TQQbF~+0 zFV{Y*eN+3s_V3zHb((bp>ju>sDe8>ttm=I0g6fj$rqxZan^8BbF1s$TuAr`{uC#7- zT~%F8U430sU29!?-PXDjb(iXH);+CzUH7i;@48QQU+bBAu3o6usF&Ak*W1;PuAft1 zSYKXWRbNwIU*A;UQopPIQ2mefC+mNzKUaUF{$BmV`X}|z>R;EttN*M1WBum_1>K<8 zFtEY6!K`6ugH?lLgG+;JgGYmBLr_CRLsCOZLwduchA9ox8kRH^G!!+IHmq)_ZD?!g zY}nYarD0pc-i99<4mBKYINorw;bz0@hOdoWqh8~nMx#cPM)O9SM*Bv`M(4)ijbV++ zjdL3pH=@S8#)8J8#*)TOjVBwQH-1$#88q29c{U|9O=wDON^hFfG_`3))2ybsP5DiQ zO(jjMn$|XzHPtq?HFY*^Y}(Sat?9d_Lrq7UjyIiZy4Uog>2=fFroWo0W~P~ImNoZp zHfT0%9@6aG?Az?$9Ml}#oYB0l`P=3_%@>-lHa~CCXwhoXZRy*h-!ibpu*Imwq($M@ zGNQ$+#kVD(C8#B$CAKBLC8;H)C9P$4OJ>XbmTy{?x2$L>YAJ20ZmDglZ)s}T(Q>%u zXv^`IlP$MeC9SZPZe?4AR?SxJR^3*;R;yOqR)<#SR@YYdR=?Je*3qpItx>Jft!b?p zty5a3w=QWdZe7{Bx>eQM(AwPE+S;LL-P?Mi^;GMb)^n{lTK{Z))%v#euhx&PU)qQ^ zvQ65?wHdSxZX42O(q`5+w9Tr`rp>O+vCX+{Y}?$nb!|J_uD28IrtSXi>FqPxXSZjz zXSL_H=eMtDFKRDoU)jF8y|%rfy}7-uy|cZm{Y3kf_Fvm?wBKsK-~O=uN&D~ZA37AU zL*CJ+L$9NMhhc|Nhe?N7hjYis4xbMHj-ZZ+j_Dnj``(48ml4 zrkqgt0zVK6MuRXA17g7xFcnM#)4>cd6U+iRU^bWo=7W5&3@isLK{==Z>p>OR488zc zz*evgYzI5QPOuB?248~1;0X8z90jMqX>bu-0++#ca0C1SUV%TsYw#C%1Kxsn;63;N zMNk51$Ut2vQ$S;A0{g-KZ~z<%Euc3X34Ne1^n?B|00zQQFbIx@V__VOhZA5LOovn8 zRH%STh~P4~92UYNSPVA4MZh>3jF?bxFfG6Q8cp82O&%m?r z9J~mx!JpvI@D98S6;I$(_zb>+f07)@lTuQL)Fox49;r_nkcOl&IhZsh%}6WKnjB6# zksBB5`eFldfAIkEK(U3`Qan=ZBlZ>hiT%X^;z02zagaDz943wy$B1LaiQ@6%423vT zoF$$p&KA!U&k`4ki^Rp^67dRgskltMQd};s5U&+ii)+NS;wG_LtPyV#cZqk3cZpAn zzZ0JkpB0}IpBH~Gz97CRz9haXzA3&XzAt_telC6?{!RQ+{8s!C>biTkXTCWBno?po5Wo*LgFFumjp->B#Dyok|as8Bt?=cnIK7%q)R4B zrb}i>awT&md6Ildfn=#fAt{lpkTggdB~22wq*>A;X_d4|+9e&5F3AqbPRTCGe#uvo zqmpkW$0Wxk=OpJP_azS`4<(Nzk0nnePbJSJze=7AEXb_hv_5qG5QQ`ev!UJ z|4d(}Z_xMY2lO-gSNb_4W+V*FFbvCZ49`ea-&1`QX3P-AoEgg4G49L=#)I)>ycln0 zBoo4fGNYL=M$U|5;+S|QoylM_nMuqvW(kwW?`(94ss+%abixw(VPya z%gH!B&X65%xJle( zZVI=8E9J_#m0USj!L3qotGPAYT5cVu;wriITot#0tLGZH7VZmf3%8Zq#%+=S@A>W7Z z&kx|u_+h*qZ_kh5J$O&vkN4+;_-HV}%6{IUn?E9K~JsKeb*dby%}HJGd1ue7_^O|n3>&uXA<0Z<4$OO*%IK&kv%;OPqr zK?$xLC=%UP9#oEM1}g|!c}QhyJ;-PkSgWn}8eHuo%>)frC}Z%k?rLuUYN6WIpa#@} zji3(Hg9gwDnv_SC-ztwOk1J0oPbyC-PbY!=Hcc#tZl;;C)iw z>%oHr#)AMtp(uY*-tR7UGD_y$Q%A@`9>YOS`A`j|%17OBP!Ag7ibH)2_ZY*$J{aza z0H?ZQ*VkwuH0{QMgE7`~j0O8(tS16i477y9F&4Cf*3bsp!eP)3+CvBEsQgX&Qu({` z59KT6pUT(Dzm#t@&`FC0-Lw$|J(X{Ju-CSGvG`(3+BMta1P9ca}fa%K_Y@egcuPLM9_#}5WymX)4=&XY>TxX2@4Rx zYvB+f)A}SL`gGHU!BT;)3=z^^yb8f?tKe#(AVLQby4o#vOfnW9D9_qn8iU_k_T#H^@ z+iu)YcwWH$9uY%&aW4tDmqiEQ7104im@9n|F|@m(93UIm3ws^j6ku;4!cq-yA;L<4 z?Fa9{2U=s_SB^r2wE*)-fU!}%a2a6oEBsB1`a(b*_K&08sIN(pfch7F1K+}T@ICwh zKf+J&Ga~E};eZH7L<~oS6C#`u;erTPM7U{4LW@dLT2vC7+`Sjos~6QzYgw`nMkV_q zVnh!rX@XJ7eq?{4Ai@I?p4u(8te(uh2bLT{4#lvfIU>B(qy-{I3b12I8`2KrkhX$l zeXwOod(k~a_+sz=S8f2kUP8K%?%f)YZh{8>*tto2WiY-Bo7*I1BpHGwAbm(*(vS2f z1IR#f6d6R~JfV!M4B#X#mvV>egmXc-U zN<<_eA`ube5s`$5WJKV)rXpejBGNQuMGxv)Z5u_dM?`ur>crkwYHE+Q)dFcVA~JeO z+XT{fvO_3{$V5bzc8f__nMp6}7IK@wx)l-GYH~XwCTUrBllugk+vHxswI>TS`vsaQ zDm(81CWpvxw5&%2)@lDZDzKg;FAA)u$kXI^7ZJEEo2MZ!^{`&;Vf`5q^Ltqr_Oj-8vyLJk3apP1v7ndrsSw1gaS-Ez8!RD+ z@kVLaOZhwbN}&7$5sTF1pNLp2P#TkO$q#}>-w767B3SgJV9`9)N}oX{kP>$@Qk1}0 zATWLu6vz`=stFWN^~I2sl+vMeDH)|l=~D)jA=L*F3PdOofe^6_5z7%#h=?LY6eFTU zLm6oyss7XeYM^K@H5d^qdLgkZtU<(D!FktdotGMhF)7?PEbYOh95E&}oJO~6c)TyppBu5sZuTN3W2sw;8`iqw*R}a;vdUwdhfQDs?^$CCCH%p z&t+Ph*HW#53>&FBs-9|~8mT5qO*K<3i0DGZW<-2}h%Jb~p|lMVIFxoEVyA{`>#@0p z+Jw{0UJ9SIt5=47i1=E_Iar5-Jvw|T=&&CVyL)x`TF~Jjbx0_P*n^0@+AY?>O=jL( z^W)S>L5CBF_)<-sLd5=V2dBsK?Y3L>xiHH;6cjh;I>b3=zi>fggPm z5vMfNvmW5zw2@4`Ld5A_;B&o^d`XKd7GYd5fr#&VaK$9X6;oodP!Mqj5ofhqj0tbB74kFI0#WF;Ek8!Px48=y6M%+iBy?|-O#scj{f!3T^(R=M6u~|2>*i>M? zjG4v80`tXgBa5xXPMBG2Ew&Nciie5q#P(tbv7>l6BCa6fDk6SF#5F|xgb3V1T}K4& z6Wr8@owdwjcku|ZhiI=D$K9=7=6i_1P1R$;$WOF^Ee;W=aZI3j;V z#B)TvK*Vo|c!`ML5rJD*Z0kQY;w3$5EY*5|7{}%7UNzqJdcfx%4_GB=u^JJ7^=h$B z&_X4y6bd5VAmXidi#>pr8THnCqqtsB12;AA)#3(3d=S)#Y8JO?)o2ye_$bhH2x@%# zw;F6!@2xhAw`wKWf+YZ=|6HVXh~45tf&_cSd&T?2UyApOzY-r1e=RZ5pdH;#`NeABZ-yBu?}$v^!ChwCj!0* z;Q1K@{JV7s$q;nNM4-28F3A>jm;|o~1pyB{2GMS@!AJLsFjJBvh=AvRywsA}2zU!3 zn9P$b)QYe`5MiVMvse(pN0lnKGEqvFYf+a8r~&^tDkOGEsYE59mPuAh$|V(&Rg%?` zHIlWGbqL^l1tEZ)BLsm^1V$qeh5)`rgho=?gIX=A0l49l)FC|e(>?oyKr{kzc%liD z#&?sB?i5Hh2;e?S_hgM^vq1WVWQ$M`h(chjc8f{J$sBuGcT4sPta}iMQA_qA5Zldq zKypaSisy0=kP9?N1lDn?3vq+ZdapepIjvgurAR(3bsZ zKvUh&G$}w&!BI;~gs7dW3Q4pw(V_LaVQHBFJM$k$g$zy`(PkKyHl|JJesq6&06mZ% zL=UEMtmPnpeP|8>xd_ZfU>*YV5mfug(VGN9ct zD?I{%#XYRFmoPn|PY2L=CQ(h}ImI_{EbY$G z@LZ1+bS#Z?9nMPhIDtxuO-M%yhF;nop>#5xEl{P0X(r&TiE|>M~t$7KJd!A|jWT` z0Hjixq*|HO(m0t3xOD>VhJPIGHew6?g@D^ix6$o%2i-|)=uLDNy%~WT1Zol3hyaek zdITB}Xhfh10kwwS(u2E0n}liXam~HBtvyK?XnKtJjR1QTftFs_<60x0rOyjA=MZR9 z)88Y|F3^mnFVk0r`rf9m2s9mn(_Ir>vh&{!FR<@b<|chd3wc|B-1MJ|1e@y959!Ck zqaGo!SxrAd;0x8=v|)-D^gB`CP4sW{OZs>E5Be4TC;giKi+)4DMPMre+Ys1}zzzg< zBCrdA-3VaJy$I~vM8Bs$h%B&~KQkhRU;qO}76^Qaz<#BUVCJt7IDo*{2;g`;gm;CG zpO=w4IeVTwC?ZW}sQnz2y|X+$hOjVZ28bM57!#%+(;tB&2z-OU(H3SPGl&_Cz_$q8 zMc}*&Waf;qV1~6ZmW&l+&Db!u2pmJ;3<6lV%LrUU;7*Sgj6H)pnJtV1&G(D40gW@2wX(ql5o9DdxKan(=?eZFd!i!Av-gEs_NG)U5f-J`G4Ib zg-K;5Ab`6qR}i?WGMi{9$r9-@6PfItBPZ_ZtN8JvC_$9SOlGE}M#;y_pO=w2BReQ# zUPcSvHC2=xA0-$5>aFN>CRgOpjwPAN%wmQ!vza;F!u*85&sZA-t|M@xopC19nfc5D zVg5$Y2~XgFn+V|k{up5xY?dY)5*8F3kTq}Wf~l%md6f1~u!3JLjq~!HoQB((4ll4X&2t*z>S<@{M3=Vl(L^pr04c*t89Rc?Jzrg2gl(fJbXt-jg6KkB#uu@&zLx6>a>}& z;)c$eKVycfcA1$XJ}pY_<>Hwp>l+vl7aJ+ho;!DH&aCL%oOwA}IWrulq{;M!O6KHF zpF2AvD_dLJ=rma$yf>)lwbZDbS@UvpX3WUWz2xNV;_BueKQwDb#@xAy3%l9Ef^byN z&d!}Xb?!X;5-V&X-b|e|H9J?y$aJBS?yiEn>qSp5?~&_xL)SFfpeT9t-{;4L1<%UL znV3B>HhWTbZuYFK>}GGD#3=dL%xT$K^Dg=MI|T%Vs)%gEzJa5ZoKm+rI7F$h?5i}n z6c+9j5jjS+OX)=MN~uyu^+f4r?&%d1i+xO7qo&ir}JF+Re%JbNb(!5;RW?*A~3v$LD(12V^V&dkDh)=JcK z=S-hV_(s{2CMb=R#>zgbz-4Yxo?g>uq~HLYibEx5Rz~jP=IK5YhA$d1Da$o``0z;{ zZX<@L$!xkGB|OPg@BvdN{1j7rXE*oZcdKSmBpAPS6Fq!4Y^F&UF0VV-?(nUk&WSuLXX9f5LYpgICWOkbOua(nLYJ zl4I}^nKUvJ&(n7Q1BCXsD5vLl&o2_E${%~%o#V{+IJq(>n3K#Y<}~vibA~y~oMX-- z@CO2~5cm^;*9iQD03Lzir1K7e_ZpD}bCJ2kTxNb?t}s_|gk4kW7$NWh!C46AAef8r z8ybk`FA-d%(k z<|Xqx^9S<^K@vdLX~N8dY4Wr_bVdY--j3L0-+`drMW1iU+uxu>El(#`Z%{N6q5L z=_<{}{~dHaa<1Z8U096>#mSIOvUHtewf+|Uj|LuKzUm33tCOSz^dWpDSK zbzwb)io3FItUEh`^+2#Mf<_1$BWQwPzc%JE>y1@-$UNy5roW&8)(H~b&AUo(#Q+t( z; zM9>OB>&h(f;I@+A~+2H7i@?(_!rJE!e`-6vk754BTF5K zh}r*W&e^%_ye0(kFb8Knb^*IE4o7(Qyk>TRD7ja?#caOFp_yI6<{{{Spkp&zz%E5_ zID&qvV`Z)m%h?qohgP_*WQQ7qfQHmbf_=|0E@K@VDqy=x?bzL)U{YPOkeVOvG9q953H zm2SDUjkj>v^CCXh$!ge5<8h*#J1=+YtjP#^$!9K@sioP>exXV)H#FMJZV@Hpc2C}Y ziuTwxcDrh2c|T%@s=eF??qT<;_zE-F%nI10g_ zR`v+{4SSS5f?zO$Aqa-z531~nsqj1YjOs##jo$a{MZv2sAUImhUP3TT#jP@IYQOYptkHrbp5i?QB@npCHZtY|T)8y>=+kq%vK%$4(pi zf42z9|J@?MGA+w>_C}h_Ql(J!QJJX>=$q^9y3IpQ_@K?s1q*f;E3 z_8t2kLF}&M5R5}G9>Ih*_9O1NT5uwcKrj&}X?$%eg40z$RUYljaMBizNOgL>v#&m9fLryRz7}@A7EWJqzwYh^*9Uh-I2>!Z&vxer&V=hH(&hSd z14OahAZ{>c%9*LWs^X;S2u?#V4Z*2tGAC6`eP7j%Dl`9~c<{qnaF(1EXN_P6f)f#( zgy3Y{E8&K5cKA;Aq63^`(ti?bT-dCM*^3a&6dX27Ww0R}I&&_n^bKavRg{c>4-V_S z)E%zo91+aMFKzItiQ}f^W@k(^b?H6K33tY<-8bsp>8IT}MSJ&W8{A3GSb|Cwtu&kdxDP}!;QsF7l(~CTg_o(%~74Gwlg264PkTto}|%xb|RM~oQ*}E zr|Mf{FH7Sxap-dC9EM+j;6jzWW{hGgw@Bo$g`37r=Vov-xmjEeH=CQo<#KbmdE9(% z0k;sr#Rx7z5C?od!f)as4tE8DN(2#t%Me_SU?GA<2o`U_L`%3lE}tt91}>Zu|GkV` z&J}V+qP+qpZVy%!#TNA+-dBbXYjN*Y(}uQ+c|4gk@a2^z875b z0(X(S#9c-Zlhz~Hh+xxyT=FWJE;tUJBgQeB_5azu>~*Q@T9<0jy40O4Lz^Dg{;vbQ zXW!SJt?oU$Pk*IISEL{^xu>F7c=>i;|U$A9HR?lt!w zw~*Xl+#BvK_YT2!1hFML5!AGDAGnWVG4~n4O$crk-i5$@s;wIM`GMF8_(A+&1a}~a$I87Eou-?nizKKb4=xPZ#O(Gx(YOEIx;yEsEuH`MLZ&VgSED^@Vzy;uM1Cg|v7a!HWo9 zP)yzgYJfZbTrEhmD%L~&)ynK-SO<-?kLl`V^Oy|;@s1s3T>IKXy6<1KnRbU zf+tR$my%hrZv>md5@xIL^x@VcNG4n?fl z4JFQ4|D{$i12D5L65u2ng5p_Kk|xey-xH1!Q20>$4$X`Z}GSJ zI|$~q0?@FVa|vH!^8r)Dqw&-mA2=Ko6_{#UJ|+*gt~d1R^XWc5*f z-A2z68m(E~jaE-);9pCH1xoy1{2Tr)|Bippf8amzpLpCDJwos?f=>{9ir_N@e?{;) zf-eyKO(P|=vyM_qDi)m=?UgbJzU-NGgnuCTm(oXQOx|=)I|fLF6-v^+2>#wP?I;yi zC;`0sQz&>jq;GfWUBw|al@7uEL8%#nuhdf9oBy+WZdGa}we6mbl-l6gNcbAhp5mAN z_@!UF>T$=A{!UWY?rBG<3!Zj_Z~t>t8LE=$8}^lY;igH78>;uXX}T!&73oU-r2eYt z&H)Pe0g*=kGPdCR(jaLtKbO1uAKynLZmd3b8@ulRc7ADuG_uFmB#Gds|FX3-1~W@z zrE=*wDeeJ&Mx+Rl1R{Yl{_nok|4-+aPVBZh3IAWd-(z;^OzA>wcIhl>j&!zkjx<*~ zS2|BRU%CL1Vnj+1Nh7@KjARkXA(BU=6p=a_>7pL9=W8dMrAkEV_L!a2>zQmO`v?QL ze)638xmi2&EQb*W(sIH66^NAe+J8;=w6k=Bv_>#=H6r!Z(pp3s2!=M1Hb~Xjl+s50 z?tnDJ?+#!JUK{#Z86!*}n@BsP+NFh3VQC@Ry|gd|uMPdIYUnZ=v`xBQJ74r)?VfyI zM%MIZ=?>MUu2G6gx)x8aZ^d6&I6@z%PtvF9^YjHg)qREjl`&+@7+3rq1P}cEgOQ9c zmxeJ*IB5u zSO@8>(AlW7Tj!w8O`ZF?lx~0Bp}KauPP)Fje!Bj;fx2ULV|B;rCg_gWP1c>FJ56_n z?kwFGx*ue^cp;&ItdGn{W`b8S50nj-naNyb?lKRVmu#fWSLQDZlm*E`WTR!-vO-y> z?6mB;o}r$HUV`2Ng`PrhnO>n@vEFLEYQ0*$I=u$HCcS38R=sw;4!vD^d-cB5JD_(^ z@37tty(fAv^j_-yq4!4bo!$q%Px`FBiT)6MbA1baYkenucYQzoNc|Xnxqh5}l75Q* z1pRdVN&55km+2Sjm*|)2m+P<6->6@&->9$FzoLIn|AGD^{ipf{zv{m*;0z26`WP4) z3^hnLNHs`P4c_9Ud)(lp!D)jt2ImaEH@IkkS5R-UQpgMk8V)uzGc-3;7?vBZGF)T0 z&hWY6d&7^0pZgGfP@h$O*7RA|r?RiOuR-5FeU18>^xe?6wQqah&c2(B`Wsmr*&5jy zIT&p++H3Ts(N{)a8ygu9HMTUiHnufxH{NNy+jy_>mnN1bE+%d!BTPI^zA)Kua=_%E z$>DyYe$sxr{qz+54Eh!JTiZ|7Z+*WF{a*I_)L+ye^e6l0^w00Vw7;_dvH_w2(gC^y z^adCVm^xs=fJFnA49FjFX~69PcL)43;K4xo!1RHc11AogH1O+zrw5)Hcy8eLgB%8V z5Aqr0Hz;7x$HDAiez4A9+2A#U>jyUuRu675)ioVpI>^-2bcpHCrjJY&PfVYgJ~zuW z%Q0JKR%ljiw!*B;tlVss*&4HTW|d|gW*W0DvoFlHnr%1RX|~&Jui2MoUzz=A_Sca9 zLwts03@I7XHRSY=$3uP}^5>AhhP*Wg=A60IT-RLB+`zn#`4Dppb1QROb31bf^9b`q z^HlRR^9=Jz=2Oh4na?oKGhb?6qA;&CuQA_fUT@xP-fG@%-f6zq{9E&@=GV-BHoswh z%lwY{J@fnK56vH&e=z?vR5TO}C5MWK(nHyy{7{{tvZ3}vBZtl&x^C#6q1W+9d$5JC zMW{u%MWjWPMS?}TMW)3>i%Aw!ET&n^uvl!7Z?V(@SuD3GvS_y0YO%{=kHtO<#n%>x zERI+lwYX^UgT-BohZc`5o?857@w>$Rn_E{aXI%##<>a5jys|!}o6;|)9Mb^NYv}UY1YpJ!a^&o3AYX@r=Yd7l= z)+4Qbt^KV7tz)bwSkJMZYdzn3q4i?xJnI5$g*CEXZe3+vZCz_!XWd}kWZi7tYTa(# zX}!t%g!Ka(*2c~z+Gc@Gt<9G+m5k~wH;?0Z<}nJYMW-8VLRJ)uC3Cx$hO3`)OMBa8ryZYm9{Om z+iZ{894Z+q1UkZ7g}5CTJ75Hy6nEN+iJJn?y%iayEAs@?XKJ1vAbt?-|mUsGrQ+@zuA4Z=j{jE zo7tP&Ti9FK+t?4Yx3_n+cd`$%53wI@A8sFMA7vkHA8S9(KEZyx{Q~>-_FvlnZ2#H8 z!a)({FvX$7VU2^zVZFl!hb9M&LzlxB4qF|zJM45g>~PfKn8Qhj(++1G9y`2tc<=Dh z;j<&@D0ZYBSw|Dc{*Km;_KuE@&W8{g#r$F=f2Ly&Th`*oEJIQIv;fY#f5gUatU!6>k{h{=aS%(?lRS7hRZCMIWBWu z=DRF(S?p5mQtDFfvf5>xOQp+pmxC@xU5>e&bUEvC-sPgpWtV#{4_y9mdE@fV<)bTb zC0!-1jH|J$g{z0Fx2vyffNPLzsB5_E7}sc5xx#gl>r~h2t}|V8TytILxh`;B!VQw?s%H6u$cDe0!+wXS3?U>s+w+n8U-LAU*~jxKDJS>OS3lmiugXg?qVs zqkFS^o4caZy~}-z`*!zT?t9($yPtLc-u2r$BIMDU2o zBUX;sKH`TFuRIJq26zni7~(P1!`{Q)!_#A=ho48FN03K|hukCHW4uR-N18{5$5M}# z9&0>Q9_u}7J?cFgJ=7lCJa&2<@Hpjh&f|NJOCCRZ{N!;%;c?63xyO4?9Zx+^Lr){m zex3t8O+C#$Ej?{KM|%2s26&G04E7xD8SWYB8RZ${DfgW1x!QB5=MSE5y#{-Y^2+o= zUS(btUTeJ8d2RG+_3H52yfeM$doS|N^IqzWybHZcyvw{Ryw`ZQ zc(;3ZdT;XH?7h`{yZ27--QN4W_j_OUem%0^$dMz{M;4FVH1gEQMEmPMGt|e*$JWQ*XSk2E&sd)npA4UgK9hW=`^-}K%=XFkK|X~(YkjJG zs(m*4H2F09wE1-S?D0A3bH(SH&vl<$K6icY`#kb_>hs*^r7!6#@nw8DU#YLm*TA>0 zud#1`-+{hfzTeg_`abrP`q}wK_>J>R@JsSb@yqs`hC4TvSOZ`^* zt@2yzSLwIGuf}hWpW>+BNx##6XZ-TX)UNBBqi$M}!)Pw-FjPxVjt&+=d3zt}&|zrbJNzs$eTzr?@PzubS7f0zGh z|K|a+0M~$|fTaQT0S5w(1)L1{F5qmym4I6TcLVMRJPLRk@N2*eMZn8|Pk}@r87K*4 z1NlIkK=(lJK%YSWz~I2p!0^Dxz~sOQf$4!W19JoC1uhKC4_q3E0+$D_3v3MB5x6^W zU*K1P2Lq1;ej9iq@O0qWz}tcM0`CVt4165;Ebv9(?}4uZ{|bCNs_!VbQR7GDjcOcq zY}Df*I>;($c#unwdyq$vA|NO{XiQLakUS_pC^0B0C?#lW(2Ss*pxmJOK?{Q_gVaIo zL7Jehplv}rgLVh)4LTllD(GU+t)O3m9t1rOdLHy!&>um629v>h!9#;~P473v=985$BA5jrL`Iy5dcAv7s8C3Je|qR^G0t3ua?R)%f}tqrXYZ3=A(Z4do2 z^g!sr(8HnMgdPh$8Twu5+0gGp6&FKajMf?LJbK*dMWY)=e>3_{m?(@15Ha%=nSV5Q~Y*|=ISZP>!*s8Glu%<9g zSXbD-u&=`og?$rtBJ5PynXq$VH^QETeGC_c!*Fpp6V8Y0hUWJTN>hd}(-d__yJYB6K30BVrsM)Q=n-IW*ET(k9X& za(JXmq+4WAWK875$jOn@B4Q=k?P3S$o5E0 zWLMQdB|sB2Nzqi#jrjk+K8DC%j{^RdKOa;$hPJ(e9S9V;7aFt*QF@TqoVjso+8T%&oee5SWA%}8PxxL(3?kXQ4A1U`$ z$OGh~0U-;C=s&UIYkxFzEn#(g{PQJf^sGR`s1InFI^M4W$I zSX^Y>*tpoZxVVJ4@o~vVmh zyA*dj?ta|ExF>Nh;$FtRihCVT#p}mg#9PM?i+6~3ig%445$_f66Yn1{kB^T}j8BSB ziBF5qjL(jr96v37Mto^}XZ)G?=Lz}=9tkN4c?q=%EeY)jnuM-|T?t<&98Nfza6I9Z zBH_D)a|u5u+)TKW@JqtOgvW{EM1w@*#D0kb6Ne-YO|(k1N%TncP7F#6Nt7ohCMG4O zCT1p1Oq`rJHE~g5QDSxC#>9q1bz*B`N8+Z$FA}#U?o2$Mcq;L`#IuR#6E7xSPP~%% zW8%+=Hxl2CHyQ6UK5hK+@tW~x$3IKrk_?lKk`(=t1|(S|IV25Fa!ztha!>L|3QiiG z6p<8_6q6)Rnw?aTv@EG8sU)d9X?4=tBvn##Qd`oFq`gUBCLKsRl5{lbc+$zFt4Y5k z{gw1C>0`1e877O9nPfg$H(5W~BH23GHrX!OA=xR}HF-p`XY$Bo-{j=vCCLrRhm(Iv zVN)CwDPvM*q|8rQl#-WHkW!qoI%QqT`jqOFjVbjhjVbDsEh*bmcBSl1*`IPC%jXUbnG?@~Uba;ZA0MyV#LmZ`&1?Nf)Rx}}at^-3L?8j+fqIz4q(>YUVh zsS8t=q!y$qQex2}Q!kaWA4W?0Pk~AibOEXUEpEfAXENy6-W!k8;=(M=BgtVlzw6u)0 ziD{G4=BF)6D@rR%D^FXUR+(0nR+F|dZByFbwEbycryWi^nszMhQrd&GKho)RE?p;G zFWoTRD7~K|ePFt2x_P=~x_7#7dO-T9^x*W-=@IEs=`rc!(&N(;(=*c-rx&Kzr*BI? zk$ye>Wd@TmB*P;kJR>EeKBG0GD`QW_(Tvj>XEVOfxRmiz#*K{I8TT^oXBua^WJYGj zWu|9lWlqYRnmHpgCo?xwky)HsnpvK?Ig)<9LVP#=w;qJok3U3xZD|}l-7jZ>8MS4YsMMg#aiUt6Wh;REd5`pAzGe{w0G-OiP?g{7M2#f=fo1M3jsvNhq0E zGPz`0$;^`3CAlRVN~%k?m3&=txa4Tb@sd*|-5x*3QtQ%Tr4FS|rLLtTO1(;b zO8rYmm4=k2m1dS^mrg02UOKaMc4=$1?Y z__AqbiZWGMSJ|$z-DUgAjws5$DLYnnuIzHzwXz3gPs^T{y)1iO_O|Rp*{7BLR$8xg zTj{$pU}ezC(3RmUCaz3gIbmh`%Ec?ISGKPFa^;1U*H-?%@ zTVYr+u)?=uRK>)K?26oqyo#k2sG_i#Nq+tgl<&xW0M){`F_q-(UZH{rf6V#Z~E4=~Wq4 z*;I|Jil~}UwWKP)N>R0}s;Fv3)q$#GRp+WMR9&vRTJ=-a^{U5Jud3cveXRPt0c;4_ zpcuPh)`qzo)@^9q(7d5-L+6I=8xC$bvf=24;~Oq*xU%8L4L?_dYOdO_+OImOI;T3n zy0W^ey0Ln5_15Yg)w`?rRqwC9S^cp3QT5a6S2aWpStF@oYxo+S8oL_L8sD0LnxLAn znuwY)HDhZg*Ob;&)$FXLhhKb$WG%bw+iA>dflQ>n!W6>)h)`)y3DP*G;Wk zP*+f=tXp1JTvwr}TT{2LZhhT`I!)bVBwuRQI&*RlTU5s@JO@Q14XlT0f%R ztKO&HuYOMblKSQK#r382<@KxU*VZ@GtLt0qJL(VDpRNDC{$l+P^^fZRtbbGguKr^K z+aPVwZP0J9XmDHAOZ>HN`Z^6-}v4lbYr>EofTYl;5Kb*O zx>4P%ZdD&s-)W|rjhfw>!)p9S}j{`TJ2gLTAf;5TSv5dwvKF#X&u*^(3;em+M3on zrFBm0yw-)SOIiyQt%}z2*43@+TGzKWx3;x*v~FtM+q%E?Kypp*7t4Fwjph!+CtjG+9KP=w#Bx^wI#GAwdJ(sw#{!_)Rxy)&{o`5(YB^d)mGJ3 z-PYFD+1AyzrR_-DxwZ>!m)fqh-D`W$_NeV?+oyJ}UD_^d*Kb!0Zg*~XYxijPZue~u zXb)-+Z4YlB)1Ka*)t=oxxqWK;jP{)NIqh@X7ql;GU*Eo~{m1rq9fLZ8I;M1#bhLMD z?by+=yJK(1;f_-s-*uerINx!h<5I`%j(Z&sIv#gC>v-PDbsBdL>>S)Vq|>U?rqiy| zq0^@`q*LCR*qPLs+L@{7oY*EMG)bDtnrWID znjB5OMxjBPLd^zEtEOF}(R69{X};5((_GM8)?C&6q`9F{+}7OFJkY$=e9(N_B-#Wv zQJW;2m`&U!olUY$_M0L%&EB+b)1FP&yF^`syL`JsyTZH1bdBvw?8@lM>dNk#+%>gp zde@?^yso8PsH?E6xT~dWTi5QceO>#z4s{*rI@)!t>vGqft_NL@x}J9Z*7bYWtFG6Z ism(f@EjJI_JW3=QB&@9hpnHXtNV-e=yLY=e?*9NY(qEte diff --git a/README.md b/README.md index 0ae4c3f..50a76f2 100644 --- a/README.md +++ b/README.md @@ -35,64 +35,32 @@ UIWebView,WKWebView都不支持WebP。(UIWebView 可以用NSUrlProtocol来 ## 4、BAWKWebView-WebP 的类结构及 demo 示例 ![BAWKWebView-WebP](https://github.com/BAHome/BAWKWebView-WebP/blob/master/Images/BAWKWebView-WebP.png) -### BAWKWebView_WebP.h -``` -#ifndef BAWKWebView_WebP_h -#define BAWKWebView_WebP_h - -//#import "BAURLSessionProtocol.h" -#import "NSURLProtocol+BAWebView.h" - -/*! - ********************************************************************************* - ************************************ 更新说明 ************************************ - ********************************************************************************* - - 欢迎使用 BAHome 系列开源代码 ! - 如有更多需求,请前往:https://github.com/BAHome - - 项目源码地址: - OC 版 :https://github.com/BAHome/BAWKWebView_WebP - - 最新更新时间:2017-08-02 【倒叙】
- 最新Version:【Version:1.0.0】
- 更新内容:
- 1.0.0.1、用分类封装 WKWebView,代码无任何侵入更改
- 1.0.0.2、WKWebView 目前可以兼容 GIF 动图显示,和 webp 的静态图片显示(webp 的动态图片显示需要等待后期版本更新)
- */ -#endif /* BAWKWebView_WebP_h */ -``` +### demo 示例 -### NSURLProtocol+BAWebView.h -``` -/**** - NSURLProtocol, UIWebView 直接就可以支持,但是 WKWebView 是不支持的,如何让 WKWebView 也支持 NSURLProtocol - **/ -#import +`引入SDWebImage来编解码webp` -@interface NSURLProtocol (BAWebView) +```C +#import -/** - NSURLProtocol:registerScheme +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + ... your code + + /// 添加Webp格式解码 + [SDImageCodersManager.sharedManager addCoder:[SDImageWebPCoder sharedCoder]]; + [SDWebImageDownloader.sharedDownloader setValue:@"image/webp,image/*,*/*;q=0.8" forHTTPHeaderField:@"Accept"]; + + return YES; +} - @param scheme 【http/https】 - */ -+ (void)ba_web_registerScheme:(NSString*)scheme; +``` -/** - NSURLProtocol:webView销毁的时候注销Scheme +使用 - @param scheme 【http/https】 - */ -+ (void)ba_web_unregisterScheme:(NSString*)scheme; +> iOS14发布后,新版WebKit内核已经支持webp,所以只要向下兼容即可 -@end -``` +```C -### demo 示例 -``` -// 示例1: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. @@ -110,43 +78,48 @@ UIWebView,WKWebView都不支持WebP。(UIWebView 可以用NSUrlProtocol来 } #pragma mark - 注册自定义 NSURLProtocol -- (void)ba_registerURLProtocol -{ - [NSURLProtocol registerClass:NSClassFromString(@"BAURLSessionProtocol")]; - // 注册registerScheme使得WKWebView支持NSURLProtocol - [NSURLProtocol ba_web_registerScheme:@"http"]; - [NSURLProtocol ba_web_registerScheme:@"https"]; +BOOL beforeiOS(CGFloat aVersion) { + return UIDevice.currentDevice.systemVersion.floatValue < aVersion; } -- (void)dealloc -{ - [NSURLProtocol unregisterClass:NSClassFromString(@"BAURLSessionProtocol")]; - // 移除 registerScheme - [NSURLProtocol ba_web_unregisterScheme:@"http"]; - [NSURLProtocol ba_web_unregisterScheme:@"https"]; + +- (void)ba_registerURLProtocol { + // 新版WebKit内核已经支持webp + if (beforeiOS(14)) { + [NSURLProtocol registerClass:NSClassFromString(@"BAURLSessionProtocol")]; + // 注册registerScheme使得WKWebView支持NSURLProtocol + [NSURLProtocol ba_web_registerScheme:@"http"]; + [NSURLProtocol ba_web_registerScheme:@"https"]; + } } -- (WKWebView *)wkWebview -{ - if (!_wkWebview) - { - _wkWebview = [[WKWebView alloc]initWithFrame:CGRectZero]; +- (void)dealloc{ + if (beforeiOS(14)) { + [NSURLProtocol unregisterClass:NSClassFromString(@"BAURLSessionProtocol")]; + // 移除 registerScheme + [NSURLProtocol ba_web_unregisterScheme:@"http"]; + [NSURLProtocol ba_web_unregisterScheme:@"https"]; } - return _wkWebview; +} + +- (WKWebView *)wkWebview { + if (!_wkWebview) { + _wkWebview = [[WKWebView alloc]initWithFrame:CGRectZero]; + } return _wkWebview; } 其他示例可下载 demo 查看源码! ``` -## 5、更新记录:【倒叙】 - 欢迎使用 [【BAHome】](https://github.com/BAHome) 系列开源代码 ! - 如有更多需求,请前往:[【https://github.com/BAHome】](https://github.com/BAHome) - - 最新更新时间:2017-08-02 【倒叙】
- 最新Version:【Version:1.0.0】
+ +## 5、更新 + + 最新更新时间:2020-09-28 【倒叙】
+ 最新Version:【Version:1.0.3】
更新内容:
- 1.0.0.1、用分类封装 WKWebView,代码无任何侵入更改
- 1.0.0.2、WKWebView 目前可以兼容 GIF 动图显示,和 webp 的静态图片显示(webp 的动态图片显示需要等待后期版本更新)
+> * 1.0.1、 用分类封装 WKWebView,代码无任何侵入更改 +> * 1.0.2、 WKWebView 目前可以兼容 GIF 动图显示,和 webp 的静态图片显示 +> * 1.0.3、 已支持webp动图显示 ## 6、bug 反馈 > 1、开发中遇到 bug,希望小伙伴儿们能够及时反馈与我们 BAHome 团队,我们必定会认真对待每一个问题!
From e9878e9bdcb653332d4f3e1f976de636b5a65e99 Mon Sep 17 00:00:00 2001 From: jk Date: Mon, 28 Sep 2020 19:29:00 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改注释 --- .../UserInterfaceState.xcuserstate | Bin 51061 -> 52132 bytes .../BAWKWebView-WebP/BAURLSessionProtocol.m | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate b/BAWKWebView-WebP.xcworkspace/xcuserdata/mvmtv.xcuserdatad/UserInterfaceState.xcuserstate index 8dd4930e68a003a4c05d35a00cec876b03aae4d1..3af09d4f0d38939c8f455ea8e942edb020093454 100644 GIT binary patch delta 19639 zcmaL71z;3c_y4^!cXu+HY@7rQQKCeM5>JQ{Awt}PYY3Wz-CLqWkc|`DBt(cH!QE*o z6n8JBXem+(6npPPo~O^R{lBF%yBXW_Ip=%MmAUWAKx-9Pn~Yg)O^LuHuDBcSi~HgJ zcmN)VhvO0WYBgy2BJX>NCBxJ4a@;^ z!77jo@<2W)0EM6ktOmuP1gr&Bpc>SGM$iO0KquG)wt+tI12_$S1ZTim@Dn%(&Vvi! zBDf0ffV&{}9(V+P1uwzx;1&1)J_?nDVxh87MW`xN6RHa}gqp%(!VyAUp`K7*Xd*Nf z+6X5IZG|pES7C%OQaDu@C5#rv2xEnD!gyhVFhw|1I7>KNxKNlOTp<$!L(y*G9^nz$ zL=Yfx7I})iM1i8oq99SQC`1$`iWbcmEf6gfWr!AuGDV9;OGHaW%S73tRia!`o~T$< zA}SYEh$=-@qH0l-NG{qX+AZ26+AG>8+AlgFIw(3MIxIRa`cZU7bWwCkbW3zwbVqbo z^sDHx=!@v9=o=v*Fajq4AtXcuAt7i&nNT5A2`xgK7)$69dW0!qMtBllgf}sX@F9E& zKf<2~AOeXHVk!|uL=%Zb5;23ANz5W<6N`vUVl`1rln|vv8L@^~OROW-6EdQTXdoJi zCZdgKCpHsXh^@pnVlT0exIkPaE)kcBE5ude8gZQv-5_ofcV(-E1(L%GM-+ZgIIZxb z!Wo6L3Re`aD!fqmP2r`&?+ULJUMsv&c&qS-!aIeJq=3Xo1(GDiq%x^Os*-Bt2y!H8 zP1=wXNL$j5v?m=%N79L$NV<_e*Njc0r@le zkbF+QAm5O0$v-HT;$-JVIub+5h#E&3Q&!YO%9(PZTq!roo${apsmW9j6--4_F;pxS zM@^%qQ?sf0l!TH}kot~VMdeb3R54XTt)bRZM(VLI!Ya*j#DS7lhi5d zd+JB(0rfNWkotvsMEy!Vrk+qwsb|z@>I?Oi`Zkdk&=`%=fELm!v?{GetJ4~^COwiK zMeEV}vWl`X$!Ig97$asJGoG=-A;m2qRd7+=PZ@s}_`OfVC| zgfdf^C?=MPV^Ww@W;Qd2nah+iWy~68EwheU&&Zf^rh=(ts+ek~hN)#XFm+5b)53Hx z+n7FPJF|n?$?Rf|Fh`kV%yH&><_vR|xx`#%ZZY?m`^+!QBjzdd8}pKR!~Dto#S*Ln zOR^M8vl0zflO4utvD)kyR);lU$Fr8K6+4l2W?fh>)|>TXBiKlGDjUT{v#D$vo6b&S z=djuAcWe<`%9gR~*-EyS-M}`oP3%r~7rUF?!|rAGvHRHr>_PSrdyGBJo@XzxH`tr( z&+J3?7xoeRlzqc~V83yIQ;={Br^JalHBOz=;6`)$oC#;ajpuAQd(MG#=EAseE`p2X zrgBkSG#A6ga&cS|H=Ucy&EuAEOSxs-at?CeajUoju9z$5YB@Q#k?Z7oxUJkaZYOt! zJInpVo#W1P7r2YuCGIkJg}cGs=YHiLbH8)1IME00BlksCOS)n&WjD!U)vXZU4)K!^ ze+uzu5Pt#j-};tO(X{6_=?UpA=^Ka<5E~A$@euQdSRBL_LM#_z8z8m~Vy7T>8)9!D zPC|Sn#H}Ij2k}IRFNSy_#2fn5)ZQymozhYU0(_M{}U?>J#sQ0!r%QG50?5%xBlmDS+dix z5Iho35}0@5Q}HM~8jrza@i;slPrwtUebVjH9nziBUDDmsJ<`3>eVur+U>E-nPZ#VH z>_?w7rTY;W|L>sGSL%X3kM%<;FBW9W@g>p&Qqzn5P|Ibz4M!?T@$YyvC_N;{S4j`^ zXc~9{z8V>a7Ygo6k4Qb6@nVdW9+izT8l|}oFCQ>lhRi;r=AR{S7-2yI8C7o-=_c1da~Ruc~wn+!Sk6#fGb^}Y0p96v3+ zIso+(eu0NNhoG+UP!|!@bp)lRL)r}8cpbkrfOiw&-Q@8uBE0JZQF(wr=kb2VAL75@ zkMLjd$M_TcDgI1)TY5)&S9(u+U;04$v-F|#mrne}Al@tdHU0)gVLo2ghNwi+}Na6k#s0Y&LEIS@;q_tOD2 zpouI8>WJ3EP<8ut@ID+JL#X&_tFp2kJ7)SpE`lf02i>wZt!XY6Q!RAxxPuOd9^`II0)v; zgZW9n41opmV3P&=`Azy2UCVE#Vr~d497OV15fBr|!BmK0JXjEj1qnP@oZvphaGoqt z@DO4ErP}{ZH1VUMN2P-q1Gv+r{ty$P>;j2WR4M=u90%rsWjyeFumCIs8DJ5}1dG8E zuoPkn5F;T*L5zkN12Gn29K;kMrql_R50d8$2o^wyi3iXjrZym1h-vk+`+-uPy$oW? zL-6Z(`1L@>ZxB;~nCieDIe--tLw47KI^G4Skg3Z-J;XG47YqY((8{|2)f$Lt@-EoO zTRE&hx^H;Lsr3u|YOeL-mK)#tpHV_p|wcOFY|Uh#3sAUE|rVqrl!2?1z}4)CFQj{h=Kp z9yvsIANk(S7!5;%$Z+R|@ zzn$$5<6lA{&-Dp>24BEe@J%QXVnSR9AZ7_MD~MS`%m!i;AZ80OJBZms%%M{#8bB3N z1E@k2U&kR-mmyTofiMcS5UNlcVormo!jTA7I7&F0-yk*-V$K756h>vS?I5hsKxl+u zg@zDwl?%r~%#DW)7McmiBOIYQA4Yc+MxiCIWRHJQvNAp-389_PvEK(m2i^x>NXkM> zUdkRQwpzp8g#O3{LU*Bu&{OCo^cGGM`Uri6eh`}^+iyF}xKkJ~$QvvS5rztO3Bw>3 zJj9E>M?ox_PuiG4;zXV}31T5b#Hl=SnlPQ;AcjISWnhnpb;a}$@f_hio_H?A!sWvG z5R2f69fXU7OZvkrT+D|zk~e-CZ~WAMo6jbdyXj za)($sZ)c3iTjbksr^tu5vjW*E^5^ZW{HL9IUv%AU27Q__^w>~Qc)y@TVZ5Mf|9d}Q zED}U9qBNu^QLHFV6fa5;C5nb^{v;tyngCY~qXA@Le&{I^Ll@0}g2xb@L8s5w(goirPf&q7G4~Xp^W5Vto)p zBH95lB%)mq+YPZj5Zeo}eVwA7L5FM=Z9|oDmk3=n*eiqBA&4F4%OrBhiGGLph>q|M zISR3%zM1F*?~s$iG=78F!Tyxv_sAg=hU`8oI>)=?Cx{)Ei_Syr2(J%K(Phy!-W^wX zcO2#2ah-20WTTDLWj}kVYTXl|Ld?@X;Au~ynku@^SKMPfZJg+d=nYT%RP;>rT=YWp zo9LzJchM`+YlwXhu^%9I8e%^}>h+TphYFqd{Vg+J+kd{y*G!QMJ4za6pLK9-w5Uruc zaAFjqAx7}9*AXl+x*v9-vAQl*ICQH%fyyyLCJcGxTL_sL%_HCF4=`a)*dt`Zf*4O& z5>|vYVM9zHYzdT^cOZ5bV)r11o{n0spCN{X^$WxvbrKE($b_?KEa58HMWForbqM)c zf4ZYS9>fMZc|OEs9y$nOkB6W`dFUyE{X{rlE1vMR;%R@I881#4vO9)|s8`z_0YKYB;(Bwo5kJb!vOir{y9PdZ#Ai4(7HX$?|^>-c; zD2*X5lqm*|)ET>A)WSM);sp z6!s~g)=RFiAL3Kx3I`z`C0iF^sC87~M8887j`I$UMru$vg|vdl$Sy>T)A~t)9}o#% zE1c&Yneex>d`qBkP2mA@q{4ND8wxiSZYkVWxTA1a;hw^Mh$lfj8R97rPlb3I#M2=@ z4dT-wKBH6N=K)75{HpL+;R)hK!}pm(+;bql5aJm;*P?zdpFfc|72ZR9)}S{P{zBeV z_#`^XZxEl&m%jeJ)KnQ046>3qDMYL!fcRWFDT4SszVK<26v_6(k_-XLe-K50N2LVO9tmqL6Q#Fs;S z1;n!;o(=IFh_CD<#|^-eW&?dm(h}m5Ay_!rm&Eh?GewnjMy#X@#HE9*q&pgak5D0f zNq?ROO;UU(Cj%h9il-Sy29r~ey<`ZgY44Y?wkL?r@+kc{Q2 z3Q!2iFh0O}{iTgeA?NT^sbm_NPEI4IlQYPfVybR)NAifsj z>pID~gH#L2404fR7l|fL)(=rtK)e>>8~6~`4YXY(?Hem*iB>?*-iG4z2s(c3%Qlt2JuFSH$hwuaa3y5mk)O#g8)^b&3-L1$KMV1nS}1$UfpUa6s?p~m zenECHWsAg<^7*$beJMZww=Y2)#pa4sN7rqj^Ct)$6XCIV=A5*lUkahZ|Ly(=Dw3KC z@oNyj4)GiO{o;WKOmQ5OC>DFTPYsxwo)S4z_FJlwZ9J9yFVDb7QK?j#v=`#HAbwk_ zlPVaaj|;|Jq-F?|sF~EPzKLl&H6(W~3Z@F8s5#W!_@J=Ki!+l`=A?TiXC}9xL-Pc& zkwIbnUqjX|pq2{E+mK%}s6~`5wU}Dc@11)PN5$eNh(Cb%&uz#}%c&Jq7TTlAg`D*e z;=e%r*ZwaLr8ALPm*M1fG z-a(OjG+<#7wR*sq^k%9^Ha>f}q?9U4_>ax*85zmTTc}b&jUZP1tbd-7T1Q#R1u9bT zx4>3VRRZ(=gL0}G;?Jcz1D9_2@1+9=8YxSZxsM0_XclB|!p31**a%D+8;NOS>X;5D z8IFyW=1J3~v!xNzxzg#5#WJQ@aG_?bH@(E47X4qqb8!D3lPtLmZ{g zYlx$n;N?tTC14@myVX~U4yrp}y~Hh*b&a*9WC zhRiSLH+{{lEW7chW5(y0j>)pLvvDvTV`*vSkdreI$!RlY&YC+fLT}#U zIdc-lBkg33-;JOn6NADWtsN4@TC!jrt$B%J72d4*8M7BHNKQ>3urDN0td5R)4NgXT z&Yzc=F@MgS^o&cER@OEXY$Nqj=Oiy$6t%RU#?K2S^n&z^MKc#=qN!`YG_;#JZDx9g zloA6e+5dyKHWwWnohGhl)oc>Qqk_Uh{&RVRpZC1f`Dy8CQ_`oUXQacH`jtUA3 zPMMXSnt939&C=b=M~0=VX?S=_8L3jU_av!`R70wD$b?3r|e zu7hLf6eOy!)Qt4>d4b8x=P%A|4t3_Q4Ud>C6-$-Tb%}5S5ff_}7oQ-jg{~r1shU(> zb{D#jb8t*aMK=#PVesY@=S%3?^l1rFP3bVHdZL(*n9T1xbM#ZQ=ft7(nu!u&{=DRj z<;}C56UHyIo0e*mK7RZ(`w4dAWxq__ZA_5k~c3vdNoj2q(P za1-1Nx4|87FMKk3U%e1tfuklCFUPCU`{@m6D!d6zgSX;c=za7p{0@2({Q!_a9cZJe zS5sgOCICC&0Fuy)H>90tm29fj)JexNWKS0sw&!0ue-gW1s*52?5nk{XxB>{-oYhAE=MiUl7m` zFc1ufU@QdI5KMw#N*|MlVRj;#5twhJ30i?BX^KYIu@G<&C_8D~=x{oMj-;p3QFJr}x)A8eUKEaU=%!=oI69t=N8UgiiWZuz=KqGk z0)p`nSfc-V_n;kL&>r@GM}PMD7Fl5dOa4}5>E-l_CJ3zht391f=R}}1OwVklvjwq3 zyb}65fq646r6B}15KL&MSJAl;*h1hfJF(ivyofFnn77ia>0-KsE``7j0(%G?AaHCI z?5Ee#>*)1pybGKlmy-~KW*mjgB1TLf$ zsnP=iugmCycDjS^q&Eqs2(HlGGNlruaqj$S*Nf;}FTI)G5{;U#MVT2h=S_#eEo|R;xoiUNr z8lRAmD0`5qD*Luh6%5vTTr8B0S-;P^0xc@p2d@2}GLZbgWdPh5p!=DAm?$=oNo49W z9hoZm3;jqCJ9Hpaw$kk}{StL3=qL13`WgKkDegB2!XOBT=xq#$>{r^BIx3<9Ll7zkn^h=U-0BLh%RQ=cIi z1qc#QV~XxggZV1V`T(44T1#_q(d-2 zQEVv-t=EuktJHBbMq?GmgfV5z7;^}aTxLNq2ZFh%_rO>(R_ICAg8j^dnEy715q|U1 z(oyM~!Ap3iOts1%*fS2Yq$(ZYD2PR$qy2_%od{&i1PIV5Rux?u6+R;)JvnWR_0VZ$ z{>g~7|3O0sy$24?8+iJQDq9f11j_WQ&9KR`uJ;Vn{pB2Ci-!x>|j> zRG=h~U?-VZf+^B`2s)&K0nWF~A2QR1Vc0vFcf%OB_soa?X}_3HtN@ie<}>q!`O18Q zpbG-z_Z|p(TUm_7364dL)n*9L?Du5|4#+k(xM?%27~R9NEXOLcsCh<#*$Tln2>N8- z8rCZhXGfxlvnWk>$k|a4>_ibC?!t~mA!l`2JqUI|fQF_+LqFD#HTjoFvZjJvEK1bf zd?feCJ~fWevu5r7?LvEjKI;g*F)I^xrgm^L3Rr}gPqBuB6AvoXAr!TnqFt;vh&#a z>;i!jyO7Ob7qOY_Vs;6;lwHOy$40POvL5*s$xjfyaRpZ(_z{Aq5Im92hT!kTj?H0L z4oUD51ZM^$D0S(tknAd?LN=GpWAoVp2+l%q4ubO#T=9j&qP4Wj-yV(g$l5 zD`&eHzBwM!EFfcKybH{?dE$sNE2H` zV@0~?b2|k02B&ZMcg^3yct>@D_g|11uB2hHMu zU;lghA5%YxVl&x!T31%w!b%Lx{_Awd%;ZJ09n)r}dCs4^U`~1_8q{UZ@XpAXpW)b_ z!|bo@V>Dtz13d4vnVIu5e9^dVe#UaY%=Ed<>=V9u|JQT>kQ;NGeJ+^7{)Xfx`5ha_ zqGmx3!CSsV^}Jtee@OHGkJjF@e++5u4FoU#S8E@6t^LJ*Vn4HAAVB?ymk|68!K?ph zjrre-_csaI@Dd!Tb$>hhkAoaLAgtH_5tihibuLk?v|w?{oSCWSsb(`!vzwlQ#>oGf zuSs8;h~{lV%xC<=9h@e+nA764*<~D>W#GN>u|M^`LhvW=4xx%P;(y)2jo~CZL;gU> z@BhaioB>LD&X6q8&DWao=(SGt8ZfM~TKI zKp{1lXk0Rq1;4)Tf7jRznKpx)g_4Y$35ATDn+=65pJWnlK9|v-WZXiOWI_&Q5n5sw z`Y%iDblvm@IzHlYLyug+<@9GDmyI$|sQmxFH_9w6J$cTY`KkT2lFLQS0+$DcYLG$m zPF$fti7Vn(%R)LvO4Oln{67T4=MPuLtznljxBr_yP&f(-HTv^M{(tj_tKcdJ^&%Vz zg_{4Xmkr2KTpd@>HE@kkI1CE4AXO%7&$z-JVWf_=Ys@zpxG}oYT+>mH)_D`>K54eZCI(~*i z6FK(_6q@#zVD1U`d_Wz~cy*Ye2&3tB^s=CrFTvW}Yi?li5XUbb67q|OhE6whX^#4f z`!p~;_CM7#EHgQEb~E=`cB#u#a*{mLzv%h}T5SCR&8dGzljQ(SlapwQdlD6fmQ&B5 zX7Tg0)B-dSn@KI9mZ8PerD!qrda8n|rZ)61r*5U%r~_yo9ezn~W9$&tn&$jzcEuG(dJ0YUK;ivfyI0F!%ubg45>wxD2iYt;p@= zHgj9hdfa_z74CKJ5%&^#=q>k7kx&#XYAYHj8Yvnpnkt$rLdDgJRf=_rk_N>l#f^&X zik*sGihYWE70)U@R(z!-R?<|mQ<|(4sg$6Us=jRmxW?QYuy|RjO60 zQ)*CZ66=V~(HdG$vA5Vq>?aNoPZkG@L&ag@Y2q2;S>ie3dEy1)3~{D-iFlcKg}6$* zQ+!kWS$T}|B;{GkMamr#<*mxwm3J!dRz9M9TKSCfPs-<&FDhSFzN&m(`G)eZ%1@P_ zE5B5JrTj)kNo9nJj*6~|zKXGmsfxMEc$JAN0V?4t5h_zvVpLL9W~eMwS*fy0B~PV5 zr9`DnWv$A3m1>oCmF+6KRQ9OsS2?J1SmmtBIh6}4msCkrb=6_2+NvW}C8Je!RGn2P zsrsn;sYa@ns;*I8rz%seP_0s}QQe?guiB_8S8Y+4%J<% zdsO$S9#B1`dPMbu>R+m#RllkU)NnPSnt~dw#;J+bRMj-pwA4nZjaD10rmtqCW};@U zW~pYQW~b(;=B(zX=Ajm>7AjE-Q;SgBs&-KAu-Z|zz>vNt(RJ_wBBf2X}fB>YkO*YYwy&S9Me9b zeM;kv`e54Rd_Gu(E#e0cBhEyK4B-#)@>gzE_R5uPKwM{F3;F=Eq*?h(BsMI%*4 zs*ThbIc#L!$n_)3M^=uk9{Kyo&m+H%5{$w}C5@UpYW}E&qZW;}7(H>c%V@XJ9;1(r zJ~#Tp=u4xojBy_mG$v%slriBtoQ}562%S+nV+IFpuX9l6u+CAP z<2omGZs^?7xubJW=Yh^coku#4b)M=x*ZFNMJ$BsK$z$h_m5tpq_RiSPy2Ew#bPaXK z>6+-;=sN4V>bmQC>U!(?=!WY~)s5DT(@oG#(#_Fbt-D5dovuu`TDMlWPPaj~M|X?v z9^I3=Kk7=(>YmfRtb0}Wy6#Qgr@DXYQF@FXr>CT+tf#7{uBWM|r8iv9TyMOdm7a~B zt)9J}quxY47dqtz#zjQ(_o1~kwLLRslgh9bp|qn3WF+x z8iNf6^#*$lZWw$q9Bt@nIMcAyu-ouQ!^?)(3~w0TGW^BxH^bizUmLzPd}sLHNNA*B zL>aM0ibi51iJ6h3k*krrk*ATbk-t%(QIJu*QIgSIqYR@=qa{XJMma_jBWSeNsNQIc z(Ke&)Mmvpm8|^jPZ*Dp#_5mq8#jC0 znsGbE-5B@5Skrinv97Vcv7zyJV+Ug=V`pPmV|QauV{c<0iLsw?q;a%ytZ{;Il5vW$ z#JI$Gow3Zg!noGB&bYz2$#}EzHseFa$Bj=Ke{X!&_?+ zVNDcG#3m{xY9@vz<4jCU%uFmyEKRIUCYacnIG8w@M42o#*klb9Epx0|0dKWBc?{IdB~ z^Lyq`%%7RRFn?+O%KVM_9~PK}&_cn2w%{z3EKDsNEL<$yEj%rJEdneiTLfDqSR`4@ zwaBo@v{-79ZL!heeZi{^u2Q7|R9Je@SaoXan#eIv17LP0*TRgRR zVe!)9mBky2cNXu*OVq|&kDoez`S|+r$HqUlBrNqU%`Gi0Z7gjqT`her11y6qLoLHC zBQ2vWV=Sjz&a#|qxxjLfRghJP#45}x!fL8jv{jr{ zf>oAPt<^!R`_@8hW9uO6xz;7t71q_(8?5WC+pITRZ?oQRy~}!!^*-wZ)`zUmSf8`L zXnn={y7f)#_clTs%7(E~v{AKDw;5)mZ8Ofs)W*Ta#m3FX)5h1v-)6E+uuX!^Y@3xf z&?eWWz-F~gsm)p&nT@2cKwjF6Z#&)c&o~?ncwXLnKgY86HS6g@61l!rR z3v3tJF1B4^n`0}ng|=&LWwuSW8*STdH`#8s-D{RVE?1tHC+l{arZ8z3V-_Fp^*v{0>&u)fYiCwSVMY|97BkY~*W9(Dy zr`gZ6pKYIMpJOkzUuBcOAMHOoh#V9g)Eu-NhC4_`Ip{j*I~X|_J2*H@a)@?_b4YYZaY%QV;V|1_p2I?i zOosx8)ea>NWe#f{WDb=MH4Ymb8XTG&4mjL)6gZA`oa8viajoNK$DbUpIo@=<<9N^U ziQ{X>KOEmX{^j_^@tYIor0AsVq~@gQr0q1q$-!xoQ-ITCrx2$Ir>RacPH_^a*-rDE zmOAA+6*(04oIo)-7;Pi{rd#AsgK0AG# zD3}N)iY6*dq$aWx6(^cZ^q)9y;@XMZC*GX+)p?}zL}zbjU*`bl$WQc-r+3S?Y!6dkn>UJHN|8lMC&l>0<0+<}%*J+Qrtz!DXV0tBZ$=w@Z{utV_I0qD!(%n#**TSuS&2=DRF( zDRb#@x#05FRnyhkH5t8yX>{#y?Q-pP-Qv2(^{DF!*Y90_bp6Toyz52R%dQVxe{p>* zaee0co9pjxteckGD7P_gx^6~p#%^YA7H%$X?r#2Wfo{=m32sSlsctjeX1UFEoA0*L zt=O%>P43p}*6y~+t;cPPTc6ubw>@rW+|IdOaJ%Go#qGM=Ew{UF_uU@4J#xq0b=6J9@ji>d))PS;PKGojmI}n6;E}~ zVV=W1M|tXa>UkP^8he^~x_NqfdVBhK`gsO=276BN4ELPs8SS~mv%+(a=Pl1~Uiw~s zUNa$KNduk&7)ysmh?@%rX1^j7eu zycNBby;Z%{z4g2ey~leydwY0$dHZ+=dIx!jdWU(Zc+dC#&O6V$(7V{X%zK@8xp$R! zt#`fm7Vkdq9p1aV_jvF3KInbe`>6K`?^E8tOp<^}hLijz&7CBhv}@AUN$)0o^}&3E zK7@~w&oH0iKBIheeDr(_e2jdIee8T3eVl#Vd^~-;eNuep`(*ko^;zz-(g*si^2zfl z_o?z}_38BK^6B;I^V#9E+h?!O4?b6Yp8CA-`Q7J@&pV$FKA(KP`eMF9Urk?a-x0o} ze8>3eN_-7`$N8H0n){CTo$NcucdhR>->bf#{l@sY`X%^H_nYN6*KfYxGC$~->zD6W zbJ&konM2W+^^NI-EWg$x8DzbSN(4J-SNBc_sH+D-!s1#exLll`V0Iye-(c< ze@*`p{-gYL{B`}U{9XO0_(%9h`N#Sv_$T|P`A_$k%<`Y>FZEyLpXXoTU*uonzs7&P zf4P5^e~tf6|116<1BM5<2BZfR1#|?Q3OFBdDd1|r^?(Nf&jNl6copzA;Lm^$0e=O2 z4x|FvK&3#HK=nY)K$}4Kz)69=fdPRbfl~q_0;dK}3!E945hw}F4a^TL3M>m;8z>8` z2y6}98hBh1cq;I8;Mu_QftLcW2Hps~9e6MBP2ju0_kkY+KLviBj7=6!CMHvpnaM_z zeJ0PITsnE{T}51JV?J7`%@R?x~I7?c~7 zAJh`GC1^*`?x4Lvhk}j<9S=GgbS3C|(1W0tL2rZJ1$_vTdz2ML0!wiqDjpQ%a}wO}RGZ&oK3{ zQDHh^dSM1(7Gd^bPGK%#?qObGlfrz%BEq7=V#5-`lEYHNq+z9DlJ#NbVO3#uVGUvO zu$HiGVLQSOh8+$&8+I}5a@e)7+hKRZ9)vv%dlU98TqRsRd|3GK@KND9;d6MifFTZDduU&M@vf{3*dvWUuv>Iiwn zrih-1EfIYYJ0o^S?2R}ji8vi`HsXB5rHCsLZz8@$3L}X~DpE009H|QfFu2CLQ-ci0${!!DTGNYD9Wks!wS{0QSRT#B8swS!~YGYJ;)b^-7QTw6} zMjeYf5%qo4>8Kk~zeatG`W*Ew8jlu5lhI7HVzhF!TC`!bakOc)dGz>b>*xv5cF_*e z6Qfjk7scks7R46Fmd37$T_0N!TOC^)TOZpPyFd0;tmU^jojC8f z*>P*)dgIQBpe?IqIr}!`N z-x9C{VFHmrCeR67f>MHMLO{a&gmno!5^g1YOB|KxoH!}bFEKDNC~<0HQesMCTH>_C z8HuwJmnN=A%t@3cu1d^HY);&qxIJ;FBymsT!NkLf#}ZE@UQWE0_)Fr`#OH}G6W=Dj zOZ<@dR}z(^k))M0B58Ee*d)Cqt0eEFDM{0lW+lx{T9C9TX-U%Zr0gU~(sxODNwrD! zNli)3Nv%okNt=>-lC~uECGAMsm2@QOdeXzB&&f*32FXszA;~k6VRBV+XY#(}&nX}! zfKE|Q8JjXL#Wckt#VW-iWnzkJibsl9%F>keDP1YsQx2sZO*xVBeaeq1Kc!qqxtsDR zKRuP;j{5Si#AH9}0dfcvbMakSf$D)G8cNIJ$6bp`obfHPm5HGY>OljMJYvDMJtP7QEpK|(dweo zqP0b`qROJ0qPn8SqTNONiVhYXDLP(svgn7RAB)ZwoiDmrbfxHe(aoZ#tFhJUt1VXh zuTEbLS2wNRy!zPc>#JWB3yZm8#bV`R?c(9ZqlyiS&5EsxU5mYneTw~ygNvsWM-)#j zUQ`T=%ZjUtYbC|?#ZAR6#ofid#aoNF7w;dZ+Y$>C@5|rN5WHDV4k{eP55jl~t{+s;}y(>aE&Z)mOE% z>aS{0J+|7gdQx>*b!2sPbzF6Nbw>5#>ZR2ystc-DSC>?;soq&FIaK|9_1o$XHM%w9 zYkX@$YZ7XbYtm|_*UYM!Q?s_Frlz*0zNW3FuV!b>o|^qN2Wt-3+^u3Jy(07_R#o~Vcew6Y-O0Ki>dx0)s=HEmz3yh+ zle%~HWW7rL@Oq2KNTfhLDD^hRBBKhQ$rvHRLrEG^}o@ zZ`jn()3CW=Tf?D-qYcL!PBq+Yc--)`;YGvChWCwJqe`Pu}cH4c(CzE%Mn%gwLX;o86)4HbermCjeruL@Zrmaoen|3uFY&z0(tm$Oa z_e~d?ZZ5r!OO<(1h9LNbdDOZsXmmA4V@*H`-yhvUmUn5^HFPC@756Vx=ugHIvKb60b|1N(c|0w?~|JIB*3!Al? zO`BbseVT)sLz}~!r#447uV}7p-rIbp`C0SV7P`f##iYf&#j?ew#jeG%WnznKOL)uF zmYA0KmZX-Hmf0v>>N~?OSW~+6pTWeTrWNUP5Tx()$N^5%SjMmw$^IBnRZfkyPVe9JF z($=-Dvet^$>ekxUU9DGJ|JpcWqua)58&_}a-1z;*3mY$QyteVi#-BGn-}rK)+SoRwHkCHDHp@1bHqSQiHs7|%ZNY6*+QQpX+ZMDfZd=;6qD|5U+j86T z+bY^lw7qP5->%rM+HTw)&>qwt+8)*(*&f{<*PhUx+`goJd3$!dr2V`0-1gG;%J!P} zy7tEQ=JwY1t?k>}ceU?rKh=J^{fwmjT>I_zd+iU}e`$Z+{zv`duQ@0`&&yHhf+ zb75y@XF=!c&XUfu&b6Jg&dSc3&JCRnolTtwI&W_hY#O_1(xy3^)^6Io>8DNCHr?EG zXVbk+Pd2^Y^mfy`P472--1Mo7>|(kUyOg`sx-`11yWG0GyL`I*yMntyyTZC6y3)Gl zcFpg~?t)#by7Iegw#;*0n>@wYzIy*YU1L$9WZnj&gTcumQ zdsw%2_sDLm?g`!Y-A>&u-EQ4}-BY?Fx}&;dyA!&Ty61K;=w8&lqeWm+a_s#Cx-A}tecYo`_dqh2C57VRAquis`quFEJW7cEQ zBeCqU?y>E$?{Vyz*yGyc-jmRi($U6+>7C!ZtT(H7Wv{fisCRvDd2eNJ zb#HBNU2kV^ckkxjZM{2sclBQGebD=B?~~r=y{~%T^uFtTznR#qx_Q`U?ad=MkKL@d j*>Ll?&Gwt!H%D(y*t}$LMI}D)slt67_%gKLT=@S1(k$`= delta 19002 zcma*O1zc3w|NlSto|((7fq@|e1Cd6$B&171QbI!7PDEW7aOMcoSc8<*&?DB`-R;`l zovUl>+P`y&{p{zv-~adVU-sUqd(VA8-|yFXpR}zSd{_*YrecGBON+)NF1RP|g$Lq6 zcrYGAh*WhdNwfF=0+Wf(M1HK{Oh;Pof z;5+ag`6Kuqd{2H1Kb9ZIAIp#DC-4*bN&IpAWPUn-GJgtxDnE-qTP6a=f{py`{2j89 zAXwrp@DT(HLIk4)p@J|$tRPM>T`)s1Q!q=AC73P97R(XM70eUl2o?(R1qFgqL76}% zs1&RaR0$ddO@hsWErP9rZG!EB9fF;LU4q?$J%R&*n`&?fYVVT3+0oG>T62_M3j@FV<*0Adso zNCXkVL>Li6#1e7DI3k&tKujbi5tE55Vm47iloDk`IZ;6@CYBIOiDkrcqKarB8i_Wd zomfMxCDsw^iQkCr#17&tagI1oTp%tImx#;672+x(xJKL}9?DAjMUtIL`;`tTolrWd z^t;k2rPE56m98kgRQgltmC|daH%f1n-YLCT`k?et=?jUGI7yNesY^$u#m8az6PhnM3B1dE^38LP|+U zE+Wgx3Quw|SxK%S8^}hoiEJk2q=H;U?j!e;2grluA@VSJggi)B)-sb%;7l9ifg= z$Ef4f3F;K}fO<$hq8?LEsHfC3>N)iX^@93A{Txa2XpF{bK=WwD1L+_-m=2*w)1k7}gtlZZJ&*pC&ZDJtFb@WQQp6;U8(HrTl^iFygy_?=oAD~auXXvx^Ir=<(nZ82bqHojp=?C;v`Y-x3 z{e}KYf1|%M48t-)MwwAzM2se*#SCDynL*4@#*7)x*fLIxGvmg1G2VbrOYyBIU{2#nH5YGQ_a*cwM-qelBs7Jm`0|J zX=he3o0!ea7G^86joHo|WDYThnIp^z<}`DLxx`#%ZZdb7d(0!|G4q`HgL%cgV?MEf z<+B2oU?obdm{n&rSWQ-o9n214^;rwnlC@%;Sr^uo^RehV#l!2Yz&*irm|^l zIy;G-&q~-rwv;Vnm#{Lnnyq2$*#@?eZDL#5)$9g#8@r3$#~xx2v&Y#J>;?83dxw3% zK4hP=FW8st8=;br6jDMuPRIyZp-`wSR1u1V>cW9SJ>f8+nQ*w!Txc(J5IPIpg#N-1 zVWcod7%v%o<_L3zdBO!kiBKwp!iB;@VTDj8tQ6J@8-(q`4&f@<5z+&D zEhDHh@kWSmf%q|q{{itA5dRb6uQs+(V`-m_(j(HF(svM3g4iI4*+9%6Vu=u&1+fB% z)j@1M#EwAh2E^V#TnXZXA#MlpK!~S6d@jUGAl|&uQ~i?)wMx29x?bub{cYoZdk0K5 z$56|Hw+pw&9i*L7cWIYYAvG7-h(?RB3p^oDnWuug;%+=mIX+U_EyvxZt7WO)MlrZI z?#I(?;oZf3r9RR%ExZSKfYeXARvIuaV@CR%X_?crLo%mN$eyT5ZPNF&=k@$2vgj`| z6p!HUeuIZggQOe&zFT(AOgk(VPvu!E@Hl)d9*-yBiFgt|4o}8Yq?@FhrCX$1rQ4+2 zr8}fMrMnb(8gDE2hmYs&68TYqWIttNvNDuW;y5neGUkW2E$;>^B>A z**FtgYdOB67pW2<9d1Esuv{8}e&>)@;_Vz#J>Gyf;!SunF2`H&R=iDmRC-K$TzW!! zQu@2}l=QUpi~{fILt52`v{rhy59v}L()AuBUwj9Lv{QPnA88Ll!uR6)&~ZR|UU~r? z7f~$LMFT~{`@xRkCpfU<(#vxEr1VNJ*ctph2X+>LUFE;?yR0fAlX0lSaC;J_Z>5AjF%WBdvJ6n}<4$N!MtlHQiyk=~Wwlirs;kUo??Qs6K9 zz~10*@pmXzAEb}_z@AHANnfM)Z+gJI0fxW;E`8Dm1_THU5I~7Lq)(;KdJc1uKxEs8 z1(bmZVF4BCA9A27ebIvjG{694IM75`FA)~dMp%DxSj#Omwe)~N4;9cyRBsU#&_+~$ z%Al2Ygc-0$RA4wT2Nu8*SOIHb18jkv^u6?h^rQ5X^e^dW=@;o&={E&%=%oVA*fmap zz)kwSmkMG$X$>bqhza_*0y(ZA>5qP{(HvJOZx?q+f1+!-!(1fnr-}x#990a&Fgb{W z7|wAG0Er-(<4WS)g&5$#Qg{y_#+L?uFrNdP z31)#TFdJlpIbbfB2Y!JV2{8&{G{hK)u@DnNOc`P-5ECiDuYH6IdIbpF3t|ffG0H$CcR)-GG4(HN44oSxrqxT@0@^v! zR*rN4N7}&|s*PeeWWZ{$u9tKzM>>#;V23mUVlpgDTN`W!dpXiAU@O=Lwu2pDC)fpc zgFUiAwgZMk%uoUL^z(L)I*l;;`2r+XGN(Vdze{hE11<$2E5VPP6f5{ncDU*APWy9?$ z?YH1VFWP$!&H5i#pdb$T$`^2G-@te91N`Lk_!uAO13rqdJ%{F^;1j)Qe7YBnk3#9% zkLJ;j=8MoAu~9mRj6V=!Bm2nsLl7BXmp_y{Am#=!gvOmwz*I$!eQbPVzA0kkn?TG{ z&NqXYS5LtBmV6szIp2y4m^TU--@m1EoA6gcYJ0La@Vv~B$$bMR+-T$af z{4JdQn;|wu&ff~Lshs^`{GI$gz4q_s?4QP2u#dBU`oHZ5UHxSp<{#@d`zUAj%>UfP znZ0qnYZsXIvpkb zrG^WlddwF@a^~0m=YH8eZ|#9&1?fnCf_OoKAW@Jc7$-;;qzF<4X%Jf}YxEpost{!K zicK&Pe=C^G+bWm}v9|u;bV*-9Yz>FFwg)j#@C#C#U_Qj!`_v}LMQRh|2^Me%#5y3> z*?UIdV$t}1BNqvZIP^k@Ddd7;h^^w#waW!ddeIki=-r&@%Q*DaC}*hai%k3Pt`^kw zBGz(<>;7>aLQHBFtl|*mf)+umpiR&&=n!-Yx&+Aozd>vR#5O`~6U2~Iwm=L?WgEn{ zD+Jwr)awN6QNr6QKo{-kr``jxgIxAQ*uDL%K*3%P8`Y+r{n!UN>_dXX+yOD9jNQFw zgzX^G?>GE+!D$Zr6vXz*1!o|(kHglwAh?Wh1Q)q;%M4LhN^l zp@*J^*cpZ3Z6E5#-r6Vl04L@g)cZN+?0Bzxzed2$Wz5mOCJJ9%2`I z&j=KV@IFvNOlTlb0=0sdMj%qclCUDI2^+$eup{gV2f`6zHz9TlVz(i72V$t$dk{lS z(F2G*R1i+Rq{K*k2;t7#N_ax-QGZaMN!LN_PcEjfdQbz15DpdP+{b+}CBiw>2;MFt zimU2RxT^lNr}aw`jq3*;OC)fh@eq41ClVp{2M4M{q!8&G%v~alQ}PQACX<7CDSI9` zM0*M`y%%*Fhx+;-zarG6Y+?b2I)|7`%p-mw<`cgXIYcgz2eG#hdk3-i5c>eJj}ZF= zvA-bp8Dd`)grpBOpC}*}A=Dy>eeFm60dW9vK4Qgt`)K}zjAN~Y*tdSxYQ)N4jT(v7 z1j@z}Io62~`;MY&-H+Nt$T`$zi2alkEfD8%sPRMxq2OZLiDHUlTufJ?#t_HRFzH`| zB)Ur9)3q;O@%xM2Ky2=H#wO$poa@UGt5BuKaW3vjJBh=bGjK4+XDP6`eoXPkz3e_syQfVd8-nw&ER_5|LF zxXwA_2E_Y&bHr^f@OOy2#2tW!m|}>lqciG|n~MTOq-;v)pPKj(B{6TS5-QBN&&&95 z>AHAAJ91Yti_k&M^coxKGb70v$V55{iA&)Bk z1@S3;@>2SWJgW3faELn~j+&HRy=SSpD#q($B>^cwtRx@e)8!-q@fkgJiKIzk4=l-Y zuv~jgs&E3CB`c0I*48Aodtk`{9PFHb{EAv@ZBmysMYQBlQjZ))>XQbfA!$S!lP0on zai|-KOBAG8FB)mt+l?e`AujDlTiDl)#EW{syhwKhMj}wy2S$1$u>a2iHW^3;b419n zd^s5c@q(T-NQRSK6HP{NRb~;YGUOPP2Ju4F;nx^;y5Ae|WKu6!A_rECqDYS6VqC~| zL&lNmZ3f_QJpHV(JxAHVj* zv76k?;jSjvkZZ|xBr< zD7$vblCq+#DH{salT#4C2yx_$n-E9&<5`~oC6@CJ+KRrK#Y>0@jp9D_+dZ55m1o(3JT!-zOF2=$Q1g5IbRXgmkgFj65aN$IC>Pv; z%A*$G4rl~{pF<-E{4vCzqNz)TR4-XHEYR1_D?NMC+)3Hv`l@k151AhM%{V}@h81DmQm%s=47@|WwI%`10_qSrQ`m#+AAw7b$%XVmS#$mq>H3eq!Xmmq?4rcr2R9M)Nj;wo@FPs zf!auIqBc`osIAmCh`)h2svhqk{vP5VApQ~JpE{BBccNoAx?(TSkdyph-05@A&tEo9 z&jXk&eBlsbZ}?79)525*z8k9+1Y<4(NJ@%RQl6AARZ^9zNCi?Y5l_|O#X6C;so8LI z3rj0&S1)g$z|o;$(J`^{Zn>jUeLTYxV z0o?> zi|iUXP}9LtN=n%lCud}bSgLtpq??_)ho{U7+6X8qEoEf$po6EcpMOBSLHg9x*|Vpo zPRoqzeVaKO#WE^AD>HL?Nb39WM`lQ5guU| z88t>mFZ2+Iq^eRiS?EG9Ghe^Bv8a^TNz*fC%yAT#?~3Vw;pP1ZSU0cN#>A0Mk2u$VH>dR*iq~z4)B5aFx(7@eHZu|gR)4hylW}o73&}!}%w37P+7^0a>XAq61{pN!lkOvyj zwAcZ(ym}Gb0Jp#$a1VS#tEf6?hR2NW+*_}4Ow#*?m)ZB)_ri~d_}%`Rdz!k68Y1cp zb(T6uou@8P7pY6sW$FsVze4;Q#J@uv^|yaQz=HsT0EYl5c!tz<>IQX_x<%cl?jUvE zlPW{NhhPo_b0L@y!LJbHN<9Ds5?N!xy3sGG51icpq+U_4sW;SH>K*kS0s#aBL_JbK zLO?-4L%?)WAE{5&U({#n3-y)y1_29!5Q4!F7(n0v!6*pEY^+;^VI!1iAYU8kUbDv_vGqBK)}!@NUZ96TfNnunXi4?P#?Hu^GJ9rf`rj9s&}Q64 zrVtE})59UqmK`q|HQ9!?`_FUiAs8eL=r45y?ZmTeZkFoxf8k1daXcewH`<-{pgkcN z0)Z|BLm|+EU|2i#hW0_uc}2bL@t1y&Ymob>p42I`Db$oLEB<{*7@f$oTuq155p*OS zMUSDQ=@>eej-$uY@pOU=mJD%+zzPEE)pQa)j!veNk(1DYX78whM6utWcI zUPCAJr|5Z$K5e{OVv7a;@{b%y=g_&$5ZL!5V|oECiAL2mGrNUez)R?-gLDDUvV~qq z=R@EK!H5=m5nTv@69fUW=rViDGI}Y`vW+gME9k}a5(u0jaDl)Tf{~~O^` z=x%y7FOqkOUMp)VH!=0$e)c+#ep^rfMsFC4T9?_`S(BzufWSLy+T3ZqG@Iznve)J6 zTAS!CyabeVqIxdr{cRh)T{f^n2iqZYtZ)N+=)JP~3O&$5?~~P4m|GpBk8wnY=)?38 z`X~f}5ClOG3_(a6eVjf)pQMjNFdBkT2*S`C*@ucr-~xS7mb%zf^(uXx)6F#q!sYZ0 z2qI)F7wZY`(0A#3vi*y7$tVaS!&LcQ8=o#t2E@`ICtj-i%0@3Y6AWxk8ka27%Mizcs=QH{>YU1hV z^dIyK`Xy4>D+r`MK^6o^0kdQyt6eOLY)%VO(X#HM*dM z87VWY(GTdo(H&GWBOsWDCR@>kabqTCWu|5fwd*fe%$17}dy47*GNAX%nZ0E%sc{6O znNZoW8Vf8;_OT{ibqs_0j&cUYWS*QsG5JL{xz=1ip|_^$d(P^OZ(ogMl9^QQ>J$ia zWZP>kMB|xBsD?5V803UJ2o}gb){Z7-G7_HUTG{Bj0emKpSslj(wBIRrKT>7p^+3|c&DWmYq5n6(hdAX=LOD_WWL zNHH5AsN&R8ExTGDY_Nktvkd>fa4#}+KLoX$GV5dk4SLK`<``NkcjjGUj>~2@m_{}9 zXrDRB{GJdR)f3F{)a;2Z%qd>NKfj0%o0&O1aQc|kwAueq6LXe1htzZd&8`7tyu3$E z&9YYwE}>U=xvk7q<{EPy0>s${(W=+qD!N6mT(n!cxkoVNziVxO@bC8qzr8p3dKv2K zeG+`q`vckpz$s2ILqn$AMOZd6FL{wt)D|nGyk4Z&%$sD9*f(a3Z~sF7jPz8lchkbW zm5G{$dcJ2+8~u+KiTR89jxreYnfbzeWl&SR8iF+tAjhw3V}39{36{kmSPuc3c}8~c zkrsb*wSRE8^RvUsXa&{mDTT#3RN?2VK zaCRuG2f;Q7cK#>etO0BCzr>L>4*_Z)jzMs|l}+p!8-Wwtm`H}VcsruSu2wda9nYeybP@v8B;1#pUu7q=Q`o8O zG@c4Oot?qXWM{Eiyht{iox{$>2C=`$er;JVIRn8Zu95p4f~yc*kxqf&@;}td{>tX` ztMwuTr+U>Yb?-@-tQ6%w7P1T3e6|3B(-546;2Z?!|5hzKt5>yX)}K>tvPje0D>^bH zDs%R1B&zVN8M1XcqsvGdEAlszMB)TG(yJU=iy zb6N}AB2(=gDES|bWN!61vJ*K{f$6a*mACeJ5mj8|#d}iJ#r-cYu3^{qd+{zr^Q2r0 z(%kRGja>9Lv76Z~5Zr{|76iBdb|Ax5d;9;?`~TA|`+MDT=fB({`DZOhl{+nS{EV#3 zNnueYsWF*ZTo_FMt(22&7JG_4jQ~$#gE_#*2oQolAb8M2_*gpae-K_|FZB~XhiFCo zZ^Ef)n-Pm9n_Jl%>`fNIJ%Zo~1W*4)WKR-{xM-qLKEFpJBCeMD%$S~?HDl`3%q+`k z|0ndbUg&544PDx!h3P$7=&$E**>7kN!@gtRvme-x>?igw_A~p1{R+Vg2wp<)Cj_Xs z@*09S5WI!p9R%+c?DyW;H6bR%d1rWAg#rjZ^v$k;PY`^Sx^emC8`r)VH7=pj#LR|65At>XB_OVb2t9>f>>TFS ze`*NilaP;^15`y?|7R5u1_(#>35c%*`S{-gis!a;3DI_%R$-_xOc)ON0P^{eFZf$P zJ$2;&UlkE1^r(eT{I^>ESw;HPBFqp@M`{sf3daj42qy|B2`3Au2&W3CK|TffG~_do z&qBTsq8%7~704GszN$hvqfaffdl#gH^B`ZXPc3})zZazV1O8hs8_(DqW4^+CPAvtH zFYZ@M5mL+lx;)iy<6_}bPB2R#Uqdcj2KkyjGws3^!WtBHVHKKb=WF#WPH{8sIGSlk zU49cKdtsvxEoz}@XJIpv1z#J<0AVqj}GfXdA94+Jfs#`BS5)AS#4Prc$YN zYCPJ0I~7e3W}$h&U#MTvrrWjDPU<|`H>*Y4)BbcSokq`~e?hxpbJ0Liigv@6p%LE_ zdKntvonmOl9&JmVC1J9exy*bf2X#41(Z1A1rkQC$yHG!|Jk+UBXLVRz)`WFnJ<-Nd zU$k{}6l!&&*;v$)Ca_6tGTJ`63~dYjQ#csy>P!*NK|43|g#~E$<`T4PbG2~0@PP2J z@Tl;(@VfA!@K50v;WyzAWu7vw9IZS~d5ZE(Wl5HDw(@-C9OXP^iE@$hVr9AVPUS<& z50(E=VN~=~%v5YuMyU9z_^J4-j8chKiBpMJNm5BxNmZGyGE*f>C0pf#2p4IHv_#ry z3*TUoF4~u(FESJvi(Et_MeZU`k+;ZKv!eH^I;!rfNvgRL z)kUhss->#ssw-3*Rhv~?RNGWLRJ&AHsjgOCqq;+Nx9VQi1FDBqkElLSeXaUI^^@vn z)gNj+HC&CaCQ{Q?Gf^{D8?I)lHbQNrnx9&vTCCbwwFI>kwKTO1wef0G)pFE|)ymW= z)Rw9(SF2Q$tF@}Nt97c~RC}iOLhVnrH)@i1Y9GX^Vjb~7@nEr;I8~f3&J<4&PZCcN zPZQ4&&l1lT&k@fP&ll&2^TZM{6z7WJs+L{A32W#qTHfXNWT&=lQbG??H zmZg@pmaUe()_SeoT6?wjYaJXgc!1de^8uCvtOu+fuzkSJ0lNq6)i&35)^^o))ArEb zsJ&17fc7EnBRYhRSVu!gOGjI$R7X;+Q>(L5r$Oh_K>k2tAUTj8IA`F(fdvB#2Nn+^ z28jo04AL5;J!rdnzB)+^O3*ITT&RByRnrCya@jb5GJ8ohOTzv*q%+pM=$Z@b=3z1@0y_4e!C z*84t8Z#x<{t$#xQmi`_6 zd-@ObAL&2Qf2RM3{!9H=2Dky=fG{8pXam+j*+68VW}t4MX<%m%X)xEI#$cDheM7>~ z(9qX#v|+emq~RFDB*XEB6AdRDPBolvIMXo8FxzmhVZLFZVX!<&Y844)c4H~eJy&G3g2&q!dTWJDP;Mmk2uMlMDpjoghqjl7L~ zjr@&983h@I7$qB}8l@X$8ci^oWHiNSn$ZlSSw^#smKv=yx?uFdSligcINf-mvD|o- z@fzcG#=jZwFg|E}*!ZaNapRN5r;M)~-!i^qeBbz?vE;D{FcFz(m}r@3n+!1-YBJ2k zz{JkP(Zt7Olu3|Dh)IM=lu5KntjTzj*(QZ1#U`aD5x^sDK2Gr~;8Ow~+m zreUUKrfoJ*Vm8=J*Ua3^%FM>h-ptX=$t>C|&1{0%B(o`IGtIKhvd!k2Eix-MTVYmb zR&Um5)@s&n)@i0N+h%sy?5f#yvzunO&F-4rH+yLI*zBpE@Z{6U-->Pcffn zKEpiMTw)H*3(O16i_P23H<)iV-)_Fse4qIN^F!uG%rBW=HNR*6(EN@0NAthTznK5D zz$}1;z(UKxWHr~S#H!qC ziPdte6;?G?E3F!>!S=x00N;`oo&GwzLkn&bF?z z-eY~s`kRfwhO}X9gf^Nsx;DdX3~fwohTB-!SlQUvxZ8Ny_}T>61lfexOtP74lVh{M zMryOjrr4&`rrc(wO`}b>&3c;+Hk)mB*zB^|YqQ_xtj#T(*Ea8LKH7Y?`DXLe7Pl4H zlD3TP5L-Q4eOp6`t+B0{t+}nGt+lP4t%Gf(?JV0Bwp(p)*kN{tcD{D$c2n(U*k##e z+vV96+LhRq*)6tPYPa03(yq#`)vm)%VYk|Do!xJCr|oXo-L<=K_sH(K-3z-{c5m!? z_P}0buVJrcuVb%kuV-&yZ)ERa?`Cs*V%8izij`-VUUBT!+3{M2Zh5ihjR`W9j-WBbGYyDhr^!^Zyeq` zd~*2g@YUhFBkd@36gi3=H5~^yIyibe1~>*ehB!tzj&Y1}jB}jeIN5QYW3J-@N9b7S zSnOElSm9XjsBqjRaop>8!11u-F~^gRryb8ZUUaiB&G zZv;Ls(C(@dw? zPIH~+JLNhpa9Ziq<+R3Wozn)VtxnsWb~){FI^}fM>6+7Hr$3xtI!RtTeQ^5Z^u_6$ zGvhqKdAPHsvyHR8^9W}bXE$e0XCG&O=dsR-&f}a@oYR~$ohLX?a-QNm-Fc>Sh4X6X zv(9f_G+jozq_{|28eKYFR=KQkS?99NWxvZIm!mExTu!;1aXII5!R4;Y1DD4x&s<)( z{OQWL4sadps_Qz;)!5b4)m-9g>FVa{={njq(shh$tZSm{IM-Cybk{6biR*IL6|Oa| zD_t91<*se6ovy1~*SPL;J?MJa^{DG{*WX=FyPkDD?|RAgitGE4;*ldpjvbjdvUTLq zk&oR3Zpv<|Zt8BDZn|zJZo}Oy+^pSf-R#}G+7L^~CwWfwoZ*?}Imh!C&m7MMp36KdJ*zxxJnK9g zJexdQJli}wJr$luJRf;cUcSf!AZNr(SQozIc82=6OqiH{nfs z)84GNw)Y@!UGHJuhTg{BzTOeuG2U_B3EnB*Y2KOM6TIho&-c#pF7~eQUgEvnyV|?f zyWYFedyV%F?^E7qy)SrQ_P*wQ)BBG1eeXx!Prbi-|M21Y;68jGB_G;H=%eDJ=A-Uo z;}h*m#zAt^h`2O_6{P=#9ALFO&C-T$vGxziG z^Y-)e8|4@57wQ+`H^wj4FWzsO-%P(Ozihv`e)Iiu{PO%Hehd8y{N#T7{3H+k34b&H zaQ|$7ng0g=o&J0L_xm68|K0zR|5g7R{gK4gfjWWu zfkuI*fx`ps1Kk2W1HA+N0s{gA1A_xc2gU~`1*Qb12aXS%7`P~Kd0=&5ZD4(%Jg_ye zBd{xQYv7K+U4h2~PY0e2ybyRb@Ot2_z&n9|27V1v4pI$L57G+K2^t(UG)O zc7*N<-5a_;^la#@(AS~wLO+In4*eGTGYk(CgppxP*pM*2F#RyYFyk<@F!M00Fq<&@ zFvqZ{u&l7Eux(*C!|`yVaKG@3@M+;Q!)J%j311Li6kZx$5xz8B7QQ09CcG}ZGkjI} zn(+1E8^bq;pAWwi{xJM;__Odo!(WHL3;!UA;72G$&=Fb@gCd4R=tUSsm_!VZu!tBL z5g3seksOg0kr^>DVoJpHh*=TY5%VHSBPt@6L@bMtMN~!9M$|_%M#v*tBlbnyi3E{` zk%5sjB4v>qBF{x$kGvImH}ZbuACd1PKSh3t{2s-N!lU?6s!{4uT2VStgQIk#Mn(lj zNkXH-qoShXqT-{HqLQPgN6m`*H7Yl%Bx-Tg(kNL}O;lY}LsV1L+NhmTr=!kAU5vUC zbv^1<)ZM5DQIDgZMSY9HItj)@pEXH4~&on!7r3!)98 zeWF96!=fXj$3!PZkB^=dJvDkpbXIhB^xWuQB+-kai=)e;7e_CPmPN0R-W`1)`cU-I z=-;DHN1uzn5Pd)TN%ZUJx6wai_%TEb6{8#@iV??X#2Ccb#Q4Sp#015RjtP&6iiwFC z8Wh^Wx^m<;KCd{J6rn;<)O#wz#cvJK}c7?Tb4YcO>q3-0yK`;?BoCihCOO zJnlu@pK)*E-o<^0`xN&j?%P=Hu})(X$1WJ#GWM8c?2C9N-YniO-Z9=e-ZkDgesp|T zd_;Uyd~|$ld`A3)_{s6p;%CNZ#V?7kkC(@{#dpMa$FGfFAHN}ffBd2NbMcqsug2eq zzZ-u){!#ps_>T!7K{G)+VNil@!mtFx1e1i}36=>q3BCyd34sa038NFj6QUAg65rO_0`u6o2og;bM<-5AEK96RtWK;;tWRuDT$}h?;-Wn_v+ig$`%N_XKCQff}>uGE96CsHq^-cNm&`XcpJ>f6-Msozq6 zrr~M)v=M2MX;ad&(p`gw+VCV6Ig7J1frc6knYBl05iQu9jlHs@VgFkpfG zf-wt{^4s&f@;B!n%RiZaI{#e$#r!Mz*Yj`X-_3uJ|1tls{IB_v9|c$ezd)&gE?^5( z3RDXW3PuzJ7mO>&Dv%VcDCjEKQgE=~e8HuHs|7a-ZWr7ucv$eH;A6q(f^P*s7vYNp zi^xUHBH<#vMPZ9l7r{kMiw-QhSI93^EgV#+TR5!Hu+XG%c%fsVbD?XYTcKy6PoZC7 zY#}UE6mBa#Q+TuRj->E@;iJN*h0hDW6;VZOkxG$Tkw%eLkzSEykxh|((TF0KqLD?Z zMQKI978Mnh7F852Es_B|$=H%vC5uX$N_Lc7DtS{XD%CBuD;-suSejj$SGu4S zmX?;5l`bx=E^R1nDP32(sdQ`Uj?%rQ2TBi@9xZ)P`lj?pnNk^DCM*+`iOU9+4Jp$r zGbl4IGcEHjOD&sLwop=5SJqOtv+Qu$nX+qT56fPay)FAt_Oa}*vae-7%2mpZ%dN{D z%ALwx%H7KS%fri~%45q@%CpMnmoF?YD{n3DD&JRrwft83;|iq;w!)&qvck2(w<4e- zsA6m%Ws|mc6UwRpOO`N~KDwlC4y!RIRkB z46e+qlvb{+?5f;YxutS@<*v%Tl?N(MRi3RpUwN_eO6B#+o0acZ3|bMsV%Cc470oL; zSFBpGX2tpy8&{lMaeKu_$%>yI$(>QU9xsz0h;R(+`!R5R7e)uL)~b!>G?wWPYBy0vSv%lt0&Cwdk@tT)4A8S6< ze5nPsqFQmSX03MZz}msJuC=3TN7sheM%BjE#@8m+j;ozpTT|O!d!Y7k?XlXEwWn*( z)n2TDL+6nbw)tS=L$C zW!4qf)z@{_ov6E7_eb6Lm8@i??aJttQ$T)Xn%%Cjpkth~JP+RB?NZ?Am2@@qY> z9@G={RJ~^X;QFEU`t?Tj7WLNkw)GD6BkKL?BkMEkXVm{vzo@>veo6iE`W5x{^-cBi z`nLLx`fc_5>krnSt$$emss2j?Xi#ZTZy4Gzyuq`S)BdI-O~;#lZ#vU-v*|(8 z1)&XW};c8c~G-{vr)5Yvw5>!vtzSUvum?kb3k)=b5e6kb9(dm z=84Udn-??}HJ3J5G%sy#XzplMG_P)6*Sw*5XY-!s{mqA(k2W7~zSaD$`KO$gOSI%e zsoJIF`KL*&WwS@K`yP+lM}l9$TM zZAot#-!iFXYRmMNSuKSvB`xJGOInt z+tk}M+qByTwduC$wHdTIw~cJ`X!CCKYYS)#Z;NeHf0o7)bw9cnw;cD(IQJFgwI6YW$x+pf~C)~?>J)o$Ky)h@AZcW8HN zcWL)&4{9IX9^M|+9^IbSp4mRJeM&>e$2hIS0=Fz7JqFzqn!ui0qivv7%#Z z$Bj;`)3DRGGreV|8msXcfmu{C{mqC|NmqV9(msgi>S3p;I*Oad5U9-BD zcdh8E=~~&<*d_03>+0xIbnWTd-*u?#XxE9Z-@7h#-R!#4b-(LT*ORXIU7xxnU%I|4 zXoXOrqEJ)lDuyWx6vhe{MSvnu5uylHBq*jUW+}22^Ax`-^3dLjd_|$6L{YD3Qpgpp zigrbpqFb?6v0kxJu~~6m@n)6Asu8OaR>4*6s}8MtuH_=UXGu_JF zs@>x5q22o3M%|{}=G~Uv!6Dso-AUak-D%wux+ix}?VjG9*InAZq