peachsim 0.1.1692 → 0.1.1700

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 (245) hide show
  1. package/cli/bridge-flow-runner.ts +61 -39
  2. package/cli/commands/agent-wrapper.ts +21 -10
  3. package/cli/commands/control.ts +27 -7
  4. package/cli/commands/coverage.ts +1 -1
  5. package/cli/commands/detect.ts +17 -4
  6. package/cli/commands/maestro-compare.ts +25 -99
  7. package/cli/help-core.ts +3 -4
  8. package/cli/maestro-compare.ts +172 -4
  9. package/cli/outbound-endpoints.ts +2 -10
  10. package/detox/index.ts +15 -0
  11. package/detox/launch-permissions.ts +169 -0
  12. package/dist-lib/agent-daemon-client.cjs +2 -2
  13. package/dist-lib/agent-events.cjs +2 -2
  14. package/dist-lib/attached-projects.cjs +2 -2
  15. package/dist-lib/auth/shared-session.cjs +2 -2
  16. package/dist-lib/backend-origin.cjs +2 -2
  17. package/dist-lib/beta.cjs +2 -2
  18. package/dist-lib/beta.mjs +1 -1
  19. package/dist-lib/bridge-constants.cjs +2 -2
  20. package/dist-lib/bridge-contract-input.cjs +2 -2
  21. package/dist-lib/bridge-contract-input.mjs +1 -1
  22. package/dist-lib/bridge-contract.cjs +2 -2
  23. package/dist-lib/bridge-contract.mjs +1 -1
  24. package/dist-lib/bundle-channel.cjs +18273 -15925
  25. package/dist-lib/capture-contract.cjs +2 -2
  26. package/dist-lib/capture-contract.mjs +1 -1
  27. package/dist-lib/cloud-contract.cjs +2 -2
  28. package/dist-lib/cloud-contract.mjs +1 -1
  29. package/dist-lib/cloud-test-args.cjs +2 -2
  30. package/dist-lib/cloud-test-args.mjs +1 -1
  31. package/dist-lib/cloud.cjs +2 -2
  32. package/dist-lib/cloud.mjs +1 -1
  33. package/dist-lib/config.cjs +2 -2
  34. package/dist-lib/config.mjs +1 -1
  35. package/dist-lib/detox/index.cjs +104 -3
  36. package/dist-lib/dev-bundle-resolution.cjs +208 -44
  37. package/dist-lib/expo-swift-bundle.cjs +2349 -1778
  38. package/dist-lib/expo-swift-metadata.cjs +2 -2
  39. package/dist-lib/expo-swift-metadata.mjs +1 -1
  40. package/dist-lib/home-paths.cjs +2 -2
  41. package/dist-lib/host/bridge-host.cjs +7885 -3334
  42. package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
  43. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  44. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  45. package/dist-lib/host/replacement-module-handler.cjs +2 -2
  46. package/dist-lib/host/websocket-proxy.cjs +2 -2
  47. package/dist-lib/index.cjs +297 -77
  48. package/dist-lib/jump-to-source-babel.cjs +2 -2
  49. package/dist-lib/jump-to-source-native.cjs +2 -2
  50. package/dist-lib/kotlin-host.cjs +2 -2
  51. package/dist-lib/menu.cjs +2 -2
  52. package/dist-lib/menu.mjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  54. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  55. package/dist-lib/metro-production-bundle.cjs +2 -2
  56. package/dist-lib/metro-production-bundle.mjs +1 -1
  57. package/dist-lib/metro.cjs +294 -74
  58. package/dist-lib/native-app-identity-project.cjs +48 -37
  59. package/dist-lib/native-app-identity-project.mjs +47 -36
  60. package/dist-lib/native-app-identity.cjs +2 -2
  61. package/dist-lib/native-app-identity.mjs +1 -1
  62. package/dist-lib/native-firebase-metadata.cjs +2 -2
  63. package/dist-lib/native-firebase-metadata.mjs +1 -1
  64. package/dist-lib/plist.cjs +2 -2
  65. package/dist-lib/plist.mjs +1 -1
  66. package/dist-lib/profiles.cjs +2 -2
  67. package/dist-lib/public-brand.cjs +2 -2
  68. package/dist-lib/public-origins-lib-esm.json +24 -23
  69. package/dist-lib/public-origins-lib.json +199 -79
  70. package/dist-lib/react-native-host-modules.cjs +2 -2
  71. package/dist-lib/react-native-host-modules.mjs +1 -1
  72. package/dist-lib/reap-browser.cjs +2 -2
  73. package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
  74. package/dist-lib/sdk.cjs +2 -2
  75. package/dist-lib/sdk.mjs +1 -1
  76. package/dist-lib/skills.cjs +19600 -15992
  77. package/dist-lib/swift-compile.cjs +640 -402
  78. package/dist-lib/swift-compile.mjs +595 -357
  79. package/dist-lib/swift-package.cjs +24 -20
  80. package/dist-lib/swift-package.mjs +23 -19
  81. package/dist-lib/swift-submit.cjs +2 -2
  82. package/dist-lib/swift-submit.mjs +1 -1
  83. package/dist-lib/swift-toolchain.cjs +31 -4
  84. package/dist-lib/swift.cjs +2 -2
  85. package/dist-lib/vite-swift.cjs +1559 -1208
  86. package/dist-lib/vite.cjs +251 -42
  87. package/dist-lib/worklet-executable.cjs +2 -2
  88. package/dist-lib/worklet-executable.mjs +1 -1
  89. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
  90. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  91. package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
  92. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
  93. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  94. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  95. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
  98. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
  99. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
  100. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
  101. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
  102. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
  103. package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/runtime-companion.json +1 -1
  106. package/scripts/dev-server-scanner.ts +4 -0
  107. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
  108. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
  109. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
  110. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
  111. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
  112. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
  113. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
  114. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
  115. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
  116. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
  117. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
  118. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
  119. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
  120. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
  121. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
  122. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
  123. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
  124. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
  125. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
  126. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
  127. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
  128. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
  129. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
  130. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
  131. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
  132. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
  133. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
  134. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
  135. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
  136. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
  137. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
  138. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
  139. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
  140. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
  141. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
  142. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
  143. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
  144. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
  145. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
  146. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
  147. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
  148. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
  149. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
  150. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
  151. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
  152. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
  153. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
  154. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
  155. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
  156. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
  157. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
  158. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
  159. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
  173. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
  176. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
  177. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
  178. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
  179. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
  180. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
  181. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
  182. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
  183. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
  184. package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
  185. package/sdk/ios/usr/include/copyfile.h +143 -0
  186. package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
  187. package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
  188. package/sdk/ios/usr/include/malloc/_platform.h +80 -0
  189. package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
  190. package/sdk/ios/usr/include/malloc/malloc.h +768 -0
  191. package/sdk/ios/usr/include/os/availability.h +168 -6
  192. package/sdk/ios/usr/include/os/base.h +351 -0
  193. package/sdk/ios/usr/include/os/clock.h +18 -0
  194. package/sdk/ios/usr/include/os/lock.h +232 -10
  195. package/sdk/ios/usr/include/os/log.h +521 -38
  196. package/sdk/ios/usr/include/os/object.h +320 -3
  197. package/sdk/ios/usr/include/os/trace.h +492 -0
  198. package/sdk/ios/usr/include/os/trace_base.h +167 -0
  199. package/sdk/ios/usr/include/os/workgroup.h +37 -0
  200. package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
  201. package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
  202. package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
  203. package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
  204. package/sdk/ios/usr/include/sys/cdefs.h +38 -0
  205. package/sdk/ios/wasm/include/unistd.h +3 -0
  206. package/skills/contrast/SKILL.md +3 -0
  207. package/src/codex-client.ts +11 -6
  208. package/src/dev-bundle-resolution.ts +124 -48
  209. package/src/expo-native-workspace.ts +176 -0
  210. package/src/expo-swift-host.ts +161 -26
  211. package/src/expo-swift-ready.ts +14 -28
  212. package/src/expoSwiftContract.ts +4 -1
  213. package/src/generated/swift-c-predefines.json +68 -12
  214. package/src/host/bridge-host.ts +5 -0
  215. package/src/installed-package-versions.ts +14 -1
  216. package/src/metro-project-root.ts +44 -33
  217. package/src/native-app-identity-project.ts +1 -0
  218. package/src/nitro-adapter.lock.json +916 -10
  219. package/src/nitro-adapter.ts +33 -24
  220. package/src/nitro-bundle.ts +108 -22
  221. package/src/nitro-compile.ts +32 -5
  222. package/src/nitro-source.ts +13 -3
  223. package/src/nitroAdapterContract.ts +100 -20
  224. package/src/node-http-fetch.ts +116 -0
  225. package/src/packageVersionsContract.ts +46 -0
  226. package/src/serverDiscoveryContract.ts +1 -0
  227. package/src/settingsContract.ts +0 -30
  228. package/src/swift-binary-modules.ts +20 -5
  229. package/src/swift-compile.ts +168 -48
  230. package/src/swift-coverage/xcode-assets.ts +4 -3
  231. package/src/swift-host.ts +14 -3
  232. package/src/swift-objc-compile.ts +32 -5
  233. package/src/swift-objc-metadata.ts +2 -2
  234. package/src/swift-objc-platform.ts +2 -2
  235. package/src/swift-objc-standin.ts +43 -13
  236. package/src/swift-package.ts +33 -26
  237. package/src/swift-source-pods.ts +126 -41
  238. package/src/swift-standin-digest.ts +77 -0
  239. package/src/swift-standin-emit.ts +40 -4
  240. package/src/swift-standins.ts +68 -19
  241. package/src/swift-toolchain.ts +38 -0
  242. package/src/swiftContract.ts +8 -0
  243. package/src/vite-plugin.ts +0 -10
  244. package/src/xcode-project.ts +62 -42
  245. package/src/settings-flags.ts +0 -107
