@cpp.js/package-webp 1.0.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/cppjs.config.js +12 -11
  2. package/package.json +8 -12
  3. package/dist/prebuilt/Android-arm64-v8a/include/webp/decode.h +0 -506
  4. package/dist/prebuilt/Android-arm64-v8a/include/webp/demux.h +0 -367
  5. package/dist/prebuilt/Android-arm64-v8a/include/webp/encode.h +0 -558
  6. package/dist/prebuilt/Android-arm64-v8a/include/webp/mux.h +0 -591
  7. package/dist/prebuilt/Android-arm64-v8a/include/webp/mux_types.h +0 -99
  8. package/dist/prebuilt/Android-arm64-v8a/include/webp/sharpyuv/sharpyuv.h +0 -181
  9. package/dist/prebuilt/Android-arm64-v8a/include/webp/sharpyuv/sharpyuv_csp.h +0 -65
  10. package/dist/prebuilt/Android-arm64-v8a/include/webp/types.h +0 -93
  11. package/dist/prebuilt/Android-arm64-v8a/lib/libsharpyuv.la +0 -41
  12. package/dist/prebuilt/Android-arm64-v8a/lib/libsharpyuv.so +0 -0
  13. package/dist/prebuilt/Android-arm64-v8a/lib/libwebp.la +0 -41
  14. package/dist/prebuilt/Android-arm64-v8a/lib/libwebp.so +0 -0
  15. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpdemux.la +0 -41
  16. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpdemux.so +0 -0
  17. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpmux.la +0 -41
  18. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpmux.so +0 -0
  19. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libsharpyuv.pc +0 -11
  20. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libwebp.pc +0 -12
  21. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libwebpdemux.pc +0 -11
  22. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libwebpmux.pc +0 -12
  23. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/cwebp.1 +0 -339
  24. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/dwebp.1 +0 -157
  25. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/img2webp.1 +0 -133
  26. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/webpinfo.1 +0 -87
  27. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/webpmux.1 +0 -278
  28. package/dist/prebuilt/Android-x86_64/include/webp/decode.h +0 -506
  29. package/dist/prebuilt/Android-x86_64/include/webp/demux.h +0 -367
  30. package/dist/prebuilt/Android-x86_64/include/webp/encode.h +0 -558
  31. package/dist/prebuilt/Android-x86_64/include/webp/mux.h +0 -591
  32. package/dist/prebuilt/Android-x86_64/include/webp/mux_types.h +0 -99
  33. package/dist/prebuilt/Android-x86_64/include/webp/sharpyuv/sharpyuv.h +0 -181
  34. package/dist/prebuilt/Android-x86_64/include/webp/sharpyuv/sharpyuv_csp.h +0 -65
  35. package/dist/prebuilt/Android-x86_64/include/webp/types.h +0 -93
  36. package/dist/prebuilt/Android-x86_64/lib/libsharpyuv.la +0 -41
  37. package/dist/prebuilt/Android-x86_64/lib/libsharpyuv.so +0 -0
  38. package/dist/prebuilt/Android-x86_64/lib/libwebp.la +0 -41
  39. package/dist/prebuilt/Android-x86_64/lib/libwebp.so +0 -0
  40. package/dist/prebuilt/Android-x86_64/lib/libwebpdemux.la +0 -41
  41. package/dist/prebuilt/Android-x86_64/lib/libwebpdemux.so +0 -0
  42. package/dist/prebuilt/Android-x86_64/lib/libwebpmux.la +0 -41
  43. package/dist/prebuilt/Android-x86_64/lib/libwebpmux.so +0 -0
  44. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libsharpyuv.pc +0 -11
  45. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libwebp.pc +0 -12
  46. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libwebpdemux.pc +0 -11
  47. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libwebpmux.pc +0 -12
  48. package/dist/prebuilt/Android-x86_64/share/man/man1/cwebp.1 +0 -339
  49. package/dist/prebuilt/Android-x86_64/share/man/man1/dwebp.1 +0 -157
  50. package/dist/prebuilt/Android-x86_64/share/man/man1/img2webp.1 +0 -133
  51. package/dist/prebuilt/Android-x86_64/share/man/man1/webpinfo.1 +0 -87
  52. package/dist/prebuilt/Android-x86_64/share/man/man1/webpmux.1 +0 -278
  53. package/dist/prebuilt/CMakeLists.txt +0 -44
  54. package/dist/prebuilt/Emscripten-x86_64/include/webp/decode.h +0 -506
  55. package/dist/prebuilt/Emscripten-x86_64/include/webp/demux.h +0 -367
  56. package/dist/prebuilt/Emscripten-x86_64/include/webp/encode.h +0 -558
  57. package/dist/prebuilt/Emscripten-x86_64/include/webp/mux.h +0 -591
  58. package/dist/prebuilt/Emscripten-x86_64/include/webp/mux_types.h +0 -99
  59. package/dist/prebuilt/Emscripten-x86_64/include/webp/sharpyuv/sharpyuv.h +0 -181
  60. package/dist/prebuilt/Emscripten-x86_64/include/webp/sharpyuv/sharpyuv_csp.h +0 -65
  61. package/dist/prebuilt/Emscripten-x86_64/include/webp/types.h +0 -93
  62. package/dist/prebuilt/Emscripten-x86_64/lib/libsharpyuv.a +0 -0
  63. package/dist/prebuilt/Emscripten-x86_64/lib/libsharpyuv.la +0 -41
  64. package/dist/prebuilt/Emscripten-x86_64/lib/libwebp.a +0 -0
  65. package/dist/prebuilt/Emscripten-x86_64/lib/libwebp.la +0 -41
  66. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpdemux.a +0 -0
  67. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpdemux.la +0 -41
  68. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpmux.a +0 -0
  69. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpmux.la +0 -41
  70. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libsharpyuv.pc +0 -11
  71. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libwebp.pc +0 -12
  72. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libwebpdemux.pc +0 -11
  73. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libwebpmux.pc +0 -12
  74. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/cwebp.1 +0 -339
  75. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/dwebp.1 +0 -157
  76. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/img2webp.1 +0 -133
  77. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/webpinfo.1 +0 -87
  78. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/webpmux.1 +0 -278
  79. package/dist/prebuilt/iOS-iphoneos/include/webp/decode.h +0 -506
  80. package/dist/prebuilt/iOS-iphoneos/include/webp/demux.h +0 -367
  81. package/dist/prebuilt/iOS-iphoneos/include/webp/encode.h +0 -558
  82. package/dist/prebuilt/iOS-iphoneos/include/webp/mux.h +0 -591
  83. package/dist/prebuilt/iOS-iphoneos/include/webp/mux_types.h +0 -99
  84. package/dist/prebuilt/iOS-iphoneos/include/webp/sharpyuv/sharpyuv.h +0 -181
  85. package/dist/prebuilt/iOS-iphoneos/include/webp/sharpyuv/sharpyuv_csp.h +0 -65
  86. package/dist/prebuilt/iOS-iphoneos/include/webp/types.h +0 -93
  87. package/dist/prebuilt/iOS-iphoneos/lib/libsharpyuv.a +0 -0
  88. package/dist/prebuilt/iOS-iphoneos/lib/libsharpyuv.la +0 -41
  89. package/dist/prebuilt/iOS-iphoneos/lib/libwebp.a +0 -0
  90. package/dist/prebuilt/iOS-iphoneos/lib/libwebp.la +0 -41
  91. package/dist/prebuilt/iOS-iphoneos/lib/libwebpdemux.a +0 -0
  92. package/dist/prebuilt/iOS-iphoneos/lib/libwebpdemux.la +0 -41
  93. package/dist/prebuilt/iOS-iphoneos/lib/libwebpmux.a +0 -0
  94. package/dist/prebuilt/iOS-iphoneos/lib/libwebpmux.la +0 -41
  95. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libsharpyuv.pc +0 -11
  96. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libwebp.pc +0 -12
  97. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libwebpdemux.pc +0 -11
  98. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libwebpmux.pc +0 -12
  99. package/dist/prebuilt/iOS-iphoneos/share/man/man1/cwebp.1 +0 -339
  100. package/dist/prebuilt/iOS-iphoneos/share/man/man1/dwebp.1 +0 -157
  101. package/dist/prebuilt/iOS-iphoneos/share/man/man1/img2webp.1 +0 -133
  102. package/dist/prebuilt/iOS-iphoneos/share/man/man1/webpinfo.1 +0 -87
  103. package/dist/prebuilt/iOS-iphoneos/share/man/man1/webpmux.1 +0 -278
  104. package/dist/prebuilt/iOS-iphonesimulator/include/webp/decode.h +0 -506
  105. package/dist/prebuilt/iOS-iphonesimulator/include/webp/demux.h +0 -367
  106. package/dist/prebuilt/iOS-iphonesimulator/include/webp/encode.h +0 -558
  107. package/dist/prebuilt/iOS-iphonesimulator/include/webp/mux.h +0 -591
  108. package/dist/prebuilt/iOS-iphonesimulator/include/webp/mux_types.h +0 -99
  109. package/dist/prebuilt/iOS-iphonesimulator/include/webp/sharpyuv/sharpyuv.h +0 -181
  110. package/dist/prebuilt/iOS-iphonesimulator/include/webp/sharpyuv/sharpyuv_csp.h +0 -65
  111. package/dist/prebuilt/iOS-iphonesimulator/include/webp/types.h +0 -93
  112. package/dist/prebuilt/iOS-iphonesimulator/lib/libsharpyuv.a +0 -0
  113. package/dist/prebuilt/iOS-iphonesimulator/lib/libsharpyuv.la +0 -41
  114. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebp.a +0 -0
  115. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebp.la +0 -41
  116. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpdemux.a +0 -0
  117. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpdemux.la +0 -41
  118. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpmux.a +0 -0
  119. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpmux.la +0 -41
  120. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libsharpyuv.pc +0 -11
  121. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libwebp.pc +0 -12
  122. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libwebpdemux.pc +0 -11
  123. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libwebpmux.pc +0 -12
  124. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/cwebp.1 +0 -339
  125. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/dwebp.1 +0 -157
  126. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/img2webp.1 +0 -133
  127. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/webpinfo.1 +0 -87
  128. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/webpmux.1 +0 -278
  129. package/sharpyuv.xcframework/Info.plist +0 -50
  130. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/decode.h +0 -506
  131. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/demux.h +0 -367
  132. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/encode.h +0 -558
  133. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/mux.h +0 -591
  134. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/mux_types.h +0 -99
  135. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv.h +0 -181
  136. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -65
  137. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/types.h +0 -93
  138. package/sharpyuv.xcframework/ios-arm64_arm64e/libsharpyuv.a +0 -0
  139. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/decode.h +0 -506
  140. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/demux.h +0 -367
  141. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/encode.h +0 -558
  142. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux.h +0 -591
  143. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux_types.h +0 -99
  144. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv.h +0 -181
  145. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -65
  146. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/types.h +0 -93
  147. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/libsharpyuv.a +0 -0
  148. package/webp.xcframework/Info.plist +0 -50
  149. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/decode.h +0 -506
  150. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/demux.h +0 -367
  151. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/encode.h +0 -558
  152. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/mux.h +0 -591
  153. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/mux_types.h +0 -99
  154. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv.h +0 -181
  155. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -65
  156. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/types.h +0 -93
  157. package/webp.xcframework/ios-arm64_arm64e/libwebp.a +0 -0
  158. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/decode.h +0 -506
  159. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/demux.h +0 -367
  160. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/encode.h +0 -558
  161. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux.h +0 -591
  162. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux_types.h +0 -99
  163. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv.h +0 -181
  164. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -65
  165. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/types.h +0 -93
  166. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/libwebp.a +0 -0
