peachsim 0.1.1692 → 0.1.1716

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 (991) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +59 -3
  3. package/cli/app-bundle-resources.ts +3 -1
  4. package/cli/app-catalog.ts +10 -0
  5. package/cli/app-fonts.ts +1 -1
  6. package/cli/app-stubs.ts +19 -9
  7. package/cli/bridge-diagnostics.ts +2 -1
  8. package/cli/bridge-flow-runner.ts +61 -39
  9. package/cli/cloud-client.ts +6 -3
  10. package/cli/commands/agent-wrapper.ts +21 -10
  11. package/cli/commands/control.ts +149 -46
  12. package/cli/commands/coverage-swift.ts +19 -1
  13. package/cli/commands/coverage.ts +1 -1
  14. package/cli/commands/detect.ts +85 -25
  15. package/cli/commands/doctor.ts +159 -20
  16. package/cli/commands/flow.ts +4 -1
  17. package/cli/commands/inspect/core.ts +176 -17
  18. package/cli/commands/inspect/settling.ts +17 -5
  19. package/cli/commands/inspect/wait-ready.ts +7 -5
  20. package/cli/commands/inspect.ts +8 -2
  21. package/cli/commands/maestro-compare.ts +25 -99
  22. package/cli/commands/record.ts +263 -32
  23. package/cli/commands/screenshot.ts +2 -13
  24. package/cli/commands/test.ts +49 -101
  25. package/cli/current-sim.ts +4 -4
  26. package/cli/help-core.ts +3 -4
  27. package/cli/hints.ts +1 -6
  28. package/cli/maestro-compare.ts +172 -4
  29. package/cli/main.ts +8 -1
  30. package/cli/metro-bundle-assets.ts +77 -0
  31. package/cli/outbound-endpoints.ts +8 -12
  32. package/cli/run-registry.ts +0 -8
  33. package/cli/scene-video.ts +5 -3
  34. package/cli/ws-bridge.ts +56 -14
  35. package/detox/index.ts +76 -3
  36. package/detox/launch-permissions.ts +325 -0
  37. package/dist-lib/agent-daemon-client.cjs +2 -2
  38. package/dist-lib/agent-events.cjs +2 -2
  39. package/dist-lib/attached-projects.cjs +2 -2
  40. package/dist-lib/auth/shared-session.cjs +2 -2
  41. package/dist-lib/backend-origin.cjs +11 -10
  42. package/dist-lib/beta.cjs +2 -2
  43. package/dist-lib/beta.mjs +1 -1
  44. package/dist-lib/bridge-constants.cjs +6 -2
  45. package/dist-lib/bridge-contract-input.cjs +2 -2
  46. package/dist-lib/bridge-contract-input.mjs +1 -1
  47. package/dist-lib/bridge-contract.cjs +2 -2
  48. package/dist-lib/bridge-contract.mjs +1 -1
  49. package/dist-lib/bundle-channel.cjs +26769 -24228
  50. package/dist-lib/capture-contract.cjs +2 -2
  51. package/dist-lib/capture-contract.mjs +1 -1
  52. package/dist-lib/cloud-contract.cjs +2 -2
  53. package/dist-lib/cloud-contract.mjs +1 -1
  54. package/dist-lib/cloud-test-args.cjs +2 -2
  55. package/dist-lib/cloud-test-args.mjs +1 -1
  56. package/dist-lib/cloud.cjs +3 -2
  57. package/dist-lib/cloud.mjs +2 -1
  58. package/dist-lib/config.cjs +2 -2
  59. package/dist-lib/config.mjs +1 -1
  60. package/dist-lib/detox/index.cjs +256 -14
  61. package/dist-lib/dev-bundle-resolution.cjs +209 -51
  62. package/dist-lib/expo-swift-bundle.cjs +10795 -17575
  63. package/dist-lib/expo-swift-metadata.cjs +2 -2
  64. package/dist-lib/expo-swift-metadata.mjs +1 -1
  65. package/dist-lib/home-paths.cjs +2 -2
  66. package/dist-lib/host/bridge-host.cjs +36893 -31765
  67. package/dist-lib/host/fetch-proxy-handler.cjs +796 -114
  68. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  69. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  70. package/dist-lib/host/replacement-module-handler.cjs +3 -2
  71. package/dist-lib/host/websocket-proxy.cjs +312 -46
  72. package/dist-lib/index.cjs +2244 -642
  73. package/dist-lib/jump-to-source-babel.cjs +2 -2
  74. package/dist-lib/jump-to-source-native.cjs +2 -2
  75. package/dist-lib/kotlin-host.cjs +2 -2
  76. package/dist-lib/menu.cjs +5 -2
  77. package/dist-lib/menu.mjs +3 -1
  78. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  79. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  80. package/dist-lib/metro-production-bundle.cjs +2 -2
  81. package/dist-lib/metro-production-bundle.mjs +1 -1
  82. package/dist-lib/metro.cjs +2088 -612
  83. package/dist-lib/native-app-identity-project.cjs +863 -232
  84. package/dist-lib/native-app-identity-project.mjs +871 -234
  85. package/dist-lib/native-app-identity.cjs +15 -2
  86. package/dist-lib/native-app-identity.mjs +12 -1
  87. package/dist-lib/native-firebase-metadata.cjs +2 -2
  88. package/dist-lib/native-firebase-metadata.mjs +1 -1
  89. package/dist-lib/plist.cjs +2 -2
  90. package/dist-lib/plist.mjs +1 -1
  91. package/dist-lib/profiles.cjs +2 -2
  92. package/dist-lib/public-brand.cjs +2 -2
  93. package/dist-lib/public-origins-lib-esm.json +31 -100
  94. package/dist-lib/public-origins-lib.json +449 -453
  95. package/dist-lib/react-native-host-modules.cjs +98 -4
  96. package/dist-lib/react-native-host-modules.mjs +96 -3
  97. package/dist-lib/reap-browser.cjs +2 -2
  98. package/dist-lib/scripts/dev-server-scanner.cjs +225 -75
  99. package/dist-lib/sdk.cjs +146 -19
  100. package/dist-lib/sdk.mjs +139 -18
  101. package/dist-lib/skills.cjs +53577 -48467
  102. package/dist-lib/swift-compile.cjs +6111 -16733
  103. package/dist-lib/swift-compile.mjs +6052 -16681
  104. package/dist-lib/swift-package.cjs +104 -22
  105. package/dist-lib/swift-package.mjs +99 -21
  106. package/dist-lib/swift-submit.cjs +15 -5
  107. package/dist-lib/swift-submit.mjs +14 -4
  108. package/dist-lib/swift-toolchain.cjs +42 -13
  109. package/dist-lib/swift.cjs +2 -2
  110. package/dist-lib/vite-swift.cjs +13416 -21189
  111. package/dist-lib/vite.cjs +790 -157
  112. package/dist-lib/worklet-executable.cjs +2 -2
  113. package/dist-lib/worklet-executable.mjs +1 -1
  114. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +2 -0
  115. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -1
  116. package/dist-types/packages/peach-engine/src/capture/lockstep-clockContract.d.ts +1 -0
  117. package/dist-types/packages/peach-engine/src/engine/fiber-debug-metadata.d.ts +4 -0
  118. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +2 -2
  119. package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +1 -0
  120. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
  121. package/dist-types/packages/peach-engine/src/engine/lottie-types.d.ts +3 -0
  122. package/dist-types/packages/peach-engine/src/engine/node.d.ts +6 -3
  123. package/dist-types/packages/peach-engine/src/engine/riveContract.d.ts +5 -0
  124. package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
  125. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
  126. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  127. package/dist-types/packages/peach-engine/src/guest-module-overrides.d.ts +3 -0
  128. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +2 -1
  129. package/dist-types/packages/peach-engine/src/permissions/system-permission-types.d.ts +2 -1
  130. package/dist-types/packages/peach-engine/src/react-native/host-services.d.ts +1 -0
  131. package/dist-types/packages/peach-engine/src/react-native/platform-colors.d.ts +1 -0
  132. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +6 -2
  133. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +4 -0
  134. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +16 -0
  135. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +18 -2
  136. package/dist-types/packages/peach-engine/src/render-worker/live-frame-mirror.d.ts +11 -0
  137. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +10 -1
  138. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +11 -0
  139. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
  140. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  141. package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +5 -0
  142. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +5 -0
  143. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
  144. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +5 -1
  145. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +9 -4
  146. package/dist-types/packages/peach-engine/src/render-worker/workletThreadIdentityContract.d.ts +4 -0
  147. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
  148. package/dist-types/packages/peach-globals/src/guestExecutionContract.d.ts +30 -0
  149. package/dist-types/packages/peach-globals/src/index.d.ts +6 -4
  150. package/dist-types/packages/peach-globals/src/nativeBuildOptionsContract.d.ts +1 -0
  151. package/dist-types/packages/peach-globals/src/permissionsBridgeContract.d.ts +11 -0
  152. package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +22 -1
  153. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
  154. package/dist-types/packages/peach-globals/src/sceneStreamBridgeContract.d.ts +10 -0
  155. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +9 -0
  156. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +3 -0
  157. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  158. package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
  159. package/package.json +3 -1
  160. package/runtime-companion.json +1 -1
  161. package/scripts/dev-server-scanner.ts +61 -70
  162. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
  163. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
  164. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
  165. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
  166. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
  167. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
  168. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
  169. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
  170. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
  171. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
  172. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
  173. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
  174. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
  175. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
  176. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
  177. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
  178. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
  179. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
  180. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
  181. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
  182. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
  183. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
  184. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
  185. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
  186. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
  187. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
  188. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
  189. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
  190. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
  191. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
  192. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
  193. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
  194. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
  195. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
  196. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
  197. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
  198. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
  199. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
  200. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
  201. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
  202. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
  203. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
  204. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
  205. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
  206. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
  207. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
  208. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
  209. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
  210. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
  211. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
  212. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
  213. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
  214. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBATTRequest.h +69 -0
  215. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBAdvertisementData.h +94 -0
  216. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBAttribute.h +34 -0
  217. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentral.h +41 -0
  218. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManager.h +394 -0
  219. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManagerConstants.h +224 -0
  220. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCharacteristic.h +187 -0
  221. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBDefines.h +16 -0
  222. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBDescriptor.h +78 -0
  223. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBError.h +75 -0
  224. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBL2CAPChannel.h +50 -0
  225. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBManager.h +88 -0
  226. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeer.h +28 -0
  227. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h +530 -0
  228. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheralManager.h +489 -0
  229. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheralManagerConstants.h +63 -0
  230. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBService.h +100 -0
  231. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBUUID.h +144 -0
  232. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CoreBluetooth.apinotes +7 -0
  233. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CoreBluetooth.h +32 -0
  234. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Modules/module.modulemap +5 -0
  235. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
  236. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
  237. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
  238. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCGTypes.h +131 -0
  239. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
  240. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
  241. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
  242. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
  243. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
  244. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
  245. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
  246. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
  247. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
  248. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
  249. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
  250. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
  251. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +13 -223
  252. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h +359 -2
  253. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h +328 -0
  254. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -66
  255. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/CoreNFC.apinotes +258 -0
  256. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/CoreNFC.h +31 -0
  257. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCError.h +103 -0
  258. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCFeliCaTag.h +267 -0
  259. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCISO15693ReaderSession.h +59 -0
  260. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCISO15693Tag.h +739 -0
  261. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCISO7816Tag.h +159 -0
  262. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCMiFareTag.h +94 -0
  263. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFMessage.h +60 -0
  264. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFPayload.h +121 -0
  265. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFReaderSession.h +169 -0
  266. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFTag.h +93 -0
  267. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCPaymentTagReaderSession.h +58 -0
  268. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCReaderSession.h +156 -0
  269. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCTag.h +127 -0
  270. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCTagReaderSession.h +201 -0
  271. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCVASReaderSession.h +237 -0
  272. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NSUserActivity+CoreNFC.h +35 -0
  273. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Modules/module.modulemap +21 -0
  274. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +53 -0
  275. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +45 -0
  276. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +87 -0
  277. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularData.h +39 -0
  278. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanProperties.h +46 -0
  279. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanProvisioning.h +33 -0
  280. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanProvisioningRequest.h +36 -0
  281. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanStatus.h +57 -0
  282. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTQuickSwitch.h +53 -0
  283. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +107 -0
  284. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +34 -0
  285. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h +161 -0
  286. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CoreTelephonyDefines.h +39 -0
  287. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Modules/module.modulemap +5 -0
  288. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTDefines.h +92 -0
  289. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h +634 -0
  290. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h +118 -0
  291. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h +1 -0
  292. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +2497 -0
  293. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2900 -370
  294. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAccessPoint.h +110 -0
  295. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievement.h +64 -0
  296. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievementDescription.h +88 -0
  297. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievementViewController.h +30 -0
  298. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKBasePlayer.h +15 -0
  299. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallenge.h +199 -0
  300. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallengeDefinition.h +71 -0
  301. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallengeEventHandler.h +43 -0
  302. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallengesViewController.h +33 -0
  303. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKCloudPlayer.h +19 -0
  304. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKDefines.h +17 -0
  305. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKDialogController.h +35 -0
  306. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKError.h +52 -0
  307. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKEventListener.h +36 -0
  308. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKFriendRequestComposeViewController.h +60 -0
  309. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivity.h +201 -0
  310. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityDefinition.h +98 -0
  311. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityListener.h +28 -0
  312. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityPlayStyle.h +17 -0
  313. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityState.h +22 -0
  314. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameCenterViewController.h +102 -0
  315. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSession.h +87 -0
  316. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSessionError.h +26 -0
  317. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSessionEventListener.h +25 -0
  318. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSessionSharingViewController.h +33 -0
  319. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboard.h +205 -0
  320. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardEntry.h +23 -0
  321. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardScore.h +25 -0
  322. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardSet.h +64 -0
  323. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardViewController.h +34 -0
  324. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLocalPlayer.h +321 -0
  325. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatch.h +94 -0
  326. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatchmaker.h +229 -0
  327. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatchmakerViewController.h +100 -0
  328. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKNotificationBanner.h +20 -0
  329. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPeerPickerController.h +93 -0
  330. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPlayer.h +82 -0
  331. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPublicConstants.h +57 -0
  332. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPublicProtocols.h +71 -0
  333. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKReleaseState.h +16 -0
  334. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSavedGame.h +41 -0
  335. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSavedGameListener.h +22 -0
  336. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKScore.h +73 -0
  337. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSession.h +87 -0
  338. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSessionError.h +30 -0
  339. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatch.h +314 -0
  340. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatchmakerViewController.h +69 -0
  341. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKVoiceChat.h +48 -0
  342. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKVoiceChatService.h +145 -0
  343. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GameKit.apinotes +307 -0
  344. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GameKit.h +79 -0
  345. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Modules/module.modulemap +6 -0
  346. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummary.h +122 -0
  347. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummaryQuery.h +48 -0
  348. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAnchoredObjectQuery.h +93 -0
  349. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAppleSleepingBreathingDisturbancesClassification.h +39 -0
  350. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAppleWalkingSteadinessClassification.h +49 -0
  351. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAttachment.h +74 -0
  352. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAttachmentStore.h +95 -0
  353. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSample.h +66 -0
  354. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSensitivityPoint.h +82 -0
  355. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSensitivityPointClampingRange.h +54 -0
  356. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSensitivityTest.h +101 -0
  357. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCDADocumentSample.h +131 -0
  358. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCategorySample.h +92 -0
  359. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCategoryValues.h +279 -0
  360. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCharacteristicObjects.h +79 -0
  361. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCharacteristicValues.h +87 -0
  362. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalCoding.h +55 -0
  363. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalRecord.h +53 -0
  364. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalType.h +68 -0
  365. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKContactsLensSpecification.h +59 -0
  366. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKContactsPrescription.h +74 -0
  367. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCorrelation.h +85 -0
  368. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCorrelationQuery.h +57 -0
  369. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCumulativeQuantitySample.h +36 -0
  370. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCumulativeQuantitySeriesSample.h +23 -0
  371. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDefines.h +114 -0
  372. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDeletedObject.h +40 -0
  373. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDevice.h +164 -0
  374. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDiscreteQuantitySample.h +67 -0
  375. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDocumentQuery.h +83 -0
  376. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDocumentSample.h +29 -0
  377. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKElectrocardiogram.h +109 -0
  378. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKElectrocardiogramQuery.h +68 -0
  379. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKFHIRRelease.h +35 -0
  380. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKFHIRResource.h +81 -0
  381. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKFHIRVersion.h +50 -0
  382. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKGAD7Assessment.h +73 -0
  383. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKGlassesLensSpecification.h +81 -0
  384. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKGlassesPrescription.h +66 -0
  385. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHealthConceptIdentifier.h +46 -0
  386. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHealthStore.h +470 -0
  387. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHeartbeatSeriesBuilder.h +104 -0
  388. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHeartbeatSeriesQuery.h +47 -0
  389. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHeartbeatSeriesSample.h +26 -0
  390. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLensSpecification.h +53 -0
  391. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLiveWorkoutBuilder.h +131 -0
  392. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLiveWorkoutDataSource.h +67 -0
  393. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLiveWorkoutZoneUpdate.h +25 -0
  394. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMedicationConcept.h +95 -0
  395. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMedicationDoseEvent.h +113 -0
  396. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMetadata.h +583 -0
  397. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMetadataEnums.h +250 -0
  398. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObject.h +64 -0
  399. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObjectType.h +294 -0
  400. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObserverQuery.h +48 -0
  401. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKPHQ9Assessment.h +77 -0
  402. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantity.h +55 -0
  403. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantityAggregationStyle.h +30 -0
  404. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySample.h +83 -0
  405. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySeriesSampleBuilder.h +184 -0
  406. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySeriesSampleQuery.h +90 -0
  407. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuery.h +722 -0
  408. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQueryAnchor.h +33 -0
  409. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQueryDescriptor.h +46 -0
  410. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSample.h +48 -0
  411. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSampleQuery.h +95 -0
  412. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKScoredAssessment.h +31 -0
  413. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSeriesBuilder.h +40 -0
  414. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSeriesSample.h +32 -0
  415. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSource.h +45 -0
  416. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSourceQuery.h +42 -0
  417. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSourceRevision.h +78 -0
  418. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStateOfMind.h +157 -0
  419. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatistics.h +166 -0
  420. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatisticsCollectionQuery.h +80 -0
  421. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatisticsQuery.h +37 -0
  422. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKTypeIdentifiers.h +359 -0
  423. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUnit.h +287 -0
  424. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUserAnnotatedMedication.h +60 -0
  425. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUserAnnotatedMedicationQuery.h +38 -0
  426. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVerifiableClinicalRecord.h +131 -0
  427. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVerifiableClinicalRecordQuery.h +76 -0
  428. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVerifiableClinicalRecordSubject.h +39 -0
  429. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVisionPrescription.h +76 -0
  430. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVisionPrism.h +123 -0
  431. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkout.h +341 -0
  432. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutActivity.h +127 -0
  433. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutActivityType.h +147 -0
  434. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutBuilder.h +264 -0
  435. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutConfiguration.h +62 -0
  436. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutEffortRelationshipQuery.h +80 -0
  437. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutRoute.h +20 -0
  438. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutRouteBuilder.h +102 -0
  439. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutRouteQuery.h +67 -0
  440. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutSession.h +364 -0
  441. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HealthKit.apinotes +5 -0
  442. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HealthKit.h +101 -0
  443. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Modules/module.modulemap +5 -0
  444. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAAudibleMedia.h +41 -0
  445. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MACaptionAppearance.h +406 -0
  446. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MADefinitions.h +38 -0
  447. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAFlashingLightsProcessing.h +53 -0
  448. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAImageCaptioning.h +55 -0
  449. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAMusicHaptics.h +69 -0
  450. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAVideoAccommodations.h +34 -0
  451. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MediaAccessibility.h +14 -0
  452. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Modules/module.modulemap +11 -0
  453. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyFlow.h +142 -0
  454. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyProvider.h +93 -0
  455. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyProviderManager.h +40 -0
  456. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyTCPFlow.h +63 -0
  457. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyUDPFlow.h +86 -0
  458. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppPushManager.h +208 -0
  459. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppPushProvider.h +87 -0
  460. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppRule.h +80 -0
  461. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSProxyManager.h +109 -0
  462. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSProxyProvider.h +98 -0
  463. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSProxyProviderProtocol.h +45 -0
  464. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSSettings.h +124 -0
  465. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSSettingsManager.h +116 -0
  466. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEEthernetTunnelNetworkSettings.h +45 -0
  467. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEEthernetTunnelProvider.h +31 -0
  468. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterControlProvider.h +80 -0
  469. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterDataProvider.h +235 -0
  470. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterFlow.h +177 -0
  471. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterManager.h +138 -0
  472. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterPacketProvider.h +99 -0
  473. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterProvider.h +335 -0
  474. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterProviderConfiguration.h +94 -0
  475. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterRule.h +46 -0
  476. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterSettings.h +56 -0
  477. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFlowMetaData.h +45 -0
  478. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotConfigurationManager.h +493 -0
  479. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotHelper.h +529 -0
  480. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotNetwork.h +87 -0
  481. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEIPv4Settings.h +122 -0
  482. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEIPv6Settings.h +121 -0
  483. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NENetworkRule.h +218 -0
  484. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEOnDemandRule.h +210 -0
  485. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacket.h +67 -0
  486. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacketTunnelFlow.h +62 -0
  487. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacketTunnelNetworkSettings.h +135 -0
  488. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacketTunnelProvider.h +97 -0
  489. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEProvider.h +160 -0
  490. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEProxySettings.h +140 -0
  491. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NERelay.h +83 -0
  492. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NERelayManager.h +195 -0
  493. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETransparentProxyManager.h +39 -0
  494. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETransparentProxyNetworkSettings.h +62 -0
  495. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETransparentProxyProvider.h +33 -0
  496. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelNetworkSettings.h +57 -0
  497. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProvider.h +113 -0
  498. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProviderManager.h +108 -0
  499. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProviderProtocol.h +44 -0
  500. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProviderSession.h +55 -0
  501. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEURLFilter.h +51 -0
  502. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNConnection.h +162 -0
  503. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNManager.h +153 -0
  504. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNProtocol.h +135 -0
  505. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNProtocolIKEv2.h +357 -0
  506. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNProtocolIPSec.h +71 -0
  507. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWBonjourServiceEndpoint.h +82 -0
  508. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWEndpoint.h +40 -0
  509. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWHostEndpoint.h +68 -0
  510. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWPath.h +93 -0
  511. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWTCPConnection.h +335 -0
  512. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWTLSParameters.h +70 -0
  513. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWUDPSession.h +207 -0
  514. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NetworkExtension.apinotes +351 -0
  515. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NetworkExtension.h +74 -0
  516. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Modules/module.modulemap +5 -0
  517. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
  518. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/ModelIO.h +84 -0
  519. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAction.h +197 -0
  520. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAnimation.h +428 -0
  521. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAudioSource.h +170 -0
  522. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNBoundingVolume.h +50 -0
  523. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCAAnimationExtensions.h +58 -0
  524. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCamera.h +356 -0
  525. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCameraController.h +124 -0
  526. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNConstraint.h +431 -0
  527. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNGeometry.h +591 -0
  528. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNHitTest.h +101 -0
  529. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNJavascript.h +58 -0
  530. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLevelOfDetail.h +56 -0
  531. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLight.h +350 -0
  532. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterial.h +349 -0
  533. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterialProperty.h +149 -0
  534. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMorpher.h +79 -0
  535. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNNode.h +695 -0
  536. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParametricGeometry.h +727 -0
  537. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParticleSystem.h +462 -0
  538. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsBehavior.h +219 -0
  539. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsBody.h +148 -0
  540. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsContact.h +34 -0
  541. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsField.h +124 -0
  542. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsShape.h +58 -0
  543. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsWorld.h +90 -0
  544. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNReferenceNode.h +80 -0
  545. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNRenderer.h +102 -0
  546. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNScene.h +250 -0
  547. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNSceneRenderer.h +389 -0
  548. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNSceneSource.h +348 -0
  549. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNShadable.h +573 -0
  550. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNSkinner.h +84 -0
  551. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTechnique.h +320 -0
  552. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTransaction.h +64 -0
  553. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNView.h +170 -0
  554. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.apinotes +423 -0
  555. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.h +58 -0
  556. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitAvailability.h +10 -0
  557. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitDeprecated.h +88 -0
  558. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitTypes.h +264 -0
  559. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/scn_metal +75 -0
  560. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Modules/module.modulemap +12 -0
  561. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/CipherSuite.h +281 -0
  562. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecAccessControl.h +133 -0
  563. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
  564. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
  565. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecIdentity.h +232 -0
  566. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
  567. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecKey.h +1616 -0
  568. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
  569. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolMetadata.h +429 -0
  570. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolObject.h +71 -0
  571. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolOptions.h +775 -0
  572. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h +327 -0
  573. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecRandom.h +84 -0
  574. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
  575. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +13 -0
  576. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +19 -0
  577. package/sdk/ios/usr/include/AvailabilityInternal.h +23 -0
  578. package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
  579. package/sdk/ios/usr/include/Block.h +56 -0
  580. package/sdk/ios/usr/include/CommonCrypto/CommonCrypto.h +34 -0
  581. package/sdk/ios/usr/include/CommonCrypto/CommonCryptoError.h +78 -0
  582. package/sdk/ios/usr/include/CommonCrypto/CommonCryptor.h +763 -0
  583. package/sdk/ios/usr/include/CommonCrypto/CommonDigest.h +254 -47
  584. package/sdk/ios/usr/include/CommonCrypto/CommonHMAC.h +162 -0
  585. package/sdk/ios/usr/include/CommonCrypto/CommonKeyDerivation.h +136 -0
  586. package/sdk/ios/usr/include/CommonCrypto/CommonRandom.h +63 -0
  587. package/sdk/ios/usr/include/CommonCrypto/CommonSymmetricKeywrap.h +162 -0
  588. package/sdk/ios/usr/include/CommonCrypto/module.modulemap +15 -0
  589. package/sdk/ios/usr/include/ObjectiveC.apinotes +437 -0
  590. package/sdk/ios/usr/include/TargetConditionals.h +525 -14
  591. package/sdk/ios/usr/include/___wctype.h +193 -0
  592. package/sdk/ios/usr/include/__wctype.h +43 -0
  593. package/sdk/ios/usr/include/_abort.h +36 -0
  594. package/sdk/ios/usr/include/_assert.h +80 -0
  595. package/sdk/ios/usr/include/_static_assert.h +33 -0
  596. package/sdk/ios/usr/include/_stdlib.h +403 -0
  597. package/sdk/ios/usr/include/_string.h +231 -0
  598. package/sdk/ios/usr/include/_strings.h +101 -0
  599. package/sdk/ios/usr/include/_types/_wctrans_t.h +33 -0
  600. package/sdk/ios/usr/include/_types/_wctype_t.h +33 -0
  601. package/sdk/ios/usr/include/_wchar.h +263 -0
  602. package/sdk/ios/usr/include/_wctype.h +129 -0
  603. package/sdk/ios/usr/include/_xlocale.h +47 -0
  604. package/sdk/ios/usr/include/alloca.h +46 -0
  605. package/sdk/ios/usr/include/architecture/byte_order.h +381 -0
  606. package/sdk/ios/usr/include/arm/_limits.h +13 -0
  607. package/sdk/ios/usr/include/arm/arch.h +71 -0
  608. package/sdk/ios/usr/include/arm/limits.h +136 -0
  609. package/sdk/ios/usr/include/arpa/inet.h +100 -0
  610. package/sdk/ios/usr/include/assert.h +77 -10
  611. package/sdk/ios/usr/include/bsm/audit.h +434 -0
  612. package/sdk/ios/usr/include/copyfile.h +143 -0
  613. package/sdk/ios/usr/include/crt_externs.h +50 -0
  614. package/sdk/ios/usr/include/dispatch/base.h +369 -0
  615. package/sdk/ios/usr/include/dispatch/block.h +509 -0
  616. package/sdk/ios/usr/include/dispatch/data.h +290 -0
  617. package/sdk/ios/usr/include/dispatch/dispatch.h +68 -172
  618. package/sdk/ios/usr/include/dispatch/dispatch_swift_shims.h +61 -0
  619. package/sdk/ios/usr/include/dispatch/group.h +289 -0
  620. package/sdk/ios/usr/include/dispatch/introspection.h +190 -0
  621. package/sdk/ios/usr/include/dispatch/io.h +617 -0
  622. package/sdk/ios/usr/include/dispatch/object.h +680 -0
  623. package/sdk/ios/usr/include/dispatch/once.h +128 -0
  624. package/sdk/ios/usr/include/dispatch/queue.h +1824 -0
  625. package/sdk/ios/usr/include/dispatch/semaphore.h +124 -0
  626. package/sdk/ios/usr/include/dispatch/source.h +803 -0
  627. package/sdk/ios/usr/include/dispatch/time.h +144 -0
  628. package/sdk/ios/usr/include/dispatch/workloop.h +178 -0
  629. package/sdk/ios/usr/include/dlfcn.h +320 -7
  630. package/sdk/ios/usr/include/execinfo.h +100 -10
  631. package/sdk/ios/usr/include/ftw.h +63 -0
  632. package/sdk/ios/usr/include/gethostuuid.h +45 -0
  633. package/sdk/ios/usr/include/libkern/arm/OSByteOrder.h +195 -0
  634. package/sdk/ios/usr/include/limits.h +167 -4
  635. package/sdk/ios/usr/include/mach/arm/boolean.h +74 -0
  636. package/sdk/ios/usr/include/mach/arm/exception.h +86 -0
  637. package/sdk/ios/usr/include/mach/arm/kern_return.h +78 -0
  638. package/sdk/ios/usr/include/mach/arm/processor_info.h +76 -0
  639. package/sdk/ios/usr/include/mach/arm/rpc.h +39 -0
  640. package/sdk/ios/usr/include/mach/arm/thread_state.h +42 -0
  641. package/sdk/ios/usr/include/mach/arm/thread_status.h +302 -0
  642. package/sdk/ios/usr/include/mach/arm/vm_param.h +118 -0
  643. package/sdk/ios/usr/include/mach/arm/vm_types.h +162 -0
  644. package/sdk/ios/usr/include/mach/boolean.h +88 -4
  645. package/sdk/ios/usr/include/mach/clock.h +249 -0
  646. package/sdk/ios/usr/include/mach/clock_priv.h +203 -0
  647. package/sdk/ios/usr/include/mach/clock_types.h +127 -0
  648. package/sdk/ios/usr/include/mach/dyld_kernel.h +66 -0
  649. package/sdk/ios/usr/include/mach/error.h +117 -0
  650. package/sdk/ios/usr/include/mach/exc.h +285 -0
  651. package/sdk/ios/usr/include/mach/exception_types.h +204 -25
  652. package/sdk/ios/usr/include/mach/host_info.h +136 -51
  653. package/sdk/ios/usr/include/mach/host_notify.h +39 -0
  654. package/sdk/ios/usr/include/mach/host_priv.h +1167 -0
  655. package/sdk/ios/usr/include/mach/host_security.h +225 -0
  656. package/sdk/ios/usr/include/mach/host_special_ports.h +315 -0
  657. package/sdk/ios/usr/include/mach/kern_return.h +291 -2
  658. package/sdk/ios/usr/include/mach/kmod.h +180 -0
  659. package/sdk/ios/usr/include/mach/mach.h +237 -12
  660. package/sdk/ios/usr/include/mach/mach_error.h +93 -10
  661. package/sdk/ios/usr/include/mach/mach_host.h +1329 -5
  662. package/sdk/ios/usr/include/mach/mach_init.h +112 -13
  663. package/sdk/ios/usr/include/mach/mach_interface.h +52 -0
  664. package/sdk/ios/usr/include/mach/mach_port.h +1935 -4
  665. package/sdk/ios/usr/include/mach/mach_time.h +77 -14
  666. package/sdk/ios/usr/include/mach/mach_traps.h +311 -0
  667. package/sdk/ios/usr/include/mach/mach_types.h +297 -20
  668. package/sdk/ios/usr/include/mach/mach_voucher_types.h +259 -0
  669. package/sdk/ios/usr/include/mach/machine/boolean.h +40 -0
  670. package/sdk/ios/usr/include/mach/machine/exception.h +40 -0
  671. package/sdk/ios/usr/include/mach/machine/kern_return.h +40 -0
  672. package/sdk/ios/usr/include/mach/machine/processor_info.h +40 -0
  673. package/sdk/ios/usr/include/mach/machine/rpc.h +40 -0
  674. package/sdk/ios/usr/include/mach/machine/thread_state.h +44 -0
  675. package/sdk/ios/usr/include/mach/machine/thread_status.h +40 -0
  676. package/sdk/ios/usr/include/mach/machine/vm_param.h +40 -0
  677. package/sdk/ios/usr/include/mach/machine/vm_types.h +40 -0
  678. package/sdk/ios/usr/include/mach/machine.h +456 -142
  679. package/sdk/ios/usr/include/mach/memory_object_types.h +312 -0
  680. package/sdk/ios/usr/include/mach/message.h +972 -0
  681. package/sdk/ios/usr/include/mach/mig.h +180 -0
  682. package/sdk/ios/usr/include/mach/mig_errors.h +125 -0
  683. package/sdk/ios/usr/include/mach/mig_strncpy_zerofill_support.h +35 -0
  684. package/sdk/ios/usr/include/mach/ndr.h +207 -0
  685. package/sdk/ios/usr/include/mach/notify.h +141 -0
  686. package/sdk/ios/usr/include/mach/policy.h +235 -0
  687. package/sdk/ios/usr/include/mach/port.h +648 -0
  688. package/sdk/ios/usr/include/mach/processor.h +364 -0
  689. package/sdk/ios/usr/include/mach/processor_info.h +171 -0
  690. package/sdk/ios/usr/include/mach/processor_set.h +589 -0
  691. package/sdk/ios/usr/include/mach/rpc.h +135 -0
  692. package/sdk/ios/usr/include/mach/semaphore.h +78 -0
  693. package/sdk/ios/usr/include/mach/std_types.h +75 -0
  694. package/sdk/ios/usr/include/mach/sync_policy.h +47 -0
  695. package/sdk/ios/usr/include/mach/task.h +2887 -7
  696. package/sdk/ios/usr/include/mach/task_info.h +584 -19
  697. package/sdk/ios/usr/include/mach/task_inspect.h +57 -0
  698. package/sdk/ios/usr/include/mach/task_policy.h +182 -26
  699. package/sdk/ios/usr/include/mach/task_special_ports.h +135 -0
  700. package/sdk/ios/usr/include/mach/thread_act.h +1550 -5
  701. package/sdk/ios/usr/include/mach/thread_info.h +206 -28
  702. package/sdk/ios/usr/include/mach/thread_policy.h +268 -0
  703. package/sdk/ios/usr/include/mach/thread_special_ports.h +87 -0
  704. package/sdk/ios/usr/include/mach/thread_status.h +100 -0
  705. package/sdk/ios/usr/include/mach/thread_switch.h +77 -0
  706. package/sdk/ios/usr/include/mach/time_value.h +96 -4
  707. package/sdk/ios/usr/include/mach/vm_attributes.h +99 -0
  708. package/sdk/ios/usr/include/mach/vm_behavior.h +86 -0
  709. package/sdk/ios/usr/include/mach/vm_inherit.h +93 -0
  710. package/sdk/ios/usr/include/mach/vm_map.h +1558 -0
  711. package/sdk/ios/usr/include/mach/vm_page_size.h +68 -0
  712. package/sdk/ios/usr/include/mach/vm_prot.h +183 -7
  713. package/sdk/ios/usr/include/mach/vm_purgable.h +166 -0
  714. package/sdk/ios/usr/include/mach/vm_region.h +400 -36
  715. package/sdk/ios/usr/include/mach/vm_statistics.h +387 -96
  716. package/sdk/ios/usr/include/mach/vm_sync.h +84 -0
  717. package/sdk/ios/usr/include/mach/vm_types.h +194 -7
  718. package/sdk/ios/usr/include/mach-o/arch.h +154 -16
  719. package/sdk/ios/usr/include/mach-o/fat.h +89 -0
  720. package/sdk/ios/usr/include/mach-o/getsect.h +146 -12
  721. package/sdk/ios/usr/include/mach-o/loader.h +1679 -139
  722. package/sdk/ios/usr/include/mach_debug/hash_info.h +75 -0
  723. package/sdk/ios/usr/include/mach_debug/ipc_info.h +199 -0
  724. package/sdk/ios/usr/include/mach_debug/lockgroup_info.h +74 -0
  725. package/sdk/ios/usr/include/mach_debug/mach_debug_types.h +200 -0
  726. package/sdk/ios/usr/include/mach_debug/page_info.h +64 -0
  727. package/sdk/ios/usr/include/mach_debug/vm_info.h +149 -0
  728. package/sdk/ios/usr/include/mach_debug/zone_info.h +209 -0
  729. package/sdk/ios/usr/include/machine/limits.h +14 -0
  730. package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
  731. package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
  732. package/sdk/ios/usr/include/malloc/_platform.h +80 -0
  733. package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
  734. package/sdk/ios/usr/include/malloc/malloc.h +768 -0
  735. package/sdk/ios/usr/include/module.modulemap +4 -0
  736. package/sdk/ios/usr/include/net/if_types.h +152 -0
  737. package/sdk/ios/usr/include/objc/NSObjCRuntime.h +10 -0
  738. package/sdk/ios/usr/include/objc/NSObject.h +23 -25
  739. package/sdk/ios/usr/include/objc/objc-api.h +310 -0
  740. package/sdk/ios/usr/include/objc/objc.h +243 -0
  741. package/sdk/ios/usr/include/objc/runtime.h +1933 -0
  742. package/sdk/ios/usr/include/os/availability.h +168 -6
  743. package/sdk/ios/usr/include/os/base.h +351 -0
  744. package/sdk/ios/usr/include/os/clock.h +18 -0
  745. package/sdk/ios/usr/include/os/lock.h +232 -10
  746. package/sdk/ios/usr/include/os/log.h +521 -38
  747. package/sdk/ios/usr/include/os/object.h +320 -3
  748. package/sdk/ios/usr/include/os/trace.h +492 -0
  749. package/sdk/ios/usr/include/os/trace_base.h +167 -0
  750. package/sdk/ios/usr/include/os/workgroup.h +37 -0
  751. package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
  752. package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
  753. package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
  754. package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
  755. package/sdk/ios/usr/include/os.modulemap +6 -0
  756. package/sdk/ios/usr/include/pthread/pthread_impl.h +66 -0
  757. package/sdk/ios/usr/include/pthread/sched.h +46 -0
  758. package/sdk/ios/usr/include/pthread.h +754 -4
  759. package/sdk/ios/usr/include/pwd.h +119 -0
  760. package/sdk/ios/usr/include/sched.h +46 -0
  761. package/sdk/ios/usr/include/secure/_string.h +295 -0
  762. package/sdk/ios/usr/include/secure/_strings.h +96 -0
  763. package/sdk/ios/usr/include/spawn.h +193 -0
  764. package/sdk/ios/usr/include/stddef.h +90 -0
  765. package/sdk/ios/usr/include/stdlib.h +62 -17
  766. package/sdk/ios/usr/include/string.h +62 -8
  767. package/sdk/ios/usr/include/sys/_pthread/_pthread_cond_t.h +32 -0
  768. package/sdk/ios/usr/include/sys/_pthread/_pthread_condattr_t.h +32 -0
  769. package/sdk/ios/usr/include/sys/_pthread/_pthread_key_t.h +32 -0
  770. package/sdk/ios/usr/include/sys/_pthread/_pthread_mutex_t.h +32 -0
  771. package/sdk/ios/usr/include/sys/_pthread/_pthread_mutexattr_t.h +32 -0
  772. package/sdk/ios/usr/include/sys/_pthread/_pthread_once_t.h +32 -0
  773. package/sdk/ios/usr/include/sys/_pthread/_pthread_rwlock_t.h +32 -0
  774. package/sdk/ios/usr/include/sys/_pthread/_pthread_rwlockattr_t.h +32 -0
  775. package/sdk/ios/usr/include/sys/_select.h +57 -0
  776. package/sdk/ios/usr/include/sys/_types/_blkcnt_t.h +32 -0
  777. package/sdk/ios/usr/include/sys/_types/_blksize_t.h +32 -0
  778. package/sdk/ios/usr/include/sys/_types/_caddr_t.h +32 -0
  779. package/sdk/ios/usr/include/sys/_types/_dev_t.h +32 -0
  780. package/sdk/ios/usr/include/sys/_types/_fsblkcnt_t.h +32 -0
  781. package/sdk/ios/usr/include/sys/_types/_fsfilcnt_t.h +32 -0
  782. package/sdk/ios/usr/include/sys/_types/_fsid_t.h +32 -0
  783. package/sdk/ios/usr/include/sys/_types/_fsobj_id_t.h +38 -0
  784. package/sdk/ios/usr/include/sys/_types/_graftdmg_un.h +64 -0
  785. package/sdk/ios/usr/include/sys/_types/_guid_t.h +37 -0
  786. package/sdk/ios/usr/include/sys/_types/_id_t.h +32 -0
  787. package/sdk/ios/usr/include/sys/_types/_ino64_t.h +32 -0
  788. package/sdk/ios/usr/include/sys/_types/_key_t.h +32 -0
  789. package/sdk/ios/usr/include/sys/_types/_mach_port_t.h +51 -0
  790. package/sdk/ios/usr/include/sys/_types/_mbstate_t.h +33 -0
  791. package/sdk/ios/usr/include/sys/_types/_mount_t.h +34 -0
  792. package/sdk/ios/usr/include/sys/_types/_nlink_t.h +32 -0
  793. package/sdk/ios/usr/include/sys/_types/_os_inline.h +34 -0
  794. package/sdk/ios/usr/include/sys/_types/_posix_vdisable.h +30 -0
  795. package/sdk/ios/usr/include/sys/_types/_rsize_t.h +55 -0
  796. package/sdk/ios/usr/include/sys/_types/_suseconds_t.h +32 -0
  797. package/sdk/ios/usr/include/sys/_types/_timeval.h +39 -0
  798. package/sdk/ios/usr/include/sys/_types/_u_char.h +31 -0
  799. package/sdk/ios/usr/include/sys/_types/_u_int.h +31 -0
  800. package/sdk/ios/usr/include/sys/_types/_u_short.h +31 -0
  801. package/sdk/ios/usr/include/sys/_types/_useconds_t.h +32 -0
  802. package/sdk/ios/usr/include/sys/_types/_uuid_t.h +32 -0
  803. package/sdk/ios/usr/include/sys/_types/_vnode_t.h +34 -0
  804. package/sdk/ios/usr/include/sys/acl.h +215 -0
  805. package/sdk/ios/usr/include/sys/attr.h +635 -0
  806. package/sdk/ios/usr/include/sys/cdefs.h +53 -0
  807. package/sdk/ios/usr/include/sys/event.h +388 -0
  808. package/sdk/ios/usr/include/sys/kauth.h +409 -0
  809. package/sdk/ios/usr/include/sys/mount.h +470 -0
  810. package/sdk/ios/usr/include/sys/queue.h +909 -0
  811. package/sdk/ios/usr/include/sys/resource.h +600 -0
  812. package/sdk/ios/usr/include/sys/select.h +134 -0
  813. package/sdk/ios/usr/include/sys/spawn.h +84 -0
  814. package/sdk/ios/usr/include/sys/sysctl.h +803 -57
  815. package/sdk/ios/usr/include/sys/syslimits.h +131 -11
  816. package/sdk/ios/usr/include/sys/types.h +236 -19
  817. package/sdk/ios/usr/include/sys/ucred.h +116 -0
  818. package/sdk/ios/usr/include/sys/un.h +105 -0
  819. package/sdk/ios/usr/include/sys/unistd.h +225 -0
  820. package/sdk/ios/usr/include/sys/vm.h +89 -0
  821. package/sdk/ios/usr/include/sys/wait.h +256 -0
  822. package/sdk/ios/usr/include/sysdir.h +79 -0
  823. package/sdk/ios/usr/include/unistd.h +799 -3
  824. package/sdk/ios/usr/include/uuid/uuid.h +69 -10
  825. package/sdk/ios/usr/include/wchar.h +71 -0
  826. package/sdk/ios/usr/include/wctype.h +35 -0
  827. package/sdk/ios/usr/include/xlocale/___wctype.h +146 -0
  828. package/sdk/ios/usr/include/xlocale/_ctype.h +240 -0
  829. package/sdk/ios/usr/include/xlocale/_stdlib.h +77 -0
  830. package/sdk/ios/usr/include/xlocale/_string.h +43 -0
  831. package/sdk/ios/usr/include/xlocale/_wchar.h +160 -0
  832. package/sdk/ios/usr/include/xlocale/_wctype.h +100 -0
  833. package/sdk/ios/usr/include/xlocale.h +61 -0
  834. package/sdk/ios/usr/include/xpc/availability.h +141 -0
  835. package/sdk/ios/usr/include/xpc/base.h +243 -0
  836. package/sdk/ios/wasm/include/AvailabilityInternal.h +24 -0
  837. package/sdk/ios/wasm/include/TargetConditionals.h +529 -0
  838. package/sdk/ios/wasm/include/_locale.h +3 -0
  839. package/sdk/ios/wasm/include/_locale_posix2008.h +3 -0
  840. package/sdk/ios/wasm/include/_types/_locale_t.h +3 -0
  841. package/sdk/ios/wasm/include/arpa/inet.h +15 -0
  842. package/sdk/ios/wasm/include/dirent.h +52 -0
  843. package/sdk/ios/wasm/include/dlfcn.h +13 -1
  844. package/sdk/ios/wasm/include/errno.h +22 -0
  845. package/sdk/ios/wasm/include/fcntl.h +29 -0
  846. package/sdk/ios/wasm/include/ftw.h +15 -0
  847. package/sdk/ios/wasm/include/libkern/_OSByteOrder.h +6 -0
  848. package/sdk/ios/wasm/include/limits.h +9 -0
  849. package/sdk/ios/wasm/include/mach/machine/boolean.h +1 -1
  850. package/sdk/ios/wasm/include/mach/machine/exception.h +1 -4
  851. package/sdk/ios/wasm/include/mach/machine/kern_return.h +1 -1
  852. package/sdk/ios/wasm/include/mach/machine/processor_info.h +1 -1
  853. package/sdk/ios/wasm/include/mach/machine/rpc.h +1 -1
  854. package/sdk/ios/wasm/include/mach/machine/thread_state.h +1 -2
  855. package/sdk/ios/wasm/include/mach/machine/thread_status.h +1 -2
  856. package/sdk/ios/wasm/include/mach/machine/vm_param.h +1 -2
  857. package/sdk/ios/wasm/include/mach/machine/vm_types.h +1 -17
  858. package/sdk/ios/wasm/include/machine/_endian.h +2 -0
  859. package/sdk/ios/wasm/include/machine/_param.h +2 -0
  860. package/sdk/ios/wasm/include/machine/endian.h +1 -1
  861. package/sdk/ios/wasm/include/machine/limits.h +106 -2
  862. package/sdk/ios/wasm/include/machine/param.h +152 -0
  863. package/sdk/ios/wasm/include/netinet/in.h +11 -0
  864. package/sdk/ios/wasm/include/os/object.h +10 -0
  865. package/sdk/ios/wasm/include/pthread.h +14 -0
  866. package/sdk/ios/wasm/include/stdio.h +12 -0
  867. package/sdk/ios/wasm/include/stdlib.h +13 -0
  868. package/sdk/ios/wasm/include/strings.h +9 -0
  869. package/sdk/ios/wasm/include/sys/_types/_iovec_t.h +6 -0
  870. package/sdk/ios/wasm/include/sys/_types/_mode_t.h +10 -0
  871. package/sdk/ios/wasm/include/sys/mman.h +2 -2
  872. package/sdk/ios/wasm/include/sys/param.h +4 -0
  873. package/sdk/ios/wasm/include/sys/resource.h +43 -0
  874. package/sdk/ios/wasm/include/sys/socket.h +75 -9
  875. package/sdk/ios/wasm/include/sys/stat.h +63 -0
  876. package/sdk/ios/wasm/include/sys/types.h +13 -0
  877. package/sdk/ios/wasm/include/sys/un.h +7 -0
  878. package/sdk/ios/wasm/include/time.h +3 -1
  879. package/sdk/ios/wasm/include/unistd.h +19 -3
  880. package/sdk/ios/wasm/include/xlocale/_stdlib.h +37 -0
  881. package/sdk/ios/wasm/storage-include/TargetConditionals.h +529 -0
  882. package/sdk/ios/wasm/storage-include/mach/machine/boolean.h +2 -0
  883. package/sdk/ios/wasm/storage-include/mach/machine/exception.h +5 -0
  884. package/sdk/ios/wasm/storage-include/mach/machine/kern_return.h +2 -0
  885. package/sdk/ios/wasm/storage-include/mach/machine/processor_info.h +2 -0
  886. package/sdk/ios/wasm/storage-include/mach/machine/rpc.h +2 -0
  887. package/sdk/ios/wasm/storage-include/mach/machine/thread_state.h +3 -0
  888. package/sdk/ios/wasm/storage-include/mach/machine/thread_status.h +3 -0
  889. package/sdk/ios/wasm/storage-include/mach/machine/vm_param.h +3 -0
  890. package/sdk/ios/wasm/storage-include/mach/machine/vm_types.h +18 -0
  891. package/sdk/ios/wasm/storage-include/machine/_endian.h +9 -0
  892. package/sdk/ios/wasm/storage-include/machine/_param.h +8 -0
  893. package/sdk/ios/wasm/storage-include/machine/_types.h +31 -0
  894. package/sdk/ios/wasm/storage-include/machine/endian.h +2 -0
  895. package/sdk/ios/wasm/storage-include/machine/limits.h +2 -0
  896. package/sdk/ios/wasm/storage-include/machine/types.h +15 -0
  897. package/sdk/native-hashes.json +80 -0
  898. package/skills/contrast/SKILL.md +4 -1
  899. package/src/android-root-module.ts +145 -0
  900. package/src/androidRootModuleContract.ts +39 -0
  901. package/src/assetCatalogContract.ts +10 -1
  902. package/src/backend-origin.ts +11 -8
  903. package/src/bridge-constants.ts +7 -0
  904. package/src/bridge-contract.ts +3 -1
  905. package/src/capture-contract.ts +3 -1
  906. package/src/cli-runtime.ts +6 -1
  907. package/src/codex-client.ts +11 -6
  908. package/src/dev-bundle-resolution.ts +124 -48
  909. package/src/device-catalog.ts +10 -4
  910. package/src/expo-discovery-cache.ts +272 -0
  911. package/src/expo-native-workspace.ts +207 -0
  912. package/src/expo-swift-host.ts +824 -33
  913. package/src/expo-swift-ready.ts +56 -38
  914. package/src/expoSwiftContract.ts +4 -1
  915. package/src/generated/swift-c-predefines.json +69 -13
  916. package/src/host/bridge-host.ts +33 -0
  917. package/src/host/fetch-proxy-handler.ts +19 -1
  918. package/src/host/network-policy-proxy.ts +421 -0
  919. package/src/host/network-policy.ts +121 -0
  920. package/src/host/staged-host-files.ts +80 -3
  921. package/src/host/websocket-frame-guard.ts +163 -0
  922. package/src/host/websocket-proxy-headers.ts +29 -0
  923. package/src/host/websocket-proxy.ts +100 -58
  924. package/src/installed-native-build-options.ts +154 -0
  925. package/src/installed-package-versions.ts +70 -50
  926. package/src/material-symbol-fonts.ts +6 -4
  927. package/src/menu.ts +6 -0
  928. package/src/metro-plugin.ts +8 -0
  929. package/src/metro-project-root.ts +44 -33
  930. package/src/native-app-identity-project.ts +5 -0
  931. package/src/native-app-identity.ts +16 -0
  932. package/src/native-dev-bundle-url.ts +0 -18
  933. package/src/native-firebase-config.ts +47 -4
  934. package/src/native-preparation.ts +30 -0
  935. package/src/nativePreparationContract.ts +3 -0
  936. package/src/nitro-adapter.lock.json +1072 -14
  937. package/src/nitro-adapter.ts +33 -24
  938. package/src/nitro-bundle.ts +132 -22
  939. package/src/nitro-compile.ts +47 -7
  940. package/src/nitro-dependencies.ts +226 -0
  941. package/src/nitro-source.ts +200 -40
  942. package/src/nitroAdapterContract.ts +100 -20
  943. package/src/node-http-fetch.ts +116 -0
  944. package/src/packageVersionsContract.ts +79 -0
  945. package/src/react-native-bridge-modules.ts +24 -1
  946. package/src/react-native-host-modules.ts +111 -4
  947. package/src/runtime-assets.ts +10 -0
  948. package/src/serverDiscoveryContract.ts +1 -0
  949. package/src/settingsContract.ts +0 -30
  950. package/src/sim-client.ts +1 -1
  951. package/src/storageSnapshotContract.ts +22 -10
  952. package/src/stub-pattern-matcher.ts +17 -4
  953. package/src/swift-binary-modules.ts +20 -5
  954. package/src/swift-compile.ts +1292 -4123
  955. package/src/swift-compiler-digest.ts +1 -2
  956. package/src/swift-coverage/package.ts +103 -58
  957. package/src/swift-coverage/xcode-assets.ts +26 -5
  958. package/src/swift-coverage/xcode-bridging.ts +1 -12
  959. package/src/swift-coverage/xcode-packages.ts +167 -52
  960. package/src/swift-coverage/xcode.ts +2 -6
  961. package/src/swift-cxx-declarations.ts +205 -0
  962. package/src/swift-cxx-deps.ts +48 -0
  963. package/src/swift-cxx-reachable.ts +297 -0
  964. package/src/swift-cxx-standin.ts +248 -0
  965. package/src/swift-distribution.lock.json +29 -20
  966. package/src/swift-host.ts +229 -24
  967. package/src/swift-objc-compile.ts +638 -219
  968. package/src/swift-objc-import.ts +19 -964
  969. package/src/swift-objc-platform.ts +2 -2
  970. package/src/swift-objc-runtime.ts +7 -0
  971. package/src/swift-objc-standin.ts +314 -64
  972. package/src/swift-package-manifest.ts +179 -38
  973. package/src/swift-package.ts +156 -29
  974. package/src/swift-packages.ts +193 -34
  975. package/src/swift-pdf-raster.ts +114 -0
  976. package/src/swift-shared-sdk.ts +45 -0
  977. package/src/swift-source-file.ts +10 -6
  978. package/src/swift-source-pods.ts +126 -41
  979. package/src/swift-standin-digest.ts +74 -0
  980. package/src/swift-standin-emit.ts +48 -4
  981. package/src/swift-standins.ts +334 -92
  982. package/src/swift-submit.ts +24 -6
  983. package/src/swift-toolchain.ts +49 -9
  984. package/src/swiftContract.ts +58 -29
  985. package/src/vite-plugin.ts +0 -23
  986. package/src/workspace-root.ts +15 -0
  987. package/src/xcode-json-project.ts +52 -1
  988. package/src/xcode-project.ts +355 -65
  989. package/src/settings-flags.ts +0 -107
  990. package/src/swift-objc-export.ts +0 -532
  991. package/src/swift-objc-metadata.ts +0 -534