@@ -1,3 +1,14 @@
1
+ /*!
2
+ * @header vImage_Types.h
3
+ * vImage_Framework
4
+ *
5
+ * See vImage/vImage.h for more on how to view the headerdoc documentation for types declared herein.
6
+ *
7
+ * @copyright Copyright (c) 2002-2016 by Apple Inc. All rights reserved.
8
+ *
9
+ * @discussion Defines various types and constants common to vImage.
10
+ */
11
+
1
12
  #ifndef VIMAGE_TYPES_H
2
13
  #define VIMAGE_TYPES_H
3
14
 
@@ -12,6 +23,7 @@ extern "C" {
12
23
 
13
24
  #include <TargetConditionals.h>
14
25
 
26
+
15
27
  #if __has_include(<os/availability.h>) && !defined(__linux__) && !0 && !0
16
28
  # include <os/availability.h>
17
29
  #else
@@ -20,27 +32,54 @@ extern "C" {
20
32
  # endif
21
33
 
22
34
  # ifndef API_AVAILABLE
23
- # define API_AVAILABLE(...)
35
+ # define API_AVAILABLE(...) /* nothing */
24
36
  # endif
25
- #endif
37
+ #endif // __has_include(<os/availability.h>)
38
+
39
+ /*!
40
+ * @define __has_attribute
41
+ * @abstract Compiler attribute detection
42
+ * @discussion A macro for testing whether your compiler supports a particular clang attribute.
43
+ * @noParse
44
+ */
26
45
 
27
- #ifndef __has_attribute
46
+ #ifndef __has_attribute /* clang will define this. Other compilers maybe not. */
28
47
  #define __has_attribute(a) 0
29
48
  #endif
30
-
49
+
50
+ /*!
51
+ * @define VIMAGE_NON_NULL
52
+ * @abstract Enumerates which parameters may not be NULL.
53
+ * @discussion Macro to use to decorate API for sanity checking. Many vImage pointer operands may not be NULL.
54
+ * @noParse
55
+ * @ignorefuncmacro VIMAGE_NON_NULL
56
+ */
31
57
  #if __has_attribute(nonnull)
32
58
  # define VIMAGE_NON_NULL(...) __attribute__ ((nonnull(__VA_ARGS__)))
33
59
  #else
34
60
  # define VIMAGE_NON_NULL(...)
35
61
  #endif
36
62
 
37
- #ifndef __has_feature
63
+ /*!
64
+ * @define __has_feature
65
+ * @abstract Compiler feature detection
66
+ * @discussion A macro for testing whether your compiler supports a particular clang feature.
67
+ * @noParse
68
+ */
69
+
70
+ #ifndef __has_feature /* clang will define this. Other compilers maybe not. */
38
71
  # define __has_feature(f) 0
39
72
  #endif
40
- #ifndef __has_extension
73
+ #ifndef __has_extension /* clang will define this. Other compilers maybe not. */
41
74
  # define __has_extension(e) 0
42
75
  #endif
43
76
 
77
+ /*!
78
+ * @define CF_BRIDGED_TYPE
79
+ * @abstract CoreFoundation definition detection and aliasing.
80
+ * @discussion A macro for annotating structs bridging to CoreFoundation types.
81
+ * @noParse
82
+ */
44
83
  #ifndef CF_BRIDGED_TYPE
45
84
  # if __has_feature(objc_bridge_id)
46
85
  # define CF_BRIDGED_TYPE(...) __attribute__((objc_bridge(__VA_ARGS__)))
@@ -48,15 +87,22 @@ extern "C" {
48
87
  # define CF_BRIDGED_TYPE(...)
49
88
  # endif
50
89
  #endif
90
+
51
91
 
52
- #if 0
92
+ /* The C++'11 strongly typed enum feature turns out to be not exactly what we want because it precludes doing things like kvImageLeaveAlphaUnchanged | kvImageCopyInPlace */
93
+ /* We are still exploring options to deliver something better than what we have today for enums. */
94
+ #if 0 /*(__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))*/
53
95
  # define VIMAGE_CHOICE_ENUM( _name, _type) enum _name : _type _name; enum _name : _type
54
96
  # define VIMAGE_OPTIONS_ENUM(_name, _type) enum _name : _type _name; enum _name : _type
55
97
  #else
56
98
  # define VIMAGE_CHOICE_ENUM( _name, _type) _type _name; enum
57
- # define VIMAGE_OPTIONS_ENUM( _name, _type) _type _name; enum
99
+ # define VIMAGE_OPTIONS_ENUM( _name, _type) _type _name; enum
58
100
  #endif
59
101
 
102
+ /*!
103
+ * @availabilitymacro VIMAGE_ENUM_AVAILABLE_STARTING
104
+ */
105
+
60
106
  #if __has_extension(enumerator_attributes)
61
107
  # ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
62
108
  # define VIMAGE_ENUM_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios
@@ -69,46 +115,128 @@ extern "C" {
69
115
  # define VIMAGE_ENUM_AVAILABLE_STARTING( _a, _b )
70
116
  #endif
71
117
 
118
+ /*
119
+ * @vImage function prototype prefix - Currently only set for visibility
120
+ */
121
+
72
122
  #ifndef VIMAGE_PF
73
123
 
74
124
  #define VIMAGE_PF __attribute__ ((visibility ("default")))
75
125
 
76
126
  #endif
77
127
 
78
- typedef unsigned long vImagePixelCount;
128
+ /* Please see vImage.h and vImage documentation for the meaning of these types. */
129
+
130
+ /*!
131
+ @typedef vImagePixelCount
132
+ @discussion A number of pixels. Typically, this is the height or width of an image.
133
+ */
134
+
135
+ typedef unsigned long vImagePixelCount; /* Pedantic: A number of pixels. For LP64 (arm64/x86_64) this is a 64-bit quantity. */
136
+
137
+
138
+ /*!
139
+ @typedef vImage_Buffer
140
+ @field data A pointer to the top left corner of the buffer contain image pixels.
141
+ @field height The number of pixels in a column of the image.
142
+ @field width The number of visible pixels in a row of an image (excluding padding at the ends of rows)
143
+ @field rowBytes The number of bytes from a pixel to the next pixel down in the same column.
144
+ @discussion The vImage_Buffer describes a rectangular region within a regular array of pixels. It may describe
145
+ the entire image, or just a sub rectangle of it. The vImage_Buffer struct is not a complete description
146
+ of an image. Other aspects like pixel format, color space, channel ordering, etc. are generally given
147
+ by the names of functions that operate on the vImage_Buffer or by parameters passed to those functions.
148
+ A vImage_Buffer may contain multiple color channels interleaved with one another, or a single color channel
149
+ (or alpha) as a planar buffer. vImage_Buffers are often initialized directly by you, by setting fields
150
+ to appropriate values to point to image data you already own. Convenience methods are also available as
151
+ vImageBuffer_Init, vImageBuffer_InitWithCGImage and vImageBuffer_InitWithCVPixelBuffer
152
+ */
153
+
79
154
 
80
155
  typedef struct vImage_Buffer
81
156
  {
82
- void *data;
83
- vImagePixelCount height;
84
- vImagePixelCount width;
85
- size_t rowBytes;
157
+ void *data; /* Pointer to the top left pixel of the buffer. */
158
+ vImagePixelCount height; /* The height (in pixels) of the buffer */
159
+ vImagePixelCount width; /* The width (in pixels) of the buffer */
160
+ size_t rowBytes; /* The number of bytes in a pixel row, including any unused space between one row and the next. */
86
161
  }vImage_Buffer;
87
162
 
163
+
164
+
165
+ /*!
166
+ @typedef vImage_AffineTransform
167
+ @field a top left cell in 3x2 transform matrix
168
+ @field b top right cell in 3x2 transform matrix
169
+ @field c middle left cell in 3x2 transform matrix
170
+ @field d middle right cell in 3x2 transform matrix
171
+ @field tx The x coordinate translation
172
+ @field ty The y coordinate translation
173
+ @discussion This 3x2 matrix generally operates the same as the CGAffineTransform, except that the fields
174
+ are all float, not CGFloat. If you are looking for CGAffineTransform compatibility, it is
175
+ recommended that you use vImage_CGAffineTransform and associated APIs instead.
176
+ */
177
+
88
178
  typedef struct vImage_AffineTransform
89
179
  {
90
180
  float a, b, c, d;
91
181
  float tx, ty;
92
182
  }vImage_AffineTransform;
93
183
 
184
+ /*!
185
+ @typedef vImage_AffineTransform_Double
186
+ @field a top left cell in 3x2 transform matrix
187
+ @field b top right cell in 3x2 transform matrix
188
+ @field c middle left cell in 3x2 transform matrix
189
+ @field d middle right cell in 3x2 transform matrix
190
+ @field tx The x coordinate translation
191
+ @field ty The y coordinate translation
192
+ @discussion This 3x2 matrix generally operates the same as the CGAffineTransform, except that the fields
193
+ are all double precision, not CGFloat. If you are looking for CGAffineTransform compatibility, it is
194
+ recommended that you use vImage_CGAffineTransform and associated APIs instead.
195
+ */
196
+
197
+
94
198
  #ifndef VIMAGE_AFFINETRANSFORM_DOUBLE_IS_AVAILABLE
95
- #define VIMAGE_AFFINETRANSFORM_DOUBLE_IS_AVAILABLE 1
96
- typedef struct vImage_AffineTransform_Double
199
+ #define VIMAGE_AFFINETRANSFORM_DOUBLE_IS_AVAILABLE 1 /* defined if vImage_AffineTransform_Double type is available. undefined otherwise */
200
+ typedef struct vImage_AffineTransform_Double
97
201
  {
98
202
  double a, b, c, d;
99
203
  double tx, ty;
100
204
  }vImage_AffineTransform_Double;
101
205
  #endif
102
206
 
103
- #if VIMAGE_AFFINETRANSFORM_DOUBLE_IS_AVAILABLE
207
+ /*!
208
+ @typedef vImage_CGAffineTransform
209
+ @field a top left cell in 3x2 transform matrix
210
+ @field b top right cell in 3x2 transform matrix
211
+ @field c middle left cell in 3x2 transform matrix
212
+ @field d middle right cell in 3x2 transform matrix
213
+ @field tx The x coordinate translation
214
+ @field ty The y coordinate translation
215
+ @discussion This type mirrors the CGAffineTransform type, and may be used interchangeably with it.
216
+ @seealso CGAffineTransform utilities in CoreGraphics/CGAffineTransform.h
217
+ */
218
+ #if VIMAGE_AFFINETRANSFORM_DOUBLE_IS_AVAILABLE /* Interfaces that use this are only available on MacOS X.6 and later */
104
219
  #define VIMAGE_CGAFFINETRANSFORM_IS_AVAILABLE 1
105
220
  #if defined( __LP64__ )
106
221
  typedef vImage_AffineTransform_Double vImage_CGAffineTransform;
107
222
  #else
108
- typedef vImage_AffineTransform vImage_CGAffineTransform;
223
+ typedef vImage_AffineTransform vImage_CGAffineTransform;
109
224
  #endif
110
225
  #endif
111
226
 
227
+ /*!
228
+ @typedef vImage_PerpsectiveTransform
229
+ @abstract Coefficients defining the 3x3 perspective (projective) transform matrix
230
+ @field a top left cell in 3x3 transform matrix
231
+ @field b top middle cell in 3x3 transform matrix
232
+ @field c middle left cell in 3x3 transform matrix
233
+ @field d middle right cell in 3x3 transform matrix
234
+ @field tx The x-coordinate translation
235
+ @field ty The y-coordinate translation
236
+ @field vx The x-component of the projective vector
237
+ @field vy The y-component of the projective vector
238
+ @field v The homogeneous scale factor
239
+ */
112
240
  typedef struct vImage_PerpsectiveTransform
113
241
  {
114
242
  float a, b, c, d;
@@ -116,50 +244,255 @@ typedef struct vImage_PerpsectiveTransform
116
244
  float vx, vy, v;
117
245
  } vImage_PerpsectiveTransform;
118
246
 
247
+ /*!
248
+ @enum vImage_WarpInterpolation
249
+ @abstract Constants for selecting the interpolation mode
250
+ @discussion These constants selects the interpolation mode for certain geometry functions like perspective warp
251
+ @constant kvImageInterpolationNearest Nearest neigborhood
252
+ @constant kvImageInterpolationLinear Linear interpoation
253
+ */
119
254
  typedef VIMAGE_CHOICE_ENUM(vImage_WarpInterpolation, int32_t)
120
255
  {
121
256
  kvImageInterpolationNearest __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0,
122
257
  kvImageInterpolationLinear __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 1,
123
258
  };
124
259
 
125
- typedef uint8_t Pixel_8;
126
-
127
- typedef float Pixel_F;
128
-
129
- typedef uint8_t Pixel_88[2];
130
-
131
- typedef uint8_t Pixel_8888[4];
132
-
133
- typedef float Pixel_FFFF[4];
134
-
135
- typedef uint16_t Pixel_16U;
136
-
137
- typedef int16_t Pixel_16S;
138
-
139
- typedef int16_t Pixel_16Q12;
140
-
141
- typedef uint16_t Pixel_16U16U[2];
142
-
143
- typedef int16_t Pixel_16S16S[2];
144
-
145
- typedef uint32_t Pixel_32U;
146
-
147
- typedef uint16_t Pixel_ARGB_16U[4];
148
-
149
- typedef int16_t Pixel_ARGB_16S[4];
150
-
151
- typedef uint16_t Pixel_16F;
152
-
153
- typedef uint16_t Pixel_16F16F[2];
154
-
155
- typedef uint16_t Pixel_ARGB_16F[4];
156
-
157
- typedef float Pixel_FF[2];
158
-
159
- typedef void* ResamplingFilter;
160
-
161
- typedef void* GammaFunction;
162
260
 
261
+ /*!
262
+ @typedef Pixel_8
263
+ @abstract An 8-bit per component unsigned planar pixel value.
264
+ */
265
+ typedef uint8_t Pixel_8; /* 8 bit planar pixel value */
266
+
267
+ /*!
268
+ @typedef Pixel_F
269
+ @abstract A single precision floating-point planar pixel value.
270
+ @discussion Typically, these have range [0,1] though other values are generally allowed.
271
+ */
272
+ typedef float Pixel_F; /* floating point planar pixel value */
273
+
274
+ /*!
275
+ @typedef Pixel_88
276
+ @abstract A two channel, 8-bit per channel pixel.
277
+ @discussion The channel order is generally given by the function that consumes the value.
278
+ */
279
+ typedef uint8_t Pixel_88[2]; /* CbCr interleaved (8 bit/channel) pixel value. uint8_t[2] = { Cb, Cr } */
280
+
281
+ /*!
282
+ @typedef Pixel_8888
283
+ @abstract A four channel, 8-bit per channel pixel.
284
+ @discussion The channel order is generally given by the function that consumes the value.
285
+ */
286
+ typedef uint8_t Pixel_8888[4]; /* ARGB interleaved (8 bit/channel) pixel value. uint8_t[4] = { alpha, red, green, blue } */
287
+
288
+ /*!
289
+ @typedef Pixel_FFFF
290
+ @abstract A four channel, single precision floating-point per channel pixel.
291
+ @discussion The channel order is generally given by the function that consumes the value.
292
+ */
293
+ typedef float Pixel_FFFF[4]; /* ARGB interleaved (floating point) pixel value. float[4] = { alpha, red, green, blue } */
294
+
295
+ /*!
296
+ @typedef Pixel_16U
297
+ @abstract A 16-bit per channel unsigned pixel.
298
+ @discussion Typical range is [0,USHRT_MAX] meaning [0.0, 1.0], though most functions tolerate other ranges.
299
+ */
300
+ typedef uint16_t Pixel_16U; /* 16 bit unsigned pixel */
301
+
302
+ /*!
303
+ @typedef Pixel_16S
304
+ @abstract A 16-bit per channel signed pixel.
305
+ @discussion Typical range is [SHRT_MIN,SHRT_MAX] meaning [-1.0, 1.0], though most functions tolerate other ranges.
306
+ */
307
+ typedef int16_t Pixel_16S; /* 16 bit signed pixel */
308
+
309
+ /*!
310
+ @typedef Pixel_16Q12
311
+ @abstract A signed 16 bit fixed point number with 12 bits of fractional precision.
312
+ @discussion Normal range is [-4096,4096] meaning [-1.0, 1.0]. Values in the range [-8.0, 8.0) are representable.
313
+ */
314
+ typedef int16_t Pixel_16Q12; /* 16 bit signed pixel */
315
+
316
+ /*!
317
+ @typedef Pixel_16U16U
318
+ @abstract A two channel, 16-bit per channel pixel.
319
+ @discussion The channel order is generally given by the function that consumes the value.
320
+ */
321
+ typedef uint16_t Pixel_16U16U[2]; /* CbCr interleaved (16 bit/channel) pixel value. uint16_t[2] = { Cb, Cr } */
322
+
323
+ /*!
324
+ @typedef Pixel_16S16S
325
+ @abstract A two channel, 16-bit per channel signed pixel.
326
+ @discussion The channel order is generally given by the function that consumes the value.
327
+ */
328
+ typedef int16_t Pixel_16S16S[2]; /* CbCr interleaved (16 bit/channel) signed pixel value. int16_t[2] = { Cb, Cr } */
329
+
330
+ /*!
331
+ @typedef Pixel_32U
332
+ @abstract Type used for XRGB2101010 format.
333
+ @discussion Typical range for RGB channels is [0,1023] meaning [0.0, 1.0], though most functions tolerate other ranges.
334
+ */
335
+ typedef uint32_t Pixel_32U; /* 32 bit unsigned pixel */
336
+
337
+ /*!
338
+ @typedef Pixel_ARGB_16U
339
+ @abstract A four channel, 16-bit unsigned per channel pixel.
340
+ @discussion The channel order is generally given by the function that consumes the value. It is not necessarily ARGB.
341
+ */
342
+ typedef uint16_t Pixel_ARGB_16U[4]; /* four-channel 16-bit unsigned pixel */
343
+
344
+ /*!
345
+ @typedef Pixel_ARGB_16S
346
+ @abstract A four channel, 16-bit signed per channel pixel.
347
+ @discussion The channel order is generally given by the function that consumes the value. It is not necessarily ARGB.
348
+ */
349
+ typedef int16_t Pixel_ARGB_16S[4]; /* four-channel 16-bit signed pixel */
350
+
351
+ /*!
352
+ @typedef Pixel_16F
353
+ @abstract A 16-bit half precision floating-point planar pixel value.
354
+ @discussion Typically, these have range [0,1] though other values are generally allowed.
355
+ Defined as a 16-bit integer since this is a storage format only.
356
+ */
357
+ typedef uint16_t Pixel_16F; /* 16-bit floating point planar pixel value */
358
+
359
+ /*!
360
+ @typedef Pixel_16F16F
361
+ @abstract A two-channel, 16-bit floating-point per channel pixel.
362
+ @discussion The channel order is generally given by the function that consumes the value.
363
+ */
364
+ typedef uint16_t Pixel_16F16F[2]; /* CbCr interleaved 16-bit floating point per channel pixel value. uint16_t[2] = { Cb, Cr } */
365
+
366
+ /*!
367
+ @typedef Pixel_ARGB_16F
368
+ @abstract A four-channel, 16-bit floating-point per channel pixel.
369
+ @discussion The channel order is generally given by the function that consumes the value.
370
+ */
371
+ typedef uint16_t Pixel_ARGB_16F[4]; /* ARGB interleaved 16-bit floating point per channel pixel value. uint16_t[2] = { Cb, Cr } */
372
+
373
+
374
+ /*!
375
+ @typedef Pixel_FF
376
+ @abstract A two-channel, single precision floating-point per channel pixel.
377
+ @discussion The channel order is generally given by the function that consumes the value.
378
+ */
379
+ typedef float Pixel_FF[2]; /* CbCr interleaved (floating point) pixel value. float[2] = { Cb, Cr } */
380
+
381
+ /*!
382
+ @typedef ResamplingFilter
383
+ @abstract A ResamplingFilter is an opaque structure used by vImage to hold precalculated filter coefficients for a resampling filter,
384
+ such as a Lanczos or Gaussian resampling filter.
385
+ @discussion It is created with vImageNewResamplingFilter or vImageNewResamplingFilterUsingBuffer and is consumed by various vertical
386
+ and horizontal shear functions in vImage/Geometry.h. When possible, for better performance, reuse ResamplingFilters over
387
+ multiple vImage calls, instead of allocating a new one each time.
388
+ */
389
+
390
+ typedef void* ResamplingFilter; /* Used by certain Geometry functions. */
391
+
392
+
393
+ /*!
394
+ @typedef GammaFunction
395
+ @discussion A GammaFunction is an opaque structure used by vImage to represent an approximation of a non-linear curve. It is created with
396
+ vImageCreateGammaFunction, and destroyed with vImageDestroyGammaFunction. When possible, for better performance,
397
+ reuse GammaFunctions over multiple vImage function calls, instead of creating a new one each time.
398
+ */
399
+
400
+ typedef void* GammaFunction; /* Used by vImageGamma */
401
+
402
+ /* vImage Errors */
403
+ /* ============ */
404
+ /* All return values < 0 indicate failure. In this case, the results in the destination */
405
+ /* buffer are undefined. The list of error codes may grow in the future. */
406
+ /* */
407
+ /* Note: It is also possible for positive non-zero numbers to be returned out the LHS of a */
408
+ /* vImage function. This happens when the kvImageGetTempBufferSize bit is set in the flags. */
409
+ /* In this case, no work is done by the vImage function. The value returned is the size of */
410
+ /* the temp buffer needed by the function. */
411
+ /*!
412
+ @typedef vImage_Error
413
+ @abstract An error code returned by a vImage function.
414
+ @discussion All negative values are errors.
415
+ Positive return values are likely to be the result of kvImageGetTempBufferSize.
416
+ Zero indicates no error, or quasi-ambiguously a zero temp buffer size, if that
417
+ flag was passed. Please see the documentation for the function that returned the
418
+ error code for additional information about the error.
419
+
420
+ @constant kvImageNoError Success. If kvImageGetTempBufferSize is set in flags, then
421
+ it indicates the temp buffer size is 0 and the function did
422
+ nothing else.
423
+ @constant kvImageRoiLargerThanInputBuffer The size or positioning of the result buffer
424
+ was such that pixels were needed in the source buffer, were
425
+ found to be missing and could not be discovered using an edging
426
+ process like kvImageEdgeExtend. Typically, this means that the
427
+ source image was smaller than the destination image.
428
+ @constant kvImageInvalidKernelSize The size of a kernel was invalid. Typically, kernels have
429
+ have an odd number of rows and columns. The kernel might also have
430
+ been too large or of zero dimension. Typically only returned by
431
+ convolutions and morphological operations.
432
+
433
+ @constant kvImageInvalidEdgeStyle The edging style {kvImageBackgroundColorFill, kvImageCopyInPlace, kvImageEdgeExtend, kvImageTruncateKernel}
434
+ was invalid. Typically, the edging style is either missing or the edging style
435
+ is not supported by this function.
436
+
437
+ @constant kvImageInvalidOffset_X Some functions take an integer offset in the horizontal dimension. This indicates
438
+ how far from the left edge of the vImage_Buffer we shoud consider the origin to be.
439
+ The offset allows real pixel data to be used where an edging method like kvImageEdgeExtend
440
+ might otherwise have to be used to generate missing pixels. An X offset is essential to
441
+ obtaining correct results for tiled image processing when the tile is not at the left
442
+ edge of the (whole) image and the function has a kernel or ResamplingFilter.
443
+ Typically, this can happen when the offset is negative or larger than the source vImage_Buffer.width.
444
+
445
+ @constant kvImageInvalidOffset_Y Some functions take an integer offset in the vertical dimension. This indicates
446
+ how far from the top edge of the vImage_Buffer we shoud consider the origin to be.
447
+ The offset allows real pixel data to be used where an edging method like kvImageEdgeExtend
448
+ might otherwise have to be used to generate missing pixels. A Y offset is essential to
449
+ obtaining correct results for tiled image processing when the tile is not at the top
450
+ edge of the (whole) image and the function has a kernel or ResamplingFilter.
451
+ Typically, this can happen when the offset is negative or larger than the source vImage_Buffer.height.
452
+
453
+ @constant kvImageMemoryAllocationError vImage attempted to allocate memory and the allocator failed, returning NULL.
454
+
455
+ @constant kvImageNullPointerArgument One or more arguments to the function are NULL, which are not allowed to be NULL.
456
+ Typically, arguments that are not allowed to be NULL are listed in the VIMAGE_NON_NULL() attribute
457
+ that follows the function declaration.
458
+
459
+ @constant kvImageInvalidParameter A function parameter has an invalid value. This is the fallback error code when there is not
460
+ an error code that more precisely describes the invalid parameter value such as kvImageNullPointerArgument,
461
+ kvImageInvalidEdgeStyle, kvImageInvalidRowBytes, etc.
462
+
463
+ @constant kvImageBufferSizeMismatch This most often occurs when a set of planar buffers are not the same size. Most often
464
+ this occurs when the destination image is planar and the destination planes are not the same size.
465
+ It may also occur in rare cases when chunk sizes mismatch for some high level conversions.
466
+
467
+ @constant kvImageUnknownFlagsBit A bit in the flags field is set, which the function does not understand or currently support.
468
+ Please check flags enum availability info to make sure the flag is supported on the target OS revision.
469
+
470
+ @constant kvImageInternalError A serious error occured inside vImage, which prevented vImage from continuing. This error is
471
+ probably a problem with vImage itself, and not how it is being used. Please file a bug with a
472
+ reproducible test case attached, if possible!
473
+
474
+ @constant kvImageInvalidRowBytes The vImage_Buffer.rowBytes field is invalid. In some circumstances, rowBytes of 0 is not supported,
475
+ particularly with destination images or when vImage is asked to initialize a vImage_Buffer and the
476
+ rowBytes is too small to hold a row of image data.
477
+
478
+ @constant kvImageInvalidImageFormat Usually a vImage_CGImageFormat or vImageCVImageFormatRef contains an invalid format. It might be a
479
+ NULL pointer, a description which is not allowed according to rules of CG or CV image format encodings.
480
+
481
+ @constant kvImageColorSyncIsAbsent ColorSync.framework is completely missing. Certain operations will not work.
482
+
483
+ @constant kvImageOutOfPlaceOperationRequired The source images and destination images may not alias the same image data. This will
484
+ be returned by vImageCGConverter_MustOperateOutOfPlace(). However, there are many functions in vImage
485
+ that do not work in place which do not check to see if the buffers overlap. Please inspect the documentation
486
+ of each function for notes on in-place usage before using them that way.
487
+
488
+ @constant kvImageInvalidImageObject An invalid CGImageRef or CVPixelBufferRef was passed to the function. Typically, the object was NULL.
489
+ A non-NULL invalid CGImageRef or CVPixelBufferRef will result in undefined behavior.
490
+
491
+ @constant kvImageInvalidCVImageFormat A vImageCVImageFormatRef contains an invalid format. It might be a NULL pointer, or an image format
492
+ which is not allowed according to rules of CV image format encodings.
493
+
494
+ @constant kvImageUnsupportedConversion Some lower level conversion APIs only support conversion among a sparse matrix of image formats.
495
+ */
163
496
  typedef VIMAGE_CHOICE_ENUM(vImage_Error, ssize_t)
164
497
  {
165
498
  kvImageNoError VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 0,
@@ -173,7 +506,7 @@ typedef VIMAGE_CHOICE_ENUM(vImage_Error, ssize_t)
173
506
  kvImageInvalidParameter VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21773,
174
507
  kvImageBufferSizeMismatch VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21774,
175
508
  kvImageUnknownFlagsBit VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21775,
176
- kvImageInternalError VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21776,
509
+ kvImageInternalError VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21776, /* Should never see this. File a bug! */
177
510
  kvImageInvalidRowBytes VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21777,
178
511
  kvImageInvalidImageFormat VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21778,
179
512
  kvImageColorSyncIsAbsent VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21779,
@@ -183,66 +516,356 @@ typedef VIMAGE_CHOICE_ENUM(vImage_Error, ssize_t)
183
516
  kvImageUnsupportedConversion VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21783,
184
517
  kvImageCoreVideoIsAbsent VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = -21784,
185
518
  };
186
-
519
+
520
+ /* vImage Flags */
521
+ /* ============ */
522
+ /* The values here indicate bits in a vImage_Flags bit field. */
523
+ /* Other bits are reserved for future use. */
524
+ /* Some flags are mutually exclusive. You can not have more */
525
+ /* than one bit from this set set at the same time: */
526
+ /* { kvImageCopyInPlace, kvImageBackgroundColorFill, kvImageEdgeExtend, kvImageTruncateKernel } */
527
+ /* all unused flags bits must be set to 0 */
528
+ /* Not all flags are allowed by all functions. */
529
+ /*!
530
+ @typedef vImage_Flags
531
+ @abstract vImage_Flags is a 32-bit bitfield of options of general use to vImage functions.
532
+ @discussion Multiple bits may be set concurrently. kvImageUnknownFlagsBit may be returned by
533
+ a function if a flag bit is set (1) but the function does not know what the flag
534
+ bit means (e.g. your new code on an older version of vImage) or if the flag should
535
+ cause a behavior that is unsupported by the function, for example, kvImageHighQualityResampling
536
+ to a function that does not do image resampling.
537
+ @constant kvImageNoFlags Use the default behavior. Internal multithreading is enabled. Debug
538
+ messages are generally not printed to the console. No edging method is specified.
539
+ Normal quality resampling methods are used (Lanczos3, probably). Do the function,
540
+ instead of returning a temp buffer size. Allocate memory as needed.
541
+
542
+ @constant kvImageLeaveAlphaUnchanged Some functions that operate on ARGB data in place allow
543
+ you to operate on just the RGB components and leave the alpha channel unmodified.
544
+ These are typically histogram and gamma functions and some convolution functions.
545
+
546
+ @constant kvImageCopyInPlace One of four edging modes. This one tells vImage to do nothing for
547
+ destination pixels that need source pixels that are missing. The corresponding source
548
+ pixel is copied to the destination image. This is only used for image filters that take a
549
+ kernel, such as convolutions. It is not allowed for Morphology filters.
550
+
551
+ @constant kvImageBackgroundColorFill One of four edging modes. This one tells vImage to use the
552
+ backgroundColor parameter of the function as the color of any missing pixels in
553
+ a source image. Missing pixels occur when a filter needs to read off the edge of
554
+ a source image.
555
+
556
+ @constant kvImageEdgeExtend One of four edging modes. This one tells vImage to use the nearest
557
+ existing source image pixel when it needs source data but finds it needs a non-existant
558
+ pixel off the edge of the provided source image.
559
+
560
+ @constant kvImageDoNotTile Do not internally subdivide the image for processing on multiple CPUs
561
+ or other compute devices. If this flag is set, the function will run single threaded
562
+ on the current thread. Usually this flag may be expected to cause a significant increase
563
+ in the execution time of a vImage function. However, if you are calling the function
564
+ from a heavily multithreaded context (such as your own tiling engine) and CPU occupancy
565
+ is high, this may lead to small performance improvements due to reduced CPU contention.
566
+
567
+ @constant kvImageHighQualityResampling Use a more expensive image resampling method than what is available
568
+ by default. Typically this is Lanczos5. Note that as vImage resampling already leans towards
569
+ quality over performance -- the GPU texture unit is your friend if you just want raw performance
570
+ -- the additional quality from kvImageHighQualityResampling may be difficult to see in some images.
571
+ It is best suited to background rendering tasks.
572
+
573
+ @constant kvImageTruncateKernel One of four edging modes. This one tells vImage to use only the pixels it
574
+ has and reweight the kernel accordingly. The reweighting process can be expensive. It can
575
+ also lead to difficulties if a contiguous sub-rectangle of the kernel sums to zero. In this
576
+ case, the area of the kernel is zero and you have formally asked vImage to do division by zero,
577
+ in which case vImage behavior is undefined.
578
+
579
+ @constant kvImageGetTempBufferSize Instead of performing the function requested, return (as a vImage_Error)
580
+ the size of the temp buffer requried by the function for this set of parameters. The image pixels
581
+ are not touched. If the function does not take a temp buffer, then 0 will be returned and the
582
+ function will do nothing. Some functions may return a 0 sized temp buffer for some sets of parameters
583
+ an not others. The size of the temporary buffer may change for different parameters, and for
584
+ different OS revisions.
585
+
586
+ @constant kvImagePrintDiagnosticsToConsole Some of the high level functions in vImage_Utilities.h and
587
+ vImage_CVUtilities.h have complex failure modes that could prove baffling with just a
588
+ error code return. This flag instructions these functions to also print a human readable
589
+ diagnostic message to the Apple System Logger when an error is encountered. The output
590
+ should be visible in Console.app.
591
+
592
+ @constant kvImageNoAllocate Some vImage functions may allocate memory, possibly returning it to you.
593
+ This flag instructs the function to use the memory provided instead. For example, instead of
594
+ overwriting vImage_Buffer.data with a newly allocated pointer to memory, use the memory
595
+ pointed to by vImage_Buffer.data directly. In other cases, it may cause the function to
596
+ assume ownership of a buffer, rather than allocating a copy. You are responsible for making
597
+ sure the buffer that you allocate instead of vImage is large enough to hold the image. Most
598
+ vImage functions do not allocate memory and assume that vImage_Buffer.data is already allocated,
599
+ and in the case of source image buffers, contain valid pixel data.
600
+
601
+ @constant kvImageHDRContent The pixels described in the input image may contain high dymanic range content.
602
+ HDR pixels may have value outside of [-2,2.0]. This flag is generally only applicable to
603
+ floating-point images. Most 8- and 16-bit pixels can not represent values outside [0,1] and
604
+ functions that operate on 16Q12 formats are designed to operate over the full range of [-8,8).
605
+ Most floating-point functions in vImage are linear in behavior and so work equally well
606
+ on any float. Some non-linear functions like polynomials (or by extension colorspace conversion)
607
+ are only valid over a limited range (typically [-2,2]) and will return incorrect answers
608
+ for values outside that range. In addition, certain IIR or FFT algorithms in convolution may
609
+ encounter precision issues with HDR content. For these cases, if you know you have HDR content,
610
+ pass kvImageHDRContent and a (typically slower) alternative method will be used for these
611
+ sources.
612
+
613
+ @constant kvImageUseFP16Accumulator Use a faster and lower precision internal arithmetic, when available,
614
+ for the functions operating on 16-bit half-precision floating-point pixels (Pixel16_F).
615
+ This will enforce for example convolutions to be computed with 16-bit half-precision floating-point
616
+ arithmetic internally, when architecture of the CPU supports it. The arm64e architectures supports it
617
+ but none of the Intel architectures.
618
+
619
+ */
187
620
  typedef VIMAGE_OPTIONS_ENUM(vImage_Flags, uint32_t)
188
621
  {
189
622
  kvImageNoFlags VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 0,
190
-
191
- kvImageLeaveAlphaUnchanged VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 1,
192
-
623
+
624
+ /* Operate on red, green and blue channels only. Alpha is copied from source
625
+ to destination. For Interleaved formats only. */
626
+ kvImageLeaveAlphaUnchanged VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 1,
627
+
628
+ /* Copy edge pixels. Convolution Only. */
193
629
  kvImageCopyInPlace VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 2,
194
-
630
+
631
+ /* Use the background color for missing pixels. */
195
632
  kvImageBackgroundColorFill VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 4,
196
-
633
+
634
+ /* Use the nearest pixel for missing pixels. */
197
635
  kvImageEdgeExtend VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 8,
198
-
636
+
637
+ /* Pass to turn off internal tiling and disable internal multithreading. Use this if
638
+ you want to do your own tiling, or to use the Min/Max filters in place. */
199
639
  kvImageDoNotTile VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 16,
200
-
640
+
641
+ /* Use a higher quality, slower resampling filter for Geometry operations
642
+ (shear, scale, rotate, affine transform, etc.) */
201
643
  kvImageHighQualityResampling VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_5_0 ) = 32,
202
-
644
+
645
+ /* Use only the part of the kernel that overlaps the image. For integer kernels,
646
+ real_divisor = divisor * (sum of used kernel elements) / (sum of kernel elements).
647
+ This should preserve image brightness at the edges. Convolution only. */
203
648
  kvImageTruncateKernel VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 64,
204
-
649
+
650
+ /* The function will return the number of bytes required for the temp buffer.
651
+ If this value is negative, it is an error, per standard usage. */
205
652
  kvImageGetTempBufferSize VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 128,
206
-
653
+
654
+ /* Some functions such as vImageConverter_CreateWithCGImageFormat have so many possible error conditions
655
+ that developers may need more help than a simple error code to diagnose problems. When this
656
+ flag is set and an error is encountered, an informative error message will be logged to the Apple
657
+ System Logger (ASL). The output should be visible in Console.app. */
207
658
  kvImagePrintDiagnosticsToConsole VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_9, __IPHONE_7_0 ) = 256,
208
-
659
+
660
+ /* Pass this flag to prevent vImage from allocating additional storage. */
209
661
  kvImageNoAllocate VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_9, __IPHONE_7_0 ) = 512,
210
662
 
663
+ /* Use methods that are HDR-aware, capable of providing correct results for input images with pixel values
664
+ outside the otherwise limited (typically [-2,2]) range. This may be slower. */
211
665
  kvImageHDRContent VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_11, __IPHONE_9_0 ) = 1024,
212
666
 
667
+ /* Pass to disable clamping is some conversions to floating point formats. Use this if the input data
668
+ may describe values outside [0,1] which should be preserved.. */
213
669
  kvImageDoNotClamp VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_12, __IPHONE_9_3 ) = 2048,