@@ -1,99 +0,0 @@
1
- // Copyright 2012 Google Inc. All Rights Reserved.
2
- //
3
- // Use of this source code is governed by a BSD-style license
4
- // that can be found in the COPYING file in the root of the source
5
- // tree. An additional intellectual property rights grant can be found
6
- // in the file PATENTS. All contributing project authors may
7
- // be found in the AUTHORS file in the root of the source tree.
8
- // -----------------------------------------------------------------------------
9
- //
10
- // Data-types common to the mux and demux libraries.
11
- //
12
- // Author: Urvang (urvang@google.com)
13
-
14
- #ifndef WEBP_WEBP_MUX_TYPES_H_
15
- #define WEBP_WEBP_MUX_TYPES_H_
16
-
17
- #include <string.h> // memset()
18
- #include "./types.h"
19
-
20
- #ifdef __cplusplus
21
- extern "C" {
22
- #endif
23
-
24
- // Note: forward declaring enumerations is not allowed in (strict) C and C++,
25
- // the types are left here for reference.
26
- // typedef enum WebPFeatureFlags WebPFeatureFlags;
27
- // typedef enum WebPMuxAnimDispose WebPMuxAnimDispose;
28
- // typedef enum WebPMuxAnimBlend WebPMuxAnimBlend;
29
- typedef struct WebPData WebPData;
30
-
31
- // VP8X Feature Flags.
32
- typedef enum WebPFeatureFlags {
33
- ANIMATION_FLAG = 0x00000002,
34
- XMP_FLAG = 0x00000004,
35
- EXIF_FLAG = 0x00000008,
36
- ALPHA_FLAG = 0x00000010,
37
- ICCP_FLAG = 0x00000020,
38
-
39
- ALL_VALID_FLAGS = 0x0000003e
40
- } WebPFeatureFlags;
41
-
42
- // Dispose method (animation only). Indicates how the area used by the current
43
- // frame is to be treated before rendering the next frame on the canvas.
44
- typedef enum WebPMuxAnimDispose {
45
- WEBP_MUX_DISPOSE_NONE, // Do not dispose.
46
- WEBP_MUX_DISPOSE_BACKGROUND // Dispose to background color.
47
- } WebPMuxAnimDispose;
48
-
49
- // Blend operation (animation only). Indicates how transparent pixels of the
50
- // current frame are blended with those of the previous canvas.
51
- typedef enum WebPMuxAnimBlend {
52
- WEBP_MUX_BLEND, // Blend.
53
- WEBP_MUX_NO_BLEND // Do not blend.
54
- } WebPMuxAnimBlend;
55
-
56
- // Data type used to describe 'raw' data, e.g., chunk data
57
- // (ICC profile, metadata) and WebP compressed image data.
58
- // 'bytes' memory must be allocated using WebPMalloc() and such.
59
- struct WebPData {
60
- const uint8_t* bytes;
61
- size_t size;
62
- };
63
-
64
- // Initializes the contents of the 'webp_data' object with default values.
65
- static WEBP_INLINE void WebPDataInit(WebPData* webp_data) {
66
- if (webp_data != NULL) {
67
- memset(webp_data, 0, sizeof(*webp_data));
68
- }
69
- }
70
-
71
- // Clears the contents of the 'webp_data' object by calling WebPFree().
72
- // Does not deallocate the object itself.
73
- static WEBP_INLINE void WebPDataClear(WebPData* webp_data) {
74
- if (webp_data != NULL) {
75
- WebPFree((void*)webp_data->bytes);
76
- WebPDataInit(webp_data);
77
- }
78
- }
79
-
80
- // Allocates necessary storage for 'dst' and copies the contents of 'src'.
81
- // Returns true on success.
82
- WEBP_NODISCARD static WEBP_INLINE int WebPDataCopy(const WebPData* src,
83
- WebPData* dst) {
84
- if (src == NULL || dst == NULL) return 0;
85
- WebPDataInit(dst);
86
- if (src->bytes != NULL && src->size != 0) {
87
- dst->bytes = (uint8_t*)WebPMalloc(src->size);
88
- if (dst->bytes == NULL) return 0;
89
- memcpy((void*)dst->bytes, src->bytes, src->size);
90
- dst->size = src->size;
91
- }
92
- return 1;
93
- }
94
-
95
- #ifdef __cplusplus
96
- } // extern "C"
97
- #endif
98
-
99
- #endif // WEBP_WEBP_MUX_TYPES_H_
@@ -1,181 +0,0 @@
1
- // Copyright 2022 Google Inc. All Rights Reserved.
2
- //
3
- // Use of this source code is governed by a BSD-style license
4
- // that can be found in the COPYING file in the root of the source
5
- // tree. An additional intellectual property rights grant can be found
6
- // in the file PATENTS. All contributing project authors may
7
- // be found in the AUTHORS file in the root of the source tree.
8
- // -----------------------------------------------------------------------------
9
- //
10
- // Sharp RGB to YUV conversion.
11
-
12
- #ifndef WEBP_SHARPYUV_SHARPYUV_H_
13
- #define WEBP_SHARPYUV_SHARPYUV_H_
14
-
15
- #ifdef __cplusplus
16
- extern "C" {
17
- #endif
18
-
19
- #ifndef SHARPYUV_EXTERN
20
- #ifdef WEBP_EXTERN
21
- #define SHARPYUV_EXTERN WEBP_EXTERN
22
- #else
23
- // This explicitly marks library functions and allows for changing the
24
- // signature for e.g., Windows DLL builds.
25
- #if defined(_WIN32) && defined(WEBP_DLL)
26
- #define SHARPYUV_EXTERN __declspec(dllexport)
27
- #elif defined(__GNUC__) && __GNUC__ >= 4
28
- #define SHARPYUV_EXTERN extern __attribute__((visibility("default")))
29
- #else
30
- #define SHARPYUV_EXTERN extern
31
- #endif /* defined(_WIN32) && defined(WEBP_DLL) */
32
- #endif /* WEBP_EXTERN */
33
- #endif /* SHARPYUV_EXTERN */
34
-
35
- #ifndef SHARPYUV_INLINE
36
- #ifdef WEBP_INLINE
37
- #define SHARPYUV_INLINE WEBP_INLINE
38
- #else
39
- #ifndef _MSC_VER
40
- #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \
41
- (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
42
- #define SHARPYUV_INLINE inline
43
- #else
44
- #define SHARPYUV_INLINE
45
- #endif
46
- #else
47
- #define SHARPYUV_INLINE __forceinline
48
- #endif /* _MSC_VER */
49
- #endif /* WEBP_INLINE */
50
- #endif /* SHARPYUV_INLINE */
51
-
52
- // SharpYUV API version following the convention from semver.org
53
- #define SHARPYUV_VERSION_MAJOR 0
54
- #define SHARPYUV_VERSION_MINOR 4
55
- #define SHARPYUV_VERSION_PATCH 1
56
- // Version as a uint32_t. The major number is the high 8 bits.
57
- // The minor number is the middle 8 bits. The patch number is the low 16 bits.
58
- #define SHARPYUV_MAKE_VERSION(MAJOR, MINOR, PATCH) \
59
- (((MAJOR) << 24) | ((MINOR) << 16) | (PATCH))
60
- #define SHARPYUV_VERSION \
61
- SHARPYUV_MAKE_VERSION(SHARPYUV_VERSION_MAJOR, SHARPYUV_VERSION_MINOR, \
62
- SHARPYUV_VERSION_PATCH)
63
-
64
- // Returns the library's version number, packed in hexadecimal. See
65
- // SHARPYUV_VERSION.
66
- SHARPYUV_EXTERN int SharpYuvGetVersion(void);
67
-
68
- // RGB to YUV conversion matrix, in 16 bit fixed point.
69
- // y_ = rgb_to_y[0] * r + rgb_to_y[1] * g + rgb_to_y[2] * b + rgb_to_y[3]
70
- // u_ = rgb_to_u[0] * r + rgb_to_u[1] * g + rgb_to_u[2] * b + rgb_to_u[3]
71
- // v_ = rgb_to_v[0] * r + rgb_to_v[1] * g + rgb_to_v[2] * b + rgb_to_v[3]
72
- // Then the values are divided by 1<<16 and rounded.
73
- // y = (y_ + (1 << 15)) >> 16
74
- // u = (u_ + (1 << 15)) >> 16
75
- // v = (v_ + (1 << 15)) >> 16
76
- //
77
- // Typically, the offset values rgb_to_y[3], rgb_to_u[3] and rgb_to_v[3] depend
78
- // on the input's bit depth, e.g., rgb_to_u[3] = 1 << (rgb_bit_depth - 1 + 16).
79
- // See also sharpyuv_csp.h to get a predefined matrix or generate a matrix.
80
- typedef struct {
81
- int rgb_to_y[4];
82
- int rgb_to_u[4];
83
- int rgb_to_v[4];
84
- } SharpYuvConversionMatrix;
85
-
86
- typedef struct SharpYuvOptions SharpYuvOptions;
87
-
88
- // Enums for transfer functions, as defined in H.273,
89
- // https://www.itu.int/rec/T-REC-H.273-202107-I/en
90
- typedef enum SharpYuvTransferFunctionType {
91
- // 0 is reserved
92
- kSharpYuvTransferFunctionBt709 = 1,
93
- // 2 is unspecified
94
- // 3 is reserved
95
- kSharpYuvTransferFunctionBt470M = 4,
96
- kSharpYuvTransferFunctionBt470Bg = 5,
97
- kSharpYuvTransferFunctionBt601 = 6,
98
- kSharpYuvTransferFunctionSmpte240 = 7,
99
- kSharpYuvTransferFunctionLinear = 8,
100
- kSharpYuvTransferFunctionLog100 = 9,
101
- kSharpYuvTransferFunctionLog100_Sqrt10 = 10,
102
- kSharpYuvTransferFunctionIec61966 = 11,
103
- kSharpYuvTransferFunctionBt1361 = 12,
104
- kSharpYuvTransferFunctionSrgb = 13,
105
- kSharpYuvTransferFunctionBt2020_10Bit = 14,
106
- kSharpYuvTransferFunctionBt2020_12Bit = 15,
107
- kSharpYuvTransferFunctionSmpte2084 = 16, // PQ
108
- kSharpYuvTransferFunctionSmpte428 = 17,
109
- kSharpYuvTransferFunctionHlg = 18,
110
- kSharpYuvTransferFunctionNum
111
- } SharpYuvTransferFunctionType;
112
-
113
- // Converts RGB to YUV420 using a downsampling algorithm that minimizes
114
- // artefacts caused by chroma subsampling.
115
- // This is slower than standard downsampling (averaging of 4 UV values).
116
- // Assumes that the image will be upsampled using a bilinear filter. If nearest
117
- // neighbor is used instead, the upsampled image might look worse than with
118
- // standard downsampling.
119
- // r_ptr, g_ptr, b_ptr: pointers to the source r, g and b channels. Should point
120
- // to uint8_t buffers if rgb_bit_depth is 8, or uint16_t buffers otherwise.
121
- // rgb_step: distance in bytes between two horizontally adjacent pixels on the
122
- // r, g and b channels. If rgb_bit_depth is > 8, it should be a
123
- // multiple of 2.
124
- // rgb_stride: distance in bytes between two vertically adjacent pixels on the
125
- // r, g, and b channels. If rgb_bit_depth is > 8, it should be a
126
- // multiple of 2.
127
- // rgb_bit_depth: number of bits for each r/g/b value. One of: 8, 10, 12, 16.
128
- // Note: 16 bit input is truncated to 14 bits before conversion to yuv.
129
- // yuv_bit_depth: number of bits for each y/u/v value. One of: 8, 10, 12.
130
- // y_ptr, u_ptr, v_ptr: pointers to the destination y, u and v channels. Should
131
- // point to uint8_t buffers if yuv_bit_depth is 8, or uint16_t buffers
132
- // otherwise.
133
- // y_stride, u_stride, v_stride: distance in bytes between two vertically
134
- // adjacent pixels on the y, u and v channels. If yuv_bit_depth > 8, they
135
- // should be multiples of 2.
136
- // width, height: width and height of the image in pixels
137
- // yuv_matrix: RGB to YUV conversion matrix. The matrix values typically
138
- // depend on the input's rgb_bit_depth.
139
- // This function calls SharpYuvConvertWithOptions with a default transfer
140
- // function of kSharpYuvTransferFunctionSrgb.
141
- SHARPYUV_EXTERN int SharpYuvConvert(const void* r_ptr, const void* g_ptr,
142
- const void* b_ptr, int rgb_step,
143
- int rgb_stride, int rgb_bit_depth,
144
- void* y_ptr, int y_stride, void* u_ptr,
145
- int u_stride, void* v_ptr, int v_stride,
146
- int yuv_bit_depth, int width, int height,
147
- const SharpYuvConversionMatrix* yuv_matrix);
148
-
149
- struct SharpYuvOptions {
150
- // This matrix cannot be NULL and can be initialized by
151
- // SharpYuvComputeConversionMatrix.
152
- const SharpYuvConversionMatrix* yuv_matrix;
153
- SharpYuvTransferFunctionType transfer_type;
154
- };
155
-
156
- // Internal, version-checked, entry point
157
- SHARPYUV_EXTERN int SharpYuvOptionsInitInternal(const SharpYuvConversionMatrix*,
158
- SharpYuvOptions*, int);
159
-
160
- // Should always be called, to initialize a fresh SharpYuvOptions
161
- // structure before modification. SharpYuvOptionsInit() must have succeeded
162
- // before using the 'options' object.
163
- static SHARPYUV_INLINE int SharpYuvOptionsInit(
164
- const SharpYuvConversionMatrix* yuv_matrix, SharpYuvOptions* options) {
165
- return SharpYuvOptionsInitInternal(yuv_matrix, options, SHARPYUV_VERSION);
166
- }
167
-
168
- SHARPYUV_EXTERN int SharpYuvConvertWithOptions(
169
- const void* r_ptr, const void* g_ptr, const void* b_ptr, int rgb_step,
170
- int rgb_stride, int rgb_bit_depth, void* y_ptr, int y_stride, void* u_ptr,
171
- int u_stride, void* v_ptr, int v_stride, int yuv_bit_depth, int width,
172
- int height, const SharpYuvOptions* options);
173
-
174
- // TODO(b/194336375): Add YUV444 to YUV420 conversion. Maybe also add 422
175
- // support (it's rarely used in practice, especially for images).
176
-
177
- #ifdef __cplusplus
178
- } // extern "C"
179
- #endif
180
-
181
- #endif // WEBP_SHARPYUV_SHARPYUV_H_
@@ -1,65 +0,0 @@
1
- // Copyright 2022 Google Inc. All Rights Reserved.
2
- //
3
- // Use of this source code is governed by a BSD-style license
4
- // that can be found in the COPYING file in the root of the source
5
- // tree. An additional intellectual property rights grant can be found
6
- // in the file PATENTS. All contributing project authors may
7
- // be found in the AUTHORS file in the root of the source tree.
8
- // -----------------------------------------------------------------------------
9
- //
10
- // Colorspace utilities.
11
-
12
- #ifndef WEBP_SHARPYUV_SHARPYUV_CSP_H_
13
- #define WEBP_SHARPYUV_SHARPYUV_CSP_H_
14
-
15
- #include "sharpyuv/sharpyuv.h"
16
-
17
- #ifdef __cplusplus
18
- extern "C" {
19
- #endif
20
-
21
- // Range of YUV values.
22
- typedef enum {
23
- kSharpYuvRangeFull, // YUV values between [0;255] (for 8 bit)
24
- kSharpYuvRangeLimited // Y in [16;235], YUV in [16;240] (for 8 bit)
25
- } SharpYuvRange;
26
-
27
- // Constants that define a YUV color space.
28
- typedef struct {
29
- // Kr and Kb are defined such that:
30
- // Y = Kr * r + Kg * g + Kb * b where Kg = 1 - Kr - Kb.
31
- float kr;
32
- float kb;
33
- int bit_depth; // 8, 10 or 12
34
- SharpYuvRange range;
35
- } SharpYuvColorSpace;
36
-
37
- // Fills in 'matrix' for the given YUVColorSpace.
38
- SHARPYUV_EXTERN void SharpYuvComputeConversionMatrix(
39
- const SharpYuvColorSpace* yuv_color_space,
40
- SharpYuvConversionMatrix* matrix);
41
-
42
- // Enums for precomputed conversion matrices.
43
- typedef enum {
44
- // WebP's matrix, similar but not identical to kSharpYuvMatrixRec601Limited
45
- kSharpYuvMatrixWebp = 0,
46
- // Kr=0.2990f Kb=0.1140f bit_depth=8 range=kSharpYuvRangeLimited
47
- kSharpYuvMatrixRec601Limited,
48
- // Kr=0.2990f Kb=0.1140f bit_depth=8 range=kSharpYuvRangeFull
49
- kSharpYuvMatrixRec601Full,
50
- // Kr=0.2126f Kb=0.0722f bit_depth=8 range=kSharpYuvRangeLimited
51
- kSharpYuvMatrixRec709Limited,
52
- // Kr=0.2126f Kb=0.0722f bit_depth=8 range=kSharpYuvRangeFull
53
- kSharpYuvMatrixRec709Full,
54
- kSharpYuvMatrixNum
55
- } SharpYuvMatrixType;
56
-
57
- // Returns a pointer to a matrix for one of the predefined colorspaces.
58
- SHARPYUV_EXTERN const SharpYuvConversionMatrix* SharpYuvGetConversionMatrix(
59
- SharpYuvMatrixType matrix_type);
60
-
61
- #ifdef __cplusplus
62
- } // extern "C"
63
- #endif
64
-
65
- #endif // WEBP_SHARPYUV_SHARPYUV_CSP_H_
@@ -1,93 +0,0 @@
1
- // Copyright 2010 Google Inc. All Rights Reserved.
2
- //
3
- // Use of this source code is governed by a BSD-style license
4
- // that can be found in the COPYING file in the root of the source
5
- // tree. An additional intellectual property rights grant can be found
6
- // in the file PATENTS. All contributing project authors may
7
- // be found in the AUTHORS file in the root of the source tree.
8
- // -----------------------------------------------------------------------------
9
- //
10
- // Common types + memory wrappers
11
- //
12
- // Author: Skal (pascal.massimino@gmail.com)
13
-
14
- #ifndef WEBP_WEBP_TYPES_H_
15
- #define WEBP_WEBP_TYPES_H_
16
-
17
- #include <stddef.h> // for size_t
18
-
19
- #ifndef _MSC_VER
20
- #include <inttypes.h>
21
- #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \
22
- (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
23
- #define WEBP_INLINE inline
24
- #else
25
- #define WEBP_INLINE
26
- #endif
27
- #else
28
- typedef signed char int8_t;
29
- typedef unsigned char uint8_t;
30
- typedef signed short int16_t;
31
- typedef unsigned short uint16_t;
32
- typedef signed int int32_t;
33
- typedef unsigned int uint32_t;
34
- typedef unsigned long long int uint64_t;
35
- typedef long long int int64_t;
36
- #define WEBP_INLINE __forceinline
37
- #endif /* _MSC_VER */
38
-
39
- #ifndef WEBP_NODISCARD
40
- #if defined(WEBP_ENABLE_NODISCARD) && WEBP_ENABLE_NODISCARD
41
- #if (defined(__cplusplus) && __cplusplus >= 201703L) || \
42
- (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
43
- #define WEBP_NODISCARD [[nodiscard]]
44
- #else
45
- // gcc's __attribute__((warn_unused_result)) does not work for enums.
46
- #if defined(__clang__) && defined(__has_attribute)
47
- #if __has_attribute(warn_unused_result)
48
- #define WEBP_NODISCARD __attribute__((warn_unused_result))
49
- #else
50
- #define WEBP_NODISCARD
51
- #endif /* __has_attribute(warn_unused_result) */
52
- #else
53
- #define WEBP_NODISCARD
54
- #endif /* defined(__clang__) && defined(__has_attribute) */
55
- #endif /* (defined(__cplusplus) && __cplusplus >= 201700L) ||
56
- (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) */
57
- #else
58
- #define WEBP_NODISCARD
59
- #endif /* defined(WEBP_ENABLE_NODISCARD) && WEBP_ENABLE_NODISCARD */
60
- #endif /* WEBP_NODISCARD */
61
-
62
- #ifndef WEBP_EXTERN
63
- // This explicitly marks library functions and allows for changing the
64
- // signature for e.g., Windows DLL builds.
65
- # if defined(_WIN32) && defined(WEBP_DLL)
66
- # define WEBP_EXTERN __declspec(dllexport)
67
- # elif defined(__GNUC__) && __GNUC__ >= 4
68
- # define WEBP_EXTERN extern __attribute__ ((visibility ("default")))
69
- # else
70
- # define WEBP_EXTERN extern
71
- # endif /* defined(_WIN32) && defined(WEBP_DLL) */
72
- #endif /* WEBP_EXTERN */
73
-
74
- // Macro to check ABI compatibility (same major revision number)
75
- #define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8))
76
-
77
- #ifdef __cplusplus
78
- extern "C" {
79
- #endif
80
-
81
- // Allocates 'size' bytes of memory. Returns NULL upon error. Memory
82
- // must be deallocated by calling WebPFree(). This function is made available
83
- // by the core 'libwebp' library.
84
- WEBP_NODISCARD WEBP_EXTERN void* WebPMalloc(size_t size);
85
-
86
- // Releases memory returned by the WebPDecode*() functions (from decode.h).
87
- WEBP_EXTERN void WebPFree(void* ptr);
88
-
89
- #ifdef __cplusplus
90
- } // extern "C"
91
- #endif
92
-
93
- #endif // WEBP_WEBP_TYPES_H_