From 11625d510b0613794dbebb18bf35c31814e834f3 Mon Sep 17 00:00:00 2001 From: wangzhitong Date: Tue, 5 Mar 2024 12:10:22 +0800 Subject: [PATCH] update 3.991 --- .gitattributes | 1 - .../HelloUniMPDemo.xcodeproj/project.pbxproj | 40 +- .../HelloUniMPDemo/ViewController.m | 2 + .../SDWebImage/Core/NSButton+WebCache.h | 340 ---- .../SDWebImage/Core/NSData+ImageContentType.h | 61 - .../SDWebImage/Core/NSImage+Compatibility.h | 67 - .../Headers/SDWebImage/Core/SDAnimatedImage.h | 114 -- .../SDWebImage/Core/SDAnimatedImagePlayer.h | 112 -- .../SDWebImage/Core/SDAnimatedImageRep.h | 23 - .../Core/SDAnimatedImageView+WebCache.h | 168 -- .../SDWebImage/Core/SDAnimatedImageView.h | 110 -- .../Headers/SDWebImage/Core/SDDiskCache.h | 145 -- .../SDWebImage/Core/SDGraphicsImageRenderer.h | 73 - .../SDWebImage/Core/SDImageAPNGCoder.h | 19 - .../SDWebImage/Core/SDImageAWebPCoder.h | 23 - .../Headers/SDWebImage/Core/SDImageCache.h | 422 ----- .../SDWebImage/Core/SDImageCacheConfig.h | 137 -- .../SDWebImage/Core/SDImageCacheDefine.h | 143 -- .../SDWebImage/Core/SDImageCachesManager.h | 81 - .../Headers/SDWebImage/Core/SDImageCoder.h | 266 ---- .../SDWebImage/Core/SDImageCoderHelper.h | 127 -- .../SDWebImage/Core/SDImageCodersManager.h | 58 - .../Headers/SDWebImage/Core/SDImageFrame.h | 36 - .../Headers/SDWebImage/Core/SDImageGIFCoder.h | 22 - .../Headers/SDWebImage/Core/SDImageGraphics.h | 28 - .../SDWebImage/Core/SDImageHEICCoder.h | 25 - .../SDWebImage/Core/SDImageIOAnimatedCoder.h | 59 - .../Headers/SDWebImage/Core/SDImageIOCoder.h | 30 - .../Headers/SDWebImage/Core/SDImageLoader.h | 133 -- .../SDWebImage/Core/SDImageLoadersManager.h | 40 - .../SDWebImage/Core/SDImageTransformer.h | 241 --- .../Headers/SDWebImage/Core/SDMemoryCache.h | 78 - .../Core/SDWebImageCacheKeyFilter.h | 32 - .../Core/SDWebImageCacheSerializer.h | 36 - .../SDWebImage/Core/SDWebImageCompat.h | 95 -- .../SDWebImage/Core/SDWebImageDefine.h | 319 ---- .../SDWebImage/Core/SDWebImageDownloader.h | 314 ---- .../Core/SDWebImageDownloaderConfig.h | 98 -- .../Core/SDWebImageDownloaderDecryptor.h | 49 - .../Core/SDWebImageDownloaderOperation.h | 153 -- .../SDWebImageDownloaderRequestModifier.h | 69 - .../SDWebImageDownloaderResponseModifier.h | 69 - .../Headers/SDWebImage/Core/SDWebImageError.h | 27 - .../SDWebImage/Core/SDWebImageIndicator.h | 115 -- .../SDWebImage/Core/SDWebImageManager.h | 287 ---- .../SDWebImage/Core/SDWebImageOperation.h | 21 - .../Core/SDWebImageOptionsProcessor.h | 72 - .../SDWebImage/Core/SDWebImagePrefetcher.h | 143 -- .../SDWebImage/Core/SDWebImageTransition.h | 131 -- .../SDWebImage/Core/UIButton+WebCache.h | 387 ----- .../Core/UIImage+ExtendedCacheData.h | 24 - .../SDWebImage/Core/UIImage+ForceDecode.h | 46 - .../Headers/SDWebImage/Core/UIImage+GIF.h | 26 - .../SDWebImage/Core/UIImage+MemoryCacheCost.h | 27 - .../SDWebImage/Core/UIImage+Metadata.h | 57 - .../SDWebImage/Core/UIImage+MultiFormat.h | 80 - .../SDWebImage/Core/UIImage+Transform.h | 146 -- .../Core/UIImageView+HighlightedWebCache.h | 129 -- .../SDWebImage/Core/UIImageView+WebCache.h | 194 --- .../Headers/SDWebImage/Core/UIView+WebCache.h | 109 -- .../Core/UIView+WebCacheOperation.h | 48 - .../Private/NSBezierPath+RoundedCorners.h | 24 - .../Private/NSBezierPath+SDRoundedCorners.h | 24 - .../SDWebImage/Private/SDAssociatedObject.h | 14 - .../Private/SDAsyncBlockOperation.h | 21 - .../SDWebImage/Private/SDDeviceHelper.h | 18 - .../SDWebImage/Private/SDDisplayLink.h | 29 - .../Private/SDFileAttributeHelper.h | 19 - .../SDWebImage/Private/SDImageAssetManager.h | 23 - .../Private/SDImageCachesManagerOperation.h | 21 - .../Private/SDImageGIFCoderInternal.h | 16 - .../Private/SDImageIOAnimatedCoderInternal.h | 28 - .../SDWebImage/Private/SDInternalMacros.h | 107 -- .../Headers/SDWebImage/Private/SDWeakProxy.h | 20 - .../Private/SDWebImageTransitionInternal.h | 19 - .../Headers/SDWebImage/Private/SDmetamacros.h | 667 -------- .../SDWebImage/Private/UIColor+HexString.h | 18 - .../SDWebImage/Private/UIColor+SDHexString.h | 18 - .../SDWebImage/webp/SDImageWebPCoder.h | 17 - .../Headers/SDWebImage/webp/UIImage+WebP.h | 23 - .../SDWebImage/webp/src/dec/alphai_dec.h | 54 - .../SDWebImage/webp/src/dec/common_dec.h | 54 - .../Headers/SDWebImage/webp/src/dec/vp8_dec.h | 185 --- .../SDWebImage/webp/src/dec/vp8i_dec.h | 319 ---- .../SDWebImage/webp/src/dec/vp8li_dec.h | 135 -- .../SDWebImage/webp/src/dec/webpi_dec.h | 133 -- .../SDWebImage/webp/src/dsp/common_sse2.h | 194 --- .../SDWebImage/webp/src/dsp/common_sse41.h | 132 -- .../Headers/SDWebImage/webp/src/dsp/dsp.h | 678 -------- .../SDWebImage/webp/src/dsp/lossless.h | 229 --- .../SDWebImage/webp/src/dsp/lossless_common.h | 202 --- .../SDWebImage/webp/src/dsp/mips_macro.h | 200 --- .../SDWebImage/webp/src/dsp/msa_macro.h | 1392 ----------------- .../Headers/SDWebImage/webp/src/dsp/neon.h | 101 -- .../Headers/SDWebImage/webp/src/dsp/quant.h | 70 - .../Headers/SDWebImage/webp/src/dsp/yuv.h | 210 --- .../webp/src/enc/backward_references_enc.h | 234 --- .../SDWebImage/webp/src/enc/cost_enc.h | 82 - .../SDWebImage/webp/src/enc/histogram_enc.h | 128 -- .../SDWebImage/webp/src/enc/vp8i_enc.h | 518 ------ .../SDWebImage/webp/src/enc/vp8li_enc.h | 118 -- .../Headers/SDWebImage/webp/src/mux/animi.h | 43 - .../Headers/SDWebImage/webp/src/mux/muxi.h | 234 --- .../webp/src/utils/bit_reader_inl_utils.h | 190 --- .../webp/src/utils/bit_reader_utils.h | 175 --- .../webp/src/utils/bit_writer_utils.h | 154 -- .../webp/src/utils/color_cache_utils.h | 87 -- .../webp/src/utils/endian_inl_utils.h | 93 -- .../SDWebImage/webp/src/utils/filters_utils.h | 32 - .../webp/src/utils/huffman_encode_utils.h | 60 - .../SDWebImage/webp/src/utils/huffman_utils.h | 88 -- .../webp/src/utils/quant_levels_dec_utils.h | 35 - .../webp/src/utils/quant_levels_utils.h | 36 - .../SDWebImage/webp/src/utils/random_utils.h | 63 - .../webp/src/utils/rescaler_utils.h | 101 -- .../SDWebImage/webp/src/utils/thread_utils.h | 90 -- .../Headers/SDWebImage/webp/src/utils/utils.h | 178 --- .../Headers/SDWebImage/webp/src/webp/decode.h | 506 ------ .../Headers/SDWebImage/webp/src/webp/demux.h | 363 ----- .../Headers/SDWebImage/webp/src/webp/encode.h | 545 ------- .../webp/src/webp/format_constants.h | 87 -- .../Headers/SDWebImage/webp/src/webp/mux.h | 530 ------- .../SDWebImage/webp/src/webp/mux_types.h | 98 -- .../Headers/SDWebImage/webp/src/webp/types.h | 52 - UniMPSDK/Core/Libs/libSDWebImage.a | 3 - unimp.podspec | 4 +- 126 files changed, 26 insertions(+), 16842 deletions(-) delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/NSButton+WebCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/NSData+ImageContentType.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/NSImage+Compatibility.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImage.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImagePlayer.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageRep.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView+WebCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDDiskCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDGraphicsImageRenderer.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAPNGCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAWebPCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheConfig.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheDefine.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCachesManager.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoderHelper.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCodersManager.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageFrame.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGIFCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGraphics.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageHEICCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOAnimatedCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoader.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoadersManager.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDImageTransformer.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDMemoryCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheKeyFilter.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheSerializer.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCompat.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDefine.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloader.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderConfig.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderDecryptor.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderOperation.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageError.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageIndicator.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageManager.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOperation.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOptionsProcessor.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImagePrefetcher.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageTransition.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIButton+WebCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ExtendedCacheData.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ForceDecode.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+GIF.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MemoryCacheCost.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Metadata.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MultiFormat.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Transform.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+HighlightedWebCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+WebCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCache.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCacheOperation.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+RoundedCorners.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDAssociatedObject.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDAsyncBlockOperation.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDDeviceHelper.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDDisplayLink.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDFileAttributeHelper.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDImageAssetManager.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDImageCachesManagerOperation.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDImageGIFCoderInternal.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDInternalMacros.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDWeakProxy.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDWebImageTransitionInternal.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/SDmetamacros.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+HexString.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+SDHexString.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/SDImageWebPCoder.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/UIImage+WebP.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/alphai_dec.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/common_dec.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8_dec.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8i_dec.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8li_dec.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/webpi_dec.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse2.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse41.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/dsp.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless_common.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/mips_macro.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/msa_macro.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/neon.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/quant.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/yuv.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/backward_references_enc.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/cost_enc.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/histogram_enc.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8i_enc.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8li_enc.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/animi.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/muxi.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_inl_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_writer_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/color_cache_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/endian_inl_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/filters_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_encode_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_dec_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/random_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/rescaler_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/thread_utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/utils.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/decode.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/demux.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/encode.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/format_constants.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux_types.h delete mode 100644 UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/types.h delete mode 100644 UniMPSDK/Core/Libs/libSDWebImage.a diff --git a/.gitattributes b/.gitattributes index 9f422c7..0c0ca99 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,7 +4,6 @@ UniMPSDK/Video/Libs/DCUniVideoPublic.framework/DCUniVideoPublic filter=lfs diff= UniMPSDK/QQ/Libs/TencentOpenAPI.framework/TencentOpenAPI filter=lfs diff=lfs merge=lfs -text UniMPSDK/LivePusher/Libs/UPLiveSDKDll.framework/UPLiveSDKDll filter=lfs diff=lfs merge=lfs -text UniMPSDK/Core/Libs/liblibPDRCore.a filter=lfs diff=lfs merge=lfs -text -UniMPSDK/Core/Libs/libSDWebImage.a filter=lfs diff=lfs merge=lfs -text UniMPSDK/Core/Libs/liblibWeex.a filter=lfs diff=lfs merge=lfs -text UniMPSDK/Camera&Gallery/Libs/liblibCamera.a filter=lfs diff=lfs merge=lfs -text UniMPSDK/LivePusher/Libs/libDCUniGPUImage.a filter=lfs diff=lfs merge=lfs -text diff --git a/HelloUniMPDemo/HelloUniMPDemo.xcodeproj/project.pbxproj b/HelloUniMPDemo/HelloUniMPDemo.xcodeproj/project.pbxproj index 4fc662d..414ecc1 100644 --- a/HelloUniMPDemo/HelloUniMPDemo.xcodeproj/project.pbxproj +++ b/HelloUniMPDemo/HelloUniMPDemo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 2F0BEE8D2B837E640041FC4C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F0BEE8C2B837E640041FC4C /* CoreMotion.framework */; }; 2F8F67072B568AB4003E6DCC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F8F67062B568AB4003E6DCC /* AppDelegate.m */; }; 2F8F670D2B568AB4003E6DCC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F8F670C2B568AB4003E6DCC /* ViewController.m */; }; 2F8F67102B568AB4003E6DCC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F8F670E2B568AB4003E6DCC /* Main.storyboard */; }; @@ -26,6 +27,7 @@ /* Begin PBXFileReference section */ 0D828B9013AB3B49D39C2177 /* Pods-HelloUniMPDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloUniMPDemo.release.xcconfig"; path = "Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo.release.xcconfig"; sourceTree = ""; }; 1E99C7BEA081A5A9617D77B2 /* Pods-HelloUniMPDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloUniMPDemo.debug.xcconfig"; path = "Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo.debug.xcconfig"; sourceTree = ""; }; + 2F0BEE8C2B837E640041FC4C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; 2F8F67022B568AB4003E6DCC /* HelloUniMPDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloUniMPDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 2F8F67052B568AB4003E6DCC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 2F8F67062B568AB4003E6DCC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -55,6 +57,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 2F0BEE8D2B837E640041FC4C /* CoreMotion.framework in Frameworks */, BCDE080182B6899B15BBC910 /* libPods-HelloUniMPDemo.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -134,6 +137,7 @@ 8729CB3A1E3A8E9F70F77802 /* Frameworks */ = { isa = PBXGroup; children = ( + 2F0BEE8C2B837E640041FC4C /* CoreMotion.framework */, C3388BD023D1DDEC417F6B44 /* libPods-HelloUniMPDemo.a */, ); name = Frameworks; @@ -159,7 +163,7 @@ 2F8F66FE2B568AB4003E6DCC /* Sources */, 2F8F66FF2B568AB4003E6DCC /* Frameworks */, 2F8F67002B568AB4003E6DCC /* Resources */, - BFF9F57BCF0484F206111522 /* [CP] Copy Pods Resources */, + 0C76A5622B4094BA8E69DCB3 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -219,43 +223,43 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 15E3B50BBE06F99B7E6CAAA5 /* [CP] Check Pods Manifest.lock */ = { + 0C76A5622B4094BA8E69DCB3 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-HelloUniMPDemo-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - 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"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo-resources.sh\"\n"; showEnvVarsInLog = 0; }; - BFF9F57BCF0484F206111522 /* [CP] Copy Pods Resources */ = { + 15E3B50BBE06F99B7E6CAAA5 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-HelloUniMPDemo-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HelloUniMPDemo/Pods-HelloUniMPDemo-resources.sh\"\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 */ @@ -433,7 +437,7 @@ INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -467,7 +471,7 @@ INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/HelloUniMPDemo/HelloUniMPDemo/ViewController.m b/HelloUniMPDemo/HelloUniMPDemo/ViewController.m index 38deae8..15c0ca6 100644 --- a/HelloUniMPDemo/HelloUniMPDemo/ViewController.m +++ b/HelloUniMPDemo/HelloUniMPDemo/ViewController.m @@ -94,6 +94,8 @@ }]; } + + /// 预加载后打开小程序 - (IBAction)preloadUniMP:(id)sender { diff --git a/UniMPSDK/Core/Headers/SDWebImage/Core/NSButton+WebCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/NSButton+WebCache.h deleted file mode 100644 index 5b8035b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/NSButton+WebCache.h +++ /dev/null @@ -1,340 +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_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/UniMPSDK/Core/Headers/SDWebImage/Core/NSData+ImageContentType.h b/UniMPSDK/Core/Headers/SDWebImage/Core/NSData+ImageContentType.h deleted file mode 100644 index a9921ea..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/NSData+ImageContentType.h +++ /dev/null @@ -1,61 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/NSImage+Compatibility.h b/UniMPSDK/Core/Headers/SDWebImage/Core/NSImage+Compatibility.h deleted file mode 100644 index 0a562cc..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/NSImage+Compatibility.h +++ /dev/null @@ -1,67 +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_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/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImage.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImage.h deleted file mode 100644 index 2e208cd..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImage.h +++ /dev/null @@ -1,114 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImagePlayer.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImagePlayer.h deleted file mode 100644 index e71e239..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImagePlayer.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 "SDWebImageCompat.h" -#import "SDImageCoder.h" - -typedef NS_ENUM(NSUInteger, SDAnimatedImagePlaybackMode) { - /** - * From first to last frame and stop or next loop. - */ - SDAnimatedImagePlaybackModeNormal = 0, - /** - * From last frame to first frame and stop or next loop. - */ - SDAnimatedImagePlaybackModeReverse, - /** - * From first frame to last frame and reverse again, like reciprocating. - */ - SDAnimatedImagePlaybackModeBounce, - /** - * From last frame to first frame and reverse again, like reversed reciprocating. - */ - SDAnimatedImagePlaybackModeReversedBounce, -}; - -/// 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; - -/// Asynchronous setup animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal. -@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode; - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageRep.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageRep.h deleted file mode 100644 index be52f8c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageRep.h +++ /dev/null @@ -1,23 +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_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/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView+WebCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView+WebCache.h deleted file mode 100644 index af46476..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView+WebCache.h +++ /dev/null @@ -1,168 +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 "SDAnimatedImageView.h" - -#if SD_UIKIT || SD_MAC - -#import "SDWebImageManager.h" - -/** - Integrates SDWebImage async downloading and caching of remote images with SDAnimatedImageView. - */ -@interface SDAnimatedImageView (WebCache) - -/** - * Set the imageView `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 imageView `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 imageView `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 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`. - * - * 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 imageView `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 imageView `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 imageView `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 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_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/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView.h deleted file mode 100644 index f5f541b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDAnimatedImageView.h +++ /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 "SDWebImageCompat.h" - -#if SD_UIKIT || SD_MAC - -#import "SDAnimatedImage.h" -#import "SDAnimatedImagePlayer.h" - -/** - A drop-in replacement for UIImageView/NSImageView, you can use this for animated image rendering. - Call `setImage:` with `UIImage(NSImage)` which conforms 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 -/** - The internal animation player. - This property is only used for advanced usage, like inspecting/debugging animation status, control progressive loading, complicated animation frame index control, etc. - @warning Pay attention if you directly update the player's property like `totalFrameCount`, `totalLoopCount`, the same property on `SDAnimatedImageView` may not get synced. - */ -@property (nonatomic, strong, readonly, nullable) SDAnimatedImagePlayer *player; - -/** - 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; - -/// Asynchronous setup animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal. -@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode; - -/** - 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 which conforms to `SDAnimatedImage` protocol 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDDiskCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDDiskCache.h deleted file mode 100644 index dc5e1fa..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDDiskCache.h +++ /dev/null @@ -1,145 +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" - -@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/UniMPSDK/Core/Headers/SDWebImage/Core/SDGraphicsImageRenderer.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDGraphicsImageRenderer.h deleted file mode 100644 index 900acd7..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDGraphicsImageRenderer.h +++ /dev/null @@ -1,73 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAPNGCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAPNGCoder.h deleted file mode 100644 index f73742c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAPNGCoder.h +++ /dev/null @@ -1,19 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAWebPCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAWebPCoder.h deleted file mode 100644 index 4b585a9..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageAWebPCoder.h +++ /dev/null @@ -1,23 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCache.h deleted file mode 100644 index ad3afd5..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCache.h +++ /dev/null @@ -1,422 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheConfig.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheConfig.h deleted file mode 100644 index 4d6e79b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheConfig.h +++ /dev/null @@ -1,137 +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" - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheDefine.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheDefine.h deleted file mode 100644 index 48f7b5c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCacheDefine.h +++ /dev/null @@ -1,143 +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" -#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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCachesManager.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCachesManager.h deleted file mode 100644 index ad85db8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCachesManager.h +++ /dev/null @@ -1,81 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoder.h deleted file mode 100644 index 53b52e5..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoder.h +++ /dev/null @@ -1,266 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoderHelper.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoderHelper.h deleted file mode 100644 index 77b9d77..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCoderHelper.h +++ /dev/null @@ -1,127 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCodersManager.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCodersManager.h deleted file mode 100644 index 14b655d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageCodersManager.h +++ /dev/null @@ -1,58 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageFrame.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageFrame.h deleted file mode 100644 index a93fd9c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageFrame.h +++ /dev/null @@ -1,36 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGIFCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGIFCoder.h deleted file mode 100644 index 5ef67ac..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGIFCoder.h +++ /dev/null @@ -1,22 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGraphics.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGraphics.h deleted file mode 100644 index 131d685..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageGraphics.h +++ /dev/null @@ -1,28 +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 - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageHEICCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageHEICCoder.h deleted file mode 100644 index f7dd661..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageHEICCoder.h +++ /dev/null @@ -1,25 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOAnimatedCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOAnimatedCoder.h deleted file mode 100644 index 3f4149a..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOAnimatedCoder.h +++ /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 -#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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOCoder.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOCoder.h deleted file mode 100644 index 98682ed..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageIOCoder.h +++ /dev/null @@ -1,30 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoader.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoader.h deleted file mode 100644 index 25f1af4..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoader.h +++ /dev/null @@ -1,133 +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 "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 - -@required -/** - 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 API_DEPRECATED("Use canRequestImageForURL:options:context: 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)); - -@optional -/** - Whether current image loader supports to load the provide image URL, with associated options and context. - 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. - @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 YES to continue download, NO to stop download. - */ -- (BOOL)canRequestImageForURL:(nullable NSURL *)url - options:(SDWebImageOptions)options - context:(nullable SDWebImageContext *)context; - -@required -/** - 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 API_DEPRECATED("Use shouldBlockFailedURLWithURL:error:options:context: 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)); - -@optional -/** - Whether the error from image loader should be marked indeed un-recoverable or not, with associated options and context. - 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. - @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 Whether to block this url or not. Return YES to mark this URL as failed. - */ -- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url - error:(nonnull NSError *)error - options:(SDWebImageOptions)options - context:(nullable SDWebImageContext *)context; - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoadersManager.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoadersManager.h deleted file mode 100644 index 9886f45..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageLoadersManager.h +++ /dev/null @@ -1,40 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageTransformer.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageTransformer.h deleted file mode 100644 index 3031bfe..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDImageTransformer.h +++ /dev/null @@ -1,241 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDMemoryCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDMemoryCache.h deleted file mode 100644 index 43c39e8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDMemoryCache.h +++ /dev/null @@ -1,78 +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" - -@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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheKeyFilter.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheKeyFilter.h deleted file mode 100644 index 4f54dd8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheKeyFilter.h +++ /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 -#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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheSerializer.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheSerializer.h deleted file mode 100644 index 3c271b1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCacheSerializer.h +++ /dev/null @@ -1,36 +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" - -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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCompat.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCompat.h deleted file mode 100644 index f47a248..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageCompat.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 - -#ifdef __OBJC_GC__ - #error SDWebImage does not support Objective-C Garbage Collection -#endif - -// Seems like TARGET_OS_MAC is always defined (on all platforms). -// 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 -#endif - -// iOS and tvOS are very similar, UIKit exists on both platforms -// Note: watchOS also has UIKit, but it's very limited -#if TARGET_OS_IOS || TARGET_OS_TV - #define SD_UIKIT 1 -#else - #define SD_UIKIT 0 -#endif - -#if TARGET_OS_IOS - #define SD_IOS 1 -#else - #define SD_IOS 0 -#endif - -#if TARGET_OS_TV - #define SD_TV 1 -#else - #define SD_TV 0 -#endif - -#if TARGET_OS_WATCH - #define SD_WATCH 1 -#else - #define SD_WATCH 0 -#endif - - -#if SD_MAC - #import - #ifndef UIImage - #define UIImage NSImage - #endif - #ifndef UIImageView - #define UIImageView NSImageView - #endif - #ifndef UIView - #define UIView NSView - #endif - #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 - -#ifndef NS_ENUM -#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type -#endif - -#ifndef NS_OPTIONS -#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type -#endif - -#ifndef dispatch_main_async_safe -#define dispatch_main_async_safe(block)\ - 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 diff --git a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDefine.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDefine.h deleted file mode 100644 index 43df046..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDefine.h +++ /dev/null @@ -1,319 +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" - -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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloader.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloader.h deleted file mode 100644 index 49ecd5d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloader.h +++ /dev/null @@ -1,314 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderConfig.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderConfig.h deleted file mode 100644 index 5a8cf58..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderConfig.h +++ /dev/null @@ -1,98 +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" - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderDecryptor.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderDecryptor.h deleted file mode 100644 index 0923f29..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderDecryptor.h +++ /dev/null @@ -1,49 +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" - -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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderOperation.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderOperation.h deleted file mode 100644 index 7f073b7..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderOperation.h +++ /dev/null @@ -1,153 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h deleted file mode 100644 index 42c8a40..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h +++ /dev/null @@ -1,69 +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" - -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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h deleted file mode 100644 index 63c1456..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h +++ /dev/null @@ -1,69 +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" - -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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageError.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageError.h deleted file mode 100644 index 2b41201..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageError.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageIndicator.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageIndicator.h deleted file mode 100644 index e1165c1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageIndicator.h +++ /dev/null @@ -1,115 +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 - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageManager.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageManager.h deleted file mode 100644 index ee90724..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageManager.h +++ /dev/null @@ -1,287 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOperation.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOperation.h deleted file mode 100644 index 50266db..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOperation.h +++ /dev/null @@ -1,21 +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 - -/// A protocol represents cancelable operation. -@protocol SDWebImageOperation - -- (void)cancel; - -@end - -/// NSOperation conform to `SDWebImageOperation`. -@interface NSOperation (SDWebImageOperation) - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOptionsProcessor.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOptionsProcessor.h deleted file mode 100644 index 31ef153..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageOptionsProcessor.h +++ /dev/null @@ -1,72 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImagePrefetcher.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImagePrefetcher.h deleted file mode 100644 index a9b2c1f..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImagePrefetcher.h +++ /dev/null @@ -1,143 +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; - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageTransition.h b/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageTransition.h deleted file mode 100644 index 889372e..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/SDWebImageTransition.h +++ /dev/null @@ -1,131 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/UIButton+WebCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIButton+WebCache.h deleted file mode 100644 index 89d94b4..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIButton+WebCache.h +++ /dev/null @@ -1,387 +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 - -#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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ExtendedCacheData.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ExtendedCacheData.h deleted file mode 100644 index 482c8c4..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ExtendedCacheData.h +++ /dev/null @@ -1,24 +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" - -@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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ForceDecode.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ForceDecode.h deleted file mode 100644 index f368746..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+ForceDecode.h +++ /dev/null @@ -1,46 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+GIF.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+GIF.h deleted file mode 100644 index 5da8e19..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+GIF.h +++ /dev/null @@ -1,26 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MemoryCacheCost.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MemoryCacheCost.h deleted file mode 100644 index 0ff2f2f..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MemoryCacheCost.h +++ /dev/null @@ -1,27 +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" - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Metadata.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Metadata.h deleted file mode 100644 index 8328c26..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Metadata.h +++ /dev/null @@ -1,57 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MultiFormat.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MultiFormat.h deleted file mode 100644 index a0935b5..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+MultiFormat.h +++ /dev/null @@ -1,80 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Transform.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Transform.h deleted file mode 100644 index 06cb66d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImage+Transform.h +++ /dev/null @@ -1,146 +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" - -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/UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+HighlightedWebCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+HighlightedWebCache.h deleted file mode 100644 index 6cd3ba6..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+HighlightedWebCache.h +++ /dev/null @@ -1,129 +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 - -#import "SDWebImageManager.h" - -/** - * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. - */ -@interface UIImageView (HighlightedWebCache) - -/** - * Set the imageView `highlightedImage` with an `url`. - * - * The download is asynchronous and cached. - * - * @param url The url for the image. - */ -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; - -/** - * Set the imageView `highlightedImage` with an `url` and custom options. - * - * 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. - */ -- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url - 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`. - * - * 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_setHighlightedImageWithURL:(nullable NSURL *)url - completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; - -/** - * Set the imageView `highlightedImage` with an `url` and custom options. - * - * 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 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 - completed:(nullable SDExternalCompletionBlock)completedBlock; - -/** - * Set the imageView `highlightedImage` with an `url` and custom options. - * - * 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 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 - 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 - -#endif diff --git a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+WebCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+WebCache.h deleted file mode 100644 index 626de9d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIImageView+WebCache.h +++ /dev/null @@ -1,194 +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 "SDWebImageManager.h" - -/** - * Usage with a UITableViewCell sub-class: - * - * @code - -#import - -... - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - static NSString *MyIdentifier = @"MyIdentifier"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; - - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]; - } - - // 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"]]; - - cell.textLabel.text = @"My Text"; - return cell; -} - - * @endcode - */ - -/** - * Integrates SDWebImage async downloading and caching of remote images with UIImageView. - */ -@interface UIImageView (WebCache) - -/** - * Set the imageView `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 imageView `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 imageView `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 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`. - * - * 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 imageView `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 imageView `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 imageView `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 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_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/UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCache.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCache.h deleted file mode 100644 index ee9f761..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCache.h +++ /dev/null @@ -1,109 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCacheOperation.h b/UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCacheOperation.h deleted file mode 100644 index 53a7045..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Core/UIView+WebCacheOperation.h +++ /dev/null @@ -1,48 +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" - -/** - 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) - -/** - * 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; - -/** - * Cancel all operations for the current UIView and key - * - * @param key key for identifying the operations - */ -- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; - -/** - * Just remove the operations corresponding to the current UIView and key without cancelling them - * - * @param key key for identifying the operations - */ -- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+RoundedCorners.h b/UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+RoundedCorners.h deleted file mode 100644 index 224f259..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+RoundedCorners.h +++ /dev/null @@ -1,24 +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_MAC - -#import "UIImage+Transform.h" - -@interface NSBezierPath (RoundedCorners) - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h b/UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h deleted file mode 100644 index dfec18b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h +++ /dev/null @@ -1,24 +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_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/UniMPSDK/Core/Headers/SDWebImage/Private/SDAssociatedObject.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDAssociatedObject.h deleted file mode 100644 index 199cf4f..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDAssociatedObject.h +++ /dev/null @@ -1,14 +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" - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Private/SDAsyncBlockOperation.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDAsyncBlockOperation.h deleted file mode 100644 index a3480de..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDAsyncBlockOperation.h +++ /dev/null @@ -1,21 +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" - -@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/UniMPSDK/Core/Headers/SDWebImage/Private/SDDeviceHelper.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDDeviceHelper.h deleted file mode 100644 index 5d5676b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDDeviceHelper.h +++ /dev/null @@ -1,18 +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" - -/// Device information helper methods -@interface SDDeviceHelper : NSObject - -+ (NSUInteger)totalMemory; -+ (NSUInteger)freeMemory; - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/Private/SDDisplayLink.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDDisplayLink.h deleted file mode 100644 index 3ee8c6f..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDDisplayLink.h +++ /dev/null @@ -1,29 +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" - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Private/SDFileAttributeHelper.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDFileAttributeHelper.h deleted file mode 100644 index 3ce6bad..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDFileAttributeHelper.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// 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/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageAssetManager.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageAssetManager.h deleted file mode 100644 index 88dee48..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageAssetManager.h +++ /dev/null @@ -1,23 +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" - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageCachesManagerOperation.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageCachesManagerOperation.h deleted file mode 100644 index 0debe6c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageCachesManagerOperation.h +++ /dev/null @@ -1,21 +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" - -/// 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/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageGIFCoderInternal.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageGIFCoderInternal.h deleted file mode 100644 index 769d206..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageGIFCoderInternal.h +++ /dev/null @@ -1,16 +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 "SDImageGIFCoder.h" - -@interface SDImageGIFCoder () - -- (float)sd_frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source; - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h deleted file mode 100644 index 022cf7d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h +++ /dev/null @@ -1,28 +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 "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/UniMPSDK/Core/Headers/SDWebImage/Private/SDInternalMacros.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDInternalMacros.h deleted file mode 100644 index 46352db..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDInternalMacros.h +++ /dev/null @@ -1,107 +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 -#import -#import "SDmetamacros.h" - -#ifndef SD_LOCK_DECLARE -#if TARGET_OS_MACCATALYST -#define SD_LOCK_DECLARE(lock) os_unfair_lock lock; -#else -#define SD_LOCK_DECLARE(lock) os_unfair_lock lock API_AVAILABLE(ios(10.0), tvos(10), watchos(3), macos(10.12)); \ -OSSpinLock lock##_deprecated; -#endif -#endif - -#ifndef SD_LOCK_INIT -#if TARGET_OS_MACCATALYST -#define SD_LOCK_INIT(lock) lock = OS_UNFAIR_LOCK_INIT; -#else -#define SD_LOCK_INIT(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) lock = OS_UNFAIR_LOCK_INIT; \ -else lock##_deprecated = OS_SPINLOCK_INIT; -#endif -#endif - -#ifndef SD_LOCK -#if TARGET_OS_MACCATALYST -#define SD_LOCK(lock) os_unfair_lock_lock(&lock); -#else -#define SD_LOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_lock(&lock); \ -else OSSpinLockLock(&lock##_deprecated); -#endif -#endif - -#ifndef SD_UNLOCK -#if TARGET_OS_MACCATALYST -#define SD_UNLOCK(lock) os_unfair_lock_unlock(&lock); -#else -#define SD_UNLOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_unlock(&lock); \ -else OSSpinLockUnlock(&lock##_deprecated); -#endif -#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/UniMPSDK/Core/Headers/SDWebImage/Private/SDWeakProxy.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDWeakProxy.h deleted file mode 100644 index d92c682..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDWeakProxy.h +++ /dev/null @@ -1,20 +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" - -/// A weak proxy which forward all the message to the target -@interface SDWeakProxy : NSProxy - -@property (nonatomic, weak, readonly, nullable) id target; - -- (nonnull instancetype)initWithTarget:(nonnull id)target; -+ (nonnull instancetype)proxyWithTarget:(nonnull id)target; - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/Private/SDWebImageTransitionInternal.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDWebImageTransitionInternal.h deleted file mode 100644 index 1b70649..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDWebImageTransitionInternal.h +++ /dev/null @@ -1,19 +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_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/UniMPSDK/Core/Headers/SDWebImage/Private/SDmetamacros.h b/UniMPSDK/Core/Headers/SDWebImage/Private/SDmetamacros.h deleted file mode 100644 index dd90d99..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/SDmetamacros.h +++ /dev/null @@ -1,667 +0,0 @@ -/** - * 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/UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+HexString.h b/UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+HexString.h deleted file mode 100644 index 2a8a3d8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+HexString.h +++ /dev/null @@ -1,18 +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" - -@interface UIColor (HexString) - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+SDHexString.h b/UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+SDHexString.h deleted file mode 100644 index cf67186..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/Private/UIColor+SDHexString.h +++ /dev/null @@ -1,18 +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" - -@interface UIColor (SDHexString) - -/** - 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/UniMPSDK/Core/Headers/SDWebImage/webp/SDImageWebPCoder.h b/UniMPSDK/Core/Headers/SDWebImage/webp/SDImageWebPCoder.h deleted file mode 100644 index 42d7e0b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/SDImageWebPCoder.h +++ /dev/null @@ -1,17 +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 "SDImageCoder.h" -/** - Built in coder that supports WebP and animated WebP - */ -@interface SDImageWebPCoder : NSObject - -@property (nonatomic, class, readonly, nonnull) SDImageWebPCoder *sharedCoder; - -@end diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/UIImage+WebP.h b/UniMPSDK/Core/Headers/SDWebImage/webp/UIImage+WebP.h deleted file mode 100644 index 4393c2c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/UIImage+WebP.h +++ /dev/null @@ -1,23 +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 - -// 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/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/alphai_dec.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/alphai_dec.h deleted file mode 100644 index a64104a..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/alphai_dec.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2013 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. -// ----------------------------------------------------------------------------- -// -// Alpha decoder: internal header. -// -// Author: Urvang (urvang@google.com) - -#ifndef WEBP_DEC_ALPHAI_DEC_H_ -#define WEBP_DEC_ALPHAI_DEC_H_ - -#include "src/dec/webpi_dec.h" -#include "src/utils/filters_utils.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct VP8LDecoder; // Defined in dec/vp8li.h. - -typedef struct ALPHDecoder ALPHDecoder; -struct ALPHDecoder { - int width_; - int height_; - int method_; - WEBP_FILTER_TYPE filter_; - int pre_processing_; - struct VP8LDecoder* vp8l_dec_; - VP8Io io_; - int use_8b_decode_; // Although alpha channel requires only 1 byte per - // pixel, sometimes VP8LDecoder may need to allocate - // 4 bytes per pixel internally during decode. - uint8_t* output_; - const uint8_t* prev_line_; // last output row (or NULL) -}; - -//------------------------------------------------------------------------------ -// internal functions. Not public. - -// Deallocate memory associated to dec->alpha_plane_ decoding -void WebPDeallocateAlphaMemory(VP8Decoder* const dec); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DEC_ALPHAI_DEC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/common_dec.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/common_dec.h deleted file mode 100644 index b158550..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/common_dec.h +++ /dev/null @@ -1,54 +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. -// ----------------------------------------------------------------------------- -// -// Definitions and macros common to encoding and decoding -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_DEC_COMMON_DEC_H_ -#define WEBP_DEC_COMMON_DEC_H_ - -// intra prediction modes -enum { B_DC_PRED = 0, // 4x4 modes - B_TM_PRED = 1, - B_VE_PRED = 2, - B_HE_PRED = 3, - B_RD_PRED = 4, - B_VR_PRED = 5, - B_LD_PRED = 6, - B_VL_PRED = 7, - B_HD_PRED = 8, - B_HU_PRED = 9, - NUM_BMODES = B_HU_PRED + 1 - B_DC_PRED, // = 10 - - // Luma16 or UV modes - DC_PRED = B_DC_PRED, V_PRED = B_VE_PRED, - H_PRED = B_HE_PRED, TM_PRED = B_TM_PRED, - B_PRED = NUM_BMODES, // refined I4x4 mode - NUM_PRED_MODES = 4, - - // special modes - B_DC_PRED_NOTOP = 4, - B_DC_PRED_NOLEFT = 5, - B_DC_PRED_NOTOPLEFT = 6, - NUM_B_DC_MODES = 7 }; - -enum { MB_FEATURE_TREE_PROBS = 3, - NUM_MB_SEGMENTS = 4, - NUM_REF_LF_DELTAS = 4, - NUM_MODE_LF_DELTAS = 4, // I4x4, ZERO, *, SPLIT - MAX_NUM_PARTITIONS = 8, - // Probabilities - NUM_TYPES = 4, // 0: i16-AC, 1: i16-DC, 2:chroma-AC, 3:i4-AC - NUM_BANDS = 8, - NUM_CTX = 3, - NUM_PROBAS = 11 - }; - -#endif // WEBP_DEC_COMMON_DEC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8_dec.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8_dec.h deleted file mode 100644 index a05405d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8_dec.h +++ /dev/null @@ -1,185 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Low-level API for VP8 decoder -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_DEC_VP8_DEC_H_ -#define WEBP_DEC_VP8_DEC_H_ - -#include "src/webp/decode.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//------------------------------------------------------------------------------ -// Lower-level API -// -// These functions provide fine-grained control of the decoding process. -// The call flow should resemble: -// -// VP8Io io; -// VP8InitIo(&io); -// io.data = data; -// io.data_size = size; -// /* customize io's functions (setup()/put()/teardown()) if needed. */ -// -// VP8Decoder* dec = VP8New(); -// int ok = VP8Decode(dec, &io); -// if (!ok) printf("Error: %s\n", VP8StatusMessage(dec)); -// VP8Delete(dec); -// return ok; - -// Input / Output -typedef struct VP8Io VP8Io; -typedef int (*VP8IoPutHook)(const VP8Io* io); -typedef int (*VP8IoSetupHook)(VP8Io* io); -typedef void (*VP8IoTeardownHook)(const VP8Io* io); - -struct VP8Io { - // set by VP8GetHeaders() - int width, height; // picture dimensions, in pixels (invariable). - // These are the original, uncropped dimensions. - // The actual area passed to put() is stored - // in mb_w / mb_h fields. - - // set before calling put() - int mb_y; // position of the current rows (in pixels) - int mb_w; // number of columns in the sample - int mb_h; // number of rows in the sample - const uint8_t* y, *u, *v; // rows to copy (in yuv420 format) - int y_stride; // row stride for luma - int uv_stride; // row stride for chroma - - void* opaque; // user data - - // called when fresh samples are available. Currently, samples are in - // YUV420 format, and can be up to width x 24 in size (depending on the - // in-loop filtering level, e.g.). Should return false in case of error - // or abort request. The actual size of the area to update is mb_w x mb_h - // in size, taking cropping into account. - VP8IoPutHook put; - - // called just before starting to decode the blocks. - // Must return false in case of setup error, true otherwise. If false is - // returned, teardown() will NOT be called. But if the setup succeeded - // and true is returned, then teardown() will always be called afterward. - VP8IoSetupHook setup; - - // Called just after block decoding is finished (or when an error occurred - // during put()). Is NOT called if setup() failed. - VP8IoTeardownHook teardown; - - // this is a recommendation for the user-side yuv->rgb converter. This flag - // is set when calling setup() hook and can be overwritten by it. It then - // can be taken into consideration during the put() method. - int fancy_upsampling; - - // Input buffer. - size_t data_size; - const uint8_t* data; - - // If true, in-loop filtering will not be performed even if present in the - // bitstream. Switching off filtering may speed up decoding at the expense - // of more visible blocking. Note that output will also be non-compliant - // with the VP8 specifications. - int bypass_filtering; - - // Cropping parameters. - int use_cropping; - int crop_left, crop_right, crop_top, crop_bottom; - - // Scaling parameters. - int use_scaling; - int scaled_width, scaled_height; - - // If non NULL, pointer to the alpha data (if present) corresponding to the - // start of the current row (That is: it is pre-offset by mb_y and takes - // cropping into account). - const uint8_t* a; -}; - -// Internal, version-checked, entry point -int VP8InitIoInternal(VP8Io* const, int); - -// Set the custom IO function pointers and user-data. The setter for IO hooks -// should be called before initiating incremental decoding. Returns true if -// WebPIDecoder object is successfully modified, false otherwise. -int WebPISetIOHooks(WebPIDecoder* const idec, - VP8IoPutHook put, - VP8IoSetupHook setup, - VP8IoTeardownHook teardown, - void* user_data); - -// Main decoding object. This is an opaque structure. -typedef struct VP8Decoder VP8Decoder; - -// Create a new decoder object. -VP8Decoder* VP8New(void); - -// Must be called to make sure 'io' is initialized properly. -// Returns false in case of version mismatch. Upon such failure, no other -// decoding function should be called (VP8Decode, VP8GetHeaders, ...) -static WEBP_INLINE int VP8InitIo(VP8Io* const io) { - return VP8InitIoInternal(io, WEBP_DECODER_ABI_VERSION); -} - -// Decode the VP8 frame header. Returns true if ok. -// Note: 'io->data' must be pointing to the start of the VP8 frame header. -int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io); - -// Decode a picture. Will call VP8GetHeaders() if it wasn't done already. -// Returns false in case of error. -int VP8Decode(VP8Decoder* const dec, VP8Io* const io); - -// Return current status of the decoder: -VP8StatusCode VP8Status(VP8Decoder* const dec); - -// return readable string corresponding to the last status. -const char* VP8StatusMessage(VP8Decoder* const dec); - -// Resets the decoder in its initial state, reclaiming memory. -// Not a mandatory call between calls to VP8Decode(). -void VP8Clear(VP8Decoder* const dec); - -// Destroy the decoder object. -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); - -// 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( - 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); - -// 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( - const uint8_t* data, size_t data_size, // data available so far - int* const width, int* const height, int* const has_alpha); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DEC_VP8_DEC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8i_dec.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8i_dec.h deleted file mode 100644 index 2d7900a..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8i_dec.h +++ /dev/null @@ -1,319 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// VP8 decoder: internal header. -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_DEC_VP8I_DEC_H_ -#define WEBP_DEC_VP8I_DEC_H_ - -#include // for memcpy() -#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" { -#endif - -//------------------------------------------------------------------------------ -// Various defines and enums - -// version numbers -#define DEC_MAJ_VERSION 1 -#define DEC_MIN_VERSION 0 -#define DEC_REV_VERSION 2 - -// YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). -// Constraints are: We need to store one 16x16 block of luma samples (y), -// and two 8x8 chroma blocks (u/v). These are better be 16-bytes aligned, -// in order to be SIMD-friendly. We also need to store the top, left and -// top-left samples (from previously decoded blocks), along with four -// extra top-right samples for luma (intra4x4 prediction only). -// One possible layout is, using 32 * (17 + 9) bytes: -// -// .+------ <- only 1 pixel high -// .|yyyyt. -// .|yyyyt. -// .|yyyyt. -// .|yyyy.. -// .+--.+-- <- only 1 pixel high -// .|uu.|vv -// .|uu.|vv -// -// Every character is a 4x4 block, with legend: -// '.' = unused -// 'y' = y-samples 'u' = u-samples 'v' = u-samples -// '|' = left sample, '-' = top sample, '+' = top-left sample -// 't' = extra top-right sample for 4x4 modes -#define YUV_SIZE (BPS * 17 + BPS * 9) -#define Y_OFF (BPS * 1 + 8) -#define U_OFF (Y_OFF + BPS * 16 + BPS) -#define V_OFF (U_OFF + 16) - -// minimal width under which lossy multi-threading is always disabled -#define MIN_WIDTH_FOR_THREADS 512 - -//------------------------------------------------------------------------------ -// Headers - -typedef struct { - uint8_t key_frame_; - uint8_t profile_; - uint8_t show_; - uint32_t partition_length_; -} VP8FrameHeader; - -typedef struct { - uint16_t width_; - uint16_t height_; - uint8_t xscale_; - uint8_t yscale_; - uint8_t colorspace_; // 0 = YCbCr - uint8_t clamp_type_; -} VP8PictureHeader; - -// segment features -typedef struct { - int use_segment_; - int update_map_; // whether to update the segment map or not - int absolute_delta_; // absolute or delta values for quantizer and filter - int8_t quantizer_[NUM_MB_SEGMENTS]; // quantization changes - int8_t filter_strength_[NUM_MB_SEGMENTS]; // filter strength for segments -} VP8SegmentHeader; - -// probas associated to one of the contexts -typedef uint8_t VP8ProbaArray[NUM_PROBAS]; - -typedef struct { // all the probas associated to one band - VP8ProbaArray probas_[NUM_CTX]; -} VP8BandProbas; - -// Struct collecting all frame-persistent probabilities. -typedef struct { - uint8_t segments_[MB_FEATURE_TREE_PROBS]; - // Type: 0:Intra16-AC 1:Intra16-DC 2:Chroma 3:Intra4 - VP8BandProbas bands_[NUM_TYPES][NUM_BANDS]; - const VP8BandProbas* bands_ptr_[NUM_TYPES][16 + 1]; -} VP8Proba; - -// Filter parameters -typedef struct { - int simple_; // 0=complex, 1=simple - int level_; // [0..63] - int sharpness_; // [0..7] - int use_lf_delta_; - int ref_lf_delta_[NUM_REF_LF_DELTAS]; - int mode_lf_delta_[NUM_MODE_LF_DELTAS]; -} VP8FilterHeader; - -//------------------------------------------------------------------------------ -// Informations about the macroblocks. - -typedef struct { // filter specs - uint8_t f_limit_; // filter limit in [3..189], or 0 if no filtering - uint8_t f_ilevel_; // inner limit in [1..63] - uint8_t f_inner_; // do inner filtering? - uint8_t hev_thresh_; // high edge variance threshold in [0..2] -} VP8FInfo; - -typedef struct { // Top/Left Contexts used for syntax-parsing - uint8_t nz_; // non-zero AC/DC coeffs (4bit for luma + 4bit for chroma) - uint8_t nz_dc_; // non-zero DC coeff (1bit) -} VP8MB; - -// Dequantization matrices -typedef int quant_t[2]; // [DC / AC]. Can be 'uint16_t[2]' too (~slower). -typedef struct { - quant_t y1_mat_, y2_mat_, uv_mat_; - - int uv_quant_; // U/V quantizer value - int dither_; // dithering amplitude (0 = off, max=255) -} VP8QuantMatrix; - -// Data needed to reconstruct a macroblock -typedef struct { - int16_t coeffs_[384]; // 384 coeffs = (16+4+4) * 4*4 - uint8_t is_i4x4_; // true if intra4x4 - uint8_t imodes_[16]; // one 16x16 mode (#0) or sixteen 4x4 modes - uint8_t uvmode_; // chroma prediction mode - // bit-wise info about the content of each sub-4x4 blocks (in decoding order). - // Each of the 4x4 blocks for y/u/v is associated with a 2b code according to: - // code=0 -> no coefficient - // code=1 -> only DC - // code=2 -> first three coefficients are non-zero - // code=3 -> more than three coefficients are non-zero - // This allows to call specialized transform functions. - uint32_t non_zero_y_; - uint32_t non_zero_uv_; - uint8_t dither_; // local dithering strength (deduced from non_zero_*) - uint8_t skip_; - uint8_t segment_; -} VP8MBData; - -// Persistent information needed by the parallel processing -typedef struct { - int id_; // cache row to process (in [0..2]) - int mb_y_; // macroblock position of the row - int filter_row_; // true if row-filtering is needed - VP8FInfo* f_info_; // filter strengths (swapped with dec->f_info_) - VP8MBData* mb_data_; // reconstruction data (swapped with dec->mb_data_) - VP8Io io_; // copy of the VP8Io to pass to put() -} VP8ThreadContext; - -// Saved top samples, per macroblock. Fits into a cache-line. -typedef struct { - uint8_t y[16], u[8], v[8]; -} VP8TopSamples; - -//------------------------------------------------------------------------------ -// VP8Decoder: the main opaque structure handed over to user - -struct VP8Decoder { - VP8StatusCode status_; - int ready_; // true if ready to decode a picture with VP8Decode() - const char* error_msg_; // set when status_ is not OK. - - // Main data source - VP8BitReader br_; - - // headers - VP8FrameHeader frm_hdr_; - VP8PictureHeader pic_hdr_; - VP8FilterHeader filter_hdr_; - VP8SegmentHeader segment_hdr_; - - // Worker - WebPWorker worker_; - int mt_method_; // multi-thread method: 0=off, 1=[parse+recon][filter] - // 2=[parse][recon+filter] - int cache_id_; // current cache row - int num_caches_; // number of cached rows of 16 pixels (1, 2 or 3) - VP8ThreadContext thread_ctx_; // Thread context - - // dimension, in macroblock units. - int mb_w_, mb_h_; - - // Macroblock to process/filter, depending on cropping and filter_type. - int tl_mb_x_, tl_mb_y_; // top-left MB that must be in-loop filtered - int br_mb_x_, br_mb_y_; // last bottom-right MB that must be decoded - - // number of partitions minus one. - uint32_t num_parts_minus_one_; - // per-partition boolean decoders. - VP8BitReader parts_[MAX_NUM_PARTITIONS]; - - // Dithering strength, deduced from decoding options - int dither_; // whether to use dithering or not - VP8Random dithering_rg_; // random generator for dithering - - // dequantization (one set of DC/AC dequant factor per segment) - VP8QuantMatrix dqm_[NUM_MB_SEGMENTS]; - - // probabilities - VP8Proba proba_; - int use_skip_proba_; - uint8_t skip_p_; - - // Boundary data cache and persistent buffers. - uint8_t* intra_t_; // top intra modes values: 4 * mb_w_ - uint8_t intra_l_[4]; // left intra modes values - - VP8TopSamples* yuv_t_; // top y/u/v samples - - VP8MB* mb_info_; // contextual macroblock info (mb_w_ + 1) - VP8FInfo* f_info_; // filter strength info - uint8_t* yuv_b_; // main block for Y/U/V (size = YUV_SIZE) - - uint8_t* cache_y_; // macroblock row for storing unfiltered samples - uint8_t* cache_u_; - uint8_t* cache_v_; - int cache_y_stride_; - int cache_uv_stride_; - - // main memory chunk for the above data. Persistent. - void* mem_; - size_t mem_size_; - - // Per macroblock non-persistent infos. - int mb_x_, mb_y_; // current position, in macroblock units - VP8MBData* mb_data_; // parsed reconstruction data - - // Filtering side-info - int filter_type_; // 0=off, 1=simple, 2=complex - VP8FInfo fstrengths_[NUM_MB_SEGMENTS][2]; // precalculated per-segment/type - - // Alpha - struct ALPHDecoder* alph_dec_; // alpha-plane decoder object - const uint8_t* alpha_data_; // compressed alpha data (if present) - size_t alpha_data_size_; - int is_alpha_decoded_; // true if alpha_data_ is decoded in alpha_plane_ - uint8_t* alpha_plane_mem_; // memory allocated for alpha_plane_ - uint8_t* alpha_plane_; // output. Persistent, contains the whole data. - const uint8_t* alpha_prev_line_; // last decoded alpha row (or NULL) - int alpha_dithering_; // derived from decoding options (0=off, 100=full) -}; - -//------------------------------------------------------------------------------ -// internal functions. Not public. - -// in vp8.c -int VP8SetError(VP8Decoder* const dec, - VP8StatusCode error, const char* const msg); - -// in tree.c -void VP8ResetProba(VP8Proba* const proba); -void VP8ParseProba(VP8BitReader* const br, VP8Decoder* const dec); -// parses one row of intra mode data in partition 0, returns !eof -int VP8ParseIntraModeRow(VP8BitReader* const br, VP8Decoder* const dec); - -// in quant.c -void VP8ParseQuant(VP8Decoder* const dec); - -// in frame.c -int VP8InitFrame(VP8Decoder* const dec, VP8Io* const io); -// Call io->setup() and finish setting up scan parameters. -// After this call returns, one must always call VP8ExitCritical() with the -// same parameters. Both functions should be used in pair. Returns VP8_STATUS_OK -// if ok, otherwise sets and returns the error status on *dec. -VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io); -// Must always be called in pair with VP8EnterCritical(). -// Returns false in case of error. -int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io); -// Return the multi-threading method to use (0=off), depending -// on options and bitstream size. Only for lossy decoding. -int VP8GetThreadMethod(const WebPDecoderOptions* const options, - const WebPHeaderStructure* const headers, - int width, int height); -// Initialize dithering post-process if needed. -void VP8InitDithering(const WebPDecoderOptions* const options, - VP8Decoder* const dec); -// Process the last decoded row (filtering + output). -int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io); -// To be called at the start of a new scanline, to initialize predictors. -void VP8InitScanline(VP8Decoder* const dec); -// Decode one macroblock. Returns false if there is not enough data. -int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br); - -// in alpha.c -const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec, - const VP8Io* const io, - int row, int num_rows); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DEC_VP8I_DEC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8li_dec.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8li_dec.h deleted file mode 100644 index 0a4d613..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/vp8li_dec.h +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Lossless decoder: internal header. -// -// Author: Skal (pascal.massimino@gmail.com) -// Vikas Arora(vikaas.arora@gmail.com) - -#ifndef WEBP_DEC_VP8LI_DEC_H_ -#define WEBP_DEC_VP8LI_DEC_H_ - -#include // for memcpy() -#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" { -#endif - -typedef enum { - READ_DATA = 0, - READ_HDR = 1, - READ_DIM = 2 -} VP8LDecodeState; - -typedef struct VP8LTransform VP8LTransform; -struct VP8LTransform { - VP8LImageTransformType type_; // transform type. - int bits_; // subsampling bits defining transform window. - int xsize_; // transform window X index. - int ysize_; // transform window Y index. - uint32_t *data_; // transform data. -}; - -typedef struct { - int color_cache_size_; - VP8LColorCache color_cache_; - VP8LColorCache saved_color_cache_; // for incremental - - int huffman_mask_; - int huffman_subsample_bits_; - int huffman_xsize_; - uint32_t *huffman_image_; - int num_htree_groups_; - HTreeGroup *htree_groups_; - HuffmanCode *huffman_tables_; -} VP8LMetadata; - -typedef struct VP8LDecoder VP8LDecoder; -struct VP8LDecoder { - VP8StatusCode status_; - VP8LDecodeState state_; - VP8Io *io_; - - const WebPDecBuffer *output_; // shortcut to io->opaque->output - - 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. - - VP8LBitReader br_; - int incremental_; // if true, incremental decoding is expected - VP8LBitReader saved_br_; // note: could be local variables too - int saved_last_pixel_; - - int width_; - int height_; - int last_row_; // last input row decoded so far. - int last_pixel_; // last pixel decoded so far. However, it may - // not be transformed, scaled and - // color-converted yet. - int last_out_row_; // last row output so far. - - VP8LMetadata hdr_; - - int next_transform_; - VP8LTransform transforms_[NUM_TRANSFORMS]; - // 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. -}; - -//------------------------------------------------------------------------------ -// internal functions. Not public. - -struct ALPHDecoder; // Defined in dec/alphai.h. - -// in vp8l.c - -// Decodes image header for alpha data stored using lossless compression. -// Returns false in case of error. -int VP8LDecodeAlphaHeader(struct ALPHDecoder* const alph_dec, - const uint8_t* const data, size_t data_size); - -// Decodes *at least* 'last_row' rows of alpha. If some of the initial rows are -// already decoded in previous call(s), it will resume decoding from where it -// was paused. -// Returns false in case of bitstream error. -int VP8LDecodeAlphaImageStream(struct ALPHDecoder* const alph_dec, - int last_row); - -// Allocates and initialize a new lossless decoder instance. -VP8LDecoder* VP8LNew(void); - -// Decodes the image header. Returns false in case of error. -int VP8LDecodeHeader(VP8LDecoder* const dec, VP8Io* const io); - -// Decodes an image. It's required to decode the lossless header before calling -// this function. Returns false in case of error, with updated dec->status_. -int VP8LDecodeImage(VP8LDecoder* const dec); - -// Resets the decoder in its initial state, reclaiming memory. -// Preserves the dec->status_ value. -void VP8LClear(VP8LDecoder* const dec); - -// Clears and deallocate a lossless decoder instance. -void VP8LDelete(VP8LDecoder* const dec); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DEC_VP8LI_DEC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/webpi_dec.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/webpi_dec.h deleted file mode 100644 index 24baff5..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dec/webpi_dec.h +++ /dev/null @@ -1,133 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Internal header: WebP decoding parameters and custom IO on buffer -// -// Author: somnath@google.com (Somnath Banerjee) - -#ifndef WEBP_DEC_WEBPI_DEC_H_ -#define WEBP_DEC_WEBPI_DEC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "src/utils/rescaler_utils.h" -#include "src/dec/vp8_dec.h" - -//------------------------------------------------------------------------------ -// WebPDecParams: Decoding output parameters. Transient internal object. - -typedef struct WebPDecParams WebPDecParams; -typedef int (*OutputFunc)(const VP8Io* const io, WebPDecParams* const p); -typedef int (*OutputAlphaFunc)(const VP8Io* const io, WebPDecParams* const p, - int expected_num_out_lines); -typedef int (*OutputRowFunc)(WebPDecParams* const p, int y_pos, - int max_out_lines); - -struct WebPDecParams { - WebPDecBuffer* output; // output buffer. - uint8_t* tmp_y, *tmp_u, *tmp_v; // cache for the fancy upsampler - // or used for tmp rescaling - - int last_y; // coordinate of the line that was last output - const WebPDecoderOptions* options; // if not NULL, use alt decoding features - - WebPRescaler* scaler_y, *scaler_u, *scaler_v, *scaler_a; // rescalers - void* memory; // overall scratch memory for the output work. - - OutputFunc emit; // output RGB or YUV samples - OutputAlphaFunc emit_alpha; // output alpha channel - OutputRowFunc emit_alpha_row; // output one line of rescaled alpha values -}; - -// Should be called first, before any use of the WebPDecParams object. -void WebPResetDecParams(WebPDecParams* const params); - -//------------------------------------------------------------------------------ -// Header parsing helpers - -// Structure storing a description of the RIFF headers. -typedef struct { - const uint8_t* data; // input buffer - size_t data_size; // input buffer size - int have_all_data; // true if all data is known to be available - size_t offset; // offset to main data chunk (VP8 or VP8L) - const uint8_t* alpha_data; // points to alpha chunk (if present) - size_t alpha_data_size; // alpha chunk size - size_t compressed_size; // VP8/VP8L compressed data size - size_t riff_size; // size of the riff payload (or 0 if absent) - int is_lossless; // true if a VP8L chunk is present -} WebPHeaderStructure; - -// Skips over all valid chunks prior to the first VP8/VP8L frame header. -// Returns: VP8_STATUS_OK, VP8_STATUS_BITSTREAM_ERROR (invalid header/chunk), -// VP8_STATUS_NOT_ENOUGH_DATA (partial input) or VP8_STATUS_UNSUPPORTED_FEATURE -// in the case of non-decodable features (animation for instance). -// In 'headers', compressed_size, offset, alpha_data, alpha_size, and lossless -// fields are updated appropriately upon success. -VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers); - -//------------------------------------------------------------------------------ -// Misc utils - -// Initializes VP8Io with custom setup, io and teardown functions. The default -// hooks will use the supplied 'params' as io->opaque handle. -void WebPInitCustomIo(WebPDecParams* const params, VP8Io* const io); - -// Setup crop_xxx fields, mb_w and mb_h in io. 'src_colorspace' refers -// to the *compressed* format, not the output one. -int WebPIoInitFromOptions(const WebPDecoderOptions* const options, - VP8Io* const io, WEBP_CSP_MODE src_colorspace); - -//------------------------------------------------------------------------------ -// Internal functions regarding WebPDecBuffer memory (in buffer.c). -// Don't really need to be externally visible for now. - -// Prepare 'buffer' with the requested initial dimensions width/height. -// If no external storage is supplied, initializes buffer by allocating output -// memory and setting up the stride information. Validate the parameters. Return -// an error code in case of problem (no memory, or invalid stride / size / -// dimension / etc.). If *options is not NULL, also verify that the options' -// parameters are valid and apply them to the width/height dimensions of the -// output buffer. This takes cropping / scaling / rotation into account. -// Also incorporates the options->flip flag to flip the buffer parameters if -// needed. -VP8StatusCode WebPAllocateDecBuffer(int width, int height, - const WebPDecoderOptions* const options, - WebPDecBuffer* const buffer); - -// Flip buffer vertically by negating the various strides. -VP8StatusCode WebPFlipBuffer(WebPDecBuffer* const buffer); - -// Copy 'src' into 'dst' buffer, making sure 'dst' is not marked as owner of the -// memory (still held by 'src'). No pixels are copied. -void WebPCopyDecBuffer(const WebPDecBuffer* const src, - WebPDecBuffer* const dst); - -// Copy and transfer ownership from src to dst (beware of parameter order!) -void WebPGrabDecBuffer(WebPDecBuffer* const src, WebPDecBuffer* const dst); - -// Copy pixels from 'src' into a *preallocated* 'dst' buffer. Returns -// VP8_STATUS_INVALID_PARAM if the 'dst' is not set up correctly for the copy. -VP8StatusCode WebPCopyDecBufferPixels(const WebPDecBuffer* const src, - WebPDecBuffer* const dst); - -// Returns true if decoding will be slow with the current configuration -// and bitstream features. -int WebPAvoidSlowMemory(const WebPDecBuffer* const output, - const WebPBitstreamFeatures* const features); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DEC_WEBPI_DEC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse2.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse2.h deleted file mode 100644 index e9f1ebf..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse2.h +++ /dev/null @@ -1,194 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// SSE2 code common to several files. -// -// Author: Vincent Rabaud (vrabaud@google.com) - -#ifndef WEBP_DSP_COMMON_SSE2_H_ -#define WEBP_DSP_COMMON_SSE2_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(WEBP_USE_SSE2) - -#include - -//------------------------------------------------------------------------------ -// Quite useful macro for debugging. Left here for convenience. - -#if 0 -#include -static WEBP_INLINE void PrintReg(const __m128i r, const char* const name, - int size) { - int n; - union { - __m128i r; - uint8_t i8[16]; - uint16_t i16[8]; - uint32_t i32[4]; - uint64_t i64[2]; - } tmp; - tmp.r = r; - fprintf(stderr, "%s\t: ", name); - if (size == 8) { - for (n = 0; n < 16; ++n) fprintf(stderr, "%.2x ", tmp.i8[n]); - } else if (size == 16) { - for (n = 0; n < 8; ++n) fprintf(stderr, "%.4x ", tmp.i16[n]); - } else if (size == 32) { - for (n = 0; n < 4; ++n) fprintf(stderr, "%.8x ", tmp.i32[n]); - } else { - for (n = 0; n < 2; ++n) fprintf(stderr, "%.16lx ", tmp.i64[n]); - } - fprintf(stderr, "\n"); -} -#endif - -//------------------------------------------------------------------------------ -// Math functions. - -// Return the sum of all the 8b in the register. -static WEBP_INLINE int VP8HorizontalAdd8b(const __m128i* const a) { - const __m128i zero = _mm_setzero_si128(); - const __m128i sad8x2 = _mm_sad_epu8(*a, zero); - // sum the two sads: sad8x2[0:1] + sad8x2[8:9] - const __m128i sum = _mm_add_epi32(sad8x2, _mm_shuffle_epi32(sad8x2, 2)); - return _mm_cvtsi128_si32(sum); -} - -// Transpose two 4x4 16b matrices horizontally stored in registers. -static WEBP_INLINE void VP8Transpose_2_4x4_16b( - const __m128i* const in0, const __m128i* const in1, - const __m128i* const in2, const __m128i* const in3, __m128i* const out0, - __m128i* const out1, __m128i* const out2, __m128i* const out3) { - // Transpose the two 4x4. - // a00 a01 a02 a03 b00 b01 b02 b03 - // a10 a11 a12 a13 b10 b11 b12 b13 - // a20 a21 a22 a23 b20 b21 b22 b23 - // a30 a31 a32 a33 b30 b31 b32 b33 - const __m128i transpose0_0 = _mm_unpacklo_epi16(*in0, *in1); - const __m128i transpose0_1 = _mm_unpacklo_epi16(*in2, *in3); - const __m128i transpose0_2 = _mm_unpackhi_epi16(*in0, *in1); - const __m128i transpose0_3 = _mm_unpackhi_epi16(*in2, *in3); - // a00 a10 a01 a11 a02 a12 a03 a13 - // a20 a30 a21 a31 a22 a32 a23 a33 - // b00 b10 b01 b11 b02 b12 b03 b13 - // b20 b30 b21 b31 b22 b32 b23 b33 - const __m128i transpose1_0 = _mm_unpacklo_epi32(transpose0_0, transpose0_1); - const __m128i transpose1_1 = _mm_unpacklo_epi32(transpose0_2, transpose0_3); - const __m128i transpose1_2 = _mm_unpackhi_epi32(transpose0_0, transpose0_1); - const __m128i transpose1_3 = _mm_unpackhi_epi32(transpose0_2, transpose0_3); - // a00 a10 a20 a30 a01 a11 a21 a31 - // b00 b10 b20 b30 b01 b11 b21 b31 - // a02 a12 a22 a32 a03 a13 a23 a33 - // b02 b12 a22 b32 b03 b13 b23 b33 - *out0 = _mm_unpacklo_epi64(transpose1_0, transpose1_1); - *out1 = _mm_unpackhi_epi64(transpose1_0, transpose1_1); - *out2 = _mm_unpacklo_epi64(transpose1_2, transpose1_3); - *out3 = _mm_unpackhi_epi64(transpose1_2, transpose1_3); - // a00 a10 a20 a30 b00 b10 b20 b30 - // a01 a11 a21 a31 b01 b11 b21 b31 - // a02 a12 a22 a32 b02 b12 b22 b32 - // a03 a13 a23 a33 b03 b13 b23 b33 -} - -//------------------------------------------------------------------------------ -// Channel mixing. - -// Function used several times in VP8PlanarTo24b. -// It samples the in buffer as follows: one every two unsigned char is stored -// at the beginning of the buffer, while the other half is stored at the end. -#define VP8PlanarTo24bHelper(IN, OUT) \ - do { \ - const __m128i v_mask = _mm_set1_epi16(0x00ff); \ - /* Take one every two upper 8b values.*/ \ - (OUT##0) = _mm_packus_epi16(_mm_and_si128((IN##0), v_mask), \ - _mm_and_si128((IN##1), v_mask)); \ - (OUT##1) = _mm_packus_epi16(_mm_and_si128((IN##2), v_mask), \ - _mm_and_si128((IN##3), v_mask)); \ - (OUT##2) = _mm_packus_epi16(_mm_and_si128((IN##4), v_mask), \ - _mm_and_si128((IN##5), v_mask)); \ - /* Take one every two lower 8b values.*/ \ - (OUT##3) = _mm_packus_epi16(_mm_srli_epi16((IN##0), 8), \ - _mm_srli_epi16((IN##1), 8)); \ - (OUT##4) = _mm_packus_epi16(_mm_srli_epi16((IN##2), 8), \ - _mm_srli_epi16((IN##3), 8)); \ - (OUT##5) = _mm_packus_epi16(_mm_srli_epi16((IN##4), 8), \ - _mm_srli_epi16((IN##5), 8)); \ - } while (0) - -// 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_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 - // 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 - __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; - VP8PlanarTo24bHelper(*in, tmp); - VP8PlanarTo24bHelper(tmp, *in); - VP8PlanarTo24bHelper(*in, tmp); - // We need to do it two more times than the example as we have sixteen bytes. - { - __m128i out0, out1, out2, out3, out4, out5; - VP8PlanarTo24bHelper(tmp, out); - VP8PlanarTo24bHelper(out, *in); - } -} - -#undef VP8PlanarTo24bHelper - -// Convert four packed four-channel buffers like argbargbargbargb... into the -// split channels aaaaa ... rrrr ... gggg .... bbbbb ...... -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); - const __m128i A2 = _mm_unpacklo_epi8(*in2, *in3); - const __m128i A3 = _mm_unpackhi_epi8(*in2, *in3); - const __m128i B0 = _mm_unpacklo_epi8(A0, A1); - const __m128i B1 = _mm_unpackhi_epi8(A0, A1); - const __m128i B2 = _mm_unpacklo_epi8(A2, A3); - const __m128i B3 = _mm_unpackhi_epi8(A2, A3); - // C0 = g7 g6 ... g1 g0 | b7 b6 ... b1 b0 - // C1 = a7 a6 ... a1 a0 | r7 r6 ... r1 r0 - const __m128i C0 = _mm_unpacklo_epi8(B0, B1); - const __m128i C1 = _mm_unpackhi_epi8(B0, B1); - const __m128i C2 = _mm_unpacklo_epi8(B2, B3); - const __m128i C3 = _mm_unpackhi_epi8(B2, B3); - // Gather the channels. - *in0 = _mm_unpackhi_epi64(C1, C3); - *in1 = _mm_unpacklo_epi64(C1, C3); - *in2 = _mm_unpackhi_epi64(C0, C2); - *in3 = _mm_unpacklo_epi64(C0, C2); -} - -#endif // WEBP_USE_SSE2 - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DSP_COMMON_SSE2_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse41.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse41.h deleted file mode 100644 index 2f173c0..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/common_sse41.h +++ /dev/null @@ -1,132 +0,0 @@ -// 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/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/dsp.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/dsp.h deleted file mode 100644 index fafc2d0..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/dsp.h +++ /dev/null @@ -1,678 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Speed-critical functions. -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_DSP_DSP_H_ -#define WEBP_DSP_DSP_H_ - -#ifdef HAVE_CONFIG_H -#include "src/webp/config.h" -#endif - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define BPS 32 // this is the common stride for enc/dec - -//------------------------------------------------------------------------------ -// CPU detection - -#if defined(__GNUC__) -# define LOCAL_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__) -# define LOCAL_GCC_PREREQ(maj, min) \ - (LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) -#else -# define LOCAL_GCC_VERSION 0 -# 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 -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1500 && \ - (defined(_M_X64) || defined(_M_IX86)) -#define WEBP_MSC_SSE41 // Visual C++ SSE4.1 targets -#endif - -// WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp -// files without intrinsics, allowing the corresponding Init() to be called. -// Files containing intrinsics will need to be built targeting the instruction -// set so should succeed on one of the earlier tests. -#if defined(__SSE2__) || defined(WEBP_MSC_SSE2) || defined(WEBP_HAVE_SSE2) -#define WEBP_USE_SSE2 -#endif - -#if defined(__SSE4_1__) || defined(WEBP_MSC_SSE41) || defined(WEBP_HAVE_SSE41) -#define WEBP_USE_SSE41 -#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(__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 -#endif - -#if defined(__mips__) && !defined(__mips64) && \ - defined(__mips_isa_rev) && (__mips_isa_rev >= 1) && (__mips_isa_rev < 6) -#define WEBP_USE_MIPS32 -#if (__mips_isa_rev >= 2) -#define WEBP_USE_MIPS32_R2 -#if defined(__mips_dspr2) || (defined(__mips_dsp_rev) && __mips_dsp_rev >= 2) -#define WEBP_USE_MIPS_DSP_R2 -#endif -#endif -#endif - -#if defined(__mips_msa) && defined(__mips_isa_rev) && (__mips_isa_rev >= 5) -#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) -#if __has_feature(thread_sanitizer) -#undef WEBP_TSAN_IGNORE_FUNCTION -#define WEBP_TSAN_IGNORE_FUNCTION __attribute__((no_sanitize_thread)) -#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) -#if __has_attribute(no_sanitize) -// This macro prevents the undefined behavior sanitizer from reporting -// failures. This is only meant to silence unaligned loads on platforms that -// are known to support them. -#undef WEBP_UBSAN_IGNORE_UNDEF -#define WEBP_UBSAN_IGNORE_UNDEF \ - __attribute__((no_sanitize("undefined"))) - -// This macro prevents the undefined behavior sanitizer from reporting -// failures related to unsigned integer overflows. This is only meant to -// silence cases where this well defined behavior is expected. -#undef WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW -#define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW \ - __attribute__((no_sanitize("unsigned-integer-overflow"))) -#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, - kSlowSSSE3, // special feature for slow SSSE3 architectures - kSSE4_1, - kAVX, - kAVX2, - kNEON, - kMIPS32, - kMIPSdspR2, - kMSA -} CPUFeature; -// returns true if the CPU supports the feature. -typedef int (*VP8CPUInfo)(CPUFeature feature); -WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo; - -//------------------------------------------------------------------------------ -// Init stub generator - -// Defines an init function stub to ensure each module exposes a symbol, -// avoiding a compiler warning. -#define WEBP_DSP_INIT_STUB(func) \ - extern void func(void); \ - void func(void) {} - -//------------------------------------------------------------------------------ -// Encoding - -// Transforms -// VP8Idct: Does one of two inverse transforms. If do_two is set, the transforms -// will be done for (ref, in, dst) and (ref + 4, in + 16, dst + 4). -typedef void (*VP8Idct)(const uint8_t* ref, const int16_t* in, uint8_t* dst, - int do_two); -typedef void (*VP8Fdct)(const uint8_t* src, const uint8_t* ref, int16_t* out); -typedef void (*VP8WHT)(const int16_t* in, int16_t* out); -extern VP8Idct VP8ITransform; -extern VP8Fdct VP8FTransform; -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, - const uint8_t* top); -typedef void (*VP8Intra4Preds)(uint8_t *dst, const uint8_t* top); -extern VP8Intra4Preds VP8EncPredLuma4; -extern VP8IntraPreds VP8EncPredLuma16; -extern VP8IntraPreds VP8EncPredChroma8; - -typedef int (*VP8Metric)(const uint8_t* pix, const uint8_t* ref); -extern VP8Metric VP8SSE16x16, VP8SSE16x8, VP8SSE8x8, VP8SSE4x4; -typedef int (*VP8WMetric)(const uint8_t* pix, const uint8_t* ref, - const uint16_t* const weights); -// The weights for VP8TDisto4x4 and VP8TDisto16x16 contain a row-major -// 4 by 4 symmetric matrix. -extern VP8WMetric VP8TDisto4x4, VP8TDisto16x16; - -// Compute the average (DC) of four 4x4 blocks. -// Each sub-4x4 block #i sum is stored in dc[i]. -typedef void (*VP8MeanMetric)(const uint8_t* ref, uint32_t dc[4]); -extern VP8MeanMetric VP8Mean16x4; - -typedef void (*VP8BlockCopy)(const uint8_t* src, uint8_t* dst); -extern VP8BlockCopy VP8Copy4x4; -extern VP8BlockCopy VP8Copy16x8; -// Quantization -struct VP8Matrix; // forward declaration -typedef int (*VP8QuantizeBlock)(int16_t in[16], int16_t out[16], - const struct VP8Matrix* const mtx); -// Same as VP8QuantizeBlock, but quantizes two consecutive blocks. -typedef int (*VP8Quantize2Blocks)(int16_t in[32], int16_t out[32], - const struct VP8Matrix* const mtx); - -extern VP8QuantizeBlock VP8EncQuantizeBlock; -extern VP8Quantize2Blocks VP8EncQuantize2Blocks; - -// specific to 2nd transform: -typedef int (*VP8QuantizeBlockWHT)(int16_t in[16], int16_t out[16], - const struct VP8Matrix* const mtx); -extern VP8QuantizeBlockWHT VP8EncQuantizeBlockWHT; - -extern const int VP8DspScan[16 + 4 + 4]; - -// Collect histogram for susceptibility calculation. -#define MAX_COEFF_THRESH 31 // size of histogram used by CollectHistogram. -typedef struct { - // We only need to store max_value and last_non_zero, not the distribution. - int max_value; - int last_non_zero; -} VP8Histogram; -typedef void (*VP8CHisto)(const uint8_t* ref, const uint8_t* pred, - int start_block, int end_block, - VP8Histogram* const histo); -extern VP8CHisto VP8CollectHistogram; -// General-purpose util function to help VP8CollectHistogram(). -void VP8SetHistogramData(const int distribution[MAX_COEFF_THRESH + 1], - VP8Histogram* const histo); - -// must be called before using any of the above -void VP8EncDspInit(void); - -//------------------------------------------------------------------------------ -// cost functions (encoding) - -extern const uint16_t VP8EntropyCost[256]; // 8bit fixed-point log(p) -// approximate cost per level: -extern const uint16_t VP8LevelFixedCosts[2047 /*MAX_LEVEL*/ + 1]; -extern const uint8_t VP8EncBands[16 + 1]; - -struct VP8Residual; -typedef void (*VP8SetResidualCoeffsFunc)(const int16_t* const coeffs, - struct VP8Residual* const res); -extern VP8SetResidualCoeffsFunc VP8SetResidualCoeffs; - -// Cost calculation function. -typedef int (*VP8GetResidualCostFunc)(int ctx0, - const struct VP8Residual* const res); -extern VP8GetResidualCostFunc VP8GetResidualCost; - -// must be called before anything using the above -void VP8EncDspCostInit(void); - -//------------------------------------------------------------------------------ -// SSIM / PSNR utils - -// struct for accumulating statistical moments -typedef struct { - uint32_t w; // sum(w_i) : sum of weights - uint32_t xm, ym; // sum(w_i * x_i), sum(w_i * y_i) - uint32_t xxm, xym, yym; // sum(w_i * x_i * x_i), etc. -} VP8DistoStats; - -// Compute the final SSIM value -// The non-clipped version assumes stats->w = (2 * VP8_SSIM_KERNEL + 1)^2. -double VP8SSIMFromStats(const VP8DistoStats* const stats); -double VP8SSIMFromStatsClipped(const VP8DistoStats* const stats); - -#define VP8_SSIM_KERNEL 3 // total size of the kernel: 2 * VP8_SSIM_KERNEL + 1 -typedef double (*VP8SSIMGetClippedFunc)(const uint8_t* src1, int stride1, - const uint8_t* src2, int stride2, - 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, - const uint8_t* src2, int stride2); - -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); - -//------------------------------------------------------------------------------ -// Decoding - -typedef void (*VP8DecIdct)(const int16_t* coeffs, uint8_t* dst); -// when doing two transforms, coeffs is actually int16_t[2][16]. -typedef void (*VP8DecIdct2)(const int16_t* coeffs, uint8_t* dst, int do_two); -extern VP8DecIdct2 VP8Transform; -extern VP8DecIdct VP8TransformAC3; -extern VP8DecIdct VP8TransformUV; -extern VP8DecIdct VP8TransformDC; -extern VP8DecIdct VP8TransformDCUV; -extern VP8WHT VP8TransformWHT; - -// *dst is the destination block, with stride BPS. Boundary samples are -// assumed accessible when needed. -typedef void (*VP8PredFunc)(uint8_t* dst); -extern VP8PredFunc VP8PredLuma16[/* NUM_B_DC_MODES */]; -extern VP8PredFunc VP8PredChroma8[/* NUM_B_DC_MODES */]; -extern VP8PredFunc VP8PredLuma4[/* NUM_BMODES */]; - -// clipping tables (for filtering) -extern const int8_t* const VP8ksclip1; // clips [-1020, 1020] to [-128, 127] -extern const int8_t* const VP8ksclip2; // clips [-112, 112] to [-16, 15] -extern const uint8_t* const VP8kclip1; // clips [-255,511] to [0,255] -extern const uint8_t* const VP8kabs0; // abs(x) for x in [-255,255] -// must be called first -void VP8InitClipTables(void); - -// simple filter (only for luma) -typedef void (*VP8SimpleFilterFunc)(uint8_t* p, int stride, int thresh); -extern VP8SimpleFilterFunc VP8SimpleVFilter16; -extern VP8SimpleFilterFunc VP8SimpleHFilter16; -extern VP8SimpleFilterFunc VP8SimpleVFilter16i; // filter 3 inner edges -extern VP8SimpleFilterFunc VP8SimpleHFilter16i; - -// regular filter (on both macroblock edges and inner edges) -typedef void (*VP8LumaFilterFunc)(uint8_t* luma, int stride, - int thresh, int ithresh, int hev_t); -typedef void (*VP8ChromaFilterFunc)(uint8_t* u, uint8_t* v, int stride, - int thresh, int ithresh, int hev_t); -// on outer edge -extern VP8LumaFilterFunc VP8VFilter16; -extern VP8LumaFilterFunc VP8HFilter16; -extern VP8ChromaFilterFunc VP8VFilter8; -extern VP8ChromaFilterFunc VP8HFilter8; - -// on inner edge -extern VP8LumaFilterFunc VP8VFilter16i; // filtering 3 inner edges altogether -extern VP8LumaFilterFunc VP8HFilter16i; -extern VP8ChromaFilterFunc VP8VFilter8i; // filtering u and v altogether -extern VP8ChromaFilterFunc VP8HFilter8i; - -// Dithering. Combines dithering values (centered around 128) with dst[], -// according to: dst[] = clip(dst[] + (((dither[]-128) + 8) >> 4) -#define VP8_DITHER_DESCALE 4 -#define VP8_DITHER_DESCALE_ROUNDER (1 << (VP8_DITHER_DESCALE - 1)) -#define VP8_DITHER_AMP_BITS 7 -#define VP8_DITHER_AMP_CENTER (1 << VP8_DITHER_AMP_BITS) -extern void (*VP8DitherCombine8x8)(const uint8_t* dither, uint8_t* dst, - int dst_stride); - -// must be called before anything using the above -void VP8DspInit(void); - -//------------------------------------------------------------------------------ -// WebP I/O - -#define FANCY_UPSAMPLING // undefined to remove fancy upsampling support - -// Convert a pair of y/u/v lines together to the output rgb/a colorspace. -// bottom_y can be NULL if only one line of output is needed (at top/bottom). -typedef void (*WebPUpsampleLinePairFunc)( - 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); - -#ifdef FANCY_UPSAMPLING - -// Fancy upsampling functions to convert YUV to RGB(A) modes -extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */]; - -#endif // FANCY_UPSAMPLING - -// Per-row point-sampling methods. -typedef void (*WebPSamplerRowFunc)(const uint8_t* y, - const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len); -// Generic function to apply 'WebPSamplerRowFunc' to the whole plane: -void WebPSamplerProcessPlane(const uint8_t* y, int y_stride, - const uint8_t* u, const uint8_t* v, int uv_stride, - uint8_t* dst, int dst_stride, - int width, int height, WebPSamplerRowFunc func); - -// Sampling functions to convert rows of YUV to RGB(A) -extern WebPSamplerRowFunc WebPSamplers[/* MODE_LAST */]; - -// General function for converting two lines of ARGB or RGBA. -// 'alpha_is_last' should be true if 0xff000000 is stored in memory as -// as 0x00, 0x00, 0x00, 0xff (little endian). -WebPUpsampleLinePairFunc WebPGetLinePairConverter(int alpha_is_last); - -// YUV444->RGB converters -typedef void (*WebPYUV444Converter)(const uint8_t* y, - const uint8_t* u, const uint8_t* v, - uint8_t* dst, int len); - -extern WebPYUV444Converter WebPYUV444Converters[/* MODE_LAST */]; - -// Must be called before using the WebPUpsamplers[] (and for premultiplied -// colorspaces like rgbA, rgbA4444, etc) -void WebPInitUpsamplers(void); -// Must be called before using WebPSamplers[] -void WebPInitSamplers(void); -// Must be called before using WebPYUV444Converters[] -void WebPInitYUV444Converters(void); - -//------------------------------------------------------------------------------ -// ARGB -> YUV converters - -// Convert ARGB samples to luma Y. -extern void (*WebPConvertARGBToY)(const uint32_t* argb, uint8_t* y, int width); -// Convert ARGB samples to U/V with downsampling. do_store should be '1' for -// even lines and '0' for odd ones. 'src_width' is the original width, not -// the U/V one. -extern void (*WebPConvertARGBToUV)(const uint32_t* argb, uint8_t* u, uint8_t* v, - int src_width, int do_store); - -// Convert a row of accumulated (four-values) of rgba32 toward U/V -extern void (*WebPConvertRGBA32ToUV)(const uint16_t* rgb, - uint8_t* u, uint8_t* v, int width); - -// Convert RGB or BGR to Y -extern void (*WebPConvertRGB24ToY)(const uint8_t* rgb, uint8_t* y, int width); -extern void (*WebPConvertBGR24ToY)(const uint8_t* bgr, uint8_t* y, int width); - -// used for plain-C fallback. -extern void WebPConvertARGBToUV_C(const uint32_t* argb, uint8_t* u, uint8_t* v, - int src_width, int do_store); -extern void WebPConvertRGBA32ToUV_C(const uint16_t* rgb, - uint8_t* u, uint8_t* v, int width); - -// utilities for accurate RGB->YUV conversion -extern uint64_t (*WebPSharpYUVUpdateY)(const uint16_t* src, const uint16_t* ref, - uint16_t* dst, int len); -extern void (*WebPSharpYUVUpdateRGB)(const int16_t* src, const int16_t* ref, - int16_t* dst, int len); -extern void (*WebPSharpYUVFilterRow)(const int16_t* A, const int16_t* B, - int len, - const uint16_t* best_y, uint16_t* out); - -// Must be called before using the above. -void WebPInitConvertARGBToYUV(void); - -//------------------------------------------------------------------------------ -// Rescaler - -struct WebPRescaler; - -// Import a row of data and save its contribution in the rescaler. -// 'channel' denotes the channel number to be imported. 'Expand' corresponds to -// the wrk->x_expand case. Otherwise, 'Shrink' is to be used. -typedef void (*WebPRescalerImportRowFunc)(struct WebPRescaler* const wrk, - const uint8_t* src); - -extern WebPRescalerImportRowFunc WebPRescalerImportRowExpand; -extern WebPRescalerImportRowFunc WebPRescalerImportRowShrink; - -// Export one row (starting at x_out position) from rescaler. -// 'Expand' corresponds to the wrk->y_expand case. -// Otherwise 'Shrink' is to be used -typedef void (*WebPRescalerExportRowFunc)(struct WebPRescaler* const wrk); -extern WebPRescalerExportRowFunc WebPRescalerExportRowExpand; -extern WebPRescalerExportRowFunc WebPRescalerExportRowShrink; - -// Plain-C implementation, as fall-back. -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, - const uint8_t* src); -// Export one row (starting at x_out position) from rescaler. -extern void WebPRescalerExportRow(struct WebPRescaler* const wrk); - -// Must be called first before using the above. -void WebPRescalerDspInit(void); - -//------------------------------------------------------------------------------ -// Utilities for processing transparent channel. - -// Apply alpha pre-multiply on an rgba, bgra or argb plane of size w * h. -// alpha_first should be 0 for argb, 1 for rgba or bgra (where alpha is last). -extern void (*WebPApplyAlphaMultiply)( - uint8_t* rgba, int alpha_first, int w, int h, int stride); - -// Same, buf specifically for RGBA4444 format -extern void (*WebPApplyAlphaMultiply4444)( - uint8_t* rgba4444, int w, int h, int stride); - -// Dispatch the values from alpha[] plane to the ARGB destination 'dst'. -// Returns true if alpha[] plane has non-trivial values different from 0xff. -extern int (*WebPDispatchAlpha)(const uint8_t* alpha, int alpha_stride, - int width, int height, - uint8_t* dst, int dst_stride); - -// Transfer packed 8b alpha[] values to green channel in dst[], zero'ing the -// A/R/B values. 'dst_stride' is the stride for dst[] in uint32_t units. -extern void (*WebPDispatchAlphaToGreen)(const uint8_t* alpha, int alpha_stride, - int width, int height, - uint32_t* dst, int dst_stride); - -// Extract the alpha values from 32b values in argb[] and pack them into alpha[] -// (this is the opposite of WebPDispatchAlpha). -// Returns true if there's only trivial 0xff alpha values. -extern int (*WebPExtractAlpha)(const uint8_t* argb, int argb_stride, - int width, int height, - uint8_t* alpha, int alpha_stride); - -// Extract the green values from 32b values in argb[] and pack them into alpha[] -// (this is the opposite of WebPDispatchAlphaToGreen). -extern void (*WebPExtractGreen)(const uint32_t* argb, uint8_t* alpha, int size); - -// Pre-Multiply operation transforms x into x * A / 255 (where x=Y,R,G or B). -// Un-Multiply operation transforms x into x * 255 / A. - -// Pre-Multiply or Un-Multiply (if 'inverse' is true) argb values in a row. -extern void (*WebPMultARGBRow)(uint32_t* const ptr, int width, int inverse); - -// Same a WebPMultARGBRow(), but for several rows. -void WebPMultARGBRows(uint8_t* ptr, int stride, int width, int num_rows, - int inverse); - -// Same for a row of single values, with side alpha values. -extern void (*WebPMultRow)(uint8_t* const ptr, const uint8_t* const alpha, - int width, int inverse); - -// Same a WebPMultRow(), but for several 'num_rows' rows. -void WebPMultRows(uint8_t* ptr, int stride, - const uint8_t* alpha, int alpha_stride, - int width, int num_rows, int inverse); - -// Plain-C versions, used as fallback by some implementations. -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 (*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 (*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 WebPInitAlphaProcessing(void); - -//------------------------------------------------------------------------------ -// Filter functions - -typedef enum { // Filter types. - WEBP_FILTER_NONE = 0, - WEBP_FILTER_HORIZONTAL, - WEBP_FILTER_VERTICAL, - WEBP_FILTER_GRADIENT, - WEBP_FILTER_LAST = WEBP_FILTER_GRADIENT + 1, // end marker - WEBP_FILTER_BEST, // meta-types - WEBP_FILTER_FAST -} WEBP_FILTER_TYPE; - -typedef void (*WebPFilterFunc)(const uint8_t* in, int width, int height, - int stride, uint8_t* out); -// In-place un-filtering. -// Warning! 'prev_line' pointer can be equal to 'cur_line' or 'preds'. -typedef void (*WebPUnfilterFunc)(const uint8_t* prev_line, const uint8_t* preds, - uint8_t* cur_line, int width); - -// Filter the given data using the given predictor. -// 'in' corresponds to a 2-dimensional pixel array of size (stride * height) -// in raster order. -// 'stride' is number of bytes per scan line (with possible padding). -// 'out' should be pre-allocated. -extern WebPFilterFunc WebPFilters[WEBP_FILTER_LAST]; - -// In-place reconstruct the original data from the given filtered data. -// The reconstruction will be done for 'num_rows' rows starting from 'row' -// (assuming rows upto 'row - 1' are already reconstructed). -extern WebPUnfilterFunc WebPUnfilters[WEBP_FILTER_LAST]; - -// To be called first before using the above. -void VP8FiltersInit(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DSP_DSP_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless.h deleted file mode 100644 index f709cc8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless.h +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Image transforms and color space conversion methods for lossless decoder. -// -// Authors: Vikas Arora (vikaas.arora@gmail.com) -// Jyrki Alakuijala (jyrki@google.com) - -#ifndef WEBP_DSP_LOSSLESS_H_ -#define WEBP_DSP_LOSSLESS_H_ - -#include "src/webp/types.h" -#include "src/webp/decode.h" - -#include "src/enc/histogram_enc.h" -#include "src/utils/utils.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//------------------------------------------------------------------------------ -// Decoding - -typedef uint32_t (*VP8LPredictorFunc)(uint32_t left, const uint32_t* const top); -extern VP8LPredictorFunc VP8LPredictors[16]; -extern VP8LPredictorFunc VP8LPredictors_C[16]; -// These Add/Sub function expects upper[-1] and out[-1] to be readable. -typedef void (*VP8LPredictorAddSubFunc)(const uint32_t* in, - const uint32_t* upper, int num_pixels, - uint32_t* out); -extern VP8LPredictorAddSubFunc VP8LPredictorsAdd[16]; -extern VP8LPredictorAddSubFunc VP8LPredictorsAdd_C[16]; - -typedef void (*VP8LProcessDecBlueAndRedFunc)(const uint32_t* src, - int num_pixels, uint32_t* dst); -extern VP8LProcessDecBlueAndRedFunc VP8LAddGreenToBlueAndRed; - -typedef struct { - // Note: the members are uint8_t, so that any negative values are - // automatically converted to "mod 256" values. - uint8_t green_to_red_; - uint8_t green_to_blue_; - uint8_t red_to_blue_; -} VP8LMultipliers; -typedef void (*VP8LTransformColorInverseFunc)(const VP8LMultipliers* const m, - const uint32_t* src, - int num_pixels, uint32_t* dst); -extern VP8LTransformColorInverseFunc VP8LTransformColorInverse; - -struct VP8LTransform; // Defined in dec/vp8li.h. - -// Performs inverse transform of data given transform information, start and end -// rows. Transform will be applied to rows [row_start, row_end[. -// The *in and *out pointers refer to source and destination data respectively -// corresponding to the intermediate row (row_start). -void VP8LInverseTransform(const struct VP8LTransform* const transform, - int row_start, int row_end, - const uint32_t* const in, uint32_t* const out); - -// Color space conversion. -typedef void (*VP8LConvertFunc)(const uint32_t* src, int num_pixels, - uint8_t* dst); -extern VP8LConvertFunc VP8LConvertBGRAToRGB; -extern VP8LConvertFunc VP8LConvertBGRAToRGBA; -extern VP8LConvertFunc VP8LConvertBGRAToRGBA4444; -extern VP8LConvertFunc VP8LConvertBGRAToRGB565; -extern VP8LConvertFunc VP8LConvertBGRAToBGR; - -// Converts from BGRA to other color spaces. -void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels, - WEBP_CSP_MODE out_colorspace, uint8_t* const rgba); - -typedef void (*VP8LMapARGBFunc)(const uint32_t* src, - const uint32_t* const color_map, - uint32_t* dst, int y_start, - int y_end, int width); -typedef void (*VP8LMapAlphaFunc)(const uint8_t* src, - const uint32_t* const color_map, - uint8_t* dst, int y_start, - int y_end, int width); - -extern VP8LMapARGBFunc VP8LMapColor32b; -extern VP8LMapAlphaFunc VP8LMapColor8b; - -// Similar to the static method ColorIndexInverseTransform() that is part of -// lossless.c, but used only for alpha decoding. It takes uint8_t (rather than -// uint32_t) arguments for 'src' and 'dst'. -void VP8LColorIndexInverseTransformAlpha( - const struct VP8LTransform* const transform, int y_start, int y_end, - const uint8_t* src, uint8_t* dst); - -// Expose some C-only fallback functions -void VP8LTransformColorInverse_C(const VP8LMultipliers* const m, - const uint32_t* src, int num_pixels, - uint32_t* dst); - -void VP8LConvertBGRAToRGB_C(const uint32_t* src, int num_pixels, uint8_t* dst); -void VP8LConvertBGRAToRGBA_C(const uint32_t* src, int num_pixels, uint8_t* dst); -void VP8LConvertBGRAToRGBA4444_C(const uint32_t* src, - int num_pixels, uint8_t* dst); -void VP8LConvertBGRAToRGB565_C(const uint32_t* src, - int num_pixels, uint8_t* dst); -void VP8LConvertBGRAToBGR_C(const uint32_t* src, int num_pixels, uint8_t* dst); -void VP8LAddGreenToBlueAndRed_C(const uint32_t* src, int num_pixels, - uint32_t* dst); - -// Must be called before calling any of the above methods. -void VP8LDspInit(void); - -//------------------------------------------------------------------------------ -// Encoding - -typedef void (*VP8LProcessEncBlueAndRedFunc)(uint32_t* dst, int num_pixels); -extern VP8LProcessEncBlueAndRedFunc VP8LSubtractGreenFromBlueAndRed; -typedef void (*VP8LTransformColorFunc)(const VP8LMultipliers* const m, - uint32_t* dst, int num_pixels); -extern VP8LTransformColorFunc VP8LTransformColor; -typedef void (*VP8LCollectColorBlueTransformsFunc)( - const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_blue, int red_to_blue, int histo[]); -extern VP8LCollectColorBlueTransformsFunc VP8LCollectColorBlueTransforms; - -typedef void (*VP8LCollectColorRedTransformsFunc)( - const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_red, int histo[]); -extern VP8LCollectColorRedTransformsFunc VP8LCollectColorRedTransforms; - -// Expose some C-only fallback functions -void VP8LTransformColor_C(const VP8LMultipliers* const m, - uint32_t* data, int num_pixels); -void VP8LSubtractGreenFromBlueAndRed_C(uint32_t* argb_data, int num_pixels); -void VP8LCollectColorRedTransforms_C(const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_red, int histo[]); -void VP8LCollectColorBlueTransforms_C(const uint32_t* argb, int stride, - int tile_width, int tile_height, - int green_to_blue, int red_to_blue, - int histo[]); - -extern VP8LPredictorAddSubFunc VP8LPredictorsSub[16]; -extern VP8LPredictorAddSubFunc VP8LPredictorsSub_C[16]; - -// ----------------------------------------------------------------------------- -// Huffman-cost related functions. - -typedef double (*VP8LCostFunc)(const uint32_t* population, int length); -typedef double (*VP8LCostCombinedFunc)(const uint32_t* X, const uint32_t* Y, - int length); -typedef float (*VP8LCombinedShannonEntropyFunc)(const int X[256], - const int Y[256]); - -extern VP8LCostFunc VP8LExtraCost; -extern VP8LCostCombinedFunc VP8LExtraCostCombined; -extern VP8LCombinedShannonEntropyFunc VP8LCombinedShannonEntropy; - -typedef struct { // small struct to hold counters - int counts[2]; // index: 0=zero streak, 1=non-zero streak - int streaks[2][2]; // [zero/non-zero][streak<3 / streak>=3] -} VP8LStreaks; - -typedef struct { // small struct to hold bit entropy results - double entropy; // entropy - uint32_t sum; // sum of the population - int nonzeros; // number of non-zero elements in the population - uint32_t max_val; // maximum value in the population - uint32_t nonzero_code; // index of the last non-zero in the population -} VP8LBitEntropy; - -void VP8LBitEntropyInit(VP8LBitEntropy* const entropy); - -// Get the combined symbol bit entropy and Huffman cost stats for the -// distributions 'X' and 'Y'. Those results can then be refined according to -// codec specific heuristics. -typedef void (*VP8LGetCombinedEntropyUnrefinedFunc)( - const uint32_t X[], const uint32_t Y[], int length, - VP8LBitEntropy* const bit_entropy, VP8LStreaks* const stats); -extern VP8LGetCombinedEntropyUnrefinedFunc VP8LGetCombinedEntropyUnrefined; - -// Get the entropy for the distribution 'X'. -typedef void (*VP8LGetEntropyUnrefinedFunc)(const uint32_t X[], int length, - VP8LBitEntropy* const bit_entropy, - VP8LStreaks* const stats); -extern VP8LGetEntropyUnrefinedFunc VP8LGetEntropyUnrefined; - -void VP8LBitsEntropyUnrefined(const uint32_t* const array, int n, - VP8LBitEntropy* const entropy); - -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() - -typedef int (*VP8LVectorMismatchFunc)(const uint32_t* const array1, - const uint32_t* const array2, int length); -// Returns the first index where array1 and array2 are different. -extern VP8LVectorMismatchFunc VP8LVectorMismatch; - -typedef void (*VP8LBundleColorMapFunc)(const uint8_t* const row, int width, - int xbits, uint32_t* dst); -extern VP8LBundleColorMapFunc VP8LBundleColorMap; -void VP8LBundleColorMap_C(const uint8_t* const row, int width, int xbits, - uint32_t* dst); - -// Must be called before calling any of the above methods. -void VP8LEncDspInit(void); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DSP_LOSSLESS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless_common.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless_common.h deleted file mode 100644 index a2648d1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/lossless_common.h +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Image transforms and color space conversion methods for lossless decoder. -// -// Authors: Vikas Arora (vikaas.arora@gmail.com) -// Jyrki Alakuijala (jyrki@google.com) -// Vincent Rabaud (vrabaud@google.com) - -#ifndef WEBP_DSP_LOSSLESS_COMMON_H_ -#define WEBP_DSP_LOSSLESS_COMMON_H_ - -#include "src/webp/types.h" - -#include "src/utils/utils.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//------------------------------------------------------------------------------ -// Decoding - -// color mapping related functions. -static WEBP_INLINE uint32_t VP8GetARGBIndex(uint32_t idx) { - return (idx >> 8) & 0xff; -} - -static WEBP_INLINE uint8_t VP8GetAlphaIndex(uint8_t idx) { - return idx; -} - -static WEBP_INLINE uint32_t VP8GetARGBValue(uint32_t val) { - return val; -} - -static WEBP_INLINE uint8_t VP8GetAlphaValue(uint32_t val) { - return (val >> 8) & 0xff; -} - -//------------------------------------------------------------------------------ -// Misc methods. - -// Computes sampled size of 'size' when sampling using 'sampling bits'. -static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size, - uint32_t sampling_bits) { - return (size + (1 << sampling_bits) - 1) >> sampling_bits; -} - -// Converts near lossless quality into max number of bits shaved off. -static WEBP_INLINE int VP8LNearLosslessBits(int near_lossless_quality) { - // 100 -> 0 - // 80..99 -> 1 - // 60..79 -> 2 - // 40..59 -> 3 - // 20..39 -> 4 - // 0..19 -> 5 - return 5 - near_lossless_quality / 20; -} - -// ----------------------------------------------------------------------------- -// Faster logarithm for integers. Small values use a look-up table. - -// The threshold till approximate version of log_2 can be used. -// Practically, we can get rid of the call to log() as the two values match to -// very high degree (the ratio of these two is 0.99999x). -// Keeping a high threshold for now. -#define APPROX_LOG_WITH_CORRECTION_MAX 65536 -#define APPROX_LOG_MAX 4096 -#define LOG_2_RECIPROCAL 1.44269504088896338700465094007086 -#define LOG_LOOKUP_IDX_MAX 256 -extern const float kLog2Table[LOG_LOOKUP_IDX_MAX]; -extern const float kSLog2Table[LOG_LOOKUP_IDX_MAX]; -typedef float (*VP8LFastLog2SlowFunc)(uint32_t v); - -extern VP8LFastLog2SlowFunc VP8LFastLog2Slow; -extern VP8LFastLog2SlowFunc VP8LFastSLog2Slow; - -static WEBP_INLINE float VP8LFastLog2(uint32_t v) { - return (v < LOG_LOOKUP_IDX_MAX) ? kLog2Table[v] : VP8LFastLog2Slow(v); -} -// Fast calculation of v * log2(v) for integer input. -static WEBP_INLINE float VP8LFastSLog2(uint32_t v) { - return (v < LOG_LOOKUP_IDX_MAX) ? kSLog2Table[v] : VP8LFastSLog2Slow(v); -} - -// ----------------------------------------------------------------------------- -// PrefixEncode() - -// 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. -static WEBP_INLINE void VP8LPrefixEncodeBitsNoLUT(int distance, int* const code, - int* const extra_bits) { - const int highest_bit = BitsLog2Floor(--distance); - const int second_highest_bit = (distance >> (highest_bit - 1)) & 1; - *extra_bits = highest_bit - 1; - *code = 2 * highest_bit + second_highest_bit; -} - -static WEBP_INLINE void VP8LPrefixEncodeNoLUT(int distance, int* const code, - int* const extra_bits, - int* const extra_bits_value) { - const int highest_bit = BitsLog2Floor(--distance); - const int second_highest_bit = (distance >> (highest_bit - 1)) & 1; - *extra_bits = highest_bit - 1; - *extra_bits_value = distance & ((1 << *extra_bits) - 1); - *code = 2 * highest_bit + second_highest_bit; -} - -#define PREFIX_LOOKUP_IDX_MAX 512 -typedef struct { - int8_t code_; - int8_t extra_bits_; -} VP8LPrefixCode; - -// These tables are derived using VP8LPrefixEncodeNoLUT. -extern const VP8LPrefixCode kPrefixEncodeCode[PREFIX_LOOKUP_IDX_MAX]; -extern const uint8_t kPrefixEncodeExtraBitsValue[PREFIX_LOOKUP_IDX_MAX]; -static WEBP_INLINE void VP8LPrefixEncodeBits(int distance, int* const code, - int* const extra_bits) { - if (distance < PREFIX_LOOKUP_IDX_MAX) { - const VP8LPrefixCode prefix_code = kPrefixEncodeCode[distance]; - *code = prefix_code.code_; - *extra_bits = prefix_code.extra_bits_; - } else { - VP8LPrefixEncodeBitsNoLUT(distance, code, extra_bits); - } -} - -static WEBP_INLINE void VP8LPrefixEncode(int distance, int* const code, - int* const extra_bits, - int* const extra_bits_value) { - if (distance < PREFIX_LOOKUP_IDX_MAX) { - const VP8LPrefixCode prefix_code = kPrefixEncodeCode[distance]; - *code = prefix_code.code_; - *extra_bits = prefix_code.extra_bits_; - *extra_bits_value = kPrefixEncodeExtraBitsValue[distance]; - } else { - VP8LPrefixEncodeNoLUT(distance, code, extra_bits, extra_bits_value); - } -} - -// Sum of each component, mod 256. -static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE -uint32_t VP8LAddPixels(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); - return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); -} - -// Difference of each component, mod 256. -static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE -uint32_t VP8LSubPixels(uint32_t a, uint32_t b) { - const uint32_t alpha_and_green = - 0x00ff00ffu + (a & 0xff00ff00u) - (b & 0xff00ff00u); - const uint32_t red_and_blue = - 0xff00ff00u + (a & 0x00ff00ffu) - (b & 0x00ff00ffu); - return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); -} - -//------------------------------------------------------------------------------ -// Transform-related functions use din both encoding and decoding. - -// Macros used to create a batch predictor that iteratively uses a -// one-pixel predictor. - -// The predictor is added to the output pixel (which -// is therefore considered as a residual) to get the final prediction. -#define GENERATE_PREDICTOR_ADD(PREDICTOR, PREDICTOR_ADD) \ -static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \ - int num_pixels, uint32_t* out) { \ - int x; \ - for (x = 0; x < num_pixels; ++x) { \ - const uint32_t pred = (PREDICTOR)(out[x - 1], upper + x); \ - out[x] = VP8LAddPixels(in[x], pred); \ - } \ -} - -// It subtracts the prediction from the input pixel and stores the residual -// in the output pixel. -#define GENERATE_PREDICTOR_SUB(PREDICTOR, PREDICTOR_SUB) \ -static void PREDICTOR_SUB(const uint32_t* in, const uint32_t* upper, \ - int num_pixels, uint32_t* out) { \ - int x; \ - for (x = 0; x < num_pixels; ++x) { \ - const uint32_t pred = (PREDICTOR)(in[x - 1], upper + x); \ - out[x] = VP8LSubPixels(in[x], pred); \ - } \ -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DSP_LOSSLESS_COMMON_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/mips_macro.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/mips_macro.h deleted file mode 100644 index 44aba9b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/mips_macro.h +++ /dev/null @@ -1,200 +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. -// ----------------------------------------------------------------------------- -// -// MIPS common macros - -#ifndef WEBP_DSP_MIPS_MACRO_H_ -#define WEBP_DSP_MIPS_MACRO_H_ - -#if defined(__GNUC__) && defined(__ANDROID__) && LOCAL_GCC_VERSION == 0x409 -#define WORK_AROUND_GCC -#endif - -#define STR(s) #s -#define XSTR(s) STR(s) - -// O0[31..16 | 15..0] = I0[31..16 | 15..0] + I1[31..16 | 15..0] -// O1[31..16 | 15..0] = I0[31..16 | 15..0] - I1[31..16 | 15..0] -// O - output -// I - input (macro doesn't change it) -#define ADD_SUB_HALVES(O0, O1, \ - I0, I1) \ - "addq.ph %[" #O0 "], %[" #I0 "], %[" #I1 "] \n\t" \ - "subq.ph %[" #O1 "], %[" #I0 "], %[" #I1 "] \n\t" - -// O - output -// I - input (macro doesn't change it) -// I[0/1] - offset in bytes -#define LOAD_IN_X2(O0, O1, \ - I0, I1) \ - "lh %[" #O0 "], " #I0 "(%[in]) \n\t" \ - "lh %[" #O1 "], " #I1 "(%[in]) \n\t" - -// I0 - location -// I1..I9 - offsets in bytes -#define LOAD_WITH_OFFSET_X4(O0, O1, O2, O3, \ - I0, I1, I2, I3, I4, I5, I6, I7, I8, I9) \ - "ulw %[" #O0 "], " #I1 "+" XSTR(I9) "*" #I5 "(%[" #I0 "]) \n\t" \ - "ulw %[" #O1 "], " #I2 "+" XSTR(I9) "*" #I6 "(%[" #I0 "]) \n\t" \ - "ulw %[" #O2 "], " #I3 "+" XSTR(I9) "*" #I7 "(%[" #I0 "]) \n\t" \ - "ulw %[" #O3 "], " #I4 "+" XSTR(I9) "*" #I8 "(%[" #I0 "]) \n\t" - -// O - output -// IO - input/output -// I - input (macro doesn't change it) -#define MUL_SHIFT_SUM(O0, O1, O2, O3, O4, O5, O6, O7, \ - IO0, IO1, IO2, IO3, \ - I0, I1, I2, I3, I4, I5, I6, I7) \ - "mul %[" #O0 "], %[" #I0 "], %[kC2] \n\t" \ - "mul %[" #O1 "], %[" #I0 "], %[kC1] \n\t" \ - "mul %[" #O2 "], %[" #I1 "], %[kC2] \n\t" \ - "mul %[" #O3 "], %[" #I1 "], %[kC1] \n\t" \ - "mul %[" #O4 "], %[" #I2 "], %[kC2] \n\t" \ - "mul %[" #O5 "], %[" #I2 "], %[kC1] \n\t" \ - "mul %[" #O6 "], %[" #I3 "], %[kC2] \n\t" \ - "mul %[" #O7 "], %[" #I3 "], %[kC1] \n\t" \ - "sra %[" #O0 "], %[" #O0 "], 16 \n\t" \ - "sra %[" #O1 "], %[" #O1 "], 16 \n\t" \ - "sra %[" #O2 "], %[" #O2 "], 16 \n\t" \ - "sra %[" #O3 "], %[" #O3 "], 16 \n\t" \ - "sra %[" #O4 "], %[" #O4 "], 16 \n\t" \ - "sra %[" #O5 "], %[" #O5 "], 16 \n\t" \ - "sra %[" #O6 "], %[" #O6 "], 16 \n\t" \ - "sra %[" #O7 "], %[" #O7 "], 16 \n\t" \ - "addu %[" #IO0 "], %[" #IO0 "], %[" #I4 "] \n\t" \ - "addu %[" #IO1 "], %[" #IO1 "], %[" #I5 "] \n\t" \ - "subu %[" #IO2 "], %[" #IO2 "], %[" #I6 "] \n\t" \ - "subu %[" #IO3 "], %[" #IO3 "], %[" #I7 "] \n\t" - -// O - output -// I - input (macro doesn't change it) -#define INSERT_HALF_X2(O0, O1, \ - I0, I1) \ - "ins %[" #O0 "], %[" #I0 "], 16, 16 \n\t" \ - "ins %[" #O1 "], %[" #I1 "], 16, 16 \n\t" - -// O - output -// I - input (macro doesn't change it) -#define SRA_16(O0, O1, O2, O3, \ - I0, I1, I2, I3) \ - "sra %[" #O0 "], %[" #I0 "], 16 \n\t" \ - "sra %[" #O1 "], %[" #I1 "], 16 \n\t" \ - "sra %[" #O2 "], %[" #I2 "], 16 \n\t" \ - "sra %[" #O3 "], %[" #I3 "], 16 \n\t" - -// temp0[31..16 | 15..0] = temp8[31..16 | 15..0] + temp12[31..16 | 15..0] -// temp1[31..16 | 15..0] = temp8[31..16 | 15..0] - temp12[31..16 | 15..0] -// temp0[31..16 | 15..0] = temp0[31..16 >> 3 | 15..0 >> 3] -// temp1[31..16 | 15..0] = temp1[31..16 >> 3 | 15..0 >> 3] -// O - output -// I - input (macro doesn't change it) -#define SHIFT_R_SUM_X2(O0, O1, O2, O3, O4, O5, O6, O7, \ - I0, I1, I2, I3, I4, I5, I6, I7) \ - "addq.ph %[" #O0 "], %[" #I0 "], %[" #I4 "] \n\t" \ - "subq.ph %[" #O1 "], %[" #I0 "], %[" #I4 "] \n\t" \ - "addq.ph %[" #O2 "], %[" #I1 "], %[" #I5 "] \n\t" \ - "subq.ph %[" #O3 "], %[" #I1 "], %[" #I5 "] \n\t" \ - "addq.ph %[" #O4 "], %[" #I2 "], %[" #I6 "] \n\t" \ - "subq.ph %[" #O5 "], %[" #I2 "], %[" #I6 "] \n\t" \ - "addq.ph %[" #O6 "], %[" #I3 "], %[" #I7 "] \n\t" \ - "subq.ph %[" #O7 "], %[" #I3 "], %[" #I7 "] \n\t" \ - "shra.ph %[" #O0 "], %[" #O0 "], 3 \n\t" \ - "shra.ph %[" #O1 "], %[" #O1 "], 3 \n\t" \ - "shra.ph %[" #O2 "], %[" #O2 "], 3 \n\t" \ - "shra.ph %[" #O3 "], %[" #O3 "], 3 \n\t" \ - "shra.ph %[" #O4 "], %[" #O4 "], 3 \n\t" \ - "shra.ph %[" #O5 "], %[" #O5 "], 3 \n\t" \ - "shra.ph %[" #O6 "], %[" #O6 "], 3 \n\t" \ - "shra.ph %[" #O7 "], %[" #O7 "], 3 \n\t" - -// precrq.ph.w temp0, temp8, temp2 -// temp0 = temp8[31..16] | temp2[31..16] -// ins temp2, temp8, 16, 16 -// temp2 = temp8[31..16] | temp2[15..0] -// O - output -// IO - input/output -// I - input (macro doesn't change it) -#define PACK_2_HALVES_TO_WORD(O0, O1, O2, O3, \ - IO0, IO1, IO2, IO3, \ - I0, I1, I2, I3) \ - "precrq.ph.w %[" #O0 "], %[" #I0 "], %[" #IO0 "] \n\t" \ - "precrq.ph.w %[" #O1 "], %[" #I1 "], %[" #IO1 "] \n\t" \ - "ins %[" #IO0 "], %[" #I0 "], 16, 16 \n\t" \ - "ins %[" #IO1 "], %[" #I1 "], 16, 16 \n\t" \ - "precrq.ph.w %[" #O2 "], %[" #I2 "], %[" #IO2 "] \n\t" \ - "precrq.ph.w %[" #O3 "], %[" #I3 "], %[" #IO3 "] \n\t" \ - "ins %[" #IO2 "], %[" #I2 "], 16, 16 \n\t" \ - "ins %[" #IO3 "], %[" #I3 "], 16, 16 \n\t" - -// preceu.ph.qbr temp0, temp8 -// temp0 = 0 | 0 | temp8[23..16] | temp8[7..0] -// preceu.ph.qbl temp1, temp8 -// temp1 = temp8[23..16] | temp8[7..0] | 0 | 0 -// O - output -// I - input (macro doesn't change it) -#define CONVERT_2_BYTES_TO_HALF(O0, O1, O2, O3, O4, O5, O6, O7, \ - I0, I1, I2, I3) \ - "preceu.ph.qbr %[" #O0 "], %[" #I0 "] \n\t" \ - "preceu.ph.qbl %[" #O1 "], %[" #I0 "] \n\t" \ - "preceu.ph.qbr %[" #O2 "], %[" #I1 "] \n\t" \ - "preceu.ph.qbl %[" #O3 "], %[" #I1 "] \n\t" \ - "preceu.ph.qbr %[" #O4 "], %[" #I2 "] \n\t" \ - "preceu.ph.qbl %[" #O5 "], %[" #I2 "] \n\t" \ - "preceu.ph.qbr %[" #O6 "], %[" #I3 "] \n\t" \ - "preceu.ph.qbl %[" #O7 "], %[" #I3 "] \n\t" - -// temp0[31..16 | 15..0] = temp0[31..16 | 15..0] + temp8[31..16 | 15..0] -// temp0[31..16 | 15..0] = temp0[31..16 <<(s) 7 | 15..0 <<(s) 7] -// temp1..temp7 same as temp0 -// precrqu_s.qb.ph temp0, temp1, temp0: -// temp0 = temp1[31..24] | temp1[15..8] | temp0[31..24] | temp0[15..8] -// store temp0 to dst -// IO - input/output -// I - input (macro doesn't change it) -#define STORE_SAT_SUM_X2(IO0, IO1, IO2, IO3, IO4, IO5, IO6, IO7, \ - I0, I1, I2, I3, I4, I5, I6, I7, \ - I8, I9, I10, I11, I12, I13) \ - "addq.ph %[" #IO0 "], %[" #IO0 "], %[" #I0 "] \n\t" \ - "addq.ph %[" #IO1 "], %[" #IO1 "], %[" #I1 "] \n\t" \ - "addq.ph %[" #IO2 "], %[" #IO2 "], %[" #I2 "] \n\t" \ - "addq.ph %[" #IO3 "], %[" #IO3 "], %[" #I3 "] \n\t" \ - "addq.ph %[" #IO4 "], %[" #IO4 "], %[" #I4 "] \n\t" \ - "addq.ph %[" #IO5 "], %[" #IO5 "], %[" #I5 "] \n\t" \ - "addq.ph %[" #IO6 "], %[" #IO6 "], %[" #I6 "] \n\t" \ - "addq.ph %[" #IO7 "], %[" #IO7 "], %[" #I7 "] \n\t" \ - "shll_s.ph %[" #IO0 "], %[" #IO0 "], 7 \n\t" \ - "shll_s.ph %[" #IO1 "], %[" #IO1 "], 7 \n\t" \ - "shll_s.ph %[" #IO2 "], %[" #IO2 "], 7 \n\t" \ - "shll_s.ph %[" #IO3 "], %[" #IO3 "], 7 \n\t" \ - "shll_s.ph %[" #IO4 "], %[" #IO4 "], 7 \n\t" \ - "shll_s.ph %[" #IO5 "], %[" #IO5 "], 7 \n\t" \ - "shll_s.ph %[" #IO6 "], %[" #IO6 "], 7 \n\t" \ - "shll_s.ph %[" #IO7 "], %[" #IO7 "], 7 \n\t" \ - "precrqu_s.qb.ph %[" #IO0 "], %[" #IO1 "], %[" #IO0 "] \n\t" \ - "precrqu_s.qb.ph %[" #IO2 "], %[" #IO3 "], %[" #IO2 "] \n\t" \ - "precrqu_s.qb.ph %[" #IO4 "], %[" #IO5 "], %[" #IO4 "] \n\t" \ - "precrqu_s.qb.ph %[" #IO6 "], %[" #IO7 "], %[" #IO6 "] \n\t" \ - "usw %[" #IO0 "], " XSTR(I13) "*" #I9 "(%[" #I8 "]) \n\t" \ - "usw %[" #IO2 "], " XSTR(I13) "*" #I10 "(%[" #I8 "]) \n\t" \ - "usw %[" #IO4 "], " XSTR(I13) "*" #I11 "(%[" #I8 "]) \n\t" \ - "usw %[" #IO6 "], " XSTR(I13) "*" #I12 "(%[" #I8 "]) \n\t" - -#define OUTPUT_EARLY_CLOBBER_REGS_10() \ - : [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), [temp3]"=&r"(temp3), \ - [temp4]"=&r"(temp4), [temp5]"=&r"(temp5), [temp6]"=&r"(temp6), \ - [temp7]"=&r"(temp7), [temp8]"=&r"(temp8), [temp9]"=&r"(temp9), \ - [temp10]"=&r"(temp10) - -#define OUTPUT_EARLY_CLOBBER_REGS_18() \ - OUTPUT_EARLY_CLOBBER_REGS_10(), \ - [temp11]"=&r"(temp11), [temp12]"=&r"(temp12), [temp13]"=&r"(temp13), \ - [temp14]"=&r"(temp14), [temp15]"=&r"(temp15), [temp16]"=&r"(temp16), \ - [temp17]"=&r"(temp17), [temp18]"=&r"(temp18) - -#endif // WEBP_DSP_MIPS_MACRO_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/msa_macro.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/msa_macro.h deleted file mode 100644 index de026a1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/msa_macro.h +++ /dev/null @@ -1,1392 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// MSA common macros -// -// Author(s): Prashant Patil (prashant.patil@imgtec.com) - -#ifndef WEBP_DSP_MSA_MACRO_H_ -#define WEBP_DSP_MSA_MACRO_H_ - -#include -#include - -#if defined(__clang__) - #define CLANG_BUILD -#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) - #define SRAI_H(a, b) __msa_srai_h((v8i16)a, b) - #define SRAI_W(a, b) __msa_srai_w((v4i32)a, b) - #define SRLI_H(a, b) __msa_srli_h((v8i16)a, b) - #define SLLI_B(a, b) __msa_slli_b((v4i32)a, b) - #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) - #define SRAI_H(a, b) (a >> b) - #define SRAI_W(a, b) (a >> b) - #define SRLI_H(a, b) (a << b) - #define SLLI_B(a, b) (a << b) - #define ANDI_B(a, b) (a & b) - #define ORI_B(a, b) (a | b) -#endif - -#define LD_B(RTYPE, psrc) *((RTYPE*)(psrc)) -#define LD_UB(...) LD_B(v16u8, __VA_ARGS__) -#define LD_SB(...) LD_B(v16i8, __VA_ARGS__) - -#define LD_H(RTYPE, psrc) *((RTYPE*)(psrc)) -#define LD_UH(...) LD_H(v8u16, __VA_ARGS__) -#define LD_SH(...) LD_H(v8i16, __VA_ARGS__) - -#define LD_W(RTYPE, psrc) *((RTYPE*)(psrc)) -#define LD_UW(...) LD_W(v4u32, __VA_ARGS__) -#define LD_SW(...) LD_W(v4i32, __VA_ARGS__) - -#define ST_B(RTYPE, in, pdst) *((RTYPE*)(pdst)) = in -#define ST_UB(...) ST_B(v16u8, __VA_ARGS__) -#define ST_SB(...) ST_B(v16i8, __VA_ARGS__) - -#define ST_H(RTYPE, in, pdst) *((RTYPE*)(pdst)) = in -#define ST_UH(...) ST_H(v8u16, __VA_ARGS__) -#define ST_SH(...) ST_H(v8i16, __VA_ARGS__) - -#define ST_W(RTYPE, in, pdst) *((RTYPE*)(pdst)) = in -#define ST_UW(...) ST_W(v4u32, __VA_ARGS__) -#define ST_SW(...) ST_W(v4i32, __VA_ARGS__) - -#define MSA_LOAD_FUNC(TYPE, INSTR, FUNC_NAME) \ - static inline TYPE FUNC_NAME(const void* const psrc) { \ - const uint8_t* const psrc_m = (const uint8_t*)psrc; \ - TYPE val_m; \ - asm volatile ( \ - "" #INSTR " %[val_m], %[psrc_m] \n\t" \ - : [val_m] "=r" (val_m) \ - : [psrc_m] "m" (*psrc_m)); \ - return val_m; \ - } - -#define MSA_LOAD(psrc, FUNC_NAME) FUNC_NAME(psrc) - -#define MSA_STORE_FUNC(TYPE, INSTR, FUNC_NAME) \ - static inline void FUNC_NAME(TYPE val, void* const pdst) { \ - uint8_t* const pdst_m = (uint8_t*)pdst; \ - TYPE val_m = val; \ - asm volatile ( \ - " " #INSTR " %[val_m], %[pdst_m] \n\t" \ - : [pdst_m] "=m" (*pdst_m) \ - : [val_m] "r" (val_m)); \ - } - -#define MSA_STORE(val, pdst, FUNC_NAME) FUNC_NAME(val, pdst) - -#if (__mips_isa_rev >= 6) - MSA_LOAD_FUNC(uint16_t, lh, msa_lh); - #define LH(psrc) MSA_LOAD(psrc, msa_lh) - MSA_LOAD_FUNC(uint32_t, lw, msa_lw); - #define LW(psrc) MSA_LOAD(psrc, msa_lw) - #if (__mips == 64) - MSA_LOAD_FUNC(uint64_t, ld, msa_ld); - #define LD(psrc) MSA_LOAD(psrc, msa_ld) - #else // !(__mips == 64) - #define LD(psrc) ((((uint64_t)MSA_LOAD(psrc + 4, msa_lw)) << 32) | \ - MSA_LOAD(psrc, msa_lw)) - #endif // (__mips == 64) - - MSA_STORE_FUNC(uint16_t, sh, msa_sh); - #define SH(val, pdst) MSA_STORE(val, pdst, msa_sh) - MSA_STORE_FUNC(uint32_t, sw, msa_sw); - #define SW(val, pdst) MSA_STORE(val, pdst, msa_sw) - MSA_STORE_FUNC(uint64_t, sd, msa_sd); - #define SD(val, pdst) MSA_STORE(val, pdst, msa_sd) -#else // !(__mips_isa_rev >= 6) - MSA_LOAD_FUNC(uint16_t, ulh, msa_ulh); - #define LH(psrc) MSA_LOAD(psrc, msa_ulh) - MSA_LOAD_FUNC(uint32_t, ulw, msa_ulw); - #define LW(psrc) MSA_LOAD(psrc, msa_ulw) - #if (__mips == 64) - MSA_LOAD_FUNC(uint64_t, uld, msa_uld); - #define LD(psrc) MSA_LOAD(psrc, msa_uld) - #else // !(__mips == 64) - #define LD(psrc) ((((uint64_t)MSA_LOAD(psrc + 4, msa_ulw)) << 32) | \ - MSA_LOAD(psrc, msa_ulw)) - #endif // (__mips == 64) - - MSA_STORE_FUNC(uint16_t, ush, msa_ush); - #define SH(val, pdst) MSA_STORE(val, pdst, msa_ush) - MSA_STORE_FUNC(uint32_t, usw, msa_usw); - #define SW(val, pdst) MSA_STORE(val, pdst, msa_usw) - #define SD(val, pdst) do { \ - uint8_t* const pdst_sd_m = (uint8_t*)(pdst); \ - const uint32_t val0_m = (uint32_t)(val & 0x00000000FFFFFFFF); \ - const uint32_t val1_m = (uint32_t)((val >> 32) & 0x00000000FFFFFFFF); \ - SW(val0_m, pdst_sd_m); \ - SW(val1_m, pdst_sd_m + 4); \ - } while (0) -#endif // (__mips_isa_rev >= 6) - -/* Description : Load 4 words with stride - * Arguments : Inputs - psrc, stride - * Outputs - out0, out1, out2, out3 - * Details : Load word in 'out0' from (psrc) - * Load word in 'out1' from (psrc + stride) - * Load word in 'out2' from (psrc + 2 * stride) - * Load word in 'out3' from (psrc + 3 * stride) - */ -#define LW4(psrc, stride, out0, out1, out2, out3) do { \ - const uint8_t* ptmp = (const uint8_t*)psrc; \ - out0 = LW(ptmp); \ - ptmp += stride; \ - out1 = LW(ptmp); \ - ptmp += stride; \ - out2 = LW(ptmp); \ - ptmp += stride; \ - out3 = LW(ptmp); \ -} while (0) - -/* Description : Store words with stride - * Arguments : Inputs - in0, in1, in2, in3, pdst, stride - * Details : Store word from 'in0' to (pdst) - * Store word from 'in1' to (pdst + stride) - * Store word from 'in2' to (pdst + 2 * stride) - * Store word from 'in3' to (pdst + 3 * stride) - */ -#define SW4(in0, in1, in2, in3, pdst, stride) do { \ - uint8_t* ptmp = (uint8_t*)pdst; \ - SW(in0, ptmp); \ - ptmp += stride; \ - SW(in1, ptmp); \ - ptmp += stride; \ - SW(in2, ptmp); \ - ptmp += stride; \ - SW(in3, ptmp); \ -} while (0) - -#define SW3(in0, in1, in2, pdst, stride) do { \ - uint8_t* ptmp = (uint8_t*)pdst; \ - SW(in0, ptmp); \ - ptmp += stride; \ - SW(in1, ptmp); \ - ptmp += stride; \ - SW(in2, ptmp); \ -} while (0) - -#define SW2(in0, in1, pdst, stride) do { \ - uint8_t* ptmp = (uint8_t*)pdst; \ - SW(in0, ptmp); \ - ptmp += stride; \ - SW(in1, ptmp); \ -} while (0) - -/* Description : Store 4 double words with stride - * Arguments : Inputs - in0, in1, in2, in3, pdst, stride - * Details : Store double word from 'in0' to (pdst) - * Store double word from 'in1' to (pdst + stride) - * Store double word from 'in2' to (pdst + 2 * stride) - * Store double word from 'in3' to (pdst + 3 * stride) - */ -#define SD4(in0, in1, in2, in3, pdst, stride) do { \ - uint8_t* ptmp = (uint8_t*)pdst; \ - SD(in0, ptmp); \ - ptmp += stride; \ - SD(in1, ptmp); \ - ptmp += stride; \ - SD(in2, ptmp); \ - ptmp += stride; \ - SD(in3, ptmp); \ -} while (0) - -/* Description : Load vectors with 16 byte elements with stride - * Arguments : Inputs - psrc, stride - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Load 16 byte elements in 'out0' from (psrc) - * Load 16 byte elements in 'out1' from (psrc + stride) - */ -#define LD_B2(RTYPE, psrc, stride, out0, out1) do { \ - out0 = LD_B(RTYPE, psrc); \ - out1 = LD_B(RTYPE, psrc + stride); \ -} while (0) -#define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__) -#define LD_SB2(...) LD_B2(v16i8, __VA_ARGS__) - -#define LD_B3(RTYPE, psrc, stride, out0, out1, out2) do { \ - LD_B2(RTYPE, psrc, stride, out0, out1); \ - out2 = LD_B(RTYPE, psrc + 2 * stride); \ -} while (0) -#define LD_UB3(...) LD_B3(v16u8, __VA_ARGS__) -#define LD_SB3(...) LD_B3(v16i8, __VA_ARGS__) - -#define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) do { \ - LD_B2(RTYPE, psrc, stride, out0, out1); \ - LD_B2(RTYPE, psrc + 2 * stride , stride, out2, out3); \ -} while (0) -#define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__) -#define LD_SB4(...) LD_B4(v16i8, __VA_ARGS__) - -#define LD_B8(RTYPE, psrc, stride, \ - out0, out1, out2, out3, out4, out5, out6, out7) do { \ - LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3); \ - LD_B4(RTYPE, psrc + 4 * stride, stride, out4, out5, out6, out7); \ -} while (0) -#define LD_UB8(...) LD_B8(v16u8, __VA_ARGS__) -#define LD_SB8(...) LD_B8(v16i8, __VA_ARGS__) - -/* Description : Load vectors with 8 halfword elements with stride - * Arguments : Inputs - psrc, stride - * Outputs - out0, out1 - * Details : Load 8 halfword elements in 'out0' from (psrc) - * Load 8 halfword elements in 'out1' from (psrc + stride) - */ -#define LD_H2(RTYPE, psrc, stride, out0, out1) do { \ - out0 = LD_H(RTYPE, psrc); \ - out1 = LD_H(RTYPE, psrc + stride); \ -} while (0) -#define LD_UH2(...) LD_H2(v8u16, __VA_ARGS__) -#define LD_SH2(...) LD_H2(v8i16, __VA_ARGS__) - -/* Description : Load vectors with 4 word elements with stride - * Arguments : Inputs - psrc, stride - * Outputs - out0, out1, out2, out3 - * Details : Load 4 word elements in 'out0' from (psrc + 0 * stride) - * Load 4 word elements in 'out1' from (psrc + 1 * stride) - * Load 4 word elements in 'out2' from (psrc + 2 * stride) - * Load 4 word elements in 'out3' from (psrc + 3 * stride) - */ -#define LD_W2(RTYPE, psrc, stride, out0, out1) do { \ - out0 = LD_W(RTYPE, psrc); \ - out1 = LD_W(RTYPE, psrc + stride); \ -} while (0) -#define LD_UW2(...) LD_W2(v4u32, __VA_ARGS__) -#define LD_SW2(...) LD_W2(v4i32, __VA_ARGS__) - -#define LD_W3(RTYPE, psrc, stride, out0, out1, out2) do { \ - LD_W2(RTYPE, psrc, stride, out0, out1); \ - out2 = LD_W(RTYPE, psrc + 2 * stride); \ -} while (0) -#define LD_UW3(...) LD_W3(v4u32, __VA_ARGS__) -#define LD_SW3(...) LD_W3(v4i32, __VA_ARGS__) - -#define LD_W4(RTYPE, psrc, stride, out0, out1, out2, out3) do { \ - LD_W2(RTYPE, psrc, stride, out0, out1); \ - LD_W2(RTYPE, psrc + 2 * stride, stride, out2, out3); \ -} while (0) -#define LD_UW4(...) LD_W4(v4u32, __VA_ARGS__) -#define LD_SW4(...) LD_W4(v4i32, __VA_ARGS__) - -/* Description : Store vectors of 16 byte elements with stride - * Arguments : Inputs - in0, in1, pdst, stride - * Details : Store 16 byte elements from 'in0' to (pdst) - * Store 16 byte elements from 'in1' to (pdst + stride) - */ -#define ST_B2(RTYPE, in0, in1, pdst, stride) do { \ - ST_B(RTYPE, in0, pdst); \ - ST_B(RTYPE, in1, pdst + stride); \ -} while (0) -#define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__) -#define ST_SB2(...) ST_B2(v16i8, __VA_ARGS__) - -#define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride) do { \ - ST_B2(RTYPE, in0, in1, pdst, stride); \ - ST_B2(RTYPE, in2, in3, pdst + 2 * stride, stride); \ -} while (0) -#define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__) -#define ST_SB4(...) ST_B4(v16i8, __VA_ARGS__) - -#define ST_B8(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ - pdst, stride) do { \ - ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride); \ - ST_B4(RTYPE, in4, in5, in6, in7, pdst + 4 * stride, stride); \ -} while (0) -#define ST_UB8(...) ST_B8(v16u8, __VA_ARGS__) - -/* Description : Store vectors of 4 word elements with stride - * Arguments : Inputs - in0, in1, in2, in3, pdst, stride - * Details : Store 4 word elements from 'in0' to (pdst + 0 * stride) - * Store 4 word elements from 'in1' to (pdst + 1 * stride) - * Store 4 word elements from 'in2' to (pdst + 2 * stride) - * Store 4 word elements from 'in3' to (pdst + 3 * stride) - */ -#define ST_W2(RTYPE, in0, in1, pdst, stride) do { \ - ST_W(RTYPE, in0, pdst); \ - ST_W(RTYPE, in1, pdst + stride); \ -} while (0) -#define ST_UW2(...) ST_W2(v4u32, __VA_ARGS__) -#define ST_SW2(...) ST_W2(v4i32, __VA_ARGS__) - -#define ST_W3(RTYPE, in0, in1, in2, pdst, stride) do { \ - ST_W2(RTYPE, in0, in1, pdst, stride); \ - ST_W(RTYPE, in2, pdst + 2 * stride); \ -} while (0) -#define ST_UW3(...) ST_W3(v4u32, __VA_ARGS__) -#define ST_SW3(...) ST_W3(v4i32, __VA_ARGS__) - -#define ST_W4(RTYPE, in0, in1, in2, in3, pdst, stride) do { \ - ST_W2(RTYPE, in0, in1, pdst, stride); \ - ST_W2(RTYPE, in2, in3, pdst + 2 * stride, stride); \ -} while (0) -#define ST_UW4(...) ST_W4(v4u32, __VA_ARGS__) -#define ST_SW4(...) ST_W4(v4i32, __VA_ARGS__) - -/* Description : Store vectors of 8 halfword elements with stride - * Arguments : Inputs - in0, in1, pdst, stride - * Details : Store 8 halfword elements from 'in0' to (pdst) - * Store 8 halfword elements from 'in1' to (pdst + stride) - */ -#define ST_H2(RTYPE, in0, in1, pdst, stride) do { \ - ST_H(RTYPE, in0, pdst); \ - ST_H(RTYPE, in1, pdst + stride); \ -} while (0) -#define ST_UH2(...) ST_H2(v8u16, __VA_ARGS__) -#define ST_SH2(...) ST_H2(v8i16, __VA_ARGS__) - -/* Description : Store 2x4 byte block to destination memory from input vector - * Arguments : Inputs - in, stidx, pdst, stride - * Details : Index 'stidx' halfword element from 'in' vector is copied to - * the GP register and stored to (pdst) - * Index 'stidx+1' halfword element from 'in' vector is copied to - * the GP register and stored to (pdst + stride) - * Index 'stidx+2' halfword element from 'in' vector is copied to - * the GP register and stored to (pdst + 2 * stride) - * Index 'stidx+3' halfword element from 'in' vector is copied to - * the GP register and stored to (pdst + 3 * stride) - */ -#define ST2x4_UB(in, stidx, pdst, stride) do { \ - uint8_t* pblk_2x4_m = (uint8_t*)pdst; \ - const uint16_t out0_m = __msa_copy_s_h((v8i16)in, stidx); \ - const uint16_t out1_m = __msa_copy_s_h((v8i16)in, stidx + 1); \ - const uint16_t out2_m = __msa_copy_s_h((v8i16)in, stidx + 2); \ - const uint16_t out3_m = __msa_copy_s_h((v8i16)in, stidx + 3); \ - SH(out0_m, pblk_2x4_m); \ - pblk_2x4_m += stride; \ - SH(out1_m, pblk_2x4_m); \ - pblk_2x4_m += stride; \ - SH(out2_m, pblk_2x4_m); \ - pblk_2x4_m += stride; \ - SH(out3_m, pblk_2x4_m); \ -} while (0) - -/* Description : Store 4x4 byte block to destination memory from input vector - * Arguments : Inputs - in0, in1, pdst, stride - * Details : 'Idx0' word element from input vector 'in0' is copied to the - * GP register and stored to (pdst) - * 'Idx1' word element from input vector 'in0' is copied to the - * GP register and stored to (pdst + stride) - * 'Idx2' word element from input vector 'in0' is copied to the - * GP register and stored to (pdst + 2 * stride) - * 'Idx3' word element from input vector 'in0' is copied to the - * GP register and stored to (pdst + 3 * stride) - */ -#define ST4x4_UB(in0, in1, idx0, idx1, idx2, idx3, pdst, stride) do { \ - uint8_t* const pblk_4x4_m = (uint8_t*)pdst; \ - const uint32_t out0_m = __msa_copy_s_w((v4i32)in0, idx0); \ - const uint32_t out1_m = __msa_copy_s_w((v4i32)in0, idx1); \ - const uint32_t out2_m = __msa_copy_s_w((v4i32)in1, idx2); \ - const uint32_t out3_m = __msa_copy_s_w((v4i32)in1, idx3); \ - SW4(out0_m, out1_m, out2_m, out3_m, pblk_4x4_m, stride); \ -} while (0) - -#define ST4x8_UB(in0, in1, pdst, stride) do { \ - uint8_t* const pblk_4x8 = (uint8_t*)pdst; \ - ST4x4_UB(in0, in0, 0, 1, 2, 3, pblk_4x8, stride); \ - ST4x4_UB(in1, in1, 0, 1, 2, 3, pblk_4x8 + 4 * stride, stride); \ -} while (0) - -/* Description : Immediate number of elements to slide - * Arguments : Inputs - in0, in1, slide_val - * Outputs - out - * Return Type - as per RTYPE - * Details : Byte elements from 'in1' vector are slid into 'in0' by - * value specified in the 'slide_val' - */ -#define SLDI_B(RTYPE, in0, in1, slide_val) \ - (RTYPE)__msa_sldi_b((v16i8)in0, (v16i8)in1, slide_val) \ - -#define SLDI_UB(...) SLDI_B(v16u8, __VA_ARGS__) -#define SLDI_SB(...) SLDI_B(v16i8, __VA_ARGS__) -#define SLDI_SH(...) SLDI_B(v8i16, __VA_ARGS__) - -/* Description : Shuffle byte vector elements as per mask vector - * Arguments : Inputs - in0, in1, in2, in3, mask0, mask1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Byte elements from 'in0' & 'in1' are copied selectively to - * 'out0' as per control vector 'mask0' - */ -#define VSHF_B(RTYPE, in0, in1, mask) \ - (RTYPE)__msa_vshf_b((v16i8)mask, (v16i8)in1, (v16i8)in0) - -#define VSHF_UB(...) VSHF_B(v16u8, __VA_ARGS__) -#define VSHF_SB(...) VSHF_B(v16i8, __VA_ARGS__) -#define VSHF_UH(...) VSHF_B(v8u16, __VA_ARGS__) -#define VSHF_SH(...) VSHF_B(v8i16, __VA_ARGS__) - -#define VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) do { \ - out0 = VSHF_B(RTYPE, in0, in1, mask0); \ - out1 = VSHF_B(RTYPE, in2, in3, mask1); \ -} while (0) -#define VSHF_B2_UB(...) VSHF_B2(v16u8, __VA_ARGS__) -#define VSHF_B2_SB(...) VSHF_B2(v16i8, __VA_ARGS__) -#define VSHF_B2_UH(...) VSHF_B2(v8u16, __VA_ARGS__) -#define VSHF_B2_SH(...) VSHF_B2(v8i16, __VA_ARGS__) - -/* Description : Shuffle halfword vector elements as per mask vector - * Arguments : Inputs - in0, in1, in2, in3, mask0, mask1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : halfword elements from 'in0' & 'in1' are copied selectively to - * 'out0' as per control vector 'mask0' - */ -#define VSHF_H2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) do { \ - out0 = (RTYPE)__msa_vshf_h((v8i16)mask0, (v8i16)in1, (v8i16)in0); \ - out1 = (RTYPE)__msa_vshf_h((v8i16)mask1, (v8i16)in3, (v8i16)in2); \ -} while (0) -#define VSHF_H2_UH(...) VSHF_H2(v8u16, __VA_ARGS__) -#define VSHF_H2_SH(...) VSHF_H2(v8i16, __VA_ARGS__) - -/* Description : Dot product of byte vector elements - * Arguments : Inputs - mult0, mult1, cnst0, cnst1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Signed byte elements from 'mult0' are multiplied with - * signed byte elements from 'cnst0' producing a result - * twice the size of input i.e. signed halfword. - * The multiplication result of adjacent odd-even elements - * are added together and written to the 'out0' vector -*/ -#define DOTP_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) do { \ - out0 = (RTYPE)__msa_dotp_s_h((v16i8)mult0, (v16i8)cnst0); \ - out1 = (RTYPE)__msa_dotp_s_h((v16i8)mult1, (v16i8)cnst1); \ -} while (0) -#define DOTP_SB2_SH(...) DOTP_SB2(v8i16, __VA_ARGS__) - -/* Description : Dot product of halfword vector elements - * Arguments : Inputs - mult0, mult1, cnst0, cnst1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Signed halfword elements from 'mult0' are multiplied with - * signed halfword elements from 'cnst0' producing a result - * twice the size of input i.e. signed word. - * The multiplication result of adjacent odd-even elements - * are added together and written to the 'out0' vector - */ -#define DOTP_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) do { \ - out0 = (RTYPE)__msa_dotp_s_w((v8i16)mult0, (v8i16)cnst0); \ - out1 = (RTYPE)__msa_dotp_s_w((v8i16)mult1, (v8i16)cnst1); \ -} while (0) -#define DOTP_SH2_SW(...) DOTP_SH2(v4i32, __VA_ARGS__) - -/* Description : Dot product of unsigned word vector elements - * Arguments : Inputs - mult0, mult1, cnst0, cnst1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Unsigned word elements from 'mult0' are multiplied with - * unsigned word elements from 'cnst0' producing a result - * twice the size of input i.e. unsigned double word. - * The multiplication result of adjacent odd-even elements - * are added together and written to the 'out0' vector - */ -#define DOTP_UW2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) do { \ - out0 = (RTYPE)__msa_dotp_u_d((v4u32)mult0, (v4u32)cnst0); \ - out1 = (RTYPE)__msa_dotp_u_d((v4u32)mult1, (v4u32)cnst1); \ -} while (0) -#define DOTP_UW2_UD(...) DOTP_UW2(v2u64, __VA_ARGS__) - -/* Description : Dot product & addition of halfword vector elements - * Arguments : Inputs - mult0, mult1, cnst0, cnst1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Signed halfword elements from 'mult0' are multiplied with - * signed halfword elements from 'cnst0' producing a result - * twice the size of input i.e. signed word. - * The multiplication result of adjacent odd-even elements - * are added to the 'out0' vector - */ -#define DPADD_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) do { \ - out0 = (RTYPE)__msa_dpadd_s_w((v4i32)out0, (v8i16)mult0, (v8i16)cnst0); \ - out1 = (RTYPE)__msa_dpadd_s_w((v4i32)out1, (v8i16)mult1, (v8i16)cnst1); \ -} while (0) -#define DPADD_SH2_SW(...) DPADD_SH2(v4i32, __VA_ARGS__) - -/* Description : Clips all signed halfword elements of input vector - * between 0 & 255 - * Arguments : Input/output - val - * Return Type - signed halfword - */ -#define CLIP_SH_0_255(val) do { \ - const v8i16 max_m = __msa_ldi_h(255); \ - val = __msa_maxi_s_h((v8i16)val, 0); \ - val = __msa_min_s_h(max_m, (v8i16)val); \ -} while (0) - -#define CLIP_SH2_0_255(in0, in1) do { \ - CLIP_SH_0_255(in0); \ - CLIP_SH_0_255(in1); \ -} while (0) - -#define CLIP_SH4_0_255(in0, in1, in2, in3) do { \ - CLIP_SH2_0_255(in0, in1); \ - CLIP_SH2_0_255(in2, in3); \ -} while (0) - -/* Description : Clips all unsigned halfword elements of input vector - * between 0 & 255 - * Arguments : Input - in - * Output - out_m - * Return Type - unsigned halfword - */ -#define CLIP_UH_0_255(in) do { \ - const v8u16 max_m = (v8u16)__msa_ldi_h(255); \ - in = __msa_maxi_u_h((v8u16) in, 0); \ - in = __msa_min_u_h((v8u16) max_m, (v8u16) in); \ -} while (0) - -#define CLIP_UH2_0_255(in0, in1) do { \ - CLIP_UH_0_255(in0); \ - CLIP_UH_0_255(in1); \ -} while (0) - -/* Description : Clips all signed word elements of input vector - * between 0 & 255 - * Arguments : Input/output - val - * Return Type - signed word - */ -#define CLIP_SW_0_255(val) do { \ - const v4i32 max_m = __msa_ldi_w(255); \ - val = __msa_maxi_s_w((v4i32)val, 0); \ - val = __msa_min_s_w(max_m, (v4i32)val); \ -} while (0) - -#define CLIP_SW4_0_255(in0, in1, in2, in3) do { \ - CLIP_SW_0_255(in0); \ - CLIP_SW_0_255(in1); \ - CLIP_SW_0_255(in2); \ - CLIP_SW_0_255(in3); \ -} while (0) - -/* Description : Horizontal addition of 4 signed word elements of input vector - * Arguments : Input - in (signed word vector) - * Output - sum_m (i32 sum) - * Return Type - signed word (GP) - * Details : 4 signed word elements of 'in' vector are added together and - * the resulting integer sum is returned - */ -static WEBP_INLINE int32_t func_hadd_sw_s32(v4i32 in) { - const v2i64 res0_m = __msa_hadd_s_d((v4i32)in, (v4i32)in); - const v2i64 res1_m = __msa_splati_d(res0_m, 1); - const v2i64 out = res0_m + res1_m; - int32_t sum_m = __msa_copy_s_w((v4i32)out, 0); - return sum_m; -} -#define HADD_SW_S32(in) func_hadd_sw_s32(in) - -/* Description : Horizontal addition of 8 signed halfword elements - * Arguments : Input - in (signed halfword vector) - * Output - sum_m (s32 sum) - * Return Type - signed word - * Details : 8 signed halfword elements of input vector are added - * together and the resulting integer sum is returned - */ -static WEBP_INLINE int32_t func_hadd_sh_s32(v8i16 in) { - const v4i32 res = __msa_hadd_s_w(in, in); - const v2i64 res0 = __msa_hadd_s_d(res, res); - const v2i64 res1 = __msa_splati_d(res0, 1); - const v2i64 res2 = res0 + res1; - const int32_t sum_m = __msa_copy_s_w((v4i32)res2, 0); - return sum_m; -} -#define HADD_SH_S32(in) func_hadd_sh_s32(in) - -/* Description : Horizontal addition of 8 unsigned halfword elements - * Arguments : Input - in (unsigned halfword vector) - * Output - sum_m (u32 sum) - * Return Type - unsigned word - * Details : 8 unsigned halfword elements of input vector are added - * together and the resulting integer sum is returned - */ -static WEBP_INLINE uint32_t func_hadd_uh_u32(v8u16 in) { - uint32_t sum_m; - const v4u32 res_m = __msa_hadd_u_w(in, in); - v2u64 res0_m = __msa_hadd_u_d(res_m, res_m); - v2u64 res1_m = (v2u64)__msa_splati_d((v2i64)res0_m, 1); - res0_m = res0_m + res1_m; - sum_m = __msa_copy_s_w((v4i32)res0_m, 0); - return sum_m; -} -#define HADD_UH_U32(in) func_hadd_uh_u32(in) - -/* Description : Horizontal addition of signed half word vector elements - Arguments : Inputs - in0, in1 - Outputs - out0, out1 - Return Type - as per RTYPE - Details : Each signed odd half word element from 'in0' is added to - even signed half word element from 'in0' (pairwise) and the - halfword result is written in 'out0' -*/ -#define HADD_SH2(RTYPE, in0, in1, out0, out1) do { \ - out0 = (RTYPE)__msa_hadd_s_w((v8i16)in0, (v8i16)in0); \ - out1 = (RTYPE)__msa_hadd_s_w((v8i16)in1, (v8i16)in1); \ -} while (0) -#define HADD_SH2_SW(...) HADD_SH2(v4i32, __VA_ARGS__) - -#define HADD_SH4(RTYPE, in0, in1, in2, in3, out0, out1, out2, out3) do { \ - HADD_SH2(RTYPE, in0, in1, out0, out1); \ - HADD_SH2(RTYPE, in2, in3, out2, out3); \ -} while (0) -#define HADD_SH4_SW(...) HADD_SH4(v4i32, __VA_ARGS__) - -/* Description : Horizontal subtraction of unsigned byte vector elements - * Arguments : Inputs - in0, in1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Each unsigned odd byte element from 'in0' is subtracted from - * even unsigned byte element from 'in0' (pairwise) and the - * halfword result is written to 'out0' - */ -#define HSUB_UB2(RTYPE, in0, in1, out0, out1) do { \ - out0 = (RTYPE)__msa_hsub_u_h((v16u8)in0, (v16u8)in0); \ - out1 = (RTYPE)__msa_hsub_u_h((v16u8)in1, (v16u8)in1); \ -} while (0) -#define HSUB_UB2_UH(...) HSUB_UB2(v8u16, __VA_ARGS__) -#define HSUB_UB2_SH(...) HSUB_UB2(v8i16, __VA_ARGS__) -#define HSUB_UB2_SW(...) HSUB_UB2(v4i32, __VA_ARGS__) - -/* Description : Set element n input vector to GPR value - * Arguments : Inputs - in0, in1, in2, in3 - * Output - out - * Return Type - as per RTYPE - * Details : Set element 0 in vector 'out' to value specified in 'in0' - */ -#define INSERT_W2(RTYPE, in0, in1, out) do { \ - out = (RTYPE)__msa_insert_w((v4i32)out, 0, in0); \ - out = (RTYPE)__msa_insert_w((v4i32)out, 1, in1); \ -} while (0) -#define INSERT_W2_UB(...) INSERT_W2(v16u8, __VA_ARGS__) -#define INSERT_W2_SB(...) INSERT_W2(v16i8, __VA_ARGS__) - -#define INSERT_W4(RTYPE, in0, in1, in2, in3, out) do { \ - out = (RTYPE)__msa_insert_w((v4i32)out, 0, in0); \ - out = (RTYPE)__msa_insert_w((v4i32)out, 1, in1); \ - out = (RTYPE)__msa_insert_w((v4i32)out, 2, in2); \ - out = (RTYPE)__msa_insert_w((v4i32)out, 3, in3); \ -} while (0) -#define INSERT_W4_UB(...) INSERT_W4(v16u8, __VA_ARGS__) -#define INSERT_W4_SB(...) INSERT_W4(v16i8, __VA_ARGS__) -#define INSERT_W4_SW(...) INSERT_W4(v4i32, __VA_ARGS__) - -/* Description : Set element n of double word input vector to GPR value - * Arguments : Inputs - in0, in1 - * Output - out - * Return Type - as per RTYPE - * Details : Set element 0 in vector 'out' to GPR value specified in 'in0' - * Set element 1 in vector 'out' to GPR value specified in 'in1' - */ -#define INSERT_D2(RTYPE, in0, in1, out) do { \ - out = (RTYPE)__msa_insert_d((v2i64)out, 0, in0); \ - out = (RTYPE)__msa_insert_d((v2i64)out, 1, in1); \ -} while (0) -#define INSERT_D2_UB(...) INSERT_D2(v16u8, __VA_ARGS__) -#define INSERT_D2_SB(...) INSERT_D2(v16i8, __VA_ARGS__) - -/* Description : Interleave even byte elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even byte elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - */ -#define ILVEV_B2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvev_b((v16i8)in1, (v16i8)in0); \ - out1 = (RTYPE)__msa_ilvev_b((v16i8)in3, (v16i8)in2); \ -} while (0) -#define ILVEV_B2_UB(...) ILVEV_B2(v16u8, __VA_ARGS__) -#define ILVEV_B2_SB(...) ILVEV_B2(v16i8, __VA_ARGS__) -#define ILVEV_B2_UH(...) ILVEV_B2(v8u16, __VA_ARGS__) -#define ILVEV_B2_SH(...) ILVEV_B2(v8i16, __VA_ARGS__) -#define ILVEV_B2_SD(...) ILVEV_B2(v2i64, __VA_ARGS__) - -/* Description : Interleave odd byte elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Odd byte elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - */ -#define ILVOD_B2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvod_b((v16i8)in1, (v16i8)in0); \ - out1 = (RTYPE)__msa_ilvod_b((v16i8)in3, (v16i8)in2); \ -} while (0) -#define ILVOD_B2_UB(...) ILVOD_B2(v16u8, __VA_ARGS__) -#define ILVOD_B2_SB(...) ILVOD_B2(v16i8, __VA_ARGS__) -#define ILVOD_B2_UH(...) ILVOD_B2(v8u16, __VA_ARGS__) -#define ILVOD_B2_SH(...) ILVOD_B2(v8i16, __VA_ARGS__) -#define ILVOD_B2_SD(...) ILVOD_B2(v2i64, __VA_ARGS__) - -/* Description : Interleave even halfword elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even halfword elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - */ -#define ILVEV_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvev_h((v8i16)in1, (v8i16)in0); \ - out1 = (RTYPE)__msa_ilvev_h((v8i16)in3, (v8i16)in2); \ -} while (0) -#define ILVEV_H2_UB(...) ILVEV_H2(v16u8, __VA_ARGS__) -#define ILVEV_H2_UH(...) ILVEV_H2(v8u16, __VA_ARGS__) -#define ILVEV_H2_SH(...) ILVEV_H2(v8i16, __VA_ARGS__) -#define ILVEV_H2_SW(...) ILVEV_H2(v4i32, __VA_ARGS__) - -/* Description : Interleave odd halfword elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Odd halfword elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - */ -#define ILVOD_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvod_h((v8i16)in1, (v8i16)in0); \ - out1 = (RTYPE)__msa_ilvod_h((v8i16)in3, (v8i16)in2); \ -} while (0) -#define ILVOD_H2_UB(...) ILVOD_H2(v16u8, __VA_ARGS__) -#define ILVOD_H2_UH(...) ILVOD_H2(v8u16, __VA_ARGS__) -#define ILVOD_H2_SH(...) ILVOD_H2(v8i16, __VA_ARGS__) -#define ILVOD_H2_SW(...) ILVOD_H2(v4i32, __VA_ARGS__) - -/* Description : Interleave even word elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even word elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - */ -#define ILVEV_W2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvev_w((v4i32)in1, (v4i32)in0); \ - out1 = (RTYPE)__msa_ilvev_w((v4i32)in3, (v4i32)in2); \ -} while (0) -#define ILVEV_W2_UB(...) ILVEV_W2(v16u8, __VA_ARGS__) -#define ILVEV_W2_SB(...) ILVEV_W2(v16i8, __VA_ARGS__) -#define ILVEV_W2_UH(...) ILVEV_W2(v8u16, __VA_ARGS__) -#define ILVEV_W2_SD(...) ILVEV_W2(v2i64, __VA_ARGS__) - -/* Description : Interleave even-odd word elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even word elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - * Odd word elements of 'in2' and 'in3' are interleaved - * and written to 'out1' - */ -#define ILVEVOD_W2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvev_w((v4i32)in1, (v4i32)in0); \ - out1 = (RTYPE)__msa_ilvod_w((v4i32)in3, (v4i32)in2); \ -} while (0) -#define ILVEVOD_W2_UB(...) ILVEVOD_W2(v16u8, __VA_ARGS__) -#define ILVEVOD_W2_UH(...) ILVEVOD_W2(v8u16, __VA_ARGS__) -#define ILVEVOD_W2_SH(...) ILVEVOD_W2(v8i16, __VA_ARGS__) -#define ILVEVOD_W2_SW(...) ILVEVOD_W2(v4i32, __VA_ARGS__) - -/* Description : Interleave even-odd half-word elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even half-word elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - * Odd half-word elements of 'in2' and 'in3' are interleaved - * and written to 'out1' - */ -#define ILVEVOD_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvev_h((v8i16)in1, (v8i16)in0); \ - out1 = (RTYPE)__msa_ilvod_h((v8i16)in3, (v8i16)in2); \ -} while (0) -#define ILVEVOD_H2_UB(...) ILVEVOD_H2(v16u8, __VA_ARGS__) -#define ILVEVOD_H2_UH(...) ILVEVOD_H2(v8u16, __VA_ARGS__) -#define ILVEVOD_H2_SH(...) ILVEVOD_H2(v8i16, __VA_ARGS__) -#define ILVEVOD_H2_SW(...) ILVEVOD_H2(v4i32, __VA_ARGS__) - -/* Description : Interleave even double word elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even double word elements of 'in0' and 'in1' are interleaved - * and written to 'out0' - */ -#define ILVEV_D2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvev_d((v2i64)in1, (v2i64)in0); \ - out1 = (RTYPE)__msa_ilvev_d((v2i64)in3, (v2i64)in2); \ -} while (0) -#define ILVEV_D2_UB(...) ILVEV_D2(v16u8, __VA_ARGS__) -#define ILVEV_D2_SB(...) ILVEV_D2(v16i8, __VA_ARGS__) -#define ILVEV_D2_SW(...) ILVEV_D2(v4i32, __VA_ARGS__) -#define ILVEV_D2_SD(...) ILVEV_D2(v2i64, __VA_ARGS__) - -/* Description : Interleave left half of byte elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Left half of byte elements of 'in0' and 'in1' are interleaved - * and written to 'out0'. - */ -#define ILVL_B2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvl_b((v16i8)in0, (v16i8)in1); \ - out1 = (RTYPE)__msa_ilvl_b((v16i8)in2, (v16i8)in3); \ -} while (0) -#define ILVL_B2_UB(...) ILVL_B2(v16u8, __VA_ARGS__) -#define ILVL_B2_SB(...) ILVL_B2(v16i8, __VA_ARGS__) -#define ILVL_B2_UH(...) ILVL_B2(v8u16, __VA_ARGS__) -#define ILVL_B2_SH(...) ILVL_B2(v8i16, __VA_ARGS__) -#define ILVL_B2_SW(...) ILVL_B2(v4i32, __VA_ARGS__) - -/* Description : Interleave right half of byte elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Right half of byte elements of 'in0' and 'in1' are interleaved - * and written to out0. - */ -#define ILVR_B2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvr_b((v16i8)in0, (v16i8)in1); \ - out1 = (RTYPE)__msa_ilvr_b((v16i8)in2, (v16i8)in3); \ -} while (0) -#define ILVR_B2_UB(...) ILVR_B2(v16u8, __VA_ARGS__) -#define ILVR_B2_SB(...) ILVR_B2(v16i8, __VA_ARGS__) -#define ILVR_B2_UH(...) ILVR_B2(v8u16, __VA_ARGS__) -#define ILVR_B2_SH(...) ILVR_B2(v8i16, __VA_ARGS__) -#define ILVR_B2_SW(...) ILVR_B2(v4i32, __VA_ARGS__) - -#define ILVR_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - ILVR_B2(RTYPE, in0, in1, in2, in3, out0, out1); \ - ILVR_B2(RTYPE, in4, in5, in6, in7, out2, out3); \ -} while (0) -#define ILVR_B4_UB(...) ILVR_B4(v16u8, __VA_ARGS__) -#define ILVR_B4_SB(...) ILVR_B4(v16i8, __VA_ARGS__) -#define ILVR_B4_UH(...) ILVR_B4(v8u16, __VA_ARGS__) -#define ILVR_B4_SH(...) ILVR_B4(v8i16, __VA_ARGS__) -#define ILVR_B4_SW(...) ILVR_B4(v4i32, __VA_ARGS__) - -/* Description : Interleave right half of halfword elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Right half of halfword elements of 'in0' and 'in1' are - * interleaved and written to 'out0'. - */ -#define ILVR_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvr_h((v8i16)in0, (v8i16)in1); \ - out1 = (RTYPE)__msa_ilvr_h((v8i16)in2, (v8i16)in3); \ -} while (0) -#define ILVR_H2_UB(...) ILVR_H2(v16u8, __VA_ARGS__) -#define ILVR_H2_SH(...) ILVR_H2(v8i16, __VA_ARGS__) -#define ILVR_H2_SW(...) ILVR_H2(v4i32, __VA_ARGS__) - -#define ILVR_H4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - ILVR_H2(RTYPE, in0, in1, in2, in3, out0, out1); \ - ILVR_H2(RTYPE, in4, in5, in6, in7, out2, out3); \ -} while (0) -#define ILVR_H4_UB(...) ILVR_H4(v16u8, __VA_ARGS__) -#define ILVR_H4_SH(...) ILVR_H4(v8i16, __VA_ARGS__) -#define ILVR_H4_SW(...) ILVR_H4(v4i32, __VA_ARGS__) - -/* Description : Interleave right half of double word elements from vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Right half of double word elements of 'in0' and 'in1' are - * interleaved and written to 'out0'. - */ -#define ILVR_D2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvr_d((v2i64)in0, (v2i64)in1); \ - out1 = (RTYPE)__msa_ilvr_d((v2i64)in2, (v2i64)in3); \ -} while (0) -#define ILVR_D2_UB(...) ILVR_D2(v16u8, __VA_ARGS__) -#define ILVR_D2_SB(...) ILVR_D2(v16i8, __VA_ARGS__) -#define ILVR_D2_SH(...) ILVR_D2(v8i16, __VA_ARGS__) - -#define ILVR_D4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - ILVR_D2(RTYPE, in0, in1, in2, in3, out0, out1); \ - ILVR_D2(RTYPE, in4, in5, in6, in7, out2, out3); \ -} while (0) -#define ILVR_D4_SB(...) ILVR_D4(v16i8, __VA_ARGS__) -#define ILVR_D4_UB(...) ILVR_D4(v16u8, __VA_ARGS__) - -/* Description : Interleave both left and right half of input vectors - * Arguments : Inputs - in0, in1 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Right half of byte elements from 'in0' and 'in1' are - * interleaved and written to 'out0' - */ -#define ILVRL_B2(RTYPE, in0, in1, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvr_b((v16i8)in0, (v16i8)in1); \ - out1 = (RTYPE)__msa_ilvl_b((v16i8)in0, (v16i8)in1); \ -} while (0) -#define ILVRL_B2_UB(...) ILVRL_B2(v16u8, __VA_ARGS__) -#define ILVRL_B2_SB(...) ILVRL_B2(v16i8, __VA_ARGS__) -#define ILVRL_B2_UH(...) ILVRL_B2(v8u16, __VA_ARGS__) -#define ILVRL_B2_SH(...) ILVRL_B2(v8i16, __VA_ARGS__) -#define ILVRL_B2_SW(...) ILVRL_B2(v4i32, __VA_ARGS__) - -#define ILVRL_H2(RTYPE, in0, in1, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvr_h((v8i16)in0, (v8i16)in1); \ - out1 = (RTYPE)__msa_ilvl_h((v8i16)in0, (v8i16)in1); \ -} while (0) -#define ILVRL_H2_UB(...) ILVRL_H2(v16u8, __VA_ARGS__) -#define ILVRL_H2_SB(...) ILVRL_H2(v16i8, __VA_ARGS__) -#define ILVRL_H2_SH(...) ILVRL_H2(v8i16, __VA_ARGS__) -#define ILVRL_H2_SW(...) ILVRL_H2(v4i32, __VA_ARGS__) -#define ILVRL_H2_UW(...) ILVRL_H2(v4u32, __VA_ARGS__) - -#define ILVRL_W2(RTYPE, in0, in1, out0, out1) do { \ - out0 = (RTYPE)__msa_ilvr_w((v4i32)in0, (v4i32)in1); \ - out1 = (RTYPE)__msa_ilvl_w((v4i32)in0, (v4i32)in1); \ -} while (0) -#define ILVRL_W2_UB(...) ILVRL_W2(v16u8, __VA_ARGS__) -#define ILVRL_W2_SH(...) ILVRL_W2(v8i16, __VA_ARGS__) -#define ILVRL_W2_SW(...) ILVRL_W2(v4i32, __VA_ARGS__) -#define ILVRL_W2_UW(...) ILVRL_W2(v4u32, __VA_ARGS__) - -/* Description : Pack even byte elements of vector pairs - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even byte elements of 'in0' are copied to the left half of - * 'out0' & even byte elements of 'in1' are copied to the right - * half of 'out0'. - */ -#define PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_pckev_b((v16i8)in0, (v16i8)in1); \ - out1 = (RTYPE)__msa_pckev_b((v16i8)in2, (v16i8)in3); \ -} while (0) -#define PCKEV_B2_SB(...) PCKEV_B2(v16i8, __VA_ARGS__) -#define PCKEV_B2_UB(...) PCKEV_B2(v16u8, __VA_ARGS__) -#define PCKEV_B2_SH(...) PCKEV_B2(v8i16, __VA_ARGS__) -#define PCKEV_B2_SW(...) PCKEV_B2(v4i32, __VA_ARGS__) - -#define PCKEV_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1); \ - PCKEV_B2(RTYPE, in4, in5, in6, in7, out2, out3); \ -} while (0) -#define PCKEV_B4_SB(...) PCKEV_B4(v16i8, __VA_ARGS__) -#define PCKEV_B4_UB(...) PCKEV_B4(v16u8, __VA_ARGS__) -#define PCKEV_B4_SH(...) PCKEV_B4(v8i16, __VA_ARGS__) -#define PCKEV_B4_SW(...) PCKEV_B4(v4i32, __VA_ARGS__) - -/* Description : Pack even halfword elements of vector pairs - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even halfword elements of 'in0' are copied to the left half of - * 'out0' & even halfword elements of 'in1' are copied to the - * right half of 'out0'. - */ -#define PCKEV_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_pckev_h((v8i16)in0, (v8i16)in1); \ - out1 = (RTYPE)__msa_pckev_h((v8i16)in2, (v8i16)in3); \ -} while (0) -#define PCKEV_H2_UH(...) PCKEV_H2(v8u16, __VA_ARGS__) -#define PCKEV_H2_SH(...) PCKEV_H2(v8i16, __VA_ARGS__) -#define PCKEV_H2_SW(...) PCKEV_H2(v4i32, __VA_ARGS__) -#define PCKEV_H2_UW(...) PCKEV_H2(v4u32, __VA_ARGS__) - -/* Description : Pack even word elements of vector pairs - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Even word elements of 'in0' are copied to the left half of - * 'out0' & even word elements of 'in1' are copied to the - * right half of 'out0'. - */ -#define PCKEV_W2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_pckev_w((v4i32)in0, (v4i32)in1); \ - out1 = (RTYPE)__msa_pckev_w((v4i32)in2, (v4i32)in3); \ -} while (0) -#define PCKEV_W2_UH(...) PCKEV_W2(v8u16, __VA_ARGS__) -#define PCKEV_W2_SH(...) PCKEV_W2(v8i16, __VA_ARGS__) -#define PCKEV_W2_SW(...) PCKEV_W2(v4i32, __VA_ARGS__) -#define PCKEV_W2_UW(...) PCKEV_W2(v4u32, __VA_ARGS__) - -/* Description : Pack odd halfword elements of vector pairs - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Odd halfword elements of 'in0' are copied to the left half of - * 'out0' & odd halfword elements of 'in1' are copied to the - * right half of 'out0'. - */ -#define PCKOD_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_pckod_h((v8i16)in0, (v8i16)in1); \ - out1 = (RTYPE)__msa_pckod_h((v8i16)in2, (v8i16)in3); \ -} while (0) -#define PCKOD_H2_UH(...) PCKOD_H2(v8u16, __VA_ARGS__) -#define PCKOD_H2_SH(...) PCKOD_H2(v8i16, __VA_ARGS__) -#define PCKOD_H2_SW(...) PCKOD_H2(v4i32, __VA_ARGS__) -#define PCKOD_H2_UW(...) PCKOD_H2(v4u32, __VA_ARGS__) - -/* Description : Arithmetic immediate shift right all elements of word vector - * Arguments : Inputs - in0, in1, shift - * Outputs - in place operation - * Return Type - as per input vector RTYPE - * Details : Each element of vector 'in0' is right shifted by 'shift' and - * the result is written in-place. 'shift' is a GP variable. - */ -#define SRAI_W2(RTYPE, in0, in1, shift_val) do { \ - in0 = (RTYPE)SRAI_W(in0, shift_val); \ - in1 = (RTYPE)SRAI_W(in1, shift_val); \ -} while (0) -#define SRAI_W2_SW(...) SRAI_W2(v4i32, __VA_ARGS__) -#define SRAI_W2_UW(...) SRAI_W2(v4u32, __VA_ARGS__) - -#define SRAI_W4(RTYPE, in0, in1, in2, in3, shift_val) do { \ - SRAI_W2(RTYPE, in0, in1, shift_val); \ - SRAI_W2(RTYPE, in2, in3, shift_val); \ -} while (0) -#define SRAI_W4_SW(...) SRAI_W4(v4i32, __VA_ARGS__) -#define SRAI_W4_UW(...) SRAI_W4(v4u32, __VA_ARGS__) - -/* Description : Arithmetic shift right all elements of half-word vector - * Arguments : Inputs - in0, in1, shift - * Outputs - in place operation - * Return Type - as per input vector RTYPE - * Details : Each element of vector 'in0' is right shifted by 'shift' and - * the result is written in-place. 'shift' is a GP variable. - */ -#define SRAI_H2(RTYPE, in0, in1, shift_val) do { \ - in0 = (RTYPE)SRAI_H(in0, shift_val); \ - in1 = (RTYPE)SRAI_H(in1, shift_val); \ -} while (0) -#define SRAI_H2_SH(...) SRAI_H2(v8i16, __VA_ARGS__) -#define SRAI_H2_UH(...) SRAI_H2(v8u16, __VA_ARGS__) - -/* Description : Arithmetic rounded shift right all elements of word vector - * Arguments : Inputs - in0, in1, shift - * Outputs - in place operation - * Return Type - as per input vector RTYPE - * Details : Each element of vector 'in0' is right shifted by 'shift' and - * the result is written in-place. 'shift' is a GP variable. - */ -#define SRARI_W2(RTYPE, in0, in1, shift) do { \ - in0 = (RTYPE)__msa_srari_w((v4i32)in0, shift); \ - in1 = (RTYPE)__msa_srari_w((v4i32)in1, shift); \ -} while (0) -#define SRARI_W2_SW(...) SRARI_W2(v4i32, __VA_ARGS__) - -#define SRARI_W4(RTYPE, in0, in1, in2, in3, shift) do { \ - SRARI_W2(RTYPE, in0, in1, shift); \ - SRARI_W2(RTYPE, in2, in3, shift); \ -} while (0) -#define SRARI_W4_SH(...) SRARI_W4(v8i16, __VA_ARGS__) -#define SRARI_W4_UW(...) SRARI_W4(v4u32, __VA_ARGS__) -#define SRARI_W4_SW(...) SRARI_W4(v4i32, __VA_ARGS__) - -/* Description : Shift right arithmetic rounded double words - * Arguments : Inputs - in0, in1, shift - * Outputs - in place operation - * Return Type - as per RTYPE - * Details : Each element of vector 'in0' is shifted right arithmetically by - * the number of bits in the corresponding element in the vector - * 'shift'. The last discarded bit is added to shifted value for - * rounding and the result is written in-place. - * 'shift' is a vector. - */ -#define SRAR_D2(RTYPE, in0, in1, shift) do { \ - in0 = (RTYPE)__msa_srar_d((v2i64)in0, (v2i64)shift); \ - in1 = (RTYPE)__msa_srar_d((v2i64)in1, (v2i64)shift); \ -} while (0) -#define SRAR_D2_SW(...) SRAR_D2(v4i32, __VA_ARGS__) -#define SRAR_D2_SD(...) SRAR_D2(v2i64, __VA_ARGS__) -#define SRAR_D2_UD(...) SRAR_D2(v2u64, __VA_ARGS__) - -#define SRAR_D4(RTYPE, in0, in1, in2, in3, shift) do { \ - SRAR_D2(RTYPE, in0, in1, shift); \ - SRAR_D2(RTYPE, in2, in3, shift); \ -} while (0) -#define SRAR_D4_SD(...) SRAR_D4(v2i64, __VA_ARGS__) -#define SRAR_D4_UD(...) SRAR_D4(v2u64, __VA_ARGS__) - -/* Description : Addition of 2 pairs of half-word vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Details : Each element in 'in0' is added to 'in1' and result is written - * to 'out0'. - */ -#define ADDVI_H2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)ADDVI_H(in0, in1); \ - out1 = (RTYPE)ADDVI_H(in2, in3); \ -} while (0) -#define ADDVI_H2_SH(...) ADDVI_H2(v8i16, __VA_ARGS__) -#define ADDVI_H2_UH(...) ADDVI_H2(v8u16, __VA_ARGS__) - -/* Description : Addition of 2 pairs of word vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Details : Each element in 'in0' is added to 'in1' and result is written - * to 'out0'. - */ -#define ADDVI_W2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)ADDVI_W(in0, in1); \ - out1 = (RTYPE)ADDVI_W(in2, in3); \ -} while (0) -#define ADDVI_W2_SW(...) ADDVI_W2(v4i32, __VA_ARGS__) - -/* Description : Fill 2 pairs of word vectors with GP registers - * Arguments : Inputs - in0, in1 - * Outputs - out0, out1 - * Details : GP register in0 is replicated in each word element of out0 - * GP register in1 is replicated in each word element of out1 - */ -#define FILL_W2(RTYPE, in0, in1, out0, out1) do { \ - out0 = (RTYPE)__msa_fill_w(in0); \ - out1 = (RTYPE)__msa_fill_w(in1); \ -} while (0) -#define FILL_W2_SW(...) FILL_W2(v4i32, __VA_ARGS__) - -/* Description : Addition of 2 pairs of vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Details : Each element in 'in0' is added to 'in1' and result is written - * to 'out0'. - */ -#define ADD2(in0, in1, in2, in3, out0, out1) do { \ - out0 = in0 + in1; \ - out1 = in2 + in3; \ -} while (0) - -#define ADD4(in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - ADD2(in0, in1, in2, in3, out0, out1); \ - ADD2(in4, in5, in6, in7, out2, out3); \ -} while (0) - -/* Description : Subtraction of 2 pairs of vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Details : Each element in 'in1' is subtracted from 'in0' and result is - * written to 'out0'. - */ -#define SUB2(in0, in1, in2, in3, out0, out1) do { \ - out0 = in0 - in1; \ - out1 = in2 - in3; \ -} while (0) - -#define SUB3(in0, in1, in2, in3, in4, in5, out0, out1, out2) do { \ - out0 = in0 - in1; \ - out1 = in2 - in3; \ - out2 = in4 - in5; \ -} while (0) - -#define SUB4(in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - out0 = in0 - in1; \ - out1 = in2 - in3; \ - out2 = in4 - in5; \ - out3 = in6 - in7; \ -} while (0) - -/* Description : Addition - Subtraction of input vectors - * Arguments : Inputs - in0, in1 - * Outputs - out0, out1 - * Details : Each element in 'in1' is added to 'in0' and result is - * written to 'out0'. - * Each element in 'in1' is subtracted from 'in0' and result is - * written to 'out1'. - */ -#define ADDSUB2(in0, in1, out0, out1) do { \ - out0 = in0 + in1; \ - out1 = in0 - in1; \ -} while (0) - -/* Description : Multiplication of pairs of vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1 - * Details : Each element from 'in0' is multiplied with elements from 'in1' - * and the result is written to 'out0' - */ -#define MUL2(in0, in1, in2, in3, out0, out1) do { \ - out0 = in0 * in1; \ - out1 = in2 * in3; \ -} while (0) - -#define MUL4(in0, in1, in2, in3, in4, in5, in6, in7, \ - out0, out1, out2, out3) do { \ - MUL2(in0, in1, in2, in3, out0, out1); \ - MUL2(in4, in5, in6, in7, out2, out3); \ -} while (0) - -/* Description : Sign extend halfword elements from right half of the vector - * Arguments : Input - in (halfword vector) - * Output - out (sign extended word vector) - * Return Type - signed word - * Details : Sign bit of halfword elements from input vector 'in' is - * extracted and interleaved with same vector 'in0' to generate - * 4 word elements keeping sign intact - */ -#define UNPCK_R_SH_SW(in, out) do { \ - const v8i16 sign_m = __msa_clti_s_h((v8i16)in, 0); \ - out = (v4i32)__msa_ilvr_h(sign_m, (v8i16)in); \ -} while (0) - -/* Description : Sign extend halfword elements from input vector and return - * the result in pair of vectors - * Arguments : Input - in (halfword vector) - * Outputs - out0, out1 (sign extended word vectors) - * Return Type - signed word - * Details : Sign bit of halfword elements from input vector 'in' is - * extracted and interleaved right with same vector 'in0' to - * generate 4 signed word elements in 'out0' - * Then interleaved left with same vector 'in0' to - * generate 4 signed word elements in 'out1' - */ -#define UNPCK_SH_SW(in, out0, out1) do { \ - const v8i16 tmp_m = __msa_clti_s_h((v8i16)in, 0); \ - ILVRL_H2_SW(tmp_m, in, out0, out1); \ -} while (0) - -/* Description : Butterfly of 4 input vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1, out2, out3 - * Details : Butterfly operation - */ -#define BUTTERFLY_4(in0, in1, in2, in3, out0, out1, out2, out3) do { \ - out0 = in0 + in3; \ - out1 = in1 + in2; \ - out2 = in1 - in2; \ - out3 = in0 - in3; \ -} while (0) - -/* Description : Transpose 16x4 block into 4x16 with byte elements in vectors - * Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7, - * in8, in9, in10, in11, in12, in13, in14, in15 - * Outputs - out0, out1, out2, out3 - * Return Type - unsigned byte - */ -#define TRANSPOSE16x4_UB_UB(in0, in1, in2, in3, in4, in5, in6, in7, \ - in8, in9, in10, in11, in12, in13, in14, in15, \ - out0, out1, out2, out3) do { \ - v2i64 tmp0_m, tmp1_m, tmp2_m, tmp3_m, tmp4_m, tmp5_m; \ - ILVEV_W2_SD(in0, in4, in8, in12, tmp2_m, tmp3_m); \ - ILVEV_W2_SD(in1, in5, in9, in13, tmp0_m, tmp1_m); \ - ILVEV_D2_UB(tmp2_m, tmp3_m, tmp0_m, tmp1_m, out1, out3); \ - ILVEV_W2_SD(in2, in6, in10, in14, tmp4_m, tmp5_m); \ - ILVEV_W2_SD(in3, in7, in11, in15, tmp0_m, tmp1_m); \ - ILVEV_D2_SD(tmp4_m, tmp5_m, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \ - ILVEV_B2_SD(out1, out3, tmp2_m, tmp3_m, tmp0_m, tmp1_m); \ - ILVEVOD_H2_UB(tmp0_m, tmp1_m, tmp0_m, tmp1_m, out0, out2); \ - ILVOD_B2_SD(out1, out3, tmp2_m, tmp3_m, tmp0_m, tmp1_m); \ - ILVEVOD_H2_UB(tmp0_m, tmp1_m, tmp0_m, tmp1_m, out1, out3); \ -} while (0) - -/* Description : Transpose 16x8 block into 8x16 with byte elements in vectors - * Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7, - * in8, in9, in10, in11, in12, in13, in14, in15 - * Outputs - out0, out1, out2, out3, out4, out5, out6, out7 - * Return Type - unsigned byte - */ -#define TRANSPOSE16x8_UB_UB(in0, in1, in2, in3, in4, in5, in6, in7, \ - in8, in9, in10, in11, in12, in13, in14, in15, \ - out0, out1, out2, out3, out4, out5, \ - out6, out7) do { \ - v8i16 tmp0_m, tmp1_m, tmp4_m, tmp5_m, tmp6_m, tmp7_m; \ - v4i32 tmp2_m, tmp3_m; \ - ILVEV_D2_UB(in0, in8, in1, in9, out7, out6); \ - ILVEV_D2_UB(in2, in10, in3, in11, out5, out4); \ - ILVEV_D2_UB(in4, in12, in5, in13, out3, out2); \ - ILVEV_D2_UB(in6, in14, in7, in15, out1, out0); \ - ILVEV_B2_SH(out7, out6, out5, out4, tmp0_m, tmp1_m); \ - ILVOD_B2_SH(out7, out6, out5, out4, tmp4_m, tmp5_m); \ - ILVEV_B2_UB(out3, out2, out1, out0, out5, out7); \ - ILVOD_B2_SH(out3, out2, out1, out0, tmp6_m, tmp7_m); \ - ILVEV_H2_SW(tmp0_m, tmp1_m, out5, out7, tmp2_m, tmp3_m); \ - ILVEVOD_W2_UB(tmp2_m, tmp3_m, tmp2_m, tmp3_m, out0, out4); \ - ILVOD_H2_SW(tmp0_m, tmp1_m, out5, out7, tmp2_m, tmp3_m); \ - ILVEVOD_W2_UB(tmp2_m, tmp3_m, tmp2_m, tmp3_m, out2, out6); \ - ILVEV_H2_SW(tmp4_m, tmp5_m, tmp6_m, tmp7_m, tmp2_m, tmp3_m); \ - ILVEVOD_W2_UB(tmp2_m, tmp3_m, tmp2_m, tmp3_m, out1, out5); \ - ILVOD_H2_SW(tmp4_m, tmp5_m, tmp6_m, tmp7_m, tmp2_m, tmp3_m); \ - ILVEVOD_W2_UB(tmp2_m, tmp3_m, tmp2_m, tmp3_m, out3, out7); \ -} while (0) - -/* Description : Transpose 4x4 block with word elements in vectors - * Arguments : Inputs - in0, in1, in2, in3 - * Outputs - out0, out1, out2, out3 - * Return Type - as per RTYPE - */ -#define TRANSPOSE4x4_W(RTYPE, in0, in1, in2, in3, \ - out0, out1, out2, out3) do { \ - v4i32 s0_m, s1_m, s2_m, s3_m; \ - ILVRL_W2_SW(in1, in0, s0_m, s1_m); \ - ILVRL_W2_SW(in3, in2, s2_m, s3_m); \ - out0 = (RTYPE)__msa_ilvr_d((v2i64)s2_m, (v2i64)s0_m); \ - out1 = (RTYPE)__msa_ilvl_d((v2i64)s2_m, (v2i64)s0_m); \ - out2 = (RTYPE)__msa_ilvr_d((v2i64)s3_m, (v2i64)s1_m); \ - out3 = (RTYPE)__msa_ilvl_d((v2i64)s3_m, (v2i64)s1_m); \ -} while (0) -#define TRANSPOSE4x4_SW_SW(...) TRANSPOSE4x4_W(v4i32, __VA_ARGS__) - -/* Description : Add block 4x4 - * Arguments : Inputs - in0, in1, in2, in3, pdst, stride - * Details : Least significant 4 bytes from each input vector are added to - * the destination bytes, clipped between 0-255 and stored. - */ -#define ADDBLK_ST4x4_UB(in0, in1, in2, in3, pdst, stride) do { \ - uint32_t src0_m, src1_m, src2_m, src3_m; \ - v8i16 inp0_m, inp1_m, res0_m, res1_m; \ - v16i8 dst0_m = { 0 }; \ - v16i8 dst1_m = { 0 }; \ - const v16i8 zero_m = { 0 }; \ - ILVR_D2_SH(in1, in0, in3, in2, inp0_m, inp1_m); \ - LW4(pdst, stride, src0_m, src1_m, src2_m, src3_m); \ - INSERT_W2_SB(src0_m, src1_m, dst0_m); \ - INSERT_W2_SB(src2_m, src3_m, dst1_m); \ - ILVR_B2_SH(zero_m, dst0_m, zero_m, dst1_m, res0_m, res1_m); \ - ADD2(res0_m, inp0_m, res1_m, inp1_m, res0_m, res1_m); \ - CLIP_SH2_0_255(res0_m, res1_m); \ - PCKEV_B2_SB(res0_m, res0_m, res1_m, res1_m, dst0_m, dst1_m); \ - ST4x4_UB(dst0_m, dst1_m, 0, 1, 0, 1, pdst, stride); \ -} while (0) - -/* Description : Pack even byte elements, extract 0 & 2 index words from pair - * of results and store 4 words in destination memory as per - * stride - * Arguments : Inputs - in0, in1, in2, in3, pdst, stride - */ -#define PCKEV_ST4x4_UB(in0, in1, in2, in3, pdst, stride) do { \ - v16i8 tmp0_m, tmp1_m; \ - PCKEV_B2_SB(in1, in0, in3, in2, tmp0_m, tmp1_m); \ - ST4x4_UB(tmp0_m, tmp1_m, 0, 2, 0, 2, pdst, stride); \ -} while (0) - -/* Description : average with rounding (in0 + in1 + 1) / 2. - * Arguments : Inputs - in0, in1, in2, in3, - * Outputs - out0, out1 - * Return Type - as per RTYPE - * Details : Each unsigned byte element from 'in0' vector is added with - * each unsigned byte element from 'in1' vector. Then the average - * with rounding is calculated and written to 'out0' - */ -#define AVER_UB2(RTYPE, in0, in1, in2, in3, out0, out1) do { \ - out0 = (RTYPE)__msa_aver_u_b((v16u8)in0, (v16u8)in1); \ - out1 = (RTYPE)__msa_aver_u_b((v16u8)in2, (v16u8)in3); \ -} while (0) -#define AVER_UB2_UB(...) AVER_UB2(v16u8, __VA_ARGS__) - -#endif // WEBP_DSP_MSA_MACRO_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/neon.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/neon.h deleted file mode 100644 index aa1dea1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/neon.h +++ /dev/null @@ -1,101 +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. -// ----------------------------------------------------------------------------- -// -// NEON common code. - -#ifndef WEBP_DSP_NEON_H_ -#define WEBP_DSP_NEON_H_ - -#include - -#include "src/dsp/dsp.h" - -// Right now, some intrinsics functions seem slower, so we disable them -// 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 - -#define INIT_VECTOR2(v, a, b) do { \ - v.val[0] = a; \ - v.val[1] = b; \ -} while (0) - -#define INIT_VECTOR3(v, a, b, c) do { \ - v.val[0] = a; \ - v.val[1] = b; \ - v.val[2] = c; \ -} while (0) - -#define INIT_VECTOR4(v, a, b, c, d) do { \ - v.val[0] = a; \ - v.val[1] = b; \ - v.val[2] = c; \ - v.val[3] = d; \ -} while (0) - -// 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_CLANG_PREREQ(3,8) || LOCAL_GCC_PREREQ(4,8) || defined(__aarch64__)) -#define WORK_AROUND_GCC -#endif - -static WEBP_INLINE int32x4x4_t Transpose4x4_NEON(const int32x4x4_t rows) { - uint64x2x2_t row01, row23; - - row01.val[0] = vreinterpretq_u64_s32(rows.val[0]); - row01.val[1] = vreinterpretq_u64_s32(rows.val[1]); - row23.val[0] = vreinterpretq_u64_s32(rows.val[2]); - row23.val[1] = vreinterpretq_u64_s32(rows.val[3]); - // Transpose 64-bit values (there's no vswp equivalent) - { - const uint64x1_t row0h = vget_high_u64(row01.val[0]); - const uint64x1_t row2l = vget_low_u64(row23.val[0]); - const uint64x1_t row1h = vget_high_u64(row01.val[1]); - const uint64x1_t row3l = vget_low_u64(row23.val[1]); - row01.val[0] = vcombine_u64(vget_low_u64(row01.val[0]), row2l); - row23.val[0] = vcombine_u64(row0h, vget_high_u64(row23.val[0])); - row01.val[1] = vcombine_u64(vget_low_u64(row01.val[1]), row3l); - row23.val[1] = vcombine_u64(row1h, vget_high_u64(row23.val[1])); - } - { - const int32x4x2_t out01 = vtrnq_s32(vreinterpretq_s32_u64(row01.val[0]), - vreinterpretq_s32_u64(row01.val[1])); - const int32x4x2_t out23 = vtrnq_s32(vreinterpretq_s32_u64(row23.val[0]), - vreinterpretq_s32_u64(row23.val[1])); - int32x4x4_t out; - out.val[0] = out01.val[0]; - out.val[1] = out01.val[1]; - out.val[2] = out23.val[0]; - out.val[3] = out23.val[1]; - return out; - } -} - -#if 0 // Useful debug macro. -#include -#define PRINT_REG(REG, SIZE) do { \ - int i; \ - printf("%s \t[%d]: 0x", #REG, SIZE); \ - if (SIZE == 8) { \ - uint8_t _tmp[8]; \ - vst1_u8(_tmp, (REG)); \ - for (i = 0; i < 8; ++i) printf("%.2x ", _tmp[i]); \ - } else if (SIZE == 16) { \ - uint16_t _tmp[4]; \ - vst1_u16(_tmp, (REG)); \ - for (i = 0; i < 4; ++i) printf("%.4x ", _tmp[i]); \ - } \ - printf("\n"); \ -} while (0) -#endif - -#endif // WEBP_DSP_NEON_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/quant.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/quant.h deleted file mode 100644 index 5ba6f9c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/quant.h +++ /dev/null @@ -1,70 +0,0 @@ -// 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 "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) - -#endif // WEBP_DSP_QUANT_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/yuv.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/yuv.h deleted file mode 100644 index c12be1d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/dsp/yuv.h +++ /dev/null @@ -1,210 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// inline YUV<->RGB conversion function -// -// The exact naming is Y'CbCr, following the ITU-R BT.601 standard. -// More information at: http://en.wikipedia.org/wiki/YCbCr -// Y = 0.2569 * R + 0.5044 * G + 0.0979 * B + 16 -// U = -0.1483 * R - 0.2911 * G + 0.4394 * B + 128 -// V = 0.4394 * R - 0.3679 * G - 0.0715 * B + 128 -// We use 16bit fixed point operations for RGB->YUV conversion (YUV_FIX). -// -// For the Y'CbCr to RGB conversion, the BT.601 specification reads: -// R = 1.164 * (Y-16) + 1.596 * (V-128) -// G = 1.164 * (Y-16) - 0.813 * (V-128) - 0.391 * (U-128) -// B = 1.164 * (Y-16) + 2.018 * (U-128) -// where Y is in the [16,235] range, and U/V in the [16,240] range. -// -// The fixed-point implementation used here is: -// R = (19077 . y + 26149 . v - 14234) >> 6 -// G = (19077 . y - 6419 . u - 13320 . v + 8708) >> 6 -// B = (19077 . y + 33050 . u - 17685) >> 6 -// where the '.' operator is the mulhi_epu16 variant: -// a . b = ((a << 8) * b) >> 16 -// that preserves 8 bits of fractional precision before final descaling. - -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_DSP_YUV_H_ -#define WEBP_DSP_YUV_H_ - -#include "src/dsp/dsp.h" -#include "src/dec/vp8_dec.h" - -//------------------------------------------------------------------------------ -// YUV -> RGB conversion - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - YUV_FIX = 16, // fixed-point precision for RGB->YUV - YUV_HALF = 1 << (YUV_FIX - 1), - - YUV_FIX2 = 6, // fixed-point precision for YUV->RGB - YUV_MASK2 = (256 << YUV_FIX2) - 1 -}; - -//------------------------------------------------------------------------------ -// slower on x86 by ~7-8%, but bit-exact with the SSE2/NEON version - -static WEBP_INLINE int MultHi(int v, int coeff) { // _mm_mulhi_epu16 emulation - return (v * coeff) >> 8; -} - -static WEBP_INLINE int VP8Clip8(int v) { - return ((v & ~YUV_MASK2) == 0) ? (v >> YUV_FIX2) : (v < 0) ? 0 : 255; -} - -static WEBP_INLINE int VP8YUVToR(int y, int v) { - return VP8Clip8(MultHi(y, 19077) + MultHi(v, 26149) - 14234); -} - -static WEBP_INLINE int VP8YUVToG(int y, int u, int v) { - return VP8Clip8(MultHi(y, 19077) - MultHi(u, 6419) - MultHi(v, 13320) + 8708); -} - -static WEBP_INLINE int VP8YUVToB(int y, int u) { - return VP8Clip8(MultHi(y, 19077) + MultHi(u, 33050) - 17685); -} - -static WEBP_INLINE void VP8YuvToRgb(int y, int u, int v, - uint8_t* const rgb) { - rgb[0] = VP8YUVToR(y, v); - rgb[1] = VP8YUVToG(y, u, v); - rgb[2] = VP8YUVToB(y, u); -} - -static WEBP_INLINE void VP8YuvToBgr(int y, int u, int v, - uint8_t* const bgr) { - bgr[0] = VP8YUVToB(y, u); - bgr[1] = VP8YUVToG(y, u, v); - bgr[2] = VP8YUVToR(y, v); -} - -static WEBP_INLINE void VP8YuvToRgb565(int y, int u, int v, - uint8_t* const rgb) { - const int r = VP8YUVToR(y, v); // 5 usable bits - const int g = VP8YUVToG(y, u, v); // 6 usable bits - const int b = VP8YUVToB(y, u); // 5 usable bits - const int rg = (r & 0xf8) | (g >> 5); - const int gb = ((g << 3) & 0xe0) | (b >> 3); -#if (WEBP_SWAP_16BIT_CSP == 1) - rgb[0] = gb; - rgb[1] = rg; -#else - rgb[0] = rg; - rgb[1] = gb; -#endif -} - -static WEBP_INLINE void VP8YuvToRgba4444(int y, int u, int v, - uint8_t* const argb) { - const int r = VP8YUVToR(y, v); // 4 usable bits - const int g = VP8YUVToG(y, u, v); // 4 usable bits - 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 -#if (WEBP_SWAP_16BIT_CSP == 1) - argb[0] = ba; - argb[1] = rg; -#else - argb[0] = rg; - argb[1] = ba; -#endif -} - -//----------------------------------------------------------------------------- -// Alpha handling variants - -static WEBP_INLINE void VP8YuvToArgb(uint8_t y, uint8_t u, uint8_t v, - uint8_t* const argb) { - argb[0] = 0xff; - VP8YuvToRgb(y, u, v, argb + 1); -} - -static WEBP_INLINE void VP8YuvToBgra(uint8_t y, uint8_t u, uint8_t v, - uint8_t* const bgra) { - VP8YuvToBgr(y, u, v, bgra); - bgra[3] = 0xff; -} - -static WEBP_INLINE void VP8YuvToRgba(uint8_t y, uint8_t u, uint8_t v, - uint8_t* const rgba) { - VP8YuvToRgb(y, u, v, rgba); - rgba[3] = 0xff; -} - -//----------------------------------------------------------------------------- -// 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_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 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 - -// Stub functions that can be called with various rounding values: -static WEBP_INLINE int VP8ClipUV(int uv, int rounding) { - uv = (uv + rounding + (128 << (YUV_FIX + 2))) >> (YUV_FIX + 2); - return ((uv & ~0xff) == 0) ? uv : (uv < 0) ? 0 : 255; -} - -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 -} - -static WEBP_INLINE int VP8RGBToU(int r, int g, int b, int rounding) { - const int u = -9719 * r - 19081 * g + 28800 * b; - return VP8ClipUV(u, rounding); -} - -static WEBP_INLINE int VP8RGBToV(int r, int g, int b, int rounding) { - const int v = +28800 * r - 24116 * g - 4684 * b; - return VP8ClipUV(v, rounding); -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_DSP_YUV_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/backward_references_enc.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/backward_references_enc.h deleted file mode 100644 index 103ddfd..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/backward_references_enc.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2012 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: Jyrki Alakuijala (jyrki@google.com) -// - -#ifndef WEBP_ENC_BACKWARD_REFERENCES_ENC_H_ -#define WEBP_ENC_BACKWARD_REFERENCES_ENC_H_ - -#include -#include -#include "src/webp/types.h" -#include "src/webp/format_constants.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// The maximum allowed limit is 11. -#define MAX_COLOR_CACHE_BITS 10 - -// ----------------------------------------------------------------------------- -// PixOrCopy - -enum Mode { - kLiteral, - kCacheIdx, - kCopy, - kNone -}; - -typedef struct { - // mode as uint8_t to make the memory layout to be exactly 8 bytes. - uint8_t mode; - uint16_t len; - uint32_t argb_or_distance; -} PixOrCopy; - -static WEBP_INLINE PixOrCopy PixOrCopyCreateCopy(uint32_t distance, - uint16_t len) { - PixOrCopy retval; - retval.mode = kCopy; - retval.argb_or_distance = distance; - retval.len = len; - return retval; -} - -static WEBP_INLINE PixOrCopy PixOrCopyCreateCacheIdx(int idx) { - PixOrCopy retval; - assert(idx >= 0); - assert(idx < (1 << MAX_COLOR_CACHE_BITS)); - retval.mode = kCacheIdx; - retval.argb_or_distance = idx; - retval.len = 1; - return retval; -} - -static WEBP_INLINE PixOrCopy PixOrCopyCreateLiteral(uint32_t argb) { - PixOrCopy retval; - retval.mode = kLiteral; - retval.argb_or_distance = argb; - retval.len = 1; - return retval; -} - -static WEBP_INLINE int PixOrCopyIsLiteral(const PixOrCopy* const p) { - return (p->mode == kLiteral); -} - -static WEBP_INLINE int PixOrCopyIsCacheIdx(const PixOrCopy* const p) { - return (p->mode == kCacheIdx); -} - -static WEBP_INLINE int PixOrCopyIsCopy(const PixOrCopy* const p) { - return (p->mode == kCopy); -} - -static WEBP_INLINE uint32_t PixOrCopyLiteral(const PixOrCopy* const p, - int component) { - assert(p->mode == kLiteral); - return (p->argb_or_distance >> (component * 8)) & 0xff; -} - -static WEBP_INLINE uint32_t PixOrCopyLength(const PixOrCopy* const p) { - return p->len; -} - -static WEBP_INLINE uint32_t PixOrCopyCacheIdx(const PixOrCopy* const p) { - assert(p->mode == kCacheIdx); - assert(p->argb_or_distance < (1U << MAX_COLOR_CACHE_BITS)); - return p->argb_or_distance; -} - -static WEBP_INLINE uint32_t PixOrCopyDistance(const PixOrCopy* const p) { - assert(p->mode == kCopy); - return p->argb_or_distance; -} - -// ----------------------------------------------------------------------------- -// VP8LHashChain - -#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 - // is found. These 20 bits are the limit defined by GetWindowSizeForHashChain - // (through WINDOW_SIZE = 1<<20). - // The lower 12 bits contain the length of the match. The 12 bit limit is - // defined in MaxFindCopyLength with MAX_LENGTH=4096. - uint32_t* offset_length_; - // This is the maximum size of the hash_chain that can be constructed. - // Typically this is the pixel count (width x height) for a given image. - int size_; -}; - -// Must be called first, to set size. -int VP8LHashChainInit(VP8LHashChain* const p, int size); -// Pre-compute the best matches for argb. -int VP8LHashChainFill(VP8LHashChain* const p, int quality, - const uint32_t* const argb, int xsize, int ysize, - 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) - -// maximum number of reference blocks the image will be segmented into -#define MAX_REFS_BLOCK_PER_IMAGE 16 - -typedef struct PixOrCopyBlock PixOrCopyBlock; // forward declaration -typedef struct VP8LBackwardRefs VP8LBackwardRefs; - -// Container for blocks chain -struct VP8LBackwardRefs { - int block_size_; // common block-size - int error_; // set to true if some memory error occurred - PixOrCopyBlock* refs_; // list of currently used blocks - PixOrCopyBlock** tail_; // for list recycling - PixOrCopyBlock* free_blocks_; // free-list - PixOrCopyBlock* last_block_; // used for adding new refs (internal) -}; - -// Initialize the object. 'block_size' is the common block size to store -// references (typically, width * height / MAX_REFS_BLOCK_PER_IMAGE). -void VP8LBackwardRefsInit(VP8LBackwardRefs* const refs, int block_size); -// Release memory for backward references. -void VP8LBackwardRefsClear(VP8LBackwardRefs* const refs); - -// Cursor for iterating on references content -typedef struct { - // public: - PixOrCopy* cur_pos; // current position - // private: - PixOrCopyBlock* cur_block_; // current block in the refs list - const PixOrCopy* last_pos_; // sentinel for switching to next block -} VP8LRefsCursor; - -// Returns a cursor positioned at the beginning of the references list. -VP8LRefsCursor VP8LRefsCursorInit(const VP8LBackwardRefs* const refs); -// Returns true if cursor is pointing at a valid position. -static WEBP_INLINE int VP8LRefsCursorOk(const VP8LRefsCursor* const c) { - return (c->cur_pos != NULL); -} -// Move to next block of references. Internal, not to be called directly. -void VP8LRefsCursorNextBlock(VP8LRefsCursor* const c); -// Move to next position, or NULL. Should not be called if !VP8LRefsCursorOk(). -static WEBP_INLINE void VP8LRefsCursorNext(VP8LRefsCursor* const c) { - assert(c != NULL); - assert(VP8LRefsCursorOk(c)); - if (++c->cur_pos == c->last_pos_) VP8LRefsCursorNextBlock(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). -// The optimal cache bits is evaluated and set for the *cache_bits parameter. -// The return value is the pointer to the best of the two backward refs viz, -// refs[0] or refs[1]. -VP8LBackwardRefs* VP8LGetBackwardReferences( - int width, int height, const uint32_t* const argb, int quality, - 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_ENC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/cost_enc.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/cost_enc.h deleted file mode 100644 index a4b177b..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/cost_enc.h +++ /dev/null @@ -1,82 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Cost tables for level and modes. -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_ENC_COST_ENC_H_ -#define WEBP_ENC_COST_ENC_H_ - -#include -#include -#include "src/enc/vp8i_enc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// On-the-fly info about the current set of residuals. Handy to avoid -// passing zillions of params. -typedef struct VP8Residual VP8Residual; -struct VP8Residual { - int first; - int last; - const int16_t* coeffs; - - int coeff_type; - ProbaArray* prob; - StatsArray* stats; - CostArrayPtr costs; -}; - -void VP8InitResidual(int first, int coeff_type, - VP8Encoder* const enc, VP8Residual* const res); - -int VP8RecordCoeffs(int ctx, const VP8Residual* const res); - -// Record proba context used. -static WEBP_INLINE int VP8RecordStats(int bit, proba_t* const stats) { - proba_t p = *stats; - // An overflow is inbound. Note we handle this at 0xfffe0000u instead of - // 0xffff0000u to make sure p + 1u does not overflow. - if (p >= 0xfffe0000u) { - 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; - return bit; -} - -// Cost of coding one event with probability 'proba'. -static WEBP_INLINE int VP8BitCost(int bit, uint8_t proba) { - return !bit ? VP8EntropyCost[proba] : VP8EntropyCost[255 - proba]; -} - -// Level cost calculations -extern const uint16_t VP8LevelCodes[MAX_VARIABLE_LEVEL][2]; -void VP8CalculateLevelCosts(VP8EncProba* const proba); -static WEBP_INLINE int VP8LevelCost(const uint16_t* const table, int level) { - return VP8LevelFixedCosts[level] - + table[(level > MAX_VARIABLE_LEVEL) ? MAX_VARIABLE_LEVEL : level]; -} - -// Mode costs -extern const uint16_t VP8FixedCostsUV[4]; -extern const uint16_t VP8FixedCostsI16[4]; -extern const uint16_t VP8FixedCostsI4[NUM_BMODES][NUM_BMODES][NUM_BMODES]; - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_ENC_COST_ENC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/histogram_enc.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/histogram_enc.h deleted file mode 100644 index 54c2d21..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/histogram_enc.h +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2012 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: Jyrki Alakuijala (jyrki@google.com) -// -// Models the histograms of literal and distance codes. - -#ifndef WEBP_ENC_HISTOGRAM_ENC_H_ -#define WEBP_ENC_HISTOGRAM_ENC_H_ - -#include - -#include "src/enc/backward_references_enc.h" -#include "src/webp/format_constants.h" -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Not a trivial literal symbol. -#define VP8L_NON_TRIVIAL_SYM (0xffffffff) - -// A simple container for histograms of data. -typedef struct { - // literal_ contains green literal, palette-code and - // copy-length-prefix histogram - uint32_t* literal_; // Pointer to the allocated buffer for literal. - uint32_t red_[NUM_LITERAL_CODES]; - uint32_t blue_[NUM_LITERAL_CODES]; - uint32_t alpha_[NUM_LITERAL_CODES]; - // Backward reference prefix-code histogram. - uint32_t distance_[NUM_DISTANCE_CODES]; - int palette_code_bits_; - uint32_t trivial_symbol_; // True, if histograms for Red, Blue & Alpha - // literal symbols are single valued. - double bit_cost_; // cached value of bit cost. - 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 -// big memory chunk. Can be destroyed by calling WebPSafeFree(). -typedef struct { - int size; // number of slots currently in use - int max_size; // maximum capacity - VP8LHistogram** histograms; -} VP8LHistogramSet; - -// Create the histogram. -// -// The input data is the PixOrCopy data, which models the literals, stop -// codes and backward references (both distances and lengths). Also: if -// palette_code_bits is >= 0, initialize the histogram with this value. -void VP8LHistogramCreate(VP8LHistogram* const p, - const VP8LBackwardRefs* const refs, - int palette_code_bits); - -// Return the size of the histogram for a given palette_code_bits. -int VP8LGetHistogramSize(int palette_code_bits); - -// Set the palette_code_bits and reset the stats. -// 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, - VP8LHistogram* const histo); - -// Free the memory allocated for the histogram. -void VP8LFreeHistogram(VP8LHistogram* const histo); - -// Free the memory allocated for the histogram set. -void VP8LFreeHistogramSet(VP8LHistogramSet* const histo); - -// Allocate an array of pointer to histograms, allocated and initialized -// 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. -VP8LHistogram* VP8LAllocateHistogram(int cache_bits); - -// Accumulate a token 'v' into a histogram. -void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo, - 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 + - ((palette_code_bits > 0) ? (1 << palette_code_bits) : 0); -} - -// Builds the histogram image. -int VP8LGetHistoImageSymbols(int xsize, int ysize, - const VP8LBackwardRefs* const refs, - int quality, int low_effort, - int histogram_bits, int cache_bits, - VP8LHistogramSet* const image_in, - VP8LHistogram* const tmp_histo, - uint16_t* const histogram_symbols); - -// Returns the entropy for the symbols in the input array. -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(VP8LHistogram* const p); - -#ifdef __cplusplus -} -#endif - -#endif // WEBP_ENC_HISTOGRAM_ENC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8i_enc.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8i_enc.h deleted file mode 100644 index 3a1967d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8i_enc.h +++ /dev/null @@ -1,518 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// WebP encoder: internal header. -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_ENC_VP8I_ENC_H_ -#define WEBP_ENC_VP8I_ENC_H_ - -#include // for memcpy() -#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" { -#endif - -//------------------------------------------------------------------------------ -// Various defines and enums - -// version numbers -#define ENC_MAJ_VERSION 1 -#define ENC_MIN_VERSION 0 -#define ENC_REV_VERSION 2 - -enum { MAX_LF_LEVELS = 64, // Maximum loop filter level - MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost - MAX_LEVEL = 2047 // max level (note: max codable is 2047 + 67) - }; - -typedef enum { // Rate-distortion optimization levels - RD_OPT_NONE = 0, // no rd-opt - RD_OPT_BASIC = 1, // basic scoring (no trellis) - RD_OPT_TRELLIS = 2, // perform trellis-quant on the final decision only - RD_OPT_TRELLIS_ALL = 3 // trellis-quant for every scoring (much slower) -} VP8RDLevel; - -// YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). -// The original or reconstructed samples can be accessed using VP8Scan[]. -// The predicted blocks can be accessed using offsets to yuv_p_ and -// the arrays VP8*ModeOffsets[]. -// * YUV Samples area (yuv_in_/yuv_out_/yuv_out2_) -// (see VP8Scan[] for accessing the blocks, along with -// Y_OFF_ENC/U_OFF_ENC/V_OFF_ENC): -// +----+----+ -// Y_OFF_ENC |YYYY|UUVV| -// U_OFF_ENC |YYYY|UUVV| -// V_OFF_ENC |YYYY|....| <- 25% wasted U/V area -// |YYYY|....| -// +----+----+ -// * Prediction area ('yuv_p_', size = PRED_SIZE_ENC) -// Intra16 predictions (16x16 block each, two per row): -// |I16DC16|I16TM16| -// |I16VE16|I16HE16| -// Chroma U/V predictions (16x8 block each, two per row): -// |C8DC8|C8TM8| -// |C8VE8|C8HE8| -// Intra 4x4 predictions (4x4 block each) -// |I4DC4 I4TM4 I4VE4 I4HE4|I4RD4 I4VR4 I4LD4 I4VL4| -// |I4HD4 I4HU4 I4TMP .....|.......................| <- ~31% wasted -#define YUV_SIZE_ENC (BPS * 16) -#define PRED_SIZE_ENC (32 * BPS + 16 * BPS + 8 * BPS) // I16+Chroma+I4 preds -#define Y_OFF_ENC (0) -#define U_OFF_ENC (16) -#define V_OFF_ENC (16 + 8) - -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 -#define I16DC16 (0 * 16 * BPS) -#define I16TM16 (I16DC16 + 16) -#define I16VE16 (1 * 16 * BPS) -#define I16HE16 (I16VE16 + 16) -// chroma 8x8, two U/V blocks side by side (hence: 16x8 each) -#define C8DC8 (2 * 16 * BPS) -#define C8TM8 (C8DC8 + 1 * 16) -#define C8VE8 (2 * 16 * BPS + 8 * BPS) -#define C8HE8 (C8VE8 + 1 * 16) -// intra 4x4 -#define I4DC4 (3 * 16 * BPS + 0) -#define I4TM4 (I4DC4 + 4) -#define I4VE4 (I4DC4 + 8) -#define I4HE4 (I4DC4 + 12) -#define I4RD4 (I4DC4 + 16) -#define I4VR4 (I4DC4 + 20) -#define I4LD4 (I4DC4 + 24) -#define I4VL4 (I4DC4 + 28) -#define I4HD4 (3 * 16 * BPS + 4 * BPS) -#define I4HU4 (I4HD4 + 4) -#define I4TMP (I4HD4 + 8) - -typedef int64_t score_t; // type used for scores, rate, distortion -// Note that MAX_COST is not the maximum allowed by sizeof(score_t), -// in order to allow overflowing computations. -#define MAX_COST ((score_t)0x7fffffffffffffLL) - -#define QFIX 17 -#define BIAS(b) ((b) << (QFIX - 8)) -// Fun fact: this is the _only_ line where we're actually being lossy and -// discarding bits. -static WEBP_INLINE int QUANTDIV(uint32_t n, uint32_t iQ, uint32_t B) { - return (int)((n * iQ + B) >> QFIX); -} - -// 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 - -typedef uint32_t proba_t; // 16b + 16b -typedef uint8_t ProbaArray[NUM_CTX][NUM_PROBAS]; -typedef proba_t StatsArray[NUM_CTX][NUM_PROBAS]; -typedef uint16_t CostArray[NUM_CTX][MAX_VARIABLE_LEVEL + 1]; -typedef const uint16_t* (*CostArrayPtr)[NUM_CTX]; // for easy casting -typedef const uint16_t* CostArrayMap[16][NUM_CTX]; -typedef double LFStats[NUM_MB_SEGMENTS][MAX_LF_LEVELS]; // filter stats - -typedef struct VP8Encoder VP8Encoder; - -// segment features -typedef struct { - int num_segments_; // Actual number of segments. 1 segment only = unused. - int update_map_; // whether to update the segment map or not. - // must be 0 if there's only 1 segment. - int size_; // bit-cost for transmitting the segment map -} VP8EncSegmentHeader; - -// Struct collecting all frame-persistent probabilities. -typedef struct { - uint8_t segments_[3]; // probabilities for segment tree - uint8_t skip_proba_; // final probability of being skipped. - ProbaArray coeffs_[NUM_TYPES][NUM_BANDS]; // 1056 bytes - StatsArray stats_[NUM_TYPES][NUM_BANDS]; // 4224 bytes - CostArray level_cost_[NUM_TYPES][NUM_BANDS]; // 13056 bytes - CostArrayMap remapped_costs_[NUM_TYPES]; // 1536 bytes - int dirty_; // if true, need to call VP8CalculateLevelCosts() - int use_skip_proba_; // Note: we always use skip_proba for now. - int nb_skip_; // number of skipped blocks -} VP8EncProba; - -// Filter parameters. Not actually used in the code (we don't perform -// the in-loop filtering), but filled from user's config -typedef struct { - int simple_; // filtering type: 0=complex, 1=simple - int level_; // base filter level [0..63] - int sharpness_; // [0..7] - int i4x4_lf_delta_; // delta filter level for i4x4 relative to i16x16 -} VP8EncFilterHeader; - -//------------------------------------------------------------------------------ -// Informations about the macroblocks. - -typedef struct { - // block type - unsigned int type_:2; // 0=i4x4, 1=i16x16 - unsigned int uv_mode_:2; - unsigned int skip_:1; - unsigned int segment_:2; - uint8_t alpha_; // quantization-susceptibility -} VP8MBInfo; - -typedef struct VP8Matrix { - uint16_t q_[16]; // quantizer steps - uint16_t iq_[16]; // reciprocals, fixed point. - uint32_t bias_[16]; // rounding bias - uint32_t zthresh_[16]; // value below which a coefficient is zeroed - uint16_t sharpen_[16]; // frequency boosters for slight sharpening -} VP8Matrix; - -typedef struct { - VP8Matrix y1_, y2_, uv_; // quantization matrices - int alpha_; // quant-susceptibility, range [-127,127]. Zero is neutral. - // Lower values indicate a lower risk of blurriness. - int beta_; // filter-susceptibility, range [0,255]. - int quant_; // final segment quantizer. - int fstrength_; // final in-loop filtering strength - int max_edge_; // max edge delta (for filtering strength) - int min_disto_; // minimum distortion required to trigger filtering record - // reactivities - int lambda_i16_, lambda_i4_, lambda_uv_; - int lambda_mode_, lambda_trellis_, tlambda_; - int lambda_trellis_i16_, lambda_trellis_i4_, lambda_trellis_uv_; - - // lambda values for distortion-based evaluation - 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 { - score_t D, SD; // Distortion, spectral distortion - score_t H, R, score; // header bits, rate, score. - int16_t y_dc_levels[16]; // Quantized levels for luma-DC, luma-AC, chroma. - int16_t y_ac_levels[16][16]; - int16_t uv_levels[4 + 4][16]; - int mode_i16; // mode number for intra16 prediction - 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 -// right neighbouring data (samples, predictions, contexts, ...) -typedef struct { - int x_, y_; // current macroblock - uint8_t* yuv_in_; // input samples - uint8_t* yuv_out_; // output samples - uint8_t* yuv_out2_; // secondary buffer swapped with yuv_out_. - uint8_t* yuv_p_; // scratch buffer for prediction - VP8Encoder* enc_; // back-pointer - VP8MBInfo* mb_; // current macroblock - VP8BitWriter* bw_; // current bit-writer - uint8_t* preds_; // intra mode predictors (4x4 blocks) - uint32_t* nz_; // non-zero pattern - uint8_t i4_boundary_[37]; // 32+5 boundary samples needed by intra4x4 - uint8_t* i4_top_; // pointer to the current top boundary sample - int i4_; // current intra4x4 mode being tested - int top_nz_[9]; // top-non-zero context. - int left_nz_[9]; // left-non-zero. left_nz[8] is independent. - uint64_t bit_count_[4][3]; // bit counters for coded levels. - uint64_t luma_bits_; // macroblock bit-cost for luma - uint64_t uv_bits_; // macroblock bit-cost for chroma - LFStats* lf_stats_; // filter stats (borrowed from enc_) - int do_trellis_; // if true, perform extra level optimisation - int count_down_; // number of mb still to be processed - 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) - - uint8_t* y_top_; // top luma samples at position 'x_' - uint8_t* uv_top_; // top u/v samples at position 'x_', packed as 16 bytes - - // memory for storing y/u/v_left_ - uint8_t yuv_left_mem_[17 + 16 + 16 + 8 + WEBP_ALIGN_CST]; - // memory for yuv_* - uint8_t yuv_mem_[3 * YUV_SIZE_ENC + PRED_SIZE_ENC + WEBP_ALIGN_CST]; -} VP8EncIterator; - - // in iterator.c -// must be called first -void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it); -// restart a scan -void VP8IteratorReset(VP8EncIterator* const it); -// reset iterator position to row 'y' -void VP8IteratorSetRow(VP8EncIterator* const it, int y); -// set count down (=number of iterations to go) -void VP8IteratorSetCountDown(VP8EncIterator* const it, int count_down); -// return true if iteration is finished -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* const tmp_32); -// export decimated samples -void VP8IteratorExport(const VP8EncIterator* const it); -// go to next macroblock. Returns false if not finished. -int VP8IteratorNext(VP8EncIterator* const it); -// save the yuv_out_ boundary values to top_/left_ arrays for next iterations. -void VP8IteratorSaveBoundary(VP8EncIterator* const it); -// Report progression based on macroblock rows. Return 0 for user-abort request. -int VP8IteratorProgress(const VP8EncIterator* const it, - int final_delta_percent); -// Intra4x4 iterations -void VP8IteratorStartI4(VP8EncIterator* const it); -// returns true if not done. -int VP8IteratorRotateI4(VP8EncIterator* const it, - const uint8_t* const yuv_out); - -// Non-zero context setup/teardown -void VP8IteratorNzToBytes(VP8EncIterator* const it); -void VP8IteratorBytesToNz(VP8EncIterator* const it); - -// Helper functions to set mode properties -void VP8SetIntra16Mode(const VP8EncIterator* const it, int mode); -void VP8SetIntra4Mode(const VP8EncIterator* const it, const uint8_t* modes); -void VP8SetIntraUVMode(const VP8EncIterator* const it, int mode); -void VP8SetSkip(const VP8EncIterator* const it, int skip); -void VP8SetSegment(const VP8EncIterator* const it, int segment); - -//------------------------------------------------------------------------------ -// Paginated token buffer - -typedef struct VP8Tokens VP8Tokens; // struct details in token.c - -typedef struct { -#if !defined(DISABLE_TOKEN_BUFFER) - VP8Tokens* pages_; // first page - VP8Tokens** last_page_; // last page - uint16_t* tokens_; // set to (*last_page_)->tokens_ - int left_; // how many free tokens left before the page is full - int page_size_; // number of tokens per page -#endif - int error_; // true in case of malloc error -} VP8TBuffer; - -// initialize an empty buffer -void VP8TBufferInit(VP8TBuffer* const b, int page_size); -void VP8TBufferClear(VP8TBuffer* const b); // de-allocate pages memory - -#if !defined(DISABLE_TOKEN_BUFFER) - -// Finalizes bitstream when probabilities are known. -// Deletes the allocated token memory if final_pass is true. -int VP8EmitTokens(VP8TBuffer* const b, VP8BitWriter* const bw, - const uint8_t* const probas, int final_pass); - -// record the coding of coefficients without knowing the probabilities yet -int VP8RecordCoeffTokens(int ctx, const struct VP8Residual* const res, - VP8TBuffer* const tokens); - -// Estimate the final coded size given a set of 'probas'. -size_t VP8EstimateTokenSize(VP8TBuffer* const b, const uint8_t* const probas); - -#endif // !DISABLE_TOKEN_BUFFER - -//------------------------------------------------------------------------------ -// VP8Encoder - -struct VP8Encoder { - const WebPConfig* config_; // user configuration and parameters - WebPPicture* pic_; // input / output picture - - // headers - VP8EncFilterHeader filter_hdr_; // filtering information - VP8EncSegmentHeader segment_hdr_; // segment information - - int profile_; // VP8's profile, deduced from Config. - - // dimension, in macroblock units. - int mb_w_, mb_h_; - int preds_w_; // stride of the *preds_ prediction plane (=4*mb_w + 1) - - // number of partitions (1, 2, 4 or 8 = MAX_NUM_PARTITIONS) - int num_parts_; - - // per-partition boolean decoders. - VP8BitWriter bw_; // part0 - VP8BitWriter parts_[MAX_NUM_PARTITIONS]; // token partitions - VP8TBuffer tokens_; // token buffer - - int percent_; // for progress - - // transparency blob - int has_alpha_; - uint8_t* alpha_data_; // non-NULL if transparency is present - uint32_t alpha_data_size_; - WebPWorker alpha_worker_; - - // quantization info (one set of DC/AC dequant factor per segment) - VP8SegmentInfo dqm_[NUM_MB_SEGMENTS]; - int base_quant_; // nominal quantizer value. Only used - // for relative coding of segments' quant. - int alpha_; // global susceptibility (<=> complexity) - int uv_alpha_; // U/V quantization susceptibility - // global offset of quantizers, shared by all segments - int dq_y1_dc_; - int dq_y2_dc_, dq_y2_ac_; - int dq_uv_dc_, dq_uv_ac_; - - // probabilities and statistics - VP8EncProba proba_; - uint64_t sse_[4]; // sum of Y/U/V/A squared errors for all macroblocks - uint64_t sse_count_; // pixel count for the sse_[] stats - int coded_size_; - int residual_bytes_[3][4]; - int block_count_[3]; - - // quality/speed settings - int method_; // 0=fastest, 6=best/slowest. - VP8RDLevel rd_opt_level_; // Deduced from method_. - int max_i4_header_bits_; // partition #0 safeness factor - int mb_header_limit_; // rough limit for header bits per MB - int thread_level_; // derived from config->thread_level - int do_search_; // derived from config->target_XXX - int use_tokens_; // if true, use token buffer - - // Memory - VP8MBInfo* mb_info_; // contextual macroblock infos (mb_w_ + 1) - uint8_t* preds_; // predictions modes: (4*mb_w+1) * (4*mb_h+1) - uint32_t* nz_; // non-zero bit context: mb_w+1 - uint8_t* y_top_; // top luma samples. - 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) -}; - -//------------------------------------------------------------------------------ -// internal functions. Not public. - - // in tree.c -extern const uint8_t VP8CoeffsProba0[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS]; -extern const uint8_t - VP8CoeffsUpdateProba[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS]; -// Reset the token probabilities to their initial (default) values -void VP8DefaultProbas(VP8Encoder* const enc); -// Write the token probabilities -void VP8WriteProbas(VP8BitWriter* const bw, const VP8EncProba* const probas); -// Writes the partition #0 modes (that is: all intra modes) -void VP8CodeIntraModes(VP8Encoder* const enc); - - // in syntax.c -// Generates the final bitstream by coding the partition0 and headers, -// and appending an assembly of all the pre-coded token partitions. -// Return true if everything is ok. -int VP8EncWrite(VP8Encoder* const enc); -// Release memory allocated for bit-writing in VP8EncLoop & seq. -void VP8EncFreeBitWriters(VP8Encoder* const enc); - - // in frame.c -extern const uint8_t VP8Cat3[]; -extern const uint8_t VP8Cat4[]; -extern const uint8_t VP8Cat5[]; -extern const uint8_t VP8Cat6[]; - -// Form all the four Intra16x16 predictions in the yuv_p_ cache -void VP8MakeLuma16Preds(const VP8EncIterator* const it); -// Form all the four Chroma8x8 predictions in the yuv_p_ cache -void VP8MakeChroma8Preds(const VP8EncIterator* const it); -// Form all the ten Intra4x4 predictions in the yuv_p_ cache -// for the 4x4 block it->i4_ -void VP8MakeIntra4Preds(const VP8EncIterator* const it); -// Rate calculation -int VP8GetCostLuma16(VP8EncIterator* const it, const VP8ModeScore* const rd); -int VP8GetCostLuma4(VP8EncIterator* const it, const int16_t levels[16]); -int VP8GetCostUV(VP8EncIterator* const it, const VP8ModeScore* const rd); -// Main coding calls -int VP8EncLoop(VP8Encoder* const enc); -int VP8EncTokenLoop(VP8Encoder* const enc); - - // in webpenc.c -// Assign an error code to a picture. Return false for convenience. -int WebPEncodingSetError(const WebPPicture* const pic, WebPEncodingError error); -int WebPReportProgress(const WebPPicture* const pic, - int percent, int* const percent_store); - - // in analysis.c -// Main analysis loop. Decides the segmentations and complexity. -// Assigns a first guess for Intra16 and uvmode_ prediction modes. -int VP8EncAnalyze(VP8Encoder* const enc); - - // in quant.c -// Sets up segment's quantization values, base_quant_ and filter strengths. -void VP8SetSegmentParams(VP8Encoder* const enc, float quality); -// Pick best modes and fills the levels. Returns true if skipped. -int VP8Decimate(VP8EncIterator* const it, VP8ModeScore* const rd, - VP8RDLevel rd_opt); - - // in alpha.c -void VP8EncInitAlpha(VP8Encoder* const enc); // initialize alpha compression -int VP8EncStartAlpha(VP8Encoder* const enc); // start alpha coding process -int VP8EncFinishAlpha(VP8Encoder* const enc); // finalize compressed data -int VP8EncDeleteAlpha(VP8Encoder* const enc); // delete compressed data - -// autofilter -void VP8InitFilter(VP8EncIterator* const it); -void VP8StoreFilterStats(VP8EncIterator* const it); -void VP8AdjustFilterStrength(VP8EncIterator* const it); - -// returns the approximate filtering strength needed to smooth a edge -// step of 'delta', given a sharpness parameter 'sharpness'. -int VP8FilterStrengthFromDelta(int sharpness, int delta); - - // misc utils for picture_*.c: - -// Remove reference to the ARGB/YUVA buffer (doesn't free anything). -void WebPPictureResetBuffers(WebPPicture* const picture); - -// Allocates ARGB buffer of given dimension (previous one is always free'd). -// Preserves the YUV(A) buffer. Returns false in case of error (invalid param, -// out-of-memory). -int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height); - -// Allocates YUVA buffer of given dimension (previous one is always free'd). -// Uses picture->csp to determine whether an alpha buffer is needed. -// Preserves the ARGB buffer. -// Returns false in case of error (invalid param, out-of-memory). -int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height); - -// Clean-up the RGB samples under fully transparent area, to help lossless -// compressibility (no guarantee, though). Assumes that pic->use_argb is true. -void WebPCleanupTransparentAreaLossless(WebPPicture* const pic); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_ENC_VP8I_ENC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8li_enc.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8li_enc.h deleted file mode 100644 index d2d0fc5..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/enc/vp8li_enc.h +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Lossless encoder: internal header. -// -// Author: Vikas Arora (vikaas.arora@gmail.com) - -#ifndef WEBP_ENC_VP8LI_ENC_H_ -#define WEBP_ENC_VP8LI_ENC_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" { -#endif - -// 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. - 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. - - // Encoding parameters derived from quality parameter. - int histo_bits_; - int transform_bits_; // <= MAX_TRANSFORM_BITS. - int cache_bits_; // If equal to 0, don't use color cache. - - // Encoding parameters derived from image characteristics. - int use_cross_color_; - int use_subtract_green_; - int use_predict_; - int use_palette_; - int palette_size_; - uint32_t palette_[MAX_PALETTE_SIZE]; - - // Some 'scratch' (potentially large) objects. - struct VP8LBackwardRefs refs_[3]; // Backward Refs array for temporaries. - VP8LHashChain hash_chain_; // HashChain data for constructing - // backward references. -} VP8LEncoder; - -//------------------------------------------------------------------------------ -// internal functions. Not public. - -// Encodes the picture. -// Returns 0 if config or picture is NULL or picture doesn't have valid argb -// input. -int VP8LEncodeImage(const WebPConfig* const config, - const WebPPicture* const picture); - -// Encodes the main image stream using the supplied bit writer. -// If 'use_cache' is false, disables the use of color cache. -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. - -void VP8LResidualImage(int width, int height, int bits, int low_effort, - uint32_t* const argb, uint32_t* const argb_scratch, - uint32_t* const image, int near_lossless, int exact, - int used_subtract_green); - -void VP8LColorSpaceTransform(int width, int height, int bits, int quality, - uint32_t* const argb, uint32_t* image); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_ENC_VP8LI_ENC_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/animi.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/animi.h deleted file mode 100644 index 34c45ba..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/animi.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Internal header for animation related functions. -// -// Author: Hui Su (huisu@google.com) - -#ifndef WEBP_MUX_ANIMI_H_ -#define WEBP_MUX_ANIMI_H_ - -#include "src/webp/mux.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Picks the optimal rectangle between two pictures, starting with initial -// values of offsets and dimensions that are passed in. The initial -// values will be clipped, if necessary, to make sure the rectangle is -// within the canvas. "use_argb" must be true for both pictures. -// Parameters: -// prev_canvas, curr_canvas - (in) two input pictures to compare. -// is_lossless, quality - (in) encoding settings. -// x_offset, y_offset, width, height - (in/out) rectangle between the two -// input pictures. -// Returns true on success. -int WebPAnimEncoderRefineRect( - const struct WebPPicture* const prev_canvas, - const struct WebPPicture* const curr_canvas, - int is_lossless, float quality, int* const x_offset, int* const y_offset, - int* const width, int* const height); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_MUX_ANIMI_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/muxi.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/muxi.h deleted file mode 100644 index 3e9d8c4..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/mux/muxi.h +++ /dev/null @@ -1,234 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Internal header for mux library. -// -// Author: Urvang (urvang@google.com) - -#ifndef WEBP_MUX_MUXI_H_ -#define WEBP_MUX_MUXI_H_ - -#include -#include -#include "src/dec/vp8i_dec.h" -#include "src/dec/vp8li_dec.h" -#include "src/webp/mux.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//------------------------------------------------------------------------------ -// Defines and constants. - -#define MUX_MAJ_VERSION 1 -#define MUX_MIN_VERSION 0 -#define MUX_REV_VERSION 2 - -// Chunk object. -typedef struct WebPChunk WebPChunk; -struct WebPChunk { - uint32_t tag_; - int owner_; // True if *data_ memory is owned internally. - // VP8X, ANIM, and other internally created chunks - // like ANMF are always owned. - WebPData data_; - WebPChunk* next_; -}; - -// MuxImage object. Store a full WebP image (including ANMF chunk, ALPH -// chunk and VP8/VP8L chunk), -typedef struct WebPMuxImage WebPMuxImage; -struct WebPMuxImage { - WebPChunk* header_; // Corresponds to WEBP_CHUNK_ANMF. - WebPChunk* alpha_; // Corresponds to WEBP_CHUNK_ALPHA. - WebPChunk* img_; // Corresponds to WEBP_CHUNK_IMAGE. - WebPChunk* unknown_; // Corresponds to WEBP_CHUNK_UNKNOWN. - int width_; - int height_; - int has_alpha_; // Through ALPH chunk or as part of VP8L. - int is_partial_; // True if only some of the chunks are filled. - WebPMuxImage* next_; -}; - -// Main mux object. Stores data chunks. -struct WebPMux { - WebPMuxImage* images_; - WebPChunk* iccp_; - WebPChunk* exif_; - WebPChunk* xmp_; - WebPChunk* anim_; - WebPChunk* vp8x_; - - WebPChunk* unknown_; - int canvas_width_; - int canvas_height_; -}; - -// CHUNK_INDEX enum: used for indexing within 'kChunks' (defined below) only. -// Note: the reason for having two enums ('WebPChunkId' and 'CHUNK_INDEX') is to -// allow two different chunks to have the same id (e.g. WebPChunkId -// 'WEBP_CHUNK_IMAGE' can correspond to CHUNK_INDEX 'IDX_VP8' or 'IDX_VP8L'). -typedef enum { - IDX_VP8X = 0, - IDX_ICCP, - IDX_ANIM, - IDX_ANMF, - IDX_ALPHA, - IDX_VP8, - IDX_VP8L, - IDX_EXIF, - IDX_XMP, - IDX_UNKNOWN, - - IDX_NIL, - IDX_LAST_CHUNK -} CHUNK_INDEX; - -#define NIL_TAG 0x00000000u // To signal void chunk. - -typedef struct { - uint32_t tag; - WebPChunkId id; - uint32_t size; -} ChunkInfo; - -extern const ChunkInfo kChunks[IDX_LAST_CHUNK]; - -//------------------------------------------------------------------------------ -// Chunk object management. - -// Initialize. -void ChunkInit(WebPChunk* const chunk); - -// Get chunk index from chunk tag. Returns IDX_UNKNOWN if not found. -CHUNK_INDEX ChunkGetIndexFromTag(uint32_t tag); - -// Get chunk id from chunk tag. Returns WEBP_CHUNK_UNKNOWN if not found. -WebPChunkId ChunkGetIdFromTag(uint32_t tag); - -// Convert a fourcc string to a tag. -uint32_t ChunkGetTagFromFourCC(const char fourcc[4]); - -// Get chunk index from fourcc. Returns IDX_UNKNOWN if given fourcc is unknown. -CHUNK_INDEX ChunkGetIndexFromFourCC(const char fourcc[4]); - -// Search for nth chunk with given 'tag' in the chunk list. -// nth = 0 means "last of the list". -WebPChunk* ChunkSearchList(WebPChunk* first, uint32_t nth, uint32_t tag); - -// Fill the chunk with the given data. -WebPMuxError ChunkAssignData(WebPChunk* chunk, const WebPData* const data, - int copy_data, uint32_t tag); - -// 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 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); - -// Deletes given chunk & returns chunk->next_. -WebPChunk* ChunkDelete(WebPChunk* const chunk); - -// Deletes all chunks in the given chunk list. -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; - return SizeWithPadding(data_size); -} - -// Total size of a list of chunks. -size_t ChunkListDiskSize(const WebPChunk* chunk_list); - -// Write out the given list of chunks into 'dst'. -uint8_t* ChunkListEmit(const WebPChunk* chunk_list, uint8_t* dst); - -//------------------------------------------------------------------------------ -// MuxImage object management. - -// Initialize. -void MuxImageInit(WebPMuxImage* const wpi); - -// Releases image 'wpi' and returns wpi->next. -WebPMuxImage* MuxImageRelease(WebPMuxImage* const wpi); - -// Delete image 'wpi' and return the next image in the list or NULL. -// 'wpi' can be NULL. -WebPMuxImage* MuxImageDelete(WebPMuxImage* const wpi); - -// Count number of images matching the given tag id in the 'wpi_list'. -// If id == WEBP_CHUNK_NIL, all images will be matched. -int MuxImageCount(const WebPMuxImage* wpi_list, WebPChunkId id); - -// Update width/height/has_alpha info from chunks within wpi. -// Also remove ALPH chunk if not needed. -int MuxImageFinalize(WebPMuxImage* const wpi); - -// Check if given ID corresponds to an image related chunk. -static WEBP_INLINE int IsWPI(WebPChunkId id) { - switch (id) { - case WEBP_CHUNK_ANMF: - case WEBP_CHUNK_ALPHA: - case WEBP_CHUNK_IMAGE: return 1; - default: return 0; - } -} - -// Pushes 'wpi' at the end of 'wpi_list'. -WebPMuxError MuxImagePush(const WebPMuxImage* wpi, WebPMuxImage** wpi_list); - -// Delete nth image in the image list. -WebPMuxError MuxImageDeleteNth(WebPMuxImage** wpi_list, uint32_t nth); - -// Get nth image in the image list. -WebPMuxError MuxImageGetNth(const WebPMuxImage** wpi_list, uint32_t nth, - WebPMuxImage** wpi); - -// Total size of the given image. -size_t MuxImageDiskSize(const WebPMuxImage* const wpi); - -// Write out the given image into 'dst'. -uint8_t* MuxImageEmit(const WebPMuxImage* const wpi, uint8_t* dst); - -//------------------------------------------------------------------------------ -// Helper methods for mux. - -// Checks if the given image list contains at least one image with alpha. -int MuxHasAlpha(const WebPMuxImage* images); - -// Write out RIFF header into 'data', given total data size 'size'. -uint8_t* MuxEmitRiffHeader(uint8_t* const data, size_t size); - -// Returns the list where chunk with given ID is to be inserted in mux. -WebPChunk** MuxGetChunkListFromId(const WebPMux* mux, WebPChunkId id); - -// Validates the given mux object. -WebPMuxError MuxValidate(const WebPMux* const mux); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_MUX_MUXI_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_inl_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_inl_utils.h deleted file mode 100644 index 7e607f3..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_inl_utils.h +++ /dev/null @@ -1,190 +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. -// ----------------------------------------------------------------------------- -// -// Specific inlined methods for boolean decoder [VP8GetBit() ...] -// This file should be included by the .c sources that actually need to call -// these methods. -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_UTILS_BIT_READER_INL_UTILS_H_ -#define WEBP_UTILS_BIT_READER_INL_UTILS_H_ - -#ifdef HAVE_CONFIG_H -#include "src/webp/config.h" -#endif - -#include // for memcpy - -#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" { -#endif - -//------------------------------------------------------------------------------ -// Derived type lbit_t = natural type for memory I/O - -#if (BITS > 32) -typedef uint64_t lbit_t; -#elif (BITS > 16) -typedef uint32_t lbit_t; -#elif (BITS > 8) -typedef uint16_t lbit_t; -#else -typedef uint8_t lbit_t; -#endif - -extern const uint8_t kVP8Log2Range[128]; -extern const uint8_t kVP8NewRange[128]; - -// special case for the tail byte-reading -void VP8LoadFinalBytes(VP8BitReader* const br); - -//------------------------------------------------------------------------------ -// Inlined critical functions - -// makes sure br->value_ has at least BITS bits worth of data -static WEBP_UBSAN_IGNORE_UNDEF WEBP_INLINE -void VP8LoadNewBytes(VP8BitReader* const br) { - assert(br != NULL && br->buf_ != NULL); - // Read 'BITS' bits at a time if possible. - if (br->buf_ < br->buf_max_) { - // convert memory type to register type (with some zero'ing!) - bit_t bits; -#if defined(WEBP_USE_MIPS32) - // This is needed because of un-aligned read. - lbit_t in_bits; - lbit_t* p_buf_ = (lbit_t*)br->buf_; - __asm__ volatile( - ".set push \n\t" - ".set at \n\t" - ".set macro \n\t" - "ulw %[in_bits], 0(%[p_buf_]) \n\t" - ".set pop \n\t" - : [in_bits]"=r"(in_bits) - : [p_buf_]"r"(p_buf_) - : "memory", "at" - ); -#else - lbit_t in_bits; - memcpy(&in_bits, br->buf_, sizeof(in_bits)); -#endif - br->buf_ += BITS >> 3; -#if !defined(WORDS_BIGENDIAN) -#if (BITS > 32) - bits = BSwap64(in_bits); - bits >>= 64 - BITS; -#elif (BITS >= 24) - bits = BSwap32(in_bits); - bits >>= (32 - BITS); -#elif (BITS == 16) - bits = BSwap16(in_bits); -#else // BITS == 8 - bits = (bit_t)in_bits; -#endif // BITS > 32 -#else // WORDS_BIGENDIAN - bits = (bit_t)in_bits; - if (BITS != 8 * sizeof(bit_t)) bits >>= (8 * sizeof(bit_t) - BITS); -#endif - br->value_ = bits | (br->value_ << BITS); - br->bits_ += BITS; - } else { - VP8LoadFinalBytes(br); // no need to be inlined - } -} - -// Read a bit with proba 'prob'. Speed-critical function! -static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, int prob) { - // 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. - range_t range = br->range_; - if (br->bits_ < 0) { - VP8LoadNewBytes(br); - } - { - const int pos = br->bits_; - const range_t split = (range * prob) >> 8; - const range_t value = (range_t)(br->value_ >> pos); - const int bit = (value > split); - if (bit) { - range -= split; - br->value_ -= (bit_t)(split + 1) << pos; - } else { - range = split + 1; - } - { - const int shift = 7 ^ BitsLog2Floor(range); - range <<= shift; - br->bits_ -= shift; - } - br->range_ = range - 1; - 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) { - if (br->bits_ < 0) { - VP8LoadNewBytes(br); - } - { - const int pos = br->bits_; - const range_t split = br->range_ >> 1; - const range_t value = (range_t)(br->value_ >> pos); - const int32_t mask = (int32_t)(split - value) >> 31; // -1 or 0 - br->bits_ -= 1; - br->range_ += mask; - br->range_ |= 1; - br->value_ -= (bit_t)((split + 1) & mask) << pos; - return (v ^ mask) - mask; - } -} - -static WEBP_INLINE int VP8GetBitAlt(VP8BitReader* const br, int prob) { - // 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. - range_t range = br->range_; - if (br->bits_ < 0) { - VP8LoadNewBytes(br); - } - { - const int pos = br->bits_; - const range_t split = (range * prob) >> 8; - const range_t value = (range_t)(br->value_ >> pos); - int bit; // Don't use 'const int bit = (value > split);", it's slower. - if (value > split) { - range -= split + 1; - br->value_ -= (bit_t)(split + 1) << pos; - bit = 1; - } else { - range = split; - bit = 0; - } - if (range <= (range_t)0x7e) { - const int shift = kVP8Log2Range[range]; - range = kVP8NewRange[range]; - br->bits_ -= shift; - } - br->range_ = range; - return bit; - } -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_BIT_READER_INL_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_utils.h deleted file mode 100644 index 0f8db2c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_reader_utils.h +++ /dev/null @@ -1,175 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Boolean decoder -// -// Author: Skal (pascal.massimino@gmail.com) -// Vikas Arora (vikaas.arora@gmail.com) - -#ifndef WEBP_UTILS_BIT_READER_UTILS_H_ -#define WEBP_UTILS_BIT_READER_UTILS_H_ - -#include -#ifdef _MSC_VER -#include // _byteswap_ulong -#endif -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// The Boolean decoder needs to maintain infinite precision on the value_ field. -// However, since range_ is only 8bit, we only need an active window of 8 bits -// for value_. Left bits (MSB) gets zeroed and shifted away when value_ falls -// below 128, range_ is updated, and fresh bits read from the bitstream are -// brought in as LSB. To avoid reading the fresh bits one by one (slow), we -// cache BITS of them ahead. The total of (BITS + 8) bits must fit into a -// natural register (with type bit_t). To fetch BITS bits from bitstream we -// use a type lbit_t. -// -// BITS can be any multiple of 8 from 8 to 56 (inclusive). -// Pick values that fit natural register size. - -#if defined(__i386__) || defined(_M_IX86) // x86 32bit -#define BITS 24 -#elif defined(__x86_64__) || defined(_M_X64) // x86 64bit -#define BITS 56 -#elif defined(__arm__) || defined(_M_ARM) // ARM -#define BITS 24 -#elif defined(__aarch64__) // ARM 64bit -#define BITS 56 -#elif defined(__mips__) // MIPS -#define BITS 24 -#else // reasonable default -#define BITS 24 -#endif - -//------------------------------------------------------------------------------ -// Derived types and constants: -// bit_t = natural register type for storing 'value_' (which is BITS+8 bits) -// range_t = register for 'range_' (which is 8bits only) - -#if (BITS > 24) -typedef uint64_t bit_t; -#else -typedef uint32_t bit_t; -#endif - -typedef uint32_t range_t; - -//------------------------------------------------------------------------------ -// Bitreader - -typedef struct VP8BitReader VP8BitReader; -struct VP8BitReader { - // boolean decoder (keep the field ordering as is!) - bit_t value_; // current value - range_t range_; // current range minus 1. In [127, 254] interval. - int bits_; // number of valid bits left - // read buffer - const uint8_t* buf_; // next byte to be read - const uint8_t* buf_end_; // end of read buffer - const uint8_t* buf_max_; // max packed-read position on buffer - int eof_; // true if input is exhausted -}; - -// Initialize the bit reader and the boolean decoder. -void VP8InitBitReader(VP8BitReader* const br, - const uint8_t* const start, size_t size); -// Sets the working read buffer. -void VP8BitReaderSetBuffer(VP8BitReader* const br, - const uint8_t* const start, size_t size); - -// Update internal pointers to displace the byte buffer by the -// relative offset 'offset'. -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); -} - -// return the next value with sign-extension. -int32_t VP8GetSignedValue(VP8BitReader* const br, int num_bits); - -// 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) -// 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. - -// ----------------------------------------------------------------------------- -// Bitreader for lossless format - -// maximum number of bits (inclusive) the bit-reader can handle: -#define VP8L_MAX_NUM_BIT_READ 24 - -#define VP8L_LBITS 64 // Number of bits prefetched (= bit-size of vp8l_val_t). -#define VP8L_WBITS 32 // Minimum number of bytes ready after VP8LFillBitWindow. - -typedef uint64_t vp8l_val_t; // right now, this bit-reader can only use 64bit. - -typedef struct { - vp8l_val_t val_; // pre-fetched bits - const uint8_t* buf_; // input byte buffer - size_t len_; // buffer length - size_t pos_; // byte position in buf_ - int bit_pos_; // current bit-reading position in val_ - int eos_; // true if a bit was read past the end of buffer -} VP8LBitReader; - -void VP8LInitBitReader(VP8LBitReader* const br, - const uint8_t* const start, - size_t length); - -// Sets a new data buffer. -void VP8LBitReaderSetBuffer(VP8LBitReader* const br, - const uint8_t* const buffer, size_t length); - -// Reads the specified number of bits from read buffer. -// Flags an error in case end_of_stream or n_bits is more than the allowed limit -// of VP8L_MAX_NUM_BIT_READ (inclusive). -// Flags eos_ if this read attempt is going to cross the read buffer. -uint32_t VP8LReadBits(VP8LBitReader* const br, int n_bits); - -// Return the prefetched bits, so they can be looked up. -static WEBP_INLINE uint32_t VP8LPrefetchBits(VP8LBitReader* const br) { - return (uint32_t)(br->val_ >> (br->bit_pos_ & (VP8L_LBITS - 1))); -} - -// Returns true if there was an attempt at reading bit past the end of -// the buffer. Doesn't set br->eos_ flag. -static WEBP_INLINE int VP8LIsEndOfStream(const VP8LBitReader* const br) { - assert(br->pos_ <= br->len_); - return br->eos_ || ((br->pos_ == br->len_) && (br->bit_pos_ > VP8L_LBITS)); -} - -// 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; -} - -// Advances the read buffer by 4 bytes to make room for reading next 32 bits. -// Speed critical, but infrequent part of the code can be non-inlined. -extern void VP8LDoFillBitWindow(VP8LBitReader* const br); -static WEBP_INLINE void VP8LFillBitWindow(VP8LBitReader* const br) { - if (br->bit_pos_ >= VP8L_WBITS) VP8LDoFillBitWindow(br); -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_BIT_READER_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_writer_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_writer_utils.h deleted file mode 100644 index b9d5102..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/bit_writer_utils.h +++ /dev/null @@ -1,154 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Bit writing and boolean coder -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_UTILS_BIT_WRITER_UTILS_H_ -#define WEBP_UTILS_BIT_WRITER_UTILS_H_ - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//------------------------------------------------------------------------------ -// Bit-writing - -typedef struct VP8BitWriter VP8BitWriter; -struct VP8BitWriter { - int32_t range_; // range-1 - int32_t value_; - int run_; // number of outstanding bits - int nb_bits_; // number of pending bits - uint8_t* buf_; // internal buffer. Re-allocated regularly. Not owned. - size_t pos_; - size_t max_pos_; - int error_; // true in case of error -}; - -// Initialize the object. Allocates some initial memory based on expected_size. -int VP8BitWriterInit(VP8BitWriter* const bw, size_t expected_size); -// Finalize the bitstream coding. Returns a pointer to the internal buffer. -uint8_t* VP8BitWriterFinish(VP8BitWriter* const bw); -// Release any pending memory and zeroes the object. Not a mandatory call. -// Only useful in case of error, when the internal buffer hasn't been grabbed! -void VP8BitWriterWipeOut(VP8BitWriter* const bw); - -int VP8PutBit(VP8BitWriter* const bw, int bit, int prob); -int VP8PutBitUniform(VP8BitWriter* const bw, int bit); -void VP8PutBits(VP8BitWriter* const bw, uint32_t value, int nb_bits); -void VP8PutSignedBits(VP8BitWriter* const bw, int value, int nb_bits); - -// Appends some bytes to the internal buffer. Data is copied. -int VP8BitWriterAppend(VP8BitWriter* const bw, - const uint8_t* data, size_t size); - -// return approximate write position (in bits) -static WEBP_INLINE uint64_t VP8BitWriterPos(const VP8BitWriter* const bw) { - const uint64_t nb_bits = 8 + bw->nb_bits_; // bw->nb_bits_ is <= 0, note - return (bw->pos_ + bw->run_) * 8 + nb_bits; -} - -// Returns a pointer to the internal buffer. -static WEBP_INLINE uint8_t* VP8BitWriterBuf(const VP8BitWriter* const bw) { - return bw->buf_; -} -// Returns the size of the internal buffer. -static WEBP_INLINE size_t VP8BitWriterSize(const VP8BitWriter* const bw) { - return bw->pos_; -} - -//------------------------------------------------------------------------------ -// VP8LBitWriter - -#if defined(__x86_64__) || defined(_M_X64) // 64bit -typedef uint64_t vp8l_atype_t; // accumulator type -typedef uint32_t vp8l_wtype_t; // writing type -#define WSWAP HToLE32 -#define VP8L_WRITER_BYTES 4 // sizeof(vp8l_wtype_t) -#define VP8L_WRITER_BITS 32 // 8 * sizeof(vp8l_wtype_t) -#define VP8L_WRITER_MAX_BITS 64 // 8 * sizeof(vp8l_atype_t) -#else -typedef uint32_t vp8l_atype_t; -typedef uint16_t vp8l_wtype_t; -#define WSWAP HToLE16 -#define VP8L_WRITER_BYTES 2 -#define VP8L_WRITER_BITS 16 -#define VP8L_WRITER_MAX_BITS 32 -#endif - -typedef struct { - vp8l_atype_t bits_; // bit accumulator - int used_; // number of bits used in accumulator - uint8_t* buf_; // start of buffer - uint8_t* cur_; // current write position - uint8_t* end_; // end of buffer - - // After all bits are written (VP8LBitWriterFinish()), the caller must observe - // the state of error_. A value of 1 indicates that a memory allocation - // failure has happened during bit writing. A value of 0 indicates successful - // writing of bits. - int error_; -} VP8LBitWriter; - -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); - -// PutBits internal function used in the 16 bit vp8l_wtype_t case. -void VP8LPutBitsInternal(VP8LBitWriter* const bw, uint32_t bits, int n_bits); - -// This function writes bits into bytes in increasing addresses (little endian), -// and within a byte least-significant-bit first. -// This function can write up to 32 bits in one go, but VP8LBitReader can only -// read 24 bits max (VP8L_MAX_NUM_BIT_READ). -// VP8LBitWriter's error_ flag is set in case of memory allocation error. -static WEBP_INLINE void VP8LPutBits(VP8LBitWriter* const bw, - uint32_t bits, int n_bits) { - if (sizeof(vp8l_wtype_t) == 4) { - if (n_bits > 0) { - if (bw->used_ >= 32) { - VP8LPutBitsFlushBits(bw); - } - bw->bits_ |= (vp8l_atype_t)bits << bw->used_; - bw->used_ += n_bits; - } - } else { - VP8LPutBitsInternal(bw, bits, n_bits); - } -} - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_BIT_WRITER_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/color_cache_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/color_cache_utils.h deleted file mode 100644 index 20b7be1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/color_cache_utils.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Color Cache for WebP Lossless -// -// Authors: Jyrki Alakuijala (jyrki@google.com) -// Urvang Joshi (urvang@google.com) - -#ifndef WEBP_UTILS_COLOR_CACHE_UTILS_H_ -#define WEBP_UTILS_COLOR_CACHE_UTILS_H_ - -#include - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Main color cache struct. -typedef struct { - uint32_t *colors_; // color entries - int hash_shift_; // Hash shift: 32 - hash_bits_. - int hash_bits_; -} VP8LColorCache; - -static const uint64_t kHashMul = 0x1e35a7bdull; - -static WEBP_INLINE int VP8LHashPix(uint32_t argb, int shift) { - return (int)(((argb * kHashMul) & 0xffffffffu) >> shift); -} - -static WEBP_INLINE uint32_t VP8LColorCacheLookup( - const VP8LColorCache* const cc, uint32_t key) { - assert((key >> cc->hash_bits_) == 0u); - return cc->colors_[key]; -} - -static WEBP_INLINE void VP8LColorCacheSet(const VP8LColorCache* const cc, - uint32_t key, uint32_t argb) { - assert((key >> cc->hash_bits_) == 0u); - cc->colors_[key] = argb; -} - -static WEBP_INLINE void VP8LColorCacheInsert(const VP8LColorCache* const cc, - uint32_t argb) { - 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 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 = VP8LHashPix(argb, cc->hash_shift_); - return (cc->colors_[key] == argb) ? key : -1; -} - -//------------------------------------------------------------------------------ - -// Initializes the color cache with 'hash_bits' bits for the keys. -// Returns false in case of memory error. -int VP8LColorCacheInit(VP8LColorCache* const color_cache, int hash_bits); - -void VP8LColorCacheCopy(const VP8LColorCache* const src, - VP8LColorCache* const dst); - -// Delete the memory associated to color cache. -void VP8LColorCacheClear(VP8LColorCache* const color_cache); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} -#endif - -#endif // WEBP_UTILS_COLOR_CACHE_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/endian_inl_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/endian_inl_utils.h deleted file mode 100644 index 3630a29..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/endian_inl_utils.h +++ /dev/null @@ -1,93 +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. -// ----------------------------------------------------------------------------- -// -// Endian related functions. - -#ifndef WEBP_UTILS_ENDIAN_INL_UTILS_H_ -#define WEBP_UTILS_ENDIAN_INL_UTILS_H_ - -#ifdef HAVE_CONFIG_H -#include "src/webp/config.h" -#endif - -#include "src/dsp/dsp.h" -#include "src/webp/types.h" - -#if defined(WORDS_BIGENDIAN) -#define HToLE32 BSwap32 -#define HToLE16 BSwap16 -#else -#define HToLE32(x) (x) -#define HToLE16(x) (x) -#endif - -#if !defined(HAVE_CONFIG_H) -#if LOCAL_GCC_PREREQ(4,8) || __has_builtin(__builtin_bswap16) -#define HAVE_BUILTIN_BSWAP16 -#endif -#if LOCAL_GCC_PREREQ(4,3) || __has_builtin(__builtin_bswap32) -#define HAVE_BUILTIN_BSWAP32 -#endif -#if LOCAL_GCC_PREREQ(4,3) || __has_builtin(__builtin_bswap64) -#define HAVE_BUILTIN_BSWAP64 -#endif -#endif // !HAVE_CONFIG_H - -static WEBP_INLINE uint16_t BSwap16(uint16_t x) { -#if defined(HAVE_BUILTIN_BSWAP16) - return __builtin_bswap16(x); -#elif defined(_MSC_VER) - return _byteswap_ushort(x); -#else - // gcc will recognize a 'rorw $8, ...' here: - return (x >> 8) | ((x & 0xff) << 8); -#endif // HAVE_BUILTIN_BSWAP16 -} - -static WEBP_INLINE uint32_t BSwap32(uint32_t x) { -#if defined(WEBP_USE_MIPS32_R2) - uint32_t ret; - __asm__ volatile ( - "wsbh %[ret], %[x] \n\t" - "rotr %[ret], %[ret], 16 \n\t" - : [ret]"=r"(ret) - : [x]"r"(x) - ); - return ret; -#elif defined(HAVE_BUILTIN_BSWAP32) - return __builtin_bswap32(x); -#elif defined(__i386__) || defined(__x86_64__) - uint32_t swapped_bytes; - __asm__ volatile("bswap %0" : "=r"(swapped_bytes) : "0"(x)); - return swapped_bytes; -#elif defined(_MSC_VER) - return (uint32_t)_byteswap_ulong(x); -#else - return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24); -#endif // HAVE_BUILTIN_BSWAP32 -} - -static WEBP_INLINE uint64_t BSwap64(uint64_t x) { -#if defined(HAVE_BUILTIN_BSWAP64) - return __builtin_bswap64(x); -#elif defined(__x86_64__) - uint64_t swapped_bytes; - __asm__ volatile("bswapq %0" : "=r"(swapped_bytes) : "0"(x)); - return swapped_bytes; -#elif defined(_MSC_VER) - return (uint64_t)_byteswap_uint64(x); -#else // generic code for swapping 64-bit values (suggested by bdb@) - x = ((x & 0xffffffff00000000ull) >> 32) | ((x & 0x00000000ffffffffull) << 32); - x = ((x & 0xffff0000ffff0000ull) >> 16) | ((x & 0x0000ffff0000ffffull) << 16); - x = ((x & 0xff00ff00ff00ff00ull) >> 8) | ((x & 0x00ff00ff00ff00ffull) << 8); - return x; -#endif // HAVE_BUILTIN_BSWAP64 -} - -#endif // WEBP_UTILS_ENDIAN_INL_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/filters_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/filters_utils.h deleted file mode 100644 index 61da66e..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/filters_utils.h +++ /dev/null @@ -1,32 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Spatial prediction using various filters -// -// Author: Urvang (urvang@google.com) - -#ifndef WEBP_UTILS_FILTERS_UTILS_H_ -#define WEBP_UTILS_FILTERS_UTILS_H_ - -#include "src/webp/types.h" -#include "src/dsp/dsp.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Fast estimate of a potentially good filter. -WEBP_FILTER_TYPE WebPEstimateBestFilter(const uint8_t* data, - int width, int height, int stride); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_FILTERS_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_encode_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_encode_utils.h deleted file mode 100644 index 3e6763c..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_encode_utils.h +++ /dev/null @@ -1,60 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Author: Jyrki Alakuijala (jyrki@google.com) -// -// Entropy encoding (Huffman) for webp lossless - -#ifndef WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ -#define WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Struct for holding the tree header in coded form. -typedef struct { - uint8_t code; // value (0..15) or escape code (16,17,18) - uint8_t extra_bits; // extra bits for escape codes -} HuffmanTreeToken; - -// Struct to represent the tree codes (depth and bits array). -typedef struct { - int num_symbols; // Number of symbols. - uint8_t* code_lengths; // Code lengths of the symbols. - uint16_t* codes; // Symbol Codes. -} HuffmanTreeCode; - -// Struct to represent the Huffman tree. -typedef struct { - uint32_t total_count_; // Symbol frequency. - int value_; // Symbol value. - int pool_index_left_; // Index for the left sub-tree. - int pool_index_right_; // Index for the right sub-tree. -} HuffmanTree; - -// Turn the Huffman tree into a token sequence. -// Returns the number of tokens used. -int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree, - HuffmanTreeToken* tokens, int max_tokens); - -// Create an optimized tree, and tokenize it. -// 'buf_rle' and 'huff_tree' are pre-allocated and the 'tree' is the constructed -// huffman code tree. -void VP8LCreateHuffmanTree(uint32_t* const histogram, int tree_depth_limit, - uint8_t* const buf_rle, HuffmanTree* const huff_tree, - HuffmanTreeCode* const tree); - -#ifdef __cplusplus -} -#endif - -#endif // WEBP_UTILS_HUFFMAN_ENCODE_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_utils.h deleted file mode 100644 index ff7ef17..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/huffman_utils.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Utilities for building and looking up Huffman trees. -// -// Author: Urvang Joshi (urvang@google.com) - -#ifndef WEBP_UTILS_HUFFMAN_UTILS_H_ -#define WEBP_UTILS_HUFFMAN_UTILS_H_ - -#include -#include "src/webp/format_constants.h" -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define HUFFMAN_TABLE_BITS 8 -#define HUFFMAN_TABLE_MASK ((1 << HUFFMAN_TABLE_BITS) - 1) - -#define LENGTHS_TABLE_BITS 7 -#define LENGTHS_TABLE_MASK ((1 << LENGTHS_TABLE_BITS) - 1) - - -// Huffman lookup table entry -typedef struct { - uint8_t bits; // number of bits used for this symbol - uint16_t value; // symbol value or table offset -} HuffmanCode; - -// long version for holding 32b values -typedef struct { - int bits; // number of bits used for this symbol, - // or an impossible value if not a literal code. - uint32_t value; // 32b packed ARGB value if literal, - // or non-literal symbol otherwise -} HuffmanCode32; - -#define HUFFMAN_PACKED_BITS 6 -#define HUFFMAN_PACKED_TABLE_SIZE (1u << HUFFMAN_PACKED_BITS) - -// Huffman table group. -// Includes special handling for the following cases: -// - is_trivial_literal: one common literal base for RED/BLUE/ALPHA (not GREEN) -// - is_trivial_code: only 1 code (no bit is read from bitstream) -// - use_packed_table: few enough literal symbols, so all the bit codes -// can fit into a small look-up table packed_table[] -// The common literal base, if applicable, is stored in 'literal_arb'. -typedef struct HTreeGroup HTreeGroup; -struct HTreeGroup { - HuffmanCode* htrees[HUFFMAN_CODES_PER_META_CODE]; - int is_trivial_literal; // True, if huffman trees for Red, Blue & Alpha - // Symbols are trivial (have a single code). - uint32_t literal_arb; // If is_trivial_literal is true, this is the - // ARGB value of the pixel, with Green channel - // being set to zero. - int is_trivial_code; // true if is_trivial_literal with only one code - int use_packed_table; // use packed table below for short literal code - // table mapping input bits to a packed values, or escape case to literal code - HuffmanCode32 packed_table[HUFFMAN_PACKED_TABLE_SIZE]; -}; - -// Creates the instance of HTreeGroup with specified number of tree-groups. -HTreeGroup* VP8LHtreeGroupsNew(int num_htree_groups); - -// Releases the memory allocated for HTreeGroup. -void VP8LHtreeGroupsFree(HTreeGroup* const htree_groups); - -// Builds Huffman lookup table assuming code lengths are in symbol order. -// The 'code_lengths' is pre-allocated temporary memory buffer used for creating -// the huffman table. -// Returns built table size or 0 in case of error (invalid tree or -// memory error). -int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits, - const int code_lengths[], int code_lengths_size); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_HUFFMAN_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_dec_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_dec_utils.h deleted file mode 100644 index 327f19f..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_dec_utils.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 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. -// ----------------------------------------------------------------------------- -// -// Alpha plane de-quantization utility -// -// Author: Vikas Arora (vikasa@google.com) - -#ifndef WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ -#define WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Apply post-processing to input 'data' of size 'width'x'height' assuming that -// the source was quantized to a reduced number of levels. 'stride' is in bytes. -// Strength is in [0..100] and controls the amount of dithering applied. -// Returns false in case of error (data is NULL, invalid parameters, -// malloc failure, ...). -int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride, - int strength); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_QUANT_LEVELS_DEC_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_utils.h deleted file mode 100644 index 9ee3ea0..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/quant_levels_utils.h +++ /dev/null @@ -1,36 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Alpha plane quantization utility -// -// Author: Vikas Arora (vikasa@google.com) - -#ifndef WEBP_UTILS_QUANT_LEVELS_UTILS_H_ -#define WEBP_UTILS_QUANT_LEVELS_UTILS_H_ - -#include - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Replace the input 'data' of size 'width'x'height' with 'num-levels' -// quantized values. If not NULL, 'sse' will contain the sum of squared error. -// Valid range for 'num_levels' is [2, 256]. -// Returns false in case of error (data is NULL, or parameters are invalid). -int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels, - uint64_t* const sse); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_QUANT_LEVELS_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/random_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/random_utils.h deleted file mode 100644 index a5006f8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/random_utils.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2013 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. -// ----------------------------------------------------------------------------- -// -// Pseudo-random utilities -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_UTILS_RANDOM_UTILS_H_ -#define WEBP_UTILS_RANDOM_UTILS_H_ - -#include -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define VP8_RANDOM_DITHER_FIX 8 // fixed-point precision for dithering -#define VP8_RANDOM_TABLE_SIZE 55 - -typedef struct { - int index1_, index2_; - uint32_t tab_[VP8_RANDOM_TABLE_SIZE]; - int amp_; -} VP8Random; - -// Initializes random generator with an amplitude 'dithering' in range [0..1]. -void VP8InitRandom(VP8Random* const rg, float dithering); - -// Returns a centered pseudo-random number with 'num_bits' amplitude. -// (uses D.Knuth's Difference-based random generator). -// 'amp' is in VP8_RANDOM_DITHER_FIX fixed-point precision. -static WEBP_INLINE int VP8RandomBits2(VP8Random* const rg, int num_bits, - int amp) { - int diff; - assert(num_bits + VP8_RANDOM_DITHER_FIX <= 31); - diff = rg->tab_[rg->index1_] - rg->tab_[rg->index2_]; - if (diff < 0) diff += (1u << 31); - rg->tab_[rg->index1_] = diff; - if (++rg->index1_ == VP8_RANDOM_TABLE_SIZE) rg->index1_ = 0; - if (++rg->index2_ == VP8_RANDOM_TABLE_SIZE) rg->index2_ = 0; - // sign-extend, 0-center - diff = (int)((uint32_t)diff << 1) >> (32 - num_bits); - diff = (diff * amp) >> VP8_RANDOM_DITHER_FIX; // restrict range - diff += 1 << (num_bits - 1); // shift back to 0.5-center - return diff; -} - -static WEBP_INLINE int VP8RandomBits(VP8Random* const rg, int num_bits) { - return VP8RandomBits2(rg, num_bits, rg->amp_); -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_RANDOM_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/rescaler_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/rescaler_utils.h deleted file mode 100644 index ca41e42..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/rescaler_utils.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Rescaling functions -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_UTILS_RESCALER_UTILS_H_ -#define WEBP_UTILS_RESCALER_UTILS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "src/webp/types.h" - -#define WEBP_RESCALER_RFIX 32 // fixed-point precision for multiplies -#define WEBP_RESCALER_ONE (1ull << WEBP_RESCALER_RFIX) -#define WEBP_RESCALER_FRAC(x, y) \ - ((uint32_t)(((uint64_t)(x) << WEBP_RESCALER_RFIX) / (y))) - -// Structure used for on-the-fly rescaling -typedef uint32_t rescaler_t; // type for side-buffer -typedef struct WebPRescaler WebPRescaler; -struct WebPRescaler { - int x_expand; // true if we're expanding in the x direction - int y_expand; // true if we're expanding in the y direction - int num_channels; // bytes to jump between pixels - uint32_t fx_scale; // fixed-point scaling factors - uint32_t fy_scale; // '' - uint32_t fxy_scale; // '' - int y_accum; // vertical accumulator - int y_add, y_sub; // vertical increments - int x_add, x_sub; // horizontal increments - int src_width, src_height; // source dimensions - int dst_width, dst_height; // destination dimensions - int src_y, dst_y; // row counters for input and output - uint8_t* dst; - int dst_stride; - rescaler_t* irow, *frow; // work buffer -}; - -// Initialize a rescaler given scratch area 'work' and dimensions of src & dst. -void WebPRescalerInit(WebPRescaler* const rescaler, - int src_width, int src_height, - uint8_t* const dst, - int dst_width, int dst_height, int dst_stride, - int num_channels, - rescaler_t* const work); - -// If either 'scaled_width' or 'scaled_height' (but not both) is 0 the value -// will be calculated preserving the aspect ratio, otherwise the values are -// left unmodified. Returns true on success, false if either value is 0 after -// performing the scaling calculation. -int WebPRescalerGetScaledDimensions(int src_width, int src_height, - int* const scaled_width, - int* const scaled_height); - -// Returns the number of input lines needed next to produce one output line, -// considering that the maximum available input lines are 'max_num_lines'. -int WebPRescaleNeededLines(const WebPRescaler* const rescaler, - int max_num_lines); - -// Import multiple rows over all channels, until at least one row is ready to -// be exported. Returns the actual number of lines that were imported. -int WebPRescalerImport(WebPRescaler* const rescaler, int num_rows, - const uint8_t* src, int src_stride); - -// Export as many rows as possible. Return the numbers of rows written. -int WebPRescalerExport(WebPRescaler* const rescaler); - -// Return true if input is finished -static WEBP_INLINE -int WebPRescalerInputDone(const WebPRescaler* const rescaler) { - return (rescaler->src_y >= rescaler->src_height); -} -// Return true if output is finished -static WEBP_INLINE -int WebPRescalerOutputDone(const WebPRescaler* const rescaler) { - return (rescaler->dst_y >= rescaler->dst_height); -} - -// Return true if there are pending output rows ready. -static WEBP_INLINE -int WebPRescalerHasPendingOutput(const WebPRescaler* const rescaler) { - return !WebPRescalerOutputDone(rescaler) && (rescaler->y_accum <= 0); -} - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_RESCALER_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/thread_utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/thread_utils.h deleted file mode 100644 index 29ad49f..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/thread_utils.h +++ /dev/null @@ -1,90 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Multi-threaded worker -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_UTILS_THREAD_UTILS_H_ -#define WEBP_UTILS_THREAD_UTILS_H_ - -#ifdef HAVE_CONFIG_H -#include "src/webp/config.h" -#endif - -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// State of the worker thread object -typedef enum { - NOT_OK = 0, // object is unusable - OK, // ready to work - WORK // busy finishing the current task -} WebPWorkerStatus; - -// Function to be called by the worker thread. Takes two opaque pointers as -// arguments (data1 and data2), and should return false in case of error. -typedef int (*WebPWorkerHook)(void*, void*); - -// Synchronization object used to launch job in the worker thread -typedef struct { - void* impl_; // platform-dependent implementation worker details - WebPWorkerStatus status_; - WebPWorkerHook hook; // hook to call - void* data1; // first argument passed to 'hook' - void* data2; // second argument passed to 'hook' - int had_error; // return value of the last call to 'hook' -} WebPWorker; - -// The interface for all thread-worker related functions. All these functions -// must be implemented. -typedef struct { - // Must be called first, before any other method. - void (*Init)(WebPWorker* const worker); - // Must be called to initialize the object and spawn the thread. Re-entrant. - // Will potentially launch the thread. Returns false in case of error. - int (*Reset)(WebPWorker* const worker); - // Makes sure the previous work is finished. Returns true if worker->had_error - // was not set and no error condition was triggered by the working thread. - int (*Sync)(WebPWorker* const worker); - // Triggers the thread to call hook() with data1 and data2 arguments. These - // hook/data1/data2 values can be changed at any time before calling this - // function, but not be changed afterward until the next call to Sync(). - void (*Launch)(WebPWorker* const worker); - // This function is similar to Launch() except that it calls the - // hook directly instead of using a thread. Convenient to bypass the thread - // mechanism while still using the WebPWorker structs. Sync() must - // still be called afterward (for error reporting). - void (*Execute)(WebPWorker* const worker); - // Kill the thread and terminate the object. To use the object again, one - // must call Reset() again. - void (*End)(WebPWorker* const worker); -} WebPWorkerInterface; - -// Install a new set of threading functions, overriding the defaults. This -// should be done before any workers are started, i.e., before any encoding or -// 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( - const WebPWorkerInterface* const winterface); - -// Retrieve the currently set thread worker interface. -WEBP_EXTERN const WebPWorkerInterface* WebPGetWorkerInterface(void); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_THREAD_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/utils.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/utils.h deleted file mode 100644 index c7620f9..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/utils/utils.h +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Misc. common utility functions -// -// Authors: Skal (pascal.massimino@gmail.com) -// Urvang (urvang@google.com) - -#ifndef WEBP_UTILS_UTILS_H_ -#define WEBP_UTILS_UTILS_H_ - -#ifdef HAVE_CONFIG_H -#include "src/webp/config.h" -#endif - -#include -#include - -#include "src/dsp/dsp.h" -#include "src/webp/types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//------------------------------------------------------------------------------ -// Memory allocation - -// This is the maximum memory amount that libwebp will ever try to allocate. -#ifndef WEBP_MAX_ALLOCABLE_MEMORY -#if SIZE_MAX > (1ULL << 34) -#define WEBP_MAX_ALLOCABLE_MEMORY (1ULL << 34) -#else -// For 32-bit targets keep this below INT_MAX to avoid valgrind warnings. -#define WEBP_MAX_ALLOCABLE_MEMORY ((1ULL << 31) - (1 << 16)) -#endif -#endif // WEBP_MAX_ALLOCABLE_MEMORY - -// size-checking safe malloc/calloc: verify that the requested size is not too -// large, or return NULL. You don't need to call these for constructs like -// malloc(sizeof(foo)), but only if there's picture-dependent size involved -// 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); -// 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); - -// Companion deallocation function to the above allocations. -WEBP_EXTERN void WebPSafeFree(void* const ptr); - -//------------------------------------------------------------------------------ -// Alignment - -#define WEBP_ALIGN_CST 31 -#define WEBP_ALIGN(PTR) (((uintptr_t)(PTR) + WEBP_ALIGN_CST) & ~WEBP_ALIGN_CST) - -#include -// 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, ptr, sizeof(A)); - return A; -} -static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { - memcpy(ptr, &val, sizeof(val)); -} - -//------------------------------------------------------------------------------ -// Reading/writing data. - -// Read 16, 24 or 32 bits stored in little-endian order. -static WEBP_INLINE int GetLE16(const uint8_t* const data) { - return (int)(data[0] << 0) | (data[1] << 8); -} - -static WEBP_INLINE int GetLE24(const uint8_t* const data) { - return GetLE16(data) | (data[2] << 16); -} - -static WEBP_INLINE uint32_t GetLE32(const uint8_t* const data) { - return GetLE16(data) | ((uint32_t)GetLE16(data + 2) << 16); -} - -// 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); -} - -static WEBP_INLINE void PutLE24(uint8_t* const data, int val) { - assert(val < (1 << 24)); - PutLE16(data, val & 0xffff); - data[2] = (val >> 16); -} - -static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) { - PutLE16(data, (int)(val & 0xffff)); - PutLE16(data + 2, (int)(val >> 16)); -} - -// Returns (int)floor(log2(n)). n must be > 0. -// use GNU builtins where available. -#if defined(__GNUC__) && \ - ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) -static WEBP_INLINE int BitsLog2Floor(uint32_t n) { - return 31 ^ __builtin_clz(n); -} -#elif defined(_MSC_VER) && _MSC_VER > 1310 && \ - (defined(_M_X64) || defined(_M_IX86)) -#include -#pragma intrinsic(_BitScanReverse) - -static WEBP_INLINE int BitsLog2Floor(uint32_t n) { - unsigned long first_set_bit; - _BitScanReverse(&first_set_bit, 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 - -//------------------------------------------------------------------------------ -// Pixel copying. - -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); - -// 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); - -//------------------------------------------------------------------------------ -// Unique colors. - -// Returns count of unique colors in 'pic', assuming pic->use_argb is true. -// If the unique color count is more than MAX_PALETTE_SIZE, returns -// MAX_PALETTE_SIZE+1. -// If 'palette' is not NULL and number of unique colors is less than or equal to -// 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); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_UTILS_UTILS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/decode.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/decode.h deleted file mode 100644 index ae8bfe8..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/decode.h +++ /dev/null @@ -1,506 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// Main decoding functions for WebP images. -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_WEBP_DECODE_H_ -#define WEBP_WEBP_DECODE_H_ - -#include "./types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define WEBP_DECODER_ABI_VERSION 0x0208 // MAJOR(8b) + MINOR(8b) - -// Note: forward declaring enumerations is not allowed in (strict) C and C++, -// the types are left here for reference. -// typedef enum VP8StatusCode VP8StatusCode; -// typedef enum WEBP_CSP_MODE WEBP_CSP_MODE; -typedef struct WebPRGBABuffer WebPRGBABuffer; -typedef struct WebPYUVABuffer WebPYUVABuffer; -typedef struct WebPDecBuffer WebPDecBuffer; -typedef struct WebPIDecoder WebPIDecoder; -typedef struct WebPBitstreamFeatures WebPBitstreamFeatures; -typedef struct WebPDecoderOptions WebPDecoderOptions; -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); - -// 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. -// 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); - -// 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); - -// 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); - -// 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); - -// 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); - - -// Decode WebP images pointed to by 'data' to Y'UV format(*). The pointer -// returned is the Y samples buffer. Upon return, *u and *v will point to -// the U and V chroma data. These U and V buffers need NOT be passed to -// WebPFree(), unlike the returned Y luma one. The dimension of the U and V -// planes are both (*width + 1) / 2 and (*height + 1)/ 2. -// Upon return, the Y buffer has a stride returned as '*stride', while U and V -// 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); - -// These five functions are variants of the above ones, that decode the image -// directly into a pre-allocated buffer 'output_buffer'. The maximum storage -// available in this buffer is indicated by 'output_buffer_size'. If this -// storage is not sufficient (or an error occurred), NULL is returned. -// Otherwise, output_buffer is returned, for convenience. -// 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( - 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( - 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( - 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( - 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( - const uint8_t* data, size_t data_size, - uint8_t* output_buffer, size_t output_buffer_size, int output_stride); - -// WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly -// into pre-allocated luma/chroma plane buffers. This function requires the -// strides to be passed: one for the luma plane and one for each of the -// chroma ones. The size of each plane buffer is passed as 'luma_size', -// '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( - 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, - uint8_t* v, size_t v_size, int v_stride); - -//------------------------------------------------------------------------------ -// Output colorspaces and buffer - -// Colorspaces -// Note: the naming describes the byte-ordering of packed samples in memory. -// For instance, MODE_BGRA relates to samples ordered as B,G,R,A,B,G,R,A,... -// Non-capital names (e.g.:MODE_Argb) relates to pre-multiplied RGB channels. -// RGBA-4444 and RGB-565 colorspaces are represented by following byte-order: -// RGBA-4444: [r3 r2 r1 r0 g3 g2 g1 g0], [b3 b2 b1 b0 a3 a2 a1 a0], ... -// RGB-565: [r4 r3 r2 r1 r0 g5 g4 g3], [g2 g1 g0 b4 b3 b2 b1 b0], ... -// In the case WEBP_SWAP_16BITS_CSP is defined, the bytes are swapped for -// these two modes: -// RGBA-4444: [b3 b2 b1 b0 a3 a2 a1 a0], [r3 r2 r1 r0 g3 g2 g1 g0], ... -// RGB-565: [g2 g1 g0 b4 b3 b2 b1 b0], [r4 r3 r2 r1 r0 g5 g4 g3], ... - -typedef enum WEBP_CSP_MODE { - MODE_RGB = 0, MODE_RGBA = 1, - MODE_BGR = 2, MODE_BGRA = 3, - MODE_ARGB = 4, MODE_RGBA_4444 = 5, - MODE_RGB_565 = 6, - // RGB-premultiplied transparent modes (alpha value is preserved) - MODE_rgbA = 7, - MODE_bgrA = 8, - MODE_Argb = 9, - MODE_rgbA_4444 = 10, - // YUV modes must come after RGB ones. - MODE_YUV = 11, MODE_YUVA = 12, // yuv 4:2:0 - MODE_LAST = 13 -} WEBP_CSP_MODE; - -// Some useful macros: -static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) { - return (mode == MODE_rgbA || mode == MODE_bgrA || mode == MODE_Argb || - mode == MODE_rgbA_4444); -} - -static WEBP_INLINE int WebPIsAlphaMode(WEBP_CSP_MODE mode) { - return (mode == MODE_RGBA || mode == MODE_BGRA || mode == MODE_ARGB || - mode == MODE_RGBA_4444 || mode == MODE_YUVA || - WebPIsPremultipliedMode(mode)); -} - -static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) { - return (mode < MODE_YUV); -} - -//------------------------------------------------------------------------------ -// WebPDecBuffer: Generic structure for describing the output sample buffer. - -struct WebPRGBABuffer { // view as RGBA - uint8_t* rgba; // pointer to RGBA samples - int stride; // stride in bytes from one scanline to the next. - size_t size; // total size of the *rgba buffer. -}; - -struct WebPYUVABuffer { // view as YUVA - uint8_t* y, *u, *v, *a; // pointer to luma, chroma U/V, alpha samples - int y_stride; // luma stride - int u_stride, v_stride; // chroma strides - int a_stride; // alpha stride - size_t y_size; // luma plane size - size_t u_size, v_size; // chroma planes size - size_t a_size; // alpha-plane size -}; - -// Output buffer -struct WebPDecBuffer { - WEBP_CSP_MODE colorspace; // Colorspace. - int width, height; // Dimensions. - int is_external_memory; // If non-zero, 'internal_memory' pointer is not - // used. If value is '2' or more, the external - // memory is considered 'slow' and multiple - // read/write will be avoided. - union { - WebPRGBABuffer RGBA; - WebPYUVABuffer YUVA; - } u; // Nameless union of buffer parameters. - uint32_t pad[4]; // padding for later use - - uint8_t* private_memory; // Internally allocated memory (only when - // is_external_memory is 0). Should not be used - // externally, but accessed via the buffer union. -}; - -// Internal, version-checked, entry point -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 -static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) { - return WebPInitDecBufferInternal(buffer, WEBP_DECODER_ABI_VERSION); -} - -// 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); - -//------------------------------------------------------------------------------ -// Enumeration of the status codes - -typedef enum VP8StatusCode { - VP8_STATUS_OK = 0, - VP8_STATUS_OUT_OF_MEMORY, - VP8_STATUS_INVALID_PARAM, - VP8_STATUS_BITSTREAM_ERROR, - VP8_STATUS_UNSUPPORTED_FEATURE, - VP8_STATUS_SUSPENDED, - VP8_STATUS_USER_ABORT, - VP8_STATUS_NOT_ENOUGH_DATA -} VP8StatusCode; - -//------------------------------------------------------------------------------ -// Incremental decoding -// -// This API allows streamlined decoding of partial data. -// Picture can be incrementally decoded as data become available thanks to the -// WebPIDecoder object. This object can be left in a SUSPENDED state if the -// picture is only partially decoded, pending additional input. -// Code example: -// -// WebPInitDecBuffer(&output_buffer); -// output_buffer.colorspace = mode; -// ... -// WebPIDecoder* idec = WebPINewDecoder(&output_buffer); -// while (additional_data_is_available) { -// // ... (get additional data in some new_data[] buffer) -// status = WebPIAppend(idec, new_data, new_data_size); -// if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) { -// break; // an error occurred. -// } -// -// // The above call decodes the current available buffer. -// // Part of the image can now be refreshed by calling -// // WebPIDecGetRGB()/WebPIDecGetYUVA() etc. -// } -// WebPIDelete(idec); - -// Creates a new incremental decoder with the supplied buffer parameter. -// This output_buffer can be passed NULL, in which case a default output buffer -// is used (with MODE_RGB). Otherwise, an internal reference to 'output_buffer' -// is kept, which means that the lifespan of 'output_buffer' must be larger than -// that of the returned WebPIDecoder object. -// The supplied 'output_buffer' content MUST NOT be changed between calls to -// WebPIAppend() or WebPIUpdate() unless 'output_buffer.is_external_memory' is -// not set to 0. In such a case, it is allowed to modify the pointers, size and -// stride of output_buffer.u.RGBA or output_buffer.u.YUVA, provided they remain -// 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); - -// This function allocates and initializes an incremental-decoder object, which -// will output the RGB/A samples specified by 'csp' into a preallocated -// buffer 'output_buffer'. The size of this buffer is at least -// 'output_buffer_size' and the stride (distance in bytes between two scanlines) -// is specified by 'output_stride'. -// Additionally, output_buffer can be passed NULL in which case the output -// buffer will be allocated automatically when the decoding starts. The -// 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_CSP_MODE csp, - uint8_t* output_buffer, size_t output_buffer_size, int output_stride); - -// This function allocates and initializes an incremental-decoder object, which -// will output the raw luma/chroma samples into a preallocated planes if -// supplied. The luma plane is specified by its pointer 'luma', its size -// 'luma_size' and its stride 'luma_stride'. Similarly, the chroma-u plane -// is specified by the 'u', 'u_size' and 'u_stride' parameters, and the chroma-v -// plane by 'v' and 'v_size'. And same for the alpha-plane. The 'a' pointer -// can be pass NULL in case one is not interested in the transparency plane. -// Conversely, 'luma' can be passed NULL if no preallocated planes are supplied. -// 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( - 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, - uint8_t* a, size_t a_size, int a_stride); - -// Deprecated version of the above, without the alpha plane. -// Kept for backward compatibility. -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); - -// 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( - WebPIDecoder* idec, const uint8_t* data, size_t data_size); - -// A variant of the above function to be used when data buffer contains -// partial data from the beginning. In this case data buffer is not copied -// 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( - WebPIDecoder* idec, const uint8_t* data, size_t data_size); - -// Returns the RGB/A image decoded so far. Returns NULL if output params -// are not initialized yet. The RGB/A output type corresponds to the colorspace -// 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. 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( - 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); - -// Deprecated alpha-less version of WebPIDecGetYUVA(): it will ignore the -// alpha information (if present). Kept for backward compatibility. -static WEBP_INLINE uint8_t* WebPIDecGetYUV( - const WebPIDecoder* idec, int* last_y, uint8_t** u, uint8_t** v, - int* width, int* height, int* stride, int* uv_stride) { - return WebPIDecGetYUVA(idec, last_y, u, v, NULL, width, height, - stride, uv_stride, NULL); -} - -// Generic call to retrieve information about the displayable area. -// If non NULL, the left/right/width/height pointers are filled with the visible -// rectangular area so far. -// 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( - const WebPIDecoder* idec, int* left, int* top, int* width, int* height); - -//------------------------------------------------------------------------------ -// Advanced decoding parametrization -// -// Code sample for using the advanced decoding API -/* - // A) Init a configuration object - WebPDecoderConfig config; - CHECK(WebPInitDecoderConfig(&config)); - - // B) optional: retrieve the bitstream's features. - CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK); - - // C) Adjust 'config', if needed - config.no_fancy_upsampling = 1; - config.output.colorspace = MODE_BGRA; - // etc. - - // Note that you can also make config.output point to an externally - // supplied memory buffer, provided it's big enough to store the decoded - // picture. Otherwise, config.output will just be used to allocate memory - // and store the decoded picture. - - // D) Decode! - CHECK(WebPDecode(data, data_size, &config) == VP8_STATUS_OK); - - // E) Decoded image is now in config.output (and config.output.u.RGBA) - - // F) Reclaim memory allocated in config's object. It's safe to call - // this function even if the memory is external and wasn't allocated - // by WebPDecode(). - WebPFreeDecBuffer(&config.output); -*/ - -// Features gathered from the bitstream -struct WebPBitstreamFeatures { - int width; // Width in pixels, as read from the bitstream. - int height; // Height in pixels, as read from the bitstream. - int has_alpha; // True if the bitstream contains an alpha channel. - int has_animation; // True if the bitstream is an animation. - int format; // 0 = undefined (/mixed), 1 = lossy, 2 = lossless - - uint32_t pad[5]; // padding for later use -}; - -// Internal, version-checked, entry point -WEBP_EXTERN VP8StatusCode WebPGetFeaturesInternal( - const uint8_t*, size_t, WebPBitstreamFeatures*, int); - -// Retrieve features from the bitstream. The *features structure is filled -// with information gathered from the bitstream. -// 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) { - return WebPGetFeaturesInternal(data, data_size, features, - WEBP_DECODER_ABI_VERSION); -} - -// Decoding options -struct WebPDecoderOptions { - int bypass_filtering; // if true, skip the in-loop filtering - int no_fancy_upsampling; // if true, use faster pointwise upsampler - int use_cropping; // if true, cropping is applied _first_ - int crop_left, crop_top; // top-left position for cropping. - // Will be snapped to even values. - int crop_width, crop_height; // dimension of the cropping area - int use_scaling; // if true, scaling is applied _afterward_ - int scaled_width, scaled_height; // final resolution - int use_threads; // if true, use multi-threaded decoding - int dithering_strength; // dithering strength (0=Off, 100=full) - int flip; // flip output vertically - int alpha_dithering_strength; // alpha dithering strength in [0..100] - - uint32_t pad[5]; // padding for later use -}; - -// Main object storing the configuration for advanced decoding. -struct WebPDecoderConfig { - WebPBitstreamFeatures input; // Immutable bitstream features (optional) - WebPDecBuffer output; // Output buffer (can point to external mem) - WebPDecoderOptions options; // Decoding options -}; - -// Internal, version-checked, entry point -WEBP_EXTERN int WebPInitDecoderConfigInternal(WebPDecoderConfig*, int); - -// Initialize the configuration as empty. This function must always be -// called first, unless WebPGetFeatures() is to be called. -// Returns false in case of mismatched version. -static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* config) { - return WebPInitDecoderConfigInternal(config, WEBP_DECODER_ABI_VERSION); -} - -// Instantiate a new incremental decoder object with the requested -// configuration. The bitstream can be passed using 'data' and 'data_size' -// parameter, in which case the features will be parsed and stored into -// config->input. Otherwise, 'data' can be NULL and no parsing will occur. -// Note that 'config' can be NULL too, in which case a default configuration -// is used. If 'config' is not NULL, it must outlive the WebPIDecoder object -// as some references to its fields will be used. No internal copy of 'config' -// is made. -// 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); - -// 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); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_WEBP_DECODE_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/demux.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/demux.h deleted file mode 100644 index 846eeb1..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/demux.h +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Demux API. -// Enables extraction of image and extended format data from WebP files. - -// Code Example: Demuxing WebP data to extract all the frames, ICC profile -// and EXIF/XMP metadata. -/* - WebPDemuxer* demux = WebPDemux(&webp_data); - - uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH); - uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT); - // ... (Get information about the features present in the WebP file). - uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS); - - // ... (Iterate over all frames). - WebPIterator iter; - if (WebPDemuxGetFrame(demux, 1, &iter)) { - do { - // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(), - // ... and get other frame properties like width, height, offsets etc. - // ... see 'struct WebPIterator' below for more info). - } while (WebPDemuxNextFrame(&iter)); - WebPDemuxReleaseIterator(&iter); - } - - // ... (Extract metadata). - WebPChunkIterator chunk_iter; - if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter); - // ... (Consume the ICC profile in 'chunk_iter.chunk'). - WebPDemuxReleaseChunkIterator(&chunk_iter); - if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter); - // ... (Consume the EXIF metadata in 'chunk_iter.chunk'). - WebPDemuxReleaseChunkIterator(&chunk_iter); - if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter); - // ... (Consume the XMP metadata in 'chunk_iter.chunk'). - WebPDemuxReleaseChunkIterator(&chunk_iter); - WebPDemuxDelete(demux); -*/ - -#ifndef WEBP_WEBP_DEMUX_H_ -#define WEBP_WEBP_DEMUX_H_ - -#include "./decode.h" // for WEBP_CSP_MODE -#include "./mux_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define WEBP_DEMUX_ABI_VERSION 0x0107 // MAJOR(8b) + MINOR(8b) - -// Note: forward declaring enumerations is not allowed in (strict) C and C++, -// the types are left here for reference. -// typedef enum WebPDemuxState WebPDemuxState; -// typedef enum WebPFormatFeature WebPFormatFeature; -typedef struct WebPDemuxer WebPDemuxer; -typedef struct WebPIterator WebPIterator; -typedef struct WebPChunkIterator WebPChunkIterator; -typedef struct WebPAnimInfo WebPAnimInfo; -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); - -//------------------------------------------------------------------------------ -// Life of a Demux object - -typedef enum WebPDemuxState { - WEBP_DEMUX_PARSE_ERROR = -1, // An error occurred while parsing. - WEBP_DEMUX_PARSING_HEADER = 0, // Not enough data to parse full header. - WEBP_DEMUX_PARSED_HEADER = 1, // Header parsing complete, - // data may be available. - WEBP_DEMUX_DONE = 2 // Entire file has been parsed. -} WebPDemuxState; - -// Internal, version-checked, entry point -WEBP_EXTERN WebPDemuxer* WebPDemuxInternal( - const WebPData*, int, WebPDemuxState*, int); - -// Parses the full WebP file given by 'data'. For single images the WebP file -// header alone or the file header and the chunk header may be absent. -// Returns a WebPDemuxer object on successful parse, NULL otherwise. -static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) { - return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION); -} - -// Parses the possibly incomplete WebP file given by 'data'. -// If 'state' is non-NULL it will be set to indicate the status of the demuxer. -// Returns NULL in case of error or if there isn't enough data to start parsing; -// and a WebPDemuxer object on successful parse. -// Note that WebPDemuxer keeps internal pointers to 'data' memory segment. -// If this data is volatile, the demuxer object should be deleted (by calling -// WebPDemuxDelete()) and WebPDemuxPartial() called again on the new data. -// This is usually an inexpensive operation. -static WEBP_INLINE WebPDemuxer* WebPDemuxPartial( - const WebPData* data, WebPDemuxState* state) { - return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION); -} - -// Frees memory associated with 'dmux'. -WEBP_EXTERN void WebPDemuxDelete(WebPDemuxer* dmux); - -//------------------------------------------------------------------------------ -// Data/information extraction. - -typedef enum WebPFormatFeature { - 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, // 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. -// 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); - -//------------------------------------------------------------------------------ -// Frame iteration. - -struct WebPIterator { - int frame_num; - int num_frames; // equivalent to WEBP_FF_FRAME_COUNT. - int x_offset, y_offset; // offset relative to the canvas. - int width, height; // dimensions of this frame. - int duration; // display duration in milliseconds. - WebPMuxAnimDispose dispose_method; // dispose method for the frame. - int complete; // true if 'fragment' contains a full frame. partial images - // may still be decoded with the WebP incremental decoder. - WebPData fragment; // The frame given by 'frame_num'. Note for historical - // reasons this is called a fragment. - int has_alpha; // True if the frame contains transparency. - WebPMuxAnimBlend blend_method; // Blend operation for the frame. - - uint32_t pad[2]; // padding for later use. - void* private_; // for internal use only. -}; - -// Retrieves frame 'frame_number' from 'dmux'. -// 'iter->fragment' points to the frame on return from this function. -// Setting 'frame_number' equal to 0 will return the last frame of the image. -// 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( - 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); - -// 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); - -//------------------------------------------------------------------------------ -// Chunk iteration. - -struct WebPChunkIterator { - // The current and total number of chunks with the fourcc given to - // WebPDemuxGetChunk(). - int chunk_num; - int num_chunks; - WebPData chunk; // The payload of the chunk. - - uint32_t pad[6]; // padding for later use - void* private_; -}; - -// Retrieves the 'chunk_number' instance of the chunk with id 'fourcc' from -// 'dmux'. -// 'fourcc' is a character array containing the fourcc of the chunk to return, -// e.g., "ICCP", "XMP ", "EXIF", etc. -// Setting 'chunk_number' equal to 0 will return the last chunk in a set. -// Returns true if the chunk is found, false otherwise. Image related chunk -// 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); - -// 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); - -// Releases any memory associated with 'iter'. -// Must be called before destroying the associated WebPDemuxer with -// WebPDemuxDelete(). -WEBP_EXTERN void WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter); - -//------------------------------------------------------------------------------ -// WebPAnimDecoder API -// -// This 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); -*/ - -typedef struct WebPAnimDecoder WebPAnimDecoder; // Main opaque object. - -// Global options. -struct WebPAnimDecoderOptions { - // Output colorspace. Only the following modes are supported: - // MODE_RGBA, MODE_BGRA, MODE_rgbA and MODE_bgrA. - WEBP_CSP_MODE color_mode; - int use_threads; // If true, use multi-threaded decoding. - uint32_t padding[7]; // Padding for later use. -}; - -// Internal, version-checked, entry point. -WEBP_EXTERN int WebPAnimDecoderOptionsInitInternal( - WebPAnimDecoderOptions*, int); - -// Should always be called, to initialize a fresh WebPAnimDecoderOptions -// structure before modification. Returns false in case of version mismatch. -// WebPAnimDecoderOptionsInit() must have succeeded before using the -// 'dec_options' object. -static WEBP_INLINE int WebPAnimDecoderOptionsInit( - WebPAnimDecoderOptions* dec_options) { - return WebPAnimDecoderOptionsInitInternal(dec_options, - WEBP_DEMUX_ABI_VERSION); -} - -// Internal, version-checked, entry point. -WEBP_EXTERN WebPAnimDecoder* WebPAnimDecoderNewInternal( - const WebPData*, const WebPAnimDecoderOptions*, int); - -// Creates and initializes a WebPAnimDecoder object. -// Parameters: -// webp_data - (in) WebP bitstream. This should remain unchanged during the -// lifetime of the output WebPAnimDecoder object. -// dec_options - (in) decoding options. Can be passed NULL to choose -// reasonable defaults (in particular, color mode MODE_RGBA -// will be picked). -// Returns: -// A pointer to the newly created WebPAnimDecoder object, or NULL in case of -// parsing error, invalid option or memory error. -static WEBP_INLINE WebPAnimDecoder* WebPAnimDecoderNew( - const WebPData* webp_data, const WebPAnimDecoderOptions* dec_options) { - return WebPAnimDecoderNewInternal(webp_data, dec_options, - WEBP_DEMUX_ABI_VERSION); -} - -// Global information about the animation.. -struct WebPAnimInfo { - uint32_t canvas_width; - uint32_t canvas_height; - uint32_t loop_count; - uint32_t bgcolor; - uint32_t frame_count; - uint32_t pad[4]; // padding for later use -}; - -// Get global information about the animation. -// Parameters: -// dec - (in) decoder instance to get information from. -// info - (out) global information fetched from the animation. -// Returns: -// True on success. -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 -// 'canvas_width * 4 * canvas_height', and not just the frame sub-rectangle. The -// returned buffer 'buf' is valid only until the next call to -// WebPAnimDecoderGetNext(), WebPAnimDecoderReset() or WebPAnimDecoderDelete(). -// Parameters: -// dec - (in/out) decoder instance from which the next frame is to be fetched. -// buf - (out) decoded frame. -// timestamp - (out) timestamp of the frame in milliseconds. -// 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); - -// Check if there are more frames left to decode. -// Parameters: -// dec - (in) decoder instance to be checked. -// 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); - -// Resets the WebPAnimDecoder object, so that next call to -// WebPAnimDecoderGetNext() will restart decoding from 1st frame. This would be -// helpful when all frames need to be decoded multiple times (e.g. -// 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); - -// Grab the internal demuxer object. -// Getting the demuxer object can be useful if one wants to use operations only -// available through demuxer; e.g. to get XMP/EXIF/ICC metadata. The returned -// demuxer object is owned by 'dec' and is valid only until the next call to -// WebPAnimDecoderDelete(). -// -// Parameters: -// dec - (in) decoder instance from which the demuxer object is to be fetched. -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); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_WEBP_DEMUX_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/encode.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/encode.h deleted file mode 100644 index 549cf07..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/encode.h +++ /dev/null @@ -1,545 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// WebP encoder: main interface -// -// Author: Skal (pascal.massimino@gmail.com) - -#ifndef WEBP_WEBP_ENCODE_H_ -#define WEBP_WEBP_ENCODE_H_ - -#include "./types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define WEBP_ENCODER_ABI_VERSION 0x020e // MAJOR(8b) + MINOR(8b) - -// Note: forward declaring enumerations is not allowed in (strict) C and C++, -// the types are left here for reference. -// typedef enum WebPImageHint WebPImageHint; -// typedef enum WebPEncCSP WebPEncCSP; -// typedef enum WebPPreset WebPPreset; -// typedef enum WebPEncodingError WebPEncodingError; -typedef struct WebPConfig WebPConfig; -typedef struct WebPPicture WebPPicture; // main structure for I/O -typedef struct WebPAuxStats WebPAuxStats; -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); - -//------------------------------------------------------------------------------ -// One-stop-shop call! No questions asked: - -// Returns the size of the compressed data (pointed to by *output), or 0 if -// an error occurred. The compressed data must be released by the caller -// using the call 'WebPFree(*output)'. -// 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, - 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 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, - 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 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 - -// Image characteristics hint for the underlying encoder. -typedef enum WebPImageHint { - WEBP_HINT_DEFAULT = 0, // default preset. - WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot - WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting - WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc). - WEBP_HINT_LAST -} WebPImageHint; - -// Compression parameters. -struct WebPConfig { - int lossless; // Lossless encoding (0=lossy(default), 1=lossless). - 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). - - 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 - // try to achieve. Takes precedence over target_size. - int segments; // maximum number of segments to use, in [1..4] - int sns_strength; // Spatial Noise Shaping. 0=off, 100=maximum. - int filter_strength; // range: [0 = off .. 100 = strongest] - int filter_sharpness; // range: [0 = off .. 7 = least sharp] - int filter_type; // filtering type: 0 = simple, 1 = strong (only used - // if filter_strength > 0 or autofilter > 0) - int autofilter; // Auto adjust filter's strength [0 = off, 1 = on] - int alpha_compression; // Algorithm for encoding the alpha plane (0 = none, - // 1 = compressed with WebP lossless). Default is 1. - int alpha_filtering; // Predictive filtering method for alpha plane. - // 0: none, 1: fast, 2: best. Default if 1. - int alpha_quality; // Between 0 (smallest size) and 100 (lossless). - // Default is 100. - int pass; // number of entropy-analysis passes (in [1..10]). - - int show_compressed; // if true, export the compressed picture back. - // In-loop filtering is not applied. - int preprocessing; // preprocessing filter: - // 0=none, 1=segment-smooth, 2=pseudo-random dithering - int partitions; // log2(number of token partitions) in [0..3]. Default - // is set to 0 for easier progressive decoding. - int partition_limit; // quality degradation allowed to fit the 512k limit - // on prediction modes coding (0: no degradation, - // 100: maximum possible degradation). - int emulate_jpeg_size; // If true, compression parameters will be remapped - // to better match the expected output size from - // JPEG compression. Generally, the output size will - // be similar but the degradation will be lower. - int thread_level; // If non-zero, try and use multi-threaded encoding. - int low_memory; // If set, reduce memory usage (but increase CPU use). - - int near_lossless; // Near lossless encoding [0 = max loss .. 100 = off - // (default)]. - int exact; // if non-zero, preserve the exact RGB values under - // transparent area. Otherwise, discard this invisible - // RGB information for better compression. The default - // value is 0. - - int use_delta_palette; // reserved for future lossless feature - int use_sharp_yuv; // if needed, use sharp (and slow) RGB->YUV conversion - - uint32_t pad[2]; // padding for later use -}; - -// Enumerate some predefined settings for WebPConfig, depending on the type -// of source picture. These presets are used when calling WebPConfigPreset(). -typedef enum WebPPreset { - WEBP_PRESET_DEFAULT = 0, // default preset. - WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot - WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting - WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details - WEBP_PRESET_ICON, // small-sized colorful images - WEBP_PRESET_TEXT // text-like -} WebPPreset; - -// Internal, version-checked, entry point -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() -// must have succeeded before using the 'config' object. -// Note that the default values are lossless=0 and quality=75. -static WEBP_INLINE int WebPConfigInit(WebPConfig* config) { - return WebPConfigInitInternal(config, WEBP_PRESET_DEFAULT, 75.f, - WEBP_ENCODER_ABI_VERSION); -} - -// This function will initialize the configuration according to a predefined -// set of parameters (referred to by 'preset') and a given quality factor. -// This function can be called as a replacement to WebPConfigInit(). Will -// return false in case of error. -static WEBP_INLINE int WebPConfigPreset(WebPConfig* config, - WebPPreset preset, float quality) { - return WebPConfigInitInternal(config, preset, quality, - WEBP_ENCODER_ABI_VERSION); -} - -// Activate the lossless compression mode with the desired efficiency level -// between 0 (fastest, lowest compression) and 9 (slower, best compression). -// A good default level is '6', providing a fair tradeoff between compression -// 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); - -// Returns true if 'config' is non-NULL and all configuration parameters are -// within their valid ranges. -WEBP_EXTERN int WebPValidateConfig(const WebPConfig* config); - -//------------------------------------------------------------------------------ -// Input / Output -// Structure for storing auxiliary statistics. - -struct WebPAuxStats { - int coded_size; // final size - - float PSNR[5]; // peak-signal-to-noise ratio for Y/U/V/All/Alpha - int block_count[3]; // number of intra4/intra16/skipped macroblocks - int header_bytes[2]; // approximate number of bytes spent for header - // and mode-partition #0 - int residual_bytes[3][4]; // approximate number of bytes spent for - // DC/AC/uv coefficients for each (0..3) segments. - int segment_size[4]; // number of macroblocks in each segments - int segment_quant[4]; // quantizer values for each segments - int segment_level[4]; // filtering strength for each segments [0..63] - - int alpha_data_size; // size of the transparency data - int layer_data_size; // size of the enhancement layer data - - // lossless encoder statistics - uint32_t lossless_features; // bit0:predictor bit1:cross-color transform - // bit2:subtract-green bit3:color indexing - int histogram_bits; // number of precision bits of histogram - int transform_bits; // precision bits for transform - int cache_bits; // number of bits for color cache lookup - int palette_size; // number of color in palette, if used - int lossless_size; // final lossless size - int lossless_hdr_size; // lossless header (transform, huffman etc) size - int lossless_data_size; // lossless image data size - - uint32_t pad[2]; // padding for later use -}; - -// Signature for output function. Should return true if writing was successful. -// data/data_size is the segment of data to write, and 'picture' is for -// reference (and so one can make use of picture->custom_ptr). -typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size, - const WebPPicture* picture); - -// WebPMemoryWrite: a special WebPWriterFunction that writes to memory using -// the following WebPMemoryWriter object (to be set as a custom_ptr). -struct WebPMemoryWriter { - uint8_t* mem; // final buffer (of size 'max_size', larger than 'size'). - size_t size; // final size - size_t max_size; // total capacity - uint32_t pad[1]; // padding for later use -}; - -// The following must be called first before any use. -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); -// 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); - -// 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 -// everything is OK. -typedef int (*WebPProgressHook)(int percent, const WebPPicture* picture); - -// Color spaces. -typedef enum WebPEncCSP { - // chroma sampling - WEBP_YUV420 = 0, // 4:2:0 - WEBP_YUV420A = 4, // alpha channel variant - WEBP_CSP_UV_MASK = 3, // bit-mask to get the UV sampling factors - WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present -} WebPEncCSP; - -// Encoding error conditions. -typedef enum WebPEncodingError { - VP8_ENC_OK = 0, - VP8_ENC_ERROR_OUT_OF_MEMORY, // memory error allocating objects - VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY, // memory error while flushing bits - VP8_ENC_ERROR_NULL_PARAMETER, // a pointer parameter is NULL - VP8_ENC_ERROR_INVALID_CONFIGURATION, // configuration is invalid - VP8_ENC_ERROR_BAD_DIMENSION, // picture has invalid width/height - VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is bigger than 512k - VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is bigger than 16M - VP8_ENC_ERROR_BAD_WRITE, // error while flushing bytes - VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G - VP8_ENC_ERROR_USER_ABORT, // abort request by user - VP8_ENC_ERROR_LAST // list terminator. always last. -} WebPEncodingError; - -// maximum width/height allowed (inclusive), in pixels -#define WEBP_MAX_DIMENSION 16383 - -// Main exchange structure (input samples, output bytes, statistics) -struct WebPPicture { - // INPUT - ////////////// - // Main flag for encoder selecting between ARGB or YUV input. - // It is recommended to use ARGB input (*argb, argb_stride) for lossless - // compression, and YUV input (*y, *u, *v, etc.) for lossy compression - // since these are the respective native colorspace for these formats. - int use_argb; - - // 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. - int y_stride, uv_stride; // luma/chroma strides. - uint8_t* a; // pointer to the alpha plane - int a_stride; // stride of the alpha plane - uint32_t pad1[2]; // padding for later use - - // ARGB input (mostly used for input to lossless compression) - uint32_t* argb; // Pointer to argb (32 bit) plane. - int argb_stride; // This is stride in pixels units, not bytes. - uint32_t pad2[3]; // padding for later use - - // OUTPUT - /////////////// - // Byte-emission hook, to store compressed bytes as they are ready. - WebPWriterFunction writer; // can be NULL - void* custom_ptr; // can be used by the writer. - - // map for extra information (only for lossy compression mode) - int extra_info_type; // 1: intra type, 2: segment, 3: quant - // 4: intra-16 prediction mode, - // 5: chroma prediction mode, - // 6: bit cost, 7: distortion - uint8_t* extra_info; // if not NULL, points to an array of size - // ((width + 15) / 16) * ((height + 15) / 16) that - // will be filled with a macroblock map, depending - // on extra_info_type. - - // STATS AND REPORTS - /////////////////////////// - // Pointer to side statistics (updated only if not NULL) - WebPAuxStats* stats; - - // Error code for the latest error encountered during encoding - WebPEncodingError error_code; - - // If not NULL, report progress during encoding. - WebPProgressHook progress_hook; - - void* user_data; // this field is free to be set to any value and - // used during callbacks (like progress-report e.g.). - - uint32_t pad3[3]; // padding for later use - - // Unused for now - uint8_t *pad4, *pad5; - uint32_t pad6[8]; // padding for later use - - // PRIVATE FIELDS - //////////////////// - void* memory_; // row chunk of memory for yuva planes - void* memory_argb_; // and for argb too. - void* pad7[2]; // padding for later use -}; - -// Internal, version-checked, entry point -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 -// 'picture' object. -// Note that, by default, use_argb is false and colorspace is WEBP_YUV420. -static WEBP_INLINE int WebPPictureInit(WebPPicture* picture) { - return WebPPictureInitInternal(picture, WEBP_ENCODER_ABI_VERSION); -} - -//------------------------------------------------------------------------------ -// WebPPicture utils - -// Convenience allocation / deallocation based on picture->width/height: -// 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); - -// 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); - -// 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); - -// Compute the single distortion for packed planes of samples. -// 'src' will be compared to 'ref', and the raw distortion stored into -// '*distortion'. The refined metric (log(MSE), log(1 - ssim),...' will be -// stored in '*result'. -// '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); - -// 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( - const WebPPicture* src, const WebPPicture* ref, - int metric_type, // 0 = PSNR, 1 = SSIM, 2 = LSIM - float result[5]); - -// self-crops a picture to the rectangle defined by top/left/width/height. -// Returns false in case of memory allocation error, or if the rectangle is -// outside of the source picture. -// The rectangle for the view is defined by the top-left corner pixel -// coordinates (left, top) as well as its width and height. This rectangle -// 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); - -// 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 -// as its width and height. This rectangle 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. -// Picture 'src' must out-live 'dst' picture. Self-extraction of view is allowed -// ('src' equal to 'dst') as a mean of fast-cropping (but note that doing so, -// the original dimension will be lost). Picture 'dst' need not be initialized -// 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); - -// 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); - -// 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); - -// 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( - WebPPicture* picture, const uint8_t* rgb, int rgb_stride); -// Same, but for RGBA buffer. -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( - WebPPicture* picture, const uint8_t* rgbx, int rgbx_stride); - -// Variants of the above, but taking BGR(A|X) input. -WEBP_EXTERN int WebPPictureImportBGR( - WebPPicture* picture, const uint8_t* bgr, int bgr_stride); -WEBP_EXTERN int WebPPictureImportBGRA( - WebPPicture* picture, const uint8_t* bgra, int bgra_stride); -WEBP_EXTERN int WebPPictureImportBGRX( - WebPPicture* picture, const uint8_t* bgrx, int bgrx_stride); - -// Converts picture->argb data to the YUV420A format. The 'colorspace' -// parameter is deprecated and should be equal to WEBP_YUV420. -// Upon return, picture->use_argb is set to false. The presence of real -// 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*/); - -// 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( - WebPPicture* picture, WebPEncCSP colorspace, float dithering); - -// Performs 'sharp' RGBA->YUVA420 downsampling and colorspace conversion. -// Downsampling is handled with extra care in case of color clipping. This -// 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); -// kept for backward compatibility: -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 -// ARGB incurs a small loss too. -// 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); - -// Helper function: given a width x height plane of RGBA or YUV(A) samples -// 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); - -// 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); - -//------------------------------------------------------------------------------ -// Main call - -// Main encoding call, after config and picture have been initialized. -// 'picture' must be less than 16384x16384 in dimension (cf WEBP_MAX_DIMENSION), -// and the 'config' object must be a valid one. -// Returns false in case of error, true otherwise. -// In case of error, picture->error_code is updated accordingly. -// 'picture' can hold the source samples in both YUV(A) or ARGB input, depending -// on the value of 'picture->use_argb'. It is highly recommended to use -// 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); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_WEBP_ENCODE_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/format_constants.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/format_constants.h deleted file mode 100644 index eca6981..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/format_constants.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Internal header for constants related to WebP file format. -// -// Author: Urvang (urvang@google.com) - -#ifndef WEBP_WEBP_FORMAT_CONSTANTS_H_ -#define WEBP_WEBP_FORMAT_CONSTANTS_H_ - -// Create fourcc of the chunk from the chunk tag characters. -#define MKFOURCC(a, b, c, d) ((a) | (b) << 8 | (c) << 16 | (uint32_t)(d) << 24) - -// VP8 related constants. -#define VP8_SIGNATURE 0x9d012a // Signature in VP8 data. -#define VP8_MAX_PARTITION0_SIZE (1 << 19) // max size of mode partition -#define VP8_MAX_PARTITION_SIZE (1 << 24) // max size for token partition -#define VP8_FRAME_HEADER_SIZE 10 // Size of the frame header within VP8 data. - -// VP8L related constants. -#define VP8L_SIGNATURE_SIZE 1 // VP8L signature size. -#define VP8L_MAGIC_BYTE 0x2f // VP8L signature byte. -#define VP8L_IMAGE_SIZE_BITS 14 // Number of bits used to store - // width and height. -#define VP8L_VERSION_BITS 3 // 3 bits reserved for version. -#define VP8L_VERSION 0 // version 0 -#define VP8L_FRAME_HEADER_SIZE 5 // Size of the VP8L frame header. - -#define MAX_PALETTE_SIZE 256 -#define MAX_CACHE_BITS 11 -#define HUFFMAN_CODES_PER_META_CODE 5 -#define ARGB_BLACK 0xff000000 - -#define DEFAULT_CODE_LENGTH 8 -#define MAX_ALLOWED_CODE_LENGTH 15 - -#define NUM_LITERAL_CODES 256 -#define NUM_LENGTH_CODES 24 -#define NUM_DISTANCE_CODES 40 -#define CODE_LENGTH_CODES 19 - -#define MIN_HUFFMAN_BITS 2 // min number of Huffman bits -#define MAX_HUFFMAN_BITS 9 // max number of Huffman bits - -#define TRANSFORM_PRESENT 1 // The bit to be written when next data - // to be read is a transform. -#define NUM_TRANSFORMS 4 // Maximum number of allowed transform - // in a bitstream. -typedef enum { - PREDICTOR_TRANSFORM = 0, - CROSS_COLOR_TRANSFORM = 1, - SUBTRACT_GREEN = 2, - COLOR_INDEXING_TRANSFORM = 3 -} VP8LImageTransformType; - -// Alpha related constants. -#define ALPHA_HEADER_LEN 1 -#define ALPHA_NO_COMPRESSION 0 -#define ALPHA_LOSSLESS_COMPRESSION 1 -#define ALPHA_PREPROCESSED_LEVELS 1 - -// Mux related constants. -#define TAG_SIZE 4 // Size of a chunk tag (e.g. "VP8L"). -#define CHUNK_SIZE_BYTES 4 // Size needed to store chunk's size. -#define CHUNK_HEADER_SIZE 8 // Size of a chunk header. -#define RIFF_HEADER_SIZE 12 // Size of the RIFF header ("RIFFnnnnWEBP"). -#define ANMF_CHUNK_SIZE 16 // Size of an ANMF chunk. -#define ANIM_CHUNK_SIZE 6 // Size of an ANIM chunk. -#define VP8X_CHUNK_SIZE 10 // Size of a VP8X chunk. - -#define MAX_CANVAS_SIZE (1 << 24) // 24-bit max for VP8X width/height. -#define MAX_IMAGE_AREA (1ULL << 32) // 32-bit max for width x height. -#define MAX_LOOP_COUNT (1 << 16) // maximum value for loop-count -#define MAX_DURATION (1 << 24) // maximum duration -#define MAX_POSITION_OFFSET (1 << 24) // maximum frame x/y offset - -// Maximum chunk payload is such that adding the header and padding won't -// overflow a uint32_t. -#define MAX_CHUNK_PAYLOAD (~0U - CHUNK_HEADER_SIZE - 1) - -#endif // WEBP_WEBP_FORMAT_CONSTANTS_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux.h deleted file mode 100644 index 66096a9..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux.h +++ /dev/null @@ -1,530 +0,0 @@ -// 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. -// ----------------------------------------------------------------------------- -// -// RIFF container manipulation and encoding for WebP images. -// -// Authors: Urvang (urvang@google.com) -// Vikas (vikasa@google.com) - -#ifndef WEBP_WEBP_MUX_H_ -#define WEBP_WEBP_MUX_H_ - -#include "./mux_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define WEBP_MUX_ABI_VERSION 0x0108 // MAJOR(8b) + MINOR(8b) - -//------------------------------------------------------------------------------ -// Mux API -// -// This API allows manipulation of WebP container images containing features -// like color profile, metadata, animation. -// -// Code Example#1: Create a WebPMux object with image data, color profile and -// XMP metadata. -/* - int copy_data = 0; - WebPMux* mux = WebPMuxNew(); - // ... (Prepare image data). - WebPMuxSetImage(mux, &image, copy_data); - // ... (Prepare ICCP color profile data). - WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data); - // ... (Prepare XMP metadata). - WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data); - // Get data from mux in WebP RIFF format. - WebPMuxAssemble(mux, &output_data); - WebPMuxDelete(mux); - // ... (Consume output_data; e.g. write output_data.bytes to file). - WebPDataClear(&output_data); -*/ - -// Code Example#2: Get image and color profile data from a WebP file. -/* - int copy_data = 0; - // ... (Read data from file). - WebPMux* mux = WebPMuxCreate(&data, copy_data); - WebPMuxGetFrame(mux, 1, &image); - // ... (Consume image; e.g. call WebPDecode() to decode the data). - WebPMuxGetChunk(mux, "ICCP", &icc_profile); - // ... (Consume icc_data). - WebPMuxDelete(mux); - free(data); -*/ - -// Note: forward declaring enumerations is not allowed in (strict) C and C++, -// the types are left here for reference. -// typedef enum WebPMuxError WebPMuxError; -// typedef enum WebPChunkId WebPChunkId; -typedef struct WebPMux WebPMux; // main opaque object. -typedef struct WebPMuxFrameInfo WebPMuxFrameInfo; -typedef struct WebPMuxAnimParams WebPMuxAnimParams; -typedef struct WebPAnimEncoderOptions WebPAnimEncoderOptions; - -// Error codes -typedef enum WebPMuxError { - WEBP_MUX_OK = 1, - WEBP_MUX_NOT_FOUND = 0, - WEBP_MUX_INVALID_ARGUMENT = -1, - WEBP_MUX_BAD_DATA = -2, - WEBP_MUX_MEMORY_ERROR = -3, - WEBP_MUX_NOT_ENOUGH_DATA = -4 -} WebPMuxError; - -// IDs for different types of chunks. -typedef enum WebPChunkId { - WEBP_CHUNK_VP8X, // VP8X - WEBP_CHUNK_ICCP, // ICCP - WEBP_CHUNK_ANIM, // ANIM - WEBP_CHUNK_ANMF, // ANMF - WEBP_CHUNK_DEPRECATED, // (deprecated from FRGM) - WEBP_CHUNK_ALPHA, // ALPH - WEBP_CHUNK_IMAGE, // VP8/VP8L - WEBP_CHUNK_EXIF, // EXIF - WEBP_CHUNK_XMP, // XMP - WEBP_CHUNK_UNKNOWN, // Other chunks. - WEBP_CHUNK_NIL -} 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); - -//------------------------------------------------------------------------------ -// Life of a Mux object - -// Internal, version-checked, entry point -WEBP_EXTERN WebPMux* WebPNewInternal(int); - -// Creates an empty mux object. -// Returns: -// A pointer to the newly created empty mux object. -// Or NULL in case of memory error. -static WEBP_INLINE WebPMux* WebPMuxNew(void) { - return WebPNewInternal(WEBP_MUX_ABI_VERSION); -} - -// Deletes the mux object. -// Parameters: -// mux - (in/out) object to be deleted -WEBP_EXTERN void WebPMuxDelete(WebPMux* mux); - -//------------------------------------------------------------------------------ -// Mux creation. - -// Internal, version-checked, entry point -WEBP_EXTERN WebPMux* WebPMuxCreateInternal(const WebPData*, int, int); - -// Creates a mux object from raw data given in WebP RIFF format. -// Parameters: -// bitstream - (in) the bitstream data in WebP RIFF format -// copy_data - (in) value 1 indicates given data WILL be copied to the mux -// object and value 0 indicates data will NOT be copied. -// Returns: -// A pointer to the mux object created from given data - on success. -// NULL - In case of invalid data or memory error. -static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* bitstream, - int copy_data) { - return WebPMuxCreateInternal(bitstream, copy_data, WEBP_MUX_ABI_VERSION); -} - -//------------------------------------------------------------------------------ -// Non-image chunks. - -// Note: Only non-image related chunks should be managed through chunk APIs. -// (Image related chunks are: "ANMF", "VP8 ", "VP8L" and "ALPH"). -// To add, get and delete images, use WebPMuxSetImage(), WebPMuxPushFrame(), -// WebPMuxGetFrame() and WebPMuxDeleteFrame(). - -// Adds a chunk with id 'fourcc' and data 'chunk_data' in the mux object. -// Any existing chunk(s) with the same id will be removed. -// Parameters: -// mux - (in/out) object to which the chunk is to be added -// fourcc - (in) a character array containing the fourcc of the given chunk; -// e.g., "ICCP", "XMP ", "EXIF" etc. -// chunk_data - (in) the chunk data to be added -// copy_data - (in) value 1 indicates given data WILL be copied to the mux -// object and value 0 indicates data will NOT be copied. -// Returns: -// WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL -// 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( - WebPMux* mux, const char fourcc[4], const WebPData* chunk_data, - int copy_data); - -// Gets a reference to the data of the chunk with id 'fourcc' in the mux object. -// The caller should NOT free the returned data. -// Parameters: -// mux - (in) object from which the chunk data is to be fetched -// fourcc - (in) a character array containing the fourcc of the chunk; -// e.g., "ICCP", "XMP ", "EXIF" etc. -// chunk_data - (out) returned chunk data -// Returns: -// WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL -// 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( - const WebPMux* mux, const char fourcc[4], WebPData* chunk_data); - -// Deletes the chunk with the given 'fourcc' from the mux object. -// Parameters: -// mux - (in/out) object from which the chunk is to be deleted -// fourcc - (in) a character array containing the fourcc of the chunk; -// e.g., "ICCP", "XMP ", "EXIF" etc. -// Returns: -// WEBP_MUX_INVALID_ARGUMENT - if mux or fourcc is NULL -// 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( - WebPMux* mux, const char fourcc[4]); - -//------------------------------------------------------------------------------ -// Images. - -// Encapsulates data about a single frame. -struct WebPMuxFrameInfo { - WebPData bitstream; // image data: can be a raw VP8/VP8L bitstream - // or a single-image WebP file. - int x_offset; // x-offset of the frame. - int y_offset; // y-offset of the frame. - int duration; // duration of the frame (in milliseconds). - - WebPChunkId id; // frame type: should be one of WEBP_CHUNK_ANMF - // or WEBP_CHUNK_IMAGE - WebPMuxAnimDispose dispose_method; // Disposal method for the frame. - WebPMuxAnimBlend blend_method; // Blend operation for the frame. - uint32_t pad[1]; // padding for later use -}; - -// Sets the (non-animated) image in the mux object. -// Note: Any existing images (including frames) will be removed. -// Parameters: -// mux - (in/out) object in which the image is to be set -// bitstream - (in) can be a raw VP8/VP8L bitstream or a single-image -// WebP file (non-animated) -// copy_data - (in) value 1 indicates given data WILL be copied to the mux -// object and value 0 indicates data will NOT be copied. -// Returns: -// 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( - WebPMux* mux, const WebPData* bitstream, int copy_data); - -// Adds a frame at the end of the mux object. -// Notes: (1) frame.id should be WEBP_CHUNK_ANMF -// (2) For setting a non-animated image, use WebPMuxSetImage() instead. -// (3) Type of frame being pushed must be same as the frames in mux. -// (4) As WebP only supports even offsets, any odd offset will be snapped -// to an even location using: offset &= ~1 -// Parameters: -// mux - (in/out) object to which the frame is to be added -// frame - (in) frame data. -// copy_data - (in) value 1 indicates given data WILL be copied to the mux -// object and value 0 indicates data will NOT be copied. -// Returns: -// WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL -// or if content of 'frame' is invalid. -// WEBP_MUX_MEMORY_ERROR - on memory allocation error. -// WEBP_MUX_OK - on success. -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 -// owned by the 'mux' object. It MUST be deallocated by the caller by calling -// WebPDataClear(). -// nth=0 has a special meaning - last position. -// Parameters: -// mux - (in) object from which the info is to be fetched -// nth - (in) index of the frame in the mux object -// frame - (out) data of the returned frame -// Returns: -// WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL. -// WEBP_MUX_NOT_FOUND - if there are less than nth frames in the mux object. -// 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( - const WebPMux* mux, uint32_t nth, WebPMuxFrameInfo* frame); - -// Deletes a frame from the mux object. -// nth=0 has a special meaning - last position. -// Parameters: -// mux - (in/out) object from which a frame is to be deleted -// nth - (in) The position from which the frame is to be deleted -// Returns: -// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL. -// 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); - -//------------------------------------------------------------------------------ -// Animation. - -// Animation parameters. -struct WebPMuxAnimParams { - uint32_t bgcolor; // Background color of the canvas stored (in MSB order) as: - // Bits 00 to 07: Alpha. - // Bits 08 to 15: Red. - // Bits 16 to 23: Green. - // Bits 24 to 31: Blue. - int loop_count; // Number of times to repeat the animation [0 = infinite]. -}; - -// Sets the animation parameters in the mux object. Any existing ANIM chunks -// will be removed. -// Parameters: -// mux - (in/out) object in which ANIM chunk is to be set/added -// params - (in) animation parameters. -// Returns: -// 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( - WebPMux* mux, const WebPMuxAnimParams* params); - -// Gets the animation parameters from the mux object. -// Parameters: -// mux - (in) object from which the animation parameters to be fetched -// params - (out) animation parameters extracted from the ANIM chunk -// Returns: -// 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( - const WebPMux* mux, WebPMuxAnimParams* params); - -//------------------------------------------------------------------------------ -// Misc Utilities. - -// Sets the canvas size for the mux object. The width and height can be -// specified explicitly or left as zero (0, 0). -// * When width and height are specified explicitly, then this frame bound is -// enforced during subsequent calls to WebPMuxAssemble() and an error is -// reported if any animated frame does not completely fit within the canvas. -// * When unspecified (0, 0), the constructed canvas will get the frame bounds -// from the bounding-box over all frames after calling WebPMuxAssemble(). -// Parameters: -// mux - (in) object to which the canvas size is to be set -// width - (in) canvas width -// height - (in) canvas height -// Returns: -// 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); - -// Gets the canvas size from the mux object. -// Note: This method assumes that the VP8X chunk, if present, is up-to-date. -// That is, the mux object hasn't been modified since the last call to -// WebPMuxAssemble() or WebPMuxCreate(). -// Parameters: -// mux - (in) object from which the canvas size is to be fetched -// width - (out) canvas width -// height - (out) canvas height -// Returns: -// 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); - -// Gets the feature flags from the mux object. -// Note: This method assumes that the VP8X chunk, if present, is up-to-date. -// That is, the mux object hasn't been modified since the last call to -// WebPMuxAssemble() or WebPMuxCreate(). -// Parameters: -// mux - (in) object from which the features are to be fetched -// flags - (out) the flags specifying which features are present in the -// mux object. This will be an OR of various flag values. -// Enum 'WebPFeatureFlags' can be used to test individual flag values. -// Returns: -// 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); - -// Gets number of chunks with the given 'id' in the mux object. -// Parameters: -// mux - (in) object from which the info is to be fetched -// id - (in) chunk id specifying the type of chunk -// num_elements - (out) number of chunks with the given chunk id -// 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); - -// 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. -// Parameters: -// mux - (in/out) object whose chunks are to be assembled -// assembled_data - (out) assembled WebP data -// Returns: -// WEBP_MUX_BAD_DATA - if mux object is invalid. -// 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); - -//------------------------------------------------------------------------------ -// WebPAnimEncoder API -// -// This API allows encoding (possibly) animated WebP images. -// -// Code Example: -/* - WebPAnimEncoderOptions enc_options; - WebPAnimEncoderOptionsInit(&enc_options); - // Tune 'enc_options' as needed. - WebPAnimEncoder* enc = WebPAnimEncoderNew(width, height, &enc_options); - while() { - WebPConfig config; - WebPConfigInit(&config); - // Tune 'config' as needed. - WebPAnimEncoderAdd(enc, frame, timestamp_ms, &config); - } - WebPAnimEncoderAdd(enc, NULL, timestamp_ms, NULL); - WebPAnimEncoderAssemble(enc, webp_data); - WebPAnimEncoderDelete(enc); - // Write the 'webp_data' to a file, or re-mux it further. -*/ - -typedef struct WebPAnimEncoder WebPAnimEncoder; // Main opaque object. - -// Forward declarations. Defined in encode.h. -struct WebPPicture; -struct WebPConfig; - -// Global options. -struct WebPAnimEncoderOptions { - WebPMuxAnimParams anim_params; // Animation parameters. - int minimize_size; // If true, minimize the output size (slow). Implicitly - // disables key-frame insertion. - int kmin; - int kmax; // Minimum and maximum distance between consecutive key - // frames in the output. The library may insert some key - // frames as needed to satisfy this criteria. - // Note that these conditions should hold: kmax > kmin - // and kmin >= kmax / 2 + 1. Also, if kmax <= 0, then - // key-frame insertion is disabled; and if kmax == 1, - // then all frames will be key-frames (kmin value does - // not matter for these special cases). - int allow_mixed; // If true, use mixed compression mode; may choose - // either lossy and lossless for each frame. - int verbose; // If true, print info and warning messages to stderr. - - uint32_t padding[4]; // Padding for later use. -}; - -// Internal, version-checked, entry point. -WEBP_EXTERN int WebPAnimEncoderOptionsInitInternal( - WebPAnimEncoderOptions*, int); - -// Should always be called, to initialize a fresh WebPAnimEncoderOptions -// structure before modification. Returns false in case of version mismatch. -// WebPAnimEncoderOptionsInit() must have succeeded before using the -// 'enc_options' object. -static WEBP_INLINE int WebPAnimEncoderOptionsInit( - WebPAnimEncoderOptions* enc_options) { - return WebPAnimEncoderOptionsInitInternal(enc_options, WEBP_MUX_ABI_VERSION); -} - -// Internal, version-checked, entry point. -WEBP_EXTERN WebPAnimEncoder* WebPAnimEncoderNewInternal( - int, int, const WebPAnimEncoderOptions*, int); - -// Creates and initializes a WebPAnimEncoder object. -// Parameters: -// width/height - (in) canvas width and height of the animation. -// enc_options - (in) encoding options; can be passed NULL to pick -// reasonable defaults. -// Returns: -// A pointer to the newly created WebPAnimEncoder object. -// Or NULL in case of memory error. -static WEBP_INLINE WebPAnimEncoder* WebPAnimEncoderNew( - int width, int height, const WebPAnimEncoderOptions* enc_options) { - return WebPAnimEncoderNewInternal(width, height, enc_options, - WEBP_MUX_ABI_VERSION); -} - -// Optimize the given frame for WebP, encode it and add it to the -// WebPAnimEncoder object. -// The last call to 'WebPAnimEncoderAdd' should be with frame = NULL, which -// indicates that no more frames are to be added. This call is also used to -// determine the duration of the last frame. -// Parameters: -// enc - (in/out) object to which the frame is to be added. -// frame - (in/out) frame data in ARGB or YUV(A) format. If it is in YUV(A) -// format, it will be converted to ARGB, which incurs a small loss. -// timestamp_ms - (in) timestamp of this frame in milliseconds. -// Duration of a frame would be calculated as -// "timestamp of next frame - timestamp of this frame". -// Hence, timestamps should be in non-decreasing order. -// config - (in) encoding options; can be passed NULL to pick -// reasonable defaults. -// Returns: -// On error, returns false and frame->error_code is set appropriately. -// Otherwise, returns true. -WEBP_EXTERN int WebPAnimEncoderAdd( - WebPAnimEncoder* enc, struct WebPPicture* frame, int timestamp_ms, - const struct WebPConfig* config); - -// Assemble all frames added so far into a WebP bitstream. -// This call should be preceded by a call to 'WebPAnimEncoderAdd' with -// frame = NULL; if not, the duration of the last frame will be internally -// estimated. -// Parameters: -// enc - (in/out) object from which the frames are to be assembled. -// webp_data - (out) generated WebP bitstream. -// Returns: -// True on success. -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 -// WebPAnimEncoderAdd() or WebPAnimEncoderAssemble() or WebPAnimEncoderDelete(). -// Parameters: -// enc - (in/out) object from which the error string is to be fetched. -// 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); - -// Deletes the WebPAnimEncoder object. -// Parameters: -// enc - (in/out) object to be deleted -WEBP_EXTERN void WebPAnimEncoderDelete(WebPAnimEncoder* enc); - -//------------------------------------------------------------------------------ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_WEBP_MUX_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux_types.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux_types.h deleted file mode 100644 index ceea77d..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/mux_types.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2012 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. -// ----------------------------------------------------------------------------- -// -// Data-types common to the mux and demux libraries. -// -// Author: Urvang (urvang@google.com) - -#ifndef WEBP_WEBP_MUX_TYPES_H_ -#define WEBP_WEBP_MUX_TYPES_H_ - -#include // free() -#include // memset() -#include "./types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Note: forward declaring enumerations is not allowed in (strict) C and C++, -// the types are left here for reference. -// typedef enum WebPFeatureFlags WebPFeatureFlags; -// typedef enum WebPMuxAnimDispose WebPMuxAnimDispose; -// typedef enum WebPMuxAnimBlend WebPMuxAnimBlend; -typedef struct WebPData WebPData; - -// VP8X Feature Flags. -typedef enum WebPFeatureFlags { - ANIMATION_FLAG = 0x00000002, - XMP_FLAG = 0x00000004, - EXIF_FLAG = 0x00000008, - ALPHA_FLAG = 0x00000010, - ICCP_FLAG = 0x00000020, - - ALL_VALID_FLAGS = 0x0000003e -} WebPFeatureFlags; - -// Dispose method (animation only). Indicates how the area used by the current -// frame is to be treated before rendering the next frame on the canvas. -typedef enum WebPMuxAnimDispose { - WEBP_MUX_DISPOSE_NONE, // Do not dispose. - WEBP_MUX_DISPOSE_BACKGROUND // Dispose to background color. -} WebPMuxAnimDispose; - -// Blend operation (animation only). Indicates how transparent pixels of the -// current frame are blended with those of the previous canvas. -typedef enum WebPMuxAnimBlend { - WEBP_MUX_BLEND, // Blend. - WEBP_MUX_NO_BLEND // Do not blend. -} WebPMuxAnimBlend; - -// Data type used to describe 'raw' data, e.g., chunk data -// (ICC profile, metadata) and WebP compressed image data. -struct WebPData { - const uint8_t* bytes; - size_t size; -}; - -// Initializes the contents of the 'webp_data' object with default values. -static WEBP_INLINE void WebPDataInit(WebPData* webp_data) { - if (webp_data != NULL) { - memset(webp_data, 0, sizeof(*webp_data)); - } -} - -// Clears the contents of the 'webp_data' object by calling free(). Does not -// deallocate the object itself. -static WEBP_INLINE void WebPDataClear(WebPData* webp_data) { - if (webp_data != NULL) { - free((void*)webp_data->bytes); - WebPDataInit(webp_data); - } -} - -// Allocates necessary storage for 'dst' and copies the contents of 'src'. -// Returns true on success. -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); - if (dst->bytes == NULL) return 0; - memcpy((void*)dst->bytes, src->bytes, src->size); - dst->size = src->size; - } - return 1; -} - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WEBP_WEBP_MUX_TYPES_H_ diff --git a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/types.h b/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/types.h deleted file mode 100644 index 0ce2622..0000000 --- a/UniMPSDK/Core/Headers/SDWebImage/webp/src/webp/types.h +++ /dev/null @@ -1,52 +0,0 @@ -// 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 -// -// 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)) - -#endif // WEBP_WEBP_TYPES_H_ diff --git a/UniMPSDK/Core/Libs/libSDWebImage.a b/UniMPSDK/Core/Libs/libSDWebImage.a deleted file mode 100644 index 2c456dd..0000000 --- a/UniMPSDK/Core/Libs/libSDWebImage.a +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b4ee4bc126edd731f84118732dd5c8480ce2b4a780307118a66c47795f42e7d2 -size 12045736 diff --git a/unimp.podspec b/unimp.podspec index 33824ef..cd41187 100644 --- a/unimp.podspec +++ b/unimp.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "unimp" - s.version = "3.99" + s.version = "3.991" s.summary = "UniMPSDK" s.homepage = "https://gitcode.net/dcloud/unimpsdk-ios" s.license = { :type => 'MIT', :file => 'LICENSE' } @@ -28,7 +28,7 @@ Pod::Spec.new do |s| ss.vendored_libraries = 'UniMPSDK/Core/Libs/*.{a}' ss.vendored_frameworks = 'UniMPSDK/Core/Libs/*.{framework}' ss.resources = 'UniMPSDK/Core/Resources/*' - # ss.dependency 'SDWebImage','5.10.0' + ss.dependency 'SDWebImage','5.10.0' ss.libraries = 'c++','iconv' end -- GitLab