214
-
670
+
671
+ /* Use a lower precision, faster floating-point arithmetic for all internal computations when available.
672
+ This applies to all functions operating on 16-bit half-precision floating-point pixels, Pixel_16F. */
215
673
  kvImageUseFP16Accumulator __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 4096,
216
674
  };
217
675
 
676
+ /*!
677
+ @class vImageConverterRef
678
+ @abstract An opaque type which contains a decription of a conversion from one CoreGraphics image format to another.
679
+
680
+ @discussion The vImageConverter is an opaque type which contains information needed to do a rapid conversion from
681
+ one image type to another. Sometimes, it can take a significant amount of time to figure out how to convert
682
+ from one format to another. It wouldn't be good to do that redundantly for a bunch of small images. The
683
+ vImageConversionSetup allows us to set up the conversion once and reuse the information many times, to
684
+ keep net latencies low.
685
+
686
+ Note that creating a vImageConverter can at times take a while. While usually it is quick, it might have
687
+ to do things like load other frameworks in the system (e.g. Colorsync) if they are not loaded already,
688
+ or build a lookup table. It is a good idea to setup your conversions in advance and reuse the conversion
689
+ objects. The objects are thread safe. You can use the same object in multiple threads concurrently. They
690
+ follow standard retain / release semantics and can be used as CFTypeRefs.
691
+
692
+ @superclass CFTypeRef
693
+
694
+ @seealso Please see vImage_Utilities.h for interfaces that operate on the vImageConverterRef
695
+ */
696
+
218
697
  typedef struct CF_BRIDGED_TYPE(id) vImageConverter * vImageConverterRef;