@@ -1,11 +1,4244 @@
1
- #ifndef VIMAGE_CONVOLUTION
2
- #define VIMAGE_CONVOLUTION
3
- #include <vImage/vImage_Types.h>
1
+ /*!
2
+ * @header Convolution.h
3
+ * vImage_Framework
4
+ *
5
+ * See vImage/vImage.h for more on how to view the headerdoc documentation for functions declared herein.
6
+ *
7
+ * @copyright Copyright (c) 2002-2020 by Apple Inc. All rights reserved.
8
+ *
9
+ * @discussion Convolution is a weighted average between a pixel and its neighboring pixels. By smoothing
10
+ * out high frequency signal, convolution can be used to blur an image. By subtracting out the
11
+ * low frequency signal, it can be used to produce a sharpening effect. Convolution is also used
12
+ * with a variety of filters such as Laplace and Sobel to detect edges in the image. Here we also
13
+ * provide a deconvolution filter that attempts to iteratively undo the effect of a convolution.
14
+ * Where the convolution kernel can be accurately determined, it can be used to remove focus
15
+ * problems, motion blur and distortion introduced by the lens.
16
+ *
17
+ * <pre>@textblock
18
+ * =========================================================================
19
+ * ====== MOST VIMAGE CONVOLUTION FUNCTIONS DO NOT WORK IN PLACE =====
20
+ * =========================================================================
21
+ * @/textblock </pre>
22
+ *
23
+ * Since a weighted average of nearby pixels can for some positions extend off the edge of the
24
+ * input image, a variety of edging modes are provided which specify what happens in such
25
+ * cases:
26
+ * <pre>@textblock
27
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
28
+ * copy the corresponding source pixel to the destination. This
29
+ * will result in a ring off unconvolved content at the edges
30
+ * and convolved content in the middle.
31
+ *
32
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
33
+ * For a blur filter this will look like the edges of the image
34
+ * have been blurred into a particular color. This is usually
35
+ * appropriate when the color of the surface onto which the image
36
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
37
+ * as a background color, and let the downstream image compositor
38
+ * blend in the background color. In this case, the result image
39
+ * should be treated as a premultiplied image.
40
+ *
41
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
42
+ * This is better when the image is drawn into a frame or other
43
+ * context where the background is not expected to contribute to
44
+ * the final content.
45
+ *
46
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
47
+ * simply ignored, and the bias and divisor are adjusted accordingly.
48
+ * Because of the complication at the edges, this edging mode can
49
+ * be significantly slower than the others. It can be numerically
50
+ * unstable if the sum over any rectangular subsection of the kernel
51
+ * is zero, which can result in division by zero during the computation.
52
+ * The results for this edging mode are usually quite visually similar
53
+ * to kvImageEdgeExtend.
54
+ * @/textblock </pre>
55
+ * Only one edging mode may be active at a time. Please see the Convolution section in
56
+ * the vImage Programming Guide for a better description of edging modes.
57
+ * (https://developer.apple.com/library/ios/documentation/Performance/Conceptual/vImage/vImage.pdf)
58
+ *
59
+ *
60
+ * When calling these interfaces from within the context of your own tiling engine,
61
+ * it may be necessary to produce a result tile starting from different points in the
62
+ * input image. Simply repackaging the input image by adjusting the height, width and
63
+ * src->data to achieve this affect will not work correctly because it introduces
64
+ * artificial edges into the input image. (See discussion of edging modes above.)
65
+ * Instead, X and Y offset parameters are provided. Simply pass in the whole input image
66
+ * and use the X and Y offsets to adjust the position of the content used to produce
67
+ * the output image. The size of the output tile is given by the dest->height and width.
68
+ *
69
+ * @ignorefuncmacro VIMAGE_NON_NULL
70
+ */
71
+
72
+
73
+ #ifndef VIMAGE_CONVOLUTION_H
74
+ #define VIMAGE_CONVOLUTION_H
75
+
76
+
4
77
  #ifdef __cplusplus