219
698
 
699
+ /*!
700
+ @class vImageCVImageFormatRef
701
+ @abstract An opaque type which contains a decription of a conversion from a CoreGraphics image format to a CVPixelBuffer, or the reverse.
702
+
703
+ @superclass CFTypeRef
704
+ @discussion The vImageCVImageFormatRef describes how the image is encoded in a CVPixelBufferRef. vImage uses this information to construct converters that
705
+ are capable of converting to and from this image encoding. The format stores a description of the pixels in the image (planar/color representation/
706
+ bit depth/number of channels, etc.) but not the image size, location of the base pointer or rowbytes. It is intended for the vImageCVImageFormatRef
707
+ to be reused for other CVPixelBufferRefs of the same format, such as other frames from the same movie.
708
+
709
+ vImageCVImageFormatRefs are capable of holding an incomplete encoding representation. You may be required to provide addition information such
710
+ as colorspace and (YCbCr only) chroma siting or conversion matrix before the vImageCVImageFormatRef can be used for image conversion to other
711
+ formats.
712
+
713
+ The vImageCVImageFormatRef is a CFTypeRef. CFEqual does not test for equivalence of the userData field. You should use vImageCVImageFormat_Retain/Release
714
+ when working with vImageCVImageFormatRef to manage ownership of the object.
715
+
716
+ <pre>
717
+ @textblock
718
+ Thread Safety:
719
+
720
+ The vImageCVImageFormatRef may be safely read from multiple threads concurrently. However,
721
+ it makes no attempt to keep its internal state coherent when multiple threads write to it,
722
+ or when one thread writes to it while one or more threads are reading from it at the same
723
+ time. This can be trivially handled by keeping the knowledge of the vImageCVImageFormatRef
724
+ limited to a single thread while it is being created / configured and then treat it as
725
+ immutable thereafter. If necessary, you can also use a read/write lock to limit reentrant
726
+ access.
727
+ @/textblock
728
+ </pre>
729
+
730
+
731
+ Information tracked by vImageCVImageFormatRef:
732
+
733
+ <pre>
734
+ @textblock
735
+ imageFormatType A CVPixelFormatType such as '2vuy'. See CVPixelBuffer.h for the complete list.
736
+
737
+ number_of_channels How many color + alpha channels are encoded in the image. An alpha channel is included in this count
738
+ if it takes up space in the image, even if its value is described always 1.0, for example by /Last
739
+ kCGImageAlphaNoneSkipFirst or kCVImageBufferAlphaChannelIsOpaque. This field is automatically initialized
740
+ based on the imageFormatType (see above) and is never missing.
741
+
742
+ channel_names A list of vImageBufferTypeCodes corresponding to the channels in the image. Unlike what happens for
743
+ vImageConverterRefs, the type codes used here always encode a single color channel. vImageConverterRefs
744
+ use the channel names to encode what is in each vImage_Buffer. Here it is used to describe each channel.
745
+ So, an ARGB buffer might be described as kvImageBufferTypeCode_CGFormat but will be described as
746
+ { kvImageBufferTypeCode_RGB_Red, kvImageBufferTypeCode_RGB_Green, kvImageBufferTypeCode_RGB_Blue,
747
+ kvImageBufferTypeCode_Alpha, kvImageBufferTypeCode_EndOfList }. The order of the channels in the list
748
+ may not match the order of the channels in the buffer. This field is automatically initialized based on
749
+ the imageFormatType (see above) and is never missing.
750
+
751
+ matrix (YpCbCr only.) A YpCbCr image has an associated 3x3 matrix that encodes how it was converted to YpCbCr from
752
+ a reference RGB colorspace (see colorspace below). The matrix is encoded as a NULL pointer when missing.
753
+ This field is ignored for non-YpCbCr formats.
754
+
755
+
756
+ chroma_siting Some YpCbCr formats store their chroma components as a smaller image than the luminance component.
757
+ This describes where the subsampled chroma samples are positioned relative to the luminance component.
758
+ This field is encoded as a NULL CFStringRef when missing. The field is ignored for RGB, monochrome,
759
+ indexed and 4:4:4 YpCbCr image formats.
760
+
761
+ colorspace For RGB, indexed and grayscale images, this is the colorspace that describes the image encoding.
762
+ For YpCbCr images, this is the colorspace of the RGB image that you get once the matrix (see above)
763
+ is unapplied. Thus, the colorspace encodes for the underlying primaries and transfer function of the
764
+ YpCbCr image. See also vImageCreateRGBColorSpaceWithPrimariesAndTransferFunction. This field is required
765
+ for all image formats. A colorspace of NULL indicates a missing colorspace. (This is inconsistent with
766
+ the shorthand used in vImage_Utilities.h where NULL maps to sRGB.) Since vImage has no concept of
767
+ a current graphics device, deviceRGB maps to sRGB and device gray maps to gray 2.2. If you wish to
768
+ ensure no color correction / conversion, you should match this colorspace with the one in the
769
+ vImage_CGImageFormat to / from which you are converting.
770
+
771
+ channel_description Some CVPixelBuffer formats do not use the entire representable range of the format to encode image data.
772
+ For example, a 'yuvs' "video range" buffer only uses the range [16,235] for luminance and [16,240] for
773
+ chroma. Values outside that range are considered to have value equal to the nearest in-range value. In
774
+ addition, we add additionional fields to leave open the possibility that some formats can encode information
775
+ outside of the traditional [0,1.0] range ([-1.0,1.0] for chroma) so reference values for the encoding for 0
776
+ and 1.0 are also described. (See vImageChannelDescription below.) The zero/one fields are analogous in function
777
+ to the decode arrays provided by CG. It is possible to use the channel description to create formats that are
778
+ not correctly understood by CoreVideo. These are provided to allow for interoperation with custom video formats.
779
+ The channel description is initialized automatically for known image format types (see imageFormatType above)
780
+ and probably only very rarely needs to be changed. It is never missing.
781
+
782
+ alpha_is_one_hint Some images are encoded with an alpha channel. However, you may have additional information that the image is
783
+ really completely opaque. The "alpha is one hint" tells vImage that the alpha channel is always 1.0 (opaque)
784
+ across the entire image. Setting the hint to 1 may allow vImage to avoid work and run faster in some cases.
785
+ There is no vImageCVImageFormatRef representation for premultiplied alpha, currently. Since it is a hint,
786
+ the hint may never be missing from a vImageCVImageFormatRef. The hint is ignored for image formats that do
787
+ not contain an alpha channel.
788
+
789
+ user_data The vImageCVImageFormatRef has a userData field to allow you to easily reference your data starting from
790
+ a handle to the object. vImage does not attempt to interact with the memory pointed to by the userData
791
+ pointer. It simply holds on to the pointer for you and will call a destructor callback function when the
792
+ vImageCVImageFormatRef to allow you to free that memory, and do any other post processing needed when the
793
+ vImageCVImageFormatRef is destroyed. Since there is only one userData pointer, by convention its use is
794
+ considered private to the application/library/framework that created the vImageCVImageFormatRef, including
795
+ cases where the creator does not set the userData field. If you need to attach your own data to a
796
+ vImageCVImageFormatRef created by someone else, you can make a copy of it or wrap it with your own object.
797
+ @/textblock
798
+ </pre>
799
+
800
+ @seealso Please see vImage_CVUtilities.h for interfaces that operate on the vImageCVImageFormatRef
801
+ */
802
+
220
803
  typedef struct CF_BRIDGED_TYPE(id) vImageCVImageFormat * vImageCVImageFormatRef;
221
804
  typedef const struct CF_BRIDGED_TYPE(id) vImageCVImageFormat * vImageConstCVImageFormatRef;
222
805
 
806
+
807
+
808
+ /*!
809
+ @typedef vImageARGBType
810
+ @abstract An encoding of an image format type to be used with RGB <-> Y'CbCr conversions in vImage/Conversions.h
811
+ @discussion These formats enumerate different vImage ARGB pixel formats.
812
+ */
223
813
  typedef enum
224
814
  {
225
- kvImageARGB8888 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 0,
226
- kvImageARGB16U VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 1,
227
- kvImageARGB16Q12 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 2
815
+ kvImageARGB8888 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 0, /* Any 8-bit four channel interleaved buffer [0,255]=[0,1.0]. Does not specify channel order. */
816
+ kvImageARGB16U VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 1, /* Any 16-bit unsigned four channel interleaved buffer [0,65535]=[0,1.0]. Does not specify channel order. */
817
+ kvImageARGB16Q12 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 2 /* Any 16-bit signed fixedpoint four channel interleaved buffer [0,4096]=[0,1.0]. Does not specify channel order. */
228
818
  }vImageARGBType;
229
-
819
+
820
+ /*!
821
+ @typedef vImageYpCbCrType
822
+ @abstract An encoding of an image format type to be used with RGB <-> Y'CbCr conversions in vImage/Conversions.h
823
+ @discussion These formats enumerate different vImage/CoreVideo Y'CbCr pixel formats.
824
+ @seealso CVPixelBuffer OSTypes in CVPixelBuffer.h
825
+ */
230
826
  typedef enum