5
78
  extern "C" {
6
79
  #endif
80
+
81
+ #include <vImage/vImage_Types.h>
82
+
83
+ /*!
84
+ * @functiongroup General Convolution
85
+ * @discussion A general convolve filter allows you to provide an arbitrary set of weights to use
86
+ * in the weighted average between each pixel and its neighbors. As such, it is a
87
+ * very flexible tool for achieving a variety of image effects, from blurring to sharpening
88
+ * to edge detection to sub-pixel image translation and motion blur.
89
+ *
90
+ * Some filters such as edge detection filters take the first derivative of the image
91
+ * surface. Since a derivative can be either positive or negative and some formats such
92
+ * as Planar8 (unorm8) can only represent positive numbers, the general convolution is also
93
+ * available in a form which allows you to provide a bias to add to the weighted sum before
94
+ * the divisor is applied, to shift the values into the positive. You might provide a
95
+ * bias of 128 * divisor to move the encoding for 0 to 128 so that negative numbers are
96
+ * representable, for example. (In this case, -20 would now be encoded as 128-20=108.)
97
+ *
98
+ * Finally, vImage provides multikernel convolution, which allows a different kernel, bias
99
+ * and divisor to be used for each color channel. This might allow for the position of the
100
+ * different color channels to be shifted independently, or for alpha to be blurred differently
101
+ * from color.
102
+ * <pre>@textblock
103
+ * =========================================================================
104
+ * ====== MOST VIMAGE CONVOLUTION FUNCTIONS DO NOT WORK IN PLACE =====
105
+ * =========================================================================
106
+ * @/textblock </pre>
107
+ */
108
+
109
+ /*!
110
+ * @function vImageConvolve_Planar8
111
+ * @abstract General convolution on a Planar8 image.
112
+ * @discussion This filter applies a convolution filter of your choosing to a Planar8 image.
113
+ * For each pixel:
114
+ * <pre>@textblock
115
+ * for each pixel[y][x] in image{
116
+ * int sum = 0;
117
+ *
118
+ * // Calculate weighted average over kernel area
119
+ * for each kernel_element[i][j] in kernel{
120
+ * sum += kernel_element[i][j] *
121
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
122
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
123
+ * }
124
+ * // Correct for the scaling introduced by multiplying by the weights table
125
+ * sum = (sum + divisor/2) / divisor;
126
+ *
127
+ * // write out result
128
+ * result[y][x] = CLAMP(sum, 0, 255);
129
+ * }
130
+ * @/textblock </pre>
131
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
132
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
133
+ * kernel_width.)
134
+ *
135
+ * This filter does not work in place.
136
+ *
137
+ * @param src The input image
138
+ *
139
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
140
+ * This may not alias the src image.
141
+ *
142
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
143
+ * computation. The size of the tempBuffer is given by calling the function
144
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
145
+ * the size is returned instead of an error code from the left hand side.
146
+ * You may pass NULL here, in which case a region of memory of similar size
147
+ * will be allocated by the function and freed before it returns. Temp Buffers
148
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
149
+ * buffers. If you will be calling this function repeatedly with similar parameters
150
+ * you should use a temp buffer. If the function is called from different threads
151
+ * concurrently, a different temp buffer should be used for each.
152
+ *
153
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
154
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
155
+ * when the destination tile is not aligned with the left edge of the image.
156
+ *
157
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
158
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
159
+ * when the destination tile is not aligned with the top edge of the image.
160
+ *
161
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
162
+ * For example, for a simple 3x3 blur, it might be:
163
+ * <pre>@textblock
164
+ * const int16_t kernel[9] = { 1, 2, 1,
165
+ * 2, 4, 2,
166
+ * 1, 2, 1 };
167
+ * @/textblock </pre>
168
+ *
169
+ * The kernel values may not sum in any combination to be outside the range
170
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
171
+ *
172
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
173
+ *
174
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
175
+ *
176
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
177
+ * to fit back into the image format of the destination image. The correction factor
178
+ * is passed in as divisor here, and is divided from the sum before the result is
179
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
180
+ * is 0, 1 will be used instead.
181
+ *
182
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
183
+ * parameter provides the background color to be used for missing pixels when the
184
+ * kernel extends off the edge of the image.
185
+ *
186
+ * @param flags The following flags are allowed:
187
+ * <pre>@textblock
188
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
189
+ * copy the corresponding source pixel to the destination. This
190
+ * will result in a ring off unconvolved content at the edges
191
+ * and convolved content in the middle.
192
+ *
193
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
194
+ * For a blur filter this will look like the edges of the image
195
+ * have been blurred into a particular color. This is usually
196
+ * appropriate when the color of the surface onto which the image
197
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
198
+ * as a background color, and let the downstream image compositor
199
+ * blend in the background color. In this case, the result image
200
+ * should be treated as a premultiplied image.
201
+ *
202
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
203
+ * This is better when the image is drawn into a frame or other
204
+ * context where the background is not expected to contribute to
205
+ * the final content.
206
+ *
207
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
208
+ * simply ignored, and the bias and divisor are adjusted accordingly.
209
+ * Because of the complication at the edges, this edging mode can
210
+ * be significantly slower than the others. It can be numerically
211
+ * unstable if the sum over any rectangular subsection of the kernel
212
+ * is zero, which can result in division by zero during the computation.
213
+ * The results for this edging mode are usually quite visually similar
214
+ * to kvImageEdgeExtend.
215
+ *
216
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
217
+ * size of the temp buffer needed for this set of parameters. Does
218
+ * not touch the src or dest image.
219
+ *
220
+ * kvImageDoNotTile Disable internal multithreading.
221
+ *
222
+ * @/textblock </pre>
223
+ * The first four flags listed are edging modes. One and only one edging mode must be
224
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
225
+ * be returned.
226
+ *
227
+ * @return One of the following error codes may be returned:
228
+ * <pre>@textblock
229
+ * kvImageNoError Success.
230
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
231
+ * the temp buffer to use with this function and this set of
232
+ * parameters.
233
+ *
234
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
235
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
236
+ * kvImageEdgeExtend, kvImageTruncateKernel }
237
+ *
238
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
239
+ * to corresponding dimensions of the source buffer.
240
+ *
241
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
242
+ *
243
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
244
+ *
245
+ * kvImageNullPointerArgument kernel may not be NULL
246
+ *
247
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
248
+ *
249
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
250
+ * @/textblock </pre>
251
+ */
252
+ VIMAGE_PF vImage_Error vImageConvolve_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, Pixel_8 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
253
+
254
+ /*!
255
+ * @function vImageConvolve_PlanarF
256
+ * @abstract General convolution on a PlanarF image.
257
+ * @discussion This filter applies a convolution filter of your choosing to a PlanarF image.
258
+ * For each pixel:
259
+ * <pre>@textblock
260
+ * for each pixel[y][x] in image{
261
+ * float sum = 0;
262
+ *
263
+ * // Calculate weighted average over kernel area
264
+ * for each kernel_element[i][j] in kernel{
265
+ * sum += kernel_element[i][j] *
266
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
267
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
268
+ * }
269
+ *
270
+ * // write out result
271
+ * result[y][x] = sum;
272
+ * }
273
+ * @/textblock </pre>
274
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
275
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
276
+ * kernel_width.)
277
+ *
278
+ * This filter does not work in place.
279
+ *
280
+ * @param src The input image
281
+ *
282
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
283
+ * This may not alias the src image.
284
+ *
285
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
286
+ * computation. The size of the tempBuffer is given by calling the function
287
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
288
+ * the size is returned instead of an error code from the left hand side.
289
+ * You may pass NULL here, in which case a region of memory of similar size
290
+ * will be allocated by the function and freed before it returns. Temp Buffers
291
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
292
+ * buffers. If you will be calling this function repeatedly with similar parameters
293
+ * you should use a temp buffer. If the function is called from different threads
294
+ * concurrently, a different temp buffer should be used for each.
295
+ *
296
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
297
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
298
+ * when the destination tile is not aligned with the left edge of the image.
299
+ *
300
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
301
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
302
+ * when the destination tile is not aligned with the top edge of the image.
303
+ *
304
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
305
+ * For example, for a simple 3x3 blur, it might be:
306
+ * <pre>@textblock
307
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
308
+ * 2./16, 4./16, 2./16,
309
+ * 1./16, 2./16, 1./16 };
310
+ * @/textblock </pre>
311
+ *
312
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
313
+ *
314
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
315
+ *
316
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
317
+ * parameter provides the background color to be used for missing pixels when the
318
+ * kernel extends off the edge of the image.
319
+ *
320
+ * @param flags The following flags are allowed:
321
+ * <pre>@textblock
322
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
323
+ * copy the corresponding source pixel to the destination. This
324
+ * will result in a ring off unconvolved content at the edges
325
+ * and convolved content in the middle.
326
+ *
327
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
328
+ * For a blur filter this will look like the edges of the image
329
+ * have been blurred into a particular color. This is usually
330
+ * appropriate when the color of the surface onto which the image
331
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
332
+ * as a background color, and let the downstream image compositor
333
+ * blend in the background color. In this case, the result image
334
+ * should be treated as a premultiplied image.
335
+ *
336
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
337
+ * This is better when the image is drawn into a frame or other
338
+ * context where the background is not expected to contribute to
339
+ * the final content.
340
+ *
341
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
342
+ * simply ignored, and the bias and divisor are adjusted accordingly.
343
+ * Because of the complication at the edges, this edging mode can
344
+ * be significantly slower than the others. It can be numerically
345
+ * unstable if the sum over any rectangular subsection of the kernel
346
+ * is zero, which can result in division by zero during the computation.
347
+ * The results for this edging mode are usually quite visually similar
348
+ * to kvImageEdgeExtend.
349
+ *
350
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
351
+ * size of the temp buffer needed for this set of parameters. Does
352
+ * not touch the src or dest image.
353
+ *
354
+ * kvImageDoNotTile Disable internal multithreading.
355
+ *
356
+ * @/textblock </pre>
357
+ * The first four flags listed are edging modes. One and only one edging mode must be
358
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
359
+ * be returned.
360
+ *
361
+ * @return One of the following error codes may be returned:
362
+ * <pre>@textblock
363
+ * kvImageNoError Success.
364
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
365
+ * the temp buffer to use with this function and this set of
366
+ * parameters.
367
+ *
368
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
369
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
370
+ * kvImageEdgeExtend, kvImageTruncateKernel }
371
+ *
372
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
373
+ * to corresponding dimensions of the source buffer.
374
+ *
375
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
376
+ *
377
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
378
+ *
379
+ * kvImageNullPointerArgument kernel may not be NULL
380
+ *
381
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
382
+ *
383
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
384
+ * @/textblock </pre>
385
+ */
386
+ VIMAGE_PF vImage_Error vImageConvolve_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, Pixel_F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
387
+
388
+ /*!
389
+ * @function vImageConvolve_Planar16F
390
+ * @abstract General convolution on a Planar16F image.
391
+ * @discussion This filter applies a convolution filter of your choosing to a Planar16F image.
392
+ * The kernel values are specified as 32-bit single-precision floats and the
393
+ * weighted average is also computed in single precision by default. However, if
394
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
395
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
396
+ * supports it. This results in up to 2x performance improvements but at the
397
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
398
+ *
399
+ * For each pixel:
400
+ * <pre>@textblock
401
+ * for each pixel[y][x] in image{
402
+ * // sum is declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
403
+ * float sum = 0;
404
+ *
405
+ * // Calculate weighted average over kernel area
406
+ * for each kernel_element[i][j] in kernel{
407
+ * sum += kernel_element[i][j] *
408
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
409
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
410
+ * }
411
+ *
412
+ * // write out result
413
+ * result[y][x] = (_Float16)sum;
414
+ * }
415
+ * @/textblock </pre>
416
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
417
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
418
+ * kernel_width.)
419
+ *
420
+ * This filter does not work in place.
421
+ *
422
+ * @param src The input image
423
+ *
424
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
425
+ * This may not alias the src image.
426
+ *
427
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
428
+ * computation. The size of the tempBuffer is given by calling the function
429
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
430
+ * the size is returned instead of an error code from the left hand side.
431
+ * You may pass NULL here, in which case a region of memory of similar size
432
+ * will be allocated by the function and freed before it returns. Temp Buffers
433
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
434
+ * buffers. If you will be calling this function repeatedly with similar parameters
435
+ * you should use a temp buffer. If the function is called from different threads
436
+ * concurrently, a different temp buffer should be used for each.
437
+ *
438
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
439
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
440
+ * when the destination tile is not aligned with the left edge of the image.
441
+ *
442
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
443
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
444
+ * when the destination tile is not aligned with the top edge of the image.
445
+ *
446
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
447
+ * For example, for a simple 3x3 blur, it might be:
448
+ * <pre>@textblock
449
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
450
+ * 2./16, 4./16, 2./16,
451
+ * 1./16, 2./16, 1./16 };
452
+ * @/textblock </pre>
453
+ *
454
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
455
+ *
456
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
457
+ *
458
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
459
+ * parameter provides the background color to be used for missing pixels when the
460
+ * kernel extends off the edge of the image.
461
+ *
462
+ * @param flags The following flags are allowed:
463
+ * <pre>@textblock
464
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
465
+ * copy the corresponding source pixel to the destination. This
466
+ * will result in a ring off unconvolved content at the edges
467
+ * and convolved content in the middle.
468
+ *
469
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
470
+ * For a blur filter this will look like the edges of the image
471
+ * have been blurred into a particular color. This is usually
472
+ * appropriate when the color of the surface onto which the image
473
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
474
+ * as a background color, and let the downstream image compositor
475
+ * blend in the background color. In this case, the result image
476
+ * should be treated as a premultiplied image.
477
+ *
478
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
479
+ * This is better when the image is drawn into a frame or other
480
+ * context where the background is not expected to contribute to
481
+ * the final content.
482
+ *
483
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
484
+ * simply ignored, and the bias and divisor are adjusted accordingly.
485
+ * Because of the complication at the edges, this edging mode can
486
+ * be significantly slower than the others. It can be numerically
487
+ * unstable if the sum over any rectangular subsection of the kernel
488
+ * is zero, which can result in division by zero during the computation.
489
+ * The results for this edging mode are usually quite visually similar
490
+ * to kvImageEdgeExtend.
491
+ *
492
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
493
+ * size of the temp buffer needed for this set of parameters. Does
494
+ * not touch the src or dest image.
495
+ *
496
+ * kvImageDoNotTile Disable internal multithreading.
497
+ *
498
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
499
+ * kernel averages when the CPU architecture supports it.
500
+ *
501
+ * @/textblock </pre>
502
+ * The first four flags listed are edging modes. One and only one edging mode must be
503
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
504
+ * be returned.
505
+ *
506
+ * @return One of the following error codes may be returned:
507
+ * <pre>@textblock
508
+ * kvImageNoError Success.
509
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
510
+ * the temp buffer to use with this function and this set of
511
+ * parameters.
512
+ *
513
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
514
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
515
+ * kvImageEdgeExtend, kvImageTruncateKernel }
516
+ *
517
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
518
+ * to corresponding dimensions of the source buffer.
519
+ *
520
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
521
+ *
522
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
523
+ *
524
+ * kvImageNullPointerArgument kernel may not be NULL
525
+ *
526
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
527
+ *
528
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
529
+ * @/textblock </pre>
530
+ */
531
+ VIMAGE_PF vImage_Error vImageConvolve_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, Pixel_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
532
+
533
+ /*!
534
+ * @function vImageConvolve_ARGB8888
535
+ * @abstract General convolution on a ARGB888 image of any channel order.
536
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB8888 image.
537
+ * This filter will work on any four-channel, 8-bit per component image format, not just ARGB.
538
+ * For each pixel:
539
+ * <pre>@textblock
540
+ * for each pixel[y][x] in image{
541
+ * int sumA = 0;
542
+ * int sumR = 0;
543
+ * int sumG = 0;
544
+ * int sumB = 0;
545
+ *
546
+ * // Calculate weighted average over kernel area
547
+ * for each kernel_element[i][j] in kernel{
548
+ * sumA += kernel_element[i][j] *
549
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][0];
550
+ * sumR += kernel_element[i][j] *
551
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][1];
552
+ * sumG += kernel_element[i][j] *
553
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][2];
554
+ * sumB += kernel_element[i][j] *
555
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][3];
556
+ * }
557
+ * // Correct for the scaling introduced by multiplying by the weights table
558
+ * sumA = (sumA + divisor/2) / divisor;
559
+ * sumR = (sumR + divisor/2) / divisor;
560
+ * sumG = (sumG + divisor/2) / divisor;
561
+ * sumB = (sumB + divisor/2) / divisor;
562
+ *
563
+ * // write out result
564
+ * result[y][x][0] = CLAMP(sumA, 0, 255);
565
+ * result[y][x][1] = CLAMP(sumR, 0, 255);
566
+ * result[y][x][2] = CLAMP(sumG, 0, 255);
567
+ * result[y][x][3] = CLAMP(sumB, 0, 255);
568
+ * }
569
+ * @/textblock </pre>
570
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
571
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
572
+ * kernel_width.)
573
+ *
574
+ * This filter does not work in place.
575
+ *
576
+ *
577
+ * @param src The input image
578
+ *
579
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
580
+ * This may not alias the src image.
581
+ *
582
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
583
+ * computation. The size of the tempBuffer is given by calling the function
584
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
585
+ * the size is returned instead of an error code from the left hand side.
586
+ * You may pass NULL here, in which case a region of memory of similar size
587
+ * will be allocated by the function and freed before it returns. Temp Buffers
588
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
589
+ * buffers. If you will be calling this function repeatedly with similar parameters
590
+ * you should use a temp buffer. If the function is called from different threads
591
+ * concurrently, a different temp buffer should be used for each.
592
+ *
593
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
594
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
595
+ * when the destination tile is not aligned with the left edge of the image.
596
+ *
597
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
598
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
599
+ * when the destination tile is not aligned with the top edge of the image.
600
+ *
601
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
602
+ * For example, for a simple 3x3 blur, it might be:
603
+ * <pre>@textblock
604
+ * const int16_t kernel[9] = { 1, 2, 1,
605
+ * 2, 4, 2,
606
+ * 1, 2, 1 };
607
+ * @/textblock </pre>
608
+ *
609
+ * The kernel values may not sum in any combination to be outside the range
610
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
611
+ *
612
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
613
+ *
614
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
615
+ *
616
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
617
+ * to fit back into the image format of the destination image. The correction factor
618
+ * is passed in as divisor here, and is divided from the sum before the result is
619
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
620
+ * is 0, 1 will be used instead.
621
+ *
622
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
623
+ * parameter provides the background color to be used for missing pixels when the
624
+ * kernel extends off the edge of the image.
625
+ *
626
+ * @param flags The following flags are allowed:
627
+ * <pre>@textblock
628
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
629
+ * copy the corresponding source pixel to the destination. This
630
+ * will result in a ring off unconvolved content at the edges
631
+ * and convolved content in the middle.
632
+ *
633
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
634
+ * For a blur filter this will look like the edges of the image
635
+ * have been blurred into a particular color. This is usually
636
+ * appropriate when the color of the surface onto which the image
637
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
638
+ * as a background color, and let the downstream image compositor
639
+ * blend in the background color. In this case, the result image
640
+ * should be treated as a premultiplied image.
641
+ *
642
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
643
+ * This is better when the image is drawn into a frame or other
644
+ * context where the background is not expected to contribute to
645
+ * the final content.
646
+ *
647
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
648
+ * simply ignored, and the bias and divisor are adjusted accordingly.
649
+ * Because of the complication at the edges, this edging mode can
650
+ * be significantly slower than the others. It can be numerically
651
+ * unstable if the sum over any rectangular subsection of the kernel
652
+ * is zero, which can result in division by zero during the computation.
653
+ * The results for this edging mode are usually quite visually similar
654
+ * to kvImageEdgeExtend.
655
+ *
656
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
657
+ * size of the temp buffer needed for this set of parameters. Does
658
+ * not touch the src or dest image.
659
+ *
660
+ * kvImageDoNotTile Disable internal multithreading.
661
+ *
662
+ * @/textblock </pre>
663
+ * The first four flags listed are edging modes. One and only one edging mode must be
664
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
665
+ * be returned.
666
+ *
667
+ * @return One of the following error codes may be returned:
668
+ * <pre>@textblock
669
+ * kvImageNoError Success.
670
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
671
+ * the temp buffer to use with this function and this set of
672
+ * parameters.
673
+ *
674
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
675
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
676
+ * kvImageEdgeExtend, kvImageTruncateKernel }
677
+ *
678
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
679
+ * to corresponding dimensions of the source buffer.
680
+ *
681
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
682
+ *
683
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
684
+ *
685
+ * kvImageNullPointerArgument kernel may not be NULL
686
+ *
687
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
688
+ *
689
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
690
+ * @/textblock </pre>
691
+ */
692
+ VIMAGE_PF vImage_Error vImageConvolve_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, const Pixel_8888 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
693
+
694
+ /*!
695
+ * @function vImageConvolve_ARGBFFFF
696
+ * @abstract General convolution on a ARGBFFFF image of any channel order.
697
+ * @discussion This filter applies a convolution filter of your choosing to a ARGBFFFF image.
698
+ * This filter will work on any four-channel, float per component image format, not just ARGB.
699
+ * For each pixel:
700
+ * <pre>@textblock
701
+ * for each pixel[y][x] in image{
702
+ * float sumA = 0;
703
+ * float sumR = 0;
704
+ * float sumG = 0;
705
+ * float sumB = 0;
706
+ *
707
+ * // Calculate weighted average over kernel area
708
+ * for each kernel_element[i][j] in kernel{
709
+ * sumA += kernel_element[i][j] *
710
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
711
+ * sumR += kernel_element[i][j] *
712
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
713
+ * sumG += kernel_element[i][j] *
714
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
715
+ * sumB += kernel_element[i][j] *
716
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
717
+ * }
718
+ *
719
+ * // write out result
720
+ * result[y][x][0] = sumA;
721
+ * result[y][x][1] = sumR;
722
+ * result[y][x][2] = sumG;
723
+ * result[y][x][3] = sumB;
724
+ * }
725
+ * @/textblock </pre>
726
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
727
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
728
+ * kernel_width.)
729
+ *
730
+ * This filter does not work in place.
731
+ *
732
+ * @param src The input image
733
+ *
734
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
735
+ * This may not alias the src image.
736
+ *
737
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
738
+ * computation. The size of the tempBuffer is given by calling the function
739
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
740
+ * the size is returned instead of an error code from the left hand side.
741
+ * You may pass NULL here, in which case a region of memory of similar size
742
+ * will be allocated by the function and freed before it returns. Temp Buffers
743
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
744
+ * buffers. If you will be calling this function repeatedly with similar parameters
745
+ * you should use a temp buffer. If the function is called from different threads
746
+ * concurrently, a different temp buffer should be used for each.
747
+ *
748
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
749
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
750
+ * when the destination tile is not aligned with the left edge of the image.
751
+ *
752
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
753
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
754
+ * when the destination tile is not aligned with the top edge of the image.
755
+ *
756
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
757
+ * For example, for a simple 3x3 blur, it might be:
758
+ * <pre>@textblock
759
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
760
+ * 2./16, 4./16, 2./16,
761
+ * 1./16, 2./16, 1./16 };
762
+ * @/textblock </pre>
763
+ *
764
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
765
+ *
766
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
767
+ *
768
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
769
+ * parameter provides the background color to be used for missing pixels when the
770
+ * kernel extends off the edge of the image.
771
+ *
772
+ * @param flags The following flags are allowed:
773
+ * <pre>@textblock
774
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
775
+ * copy the corresponding source pixel to the destination. This
776
+ * will result in a ring off unconvolved content at the edges
777
+ * and convolved content in the middle.
778
+ *
779
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
780
+ * For a blur filter this will look like the edges of the image
781
+ * have been blurred into a particular color. This is usually
782
+ * appropriate when the color of the surface onto which the image
783
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
784
+ * as a background color, and let the downstream image compositor
785
+ * blend in the background color. In this case, the result image
786
+ * should be treated as a premultiplied image.
787
+ *
788
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
789
+ * This is better when the image is drawn into a frame or other
790
+ * context where the background is not expected to contribute to
791
+ * the final content.
792
+ *
793
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
794
+ * simply ignored, and the bias and divisor are adjusted accordingly.
795
+ * Because of the complication at the edges, this edging mode can
796
+ * be significantly slower than the others. It can be numerically
797
+ * unstable if the sum over any rectangular subsection of the kernel
798
+ * is zero, which can result in division by zero during the computation.
799
+ * The results for this edging mode are usually quite visually similar
800
+ * to kvImageEdgeExtend.
801
+ *
802
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
803
+ * size of the temp buffer needed for this set of parameters. Does
804
+ * not touch the src or dest image.
805
+ *
806
+ * kvImageDoNotTile Disable internal multithreading.
807
+ *
808
+ * @/textblock </pre>
809
+ * The first four flags listed are edging modes. One and only one edging mode must be
810
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
811
+ * be returned.
812
+ *
813
+ * @return One of the following error codes may be returned:
814
+ * <pre>@textblock
815
+ * kvImageNoError Success.
816
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
817
+ * the temp buffer to use with this function and this set of
818
+ * parameters.
819
+ *
820
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
821
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
822
+ * kvImageEdgeExtend, kvImageTruncateKernel }
823
+ *
824
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
825
+ * to corresponding dimensions of the source buffer.
826
+ *
827
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
828
+ *
829
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
830
+ *
831
+ * kvImageNullPointerArgument kernel may not be NULL
832
+ *
833
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
834
+ *
835
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
836
+ * @/textblock </pre>
837
+ */
838
+ VIMAGE_PF vImage_Error vImageConvolve_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, const Pixel_FFFF backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
839
+
840
+ /*!
841
+ * @function vImageConvolve_ARGB16F
842
+ * @abstract General convolution on a ARGB16F image of any channel order.
843
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB16F image.
844
+ * This filter will work on any four-channel, half-float per component image format, not just ARGB.
845
+ * The kernel values are specified as 32-bit single-precision floats and the
846
+ * weighted average is also computed in single precision by default. However, if
847
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
848
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
849
+ * supports it. This results in up to 2x performance improvements but at the
850
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
851
+ *
852
+ * For each pixel:
853
+ * <pre>@textblock
854
+ * for each pixel[y][x] in image{
855
+ * // Sums are declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
856
+ * float sumA = 0;
857
+ * float sumR = 0;
858
+ * float sumG = 0;
859
+ * float sumB = 0;
860
+ *
861
+ * // Calculate weighted average over kernel area
862
+ * for each kernel_element[i][j] in kernel{
863
+ * sumA += kernel_element[i][j] *
864
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
865
+ * sumR += kernel_element[i][j] *
866
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
867
+ * sumG += kernel_element[i][j] *
868
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
869
+ * sumB += kernel_element[i][j] *
870
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
871
+ * }
872
+ *
873
+ * // write out result
874
+ * result[y][x][0] = (_Float16)sumA;
875
+ * result[y][x][1] = (_Float16)sumR;
876
+ * result[y][x][2] = (_Float16)sumG;
877
+ * result[y][x][3] = (_Float16)sumB;
878
+ * }
879
+ * @/textblock </pre>
880
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
881
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
882
+ * kernel_width.)
883
+ *
884
+ * This filter does not work in place.
885
+ *
886
+ * @param src The input image
887
+ *
888
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
889
+ * This may not alias the src image.
890
+ *
891
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
892
+ * computation. The size of the tempBuffer is given by calling the function
893
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
894
+ * the size is returned instead of an error code from the left hand side.
895
+ * You may pass NULL here, in which case a region of memory of similar size
896
+ * will be allocated by the function and freed before it returns. Temp Buffers
897
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
898
+ * buffers. If you will be calling this function repeatedly with similar parameters
899
+ * you should use a temp buffer. If the function is called from different threads
900
+ * concurrently, a different temp buffer should be used for each.
901
+ *
902
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
903
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
904
+ * when the destination tile is not aligned with the left edge of the image.
905
+ *
906
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
907
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
908
+ * when the destination tile is not aligned with the top edge of the image.
909
+ *
910
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
911
+ * For example, for a simple 3x3 blur, it might be:
912
+ * <pre>@textblock
913
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
914
+ * 2./16, 4./16, 2./16,
915
+ * 1./16, 2./16, 1./16 };
916
+ * @/textblock </pre>
917
+ *
918
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
919
+ *
920
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
921
+ *
922
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
923
+ * parameter provides the background color to be used for missing pixels when the
924
+ * kernel extends off the edge of the image.
925
+ *
926
+ * @param flags The following flags are allowed:
927
+ * <pre>@textblock
928
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
929
+ * copy the corresponding source pixel to the destination. This
930
+ * will result in a ring off unconvolved content at the edges
931
+ * and convolved content in the middle.
932
+ *
933
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
934
+ * For a blur filter this will look like the edges of the image
935
+ * have been blurred into a particular color. This is usually
936
+ * appropriate when the color of the surface onto which the image
937
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
938
+ * as a background color, and let the downstream image compositor
939
+ * blend in the background color. In this case, the result image
940
+ * should be treated as a premultiplied image.
941
+ *
942
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
943
+ * This is better when the image is drawn into a frame or other
944
+ * context where the background is not expected to contribute to
945
+ * the final content.
946
+ *
947
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
948
+ * simply ignored, and the bias and divisor are adjusted accordingly.
949
+ * Because of the complication at the edges, this edging mode can
950
+ * be significantly slower than the others. It can be numerically
951
+ * unstable if the sum over any rectangular subsection of the kernel
952
+ * is zero, which can result in division by zero during the computation.
953
+ * The results for this edging mode are usually quite visually similar
954
+ * to kvImageEdgeExtend.
955
+ *
956
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
957
+ * size of the temp buffer needed for this set of parameters. Does
958
+ * not touch the src or dest image.
959
+ *
960
+ * kvImageDoNotTile Disable internal multithreading.
961
+ *
962
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
963
+ * kernel averages when the CPU architecture supports it.
964
+ *
965
+ * @/textblock </pre>
966
+ * The first four flags listed are edging modes. One and only one edging mode must be
967
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
968
+ * be returned.
969
+ *
970
+ * @return One of the following error codes may be returned:
971
+ * <pre>@textblock
972
+ * kvImageNoError Success.
973
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
974
+ * the temp buffer to use with this function and this set of
975
+ * parameters.
976
+ *
977
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
978
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
979
+ * kvImageEdgeExtend, kvImageTruncateKernel }
980
+ *
981
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
982
+ * to corresponding dimensions of the source buffer.
983
+ *
984
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
985
+ *
986
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
987
+ *
988
+ * kvImageNullPointerArgument kernel may not be NULL
989
+ *
990
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
991
+ *
992
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
993
+ * @/textblock </pre>
994
+ */
995
+ VIMAGE_PF vImage_Error vImageConvolve_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, const Pixel_ARGB_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
996
+
997
+ /*!
998
+ * @function vImageConvolveWithBias_Planar8
999
+ * @abstract General convolution on a Planar8 image with added bias.
1000
+ * @discussion This filter applies a convolution filter of your choosing to a Planar8 image.
1001
+ * For each pixel:
1002
+ * <pre>@textblock
1003
+ * for each pixel[y][x] in image{
1004
+ * int sum = 0;
1005
+ *
1006
+ * // Calculate weighted average over kernel area
1007
+ * for each kernel_element[i][j] in kernel{
1008
+ * sum += kernel_element[i][j] *
1009
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
1010
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
1011
+ * }
1012
+ * // Correct for the scaling introduced by multiplying by the weights table
1013
+ * sum = (sum + bias) / divisor;
1014
+ *
1015
+ * // write out result
1016
+ * result[y][x] = CLAMP(sum, 0, 255);
1017
+ * }
1018
+ * @/textblock </pre>
1019
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1020
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1021
+ * kernel_width.)
1022
+ *
1023
+ * This filter does not work in place.
1024
+ *
1025
+ * @param src The input image
1026
+ *
1027
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1028
+ * This may not alias the src image.
1029
+ *
1030
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1031
+ * computation. The size of the tempBuffer is given by calling the function
1032
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1033
+ * the size is returned instead of an error code from the left hand side.
1034
+ * You may pass NULL here, in which case a region of memory of similar size
1035
+ * will be allocated by the function and freed before it returns. Temp Buffers
1036
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1037
+ * buffers. If you will be calling this function repeatedly with similar parameters
1038
+ * you should use a temp buffer. If the function is called from different threads
1039
+ * concurrently, a different temp buffer should be used for each.
1040
+ *
1041
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1042
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1043
+ * when the destination tile is not aligned with the left edge of the image.
1044
+ *
1045
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1046
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1047
+ * when the destination tile is not aligned with the top edge of the image.
1048
+ *
1049
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
1050
+ * For example, for a simple 3x3 blur, it might be:
1051
+ * <pre>@textblock
1052
+ * const int16_t kernel[9] = { 1, 2, 1,
1053
+ * 2, 4, 2,
1054
+ * 1, 2, 1 };
1055
+ * @/textblock </pre>
1056
+ *
1057
+ * The kernel values may not sum in any combination to be outside the range
1058
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
1059
+ *
1060
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1061
+ *
1062
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1063
+ *
1064
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
1065
+ * to fit back into the image format of the destination image. The correction factor
1066
+ * is passed in as divisor here, and is divided from the sum before the result is
1067
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
1068
+ * is 0, 1 will be used instead.
1069
+ *
1070
+ * @param bias This value is added to the sum of weighted pixels before the divisor is applied.
1071
+ * It can serve to both control rounding and adjust the brightness of the result.
1072
+ * A large bias (e.g 128 * divisor) may be required for some kernels to return
1073
+ * representable results, such as edge detection filters.
1074
+ *
1075
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
1076
+ * parameter provides the background color to be used for missing pixels when the
1077
+ * kernel extends off the edge of the image.
1078
+ *
1079
+ * @param flags The following flags are allowed:
1080
+ * <pre>@textblock
1081
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
1082
+ * copy the corresponding source pixel to the destination. This
1083
+ * will result in a ring off unconvolved content at the edges
1084
+ * and convolved content in the middle.
1085
+ *
1086
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
1087
+ * For a blur filter this will look like the edges of the image
1088
+ * have been blurred into a particular color. This is usually
1089
+ * appropriate when the color of the surface onto which the image
1090
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
1091
+ * as a background color, and let the downstream image compositor
1092
+ * blend in the background color. In this case, the result image
1093
+ * should be treated as a premultiplied image.
1094
+ *
1095
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
1096
+ * This is better when the image is drawn into a frame or other
1097
+ * context where the background is not expected to contribute to
1098
+ * the final content.
1099
+ *
1100
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
1101
+ * simply ignored, and the bias and divisor are adjusted accordingly.
1102
+ * Because of the complication at the edges, this edging mode can
1103
+ * be significantly slower than the others. It can be numerically
1104
+ * unstable if the sum over any rectangular subsection of the kernel
1105
+ * is zero, which can result in division by zero during the computation.
1106
+ * The results for this edging mode are usually quite visually similar
1107
+ * to kvImageEdgeExtend.
1108
+ *
1109
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
1110
+ * size of the temp buffer needed for this set of parameters. Does
1111
+ * not touch the src or dest image.
1112
+ *
1113
+ * kvImageDoNotTile Disable internal multithreading.
1114
+ *
1115
+ * @/textblock </pre>
1116
+ * The first four flags listed are edging modes. One and only one edging mode must be
1117
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
1118
+ * be returned.
1119
+ *
1120
+ * @return One of the following error codes may be returned:
1121
+ * <pre>@textblock
1122
+ * kvImageNoError Success.
1123
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
1124
+ * the temp buffer to use with this function and this set of
1125
+ * parameters.
1126
+ *
1127
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
1128
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
1129
+ * kvImageEdgeExtend, kvImageTruncateKernel }
1130
+ *
1131
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
1132
+ * to corresponding dimensions of the source buffer.
1133
+ *
1134
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
1135
+ *
1136
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
1137
+ *
1138
+ * kvImageNullPointerArgument kernel may not be NULL
1139
+ *
1140
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
1141
+ *
1142
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
1143
+ * @/textblock </pre>
1144
+ */
1145
+ VIMAGE_PF vImage_Error vImageConvolveWithBias_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, Pixel_8 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
1146
+
1147
+ /*!
1148
+ * @function vImageConvolveWithBias_PlanarF
1149
+ * @abstract General convolution on a PlanarF image with added bias.
1150
+ * @discussion This filter applies a convolution filter of your choosing to a PlanarF image.
1151
+ * For each pixel:
1152
+ * <pre>@textblock
1153
+ * for each pixel[y][x] in image{
1154
+ * float sum = bias;
1155
+ *
1156
+ * // Calculate weighted average over kernel area
1157
+ * for each kernel_element[i][j] in kernel{
1158
+ * sum += kernel_element[i][j] *
1159
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
1160
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
1161
+ * }
1162
+ *
1163
+ * // write out result
1164
+ * result[y][x] = sum;
1165
+ * }
1166
+ * @/textblock </pre>
1167
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1168
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1169
+ * kernel_width.)
1170
+ *
1171
+ * This filter does not work in place.
1172
+ *
1173
+ * @param src The input image
1174
+ *
1175
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1176
+ * This may not alias the src image.
1177
+ *
1178
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1179
+ * computation. The size of the tempBuffer is given by calling the function
1180
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1181
+ * the size is returned instead of an error code from the left hand side.
1182
+ * You may pass NULL here, in which case a region of memory of similar size
1183
+ * will be allocated by the function and freed before it returns. Temp Buffers
1184
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1185
+ * buffers. If you will be calling this function repeatedly with similar parameters
1186
+ * you should use a temp buffer. If the function is called from different threads
1187
+ * concurrently, a different temp buffer should be used for each.
1188
+ *
1189
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1190
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1191
+ * when the destination tile is not aligned with the left edge of the image.
1192
+ *
1193
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1194
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1195
+ * when the destination tile is not aligned with the top edge of the image.
1196
+ *
1197
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
1198
+ * For example, for a simple 3x3 blur, it might be:
1199
+ * <pre>@textblock
1200
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
1201
+ * 2./16, 4./16, 2./16,
1202
+ * 1./16, 2./16, 1./16 };
1203
+ * @/textblock </pre>
1204
+ *
1205
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1206
+ *
1207
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1208
+ *
1209
+ * @param bias This value is added to the sum of weighted pixels.
1210
+ *
1211
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
1212
+ * parameter provides the background color to be used for missing pixels when the
1213
+ * kernel extends off the edge of the image.
1214
+ *
1215
+ * @param flags The following flags are allowed:
1216
+ * <pre>@textblock
1217
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
1218
+ * copy the corresponding source pixel to the destination. This
1219
+ * will result in a ring off unconvolved content at the edges
1220
+ * and convolved content in the middle.
1221
+ *
1222
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
1223
+ * For a blur filter this will look like the edges of the image
1224
+ * have been blurred into a particular color. This is usually
1225
+ * appropriate when the color of the surface onto which the image
1226
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
1227
+ * as a background color, and let the downstream image compositor
1228
+ * blend in the background color. In this case, the result image
1229
+ * should be treated as a premultiplied image.
1230
+ *
1231
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
1232
+ * This is better when the image is drawn into a frame or other
1233
+ * context where the background is not expected to contribute to
1234
+ * the final content.
1235
+ *
1236
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
1237
+ * simply ignored, and the bias and divisor are adjusted accordingly.
1238
+ * Because of the complication at the edges, this edging mode can
1239
+ * be significantly slower than the others. It can be numerically
1240
+ * unstable if the sum over any rectangular subsection of the kernel
1241
+ * is zero, which can result in division by zero during the computation.
1242
+ * The results for this edging mode are usually quite visually similar
1243
+ * to kvImageEdgeExtend.
1244
+ *
1245
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
1246
+ * size of the temp buffer needed for this set of parameters. Does
1247
+ * not touch the src or dest image.
1248
+ *
1249
+ * kvImageDoNotTile Disable internal multithreading.
1250
+ *
1251
+ * @/textblock </pre>
1252
+ * The first four flags listed are edging modes. One and only one edging mode must be
1253
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
1254
+ * be returned.
1255
+ *
1256
+ * @return One of the following error codes may be returned:
1257
+ * <pre>@textblock
1258
+ * kvImageNoError Success.
1259
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
1260
+ * the temp buffer to use with this function and this set of
1261
+ * parameters.
1262
+ *
1263
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
1264
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
1265
+ * kvImageEdgeExtend, kvImageTruncateKernel }
1266
+ *
1267
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
1268
+ * to corresponding dimensions of the source buffer.
1269
+ *
1270
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
1271
+ *
1272
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
1273
+ *
1274
+ * kvImageNullPointerArgument kernel may not be NULL
1275
+ *
1276
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
1277
+ *
1278
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
1279
+ * @/textblock </pre>
1280
+ */
1281
+ VIMAGE_PF vImage_Error vImageConvolveWithBias_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
1282
+
1283
+ /*!
1284
+ * @function vImageConvolveWithBias_Planar16F
1285
+ * @abstract General convolution on a Planar16F image.
1286
+ * @discussion This filter applies a convolution filter of your choosing to a Planar16F image.
1287
+ * The kernel values are specified as 32-bit single-precision floats and the
1288
+ * weighted average is also computed in single precision by default. However, if
1289
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
1290
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
1291
+ * supports it. This results in up to 2x performance improvements but at the
1292
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
1293
+ *
1294
+ * For each pixel:
1295
+ * <pre>@textblock
1296
+ * for each pixel[y][x] in image{
1297
+ * // sum is declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
1298
+ * float sum = bias;
1299
+ *
1300
+ * // Calculate weighted average over kernel area
1301
+ * for each kernel_element[i][j] in kernel{
1302
+ * sum += kernel_element[i][j] *
1303
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
1304
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
1305
+ * }
1306
+ *
1307
+ * // write out result
1308
+ * result[y][x] = (_Float16)sum;
1309
+ * }
1310
+ * @/textblock </pre>
1311
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1312
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1313
+ * kernel_width.)
1314
+ *
1315
+ * This filter does not work in place.
1316
+ *
1317
+ * @param src The input image
1318
+ *
1319
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1320
+ * This may not alias the src image.
1321
+ *
1322
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1323
+ * computation. The size of the tempBuffer is given by calling the function
1324
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1325
+ * the size is returned instead of an error code from the left hand side.
1326
+ * You may pass NULL here, in which case a region of memory of similar size
1327
+ * will be allocated by the function and freed before it returns. Temp Buffers
1328
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1329
+ * buffers. If you will be calling this function repeatedly with similar parameters
1330
+ * you should use a temp buffer. If the function is called from different threads
1331
+ * concurrently, a different temp buffer should be used for each.
1332
+ *
1333
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1334
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1335
+ * when the destination tile is not aligned with the left edge of the image.
1336
+ *
1337
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1338
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1339
+ * when the destination tile is not aligned with the top edge of the image.
1340
+ *
1341
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
1342
+ * For example, for a simple 3x3 blur, it might be:
1343
+ * <pre>@textblock
1344
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
1345
+ * 2./16, 4./16, 2./16,
1346
+ * 1./16, 2./16, 1./16 };
1347
+ * @/textblock </pre>
1348
+ *
1349
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1350
+ *
1351
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1352
+ *
1353
+ * @param bias This value is added to the sum of weighted pixels.
1354
+ *
1355
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
1356
+ * parameter provides the background color to be used for missing pixels when the
1357
+ * kernel extends off the edge of the image.
1358
+ *
1359
+ * @param flags The following flags are allowed:
1360
+ * <pre>@textblock
1361
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
1362
+ * copy the corresponding source pixel to the destination. This
1363
+ * will result in a ring off unconvolved content at the edges
1364
+ * and convolved content in the middle.
1365
+ *
1366
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
1367
+ * For a blur filter this will look like the edges of the image
1368
+ * have been blurred into a particular color. This is usually
1369
+ * appropriate when the color of the surface onto which the image
1370
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
1371
+ * as a background color, and let the downstream image compositor
1372
+ * blend in the background color. In this case, the result image
1373
+ * should be treated as a premultiplied image.
1374
+ *
1375
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
1376
+ * This is better when the image is drawn into a frame or other
1377
+ * context where the background is not expected to contribute to
1378
+ * the final content.
1379
+ *
1380
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
1381
+ * simply ignored, and the bias and divisor are adjusted accordingly.
1382
+ * Because of the complication at the edges, this edging mode can
1383
+ * be significantly slower than the others. It can be numerically
1384
+ * unstable if the sum over any rectangular subsection of the kernel
1385
+ * is zero, which can result in division by zero during the computation.
1386
+ * The results for this edging mode are usually quite visually similar
1387
+ * to kvImageEdgeExtend.
1388
+ *
1389
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
1390
+ * size of the temp buffer needed for this set of parameters. Does
1391
+ * not touch the src or dest image.
1392
+ *
1393
+ * kvImageDoNotTile Disable internal multithreading.
1394
+ *
1395
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
1396
+ * kernel averages when the CPU architecture supports it.
1397
+ *
1398
+ * @/textblock </pre>
1399
+ * The first four flags listed are edging modes. One and only one edging mode must be
1400
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
1401
+ * be returned.
1402
+ *
1403
+ * @return One of the following error codes may be returned:
1404
+ * <pre>@textblock
1405
+ * kvImageNoError Success.
1406
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
1407
+ * the temp buffer to use with this function and this set of
1408
+ * parameters.
1409
+ *
1410
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
1411
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
1412
+ * kvImageEdgeExtend, kvImageTruncateKernel }
1413
+ *
1414
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
1415
+ * to corresponding dimensions of the source buffer.
1416
+ *
1417
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
1418
+ *
1419
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
1420
+ *
1421
+ * kvImageNullPointerArgument kernel may not be NULL
1422
+ *
1423
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
1424
+ *
1425
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
1426
+ * @/textblock </pre>
1427
+ */
1428
+ VIMAGE_PF vImage_Error vImageConvolveWithBias_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
1429
+
1430
+ /*!
1431
+ * @function vImageConvolveWithBias_ARGB8888
1432
+ * @abstract General convolution on a ARGB888 image of any channel order with bias.
1433
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB8888 image.
1434
+ * This filter will work on any four-channel, 8-bit per component image format, not just ARGB.
1435
+ * For each pixel:
1436
+ * <pre>@textblock
1437
+ * for each pixel[y][x] in image{
1438
+ * int sumA = 0;
1439
+ * int sumR = 0;
1440
+ * int sumG = 0;
1441
+ * int sumB = 0;
1442
+ *
1443
+ * // Calculate weighted average over kernel area
1444
+ * for each kernel_element[i][j] in kernel{
1445
+ * sumA += kernel_element[i][j] *
1446
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][0];
1447
+ * sumR += kernel_element[i][j] *
1448
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][1];
1449
+ * sumG += kernel_element[i][j] *
1450
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][2];
1451
+ * sumB += kernel_element[i][j] *
1452
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][3];
1453
+ * }
1454
+ * // Correct for the scaling introduced by multiplying by the weights table
1455
+ * sumA = (sumA + bias[0]) / divisor;
1456
+ * sumR = (sumR + bias[1]) / divisor;
1457
+ * sumG = (sumG + bias[2]) / divisor;
1458
+ * sumB = (sumB + bias[3]) / divisor;
1459
+ *
1460
+ * // write out result
1461
+ * result[y][x][0] = CLAMP(sumA, 0, 255);
1462
+ * result[y][x][1] = CLAMP(sumR, 0, 255);
1463
+ * result[y][x][2] = CLAMP(sumG, 0, 255);
1464
+ * result[y][x][3] = CLAMP(sumB, 0, 255);
1465
+ * }
1466
+ * @/textblock </pre>
1467
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1468
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1469
+ * kernel_width.)
1470
+ *
1471
+ * This filter does not work in place.
1472
+ *
1473
+ *
1474
+ * @param src The input image
1475
+ *
1476
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1477
+ * This may not alias the src image.
1478
+ *
1479
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1480
+ * computation. The size of the tempBuffer is given by calling the function
1481
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1482
+ * the size is returned instead of an error code from the left hand side.
1483
+ * You may pass NULL here, in which case a region of memory of similar size
1484
+ * will be allocated by the function and freed before it returns. Temp Buffers
1485
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1486
+ * buffers. If you will be calling this function repeatedly with similar parameters
1487
+ * you should use a temp buffer. If the function is called from different threads
1488
+ * concurrently, a different temp buffer should be used for each.
1489
+ *
1490
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1491
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1492
+ * when the destination tile is not aligned with the left edge of the image.
1493
+ *
1494
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1495
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1496
+ * when the destination tile is not aligned with the top edge of the image.
1497
+ *
1498
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
1499
+ * For example, for a simple 3x3 blur, it might be:
1500
+ * <pre>@textblock
1501
+ * const int16_t kernel[9] = { 1, 2, 1,
1502
+ * 2, 4, 2,
1503
+ * 1, 2, 1 };
1504
+ * @/textblock </pre>
1505
+ *
1506
+ * The kernel values may not sum in any combination to be outside the range
1507
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
1508
+ *
1509
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1510
+ *
1511
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1512
+ *
1513
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
1514
+ * to fit back into the image format of the destination image. The correction factor
1515
+ * is passed in as divisor here, and is divided from the sum before the result is
1516
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
1517
+ * is 0, 1 will be used instead.
1518
+ *
1519
+ * @param bias This value is added to the sum of weighted pixels before the divisor is applied.
1520
+ * It can serve to both control rounding and adjust the brightness of the result.
1521
+ * A large bias (e.g 128 * divisor) may be required for some kernels, such as edge
1522
+ * detection filters, to return representable results.
1523
+ *
1524
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
1525
+ * parameter provides the background color to be used for missing pixels when the
1526
+ * kernel extends off the edge of the image.
1527
+ *
1528
+ * @param flags The following flags are allowed:
1529
+ * <pre>@textblock
1530
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
1531
+ * copy the corresponding source pixel to the destination. This
1532
+ * will result in a ring off unconvolved content at the edges
1533
+ * and convolved content in the middle.
1534
+ *
1535
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
1536
+ * For a blur filter this will look like the edges of the image
1537
+ * have been blurred into a particular color. This is usually
1538
+ * appropriate when the color of the surface onto which the image
1539
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
1540
+ * as a background color, and let the downstream image compositor
1541
+ * blend in the background color. In this case, the result image
1542
+ * should be treated as a premultiplied image.
1543
+ *
1544
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
1545
+ * This is better when the image is drawn into a frame or other
1546
+ * context where the background is not expected to contribute to
1547
+ * the final content.
1548
+ *
1549
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
1550
+ * simply ignored, and the bias and divisor are adjusted accordingly.
1551
+ * Because of the complication at the edges, this edging mode can
1552
+ * be significantly slower than the others. It can be numerically
1553
+ * unstable if the sum over any rectangular subsection of the kernel
1554
+ * is zero, which can result in division by zero during the computation.
1555
+ * The results for this edging mode are usually quite visually similar
1556
+ * to kvImageEdgeExtend.
1557
+ *
1558
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
1559
+ * size of the temp buffer needed for this set of parameters. Does
1560
+ * not touch the src or dest image.
1561
+ *
1562
+ * kvImageDoNotTile Disable internal multithreading.
1563
+ *
1564
+ * @/textblock </pre>
1565
+ * The first four flags listed are edging modes. One and only one edging mode must be
1566
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
1567
+ * be returned.
1568
+ *
1569
+ * @return One of the following error codes may be returned:
1570
+ * <pre>@textblock
1571
+ * kvImageNoError Success.
1572
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
1573
+ * the temp buffer to use with this function and this set of
1574
+ * parameters.
1575
+ *
1576
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
1577
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
1578
+ * kvImageEdgeExtend, kvImageTruncateKernel }
1579
+ *
1580
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
1581
+ * to corresponding dimensions of the source buffer.
1582
+ *
1583
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
1584
+ *
1585
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
1586
+ *
1587
+ * kvImageNullPointerArgument kernel may not be NULL
1588
+ *
1589
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
1590
+ *
1591
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
1592
+ * @/textblock </pre>
1593
+ */
1594
+ VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, const Pixel_8888 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
1595
+
1596
+ /*!
1597
+ * @function vImageConvolveFloatKernel_ARGB8888
1598
+ * @abstract General convolution on a ARGB888 image of any channel order with a kernel with floating-point weights.
1599
+ * @discussion Performs a filtering operation just like vImageConvolveWithBias_ARGB8888 but with a float rather than an integer (with divisor) kernel.
1600
+ *
1601
+ */
1602
+ VIMAGE_PF vImage_Error vImageConvolveFloatKernel_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernelHeight, uint32_t kernelWidth, float bias, const Pixel_8888 backgroundColor, vImage_Flags flags)
1603
+ VIMAGE_NON_NULL(1,2) __API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
1604
+
1605
+ /*!
1606
+ * @function vImageConvolveWithBias_ARGBFFFF
1607
+ * @abstract General convolution on a ARGBFFFF image of any channel order with bias.
1608
+ * @discussion This filter applies a convolution filter of your choosing to a ARGBFFFF image.
1609
+ * This filter will work on any four-channel, float per component image format, not just ARGB.
1610
+ * For each pixel:
1611
+ * <pre>@textblock
1612
+ * for each pixel[y][x] in image{
1613
+ * float sumA = bias[0];
1614
+ * float sumR = bias[1];
1615
+ * float sumG = bias[2];
1616
+ * float sumB = bias[3];
1617
+ *
1618
+ * // Calculate weighted average over kernel area
1619
+ * for each kernel_element[i][j] in kernel{
1620
+ * sumA += kernel_element[i][j] *
1621
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
1622
+ * sumR += kernel_element[i][j] *
1623
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
1624
+ * sumG += kernel_element[i][j] *
1625
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
1626
+ * sumB += kernel_element[i][j] *
1627
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
1628
+ * }
1629
+ *
1630
+ * // write out result
1631
+ * result[y][x][0] = sumA;
1632
+ * result[y][x][1] = sumR;
1633
+ * result[y][x][2] = sumG;
1634
+ * result[y][x][3] = sumB;
1635
+ * }
1636
+ * @/textblock </pre>
1637
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1638
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1639
+ * kernel_width.)
1640
+ *
1641
+ * This filter does not work in place.
1642
+ *
1643
+ * @param src The input image
1644
+ *
1645
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1646
+ * This may not alias the src image.
1647
+ *
1648
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1649
+ * computation. The size of the tempBuffer is given by calling the function
1650
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1651
+ * the size is returned instead of an error code from the left hand side.
1652
+ * You may pass NULL here, in which case a region of memory of similar size
1653
+ * will be allocated by the function and freed before it returns. Temp Buffers
1654
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1655
+ * buffers. If you will be calling this function repeatedly with similar parameters
1656
+ * you should use a temp buffer. If the function is called from different threads
1657
+ * concurrently, a different temp buffer should be used for each.
1658
+ *
1659
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1660
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1661
+ * when the destination tile is not aligned with the left edge of the image.
1662
+ *
1663
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1664
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1665
+ * when the destination tile is not aligned with the top edge of the image.
1666
+ *
1667
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
1668
+ * For example, for a simple 3x3 blur, it might be:
1669
+ * <pre>@textblock
1670
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
1671
+ * 2./16, 4./16, 2./16,
1672
+ * 1./16, 2./16, 1./16 };
1673
+ * @/textblock </pre>
1674
+ *
1675
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1676
+ *
1677
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1678
+ *
1679
+ * @param bias This value is added to the sum of weighted pixels.
1680
+ *
1681
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
1682
+ * parameter provides the background color to be used for missing pixels when the
1683
+ * kernel extends off the edge of the image.
1684
+ *
1685
+ * @param flags The following flags are allowed:
1686
+ * <pre>@textblock
1687
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
1688
+ * copy the corresponding source pixel to the destination. This
1689
+ * will result in a ring off unconvolved content at the edges
1690
+ * and convolved content in the middle.
1691
+ *
1692
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
1693
+ * For a blur filter this will look like the edges of the image
1694
+ * have been blurred into a particular color. This is usually
1695
+ * appropriate when the color of the surface onto which the image
1696
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
1697
+ * as a background color, and let the downstream image compositor
1698
+ * blend in the background color. In this case, the result image
1699
+ * should be treated as a premultiplied image.
1700
+ *
1701
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
1702
+ * This is better when the image is drawn into a frame or other
1703
+ * context where the background is not expected to contribute to
1704
+ * the final content.
1705
+ *
1706
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
1707
+ * simply ignored, and the bias and divisor are adjusted accordingly.
1708
+ * Because of the complication at the edges, this edging mode can
1709
+ * be significantly slower than the others. It can be numerically
1710
+ * unstable if the sum over any rectangular subsection of the kernel
1711
+ * is zero, which can result in division by zero during the computation.
1712
+ * The results for this edging mode are usually quite visually similar
1713
+ * to kvImageEdgeExtend.
1714
+ *
1715
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
1716
+ * size of the temp buffer needed for this set of parameters. Does
1717
+ * not touch the src or dest image.
1718
+ *
1719
+ * kvImageDoNotTile Disable internal multithreading.
1720
+ *
1721
+ * @/textblock </pre>
1722
+ * The first four flags listed are edging modes. One and only one edging mode must be
1723
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
1724
+ * be returned.
1725
+ *
1726
+ * @return One of the following error codes may be returned:
1727
+ * <pre>@textblock
1728
+ * kvImageNoError Success.
1729
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
1730
+ * the temp buffer to use with this function and this set of
1731
+ * parameters.
1732
+ *
1733
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
1734
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
1735
+ * kvImageEdgeExtend, kvImageTruncateKernel }
1736
+ *
1737
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
1738
+ * to corresponding dimensions of the source buffer.
1739
+ *
1740
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
1741
+ *
1742
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
1743
+ *
1744
+ * kvImageNullPointerArgument kernel may not be NULL
1745
+ *
1746
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
1747
+ *
1748
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
1749
+ * @/textblock </pre>
1750
+ */
1751
+ VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, const Pixel_FFFF backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
1752
+
1753
+ /*!
1754
+ * @function vImageConvolveWithBias_ARGB16F
1755
+ * @abstract General convolution on a ARGB16F image of any channel order.
1756
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB16F image.
1757
+ * This filter will work on any four-channel, half-float per component image format, not just ARGB.
1758
+ * The kernel values are specified as 32-bit single-precision floats and the
1759
+ * weighted average is also computed in single precision by default. However, if
1760
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
1761
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
1762
+ * supports it. This results in up to 2x performance improvements but at the
1763
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
1764
+ *
1765
+ * For each pixel:
1766
+ * <pre>@textblock
1767
+ * for each pixel[y][x] in image{
1768
+ * // Sums are declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
1769
+ * float sumA = bias;
1770
+ * float sumR = bias;
1771
+ * float sumG = bias;
1772
+ * float sumB = bias;
1773
+ *
1774
+ * // Calculate weighted average over kernel area
1775
+ * for each kernel_element[i][j] in kernel{
1776
+ * sumA += kernel_element[i][j] *
1777
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
1778
+ * sumR += kernel_element[i][j] *
1779
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
1780
+ * sumG += kernel_element[i][j] *
1781
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
1782
+ * sumB += kernel_element[i][j] *
1783
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
1784
+ * }
1785
+ *
1786
+ * // write out result
1787
+ * result[y][x][0] = (_Float16)sumA;
1788
+ * result[y][x][1] = (_Float16)sumR;
1789
+ * result[y][x][2] = (_Float16)sumG;
1790
+ * result[y][x][3] = (_Float16)sumB;
1791
+ * }
1792
+ * @/textblock </pre>
1793
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1794
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1795
+ * kernel_width.)
1796
+ *
1797
+ * This filter does not work in place.
1798
+ *
1799
+ * @param src The input image
1800
+ *
1801
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1802
+ * This may not alias the src image.
1803
+ *
1804
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1805
+ * computation. The size of the tempBuffer is given by calling the function
1806
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1807
+ * the size is returned instead of an error code from the left hand side.
1808
+ * You may pass NULL here, in which case a region of memory of similar size
1809
+ * will be allocated by the function and freed before it returns. Temp Buffers
1810
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1811
+ * buffers. If you will be calling this function repeatedly with similar parameters
1812
+ * you should use a temp buffer. If the function is called from different threads
1813
+ * concurrently, a different temp buffer should be used for each.
1814
+ *
1815
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1816
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1817
+ * when the destination tile is not aligned with the left edge of the image.
1818
+ *
1819
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1820
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1821
+ * when the destination tile is not aligned with the top edge of the image.
1822
+ *
1823
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
1824
+ * For example, for a simple 3x3 blur, it might be:
1825
+ * <pre>@textblock
1826
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
1827
+ * 2./16, 4./16, 2./16,
1828
+ * 1./16, 2./16, 1./16 };
1829
+ * @/textblock </pre>
1830
+ *
1831
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1832
+ *
1833
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1834
+ *
1835
+ * @param bias This value is added to the sum of weighted pixels.
1836
+ *
1837
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
1838
+ * parameter provides the background color to be used for missing pixels when the
1839
+ * kernel extends off the edge of the image.
1840
+ *
1841
+ * @param flags The following flags are allowed:
1842
+ * <pre>@textblock
1843
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
1844
+ * copy the corresponding source pixel to the destination. This
1845
+ * will result in a ring off unconvolved content at the edges
1846
+ * and convolved content in the middle.
1847
+ *
1848
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
1849
+ * For a blur filter this will look like the edges of the image
1850
+ * have been blurred into a particular color. This is usually
1851
+ * appropriate when the color of the surface onto which the image
1852
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
1853
+ * as a background color, and let the downstream image compositor
1854
+ * blend in the background color. In this case, the result image
1855
+ * should be treated as a premultiplied image.
1856
+ *
1857
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
1858
+ * This is better when the image is drawn into a frame or other
1859
+ * context where the background is not expected to contribute to
1860
+ * the final content.
1861
+ *
1862
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
1863
+ * simply ignored, and the bias and divisor are adjusted accordingly.
1864
+ * Because of the complication at the edges, this edging mode can
1865
+ * be significantly slower than the others. It can be numerically
1866
+ * unstable if the sum over any rectangular subsection of the kernel
1867
+ * is zero, which can result in division by zero during the computation.
1868
+ * The results for this edging mode are usually quite visually similar
1869
+ * to kvImageEdgeExtend.
1870
+ *
1871
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
1872
+ * size of the temp buffer needed for this set of parameters. Does
1873
+ * not touch the src or dest image.
1874
+ *
1875
+ * kvImageDoNotTile Disable internal multithreading.
1876
+ *
1877
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
1878
+ * kernel averages when the CPU architecture supports it.
1879
+ *
1880
+ * @/textblock </pre>
1881
+ * The first four flags listed are edging modes. One and only one edging mode must be
1882
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
1883
+ * be returned.
1884
+ *
1885
+ * @return One of the following error codes may be returned:
1886
+ * <pre>@textblock
1887
+ * kvImageNoError Success.
1888
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
1889
+ * the temp buffer to use with this function and this set of
1890
+ * parameters.
1891
+ *
1892
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
1893
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
1894
+ * kvImageEdgeExtend, kvImageTruncateKernel }
1895
+ *
1896
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
1897
+ * to corresponding dimensions of the source buffer.
1898
+ *
1899
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
1900
+ *
1901
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
1902
+ *
1903
+ * kvImageNullPointerArgument kernel may not be NULL
1904
+ *
1905
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
1906
+ *
1907
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
1908
+ * @/textblock </pre>
1909
+ */
1910
+ VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, const Pixel_ARGB_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
1911
+
1912
+ /*!
1913
+ * @function vImageConvolveMultiKernel_ARGB8888
1914
+ * @abstract General convolution on a ARGB8888 image of any channel order with separate bias, kernel and divisor for each channel.
1915
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB8888 image.
1916
+ * This filter will work on any four-channel, 8-bit per component image format, not just ARGB.
1917
+ * For each pixel:
1918
+ * <pre>@textblock
1919
+ * for each pixel[y][x] in image{
1920
+ * int sumA = 0;
1921
+ * int sumR = 0;
1922
+ * int sumG = 0;
1923
+ * int sumB = 0;
1924
+ * const int16_t *kA = kernel[0];
1925
+ * const int16_t *kR = kernel[1];
1926
+ * const int16_t *kG = kernel[2];
1927
+ * const int16_t *kB = kernel[3];
1928
+ *
1929
+ * // Calculate weighted average over kernel area
1930
+ * for each kernel_element[i][j] in kernel{
1931
+ * sumA += kA[i*kernel_width+j] *
1932
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][0];
1933
+ * sumR += kR[i*kernel_width+j] *
1934
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][1];
1935
+ * sumG += kG[i*kernel_width+j] *
1936
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][2];
1937
+ * sumB += kB[i*kernel_width+j] *
1938
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][3];
1939
+ * }
1940
+ * // Correct for the scaling introduced by multiplying by the weights table
1941
+ * sumA = (sumA + bias[0]) / divisor[0];
1942
+ * sumR = (sumR + bias[1]) / divisor[1];
1943
+ * sumG = (sumG + bias[2]) / divisor[2];
1944
+ * sumB = (sumB + bias[3]) / divisor[3];
1945
+ *
1946
+ * // write out result
1947
+ * result[y][x][0] = CLAMP(sumA, 0, 255);
1948
+ * result[y][x][1] = CLAMP(sumR, 0, 255);
1949
+ * result[y][x][2] = CLAMP(sumG, 0, 255);
1950
+ * result[y][x][3] = CLAMP(sumB, 0, 255);
1951
+ * }
1952
+ * @/textblock </pre>
1953
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
1954
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
1955
+ * kernel_width.)
1956
+ *
1957
+ * This filter does not work in place.
1958
+ *
1959
+ *
1960
+ * @param src The input image
1961
+ *
1962
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
1963
+ * This may not alias the src image.
1964
+ *
1965
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
1966
+ * computation. The size of the tempBuffer is given by calling the function
1967
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
1968
+ * the size is returned instead of an error code from the left hand side.
1969
+ * You may pass NULL here, in which case a region of memory of similar size
1970
+ * will be allocated by the function and freed before it returns. Temp Buffers
1971
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
1972
+ * buffers. If you will be calling this function repeatedly with similar parameters
1973
+ * you should use a temp buffer. If the function is called from different threads
1974
+ * concurrently, a different temp buffer should be used for each.
1975
+ *
1976
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
1977
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1978
+ * when the destination tile is not aligned with the left edge of the image.
1979
+ *
1980
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
1981
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
1982
+ * when the destination tile is not aligned with the top edge of the image.
1983
+ *
1984
+ * @param kernel An array of 4 pointers to weights of dimension kernel_height x kernel_width.
1985
+ * The kernel values in each array may not sum in any combination to be outside the range
1986
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
1987
+ *
1988
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
1989
+ *
1990
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
1991
+ *
1992
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
1993
+ * to fit back into the image format of the destination image. The correction factor
1994
+ * is passed in as divisor here, and is divided from the sum before the result is
1995
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
1996
+ * is 0, 1 will be used instead.
1997
+ *
1998
+ * @param bias This array of values is added to the sum of weighted pixels for each channel respectively
1999
+ * before the divisor is applied. It can serve to both control rounding and adjust the
2000
+ * brightness of the result. A large bias (e.g 128 * divisor) may be required for some
2001
+ * kernels, such as edge detection filters, to return representable results.
2002
+ *
2003
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2004
+ * parameter provides the background color to be used for missing pixels when the
2005
+ * kernel extends off the edge of the image.
2006
+ *
2007
+ * @param flags The following flags are allowed:
2008
+ * <pre>@textblock
2009
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2010
+ * copy the corresponding source pixel to the destination. This
2011
+ * will result in a ring off unconvolved content at the edges
2012
+ * and convolved content in the middle.
2013
+ *
2014
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2015
+ * For a blur filter this will look like the edges of the image
2016
+ * have been blurred into a particular color. This is usually
2017
+ * appropriate when the color of the surface onto which the image
2018
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2019
+ * as a background color, and let the downstream image compositor
2020
+ * blend in the background color. In this case, the result image
2021
+ * should be treated as a premultiplied image.
2022
+ *
2023
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2024
+ * This is better when the image is drawn into a frame or other
2025
+ * context where the background is not expected to contribute to
2026
+ * the final content.
2027
+ *
2028
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2029
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2030
+ * Because of the complication at the edges, this edging mode can
2031
+ * be significantly slower than the others. It can be numerically
2032
+ * unstable if the sum over any rectangular subsection of the kernel
2033
+ * is zero, which can result in division by zero during the computation.
2034
+ * The results for this edging mode are usually quite visually similar
2035
+ * to kvImageEdgeExtend.
2036
+ *
2037
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2038
+ * size of the temp buffer needed for this set of parameters. Does
2039
+ * not touch the src or dest image.
2040
+ *
2041
+ * kvImageDoNotTile Disable internal multithreading.
2042
+ *
2043
+ * @/textblock </pre>
2044
+ * The first four flags listed are edging modes. One and only one edging mode must be
2045
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2046
+ * be returned.
2047
+ *
2048
+ * @return One of the following error codes may be returned:
2049
+ * <pre>@textblock
2050
+ * kvImageNoError Success.
2051
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
2052
+ * the temp buffer to use with this function and this set of
2053
+ * parameters.
2054
+ *
2055
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
2056
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
2057
+ * kvImageEdgeExtend, kvImageTruncateKernel }
2058
+ *
2059
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
2060
+ * to corresponding dimensions of the source buffer.
2061
+ *
2062
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
2063
+ *
2064
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
2065
+ *
2066
+ * kvImageNullPointerArgument kernel may not be NULL
2067
+ *
2068
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
2069
+ *
2070
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
2071
+ * @/textblock </pre>
2072
+ */
2073
+ VIMAGE_PF vImage_Error vImageConvolveMultiKernel_ARGB8888( const vImage_Buffer *src,
2074
+ const vImage_Buffer *dest,
2075
+ void *tempBuffer,
2076
+ vImagePixelCount srcOffsetToROI_X,
2077
+ vImagePixelCount srcOffsetToROI_Y,
2078
+ const int16_t *kernels[4],
2079
+ uint32_t kernel_height,
2080
+ uint32_t kernel_width,
2081
+ const int32_t divisors[4],
2082
+ const int32_t biases[4],
2083
+ const Pixel_8888 backgroundColor,
2084
+ vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
2085
+
2086
+
2087
+ /*!
2088
+ * @function vImageConvolveMultiKernel_ARGBFFFF
2089
+ * @abstract General convolution on a ARGBFFFF image of any channel order with separate bias and kernel for each channel.
2090
+ * @discussion This filter applies a convolution filter of your choosing to a ARGBFFFF image.
2091
+ * This filter will work on any four-channel, float per component image format, not just ARGB.
2092
+ * For each pixel:
2093
+ * <pre>@textblock
2094
+ * for each pixel[y][x] in image{
2095
+ * float sumA = bias[0];
2096
+ * float sumR = bias[1];
2097
+ * float sumG = bias[2];
2098
+ * float sumB = bias[3];
2099
+ * const float *kA = kernel[0];
2100
+ * const float *kR = kernel[1];
2101
+ * const float *kG = kernel[2];
2102
+ * const float *kB = kernel[3];
2103
+ *
2104
+ * // Calculate weighted average over kernel area
2105
+ * for each kernel_element[i][j] in kernel{
2106
+ * sumA += kA[i*kernel_width+j] *
2107
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
2108
+ * sumR += kR[i*kernel_width+j] *
2109
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
2110
+ * sumG += kG[i*kernel_width+j] *
2111
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
2112
+ * sumB += kB[i*kernel_width+j] *
2113
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
2114
+ * }
2115
+ *
2116
+ * // write out result
2117
+ * result[y][x][0] = sumA;
2118
+ * result[y][x][1] = sumR;
2119
+ * result[y][x][2] = sumG;
2120
+ * result[y][x][3] = sumB;
2121
+ * }
2122
+ * @/textblock </pre>
2123
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
2124
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
2125
+ * kernel_width.)
2126
+ *
2127
+ * This filter does not work in place.
2128
+ *
2129
+ * @param src The input image
2130
+ *
2131
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
2132
+ * This may not alias the src image.
2133
+ *
2134
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
2135
+ * computation. The size of the tempBuffer is given by calling the function
2136
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
2137
+ * the size is returned instead of an error code from the left hand side.
2138
+ * You may pass NULL here, in which case a region of memory of similar size
2139
+ * will be allocated by the function and freed before it returns. Temp Buffers
2140
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
2141
+ * buffers. If you will be calling this function repeatedly with similar parameters
2142
+ * you should use a temp buffer. If the function is called from different threads
2143
+ * concurrently, a different temp buffer should be used for each.
2144
+ *
2145
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
2146
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2147
+ * when the destination tile is not aligned with the left edge of the image.
2148
+ *
2149
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
2150
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2151
+ * when the destination tile is not aligned with the top edge of the image.
2152
+ *
2153
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
2154
+ * For example, for a simple 3x3 blur, it might be:
2155
+ * <pre>@textblock
2156
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
2157
+ * 2./16, 4./16, 2./16,
2158
+ * 1./16, 2./16, 1./16 };
2159
+ * @/textblock </pre>
2160
+ *
2161
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
2162
+ *
2163
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
2164
+ *
2165
+ * @param bias This value is added to the sum of weighted pixels.
2166
+ *
2167
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2168
+ * parameter provides the background color to be used for missing pixels when the
2169
+ * kernel extends off the edge of the image.
2170
+ *
2171
+ * @param flags The following flags are allowed:
2172
+ * <pre>@textblock
2173
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2174
+ * copy the corresponding source pixel to the destination. This
2175
+ * will result in a ring off unconvolved content at the edges
2176
+ * and convolved content in the middle.
2177
+ *
2178
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2179
+ * For a blur filter this will look like the edges of the image
2180
+ * have been blurred into a particular color. This is usually
2181
+ * appropriate when the color of the surface onto which the image
2182
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2183
+ * as a background color, and let the downstream image compositor
2184
+ * blend in the background color. In this case, the result image
2185
+ * should be treated as a premultiplied image.
2186
+ *
2187
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2188
+ * This is better when the image is drawn into a frame or other
2189
+ * context where the background is not expected to contribute to
2190
+ * the final content.
2191
+ *
2192
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2193
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2194
+ * Because of the complication at the edges, this edging mode can
2195
+ * be significantly slower than the others. It can be numerically
2196
+ * unstable if the sum over any rectangular subsection of the kernel
2197
+ * is zero, which can result in division by zero during the computation.
2198
+ * The results for this edging mode are usually quite visually similar
2199
+ * to kvImageEdgeExtend.
2200
+ *
2201
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2202
+ * size of the temp buffer needed for this set of parameters. Does
2203
+ * not touch the src or dest image.
2204
+ *
2205
+ * kvImageDoNotTile Disable internal multithreading.
2206
+ *
2207
+ * @/textblock </pre>
2208
+ * The first four flags listed are edging modes. One and only one edging mode must be
2209
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2210
+ * be returned.
2211
+ *
2212
+ * @return One of the following error codes may be returned:
2213
+ * <pre>@textblock
2214
+ * kvImageNoError Success.
2215
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
2216
+ * the temp buffer to use with this function and this set of
2217
+ * parameters.
2218
+ *
2219
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
2220
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
2221
+ * kvImageEdgeExtend, kvImageTruncateKernel }
2222
+ *
2223
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
2224
+ * to corresponding dimensions of the source buffer.
2225
+ *
2226
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
2227
+ *
2228
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
2229
+ *
2230
+ * kvImageNullPointerArgument kernel may not be NULL
2231
+ *
2232
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
2233
+ *
2234
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
2235
+ * @/textblock </pre>
2236
+ */
2237
+ VIMAGE_PF vImage_Error vImageConvolveMultiKernel_ARGBFFFF( const vImage_Buffer *src,
2238
+ const vImage_Buffer *dest,
2239
+ void *tempBuffer,
2240
+ vImagePixelCount srcOffsetToROI_X,
2241
+ vImagePixelCount srcOffsetToROI_Y,
2242
+ const float *kernels[4],
2243
+ uint32_t kernel_height,
2244
+ uint32_t kernel_width,
2245
+ const float biases[4],
2246
+ const Pixel_FFFF backgroundColor,
2247
+ vImage_Flags flags ) VIMAGE_NON_NULL(1,2,6,9,10) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
2248
+
2249
+
2250
+
2251
+
2252
+ /*!
2253
+ * @functiongroup Richardson-Lucy Deconvolution
2254
+ *
2255
+ * @discussion Richardson-Lucy deconvolution (a.k.a. Lucy-Richardson) is an iterative procedure for estimating what an original image
2256
+ * probably was before a convolution, given the convolution end result and the kernel used to create it. It is typically used to fix blurring caused
2257
+ * by lens distortion, most famously for the Hubble telescope, but also to improve images in confocal microscopy and other uses. When used
2258
+ * to correct loss of signal due to physical limitations of the imaging system, the point spread function (kernel) is estimated from known
2259
+ * parameters associated with the lensing system. It can also be used to sharpen images that have been digitally blurred, as long as the
2260
+ * original convolution kernel is known or can be estimated.
2261
+ *
2262
+ * This routine iteratively uses the following formula:
2263
+ * <pre>@textblock
2264
+ * e[i+1] = e[i] x (psf0 * ( e[0] / (psf1 * e[i]) ) )
2265
+ *
2266
+ * where:
2267
+ * e[0] = the observed image (src parameter)
2268
+ * e[n] = the result of the nth iteration
2269
+ * psf = point spread function (kernel for call to convolution)
2270
+ * x = multiply operator
2271
+ * '*' = convolution operator
2272
+ * @/textblock </pre>
2273
+ * As with any sharpening operation, Richardson-Lucy amplifies noise, and at some number of iterations the noise becomes noticeable as artifacts.
2274
+ * <pre>@textblock
2275
+ * =========================================================================
2276
+ * ====== MOST VIMAGE CONVOLUTION FUNCTIONS DO NOT WORK IN PLACE =====
2277
+ * =========================================================================
2278
+ * @/textblock </pre>
2279
+ */
2280
+
2281
+
2282
+ /*!
2283
+ * @function vImageRichardsonLucyDeConvolve_Planar8
2284
+ * @abstract Perform N iterations of a Lucy-Richardson deconvolution on Planar8 data
2285
+ * @discussion
2286
+ * This routine iteratively uses the following formula:
2287
+ * <pre>@textblock
2288
+ * e[i+1] = e[i] x (psf0 * ( e[0] / (psf1 * e[i]) ) )
2289
+ *
2290
+ * where:
2291
+ * e[0] = the observed image (src parameter)
2292
+ * e[n] = the result of the nth iteration
2293
+ * psf = point spread function (kernel for call to convolution)
2294
+ * x = multiply operator
2295
+ * '*' = convolution operator
2296
+ * @/textblock </pre>
2297
+ *
2298
+ * The work in these functions is currently done internally with floating point precision. If you plan to call this function multiple times
2299
+ * (rather than with iterationCount > 1) on 8-bit per channel images, you can save some computation by converting the 8-bit image data to
2300
+ * single precision floating-point yourself using something like vImageConvert_Planar8toPlanarF and iterating on the appropriate
2301
+ * floating-point Richardson Lucy variant. Convert back, when you are done.
2302
+ *
2303
+ * Does not work in place.
2304
+ * @param src The input image
2305
+ *
2306
+ * @param dest A preallocated buffer to receive the result image.
2307
+ * This may not alias the src image.
2308
+ *
2309
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
2310
+ * computation. The size of the tempBuffer is given by calling the function
2311
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
2312
+ * the size is returned instead of an error code from the left hand side.
2313
+ * You may pass NULL here, in which case a region of memory of similar size
2314
+ * will be allocated by the function and freed before it returns. Temp Buffers
2315
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
2316
+ * buffers. If you will be calling this function repeatedly with similar parameters
2317
+ * you should use a temp buffer. If the function is called from different threads
2318
+ * concurrently, a different temp buffer should be used for each.
2319
+ *
2320
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
2321
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2322
+ * when the destination tile is not aligned with the left edge of the image.
2323
+ *
2324
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
2325
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2326
+ * when the destination tile is not aligned with the top edge of the image.
2327
+ *
2328
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
2329
+ * For example, for a simple 3x3 blur, it might be:
2330
+ * <pre>@textblock
2331
+ * const int16_t kernel[9] = { 1, 2, 1,
2332
+ * 2, 4, 2,
2333
+ * 1, 2, 1 };
2334
+ * @/textblock </pre>
2335
+ *
2336
+ * This is psf0 in the formula given in the discussion.
2337
+ *
2338
+ * @param kernel2 A pointer to a second 1D array of weights of dimension kernel_height2 x kernel_width2.
2339
+ * This is psf1 in the formula given in the discussion.
2340
+ *
2341
+ * @param kernel_height The height of the 2D table of weights passed in as kernel1. It must be an odd number.
2342
+ *
2343
+ * @param kernel_width The width of the 2D table of weights passed in as kernel1. It must be an odd number.
2344
+ *
2345
+ * @param kernel_height2 The height of the 2D table of weights passed in as kernel2. It must be an odd number.
2346
+ *
2347
+ * @param kernel_width2 The width of the 2D table of weights passed in as kernel2. It must be an odd number.
2348
+ *
2349
+ * @param divisor The divisor to use to correct for the volume under kernel.
2350
+ *
2351
+ * @param divisor2 The divisor to use to correct for the volume under kernel2.
2352
+ *
2353
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2354
+ * parameter provides the background color to be used for missing pixels when the
2355
+ * kernel extends off the edge of the image.
2356
+ *
2357
+ * @param iterationCount The number of Richardson-Lucy iterations to perform on the data before returning.
2358
+ * If 0, the src buffer is coped to dest.
2359
+ *
2360
+ *
2361
+ * @param flags The following flags are allowed:
2362
+ * <pre>@textblock
2363
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2364
+ * copy the corresponding source pixel to the destination. This
2365
+ * will result in a ring off unconvolved content at the edges
2366
+ * and convolved content in the middle.
2367
+ *
2368
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2369
+ * For a blur filter this will look like the edges of the image
2370
+ * have been blurred into a particular color. This is usually
2371
+ * appropriate when the color of the surface onto which the image
2372
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2373
+ * as a background color, and let the downstream image compositor
2374
+ * blend in the background color. In this case, the result image
2375
+ * should be treated as a premultiplied image.
2376
+ *
2377
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2378
+ * This is better when the image is drawn into a frame or other
2379
+ * context where the background is not expected to contribute to
2380
+ * the final content.
2381
+ *
2382
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2383
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2384
+ * Because of the complication at the edges, this edging mode can
2385
+ * be significantly slower than the others. It can be numerically
2386
+ * unstable if the sum over any rectangular subsection of the kernel
2387
+ * is zero, which can result in division by zero during the computation.
2388
+ * The results for this edging mode are usually quite visually similar
2389
+ * to kvImageEdgeExtend.
2390
+ *
2391
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2392
+ * size of the temp buffer needed for this set of parameters. Does
2393
+ * not touch the src or dest image.
2394
+ *
2395
+ * kvImageDoNotTile Disable internal multithreading.
2396
+ *
2397
+ * @/textblock </pre>
2398
+ * The first four flags listed are edging modes. One and only one edging mode must be
2399
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2400
+ * be returned.
2401
+ *
2402
+ * @return One of the following error codes may be returned:
2403
+ * <pre>@textblock
2404
+ * kvImageNoError Success.
2405
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
2406
+ * the temp buffer to use with this function and this set of
2407
+ * parameters.
2408
+ *
2409
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
2410
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
2411
+ * kvImageEdgeExtend, kvImageTruncateKernel }
2412
+ *
2413
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
2414
+ * to corresponding dimensions of the source buffer.
2415
+ *
2416
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
2417
+ *
2418
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
2419
+ *
2420
+ * kvImageNullPointerArgument kernel may not be NULL
2421
+ *
2422
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
2423
+ *
2424
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
2425
+ * @/textblock </pre>
2426
+ */
2427
+ VIMAGE_PF vImage_Error vImageRichardsonLucyDeConvolve_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, const int16_t *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, int32_t divisor, int32_t divisor2, Pixel_8 backgroundColor, uint32_t iterationCount, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
2428
+
2429
+ /*!
2430
+ * @function vImageRichardsonLucyDeConvolve_PlanarF
2431
+ * @abstract Perform N iterations of a Lucy-Richardson deconvolution on PlanarF data
2432
+ * @discussion
2433
+ * This routine iteratively uses the following formula:
2434
+ * <pre>@textblock
2435
+ * e[i+1] = e[i] x (psf0 * ( e[0] / (psf1 * e[i]) ) )
2436
+ *
2437
+ * where:
2438
+ * e[0] = the observed image (src parameter)
2439
+ * e[n] = the result of the nth iteration
2440
+ * psf = point spread function (kernel for call to convolution)
2441
+ * x = multiply operator
2442
+ * '*' = convolution operator
2443
+ * @/textblock </pre>
2444
+ *
2445
+ * Does not work in place.
2446
+ * @param src The input image
2447
+ *
2448
+ * @param dest A preallocated buffer to receive the result image.
2449
+ * This may not alias the src image.
2450
+ *
2451
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
2452
+ * computation. The size of the tempBuffer is given by calling the function
2453
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
2454
+ * the size is returned instead of an error code from the left hand side.
2455
+ * You may pass NULL here, in which case a region of memory of similar size
2456
+ * will be allocated by the function and freed before it returns. Temp Buffers
2457
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
2458
+ * buffers. If you will be calling this function repeatedly with similar parameters
2459
+ * you should use a temp buffer. If the function is called from different threads
2460
+ * concurrently, a different temp buffer should be used for each.
2461
+ *
2462
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
2463
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2464
+ * when the destination tile is not aligned with the left edge of the image.
2465
+ *
2466
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
2467
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2468
+ * when the destination tile is not aligned with the top edge of the image.
2469
+ *
2470
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
2471
+ * For example, for a simple 3x3 blur, it might be:
2472
+ * <pre>@textblock
2473
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
2474
+ * 2./16, 4./16, 2./16,
2475
+ * 1./16, 2./16, 1./16 };
2476
+ * @/textblock </pre>
2477
+ *
2478
+ * This is psf0 in the formula given in the discussion.
2479
+ *
2480
+ * @param kernel2 A pointer to a second 1D array of weights of dimension kernel_height2 x kernel_width2.
2481
+ * This is psf1 in the formula given in the discussion.
2482
+ *
2483
+ * @param kernel_height The height of the 2D table of weights passed in as kernel1. It must be an odd number.
2484
+ *
2485
+ * @param kernel_width The width of the 2D table of weights passed in as kernel1. It must be an odd number.
2486
+ *
2487
+ * @param kernel_height2 The height of the 2D table of weights passed in as kernel2. It must be an odd number.
2488
+ *
2489
+ * @param kernel_width2 The width of the 2D table of weights passed in as kernel2. It must be an odd number.
2490
+ *
2491
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2492
+ * parameter provides the background color to be used for missing pixels when the
2493
+ * kernel extends off the edge of the image.
2494
+ *
2495
+ * @param iterationCount The number of Richardson-Lucy iterations to perform on the data before returning.
2496
+ * If 0, the src buffer is coped to dest.
2497
+ *
2498
+ *
2499
+ * @param flags The following flags are allowed:
2500
+ * <pre>@textblock
2501
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2502
+ * copy the corresponding source pixel to the destination. This
2503
+ * will result in a ring off unconvolved content at the edges
2504
+ * and convolved content in the middle.
2505
+ *
2506
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2507
+ * For a blur filter this will look like the edges of the image
2508
+ * have been blurred into a particular color. This is usually
2509
+ * appropriate when the color of the surface onto which the image
2510
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2511
+ * as a background color, and let the downstream image compositor
2512
+ * blend in the background color. In this case, the result image
2513
+ * should be treated as a premultiplied image.
2514
+ *
2515
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2516
+ * This is better when the image is drawn into a frame or other
2517
+ * context where the background is not expected to contribute to
2518
+ * the final content.
2519
+ *
2520
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2521
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2522
+ * Because of the complication at the edges, this edging mode can
2523
+ * be significantly slower than the others. It can be numerically
2524
+ * unstable if the sum over any rectangular subsection of the kernel
2525
+ * is zero, which can result in division by zero during the computation.
2526
+ * The results for this edging mode are usually quite visually similar
2527
+ * to kvImageEdgeExtend.
2528
+ *
2529
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2530
+ * size of the temp buffer needed for this set of parameters. Does
2531
+ * not touch the src or dest image.
2532
+ *
2533
+ * kvImageDoNotTile Disable internal multithreading.
2534
+ *
2535
+ * @/textblock </pre>
2536
+ * The first four flags listed are edging modes. One and only one edging mode must be
2537
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2538
+ * be returned.
2539
+ *
2540
+ * @return One of the following error codes may be returned:
2541
+ * <pre>@textblock
2542
+ * kvImageNoError Success.
2543
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
2544
+ * the temp buffer to use with this function and this set of
2545
+ * parameters.
2546
+ *
2547
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
2548
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
2549
+ * kvImageEdgeExtend, kvImageTruncateKernel }
2550
+ *
2551
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
2552
+ * to corresponding dimensions of the source buffer.
2553
+ *
2554
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
2555
+ *
2556
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
2557
+ *
2558
+ * kvImageNullPointerArgument kernel may not be NULL
2559
+ *
2560
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
2561
+ *
2562
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
2563
+ * @/textblock </pre>
2564
+ */
2565
+ VIMAGE_PF vImage_Error vImageRichardsonLucyDeConvolve_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, const float *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, Pixel_F backgroundColor, uint32_t iterationCount, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
2566
+
2567
+ /*!
2568
+ * @function vImageRichardsonLucyDeConvolve_ARGB8888
2569
+ * @abstract Perform N iterations of a Lucy-Richardson deconvolution on ARGB8888 data.
2570
+ * @discussion
2571
+ * This routine iteratively uses the following formula:
2572
+ * <pre>@textblock
2573
+ * e[i+1] = e[i] x (psf0 * ( e[0] / (psf1 * e[i]) ) )
2574
+ *
2575
+ * where:
2576
+ * e[0] = the observed image (src parameter)
2577
+ * e[n] = the result of the nth iteration
2578
+ * psf = point spread function (kernel for call to convolution)
2579
+ * x = multiply operator
2580
+ * '*' = convolution operator
2581
+ * @/textblock </pre>
2582
+ * The channels are operated on independently of one another. Consequently, this function will work on
2583
+ * any 4-channel interleaved 8-bit per component format (e.g. RGBA, BGRA...), not just ARGB.
2584
+ *
2585
+ * The work in these functions is currently done internally with floating point precision. If you plan to call this function multiple times
2586
+ * (rather than with iterationCount > 1) on 8-bit per channel images, you can save some computation by converting the 8-bit image data to
2587
+ * single precision floating-point yourself using something like vImageConvert_Planar8toPlanarF and iterating on the appropriate
2588
+ * floating-point Richardson Lucy variant. Convert back, when you are done.
2589
+ *
2590
+ * Does not work in place.
2591
+ *
2592
+ * @param src The input image
2593
+ *
2594
+ * @param dest A preallocated buffer to receive the result image.
2595
+ * This may not alias the src image.
2596
+ *
2597
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
2598
+ * computation. The size of the tempBuffer is given by calling the function
2599
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
2600
+ * the size is returned instead of an error code from the left hand side.
2601
+ * You may pass NULL here, in which case a region of memory of similar size
2602
+ * will be allocated by the function and freed before it returns. Temp Buffers
2603
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
2604
+ * buffers. If you will be calling this function repeatedly with similar parameters
2605
+ * you should use a temp buffer. If the function is called from different threads
2606
+ * concurrently, a different temp buffer should be used for each.
2607
+ *
2608
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
2609
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2610
+ * when the destination tile is not aligned with the left edge of the image.
2611
+ *
2612
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
2613
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2614
+ * when the destination tile is not aligned with the top edge of the image.
2615
+ *
2616
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
2617
+ * For example, for a simple 3x3 blur, it might be:
2618
+ * <pre>@textblock
2619
+ * const int16_t kernel[9] = { 1, 2, 1,
2620
+ * 2, 4, 2,
2621
+ * 1, 2, 1 };
2622
+ * @/textblock </pre>
2623
+ *
2624
+ * This is psf0 in the formula given in the discussion.
2625
+ *
2626
+ * @param kernel2 A pointer to a second 1D array of weights of dimension kernel_height2 x kernel_width2.
2627
+ * This is psf1 in the formula given in the discussion.
2628
+ *
2629
+ * @param kernel_height The height of the 2D table of weights passed in as kernel1. It must be an odd number.
2630
+ *
2631
+ * @param kernel_width The width of the 2D table of weights passed in as kernel1. It must be an odd number.
2632
+ *
2633
+ * @param kernel_height2 The height of the 2D table of weights passed in as kernel2. It must be an odd number.
2634
+ *
2635
+ * @param kernel_width2 The width of the 2D table of weights passed in as kernel2. It must be an odd number.
2636
+ *
2637
+ * @param divisor The divisor to use to correct for the volume under kernel.
2638
+ *
2639
+ * @param divisor2 The divisor to use to correct for the volume under kernel2.
2640
+ *
2641
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2642
+ * parameter provides the background color to be used for missing pixels when the
2643
+ * kernel extends off the edge of the image.
2644
+ *
2645
+ * @param iterationCount The number of Richardson-Lucy iterations to perform on the data before returning.
2646
+ * If 0, the src buffer is coped to dest.
2647
+ *
2648
+ *
2649
+ * @param flags The following flags are allowed:
2650
+ * <pre>@textblock
2651
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2652
+ * copy the corresponding source pixel to the destination. This
2653
+ * will result in a ring off unconvolved content at the edges
2654
+ * and convolved content in the middle.
2655
+ *
2656
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2657
+ * For a blur filter this will look like the edges of the image
2658
+ * have been blurred into a particular color. This is usually
2659
+ * appropriate when the color of the surface onto which the image
2660
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2661
+ * as a background color, and let the downstream image compositor
2662
+ * blend in the background color. In this case, the result image
2663
+ * should be treated as a premultiplied image.
2664
+ *
2665
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2666
+ * This is better when the image is drawn into a frame or other
2667
+ * context where the background is not expected to contribute to
2668
+ * the final content.
2669
+ *
2670
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2671
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2672
+ * Because of the complication at the edges, this edging mode can
2673
+ * be significantly slower than the others. It can be numerically
2674
+ * unstable if the sum over any rectangular subsection of the kernel
2675
+ * is zero, which can result in division by zero during the computation.
2676
+ * The results for this edging mode are usually quite visually similar
2677
+ * to kvImageEdgeExtend.
2678
+ *
2679
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2680
+ * size of the temp buffer needed for this set of parameters. Does
2681
+ * not touch the src or dest image.
2682
+ *
2683
+ * kvImageDoNotTile Disable internal multithreading.
2684
+ *
2685
+ * kvImageLeaveAlphaUnchanged Operate only on the last 3 channels in memory. Leave the first channel
2686
+ * unmodified.
2687
+ *
2688
+ * @/textblock </pre>
2689
+ * The first four flags listed are edging modes. One and only one edging mode must be
2690
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2691
+ * be returned.
2692
+ *
2693
+ * @return One of the following error codes may be returned:
2694
+ * <pre>@textblock
2695
+ * kvImageNoError Success.
2696
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
2697
+ * the temp buffer to use with this function and this set of
2698
+ * parameters.
2699
+ *
2700
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
2701
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
2702
+ * kvImageEdgeExtend, kvImageTruncateKernel }
2703
+ *
2704
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
2705
+ * to corresponding dimensions of the source buffer.
2706
+ *
2707
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
2708
+ *
2709
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
2710
+ *
2711
+ * kvImageNullPointerArgument kernel may not be NULL
2712
+ *
2713
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
2714
+ *
2715
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
2716
+ * @/textblock </pre>
2717
+ */
2718
+ VIMAGE_PF vImage_Error vImageRichardsonLucyDeConvolve_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, const int16_t *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, int32_t divisor, int32_t divisor2, const Pixel_8888 backgroundColor, uint32_t iterationCount, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
2719
+
2720
+ /*!
2721
+ * @function vImageRichardsonLucyDeConvolve_ARGBFFFF
2722
+ * @abstract Perform N iterations of a Lucy-Richardson deconvolution on ARGBFFFF data
2723
+ * @discussion
2724
+ * This routine iteratively uses the following formula:
2725
+ * <pre>@textblock
2726
+ * e[i+1] = e[i] x (psf0 * ( e[0] / (psf1 * e[i]) ) )
2727
+ *
2728
+ * where:
2729
+ * e[0] = the observed image (src parameter)
2730
+ * e[n] = the result of the nth iteration
2731
+ * psf = point spread function (kernel for call to convolution)
2732
+ * x = multiply operator
2733
+ * '*' = convolution operator
2734
+ * @/textblock </pre>
2735
+ *
2736
+ * The channels are operated on independently of one another. Consequently, this function will work on
2737
+ * any 4-channel interleaved 8-bit per component format (e.g. RGBA, BGRA...), not just ARGB.
2738
+ *
2739
+ * Does not work in place.
2740
+ * @param src The input image
2741
+ *
2742
+ * @param dest A preallocated buffer to receive the result image.
2743
+ * This may not alias the src image.
2744
+ *
2745
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
2746
+ * computation. The size of the tempBuffer is given by calling the function
2747
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
2748
+ * the size is returned instead of an error code from the left hand side.
2749
+ * You may pass NULL here, in which case a region of memory of similar size
2750
+ * will be allocated by the function and freed before it returns. Temp Buffers
2751
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
2752
+ * buffers. If you will be calling this function repeatedly with similar parameters
2753
+ * you should use a temp buffer. If the function is called from different threads
2754
+ * concurrently, a different temp buffer should be used for each.
2755
+ *
2756
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
2757
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2758
+ * when the destination tile is not aligned with the left edge of the image.
2759
+ *
2760
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
2761
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2762
+ * when the destination tile is not aligned with the top edge of the image.
2763
+ *
2764
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
2765
+ * For example, for a simple 3x3 blur, it might be:
2766
+ * <pre>@textblock
2767
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
2768
+ * 2./16, 4./16, 2./16,
2769
+ * 1./16, 2./16, 1./16 };
2770
+ * @/textblock </pre>
2771
+ *
2772
+ * This is psf0 in the formula given in the discussion.
2773
+ *
2774
+ * @param kernel2 A pointer to a second 1D array of weights of dimension kernel_height2 x kernel_width2.
2775
+ * This is psf1 in the formula given in the discussion.
2776
+ *
2777
+ * @param kernel_height The height of the 2D table of weights passed in as kernel1. It must be an odd number.
2778
+ *
2779
+ * @param kernel_width The width of the 2D table of weights passed in as kernel1. It must be an odd number.
2780
+ *
2781
+ * @param kernel_height2 The height of the 2D table of weights passed in as kernel2. It must be an odd number.
2782
+ *
2783
+ * @param kernel_width2 The width of the 2D table of weights passed in as kernel2. It must be an odd number.
2784
+ *
2785
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2786
+ * parameter provides the background color to be used for missing pixels when the
2787
+ * kernel extends off the edge of the image.
2788
+ *
2789
+ * @param iterationCount The number of Richardson-Lucy iterations to perform on the data before returning.
2790
+ * If 0, the src buffer is coped to dest.
2791
+ *
2792
+ *
2793
+ * @param flags The following flags are allowed:
2794
+ * <pre>@textblock
2795
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2796
+ * copy the corresponding source pixel to the destination. This
2797
+ * will result in a ring off unconvolved content at the edges
2798
+ * and convolved content in the middle.
2799
+ *
2800
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2801
+ * For a blur filter this will look like the edges of the image
2802
+ * have been blurred into a particular color. This is usually
2803
+ * appropriate when the color of the surface onto which the image
2804
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2805
+ * as a background color, and let the downstream image compositor
2806
+ * blend in the background color. In this case, the result image
2807
+ * should be treated as a premultiplied image.
2808
+ *
2809
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2810
+ * This is better when the image is drawn into a frame or other
2811
+ * context where the background is not expected to contribute to
2812
+ * the final content.
2813
+ *
2814
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2815
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2816
+ * Because of the complication at the edges, this edging mode can
2817
+ * be significantly slower than the others. It can be numerically
2818
+ * unstable if the sum over any rectangular subsection of the kernel
2819
+ * is zero, which can result in division by zero during the computation.
2820
+ * The results for this edging mode are usually quite visually similar
2821
+ * to kvImageEdgeExtend.
2822
+ *
2823
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2824
+ * size of the temp buffer needed for this set of parameters. Does
2825
+ * not touch the src or dest image.
2826
+ *
2827
+ * kvImageDoNotTile Disable internal multithreading.
2828
+ *
2829
+ * kvImageLeaveAlphaUnchanged Operate only on the last 3 channels in memory. Leave the first channel
2830
+ * unmodified.
2831
+ *
2832
+ * @/textblock </pre>
2833
+ * The first four flags listed are edging modes. One and only one edging mode must be
2834
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2835
+ * be returned.
2836
+ *
2837
+ * @return One of the following error codes may be returned:
2838
+ * <pre>@textblock
2839
+ * kvImageNoError Success.
2840
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
2841
+ * the temp buffer to use with this function and this set of
2842
+ * parameters.
2843
+ *
2844
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
2845
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
2846
+ * kvImageEdgeExtend, kvImageTruncateKernel }
2847
+ *
2848
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
2849
+ * to corresponding dimensions of the source buffer.
2850
+ *
2851
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
2852
+ *
2853
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
2854
+ *
2855
+ * kvImageNullPointerArgument kernel may not be NULL
2856
+ *
2857
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
2858
+ *
2859
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
2860
+ * @/textblock </pre>
2861
+ */
2862
+ VIMAGE_PF vImage_Error vImageRichardsonLucyDeConvolve_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, const float *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, const Pixel_FFFF backgroundColor, uint32_t iterationCount, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
2863
+
2864
+ /*!
2865
+ * @functiongroup Box Convolve
2866
+ * @discussion A box convolve is a special case of the standard convolution, which has a much faster algorithm.
2867
+ * A box kernel is a kernel populated with all 1's. This returns the unweighted average of the pixels
2868
+ * near the result pixel. Unlike general purpose convolution, the cost of a box convolve algorithm
2869
+ * is theoretically constant regardless of kernel size, so it can be an inexpensive choice for very
2870
+ * large blurs. The box convolve behavior may not be as desired, however, because the blur effect is
2871
+ * rectangular in appearance, whereas most expect it to be gaussian or roughly circular. A tent blur has
2872
+ * similar rectangular character, but because the weighting is non uniform, it is less obvious. A
2873
+ * tent blur is also constant cost per pixel, but larger constant cost.
2874
+ *
2875
+ * Two box blur passes of the same kernel size results in a tent blur. To see this we can take a 1-d starting image:
2876
+ * <pre> @textblock
2877
+ * p0 p1 p2 p3 p4 p5 p6
2878
+ * @/textblock </pre>
2879
+ * and blur it once with a 3 wide box blur, ignoring for the moment what happens at the edges:
2880
+ * <pre> @textblock
2881
+ * (edge) p0+p1+p2 p1+p2+p3 p2+p3+p4 p3+p4+p5 p4+p5+p6 p5+p6+p7
2882
+ * @/textblock </pre>
2883
+ * and a second time:
2884
+ * <pre> @textblock
2885
+ * (edge) p0+2p1+3p2+2p3+p4 p2+2p3+3p4+2p5+p6 p4+2p5+3p6+2p7+p8 .....
2886
+ * (edge) p1+2p2+3p3+2p4+p5 p3+2p4+3p5+2p6+p7
2887
+ * @/textblock </pre>
2888
+ *
2889
+ * If this process is continued, the shape converges towards a gaussian over multiple passes.
2890
+ * <pre>@textblock
2891
+ * =========================================================================
2892
+ * ====== MOST VIMAGE CONVOLUTION FUNCTIONS DO NOT WORK IN PLACE =====
2893
+ * =========================================================================
2894
+ * @/textblock </pre>
2895
+ */
2896
+
2897
+ /*!
2898
+ * @function vImageBoxConvolve_Planar8
2899
+ * @abstract Special purpose box convolution on a Planar8 image.
2900
+ * @discussion This filter applies a box filter to a Planar8 image. A box filter uses a much faster algorithm
2901
+ * than a standard convolution, and may be a good solution for real time application of large blur
2902
+ * radii against images.
2903
+ * For each pixel:
2904
+ * <pre>@textblock
2905
+ * vImagePixelCount kernel_area = kernel_height * kernel_width;
2906
+ * for each pixel[y][x] in image{
2907
+ * int sum = 0;
2908
+ *
2909
+ * // Calculate unweighted average over kernel area
2910
+ * for each kernel_element[i][j] in kernel{
2911
+ * sum += pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
2912
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
2913
+ * }
2914
+ * // Correct for the scaling introduced by multiplying by the weights table
2915
+ * sum = (sum + kernel_area/2) / kernel_area;
2916
+ *
2917
+ * // write out result
2918
+ * result[y][x] = CLAMP(sum, 0, 255);
2919
+ * }
2920
+ * @/textblock </pre>
2921
+ *
2922
+ * This filter does not work in place.
2923
+ *
2924
+ * @param src The input image
2925
+ *
2926
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
2927
+ * This may not alias the src image.
2928
+ *
2929
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
2930
+ * computation. The size of the tempBuffer is given by calling the function
2931
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
2932
+ * the size is returned instead of an error code from the left hand side.
2933
+ * You may pass NULL here, in which case a region of memory of similar size
2934
+ * will be allocated by the function and freed before it returns. Temp Buffers
2935
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
2936
+ * buffers. If you will be calling this function repeatedly with similar parameters
2937
+ * you should use a temp buffer. If the function is called from different threads
2938
+ * concurrently, a different temp buffer should be used for each.
2939
+ *
2940
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
2941
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2942
+ * when the destination tile is not aligned with the left edge of the image.
2943
+ *
2944
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
2945
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
2946
+ * when the destination tile is not aligned with the top edge of the image.
2947
+ *
2948
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
2949
+ *
2950
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
2951
+ *
2952
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
2953
+ * parameter provides the background color to be used for missing pixels when the
2954
+ * kernel extends off the edge of the image.
2955
+ *
2956
+ * @param flags The following flags are allowed:
2957
+ * <pre>@textblock
2958
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
2959
+ * copy the corresponding source pixel to the destination. This
2960
+ * will result in a ring off unconvolved content at the edges
2961
+ * and convolved content in the middle.
2962
+ *
2963
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
2964
+ * For a blur filter this will look like the edges of the image
2965
+ * have been blurred into a particular color. This is usually
2966
+ * appropriate when the color of the surface onto which the image
2967
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
2968
+ * as a background color, and let the downstream image compositor
2969
+ * blend in the background color. In this case, the result image
2970
+ * should be treated as a premultiplied image.
2971
+ *
2972
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
2973
+ * This is better when the image is drawn into a frame or other
2974
+ * context where the background is not expected to contribute to
2975
+ * the final content.
2976
+ *
2977
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
2978
+ * simply ignored, and the bias and divisor are adjusted accordingly.
2979
+ * Because of the complication at the edges, this edging mode can
2980
+ * be significantly slower than the others. It can be numerically
2981
+ * unstable if the sum over any rectangular subsection of the kernel
2982
+ * is zero, which can result in division by zero during the computation.
2983
+ * The results for this edging mode are usually quite visually similar
2984
+ * to kvImageEdgeExtend.
2985
+ *
2986
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
2987
+ * size of the temp buffer needed for this set of parameters. Does
2988
+ * not touch the src or dest image.
2989
+ *
2990
+ * kvImageDoNotTile Disable internal multithreading.
2991
+ *
2992
+ * @/textblock </pre>
2993
+ * The first four flags listed are edging modes. One and only one edging mode must be
2994
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
2995
+ * be returned.
2996
+ *
2997
+ * @return One of the following error codes may be returned:
2998
+ * <pre>@textblock
2999
+ * kvImageNoError Success.
3000
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3001
+ * the temp buffer to use with this function and this set of
3002
+ * parameters.
3003
+ *
3004
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3005
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3006
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3007
+ *
3008
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3009
+ * to corresponding dimensions of the source buffer.
3010
+ *
3011
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3012
+ *
3013
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3014
+ *
3015
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3016
+ *
3017
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
3018
+ * @/textblock </pre>
3019
+ */
3020
+ VIMAGE_PF vImage_Error vImageBoxConvolve_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, Pixel_8 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
3021
+
3022
+ /*!
3023
+ * @function vImageBoxConvolve_ARGB8888
3024
+ * @abstract Special purpose box convolution on a 4-channel interleaved, 8-bit per channel image.
3025
+ * @discussion This filter applies a box filter to a 4-channel interleaved, 8-bit per channel imagee.
3026
+ * A box filter uses a much faster algorithm than a standard convolution, and may be a good
3027
+ * solution for real time application of large blur radii against images.
3028
+ * For each pixel:
3029
+ * <pre>@textblock
3030
+ * vImagePixelCount kernel_area = kernel_height * kernel_width;
3031
+ * for each pixel[y][x] in image{
3032
+ * int sumA = 0;
3033
+ * int sumR = 0;
3034
+ * int sumG = 0;
3035
+ * int sumB = 0;
3036
+ *
3037
+ * // Calculate unweighted average over kernel area
3038
+ * for each kernel_element[i][j] in kernel{
3039
+ * sumA += pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3040
+ * [x+j+srcOffsetToROI_X- kernel_width/2][0];
3041
+ * sumR += pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3042
+ * [x+j+srcOffsetToROI_X- kernel_width/2][1];
3043
+ * sumG += pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3044
+ * [x+j+srcOffsetToROI_X- kernel_width/2][2];
3045
+ * sumB += pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3046
+ * [x+j+srcOffsetToROI_X- kernel_width/2][3];
3047
+ * }
3048
+ * // Correct for the scaling introduced by multiplying by the weights table
3049
+ * sumA = (sumA + kernel_area/2) / kernel_area;
3050
+ * sumR = (sumR + kernel_area/2) / kernel_area;
3051
+ * sumG = (sumG + kernel_area/2) / kernel_area;
3052
+ * sumB = (sumB + kernel_area/2) / kernel_area;
3053
+ *
3054
+ * // write out result
3055
+ * result[y][x][0] = CLAMP(sumA, 0, 255);
3056
+ * result[y][x][1] = CLAMP(sumR, 0, 255);
3057
+ * result[y][x][2] = CLAMP(sumG, 0, 255);
3058
+ * result[y][x][3] = CLAMP(sumB, 0, 255);
3059
+ * }
3060
+ * @/textblock </pre>
3061
+ *
3062
+ * This filter does not work in place.
3063
+ *
3064
+ * This filter will work without modification for other byte orders such as RGBA, BGRA, AGBR, CMYK, etc.
3065
+ * The image should be non-premultiplied to avoid odd results in non-opaque regions.
3066
+ *
3067
+ * @param src The input image
3068
+ *
3069
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3070
+ * This may not alias the src image.
3071
+ *
3072
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3073
+ * computation. The size of the tempBuffer is given by calling the function
3074
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3075
+ * the size is returned instead of an error code from the left hand side.
3076
+ * You may pass NULL here, in which case a region of memory of similar size
3077
+ * will be allocated by the function and freed before it returns. Temp Buffers
3078
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3079
+ * buffers. If you will be calling this function repeatedly with similar parameters
3080
+ * you should use a temp buffer. If the function is called from different threads
3081
+ * concurrently, a different temp buffer should be used for each.
3082
+ *
3083
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3084
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3085
+ * when the destination tile is not aligned with the left edge of the image.
3086
+ *
3087
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3088
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3089
+ * when the destination tile is not aligned with the top edge of the image.
3090
+ *
3091
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
3092
+ *
3093
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
3094
+ *
3095
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
3096
+ * parameter provides the background color to be used for missing pixels when the
3097
+ * kernel extends off the edge of the image.
3098
+ *
3099
+ * @param flags The following flags are allowed:
3100
+ * <pre>@textblock
3101
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
3102
+ * copy the corresponding source pixel to the destination. This
3103
+ * will result in a ring off unconvolved content at the edges
3104
+ * and convolved content in the middle.
3105
+ *
3106
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
3107
+ * For a blur filter this will look like the edges of the image
3108
+ * have been blurred into a particular color. This is usually
3109
+ * appropriate when the color of the surface onto which the image
3110
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
3111
+ * as a background color, and let the downstream image compositor
3112
+ * blend in the background color. In this case, the result image
3113
+ * should be treated as a premultiplied image.
3114
+ *
3115
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
3116
+ * This is better when the image is drawn into a frame or other
3117
+ * context where the background is not expected to contribute to
3118
+ * the final content.
3119
+ *
3120
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
3121
+ * simply ignored, and the bias and divisor are adjusted accordingly.
3122
+ * Because of the complication at the edges, this edging mode can
3123
+ * be significantly slower than the others. It can be numerically
3124
+ * unstable if the sum over any rectangular subsection of the kernel
3125
+ * is zero, which can result in division by zero during the computation.
3126
+ * The results for this edging mode are usually quite visually similar
3127
+ * to kvImageEdgeExtend.
3128
+ *
3129
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
3130
+ * size of the temp buffer needed for this set of parameters. Does
3131
+ * not touch the src or dest image.
3132
+ *
3133
+ * kvImageLeaveAlphaUnchanged Apply the convolution to the last three channels in memory, only.
3134
+ *
3135
+ * kvImageDoNotTile Disable internal multithreading.
3136
+ *
3137
+ * @/textblock </pre>
3138
+ * The first four flags listed are edging modes. One and only one edging mode must be
3139
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
3140
+ * be returned.
3141
+ *
3142
+ * @return One of the following error codes may be returned:
3143
+ * <pre>@textblock
3144
+ * kvImageNoError Success.
3145
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3146
+ * the temp buffer to use with this function and this set of
3147
+ * parameters.
3148
+ *
3149
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3150
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3151
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3152
+ *
3153
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3154
+ * to corresponding dimensions of the source buffer.
3155
+ *
3156
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3157
+ *
3158
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3159
+ *
3160
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3161
+ *
3162
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
3163
+ * @/textblock </pre>
3164
+ */
7
3165
  VIMAGE_PF vImage_Error vImageBoxConvolve_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, const Pixel_8888 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
3166
+
3167
+ /*!
3168
+ * @functiongroup Tent Convolve
3169
+ * @discussion A tent convolve is a special case of the standard convolution, which has a much faster algorithm.
3170
+ * A tent kernel is a kernel populated with slope of 1 rising towards the center. 2D kernels
3171
+ * are calculated as the product of the appropriate 1D kernels. e.g.
3172
+ * <pre> @textblock
3173
+ * {1,2,3,2,1}
3174
+ * @/textblock </pre>
3175
+ * or
3176
+ * <pre> @textblock
3177
+ * |1| { {1,2,1},
3178
+ * |2| * {1,2,1} = {2,4,2},
3179
+ * |1| {1,2,1} }
3180
+ * @/textblock </pre>
3181
+ * This returns a blur that is more heavily weighted towards the center pixel than a box blur.
3182
+ *
3183
+ * Unlike general purpose convolution, the cost of a tent convolve algorithm is theoretically constant
3184
+ * regardless of kernel size, so it can be an inexpensive choice for very large blurs. The tent convolve
3185
+ * behavior may not be as desired, however, because the blur effect is rectangular in appearance, whereas
3186
+ * most expect a blurring effect to be gaussian or roughly circular. The rectangularity of the tent blur
3187
+ * is less obvious than the box blur. A tent blur has somewhat larger constant cost than a box blur.
3188
+ *
3189
+ * <pre>@textblock
3190
+ * =========================================================================
3191
+ * ====== MOST VIMAGE CONVOLUTION FUNCTIONS DO NOT WORK IN PLACE =====
3192
+ * =========================================================================
3193
+ * @/textblock </pre>
3194
+ */
3195
+
3196
+ /*!
3197
+ * @function vImageTentConvolve_Planar8
3198
+ * @abstract Special purpose tent convolution on a Planar8 image.
3199
+ * @discussion This filter applies a tent filter to a Planar8 image. A tent filter uses a much faster algorithm
3200
+ * than a standard convolution, and may be a good solution for real time application of large blur
3201
+ * radii against images.
3202
+ * For each pixel:
3203
+ * <pre>@textblock
3204
+ * for each pixel[y][x] in image{
3205
+ * int sum = 0;
3206
+ * int divisor = 0;
3207
+ *
3208
+ * // Calculate weighted average over kernel area
3209
+ * for each kernel_element[i][j] in kernel{
3210
+ * sum += kernel_element[i][j] *
3211
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3212
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
3213
+ * divisor += kernel_element[i][j];
3214
+ * }
3215
+ *
3216
+ * // Correct for the scaling introduced by multiplying by the weights table
3217
+ * sum = (sum + divisor/2) / divisor;
3218
+ *
3219
+ * // write out result
3220
+ * result[y][x] = CLAMP(sum, 0, 255);
3221
+ * }
3222
+ * @/textblock </pre>
3223
+ *
3224
+ * This filter does not work in place.
3225
+ *
3226
+ * @param src The input image
3227
+ *
3228
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3229
+ * This may not alias the src image.
3230
+ *
3231
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3232
+ * computation. The size of the tempBuffer is given by calling the function
3233
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3234
+ * the size is returned instead of an error code from the left hand side.
3235
+ * You may pass NULL here, in which case a region of memory of similar size
3236
+ * will be allocated by the function and freed before it returns. Temp Buffers
3237
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3238
+ * buffers. If you will be calling this function repeatedly with similar parameters
3239
+ * you should use a temp buffer. If the function is called from different threads
3240
+ * concurrently, a different temp buffer should be used for each.
3241
+ *
3242
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3243
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3244
+ * when the destination tile is not aligned with the left edge of the image.
3245
+ *
3246
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3247
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3248
+ * when the destination tile is not aligned with the top edge of the image.
3249
+ *
3250
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
3251
+ *
3252
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
3253
+ *
3254
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
3255
+ * parameter provides the background color to be used for missing pixels when the
3256
+ * kernel extends off the edge of the image.
3257
+ *
3258
+ * @param flags The following flags are allowed:
3259
+ * <pre>@textblock
3260
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
3261
+ * copy the corresponding source pixel to the destination. This
3262
+ * will result in a ring off unconvolved content at the edges
3263
+ * and convolved content in the middle.
3264
+ *
3265
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
3266
+ * For a blur filter this will look like the edges of the image
3267
+ * have been blurred into a particular color. This is usually
3268
+ * appropriate when the color of the surface onto which the image
3269
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
3270
+ * as a background color, and let the downstream image compositor
3271
+ * blend in the background color. In this case, the result image
3272
+ * should be treated as a premultiplied image.
3273
+ *
3274
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
3275
+ * This is better when the image is drawn into a frame or other
3276
+ * context where the background is not expected to contribute to
3277
+ * the final content.
3278
+ *
3279
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
3280
+ * simply ignored, and the bias and divisor are adjusted accordingly.
3281
+ * Because of the complication at the edges, this edging mode can
3282
+ * be significantly slower than the others. It can be numerically
3283
+ * unstable if the sum over any rectangular subsection of the kernel
3284
+ * is zero, which can result in division by zero during the computation.
3285
+ * The results for this edging mode are usually quite visually similar
3286
+ * to kvImageEdgeExtend.
3287
+ *
3288
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
3289
+ * size of the temp buffer needed for this set of parameters. Does
3290
+ * not touch the src or dest image.
3291
+ *
3292
+ * kvImageDoNotTile Disable internal multithreading.
3293
+ *
3294
+ * @/textblock </pre>
3295
+ * The first four flags listed are edging modes. One and only one edging mode must be
3296
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
3297
+ * be returned.
3298
+ *
3299
+ * @return One of the following error codes may be returned:
3300
+ * <pre>@textblock
3301
+ * kvImageNoError Success.
3302
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3303
+ * the temp buffer to use with this function and this set of
3304
+ * parameters.
3305
+ *
3306
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3307
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3308
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3309
+ *
3310
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3311
+ * to corresponding dimensions of the source buffer.
3312
+ *
3313
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3314
+ *
3315
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3316
+ *
3317
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3318
+ *
3319
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
3320
+ *
3321
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
3322
+ * @/textblock </pre>
3323
+ */
3324
+ VIMAGE_PF vImage_Error vImageTentConvolve_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, Pixel_8 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
3325
+
3326
+
3327
+
3328
+
3329
+ /*!
3330
+ * @function vImageTentConvolve_ARGB8888
3331
+ * @abstract Special purpose tent convolution on a 4-channel interleaved, 8-bit per channel image.
3332
+ * @discussion This filter applies a tent filter to a 4-channel interleaved, 8-bit per channel imagee.
3333
+ * A tent filter uses a much faster algorithm than a standard convolution, and may be a good
3334
+ * solution for real time application of large blur radii against images.
3335
+ * For each pixel:
3336
+ * <pre>@textblock
3337
+ * for each pixel[y][x] in image{
3338
+ * int sumA = 0;
3339
+ * int sumR = 0;
3340
+ * int sumG = 0;
3341
+ * int sumB = 0;
3342
+ * int divisor = 0;
3343
+ *
3344
+ * // Calculate weighted average over kernel area
3345
+ * for each kernel_element[i][j] in kernel{
3346
+ * sumA += kernel_element[i][j] *
3347
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][0];
3348
+ * sumR += kernel_element[i][j] *
3349
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][1];
3350
+ * sumG += kernel_element[i][j] *
3351
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][2];
3352
+ * sumB += kernel_element[i][j] *
3353
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][3];
3354
+ * divisor += kernel_element[i][j];
3355
+ * }
3356
+ * // Correct for the scaling introduced by multiplying by the weights table
3357
+ * sumA = (sumA + divisor/2) / divisor;
3358
+ * sumR = (sumR + divisor/2) / divisor;
3359
+ * sumG = (sumG + divisor/2) / divisor;
3360
+ * sumB = (sumB + divisor/2) / divisor;
3361
+ *
3362
+ * // write out result
3363
+ * result[y][x][0] = CLAMP(sumA, 0, 255);
3364
+ * result[y][x][1] = CLAMP(sumR, 0, 255);
3365
+ * result[y][x][2] = CLAMP(sumG, 0, 255);
3366
+ * result[y][x][3] = CLAMP(sumB, 0, 255);
3367
+ * }
3368
+ * @/textblock </pre>
3369
+ *
3370
+ * This filter does not work in place.
3371
+ *
3372
+ * This filter will work without modification for other byte orders such as RGBA, BGRA, AGBR, CMYK, etc.
3373
+ * The image should be non-premultiplied to avoid odd results in non-opaque regions.
3374
+ *
3375
+ * @param src The input image
3376
+ *
3377
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3378
+ * This may not alias the src image.
3379
+ *
3380
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3381
+ * computation. The size of the tempBuffer is given by calling the function
3382
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3383
+ * the size is returned instead of an error code from the left hand side.
3384
+ * You may pass NULL here, in which case a region of memory of similar size
3385
+ * will be allocated by the function and freed before it returns. Temp Buffers
3386
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3387
+ * buffers. If you will be calling this function repeatedly with similar parameters
3388
+ * you should use a temp buffer. If the function is called from different threads
3389
+ * concurrently, a different temp buffer should be used for each.
3390
+ *
3391
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3392
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3393
+ * when the destination tile is not aligned with the left edge of the image.
3394
+ *
3395
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3396
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3397
+ * when the destination tile is not aligned with the top edge of the image.
3398
+ *
3399
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
3400
+ *
3401
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
3402
+ *
3403
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
3404
+ * parameter provides the background color to be used for missing pixels when the
3405
+ * kernel extends off the edge of the image.
3406
+ *
3407
+ * @param flags The following flags are allowed:
3408
+ * <pre>@textblock
3409
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
3410
+ * copy the corresponding source pixel to the destination. This
3411
+ * will result in a ring off unconvolved content at the edges
3412
+ * and convolved content in the middle.
3413
+ *
3414
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
3415
+ * For a blur filter this will look like the edges of the image
3416
+ * have been blurred into a particular color. This is usually
3417
+ * appropriate when the color of the surface onto which the image
3418
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
3419
+ * as a background color, and let the downstream image compositor
3420
+ * blend in the background color. In this case, the result image
3421
+ * should be treated as a premultiplied image.
3422
+ *
3423
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
3424
+ * This is better when the image is drawn into a frame or other
3425
+ * context where the background is not expected to contribute to
3426
+ * the final content.
3427
+ *
3428
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
3429
+ * simply ignored, and the bias and divisor are adjusted accordingly.
3430
+ * Because of the complication at the edges, this edging mode can
3431
+ * be significantly slower than the others. It can be numerically
3432
+ * unstable if the sum over any rectangular subsection of the kernel
3433
+ * is zero, which can result in division by zero during the computation.
3434
+ * The results for this edging mode are usually quite visually similar
3435
+ * to kvImageEdgeExtend.
3436
+ *
3437
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
3438
+ * size of the temp buffer needed for this set of parameters. Does
3439
+ * not touch the src or dest image.
3440
+ *
3441
+ * kvImageLeaveAlphaUnchanged Apply the convolution to the last three channels in memory, only.
3442
+ *
3443
+ * kvImageDoNotTile Disable internal multithreading.
3444
+ *
3445
+ * @/textblock </pre>
3446
+ * The first four flags listed are edging modes. One and only one edging mode must be
3447
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
3448
+ * be returned.
3449
+ *
3450
+ * @return One of the following error codes may be returned:
3451
+ * <pre>@textblock
3452
+ * kvImageNoError Success.
3453
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3454
+ * the temp buffer to use with this function and this set of
3455
+ * parameters.
3456
+ *
3457
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3458
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3459
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3460
+ *
3461
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3462
+ * to corresponding dimensions of the source buffer.
3463
+ *
3464
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3465
+ *
3466
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3467
+ *
3468
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3469
+ *
3470
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
3471
+ * @/textblock </pre>
3472
+ */
3473
+ VIMAGE_PF vImage_Error vImageTentConvolve_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, const Pixel_8888 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
3474
+
3475
+ /*!
3476
+ * @functiongroup Separable Convolution
3477
+ *
3478
+ * @discussion A separable convolution applies two separate 1D filters along the rows and columns
3479
+ * of an image in succession. This allows for a faster implementation compared to
3480
+ * applying the corresponding 2D convolution filter, which is the outer product of the
3481
+ * two 1D filters. An example is the Sobel filter for approximating the image gradient.
3482
+ * The Sobel filter is composed of the averaging filter {1,2,1} and the differentiation
3483
+ * filter {-1,0,1}. For the image x-derivative, this results in the general 2D filter:
3484
+ * <pre> @textblock
3485
+ * |1| { {-1,0,1},
3486
+ * |2| * {-1,0,1} = {-2,0,2},
3487
+ * |1| {-1,0,1} }
3488
+ * @/textblock </pre>
3489
+ * The specialized tent convolve filter vImageTentConvolve_Planar8() is a particular
3490
+ * example of a separable filter.
3491
+ *
3492
+ * There are functions for separable convolution of Planar8 (8-bit integer) and
3493
+ * PlanarF (float) images, just as for the general 2D convolutions functions above.
3494
+ * In addition, there are functions for separable convolution of Planar16U (16-bit
3495
+ * integer) images and Planar8 to Planar16U images. These 16-bit versions can be used
3496
+ * to, for example, implement scale-space filtering where several layers of Gaussian
3497
+ * smoothed images, with increasing sigma, are generated. The initial image is often
3498
+ * 8-bit and the Gaussian smoothed images are represented with 16 bits of precision.
3499
+ *
3500
+ * A difference in the API of these separable convolution functions, compared to the
3501
+ * general 2D functions above, is that all planar integer versions uses floating point
3502
+ * kernels, just as the PlanarF version. This allows for increased precision while
3503
+ * still being fast on modern processors. The general convolution function
3504
+ * vImageConvolve_Planar8() is using 16-bit kernels with a 32-bit integer accumulator
3505
+ * becasue at the time it was first implemented this allowed for faster execution.
3506
+ *
3507
+ * All separable convolution functions also support a bias which is added to the
3508
+ * weighted sum of the pixels. This can be used to control the range of planar integer
3509
+ * images and effectively treating the 8-bit and 16-bit versions as signed ranges.
3510
+ * Since all separable functions support a bias as input parameter the WithBias string
3511
+ * has not been added to the functions names.
3512
+ *
3513
+ */
3514
+
3515
+ /*!
3516
+ * @function vImageSepConvolve_Planar8
3517
+ * @abstract Separable convolution on a Planar8 image.
3518
+ * @discussion This filter applies two separate 1D filters along the rows and columns of
3519
+ * a Planar8 image.
3520
+ *
3521
+ * For each pixel:
3522
+ * <pre>@textblock
3523
+ * for each pixel[y][x] in image {
3524
+ * float sum = bias;
3525
+ *
3526
+ * // Calculate weighted average over kernel area
3527
+ * for each kernelY_element[i] in kernelY {
3528
+ * for each kernelX_element[j] in kernelX {
3529
+ * sum += kernelY_element[i] * kernelX_element[j] *
3530
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3531
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
3532
+ * }
3533
+ * }
3534
+ * // Add 0.5 to round to nearest int when converting float to uint8_t
3535
+ * sum = sum + 0.5f;
3536
+ *
3537
+ * // write out result
3538
+ * result[y][x] = (uint8_t)CLAMP(sum, 0, 255);
3539
+ * }
3540
+ * @/textblock </pre>
3541
+ *
3542
+ * This filter does not work in place.
3543
+ *
3544
+ * @param src The input image
3545
+ *
3546
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3547
+ * This may not alias the src image.
3548
+ *
3549
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3550
+ * computation. The size of the tempBuffer is given by calling the function
3551
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3552
+ * the size is returned instead of an error code from the left hand side.
3553
+ * You may pass NULL here, in which case a region of memory of similar size
3554
+ * will be allocated by the function and freed before it returns. Temp Buffers
3555
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3556
+ * buffers. If you will be calling this function repeatedly with similar parameters
3557
+ * you should use a temp buffer. If the function is called from different threads
3558
+ * concurrently, a different temp buffer should be used for each.
3559
+ *
3560
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3561
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3562
+ * when the destination tile is not aligned with the left edge of the image.
3563
+ *
3564
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3565
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3566
+ * when the destination tile is not aligned with the top edge of the image.
3567
+ *
3568
+ * @param kernelX A pointer to a 1D array of weights of dimension kernelX_width.
3569
+ * For example, for a simple 3x3 Sobel x-derivative filter it's {-1.0, 0.0, 1.0}.
3570
+ *
3571
+ * @param kernelX_width The width of the 1D array of weights passed in as kernelX. It must be an odd number.
3572
+ *
3573
+ * @param kernelY A pointer to a 1D array of weights of dimension kernelY_width.
3574
+ * For example, for a simple 3x3 Sobel x-derivative filter it's {1.0, 2.0, 1.0}.
3575
+ *
3576
+ * @param kernelY_width The width of the 1D array of weights passed in as kernelY. It must be an odd number.
3577
+ *
3578
+ * @param bias This value is added to the sum of weighted pixels.
3579
+ * You might provide a bias of 128 to move the encoding for 0 to 128 so that
3580
+ * negative numbers are representable, such as Sobel derivative filters.
3581
+ *
3582
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
3583
+ * parameter provides the background color to be used for missing pixels when the
3584
+ * kernel extends off the edge of the image.
3585
+ *
3586
+ * @param flags The following flags are allowed:
3587
+ * <pre>@textblock
3588
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
3589
+ * copy the corresponding source pixel to the destination. This
3590
+ * will result in a ring off unconvolved content at the edges
3591
+ * and convolved content in the middle.
3592
+ *
3593
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
3594
+ * For a blur filter this will look like the edges of the image
3595
+ * have been blurred into a particular color. This is usually
3596
+ * appropriate when the color of the surface onto which the image
3597
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
3598
+ * as a background color, and let the downstream image compositor
3599
+ * blend in the background color. In this case, the result image
3600
+ * should be treated as a premultiplied image.
3601
+ *
3602
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
3603
+ * This is better when the image is drawn into a frame or other
3604
+ * context where the background is not expected to contribute to
3605
+ * the final content.
3606
+ *
3607
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
3608
+ * simply ignored, and the bias and divisor are adjusted accordingly.
3609
+ * Because of the complication at the edges, this edging mode can
3610
+ * be significantly slower than the others. It can be numerically
3611
+ * unstable if the sum over any rectangular subsection of the kernel
3612
+ * is zero, which can result in division by zero during the computation.
3613
+ * The results for this edging mode are usually quite visually similar
3614
+ * to kvImageEdgeExtend.
3615
+ *
3616
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
3617
+ * size of the temp buffer needed for this set of parameters. Does
3618
+ * not touch the src or dest image.
3619
+ *
3620
+ * kvImageDoNotTile Disable internal multithreading.
3621
+ *
3622
+ * @/textblock </pre>
3623
+ * The first four flags listed are edging modes. One and only one edging mode must be
3624
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
3625
+ * be returned.
3626
+ *
3627
+ * @return One of the following error codes may be returned:
3628
+ * <pre>@textblock
3629
+ * kvImageNoError Success.
3630
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3631
+ * the temp buffer to use with this function and this set of
3632
+ * parameters.
3633
+ *
3634
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3635
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3636
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3637
+ *
3638
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3639
+ * to corresponding dimensions of the source buffer.
3640
+ *
3641
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3642
+ *
3643
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3644
+ *
3645
+ * kvImageNullPointerArgument kernel may not be NULL
3646
+ *
3647
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3648
+ *
3649
+ * kvImageInvalidKernelSize The kernel sizes must be odd numbers.
3650
+ * @/textblock </pre>
3651
+ */
3652
+ VIMAGE_PF vImage_Error
3653
+ vImageSepConvolve_Planar8(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
3654
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
3655
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
3656
+ float bias, Pixel_16U backgroundColor, vImage_Flags flags)
3657
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
3658
+
3659
+ /*!
3660
+ * @function vImageSepConvolve_PlanarF
3661
+ * @abstract Separable convolution on a PlanarF image.
3662
+ * @discussion This filter applies two separate 1D filters along the rows and columns of
3663
+ * a PlanarF image.
3664
+ *
3665
+ * For each pixel:
3666
+ * <pre>@textblock
3667
+ * for each pixel[y][x] in image {
3668
+ * float sum = bias;
3669
+ *
3670
+ * // Calculate weighted average over kernel area
3671
+ * for each kernelY_element[i] in kernelY {
3672
+ * for each kernelX_element[j] in kernelX {
3673
+ * sum += kernelY_element[i] * kernelX_element[j] *
3674
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3675
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
3676
+ * }
3677
+ * }
3678
+ *
3679
+ * // write out result
3680
+ * result[y][x] = sum;
3681
+ * }
3682
+ * @/textblock </pre>
3683
+ *
3684
+ * This filter does not work in place.
3685
+ *
3686
+ * @param src The input image
3687
+ *
3688
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3689
+ * This may not alias the src image.
3690
+ *
3691
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3692
+ * computation. The size of the tempBuffer is given by calling the function
3693
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3694
+ * the size is returned instead of an error code from the left hand side.
3695
+ * You may pass NULL here, in which case a region of memory of similar size
3696
+ * will be allocated by the function and freed before it returns. Temp Buffers
3697
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3698
+ * buffers. If you will be calling this function repeatedly with similar parameters
3699
+ * you should use a temp buffer. If the function is called from different threads
3700
+ * concurrently, a different temp buffer should be used for each.
3701
+ *
3702
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3703
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3704
+ * when the destination tile is not aligned with the left edge of the image.
3705
+ *
3706
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3707
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3708
+ * when the destination tile is not aligned with the top edge of the image.
3709
+ *
3710
+ * @param kernelX A pointer to a 1D array of weights of dimension kernelX_width.
3711
+ *
3712
+ * @param kernelX_width The width of the 1D array of weights passed in as kernelX. It must be an odd number.
3713
+ *
3714
+ * @param kernelY A pointer to a 1D array of weights of dimension kernelY_width.
3715
+ *
3716
+ * @param kernelY_width The width of the 1D array of weights passed in as kernelY. It must be an odd number.
3717
+ *
3718
+ * @param bias This value is added to the sum of weighted pixels.
3719
+ *
3720
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
3721
+ * parameter provides the background color to be used for missing pixels when the
3722
+ * kernel extends off the edge of the image.
3723
+ *
3724
+ * @param flags The following flags are allowed:
3725
+ * <pre>@textblock
3726
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
3727
+ * copy the corresponding source pixel to the destination. This
3728
+ * will result in a ring off unconvolved content at the edges
3729
+ * and convolved content in the middle.
3730
+ *
3731
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
3732
+ * For a blur filter this will look like the edges of the image
3733
+ * have been blurred into a particular color. This is usually
3734
+ * appropriate when the color of the surface onto which the image
3735
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
3736
+ * as a background color, and let the downstream image compositor
3737
+ * blend in the background color. In this case, the result image
3738
+ * should be treated as a premultiplied image.
3739
+ *
3740
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
3741
+ * This is better when the image is drawn into a frame or other
3742
+ * context where the background is not expected to contribute to
3743
+ * the final content.
3744
+ *
3745
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
3746
+ * simply ignored, and the bias and divisor are adjusted accordingly.
3747
+ * Because of the complication at the edges, this edging mode can
3748
+ * be significantly slower than the others. It can be numerically
3749
+ * unstable if the sum over any rectangular subsection of the kernel
3750
+ * is zero, which can result in division by zero during the computation.
3751
+ * The results for this edging mode are usually quite visually similar
3752
+ * to kvImageEdgeExtend.
3753
+ *
3754
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
3755
+ * size of the temp buffer needed for this set of parameters. Does
3756
+ * not touch the src or dest image.
3757
+ *
3758
+ * kvImageDoNotTile Disable internal multithreading.
3759
+ *
3760
+ * @/textblock </pre>
3761
+ * The first four flags listed are edging modes. One and only one edging mode must be
3762
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
3763
+ * be returned.
3764
+ *
3765
+ * @return One of the following error codes may be returned:
3766
+ * <pre>@textblock
3767
+ * kvImageNoError Success.
3768
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3769
+ * the temp buffer to use with this function and this set of
3770
+ * parameters.
3771
+ *
3772
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3773
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3774
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3775
+ *
3776
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3777
+ * to corresponding dimensions of the source buffer.
3778
+ *
3779
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3780
+ *
3781
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3782
+ *
3783
+ * kvImageNullPointerArgument kernel may not be NULL
3784
+ *
3785
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3786
+ *
3787
+ * kvImageInvalidKernelSize The kernel sizes must be odd numbers.
3788
+ * @/textblock </pre>
3789
+ */
3790
+ VIMAGE_PF vImage_Error
3791
+ vImageSepConvolve_PlanarF(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
3792
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
3793
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
3794
+ float bias, Pixel_F backgroundColor, vImage_Flags flags)
3795
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
3796
+
3797
+ /*!
3798
+ * @function vImageSepConvolve_Planar16F
3799
+ * @abstract Separable convolution on a Planar16F image.
3800
+ * @discussion This filter applies two separate 1D filters along the rows and columns of a Planar16F image.
3801
+ * The weighted average is computed with single-precision floating-point kernel values. However, if
3802
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
3803
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
3804
+ * supports it. This results in up to 2x performance improvements but at the
3805
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
3806
+ *
3807
+ * For each pixel:
3808
+ * <pre>@textblock
3809
+ * for each pixel[y][x] in image {
3810
+ * float sum = bias;
3811
+ *
3812
+ * // Calculate weighted average over kernel area
3813
+ * for each kernelY_element[i] in kernelY {
3814
+ * for each kernelX_element[j] in kernelX {
3815
+ * sum += kernelY_element[i] * kernelX_element[j] *
3816
+ * (float)pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3817
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
3818
+ * }
3819
+ * }
3820
+ *
3821
+ * // Convert to half precisio and write out result
3822
+ * result[y][x] = (_Float16)sum;
3823
+ * }
3824
+ * @/textblock </pre>
3825
+ *
3826
+ * This filter does not work in place.
3827
+ *
3828
+ * @param src The input image
3829
+ *
3830
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3831
+ * This may not alias the src image.
3832
+ *
3833
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3834
+ * computation. The size of the tempBuffer is given by calling the function
3835
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3836
+ * the size is returned instead of an error code from the left hand side.
3837
+ * You may pass NULL here, in which case a region of memory of similar size
3838
+ * will be allocated by the function and freed before it returns. Temp Buffers
3839
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3840
+ * buffers. If you will be calling this function repeatedly with similar parameters
3841
+ * you should use a temp buffer. If the function is called from different threads
3842
+ * concurrently, a different temp buffer should be used for each.
3843
+ *
3844
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3845
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3846
+ * when the destination tile is not aligned with the left edge of the image.
3847
+ *
3848
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3849
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3850
+ * when the destination tile is not aligned with the top edge of the image.
3851
+ *
3852
+ * @param kernelX A pointer to a 1D array of weights of dimension kernelX_width.
3853
+ *
3854
+ * @param kernelX_width The width of the 1D array of weights passed in as kernelX. It must be an odd number.
3855
+ *
3856
+ * @param kernelY A pointer to a 1D array of weights of dimension kernelY_width.
3857
+ *
3858
+ * @param kernelY_width The width of the 1D array of weights passed in as kernelY. It must be an odd number.
3859
+ *
3860
+ * @param bias This value is added to the sum of weighted pixels.
3861
+ *
3862
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
3863
+ * parameter provides the background color to be used for missing pixels when the
3864
+ * kernel extends off the edge of the image.
3865
+ *
3866
+ * @param flags The following flags are allowed:
3867
+ * <pre>@textblock
3868
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
3869
+ * copy the corresponding source pixel to the destination. This
3870
+ * will result in a ring off unconvolved content at the edges
3871
+ * and convolved content in the middle.
3872
+ *
3873
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
3874
+ * For a blur filter this will look like the edges of the image
3875
+ * have been blurred into a particular color. This is usually
3876
+ * appropriate when the color of the surface onto which the image
3877
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
3878
+ * as a background color, and let the downstream image compositor
3879
+ * blend in the background color. In this case, the result image
3880
+ * should be treated as a premultiplied image.
3881
+ *
3882
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
3883
+ * This is better when the image is drawn into a frame or other
3884
+ * context where the background is not expected to contribute to
3885
+ * the final content.
3886
+ *
3887
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
3888
+ * simply ignored, and the bias and divisor are adjusted accordingly.
3889
+ * Because of the complication at the edges, this edging mode can
3890
+ * be significantly slower than the others. It can be numerically
3891
+ * unstable if the sum over any rectangular subsection of the kernel
3892
+ * is zero, which can result in division by zero during the computation.
3893
+ * The results for this edging mode are usually quite visually similar
3894
+ * to kvImageEdgeExtend.
3895
+ *
3896
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
3897
+ * size of the temp buffer needed for this set of parameters. Does
3898
+ * not touch the src or dest image.
3899
+ *
3900
+ * kvImageDoNotTile Disable internal multithreading.
3901
+ *
3902
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
3903
+ * kernel averages when the CPU architecture supports it.
3904
+ *
3905
+ * @/textblock </pre>
3906
+ * The first four flags listed are edging modes. One and only one edging mode must be
3907
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
3908
+ * be returned.
3909
+ *
3910
+ * @return One of the following error codes may be returned:
3911
+ * <pre>@textblock
3912
+ * kvImageNoError Success.
3913
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
3914
+ * the temp buffer to use with this function and this set of
3915
+ * parameters.
3916
+ *
3917
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
3918
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
3919
+ * kvImageEdgeExtend, kvImageTruncateKernel }
3920
+ *
3921
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
3922
+ * to corresponding dimensions of the source buffer.
3923
+ *
3924
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
3925
+ *
3926
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
3927
+ *
3928
+ * kvImageNullPointerArgument kernel may not be NULL
3929
+ *
3930
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
3931
+ *
3932
+ * kvImageInvalidKernelSize The kernel sizes must be odd numbers.
3933
+ * @/textblock </pre>
3934
+ */
3935
+ VIMAGE_PF vImage_Error
3936
+ vImageSepConvolve_Planar16F(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
3937
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
3938
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
3939
+ float bias, Pixel_16F backgroundColor, vImage_Flags flags)
3940
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
3941
+
3942
+ /*!
3943
+ * @function vImageSepConvolve_Planar16U
3944
+ * @abstract Separable convolution on a Planar16U image.
3945
+ * @discussion This filter applies two separate 1D filters along the rows and columns of
3946
+ * a Planar16U image.
3947
+ *
3948
+ * For each pixel:
3949
+ * <pre>@textblock
3950
+ * for each pixel[y][x] in image {
3951
+ * float sum = bias;
3952
+ *
3953
+ * // Calculate weighted average over kernel area
3954
+ * for each kernelY_element[i] in kernelY {
3955
+ * for each kernelX_element[j] in kernelX {
3956
+ * sum += kernelY_element[i] * kernelX_element[j] *
3957
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
3958
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
3959
+ * }
3960
+ * }
3961
+ * // Add 0.5 to round to nearest int when converting float to uint16_t
3962
+ * sum = sum + 0.5f;
3963
+ *
3964
+ * // write out result
3965
+ * result[y][x] = (uint16_t)CLAMP(sum, 0, 65535);
3966
+ * }
3967
+ * @/textblock </pre>
3968
+ *
3969
+ * This filter does not work in place.
3970
+ *
3971
+ * @param src The input image
3972
+ *
3973
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
3974
+ * This may not alias the src image.
3975
+ *
3976
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
3977
+ * computation. The size of the tempBuffer is given by calling the function
3978
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
3979
+ * the size is returned instead of an error code from the left hand side.
3980
+ * You may pass NULL here, in which case a region of memory of similar size
3981
+ * will be allocated by the function and freed before it returns. Temp Buffers
3982
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
3983
+ * buffers. If you will be calling this function repeatedly with similar parameters
3984
+ * you should use a temp buffer. If the function is called from different threads
3985
+ * concurrently, a different temp buffer should be used for each.
3986
+ *
3987
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
3988
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3989
+ * when the destination tile is not aligned with the left edge of the image.
3990
+ *
3991
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
3992
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
3993
+ * when the destination tile is not aligned with the top edge of the image.
3994
+ *
3995
+ * @param kernelX A pointer to a 1D array of weights of dimension kernelX_width.
3996
+ *
3997
+ * @param kernelX_width The width of the 1D array of weights passed in as kernelX. It must be an odd number.
3998
+ *
3999
+ * @param kernelY A pointer to a 1D array of weights of dimension kernelY_width.
4000
+ *
4001
+ * @param kernelY_width The width of the 1D array of weights passed in as kernelY. It must be an odd number.
4002
+ *
4003
+ * @param bias This value is added to the sum of weighted pixels.
4004
+ * You might provide a bias of 2 ** 15 = 32768 to move the encoding so that
4005
+ * negative numbers are representable.
4006
+ *
4007
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
4008
+ * parameter provides the background color to be used for missing pixels when the
4009
+ * kernel extends off the edge of the image.
4010
+ *
4011
+ * @param flags The following flags are allowed:
4012
+ * <pre>@textblock
4013
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
4014
+ * copy the corresponding source pixel to the destination. This
4015
+ * will result in a ring off unconvolved content at the edges
4016
+ * and convolved content in the middle.
4017
+ *
4018
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
4019
+ * For a blur filter this will look like the edges of the image
4020
+ * have been blurred into a particular color. This is usually
4021
+ * appropriate when the color of the surface onto which the image
4022
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
4023
+ * as a background color, and let the downstream image compositor
4024
+ * blend in the background color. In this case, the result image
4025
+ * should be treated as a premultiplied image.
4026
+ *
4027
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
4028
+ * This is better when the image is drawn into a frame or other
4029
+ * context where the background is not expected to contribute to
4030
+ * the final content.
4031
+ *
4032
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
4033
+ * simply ignored, and the bias and divisor are adjusted accordingly.
4034
+ * Because of the complication at the edges, this edging mode can
4035
+ * be significantly slower than the others. It can be numerically
4036
+ * unstable if the sum over any rectangular subsection of the kernel
4037
+ * is zero, which can result in division by zero during the computation.
4038
+ * The results for this edging mode are usually quite visually similar
4039
+ * to kvImageEdgeExtend.
4040
+ *
4041
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
4042
+ * size of the temp buffer needed for this set of parameters. Does
4043
+ * not touch the src or dest image.
4044
+ *
4045
+ * kvImageDoNotTile Disable internal multithreading.
4046
+ *
4047
+ * @/textblock </pre>
4048
+ * The first four flags listed are edging modes. One and only one edging mode must be
4049
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
4050
+ * be returned.
4051
+ *
4052
+ * @return One of the following error codes may be returned:
4053
+ * <pre>@textblock
4054
+ * kvImageNoError Success.
4055
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
4056
+ * the temp buffer to use with this function and this set of
4057
+ * parameters.
4058
+ *
4059
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
4060
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
4061
+ * kvImageEdgeExtend, kvImageTruncateKernel }
4062
+ *
4063
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
4064
+ * to corresponding dimensions of the source buffer.
4065
+ *
4066
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
4067
+ *
4068
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
4069
+ *
4070
+ * kvImageNullPointerArgument kernel may not be NULL
4071
+ *
4072
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
4073
+ *
4074
+ * kvImageInvalidKernelSize The kernel sizes must be odd numbers.
4075
+ * @/textblock </pre>
4076
+ */
4077
+ VIMAGE_PF vImage_Error
4078
+ vImageSepConvolve_Planar16U(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
4079
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
4080
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
4081
+ float bias, Pixel_16U backgroundColor, vImage_Flags flags)
4082
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
4083
+
4084
+ /*!
4085
+ * @function vImageSepConvolve_Planar8to16U
4086
+ * @abstract Separable convolution on a Planar8 image.
4087
+ * @discussion This filter applies two separate 1D filters along the rows and columns of
4088
+ * a Planar8 source image and writing the result to a Planar16U destination image.
4089
+ * Both a bias and scale factor can be specified to control the range of the result.
4090
+ *
4091
+ * For each pixel:
4092
+ * <pre>@textblock
4093
+ * for each pixel[y][x] in image {
4094
+ * float sum = 0.0f;
4095
+ *
4096
+ * // Calculate weighted average over kernel area
4097
+ * for each kernelY_element[i] in kernelY {
4098
+ * for each kernelX_element[j] in kernelX {
4099
+ * sum += kernelY_element[i] * kernelX_element[j] *
4100
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
4101
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
4102
+ * }
4103
+ * }
4104
+ * // Scale sum and add bias and 0.5 to round float to uint16_t
4105
+ * sum = scale * sum + bias + 0.5f;
4106
+ *
4107
+ * // write out result
4108
+ * result[y][x] = (uint16_t)CLAMP(sum, 0, 65535);
4109
+ * }
4110
+ * @/textblock </pre>
4111
+ *
4112
+ * This filter does not work in place.
4113
+ *
4114
+ * @param src The input image
4115
+ *
4116
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
4117
+ * This may not alias the src image.
4118
+ *
4119
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
4120
+ * computation. The size of the tempBuffer is given by calling the function
4121
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
4122
+ * the size is returned instead of an error code from the left hand side.
4123
+ * You may pass NULL here, in which case a region of memory of similar size
4124
+ * will be allocated by the function and freed before it returns. Temp Buffers
4125
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
4126
+ * buffers. If you will be calling this function repeatedly with similar parameters
4127
+ * you should use a temp buffer. If the function is called from different threads
4128
+ * concurrently, a different temp buffer should be used for each.
4129
+ *
4130
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
4131
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
4132
+ * when the destination tile is not aligned with the left edge of the image.
4133
+ *
4134
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
4135
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
4136
+ * when the destination tile is not aligned with the top edge of the image.
4137
+ *
4138
+ * @param kernelX A pointer to a 1D array of weights of dimension kernelX_width.
4139
+ *
4140
+ * @param kernelX_width The width of the 1D array of weights passed in as kernelX. It must be an odd number.
4141
+ *
4142
+ * @param kernelY A pointer to a 1D array of weights of dimension kernelY_width.
4143
+ *
4144
+ * @param kernelY_width The width of the 1D array of weights passed in as kernelY. It must be an odd number.
4145
+ *
4146
+ * @param scale This value is multiplied with the sum of weighted pixels, before the bias
4147
+ * is applied. For example, for normalized kernels, where the weights add to 1.0,
4148
+ * specifying a scale of 257 ( = 65535 / 255 ) would expand the 8-bit input
4149
+ * range to a full 16-bit output range.
4150
+ *
4151
+ * @param bias This value is added to the sum of weighted pixels.
4152
+ *
4153
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
4154
+ * parameter provides the background color to be used for missing pixels when the
4155
+ * kernel extends off the edge of the image.
4156
+ *
4157
+ * @param flags The following flags are allowed:
4158
+ * <pre>@textblock
4159
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
4160
+ * copy the corresponding source pixel to the destination. This
4161
+ * will result in a ring off unconvolved content at the edges
4162
+ * and convolved content in the middle.
4163
+ *
4164
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
4165
+ * For a blur filter this will look like the edges of the image
4166
+ * have been blurred into a particular color. This is usually
4167
+ * appropriate when the color of the surface onto which the image
4168
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
4169
+ * as a background color, and let the downstream image compositor
4170
+ * blend in the background color. In this case, the result image
4171
+ * should be treated as a premultiplied image.
4172
+ *
4173
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
4174
+ * This is better when the image is drawn into a frame or other
4175
+ * context where the background is not expected to contribute to
4176
+ * the final content.
4177
+ *
4178
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
4179
+ * simply ignored, and the bias and divisor are adjusted accordingly.
4180
+ * Because of the complication at the edges, this edging mode can
4181
+ * be significantly slower than the others. It can be numerically
4182
+ * unstable if the sum over any rectangular subsection of the kernel
4183
+ * is zero, which can result in division by zero during the computation.
4184
+ * The results for this edging mode are usually quite visually similar
4185
+ * to kvImageEdgeExtend.
4186
+ *
4187
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
4188
+ * size of the temp buffer needed for this set of parameters. Does
4189
+ * not touch the src or dest image.
4190
+ *
4191
+ * kvImageDoNotTile Disable internal multithreading.
4192
+ *
4193
+ * @/textblock </pre>
4194
+ * The first four flags listed are edging modes. One and only one edging mode must be
4195
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
4196
+ * be returned.
4197
+ *
4198
+ * @return One of the following error codes may be returned:
4199
+ * <pre>@textblock
4200
+ * kvImageNoError Success.
4201
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
4202
+ * the temp buffer to use with this function and this set of
4203
+ * parameters.
4204
+ *
4205
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
4206
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
4207
+ * kvImageEdgeExtend, kvImageTruncateKernel }
4208
+ *
4209
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
4210
+ * to corresponding dimensions of the source buffer.
4211
+ *
4212
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
4213
+ *
4214
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
4215
+ *
4216
+ * kvImageNullPointerArgument kernel may not be NULL
4217
+ *
4218
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
4219
+ *
4220
+ * kvImageInvalidKernelSize The kernel sizes must be odd numbers.
4221
+ * @/textblock </pre>
4222
+ */
4223
+ VIMAGE_PF vImage_Error
4224
+ vImageSepConvolve_Planar8to16U(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
4225
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
4226
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
4227
+ float scale, float bias, Pixel_8 backgroundColor, vImage_Flags flags)
4228
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
4229
+
4230
+
4231
+ VIMAGE_PF vImage_Error
4232
+ vImageSepConvolve_ARGB8888(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
4233
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
4234
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
4235
+ float bias, const Pixel_8888 backgroundColor, vImage_Flags flags)
4236
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
4237
+
8
4238
  #ifdef __cplusplus
9
4239
  }
10
4240
  #endif
4241
+
11
4242
  #endif
4243
+
4244
+