231
827
  {
232
- kvImage422CbYpCrYp8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 0,
233
- kvImage422YpCbYpCr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 1,
234
- kvImage422CbYpCrYp8_AA8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 2,
235
- kvImage420Yp8_Cb8_Cr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 3,
236
- kvImage420Yp8_CbCr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 4,
237
- kvImage444AYpCbCr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 5,
238
- kvImage444CrYpCb8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 6,
239
- kvImage444CbYpCrA8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 7,
240
- kvImage444CrYpCb10 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 8,
241
- kvImage422CrYpCbYpCbYpCbYpCrYpCrYp10 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 9,
242
- kvImage422CbYpCrYp16 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 13,
243
- kvImage444AYpCbCr16 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 14
828
+ kvImage422CbYpCrYp8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 0, /* 2vuy */
829
+ kvImage422YpCbYpCr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 1, /* yuvs / yuvf */
830
+ kvImage422CbYpCrYp8_AA8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 2, /* a2vy */
831
+ kvImage420Yp8_Cb8_Cr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 3, /* y420 / f420 */
832
+ kvImage420Yp8_CbCr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 4, /* 420v / 420f */
833
+ kvImage444AYpCbCr8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 5, /* r408 / y408 */
834
+ kvImage444CrYpCb8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 6, /* v308 */
835
+ kvImage444CbYpCrA8 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 7, /* v408 */
836
+ kvImage444CrYpCb10 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 8, /* v410 */
837
+ kvImage422CrYpCbYpCbYpCbYpCrYpCrYp10 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 9, /* v210 */
838
+ kvImage422CbYpCrYp16 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 13, /* v216 16-bit */
839
+ kvImage444AYpCbCr16 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_8_0 ) = 14 /* y416 */
244
840
  }vImageYpCbCrType;
245
-
841
+
842
+
843
+ /*!
844
+ @struct vImage_YpCbCrToARGBMatrix
845
+
846
+ @field Yp matrix[0][0]. Typically 1.
847
+ @field Cr_R matrix[0][2].
848
+ @field Cb_G matrix[1][1].
849
+ @field Cr_G matrix[1][2].
850
+ @field Cb_B matrix[2][1]
851
+
852
+ @abstract A 3x3 converson matrix for converting Y'CbCr signals to RGB
853
+ @discussion The matrix is sparse. The 3x3 matrix is given by:
854
+
855
+ <pre>
856
+ @textblock
857
+ | R | | Yp 0 Cr_R | | Y' |
858
+ | G | = | Yp Cb_G Cr_G | * | Cb |
859
+ | B | | Yp Cb_B 0 | | Cr |
860
+ @/textblock
861
+ </pre>
862
+
863
+ Limits on the range of the fields in the matrix may apply.
864
+
865
+ @seealso vImage_ARGBToYpCbCrMatrix, which is the inverse matrix
866
+ */
867
+
868
+ /* Input information into vImageConvert_YpCbCrToARGB_GenerateConversion() */
246
869
  typedef struct vImage_YpCbCrToARGBMatrix
247
870
  {
248
871
  float Yp;
@@ -251,19 +874,70 @@ typedef struct vImage_YpCbCrToARGBMatrix
251
874
  float Cb_G;
252
875
  float Cb_B;
253
876
  }vImage_YpCbCrToARGBMatrix;
254
-
877
+
255
878
  #if !0 && !0
256
-
879
+ /*! @const kvImage_YpCbCrToARGBMatrix_ITU_R_601_4
880
+ @abstract Y'CbCr->RGB conversion matrix for ITU-Recommendation BT.601-4 */
257
881
  extern VIMAGE_PF const vImage_YpCbCrToARGBMatrix *kvImage_YpCbCrToARGBMatrix_ITU_R_601_4 API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
258
882
 
883
+ /*! @const kvImage_YpCbCrToARGBMatrix_ITU_R_709_2
884
+ @abstract Y'CbCr->RGB conversion matrix for ITU-Recommendation BT.709-2 */
259
885
  extern VIMAGE_PF const vImage_YpCbCrToARGBMatrix *kvImage_YpCbCrToARGBMatrix_ITU_R_709_2 API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
260
886
  #endif
887
+
888
+
889
+
890
+ /*!
891
+ @typedef vImage_YpCbCrToARGB
892
+ @abstract An opaque representation of a 3x3 converson matrix for converting Y'CbCr signals to RGB.
893
+ It is used to do the actual conversions. Please attempt to reuse these rather than making
894
+ new ones each time.
895
+ @discussion The representation also includes the range of the input and output pixels from the matrix and
896
+ clamping information.
897
+
898
+ @seealso vImage_ARGBToYpCbCr, which is the inverse matrix
899
+ */
261
900
 
262
901
  typedef struct vImage_YpCbCrToARGB
263
902
  {
264
903
  uint8_t __attribute__ ((__aligned__(16))) opaque[128];
265
904
  }vImage_YpCbCrToARGB;
266
-
905
+
906
+ /*!
907
+ @typedef vImage_ARGBToYpCbCrMatrix
908
+ @abstract A 3x3 converson matrix for converting RGB signals to Y'CbCr
909
+ @discussion The matrix has one repeating parameter. The 3x3 matrix is given by:
910
+
911
+ @textblock
912
+ | Y' | | R_Yp G_Yp B_Yp | | R |
913
+ | Cb | = | R_Cb G_Cb B_Cb_R_Cr | * | G |
914
+ | Cr | | B_Cb_R_Cr G_Cr B_Cr | | B |
915
+ @/textblock
916
+
917
+ Typically, these matrix coefficients come from a conversion of form:
918
+
919
+ @textblock
920
+ Y' = R_Yp * R + G_Yp * G + B_Yp * B 0 <= Y' <= 1
921
+ Cb = k0 * (B - Y') -0.5 <= Cb <= 0.5
922
+ Cr = k1 * (R - Y') -0.5 <= Cr <= 0.5
923
+ @/textblock
924
+
925
+ {R_Yp, G_Yp, B_Yp} are typically derived from the perceived brightness for red, green and blue.
926
+ k0 and k1 are typically scaled so that Cb and Cr have the indicated range. Because of these
927
+ relationships, {R_Yp, G_Yp, B_Yp} are usually positive, and B_Cb_R_Cr is usually 0.5.
928
+ Limits on the range of the fields in the matrix may apply.
929
+ @field R_Yp matrix[0][0]
930
+ @field G_Yp matrix[0][1]
931
+ @field B_Yp matrix[0][2]
932
+ @field R_Cb matrix[1][0]
933
+ @field G_Cb matrix[1][1]
934
+ @field B_Cb_R_Cr matrix[1][2] and matrix[2][0]
935
+ @field G_Cr matrix[2][1]
936
+ @field B_Cr matrix[2][2]
937
+ @seealso vImage_YpCbCrToARGBMatrix, which is the inverse matrix
938
+
939
+ */
940
+ /* Input information into vImageConvert_ARGBToYpCbCr_GenerateConversion() */
267
941
  typedef struct vImage_ARGBToYpCbCrMatrix
268
942
  {
269
943
  float R_Yp;
@@ -277,17 +951,61 @@ typedef struct vImage_ARGBToYpCbCrMatrix
277
951
  }vImage_ARGBToYpCbCrMatrix;
278
952
 
279
953
  #if !0 && !0
280
-
954
+ /*! @const kvImage_ARGBToYpCbCrMatrix_ITU_R_601_4
955
+ @abstract RGB->Y'CbCr conversion matrix for ITU-Recommendation BT.601-4 */
281
956
  extern VIMAGE_PF const vImage_ARGBToYpCbCrMatrix *kvImage_ARGBToYpCbCrMatrix_ITU_R_601_4 API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
282
957
 
958
+ /*! @const kvImage_ARGBToYpCbCrMatrix_ITU_R_709_2
959
+ @abstract RGB->Y'CbCr conversion matrix for ITU-Recommendation BT.709-2 */
283
960
  extern VIMAGE_PF const vImage_ARGBToYpCbCrMatrix *kvImage_ARGBToYpCbCrMatrix_ITU_R_709_2 API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
284
961
  #endif
285
962
 
963
+ /*!
964
+ @typedef vImage_ARGBToYpCbCr
965
+ @abstract An opaque representation of a 3x3 converson matrix for converting RGB signals to Y'CbCr.
966
+ It is used to do the actual conversions. Please attempt to reuse these rather than making
967
+ new ones each time.
968
+ @discussion The representation also includes the range of the input and output pixels from the matrix and
969
+ clamping information.
970
+
971
+ @seealso vImage_ARGBToYpCbCr, which is the inverse matrix
972
+ */
286
973
  typedef struct vImage_ARGBToYpCbCr
287
974
  {
288
975
  uint8_t __attribute__ ((__aligned__(16))) opaque[128];
289
976
  }vImage_ARGBToYpCbCr;
290
-
977
+
978
+ /*!
979
+ @typedef vImage_YpCbCrPixelRange
980
+ @abstract Range and clamping information for Y'CbCr pixel formats
981
+ @discussion Y'CbCr formats frequently don't use the entire representable range available to
982
+ them to represent image data. While a "full range" video format does use the
983
+ entire range, a "video range" format often leaves the extrema unused, except perhaps
984
+ to represent values outside of the standard Y'=[0,1] CbCr = [-0.5, 0.5] range.
985
+ For example, a 8-bit video range format typically uses the range [16,235] for
986
+ Y' and [16, 240] for Cb and Cr.
987
+
988
+
989
+ Some examples:
990
+
991
+ @textblock
992
+ (vImage_YpCbCrPixelRange){ 16, 128, 235, 240, 255, 0, 255, 1 } // video range 8-bit, unclamped
993
+ (vImage_YpCbCrPixelRange){ 16, 128, 235, 240, 235, 16, 240, 16 } // video range 8-bit, clamped to video range
994
+ (vImage_YpCbCrPixelRange){ 0, 128, 255, 255, 255, 1, 255, 0 } // full range 8-bit, clamped to full range
995
+ @/textblock
996
+
997
+ The bias will be the prebias for YUV -> RGB and postbias for RGB -> YUV.
998
+
999
+ @field Yp_bias The encoding for Y' = 0.0 for this video format (varies by bitdepth)
1000
+ @field CbCr_bias The encoding for {Cb,Cr} = 0.0 for this video format. This is usually the MIDDLE of the range of CbCr, not the low end.
1001
+ @field YpRangeMax The encoding for Y' = 1.0 for this video format. For video range, this is typically less than the maximum representable value.
1002
+ @field CbCrRangeMax The encoding for {Cb,Cr} = 0.5 for this video format. This is usually near the high end of the encodable range (e.g. 0xf0), if not the maximum encodable value (e.g. 0xff)
1003
+ @field YpMax The encoding for the maximum allowed Y' value. All values larger than this will be clamped to this value.
1004
+ @field YpMin The encoding of the minimum allowed Y' value. All values less than this will be clamped to this value.
1005
+ @field CbCrMax The encoding of the maximum allowed {Cb, Cr} value. All chroma values greater than this value will be clamped to this value.
1006
+ @field CbCrMin The encoding of the minimum allowed {Cb, Cr} value. All chroma values less than this value will be clamped to this value.
1007
+ @seealso vImageChannelDescription
1008
+ */
291
1009
  typedef struct vImage_YpCbCrPixelRange
292
1010
  {
293
1011
  int32_t Yp_bias;
@@ -300,8 +1018,10 @@ typedef struct vImage_YpCbCrPixelRange
300
1018
  int32_t CbCrMin;
301
1019
  }vImage_YpCbCrPixelRange;
302
1020
 
1021
+
303
1022
  #ifdef __cplusplus
304
1023
  }
305
1024
  #endif
306
1025
 
307
- #endif
1026
+
1027
+ #endif /* vImage_TYPES_H */