peachsim 0.1.1692 → 0.1.1700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +18273 -15925
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +2349 -1778
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +7885 -3334
- package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +297 -77
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +294 -74
- package/dist-lib/native-app-identity-project.cjs +48 -37
- package/dist-lib/native-app-identity-project.mjs +47 -36
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib.json +199 -79
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +19600 -15992
- package/dist-lib/swift-compile.cjs +640 -402
- package/dist-lib/swift-compile.mjs +595 -357
- package/dist-lib/swift-package.cjs +24 -20
- package/dist-lib/swift-package.mjs +23 -19
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +1559 -1208
- package/dist-lib/vite.cjs +251 -42
- package/dist-lib/worklet-executable.cjs +2 -2
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -0
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +68 -12
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -22
- package/src/nitro-compile.ts +32 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +168 -48
- package/src/swift-coverage/xcode-assets.ts +4 -3
- package/src/swift-host.ts +14 -3
- package/src/swift-objc-compile.ts +32 -5
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +43 -13
- package/src/swift-package.ts +33 -26
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +68 -19
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +8 -0
- package/src/vite-plugin.ts +0 -10
- package/src/xcode-project.ts +62 -42
- package/src/settings-flags.ts +0 -107
|
@@ -0,0 +1,1747 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @header Transform.h
|
|
3
|
+
* vImage Framework
|
|
4
|
+
*
|
|
5
|
+
* See vImage/vImage.h for more on how to better view the headerdoc documentation for functions declared herein.
|
|
6
|
+
*
|
|
7
|
+
* @copyright Copyright (c) 2003-2022 by Apple Inc. All rights reserved.
|
|
8
|
+
*
|
|
9
|
+
* @discussion Transform.h defines a number of interfaces that do linear and nonlinear operations
|
|
10
|
+
* to images. Matrix multiply operations treat each pixel as a short vector and
|
|
11
|
+
* multiply the vector by a matrix. Typically these are used to do colorspace conversion
|
|
12
|
+
* and color twisting. There are a series of gamma functions that apply a power function
|
|
13
|
+
* to an image. The power operation is C2 symmetric around the origin such that negative values
|
|
14
|
+
* are not NaN (unlike pow(-x, y)), but instead -pow(|x|, y) for negative x).
|
|
15
|
+
* In addition a series of polynomial and rational evaluators are available. Many complex
|
|
16
|
+
* functions can be approximated as a polynomial or rational and evaluated more
|
|
17
|
+
* cheaply that way. Also, there are single and multi-dimensional interpolated lookup
|
|
18
|
+
* tables, also commonly used in colorspace conversion.
|
|
19
|
+
* Finally, there are flood, or seed, fill functions for filling a connect component of an image.
|
|
20
|
+
*
|
|
21
|
+
* @ignorefuncmacro VIMAGE_NON_NULL
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef VIMAGE_TRANSFORM_H
|
|
25
|
+
#define VIMAGE_TRANSFORM_H
|
|
26
|
+
|
|
27
|
+
#include <vImage/vImage_Types.h>
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#include <TargetConditionals.h>
|
|
34
|
+
#if !0 && !0
|
|
35
|
+
|
|
36
|
+
/*!
|
|
37
|
+
* @functiongroup Image Matrix multiplication
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
* vImageMatrixMultiply_Planar16S
|
|
42
|
+
*
|
|
43
|
+
* Transform M source planes to N destination planes by multiplying the
|
|
44
|
+
* M x N transformation matrix by the source planes. A pre-bias may
|
|
45
|
+
* optionally be added to the source planes before the transformation. A
|
|
46
|
+
* post-bias may optionally be added to the resulting destination planes. As
|
|
47
|
+
* a final step the destination planes are divided by a given divisor.
|
|
48
|
+
*
|
|
49
|
+
* if (pre_bias)
|
|
50
|
+
* { bA, bR, bG, ... } = { A + pre_bias[0], R + pre_bias[1],
|
|
51
|
+
* G + pre_bias[2], ... }
|
|
52
|
+
* else
|
|
53
|
+
* { bA, bR, bG, ... } = { A, R, G, ... }
|
|
54
|
+
*
|
|
55
|
+
*
|
|
56
|
+
* { a00 a01 a02 ... }
|
|
57
|
+
* { A', R', G', ...} = { bA, bR, bG, ... } * { a10 a11 a12 ... }
|
|
58
|
+
* { a20 a21 a22 ... }
|
|
59
|
+
* { ... ... ... ... }
|
|
60
|
+
*
|
|
61
|
+
* if (post_bias)
|
|
62
|
+
* { A', R', G', ... } += { post_bias[0], post_bias[1], post_bias[2], ... }
|
|
63
|
+
* else // correct value for normal rounding: divisor/2
|
|
64
|
+
* { A', R', G', ... } += { divisor/2, divisor/2, divisor/2, ... }
|
|
65
|
+
*
|
|
66
|
+
* { A', R', G', ... } /= divisor
|
|
67
|
+
*
|
|
68
|
+
* where the values are:
|
|
69
|
+
* { A', R', ... } Resulting destination planes (dests). For a concrete
|
|
70
|
+
* example of the multiply step for one plane:
|
|
71
|
+
* A' = bA * a00 + bR * a10 + bG * a20 + ... * ...
|
|
72
|
+
*
|
|
73
|
+
* { A, R, ... } Source planes (srcs).
|
|
74
|
+
*
|
|
75
|
+
* { bA, bR, ... } Pre-biased source planes. (for demonstration only, never
|
|
76
|
+
* actually exists)
|
|
77
|
+
*
|
|
78
|
+
* a00, a01, ... Elements in the transformation matrix (matrix).
|
|
79
|
+
*
|
|
80
|
+
* pre_bias Pre-bias values corresponding to the source channels.
|
|
81
|
+
* Value is zero when NULL.
|
|
82
|
+
*
|
|
83
|
+
* post_bias Post-bias values corresponding to the destination channels.
|
|
84
|
+
* When NULL, the correct value for normal rounding if used,
|
|
85
|
+
* which is divisor/2.
|
|
86
|
+
*
|
|
87
|
+
* divisor Divisor to normalize the destination planes.
|
|
88
|
+
*
|
|
89
|
+
* Operands:
|
|
90
|
+
* ---------
|
|
91
|
+
* srcs A pointer to an array of vImage_Buffer pointers that
|
|
92
|
+
* reference the source planes. This array must contain
|
|
93
|
+
* src_planes number of vImage_Buffer pointers.
|
|
94
|
+
*
|
|
95
|
+
* dests A pointer to an array of vImage_Buffer pointers that
|
|
96
|
+
* reference where to write the destination planes. Only
|
|
97
|
+
* the image data pointed to by each vImage_Buffer is modified
|
|
98
|
+
* (i.e. dests[0]->data), everything else remains unchanged.
|
|
99
|
+
* This array must contain dest_planes number of vImage_Buffer
|
|
100
|
+
* pointers.
|
|
101
|
+
*
|
|
102
|
+
* src_planes The number of source planes. Must be less than 256.
|
|
103
|
+
*
|
|
104
|
+
* dest_planes The number of destination planes. Must be less than 256.
|
|
105
|
+
*
|
|
106
|
+
* matrix The row major transformation matrix with dest_planes number
|
|
107
|
+
* of columns and src_planes number of rows. Be aware that if
|
|
108
|
+
* any column of this matrix sums to a value larger than
|
|
109
|
+
* +-65538 this function may silently overflow.
|
|
110
|
+
*
|
|
111
|
+
* divisor Division by this value occurs as the last step, in effect
|
|
112
|
+
* normalizing the output planes.
|
|
113
|
+
*
|
|
114
|
+
* pre_bias An optional array of length src_planes consisting of int16_t
|
|
115
|
+
* values. Each value will be added to the corresponding
|
|
116
|
+
* source plane in srcs. Pass NULL for no pre_bias.
|
|
117
|
+
*
|
|
118
|
+
* post_bias An optional array of length dest_planes consisting of
|
|
119
|
+
* int16_t values. Each value will be added to the
|
|
120
|
+
* corresponding destination planes in dests. The post_bias
|
|
121
|
+
* is added before any clipping, rounding or division. Pass
|
|
122
|
+
* NULL the correct value for for normal rounding (divisor/2).
|
|
123
|
+
*
|
|
124
|
+
* flags The following flags are allowed:
|
|
125
|
+
*
|
|
126
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
127
|
+
* wish to do this if you have your own
|
|
128
|
+
* multithreading scheme to avoid having the
|
|
129
|
+
* two interfere with one another.
|
|
130
|
+
*
|
|
131
|
+
* Return Value:
|
|
132
|
+
* -------------
|
|
133
|
+
* kvImageInvalidKernelSize Either src_planes or dest_planes is 0.
|
|
134
|
+
* kvImageBufferSizeMismatch All buffers in dests must have the same
|
|
135
|
+
* width and height.
|
|
136
|
+
* kvImageROILargerThanSourceBuffer The destination buffer size (width, or
|
|
137
|
+
* height) is larger than the source buffer.
|
|
138
|
+
* kvImageUnknownFlagsBit Unexpected flag was passed.
|
|
139
|
+
* kvImageNoError Success!
|
|
140
|
+
*
|
|
141
|
+
*
|
|
142
|
+
* Comments:
|
|
143
|
+
* ---------
|
|
144
|
+
* Be aware that 32-bit signed accumulators are used in this operation with no
|
|
145
|
+
* overflow protection. To avoid the possibility of overflow, limit the sum
|
|
146
|
+
* of any column in the transformation matrix to values less than +-65536.
|
|
147
|
+
*
|
|
148
|
+
* The 32-bit accumulated results out of 16-bit range (+-32767) will be subject
|
|
149
|
+
* clipping before writing to the destination buffer.
|
|
150
|
+
*
|
|
151
|
+
* This routine will work in place provided all of the following are true:
|
|
152
|
+
* src.data == dest.data
|
|
153
|
+
* src.rowBytes == dest.rowBytes
|
|
154
|
+
* kvImageDoNotTile is passed
|
|
155
|
+
*
|
|
156
|
+
* Some matrix based color transforms, such as that obtained using kColorSyncConversionMatrix are defined differently.
|
|
157
|
+
*
|
|
158
|
+
* ColorSync: p' = M1 * p M1 = colorsync matrix, p = input pixel as column vector, p' = output pixel as column vector
|
|
159
|
+
* vImage: p'T = pT * M2 M2 = vImage matrix,T indicates transpose -- vImage pixels are row vectors
|
|
160
|
+
*
|
|
161
|
+
* Given that (A*B)T = BT*AT, it can be shown that M2 = M1T. So, to use the alternative definition here, you need to transpose the matrix.
|
|
162
|
+
*
|
|
163
|
+
* Example:
|
|
164
|
+
* --------
|
|
165
|
+
* To convert RGB to YUV, one might use the following formula:
|
|
166
|
+
*
|
|
167
|
+
* Y = ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16
|
|
168
|
+
* U = ( ( -38 * R - 74 * G + 112 * B + 128) >> 8) + 128
|
|
169
|
+
* V = ( ( 112 * R - 94 * G - 18 * B + 128) >> 8) + 128
|
|
170
|
+
*
|
|
171
|
+
* This translates to a matrix that looks like this:
|
|
172
|
+
*
|
|
173
|
+
* 66 -38 112
|
|
174
|
+
* 129 -74 -94
|
|
175
|
+
* 25 112 -18
|
|
176
|
+
*
|
|
177
|
+
* Pass 256 as the divisor to handle the >> 8 operation. The post_bias
|
|
178
|
+
* argument can handle the addition of { 16, 128, 128 }, however because
|
|
179
|
+
* this function performs the division last, this array must be scaled by
|
|
180
|
+
* the divisor, yielding a post_bias of:
|
|
181
|
+
* post_bias = { 16*divisor + divisor/2, 128*divisor + divisor/2,
|
|
182
|
+
* 128*divisor + divisor/2}
|
|
183
|
+
* post bias = { 4224, 32896, 32896 }
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_Planar16S( const vImage_Buffer *srcs[],
|
|
187
|
+
const vImage_Buffer *dests[],
|
|
188
|
+
uint32_t src_planes,
|
|
189
|
+
uint32_t dest_planes,
|
|
190
|
+
const int16_t matrix[],
|
|
191
|
+
int32_t divisor,
|
|
192
|
+
const int16_t *pre_bias,
|
|
193
|
+
const int32_t *post_bias,
|
|
194
|
+
vImage_Flags flags )
|
|
195
|
+
VIMAGE_NON_NULL(1,2,5)
|
|
196
|
+
API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* vImageMatrixMultiply_*
|
|
200
|
+
*
|
|
201
|
+
* Multiply the M channels in the src buffers (A,R,G...) by a NxM matrix (a##) to yield N channels in the dest buffer(s)
|
|
202
|
+
* For ARGB interleaved functions, both M and N must be 4. The pre_bias (ca, cr, cg...) is added to the M input channels
|
|
203
|
+
* before the matrix is applied. The post_bias (ka, kr, kg...) is added afterward.
|
|
204
|
+
*
|
|
205
|
+
* { a00 a10 a20 ... }
|
|
206
|
+
* { A', R', G' ...} = { A + ca, R + cr, G + cg, ... } * { a01 a11 a21 ... } + { ka, kr, kg, ....}
|
|
207
|
+
* { a02 a12 a22 ... }
|
|
208
|
+
* { ... ... ... ... }
|
|
209
|
+
*
|
|
210
|
+
* A', R', G', ... = result channels stored into dests
|
|
211
|
+
* A, R, G, ... = input channels from srcs
|
|
212
|
+
* ca, cr, cg, ... = pre_bias elements corresponding to the input src channels, or zero if pre_bias is NULL
|
|
213
|
+
* a00, a11, a12, ... = elmenets from the matrix[]
|
|
214
|
+
* ka, kr, kg, ... = post_bias elements corresponding to the destination dest channels, or zero if post_bias is NULL
|
|
215
|
+
*
|
|
216
|
+
* For integer code, there is an additional division operation that happens at the end, in effect normalizing integer matrices.
|
|
217
|
+
* The post-bias is added before any clipping, rounding or division. If you pass NULL for the post-bias, the correct value for
|
|
218
|
+
* normal rounding will be used:
|
|
219
|
+
*
|
|
220
|
+
* integer: divisor/2
|
|
221
|
+
* floating point: 0.0f
|
|
222
|
+
*
|
|
223
|
+
* Be aware that 32 bit signed accumulators are used for integer code. If the sum over any matrix column is larger
|
|
224
|
+
* than +- 2**23, then overflow may occur. Generally speaking this will not happen because the matrix elements are
|
|
225
|
+
* 16 bit integers, so one would need more than 256 source buffers before it is possible to encounter trouble.
|
|
226
|
+
*
|
|
227
|
+
* As an example, to convert RGB to YUV, one might use the following formula:
|
|
228
|
+
*
|
|
229
|
+
* Y = ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16
|
|
230
|
+
* U = ( ( -38 * R - 74 * G + 112 * B + 128) >> 8) + 128
|
|
231
|
+
* V = ( ( 112 * R - 94 * G - 18 * B + 128) >> 8) + 128
|
|
232
|
+
*
|
|
233
|
+
* This translates to a matrix that looks like this:
|
|
234
|
+
*
|
|
235
|
+
* 66 -38 112
|
|
236
|
+
* 129 -74 -94
|
|
237
|
+
* 25 112 -18
|
|
238
|
+
*
|
|
239
|
+
* There is also the >>8 operation and the extra terms to be dealt with. For integer data, you would use a divisor of
|
|
240
|
+
* 256 to account for the >>8 operation. The divisor is applied last after all other multiplications and additions.
|
|
241
|
+
* (For floating point, there is no divisor. Just divide the whole matrix by the divisor if one is needed.) Use the
|
|
242
|
+
* post bias to handle the +128 and {+16, +128, +128} terms. Since the second set happen after the divisor in the
|
|
243
|
+
* formula above, but our post_bias is applied before the divide, you'll need to multiply those biases by the divisor.
|
|
244
|
+
* This will give a post_bias of:
|
|
245
|
+
*
|
|
246
|
+
* { 16 * 256 + 128, 128 * 256 + 128, 128 * 256 + 128 } = { 4224, 32896, 32896 }
|
|
247
|
+
*
|
|
248
|
+
* Finally, if there is an alpha component, such that you wish to convert ARGB to AYUV, leaving the alpha component
|
|
249
|
+
* unchanged then add another row and column:
|
|
250
|
+
*
|
|
251
|
+
* matrix = divisor 0 0 0
|
|
252
|
+
* 0 66 -38 112
|
|
253
|
+
* 0 129 -74 -94
|
|
254
|
+
* 0 25 112 -18
|
|
255
|
+
*
|
|
256
|
+
* post_bias = { divisor/2, 4224, 32896, 32896 }
|
|
257
|
+
* divisor = 256
|
|
258
|
+
*
|
|
259
|
+
* Integer results out of range of 0...255 will be subject to saturated clipping before writing to the destination buffer.
|
|
260
|
+
*
|
|
261
|
+
*
|
|
262
|
+
* Programming Note:
|
|
263
|
+
* The pre-bias is provided as a convenience. The pre-bias can be converted to a post bias by
|
|
264
|
+
* multiplying it by the matrix, which is what we do behind the scenes. Pass NULL for the pre-bias if
|
|
265
|
+
* you don't want a prebias added in.
|
|
266
|
+
*
|
|
267
|
+
* These functions work in place as long as overlapping buffers overlap exactly. Buffers that partially overlap
|
|
268
|
+
* will yield undefined results. Destination buffers will be stored to in the order they appear in the dests array.
|
|
269
|
+
* The buffers all need to be the same size. They can have different rowBytes.
|
|
270
|
+
*
|
|
271
|
+
* In cases where the number of src and dest buffers match, these functions will work in place.
|
|
272
|
+
* The source and destination buffers may all be different sizes and have different sized rowbytes. The source buffers must
|
|
273
|
+
* be at least as large as the dest buffers. In cases where the source buffer is larger than a dest buffer, the portion of the
|
|
274
|
+
* source buffer that overlaps the destination buffer when their top left corners are aligned will be used.
|
|
275
|
+
*
|
|
276
|
+
* Some matrix based color transforms, such as that obtained using kColorSyncConversionMatrix are defined differently.
|
|
277
|
+
*
|
|
278
|
+
* ColorSync: p' = M1 * p M1 = colorsync matrix, p = input pixel as column vector, p' = output pixel as column vector
|
|
279
|
+
* vImage: p'T = pT * M2 M2 = vImage matrix, T indicates transpose -- vImage pixels are row vectors
|
|
280
|
+
*
|
|
281
|
+
* Given that (A*B)T = BT*AT, we find that M2 = M1T. So, to use the alternatively defined matrix here, you need to transpose the matrix
|
|
282
|
+
* before passing it to vImage.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_Planar8( const vImage_Buffer *srcs[], //A set of src_planes as a const array of pointers to vImage_Buffer structs that reference vImage_Buffers.
|
|
286
|
+
const vImage_Buffer *dests[], //A set of src_planes as a const array of pointers to vImage_Buffer structs that reference vImage_Buffers.
|
|
287
|
+
uint32_t src_planes,
|
|
288
|
+
uint32_t dest_planes,
|
|
289
|
+
const int16_t matrix[],
|
|
290
|
+
int32_t divisor,
|
|
291
|
+
const int16_t *pre_bias, //A packed array of src_plane int16_t values. NULL is okay
|
|
292
|
+
const int32_t *post_bias, //A packed array of dest_plane int32_t values. NULL is okay
|
|
293
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
294
|
+
|
|
295
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_PlanarF( const vImage_Buffer *srcs[], //A set of src_planes as a const array of pointers to vImage_Buffer structs that reference vImage_Buffers.
|
|
296
|
+
const vImage_Buffer *dests[], //A set of src_planes as a const array of pointers to vImage_Buffer structs that reference vImage_Buffers.
|
|
297
|
+
uint32_t src_planes,
|
|
298
|
+
uint32_t dest_planes,
|
|
299
|
+
const float matrix[],
|
|
300
|
+
const float *pre_bias, //A packed array of float values. NULL is okay
|
|
301
|
+
const float *post_bias, //A packed array of float values. NULL is okay
|
|
302
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
303
|
+
|
|
304
|
+
/*
|
|
305
|
+
* vImageMatrixMultiply_ARGB8888 will also work for other channel orders such as RGBA8888. The ordering of terms in the matrix, pre_bias and
|
|
306
|
+
* post_bias should be adjusted to compensate.
|
|
307
|
+
*/
|
|
308
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_ARGB8888( const vImage_Buffer *src,
|
|
309
|
+
const vImage_Buffer *dest,
|
|
310
|
+
const int16_t matrix[4*4],
|
|
311
|
+
int32_t divisor,
|
|
312
|
+
const int16_t *pre_bias, //Must be an array of 4 int16_t's. NULL is okay.
|
|
313
|
+
const int32_t *post_bias, //Must be an array of 4 int32_t's. NULL is okay.
|
|
314
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
315
|
+
|
|
316
|
+
/*
|
|
317
|
+
* vImageMatrixMultiply_ARGBFFFF will also work for other channel orders such as RGBAFFFF. The ordering of terms in the matrix, pre_bias and
|
|
318
|
+
* post_bias should be adjusted to compensate.
|
|
319
|
+
*/
|
|
320
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_ARGBFFFF( const vImage_Buffer *src,
|
|
321
|
+
const vImage_Buffer *dest,
|
|
322
|
+
const float matrix[4*4],
|
|
323
|
+
const float *pre_bias, //Must be an array of 4 floats. NULL is okay.
|
|
324
|
+
const float *post_bias, //Must be an array of 4 floats. NULL is okay.
|
|
325
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
326
|
+
|
|
327
|
+
/*!
|
|
328
|
+
* @function vImageMatrixMultiply_ARGB8888ToPlanar8
|
|
329
|
+
* @abstract apply a 1d matrix to a four channel, 8-bit per component image and get a 1-channel 8-bit image as a result
|
|
330
|
+
* @discussion vImageMatrixMultiply_ARGB8888ToPlanar8 is like vImageMatrixMultiply_ARGB8888, except that it produces
|
|
331
|
+
* only a single channel of output. It is intended to produce grayscale images from four channel content,
|
|
332
|
+
* but can be used for other purposes.
|
|
333
|
+
* <pre>@textblock
|
|
334
|
+
* for each pixel[y][x] in image:
|
|
335
|
+
* int32_t p = (pixel[y][x][0] + pre_bias[0]) * matrix[0] +
|
|
336
|
+
* (pixel[y][x][1] + pre_bias[1]) * matrix[1] +
|
|
337
|
+
* (pixel[y][x][2] + pre_bias[2]) * matrix[2] +
|
|
338
|
+
* (pixel[y][x][3] + pre_bias[3]) * matrix[3];
|
|
339
|
+
* result[y][x] = CLAMP( ( p + post_bias ) / divisor, 0, 0xff);
|
|
340
|
+
* @/textblock </pre>
|
|
341
|
+
* If you intend to just extract a single channel without modification (e.g. alpha), please see
|
|
342
|
+
* vImageExtractChannel_ARGB8888. This function will work in place, provided that src->data = dest->data
|
|
343
|
+
* and src->rowBytes = dest->rowBytes.
|
|
344
|
+
*
|
|
345
|
+
* @param src A four channel, 8-bit per component input buffer. It does not have to be ARGB.
|
|
346
|
+
*
|
|
347
|
+
* @param dest A preallocated buffer to receive the 8-bit per component monochromatic result.
|
|
348
|
+
*
|
|
349
|
+
* @param matrix The 1D matrix by which to multiply each pixel.
|
|
350
|
+
*
|
|
351
|
+
* @param divisor Used to renormalize the image after scaling by the matrix. Typically this is the
|
|
352
|
+
* sum over the matrix. If 0, 1 will be used. A faster implementation may be available
|
|
353
|
+
* if the divisor is an integer power of 2.
|
|
354
|
+
*
|
|
355
|
+
* @param pre_bias A set of values used to correct the input image so that 0 is encoded as 0. For example,
|
|
356
|
+
* if the input image is 444 AYCbCr video range, then {0, -16, -128, -128} could be used here.
|
|
357
|
+
* If NULL, {0,0,0,0} will be used.
|
|
358
|
+
*
|
|
359
|
+
* @param post_bias A value added to the sum at the end to provide both for rounding control and for
|
|
360
|
+
* allowing for a bias to be encoded into the image format. Typically, this is just
|
|
361
|
+
* divisor/2 to allow for round to nearest behavior. However, other values may be appropriate
|
|
362
|
+
* if the encoding for 0.0 is not 0. For example, for video range luminance, you might
|
|
363
|
+
* pass 16 * divisor + divisor/2.
|
|
364
|
+
*
|
|
365
|
+
* @param flags The following flags are allowed:
|
|
366
|
+
* <pre> @textblock
|
|
367
|
+
* kvImageNoFlags Default operation
|
|
368
|
+
* kvImageDoNotTile Disable internal multithreading.
|
|
369
|
+
* kvImageGetTempBufferSize return 0, do no work
|
|
370
|
+
* kvImagePrintDiagnosticsToConsole Might print more helpful diagnostic info to the console in the event of an
|
|
371
|
+
* error.
|
|
372
|
+
* @/textblock</pre>
|
|
373
|
+
*
|
|
374
|
+
* @return kvImageNoError Success.
|
|
375
|
+
* @return kvImageRoiLargerThanInputBuffer dest->width and height must be less than or equal to the corresponding dimension of src.
|
|
376
|
+
* @return kvImageUnknownFlagsBit A flag not from the above list of flags was passed in.
|
|
377
|
+
* @return If kvImageGetTempBufferSize was passed, 0 is returned and no work is done on the image.
|
|
378
|
+
*/
|
|
379
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_ARGB8888ToPlanar8( const vImage_Buffer *src,
|
|
380
|
+
const vImage_Buffer *dest,
|
|
381
|
+
const int16_t matrix[4],
|
|
382
|
+
int32_t divisor,
|
|
383
|
+
const int16_t pre_bias[4],
|
|
384
|
+
int32_t post_bias,
|
|
385
|
+
vImage_Flags flags )
|
|
386
|
+
VIMAGE_NON_NULL(1,2,3)
|
|
387
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0));
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
/*!
|
|
391
|
+
* @function vImageMatrixMultiply_ARGBFFFFToPlanarF
|
|
392
|
+
* @abstract apply a 1d matrix to a four channel, float per component image and get a 1-channel float image as a result
|
|
393
|
+
* @discussion vImageMatrixMultiply_ARGBFFFFToPlanarF is like vImageMatrixMultiply_ARGBFFFF, except that it produces
|
|
394
|
+
* only a single channel of output. It is intended to produce grayscale images from four channel content,
|
|
395
|
+
* but can be used for other purposes.
|
|
396
|
+
* <pre>@textblock
|
|
397
|
+
for each pixel[y][x] in image:
|
|
398
|
+
float p = (pixel[y][x][0] + pre_bias[0]) * matrix[0] +
|
|
399
|
+
(pixel[y][x][1] + pre_bias[1]) * matrix[1] +
|
|
400
|
+
(pixel[y][x][2] + pre_bias[2]) * matrix[2] +
|
|
401
|
+
(pixel[y][x][3] + pre_bias[3]) * matrix[3];
|
|
402
|
+
result[y][x] = p + post_bias;
|
|
403
|
+
* @/textblock </pre>
|
|
404
|
+
* vImage reserves the right to reorder computation from the above formulation to improve performance.
|
|
405
|
+
* If you intend to just extract a single channel without modification (e.g. alpha), please see
|
|
406
|
+
* vImageExtractChannel_ARGBFFFF. This function will work in place, provided that src->data = dest->data
|
|
407
|
+
* and src->rowBytes = dest->rowBytes.
|
|
408
|
+
*
|
|
409
|
+
* @param src A four channel, floating-point input buffer. It does not have to be ARGB.
|
|
410
|
+
*
|
|
411
|
+
* @param dest A preallocated buffer to receive the floating-point monochromatic result.
|
|
412
|
+
*
|
|
413
|
+
* @param matrix The 1D matrix by which to multiply each pixel.
|
|
414
|
+
*
|
|
415
|
+
* @param pre_bias A set of values used to correct the input image so that 0 is encoded as 0.
|
|
416
|
+
* If NULL, {0,0,0,0} will be used.
|
|
417
|
+
*
|
|
418
|
+
* @param post_bias A value added to the sum at the end to provide both for rounding control and for
|
|
419
|
+
* allowing for a bias to be encoded into the image format. Typically, this is just
|
|
420
|
+
* zero.
|
|
421
|
+
*
|
|
422
|
+
* @param flags The following flags are allowed:
|
|
423
|
+
* @textblock
|
|
424
|
+
* kvImageNoFlags Default operation
|
|
425
|
+
* kvImageDoNotTile Disable internal multithreading.
|
|
426
|
+
* kvImageGetTempBufferSize return 0, do no work
|
|
427
|
+
* kvImagePrintDiagnosticsToConsole Might print more helpful diagnostic info to the console in the event of an
|
|
428
|
+
* error.
|
|
429
|
+
* @/textblock
|
|
430
|
+
*
|
|
431
|
+
* @return kvImageNoError Success.
|
|
432
|
+
* @return kvImageRoiLargerThanInputBuffer dest->width and height must be less than or equal to the corresponding dimension of src.
|
|
433
|
+
* @return kvImageUnknownFlagsBit A flag not from the above list of flags was passed in.
|
|
434
|
+
* @return If kvImageGetTempBufferSize was passed, 0 is returned and no work is done on the image.
|
|
435
|
+
*/
|
|
436
|
+
VIMAGE_PF vImage_Error vImageMatrixMultiply_ARGBFFFFToPlanarF( const vImage_Buffer *src,
|
|
437
|
+
const vImage_Buffer *dest,
|
|
438
|
+
const float matrix[4],
|
|
439
|
+
const float pre_bias[4],
|
|
440
|
+
float post_bias,
|
|
441
|
+
vImage_Flags flags )
|
|
442
|
+
VIMAGE_NON_NULL(1,2,3)
|
|
443
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0));
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
/*
|
|
447
|
+
* The gamma calculation is at the simplest level:
|
|
448
|
+
*
|
|
449
|
+
* if( value < 0)
|
|
450
|
+
* sign = -1.0f;
|
|
451
|
+
* else
|
|
452
|
+
* sign = 1.0f;
|
|
453
|
+
*
|
|
454
|
+
* result = pow( fabs( value ), gamma ) * sign;
|
|
455
|
+
*
|
|
456
|
+
* i.e. negative values are treated as if they are positive, and the sign restored at the end.
|
|
457
|
+
*
|
|
458
|
+
* This provides for symmetric gamma curves about 0, and also solves the problem of NaN results from
|
|
459
|
+
* pow( negative number, non-integer).
|
|
460
|
+
*
|
|
461
|
+
* The results are available in two varieties, full and half precision. The full precision version covers
|
|
462
|
+
* all pixel values and all exponents and delivers a result within a few ULPs of the IEEE-754 correct powf().
|
|
463
|
+
*
|
|
464
|
+
* The half precision variant provides a precision of +-1/4096:
|
|
465
|
+
*
|
|
466
|
+
* fabs((correct result - result provided)) < 1/4096
|
|
467
|
+
*
|
|
468
|
+
* Half-precision is intended to be used with data that will ultimately be converted to 8-bit integer data.
|
|
469
|
+
* As such, the faster half precision variants only work for floating point pixel values in the range 0.0 ... 1.0.
|
|
470
|
+
* Out of range pixel values will clamp appropriately to 0.0 or 1.0 before the calculation is performed.
|
|
471
|
+
*
|
|
472
|
+
* In addition, there are restrictions on range on the exponent. In general, for best performance, it should be near 1.0,
|
|
473
|
+
* though a faster path exists out to +-12. If the exponent is outside the prescribed range the code will return a full
|
|
474
|
+
* precision gamma instead. (In MacOS X.4.3 and earlier, all exponents fall back on the full precision version. )
|
|
475
|
+
*
|
|
476
|
+
* Half precision calculations that conform to these restrictions are likely to be much faster
|
|
477
|
+
* than the full precision gamma. Use kvImageGamma_UseGammaValue and kvImageGamma_UseGammaValue_half_precision
|
|
478
|
+
* to control whether you get a full or half precision result. kvImageGamma_UseGammaValue will never use a
|
|
479
|
+
* half-precision calculation.
|
|
480
|
+
*
|
|
481
|
+
* There are some additional gamma types for specific gamma curves. These are precise to +-1/4096, share the same
|
|
482
|
+
* restrictions as above for the half precision gamma, but execute in less time. (These fixed exponent gamma curves
|
|
483
|
+
* are present in MacOS X.4, unless otherwise noted below.)
|
|
484
|
+
*
|
|
485
|
+
* vImageGamma_PlanarF and vImageGamma_PlanarFToPlanar8 will work in place, provided that the following are true:
|
|
486
|
+
* src->data == dest->data
|
|
487
|
+
* src->rowBytes >= dest->rowBytes
|
|
488
|
+
* if( src->rowBytes > dest->rowBytes ) kvImageDoNotTile must be passed in the flags parameter
|
|
489
|
+
*
|
|
490
|
+
* vImageGamma_Planar8ToPlanarF will NOT work in place.
|
|
491
|
+
*
|
|
492
|
+
* For the func
|
|
493
|
+
*
|
|
494
|
+
* These functions will also work for multichannel data, such as RGBAFFFF buffers by adjusting the width of the buffer to
|
|
495
|
+
* reflect the additional channels. Note that this will cause the alpha channel if there is one to become gamma corrected.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
/*
|
|
499
|
+
* constants for use in the gamma_type
|
|
500
|
+
*/
|
|
501
|
+
enum
|
|
502
|
+
{
|
|
503
|
+
kvImageGamma_UseGammaValue VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 0, /* __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
504
|
+
kvImageGamma_UseGammaValue_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 1, /* __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
505
|
+
kvImageGamma_5_over_9_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 2, /* gamma = 5/9. (Gamma 1/1.8) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
506
|
+
kvImageGamma_9_over_5_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 3, /* gamma = 9/5. (Gamma 1.8) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
507
|
+
kvImageGamma_5_over_11_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 4, /* gamma = 5/11. (Gamma 1/2.2) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
508
|
+
kvImageGamma_11_over_5_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 5, /* gamma = 11/5. (Gamma 2.2) On exit, gamma = 5/11. __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
509
|
+
kvImageGamma_sRGB_forward_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 6, /* gamma = sRGB standard 2.2. (like 2.2 but offset a bit and with a linear segment: x<0.03928?x/12.92:pow((x+0.055)/1.055,2.4) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
510
|
+
kvImageGamma_sRGB_reverse_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 7, /* gamma = sRGB standard 1/2.2. (like 2.2 but offset a bit and with a linear segment: x<0.00304?12.92*x:1.055pow(x,1/2.4)-0.055) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
511
|
+
kvImageGamma_11_over_9_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 8, /* gamma = 11/9 (Gamma (11/5)/(9/5)) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
512
|
+
kvImageGamma_9_over_11_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 9, /* gamma = 9/11 (Gamma (9/5)/(11/5)) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
513
|
+
kvImageGamma_BT709_forward_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 10, /* gamma = ITU-R BT.709 standard (like sRGB above but without the 1.125 viewing gamma for computer graphics: x<0.081?x/4.5:pow((x+0.099)/1.099, 1/0.45) ) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
514
|
+
kvImageGamma_BT709_reverse_half_precision VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 11 /* gamma = ITU-R BT.709 standard *reverse* (like sRGB 1/2.2 above but without the 1.125 viewing gamma for computer graphics: x<0.018?4.5*x:1.099*pow(x,0.45)-0.099) __OSX_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) */
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
VIMAGE_PF GammaFunction vImageCreateGammaFunction( float gamma,
|
|
518
|
+
int gamma_type,
|
|
519
|
+
vImage_Flags flags ) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
520
|
+
|
|
521
|
+
VIMAGE_PF void vImageDestroyGammaFunction( GammaFunction f ) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
522
|
+
|
|
523
|
+
/* There is a 8 bit lookup table in Conversion.h, if you are looking for a 8bit to 8bit gamma function. */
|
|
524
|
+
VIMAGE_PF vImage_Error vImageGamma_Planar8toPlanarF( const vImage_Buffer *src,
|
|
525
|
+
const vImage_Buffer *dest,
|
|
526
|
+
const GammaFunction gamma,
|
|
527
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
528
|
+
|
|
529
|
+
VIMAGE_PF vImage_Error vImageGamma_PlanarFtoPlanar8( const vImage_Buffer *src,
|
|
530
|
+
const vImage_Buffer *dest,
|
|
531
|
+
const GammaFunction gamma,
|
|
532
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
533
|
+
|
|
534
|
+
VIMAGE_PF vImage_Error vImageGamma_PlanarF( const vImage_Buffer *src,
|
|
535
|
+
const vImage_Buffer *dest,
|
|
536
|
+
const GammaFunction gamma,
|
|
537
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
538
|
+
|
|
539
|
+
/* vImagePiecewiseGamma_Planar8
|
|
540
|
+
* vImagePiecewiseGamma_Planar8toPlanar16Q12
|
|
541
|
+
* vImagePiecewiseGamma_Planar8toPlanarF
|
|
542
|
+
* vImagePiecewiseGamma_Planar16Q12
|
|
543
|
+
* vImagePiecewiseGamma_Planar16Q12toPlanar8
|
|
544
|
+
* vImagePiecewiseGamma_PlanarF
|
|
545
|
+
* vImagePiecewiseGamma_PlanarFtoPlanar8
|
|
546
|
+
*
|
|
547
|
+
* The piecewise gamma calculation combines a linear and an exponential (gamma)
|
|
548
|
+
* curve on two regions of the input interval, separated by a user-supplied
|
|
549
|
+
* boundary value. When the input is greater or equal to the boundary value,
|
|
550
|
+
* the gamma curve is used to generate the output. Otherwise, the linear curve
|
|
551
|
+
* is used.
|
|
552
|
+
*
|
|
553
|
+
* The operation can be described as follows:
|
|
554
|
+
*
|
|
555
|
+
* For each source pixel value x:
|
|
556
|
+
* if x < cutoff:
|
|
557
|
+
* r = linearCoeffs[0]*x + linearCoeffs[1]
|
|
558
|
+
* else:
|
|
559
|
+
* t = exponentialCoeffs[0]*x + exponentialCoeffs[1]
|
|
560
|
+
* r = pow(t, gamma) + exponentialCoeffs[2]
|
|
561
|
+
* output pixel value = r
|
|
562
|
+
*
|
|
563
|
+
* If the source format is Planar8, we multiply by 1/255.0 to get the "input"
|
|
564
|
+
* value used in the expression above; if the destination format is Planar8,
|
|
565
|
+
* we clamp the output value to [0, 1.0], multiply by 255.0 and round to
|
|
566
|
+
* nearest to get the value stored to the destination buffer.
|
|
567
|
+
*
|
|
568
|
+
* If the source format is Planar16Q12, we multiply by 1/4096.0 to get the
|
|
569
|
+
* input value; we clamp to [-8, 8), multiply by 4096.0, and round to nearest
|
|
570
|
+
* to get the stored to the destination buffer.
|
|
571
|
+
*
|
|
572
|
+
* Regardless of the input or output pixel type, the parameters describing the
|
|
573
|
+
* piecewise gamma function are 32-bit floats, with the single exception of the
|
|
574
|
+
* boundary parameter.
|
|
575
|
+
*
|
|
576
|
+
* Operands:
|
|
577
|
+
* ---------
|
|
578
|
+
* src A pointer to a vImage_Buffer that references the source pixels
|
|
579
|
+
*
|
|
580
|
+
* dest A pointer to a vImage_Buffer that references the destination pixels
|
|
581
|
+
*
|
|
582
|
+
* exponentialCoeffs An array of three floating point coefficients for the gamma curve
|
|
583
|
+
*
|
|
584
|
+
* gamma The exponent of a power function for calculating gamma correction
|
|
585
|
+
*
|
|
586
|
+
* linearCoeffs An array of two floating point coefficients for the linear curve
|
|
587
|
+
*
|
|
588
|
+
* boundary The boundary value for switching from linear to gamma curve
|
|
589
|
+
*
|
|
590
|
+
* flags The following flags are allowed:
|
|
591
|
+
*
|
|
592
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
593
|
+
* wish to do this if you have your own
|
|
594
|
+
* multithreading scheme to avoid having the
|
|
595
|
+
* two interfere with one another.
|
|
596
|
+
*
|
|
597
|
+
* kvImageGetTempBufferSize Does no work and returns zero.
|
|
598
|
+
*
|
|
599
|
+
* Return Value:
|
|
600
|
+
* -------------
|
|
601
|
+
* kvImageNoError Success!
|
|
602
|
+
* kvImageNullPointerArgument src, dest, exponentialCoeffs, or linearCoeffs pointer is NULL.
|
|
603
|
+
* kvImageBufferSizeMismatch The destination buffer size (width or
|
|
604
|
+
* height) is larger than the source buffer.
|
|
605
|
+
* kvImageUnknownFlagsBit An unknown or invalid flag was passed. See flags above.
|
|
606
|
+
*
|
|
607
|
+
* The variants of this routine that have source and dest pixel types of the
|
|
608
|
+
* same size (Planar8, Planar16Q12, and PlanarF) operate in place so long as
|
|
609
|
+
* the source and dest image scanlines overlap exactly. The other variants
|
|
610
|
+
* (Planar8toPlanar16Q12, Planar8toPlanarF, etc) do not support in-place
|
|
611
|
+
* operation.
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_Planar8(const vImage_Buffer *src,
|
|
615
|
+
const vImage_Buffer *dest,
|
|
616
|
+
const float exponentialCoeffs[3],
|
|
617
|
+
const float gamma,
|
|
618
|
+
const float linearCoeffs[2],
|
|
619
|
+
const Pixel_8 boundary,
|
|
620
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
621
|
+
|
|
622
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_Planar8toPlanar16Q12(const vImage_Buffer *src,
|
|
623
|
+
const vImage_Buffer *dest,
|
|
624
|
+
const float exponentialCoeffs[3],
|
|
625
|
+
const float gamma,
|
|
626
|
+
const float linearCoeffs[2],
|
|
627
|
+
const Pixel_8 boundary,
|
|
628
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
629
|
+
|
|
630
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_Planar16Q12(const vImage_Buffer *src,
|
|
631
|
+
const vImage_Buffer *dest,
|
|
632
|
+
const float exponentialCoeffs[3],
|
|
633
|
+
const float gamma,
|
|
634
|
+
const float linearCoeffs[2],
|
|
635
|
+
const Pixel_16S boundary,
|
|
636
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
637
|
+
|
|
638
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_Planar16Q12toPlanar8(const vImage_Buffer *src,
|
|
639
|
+
const vImage_Buffer *dest,
|
|
640
|
+
const float exponentialCoeffs[3],
|
|
641
|
+
const float gamma,
|
|
642
|
+
const float linearCoeffs[2],
|
|
643
|
+
const Pixel_16S boundary,
|
|
644
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
645
|
+
|
|
646
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_Planar8toPlanarF(const vImage_Buffer *src,
|
|
647
|
+
const vImage_Buffer *dest,
|
|
648
|
+
const float exponentialCoeffs[3],
|
|
649
|
+
const float gamma,
|
|
650
|
+
const float linearCoeffs[2],
|
|
651
|
+
const Pixel_8 boundary,
|
|
652
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
653
|
+
|
|
654
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_PlanarF(const vImage_Buffer *src,
|
|
655
|
+
const vImage_Buffer *dest,
|
|
656
|
+
const float exponentialCoeffs[3],
|
|
657
|
+
const float gamma,
|
|
658
|
+
const float linearCoeffs[2],
|
|
659
|
+
const float boundary,
|
|
660
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
661
|
+
|
|
662
|
+
VIMAGE_PF vImage_Error vImagePiecewiseGamma_PlanarFtoPlanar8(const vImage_Buffer *src,
|
|
663
|
+
const vImage_Buffer *dest,
|
|
664
|
+
const float exponentialCoeffs[3],
|
|
665
|
+
const float gamma,
|
|
666
|
+
const float linearCoeffs[2],
|
|
667
|
+
const float boundary,
|
|
668
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
669
|
+
|
|
670
|
+
/* vImageSymmetricPiecewiseGamma_Planar16Q12
|
|
671
|
+
* vImageSymmetricPiecewiseGamma_PlanarF
|
|
672
|
+
*
|
|
673
|
+
* The symmetric piecewise gamma calculation combines a linear and an exponential
|
|
674
|
+
* (gamma) curve on two regions of the input interval, separated by a user-supplied
|
|
675
|
+
* boundary value. When the input magnitude is greater or equal to the boundary
|
|
676
|
+
* value, the gamma curve is used to generate the output. Otherwise, the linear
|
|
677
|
+
* curve is used. The result is clamped to [0, FMT_MAX] and assigned the sign
|
|
678
|
+
* of the input value. This creates a curve which is symmetric about the origin,
|
|
679
|
+
* with discontinuities flattened to the x-axis.
|
|
680
|
+
*
|
|
681
|
+
* The operation can be described as follows:
|
|
682
|
+
*
|
|
683
|
+
* For each source pixel value x:
|
|
684
|
+
* y = fabsf(x)
|
|
685
|
+
* if y < cutoff:
|
|
686
|
+
* t = linearCoeffs[0]*y + linearCoeffs[1]
|
|
687
|
+
* else:
|
|
688
|
+
* s = exponentialCoeffs[0]*y + exponentialCoeffs[1]
|
|
689
|
+
* t = pow(t, gamma) + exponentialCoeffs[2]
|
|
690
|
+
* r = MAX(t, 0) * copysignf(1.0f, x)
|
|
691
|
+
* output pixel value = r
|
|
692
|
+
*
|
|
693
|
+
* If the source format is Planar16Q12, we multiply by 1/4096.0 to get the
|
|
694
|
+
* input value; we clamp to [-8, 8), multiply by 4096.0, and round to nearest
|
|
695
|
+
* to get the stored to the destination buffer.
|
|
696
|
+
*
|
|
697
|
+
* Regardless of the input or output pixel type, the parameters describing the
|
|
698
|
+
* piecewise gamma function are 32-bit floats, with the single exception of the
|
|
699
|
+
* boundary parameter.
|
|
700
|
+
*
|
|
701
|
+
* Operands:
|
|
702
|
+
* ---------
|
|
703
|
+
* src A pointer to a vImage_Buffer that references the source pixels
|
|
704
|
+
*
|
|
705
|
+
* dest A pointer to a vImage_Buffer that references the destination pixels
|
|
706
|
+
*
|
|
707
|
+
* exponentialCoeffs An array of three floating point coefficients for the gamma curve
|
|
708
|
+
*
|
|
709
|
+
* gamma The exponent of a power function for calculating gamma correction
|
|
710
|
+
*
|
|
711
|
+
* linearCoeffs An array of two floating point coefficients for the linear curve
|
|
712
|
+
*
|
|
713
|
+
* boundary The boundary value for switching from linear to gamma curve
|
|
714
|
+
*
|
|
715
|
+
* flags The following flags are allowed:
|
|
716
|
+
*
|
|
717
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
718
|
+
* wish to do this if you have your own
|
|
719
|
+
* multithreading scheme to avoid having the
|
|
720
|
+
* two interfere with one another.
|
|
721
|
+
*
|
|
722
|
+
* kvImageGetTempBufferSize Does no work and returns zero.
|
|
723
|
+
*
|
|
724
|
+
* Return Value:
|
|
725
|
+
* -------------
|
|
726
|
+
* kvImageNoError Success!
|
|
727
|
+
* kvImageNullPointerArgument src, dest, exponentialCoeffs, or linearCoeffs pointer is NULL.
|
|
728
|
+
* kvImageBufferSizeMismatch The destination buffer size (width or
|
|
729
|
+
* height) is larger than the source buffer.
|
|
730
|
+
* kvImageUnknownFlagsBit An unknown or invalid flag was passed. See flags above.
|
|
731
|
+
*
|
|
732
|
+
* All variants of this routine operate in place so long as the source and
|
|
733
|
+
* dest image scanlines overlap exactly.
|
|
734
|
+
*/
|
|
735
|
+
VIMAGE_PF vImage_Error vImageSymmetricPiecewiseGamma_Planar16Q12(const vImage_Buffer *src,
|
|
736
|
+
const vImage_Buffer *dest,
|
|
737
|
+
const float exponentialCoeffs[3],
|
|
738
|
+
const float gamma,
|
|
739
|
+
const float linearCoeffs[2],
|
|
740
|
+
const Pixel_16S boundary,
|
|
741
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5)
|
|
742
|
+
API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0));
|
|
743
|
+
VIMAGE_PF vImage_Error vImageSymmetricPiecewiseGamma_PlanarF(const vImage_Buffer *src,
|
|
744
|
+
const vImage_Buffer *dest,
|
|
745
|
+
const float exponentialCoeffs[3],
|
|
746
|
+
const float gamma,
|
|
747
|
+
const float linearCoeffs[2],
|
|
748
|
+
const float boundary,
|
|
749
|
+
vImage_Flags flags) VIMAGE_NON_NULL(1,2,3,5)
|
|
750
|
+
API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0));
|
|
751
|
+
|
|
752
|
+
/*
|
|
753
|
+
* vImagePiecewisePolynomial*
|
|
754
|
+
*
|
|
755
|
+
* Apply one or more polynomials to the input image to give the output image.
|
|
756
|
+
*
|
|
757
|
+
* vImagePiecewisePolynomial_Planar8toPlanarF uses 8 bit data on input and produces floating point data.
|
|
758
|
+
* vImagePiecewisePolynomial_PlanarFtoPlanar8 uses floating point data on input and produces 8-bit data with saturated clamping at 0 and 255 to prevent modulo overflow.
|
|
759
|
+
* vImagePiecewisePolynomial_PlanarF uses floating point data on both input and output.
|
|
760
|
+
* vImageTableLookUp_Planar8 uses 8 bit data and produces 8 bit data. In certain cases, the matrix multiply function may also be appropriate.
|
|
761
|
+
*
|
|
762
|
+
* No other arithmetic is done. If you wish a /255 or *255 operation to be done as part of the calculation, you must incorporate that into your polynomial.
|
|
763
|
+
*
|
|
764
|
+
* The arrangement of the polynomials is defined as follows:
|
|
765
|
+
* Let there be N polynomials that each cover part of the single precision floating point range that are arranged in order of area of influence from -Infinity to Infinity.
|
|
766
|
+
* The ith polynomial shall operate on the set of input pixel values that fall in the range:
|
|
767
|
+
*
|
|
768
|
+
* boundary[i] <= pixel_value < boundary[i+1].
|
|
769
|
+
*
|
|
770
|
+
* for which:
|
|
771
|
+
*
|
|
772
|
+
* boundary[0] = smallest value fit by the polynomial. Input pixels smaller than this will be clamped to this value before the calculation is done. Use -Inf for no lower limit.
|
|
773
|
+
* boundary[N] = largest value fit by the polynomial. Input pixels larger than this will be clamped to this value before the calculation is done. Use +Inf for no upper limit.
|
|
774
|
+
* boundary[1....N-1] = the boundaries separating the input ranges covered by the various polynomials provided (see below)
|
|
775
|
+
*
|
|
776
|
+
* NaNs will return NaNs. The last polynomial also operates on Inf. N must be an integer power of 2.
|
|
777
|
+
* Values found in the destination array are undefined until after the function returns.
|
|
778
|
+
* The behavior is undefined if boundaries are NaN.
|
|
779
|
+
*
|
|
780
|
+
* These functions will also work for multichannel data, such as RGBAFFFF buffers by adjusting the width of the buffer to
|
|
781
|
+
* reflect the additional channels. Note that this will cause the alpha channel, if there is one, to become modified like the other channels.
|
|
782
|
+
* These will work in place, provided that the following are true:
|
|
783
|
+
* src->data == dest->data
|
|
784
|
+
* src->rowBytes >= dest->rowBytes
|
|
785
|
+
* if( src->rowBytes > dest->rowBytes ) kvImageDoNotTile must be passed in the flags parameter
|
|
786
|
+
|
|
787
|
+
*
|
|
788
|
+
* The input parameters are as follows:
|
|
789
|
+
*
|
|
790
|
+
* src = a pointer to a vImage_Buffer containing the input data for the function
|
|
791
|
+
* dest = a pointer to a vImage_Buffer structure that describes where to write the results
|
|
792
|
+
*
|
|
793
|
+
* coefficients = a packed array of pointers to packed arrays of (order+1) polynomial coefficients ( i.e. coefficients[ N ][ order + 1 ] ).
|
|
794
|
+
* The polynomials must appear in order from least to greatest sorted by area of influence.
|
|
795
|
+
* The polynomials must all be of the same order.
|
|
796
|
+
* The polynomial coefficients are sorted from 0th order term to highest order term
|
|
797
|
+
*
|
|
798
|
+
* boundaries = a packed array of (N+1) floating point values that mark the dividing line between one polynomial and the next. These must be sorted from most negative to most positive.
|
|
799
|
+
* Input pixel values less than boundaries[0] will be clamped to be equal to boundaries[0] before the calculation is done
|
|
800
|
+
* Input pixel values greater than boundaries[N] will be clamped to be equal to boundaries[N] before the calculation is done
|
|
801
|
+
*
|
|
802
|
+
* order = the number of coefficients minus one used for each polynomial -- all the polynomials must be of the same order
|
|
803
|
+
* A polynomial with _two_ coefficients (y = c0 + c1 * x) is a _first_ order polynomial. Pass 1 for a first order polynomial. Pass 2 for a second order polynomial, etc.
|
|
804
|
+
*
|
|
805
|
+
* log2segments = log2(N)
|
|
806
|
+
*
|
|
807
|
+
* flags = no flags are currently honored. You must pass zero here.
|
|
808
|
+
*
|
|
809
|
+
* vImagePiecewisePolynomial_PlanarF will work in place.
|
|
810
|
+
* vImagePiecewisePolynomial_Planar8toPlanarF will work in place.
|
|
811
|
+
* vImagePiecewisePolynomial_PlanarFtoPlanar8 will NOT work in place.
|
|
812
|
+
*
|
|
813
|
+
* Performance advisory:
|
|
814
|
+
* It costs much more to resolve additional polynomials than to work with higher order polynomials.
|
|
815
|
+
* For performance, you are typically better off with one 9th order polynomial that spans the range you are
|
|
816
|
+
* interested in than many first order polynomials that cover the area in a piecewise fashion.
|
|
817
|
+
* Vector code execution time is roughly proportional to:
|
|
818
|
+
*
|
|
819
|
+
* time = (base cost to touch all the data) + polynomial order + 4 * log2segments
|
|
820
|
+
*
|
|
821
|
+
* The vector code for an unsplit 13th order polynomial should be about as fast as vImageLookupTable_Planar8toPlanarF()
|
|
822
|
+
* on a G4.
|
|
823
|
+
*
|
|
824
|
+
* With data not in cache, the time may be significantly different. For sufficiently small polynomials, the
|
|
825
|
+
* cost may be a fixed cost, dependent only on how much data is touched, and not on polynomial order.
|
|
826
|
+
*
|
|
827
|
+
* This performance behavior is provided to help developers evaluate speed tradeoffs. It is not a guarantee.
|
|
828
|
+
* It is subject to change in future operating system revisions, and may be different on different hardware
|
|
829
|
+
* within the same or different operating system revisions.
|
|
830
|
+
*
|
|
831
|
+
* Vector code is not invoked for log2segments > 3.
|
|
832
|
+
*
|
|
833
|
+
* Accuracy advisory:
|
|
834
|
+
* Single precision floating point arithmetic is used. While some polynomials may fit a desired curve
|
|
835
|
+
* within prescribed error limits when using infinite precision math, limited floating point precision
|
|
836
|
+
* may in practice cause significant error to accumulate for some sets of polynomial coefficients. It is
|
|
837
|
+
* recommended that you test all reasonable floating point pixel values to make sure that they do indeed
|
|
838
|
+
* give results that conform to prescribed error limits.
|
|
839
|
+
*
|
|
840
|
+
*
|
|
841
|
+
* Usage Example:
|
|
842
|
+
* --------------
|
|
843
|
+
* Lets say you want to mimic the sRGB gamma curve using vImagePiecewisePolynomial_PlanarF. The sRGB gamma curve is defined as follows:
|
|
844
|
+
*
|
|
845
|
+
* if( {R,G,B} < 0.00304 )
|
|
846
|
+
* result = 12.92 * {R,G,B}
|
|
847
|
+
* else
|
|
848
|
+
* result = -0.055 + 1.055 * Pow( {R,G,B}, 2.4 )
|
|
849
|
+
*
|
|
850
|
+
* Because the power function isn't a polynomial and we need a polynomial, we will approximate it with a second order polynomial:
|
|
851
|
+
*
|
|
852
|
+
* if( {R,G,B} < 0.00304 )
|
|
853
|
+
* result = 12.92 * {R,G,B}
|
|
854
|
+
* else
|
|
855
|
+
* result = c0 + c1 * {R,G,B} + c2 * {R,G,B}^2
|
|
856
|
+
*
|
|
857
|
+
* (Finding the best values for c0, c1, c2 to approximate -0.055 + 1.055 * Pow( {R,G,B}, 2.4 ) over the range [0.00304, 1.0] is
|
|
858
|
+
* left as an exercise for the reader.)
|
|
859
|
+
*
|
|
860
|
+
* We have two polynomials -- one for the region below 0.00304 and one for the region above, so N = 2.
|
|
861
|
+
* The highest order polynomial is a second order polynomial, so order = 2.
|
|
862
|
+
*
|
|
863
|
+
* const int N = 2; // two polynomials
|
|
864
|
+
* const int order = 2; // the polynomials are second order (have three terms, including zero terms)
|
|
865
|
+
*
|
|
866
|
+
* The two polynomials are:
|
|
867
|
+
*
|
|
868
|
+
* float linearPart[ order + 1 ] = { 0, 12.92, 0 }; // result = 0 + 12.92 * {R,G,B} + 0 * {R,G,B} * {R,G,B}
|
|
869
|
+
* float nonLinearPart[ order + 1 ] = { c0, c1, c2 }; // result = c0 + c1 * {R,G,B} + c2 * {R,G,B} * {R,G,B}
|
|
870
|
+
*
|
|
871
|
+
* Here we assemble the rest of the information:
|
|
872
|
+
*
|
|
873
|
+
* float *coefficients[ N ] = { linearPart, nonLinearPart }; // sorted in order of area of influence from least to greatest. ( x < 0.00304, x >= 0.00304 )
|
|
874
|
+
* float boundaries[ N+1 ] = { 0.0f, 0.00304, 1.0f }; // sorted in order from least to greatest. 0.0f and 1.0f define the range over which the polynomials are valid. 0.00304 is the single value separating the two polynomials
|
|
875
|
+
* int log2segments = 1; // log2(N)
|
|
876
|
+
* int flags = 0; // no flags
|
|
877
|
+
*
|
|
878
|
+
* VIMAGE_PF vImage_Error error = vImagePiecewisePolynomial_PlanarF( &mySourceBuffer, &myDestinationBuffer, coefficients, boundaries, order, log2segments, flags );
|
|
879
|
+
*/
|
|
880
|
+
VIMAGE_PF vImage_Error vImagePiecewisePolynomial_PlanarF( const vImage_Buffer *src, //floating point data
|
|
881
|
+
const vImage_Buffer *dest, //floating point data
|
|
882
|
+
const float **coefficients,
|
|
883
|
+
const float *boundaries,
|
|
884
|
+
uint32_t order,
|
|
885
|
+
uint32_t log2segments,
|
|
886
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3,4) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
VIMAGE_PF vImage_Error vImagePiecewisePolynomial_Planar8toPlanarF( const vImage_Buffer *src, //8-bit data
|
|
891
|
+
const vImage_Buffer *dest, //floating point data
|
|
892
|
+
const float **coefficients,
|
|
893
|
+
const float *boundaries,
|
|
894
|
+
uint32_t order,
|
|
895
|
+
uint32_t log2segments,
|
|
896
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3,4) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
897
|
+
|
|
898
|
+
VIMAGE_PF vImage_Error vImagePiecewisePolynomial_PlanarFtoPlanar8( const vImage_Buffer *src, //floating point data
|
|
899
|
+
const vImage_Buffer *dest, //8-bit data
|
|
900
|
+
const float **coefficients,
|
|
901
|
+
const float *boundaries, /*The 0th and Nth terms in the boundaries array are typically 0.0f and 255.0f respectively. Other values may incur additional computational cost. */
|
|
902
|
+
uint32_t order,
|
|
903
|
+
uint32_t log2segments,
|
|
904
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3,4) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
/*
|
|
908
|
+
* vImageSymmetricPiecewisePolynomial*
|
|
909
|
+
*
|
|
910
|
+
* Apply one or more polynomials to the input image to give the output image. The polynomial p(x) is provided as a
|
|
911
|
+
* series of coefficients. e.g.:
|
|
912
|
+
*
|
|
913
|
+
* p(x,i) = coefficient[i][0] + (coefficient[i][1] + (coefficient[i][2] + coefficient[i][3]*x)*x)*x; (assuming a 3rd order polynomial)
|
|
914
|
+
*
|
|
915
|
+
* This is just like vImagePiecewisePolynomial_<fmt>. However, when it is applied, a modified polynomial p'(x) is actually used:
|
|
916
|
+
*
|
|
917
|
+
* p'(x) = p(fabsf(x)) * copysignf( 1.0f, x)
|
|
918
|
+
*
|
|
919
|
+
* This makes the polynomial C2 symmetric about the origin. That is, the negative domain looks like the positive domain, rotated 180 degrees about the origin.
|
|
920
|
+
*
|
|
921
|
+
* vImageSymmetricPiecewisePolynomial_PlanarF floating point data on both input and output.
|
|
922
|
+
*
|
|
923
|
+
* The arrangement of the polynomials is defined as follows:
|
|
924
|
+
* Let there be N polynomials that each cover part of the single precision floating point range that are arranged in order of area of influence from -Infinity to Infinity.
|
|
925
|
+
* The ith polynomial shall operate on the set of input pixel values that fall in the range:
|
|
926
|
+
*
|
|
927
|
+
* boundary[i] <= pixel_value < boundary[i+1].
|
|
928
|
+
*
|
|
929
|
+
* for which:
|
|
930
|
+
*
|
|
931
|
+
* boundary[0] = smallest value fit by the polynomial. Input pixels smaller than this will be clamped to this value before the calculation is done. Use -Inf for no lower limit.
|
|
932
|
+
* boundary[N] = largest value fit by the polynomial. Input pixels larger than this will be clamped to this value before the calculation is done. Use +Inf for no upper limit.
|
|
933
|
+
* boundary[1....N-1] = the boundaries separating the input ranges covered by the various polynomials provided (see below)
|
|
934
|
+
*
|
|
935
|
+
* NaNs will return NaNs. The last polynomial also operates on Inf. N must be an integer power of 2.
|
|
936
|
+
* Values found in the destination array are undefined until after the function returns.
|
|
937
|
+
* The behavior is undefined if boundaries are NaN.
|
|
938
|
+
*
|
|
939
|
+
* These functions will also work for multichannel data, such as RGBAFFFF buffers by adjusting the width of the buffer to
|
|
940
|
+
* reflect the additional channels. Note that this will cause the alpha channel, if there is one, to become modified like the other channels.
|
|
941
|
+
* These will work in place, provided that the following are true:
|
|
942
|
+
* src->data == dest->data
|
|
943
|
+
* src->rowBytes >= dest->rowBytes
|
|
944
|
+
* if( src->rowBytes > dest->rowBytes ) kvImageDoNotTile must be passed in the flags parameter
|
|
945
|
+
|
|
946
|
+
*
|
|
947
|
+
* The input parameters are as follows:
|
|
948
|
+
*
|
|
949
|
+
* src = a pointer to a vImage_Buffer containing the input data for the function
|
|
950
|
+
* dest = a pointer to a vImage_Buffer structure that describes where to write the results
|
|
951
|
+
*
|
|
952
|
+
* coefficients = a packed array of pointers to packed arrays of (order+1) polynomial coefficients ( i.e. coefficients[ N ][ order + 1 ] ).
|
|
953
|
+
* The polynomials must appear in order from least to greatest sorted by area of influence.
|
|
954
|
+
* The polynomials must all be of the same order.
|
|
955
|
+
* The polynomial coefficients are sorted from 0th order term to highest order term
|
|
956
|
+
*
|
|
957
|
+
* boundaries = a packed array of (N+1) floating point values that mark the dividing line between one polynomial and the next. These must be sorted from most negative to most positive.
|
|
958
|
+
* Input pixel values less than boundaries[0] will be clamped to be equal to boundaries[0] before the calculation is done
|
|
959
|
+
* Input pixel values greater than boundaries[N] will be clamped to be equal to boundaries[N] before the calculation is done
|
|
960
|
+
*
|
|
961
|
+
* order = the number of coefficients minus one used for each polynomial -- all the polynomials must be of the same order
|
|
962
|
+
* A polynomial with _two_ coefficients (y = c0 + c1 * x) is a _first_ order polynomial. Pass 1 for a first order polynomial. Pass 2 for a second order polynomial, etc.
|
|
963
|
+
*
|
|
964
|
+
* log2segments = log2(N)
|
|
965
|
+
*
|
|
966
|
+
* flags = no flags are currently honored. You must pass zero here.
|
|
967
|
+
*
|
|
968
|
+
* vImagePiecewisePolynomial_PlanarF will work in place.
|
|
969
|
+
* vImagePiecewisePolynomial_Planar8toPlanarF will work in place.
|
|
970
|
+
* vImagePiecewisePolynomial_PlanarFtoPlanar8 will NOT work in place.
|
|
971
|
+
*
|
|
972
|
+
* Performance advisory:
|
|
973
|
+
* It costs much more to resolve additional polynomials than to work with higher order polynomials.
|
|
974
|
+
* For performance, you are typically better off with one 9th order polynomial that spans the range you are
|
|
975
|
+
* interested in than many first order polynomials that cover the area in a piecewise fashion.
|
|
976
|
+
* Vector code execution time is roughly proportional to:
|
|
977
|
+
*
|
|
978
|
+
* time = (base cost to touch all the data) + polynomial order + 4 * log2segments
|
|
979
|
+
*
|
|
980
|
+
* The vector code for an unsplit 13th order polynomial should be about as fast as vImageLookupTable_Planar8toPlanarF()
|
|
981
|
+
* on a G4.
|
|
982
|
+
*
|
|
983
|
+
* With data not in cache, the time may be significantly different. For sufficiently small polynomials, the
|
|
984
|
+
* cost may be a fixed cost, dependent only on how much data is touched, and not on polynomial order.
|
|
985
|
+
*
|
|
986
|
+
* This performance behavior is provided to help developers evaluate speed tradeoffs. It is not a guarantee.
|
|
987
|
+
* It is subject to change in future operating system revisions, and may be different on different hardware
|
|
988
|
+
* within the same or different operating system revisions.
|
|
989
|
+
*
|
|
990
|
+
* Vector code is not invoked for log2segments > 3.
|
|
991
|
+
*
|
|
992
|
+
* Accuracy advisory:
|
|
993
|
+
* Single precision floating point arithmetic is used. While some polynomials may fit a desired curve
|
|
994
|
+
* within prescribed error limits when using infinite precision math, limited floating point precision
|
|
995
|
+
* may in practice cause significant error to accumulate for some sets of polynomial coefficients. It is
|
|
996
|
+
* recommended that you test all reasonable floating point pixel values to make sure that they do indeed
|
|
997
|
+
* give results that conform to prescribed error limits.
|
|
998
|
+
*
|
|
999
|
+
*
|
|
1000
|
+
* Usage Example:
|
|
1001
|
+
* --------------
|
|
1002
|
+
* Lets say you want to mimic the sRGB gamma curve using vImagePiecewisePolynomial_PlanarF. The sRGB gamma curve is defined as follows:
|
|
1003
|
+
*
|
|
1004
|
+
* if( {R,G,B} < 0.00304 )
|
|
1005
|
+
* result = 12.92 * {R,G,B}
|
|
1006
|
+
* else
|
|
1007
|
+
* result = -0.055 + 1.055 * Pow( {R,G,B}, 2.4 )
|
|
1008
|
+
*
|
|
1009
|
+
* Because the power function isn't a polynomial and we need a polynomial, we will approximate it with a second order polynomial:
|
|
1010
|
+
*
|
|
1011
|
+
* if( {R,G,B} < 0.00304 )
|
|
1012
|
+
* result = 12.92 * {R,G,B}
|
|
1013
|
+
* else
|
|
1014
|
+
* result = c0 + c1 * {R,G,B} + c2 * {R,G,B}^2
|
|
1015
|
+
*
|
|
1016
|
+
* (Finding the best values for c0, c1, c2 to approximate -0.055 + 1.055 * Pow( {R,G,B}, 2.4 ) over the range [0.00304, 1.0] is
|
|
1017
|
+
* left as an exercise for the reader.)
|
|
1018
|
+
*
|
|
1019
|
+
* We have two polynomials -- one for the region below 0.00304 and one for the region above, so N = 2.
|
|
1020
|
+
* The highest order polynomial is a second order polynomial, so order = 2.
|
|
1021
|
+
*
|
|
1022
|
+
* const int N = 2; // two polynomials
|
|
1023
|
+
* const int order = 2; // the polynomials are second order (have three terms, including zero terms)
|
|
1024
|
+
*
|
|
1025
|
+
* The two polynomials are:
|
|
1026
|
+
*
|
|
1027
|
+
* float linearPart[ order + 1 ] = { 0, 12.92, 0 }; // result = 0 + 12.92 * {R,G,B} + 0 * {R,G,B} * {R,G,B}
|
|
1028
|
+
* float nonLinearPart[ order + 1 ] = { c0, c1, c2 }; // result = c0 + c1 * {R,G,B} + c2 * {R,G,B} * {R,G,B}
|
|
1029
|
+
*
|
|
1030
|
+
* Here we assemble the rest of the information:
|
|
1031
|
+
*
|
|
1032
|
+
* float *coefficients[ N ] = { linearPart, nonLinearPart }; // sorted in order of area of influence from least to greatest. ( x < 0.00304, x >= 0.00304 )
|
|
1033
|
+
* float boundaries[ N+1 ] = { 0.0f, 0.00304, 1.0f }; // sorted in order from least to greatest. 0.0f and 1.0f define the range over which the polynomials are valid. 0.00304 is the single value separating the two polynomials
|
|
1034
|
+
* int log2segments = 1; // log2(N)
|
|
1035
|
+
* int flags = 0; // no flags
|
|
1036
|
+
*
|
|
1037
|
+
* VIMAGE_PF vImage_Error error = vImagePiecewisePolynomial_PlanarF( &mySourceBuffer, &myDestinationBuffer, coefficients, boundaries, order, log2segments, flags );
|
|
1038
|
+
*/
|
|
1039
|
+
VIMAGE_PF vImage_Error vImageSymmetricPiecewisePolynomial_PlanarF( const vImage_Buffer *src, //floating point data
|
|
1040
|
+
const vImage_Buffer *dest, //floating point data
|
|
1041
|
+
const float **coefficients,
|
|
1042
|
+
const float *boundaries,
|
|
1043
|
+
uint32_t order,
|
|
1044
|
+
uint32_t log2segments,
|
|
1045
|
+
vImage_Flags flags )
|
|
1046
|
+
VIMAGE_NON_NULL(1,2,3,4)
|
|
1047
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0));
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
/*
|
|
1051
|
+
* vImagePiecewiseRational_PlanarF is similar to vImagePiecewisePolynomial_PlanarF
|
|
1052
|
+
* Except that it evaluates a piecewise rational expression in the form of:
|
|
1053
|
+
*
|
|
1054
|
+
* c0 + c1*x + c2*x^2 + c3*x^3...
|
|
1055
|
+
* result = -----------------------------------
|
|
1056
|
+
* d0 + d1*x + d2*x^2 + d3*x^3...
|
|
1057
|
+
*
|
|
1058
|
+
* The function is behaves nearly exactly like vImagePiecewisePolynomial_PlanarF, except that
|
|
1059
|
+
* there are now two polynomials, for top and bottom of the divide shown above. Each
|
|
1060
|
+
* polynomial has its own set of coefficients and its own polynomial order. The two
|
|
1061
|
+
* polynomials share the same set of segment boundaries. If the polynomials are split then
|
|
1062
|
+
* all the top polynomials must be of the same order, and all the bottom polynomials must
|
|
1063
|
+
* be of the same order. However, regardless of whether the polynomial is split or not,
|
|
1064
|
+
* the top polynomials do not need to be the same order as the bottom polynomials.
|
|
1065
|
+
*
|
|
1066
|
+
* This function does not deliver IEEE-754 correct division. The divide does not round per
|
|
1067
|
+
* the IEEE-754 current rounding mode. It incurs up to 2 ulps of error. Edge cases involving
|
|
1068
|
+
* denormals, infinities, NaNs and division by zero return undefined results. (They will not
|
|
1069
|
+
* crash, but NaN is a likely result in such cases.) Denormals can be rescued on AltiVec enabled
|
|
1070
|
+
* machines by turning off the Non-Java bit in the VSCR, at the expense of taking a many-thousand
|
|
1071
|
+
* cycle kernel exception every time a denormal number is encountered. Since you can predict ahead
|
|
1072
|
+
* of time whether a given set of bounded polynomials is going to encounter these conditions,
|
|
1073
|
+
* this problem should be avoidable by wise choice of polynomials. Developers who require IEEE-754
|
|
1074
|
+
* correct results should call the polynomial evaluator above twice and do the division themselves.
|
|
1075
|
+
*
|
|
1076
|
+
* These functions will also work for multichannel data, such as RGBAFFFF buffers by adjusting the
|
|
1077
|
+
* width of the buffer to reflect the additional channels. Note that this will cause the alpha channel,
|
|
1078
|
+
* if there is one, to become modified like the other channels.
|
|
1079
|
+
*
|
|
1080
|
+
* These will work in place, provided that the following are true:
|
|
1081
|
+
* src->data == dest->data
|
|
1082
|
+
* src->rowBytes >= dest->rowBytes
|
|
1083
|
+
* if( src->rowBytes > dest->rowBytes ) kvImageDoNotTile must be passed in the flags parameter
|
|
1084
|
+
|
|
1085
|
+
* Performance Advisory:
|
|
1086
|
+
* Approximate cost of evaluating a rational (in the same units as polynomial above) is:
|
|
1087
|
+
*
|
|
1088
|
+
* time = (base cost to touch all the data)
|
|
1089
|
+
* + top polynomial order
|
|
1090
|
+
* + bottom polynomial order
|
|
1091
|
+
* + 4
|
|
1092
|
+
* + 4 * log2segments
|
|
1093
|
+
*
|
|
1094
|
+
* With data not in cache, the time may be significantly different. For sufficiently small polynomials, the
|
|
1095
|
+
* cost may be a fixed cost, dependent only on how much data is touched, and not on polynomial order.
|
|
1096
|
+
*
|
|
1097
|
+
* This performance behavior is provided to help developers evaluate speed tradeoffs. It is not a guaranteed.
|
|
1098
|
+
* It is subject to change in future operating system revisions, and may be different on different hardware
|
|
1099
|
+
* within the same or different operating system revisions.
|
|
1100
|
+
*
|
|
1101
|
+
*/
|
|
1102
|
+
VIMAGE_PF vImage_Error vImagePiecewiseRational_PlanarF( const vImage_Buffer *src, //floating point data
|
|
1103
|
+
const vImage_Buffer *dest, //floating point data
|
|
1104
|
+
const float **topCoefficients,
|
|
1105
|
+
const float **bottomCoefficients,
|
|
1106
|
+
const float *boundaries,
|
|
1107
|
+
uint32_t topOrder,
|
|
1108
|
+
uint32_t bottomOrder,
|
|
1109
|
+
uint32_t log2segments,
|
|
1110
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3,4,5) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1111
|
+
|
|
1112
|
+
/* A simple lookup table:
|
|
1113
|
+
*
|
|
1114
|
+
* Pixel_16U table[256];
|
|
1115
|
+
* Pixel_16U result_pixel = table[input_8_bit_pixel];
|
|
1116
|
+
*
|
|
1117
|
+
* The input is a buffer of 8-bit pixels. The output is a buffer of 16-bit pixels.
|
|
1118
|
+
*
|
|
1119
|
+
* Note: It is okay to use this to convert Planar8 data to other 16 bit types as well, such as 16S or 16F,
|
|
1120
|
+
* or ARGB1555 or RGB565 pixels. Simply use an array of the appropriate type for the lookup table.
|
|
1121
|
+
*
|
|
1122
|
+
* This function can also work for multichannel data by scaling the width of the image to compensate for the
|
|
1123
|
+
* additional channels. All channels will use the same table.
|
|
1124
|
+
*
|
|
1125
|
+
* vImageLookupTable_Planar8ToPlanar16 will not work in place.
|
|
1126
|
+
*/
|
|
1127
|
+
|
|
1128
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar8toPlanar16(const vImage_Buffer *src,
|
|
1129
|
+
const vImage_Buffer *dest,
|
|
1130
|
+
const Pixel_16U table[256],
|
|
1131
|
+
vImage_Flags flags)
|
|
1132
|
+
VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1133
|
+
|
|
1134
|
+
/*
|
|
1135
|
+
* vImageLookupTable_Planar8toPlanar24
|
|
1136
|
+
*
|
|
1137
|
+
* Use a lookup table to remap 0..255 values in the source image to a
|
|
1138
|
+
* different set of 3 channel 8-bit unsigned integer values in the destination.
|
|
1139
|
+
*
|
|
1140
|
+
* uint32_t table[256]; // 32-bits per pixel & 8-bit per channel
|
|
1141
|
+
* uint8_t *t_ptr = (uint8_t*)(table + srcRow[i]);
|
|
1142
|
+
* uint8_t r = t_ptr[1];
|
|
1143
|
+
* uint8_t g = t_ptr[2];
|
|
1144
|
+
* uint8_t b = t_ptr[3];
|
|
1145
|
+
* dstRow[3*i+0] = r;
|
|
1146
|
+
* dstRow[3*i+1] = g;
|
|
1147
|
+
* dstRow[3*i+2] = b;
|
|
1148
|
+
*
|
|
1149
|
+
* src A pointer to a vImage_Buffer that references 8-bit source pixels
|
|
1150
|
+
*
|
|
1151
|
+
* dest A pointer to a vImage_Buffer that references 3 channel 8-bit destination pixels
|
|
1152
|
+
*
|
|
1153
|
+
* table A pointer to the lookup table. 256 elements / 32-bits per entry / 4 8-bit values per entry.
|
|
1154
|
+
*
|
|
1155
|
+
* flags The following flags are allowed:
|
|
1156
|
+
*
|
|
1157
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1158
|
+
* wish to do this if you have your own
|
|
1159
|
+
* multithreading scheme to avoid having the
|
|
1160
|
+
* two interfere with one another.
|
|
1161
|
+
*
|
|
1162
|
+
* Return Value:
|
|
1163
|
+
* -------------
|
|
1164
|
+
* kvImageNoError Success!
|
|
1165
|
+
* kvImageBufferSizeMismatch Sizes of the src and dest images do not match
|
|
1166
|
+
* kvImageNullPointerArgument src, dest or table pointer is NULL.
|
|
1167
|
+
*
|
|
1168
|
+
* This routine will not work in place.
|
|
1169
|
+
*
|
|
1170
|
+
*/
|
|
1171
|
+
|
|
1172
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar8toPlanar24( const vImage_Buffer *src, const vImage_Buffer *dest, const uint32_t table[256], vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
/*
|
|
1176
|
+
* vImageLookupTable_Planar8toPlanar48
|
|
1177
|
+
*
|
|
1178
|
+
* Use a lookup table to remap 0..255 values in the source image to a
|
|
1179
|
+
* different set of 3 channel 16-bit unsigned integer values in the destination.
|
|
1180
|
+
*
|
|
1181
|
+
* uint64_t table[256]; // 64-bits per pixel & 16-bit per channel
|
|
1182
|
+
* uint16_t *t_ptr = (uint16_t*)(table + srcRow[i]);
|
|
1183
|
+
* uint16_t r = t_ptr[1];
|
|
1184
|
+
* uint16_t g = t_ptr[2];
|
|
1185
|
+
* uint16_t b = t_ptr[3];
|
|
1186
|
+
* dstRow[3*i+0] = r;
|
|
1187
|
+
* dstRow[3*i+1] = g;
|
|
1188
|
+
* dstRow[3*i+2] = b;
|
|
1189
|
+
*
|
|
1190
|
+
* src A pointer to a vImage_Buffer that references 8-bit source pixels
|
|
1191
|
+
*
|
|
1192
|
+
* dest A pointer to a vImage_Buffer that references 3 channel 16-bit destination pixels
|
|
1193
|
+
*
|
|
1194
|
+
* table A pointer to the lookup table. 256 elements / 64-bits per entry / 4 16-bit values per entry.
|
|
1195
|
+
*
|
|
1196
|
+
* flags The following flags are allowed:
|
|
1197
|
+
*
|
|
1198
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1199
|
+
* wish to do this if you have your own
|
|
1200
|
+
* multithreading scheme to avoid having the
|
|
1201
|
+
* two interfere with one another.
|
|
1202
|
+
*
|
|
1203
|
+
* Return Value:
|
|
1204
|
+
* -------------
|
|
1205
|
+
* kvImageNoError Success!
|
|
1206
|
+
* kvImageBufferSizeMismatch Sizes of the src and dest images do not match
|
|
1207
|
+
* kvImageNullPointerArgument src, dest or table pointer is NULL.
|
|
1208
|
+
*
|
|
1209
|
+
* This routine will not work in place.
|
|
1210
|
+
*
|
|
1211
|
+
*/
|
|
1212
|
+
|
|
1213
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar8toPlanar48( const vImage_Buffer *src, const vImage_Buffer *dest, const uint64_t table[256], vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
/*
|
|
1217
|
+
* vImageLookupTable_Planar8toPlanar96
|
|
1218
|
+
*
|
|
1219
|
+
* Use a lookup table to remap 0..255 values in the source image to a
|
|
1220
|
+
* different set of 3 channel 32-bit unsigned integer values in the destination.
|
|
1221
|
+
*
|
|
1222
|
+
* uint32_t table[256*4]; // 128-bits per pixel & 32-bit per channel
|
|
1223
|
+
* uint32_t *t_ptr = (uint32_t*)(table + 4 * srcRow[i]);
|
|
1224
|
+
* uint32_t r = t_ptr[1];
|
|
1225
|
+
* uint32_t g = t_ptr[2];
|
|
1226
|
+
* uint32_t b = t_ptr[3];
|
|
1227
|
+
* dstRow[3*i+0] = r;
|
|
1228
|
+
* dstRow[3*i+1] = g;
|
|
1229
|
+
* dstRow[3*i+2] = b;
|
|
1230
|
+
*
|
|
1231
|
+
* src A pointer to a vImage_Buffer that references 8-bit source pixels
|
|
1232
|
+
*
|
|
1233
|
+
* dest A pointer to a vImage_Buffer that references 3 channel 32-bit destination pixels.
|
|
1234
|
+
*
|
|
1235
|
+
* table A pointer to the lookup table. 256 elements / 128-bits per entry / 4 32-bit values per entry.
|
|
1236
|
+
*
|
|
1237
|
+
* flags The following flags are allowed:
|
|
1238
|
+
*
|
|
1239
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1240
|
+
* wish to do this if you have your own
|
|
1241
|
+
* multithreading scheme to avoid having the
|
|
1242
|
+
* two interfere with one another.
|
|
1243
|
+
*
|
|
1244
|
+
* Return Value:
|
|
1245
|
+
* -------------
|
|
1246
|
+
* kvImageNoError Success!
|
|
1247
|
+
* kvImageBufferSizeMismatch Sizes of the src and dest images do not match
|
|
1248
|
+
* kvImageNullPointerArgument src, dest or table pointer is NULL.
|
|
1249
|
+
*
|
|
1250
|
+
* This routine will not work in place.
|
|
1251
|
+
* dest.data must be 4-byte aligned at least.
|
|
1252
|
+
*
|
|
1253
|
+
*/
|
|
1254
|
+
|
|
1255
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar8toPlanar96( const vImage_Buffer *src, const vImage_Buffer *dest, const Pixel_FFFF table[256], vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
/*
|
|
1259
|
+
* vImageLookupTable_Planar8toPlanar128
|
|
1260
|
+
*
|
|
1261
|
+
* Use a lookup table to remap 0..255 values in the source image to a
|
|
1262
|
+
* different set of 4 channel 32-bit unsigned integer values in the destination.
|
|
1263
|
+
*
|
|
1264
|
+
* uint32_t table[256*4]; // 128-bits per pixel & 32-bit per channel
|
|
1265
|
+
* uint32_t *t_ptr = (uint32_t*)(table + 4 * srcRow[i]);
|
|
1266
|
+
* uint32_t a = t_ptr[0];
|
|
1267
|
+
* uint32_t r = t_ptr[1];
|
|
1268
|
+
* uint32_t g = t_ptr[2];
|
|
1269
|
+
* uint32_t b = t_ptr[3];
|
|
1270
|
+
* dstRow[3*i+0] = a;
|
|
1271
|
+
* dstRow[3*i+1] = r;
|
|
1272
|
+
* dstRow[3*i+2] = g;
|
|
1273
|
+
* dstRow[3*i+3] = b;
|
|
1274
|
+
*
|
|
1275
|
+
* src A pointer to a vImage_Buffer that references 8-bit source pixels
|
|
1276
|
+
*
|
|
1277
|
+
* dest A pointer to a vImage_Buffer that references 4 channel 32-bit destination pixels.
|
|
1278
|
+
*
|
|
1279
|
+
* table A pointer to the lookup table. 256 elements / 128-bits per entry / 4 32-bit values per entry.
|
|
1280
|
+
*
|
|
1281
|
+
* flags The following flags are allowed:
|
|
1282
|
+
*
|
|
1283
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1284
|
+
* wish to do this if you have your own
|
|
1285
|
+
* multithreading scheme to avoid having the
|
|
1286
|
+
* two interfere with one another.
|
|
1287
|
+
*
|
|
1288
|
+
* Return Value:
|
|
1289
|
+
* -------------
|
|
1290
|
+
* kvImageNoError Success!
|
|
1291
|
+
* kvImageBufferSizeMismatch Sizes of the src and dest images do not match
|
|
1292
|
+
* kvImageNullPointerArgument src, dest or table pointer is NULL.
|
|
1293
|
+
*
|
|
1294
|
+
* This routine will not work in place.
|
|
1295
|
+
* dest.data must be 4-byte aligned at least.
|
|
1296
|
+
*
|
|
1297
|
+
*/
|
|
1298
|
+
|
|
1299
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar8toPlanar128( const vImage_Buffer *src, const vImage_Buffer *dest, const Pixel_FFFF table[256], vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1300
|
+
|
|
1301
|
+
/*
|
|
1302
|
+
* A simple lookup table:
|
|
1303
|
+
*
|
|
1304
|
+
* float table[256];
|
|
1305
|
+
* float result_pixel = table[ input_8_bit_pixel ];
|
|
1306
|
+
*
|
|
1307
|
+
* The input is a buffer of 8-bit pixels. The output is a buffer of floating point pixels.
|
|
1308
|
+
*
|
|
1309
|
+
* Note: It is okay to use this to convert Planar8 data to other 32 bit types as well, such as a ARGB8888 pixel.
|
|
1310
|
+
* Simply pass a Pixel_8888[256] array instead of a Pixel_F[256] array.
|
|
1311
|
+
*
|
|
1312
|
+
* This function can also work for multichannel data by scaling the width of the image to compensate for the
|
|
1313
|
+
* additional channels. All channels will use the same table.
|
|
1314
|
+
*
|
|
1315
|
+
* vImageLookupTable_Planar8ToPlanarF will not work in place.
|
|
1316
|
+
*/
|
|
1317
|
+
|
|
1318
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar8toPlanarF(const vImage_Buffer *src,
|
|
1319
|
+
const vImage_Buffer *dest,
|
|
1320
|
+
const Pixel_F table[256],
|
|
1321
|
+
vImage_Flags flags)
|
|
1322
|
+
VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
/*
|
|
1326
|
+
* A simple lookup table with floating point inputs:
|
|
1327
|
+
*
|
|
1328
|
+
* uint8_t table[4096];
|
|
1329
|
+
* uint32_t index = (uint32_t) MIN( MAX( input_float_pixel * 4096.0f, 0.0f), 4095.0f);
|
|
1330
|
+
* uint8_t result_pixel = table[ index ];
|
|
1331
|
+
*
|
|
1332
|
+
* The input is a buffer of floating-point pixels. The output is a buffer of 8-bit pixels.
|
|
1333
|
+
* This function can also work for multichannel data by scaling the width of the image to compensate for the
|
|
1334
|
+
* additional channels. All channels will use the same table.
|
|
1335
|
+
*
|
|
1336
|
+
* vImageLookupTable_PlanarFToPlanar8 will work in place, provided that the following are true:
|
|
1337
|
+
* src->data == dest->data
|
|
1338
|
+
* src->rowBytes >= dest->rowBytes
|
|
1339
|
+
* if( src->rowBytes > dest->rowBytes ) kvImageDoNotTile must be passed in the flags parameter
|
|
1340
|
+
*/
|
|
1341
|
+
VIMAGE_PF vImage_Error
|
|
1342
|
+
vImageLookupTable_PlanarFtoPlanar8(
|
|
1343
|
+
const vImage_Buffer *src, /* floating point pixels */
|
|
1344
|
+
const vImage_Buffer *dest, /* 8-bit pixels */
|
|
1345
|
+
const Pixel_8 table[4096],
|
|
1346
|
+
vImage_Flags flags )
|
|
1347
|
+
VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
/*
|
|
1351
|
+
* vImageLookupTable_8to64U
|
|
1352
|
+
*
|
|
1353
|
+
* Use a lookup table to remap 0..255 values in the source image to a
|
|
1354
|
+
* different set of 64-bit unsigned integer values in the destination.
|
|
1355
|
+
*
|
|
1356
|
+
* uint64_t table[256];
|
|
1357
|
+
* uint64_t result_pixel = table[ input_8_bit_pixel ];
|
|
1358
|
+
*
|
|
1359
|
+
* src A pointer to a vImage_Buffer that references the source pixels
|
|
1360
|
+
*
|
|
1361
|
+
* dest A pointer to a vImage_Buffer that references the destination pixels
|
|
1362
|
+
*
|
|
1363
|
+
* table A pointer to the lookup table. The table should be an array with 256 elements.
|
|
1364
|
+
*
|
|
1365
|
+
* flags The following flags are allowed:
|
|
1366
|
+
*
|
|
1367
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1368
|
+
* wish to do this if you have your own
|
|
1369
|
+
* multithreading scheme to avoid having the
|
|
1370
|
+
* two interfere with one another.
|
|
1371
|
+
*
|
|
1372
|
+
* Return Value:
|
|
1373
|
+
* -------------
|
|
1374
|
+
* kvImageNoError Success!
|
|
1375
|
+
* kvImageBufferSizeMismatch Sizes of the src and dest images do not match
|
|
1376
|
+
* kvImageNullPointerArgument src, dest or table pointer is NULL.
|
|
1377
|
+
*
|
|
1378
|
+
* This routine will not work in place.
|
|
1379
|
+
*
|
|
1380
|
+
*/
|
|
1381
|
+
VIMAGE_PF vImage_Error
|
|
1382
|
+
vImageLookupTable_8to64U(
|
|
1383
|
+
const vImage_Buffer *src,
|
|
1384
|
+
const vImage_Buffer *dest,
|
|
1385
|
+
const uint64_t LUT[256],
|
|
1386
|
+
vImage_Flags flags)
|
|
1387
|
+
VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1388
|
+
|
|
1389
|
+
/*
|
|
1390
|
+
* vImageLookupTable_Planar16
|
|
1391
|
+
*
|
|
1392
|
+
* Use a lookup table to remap 0..0xffff values in the source image to a
|
|
1393
|
+
* different set of 16-bit unsigned integer values in the destination.
|
|
1394
|
+
*
|
|
1395
|
+
* Pixel_16U table[0x10000];
|
|
1396
|
+
* Pixel_16U result_pixel = table[ input_16_bit_pixel ];
|
|
1397
|
+
*
|
|
1398
|
+
* src A pointer to a vImage_Buffer that references the source pixels
|
|
1399
|
+
*
|
|
1400
|
+
* dest A pointer to a vImage_Buffer that references the destination pixels
|
|
1401
|
+
*
|
|
1402
|
+
* table A pointer to the lookup table. The table should be an array with 65536 elements.
|
|
1403
|
+
*
|
|
1404
|
+
* flags The following flags are allowed:
|
|
1405
|
+
*
|
|
1406
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1407
|
+
* wish to do this if you have your own
|
|
1408
|
+
* multithreading scheme to avoid having the
|
|
1409
|
+
* two interfere with one another.
|
|
1410
|
+
*
|
|
1411
|
+
* Return Value:
|
|
1412
|
+
* -------------
|
|
1413
|
+
* kvImageNoError Success!
|
|
1414
|
+
* kvImageBufferSizeMismatch Sizes of the src and dest images do not match
|
|
1415
|
+
* kvImageNullPointerArgument src, dest or table pointer is NULL.
|
|
1416
|
+
*
|
|
1417
|
+
* This routine will work in place.
|
|
1418
|
+
*
|
|
1419
|
+
*/
|
|
1420
|
+
|
|
1421
|
+
VIMAGE_PF vImage_Error vImageLookupTable_Planar16(const vImage_Buffer *src, const vImage_Buffer *dest, const Pixel_16U table[0x10000], vImage_Flags flags) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1422
|
+
|
|
1423
|
+
/*
|
|
1424
|
+
* vImageInterpolatedLookupTable_PlanarF
|
|
1425
|
+
*
|
|
1426
|
+
* Results are calculated as follows:
|
|
1427
|
+
*
|
|
1428
|
+
* float clippedPixel = MAX( MIN( src_pixel, maxFloat ), minFloat ); //clip src_pixel to be in range
|
|
1429
|
+
* float fIndex = (float) (tableEntries - 1) * (clippedPixel - minFloat ) / (maxFloat - minFloat);
|
|
1430
|
+
* float fract = fIndex - floor( fIndex );
|
|
1431
|
+
* unsigned long index = fIndex;
|
|
1432
|
+
* float result = table[ index ] * ( 1.0f - fract ) + table[ index + 1] * fract;
|
|
1433
|
+
*
|
|
1434
|
+
* In English, this translates to a lookup table that contains tableEntries values, that span
|
|
1435
|
+
* the input range of minFloat...maxFloat, inclusive, in an evenly spaced fashion.
|
|
1436
|
+
*
|
|
1437
|
+
* tableEntries
|
|
1438
|
+
* <--------------------->
|
|
1439
|
+
* |
|
|
1440
|
+
* r | ****
|
|
1441
|
+
* e | * * *
|
|
1442
|
+
* s | * *
|
|
1443
|
+
* u | * *
|
|
1444
|
+
* l | *****
|
|
1445
|
+
* t +--------+---------------------+--------
|
|
1446
|
+
* minFloat maxFloat
|
|
1447
|
+
*
|
|
1448
|
+
* IMPORTANT: For correct operation, the table must be allocated to contain tableEntries+1 entries.
|
|
1449
|
+
* If the table is too small or the value of table[ tableEntries ] is infinite or NaN,
|
|
1450
|
+
* behavior is undefined.
|
|
1451
|
+
*
|
|
1452
|
+
* The function will work in place, provided that the following are true:
|
|
1453
|
+
* src->data == dest->data
|
|
1454
|
+
* src->rowBytes >= dest->rowBytes
|
|
1455
|
+
* if( src->rowBytes > dest->rowBytes ) kvImageDoNotTile must be passed in the flags parameter
|
|
1456
|
+
*
|
|
1457
|
+
* This function may be used on multichannel images by scaling the width by the number of channels.
|
|
1458
|
+
* The same table will be used for all the channels, including alpha, if there is an alpha channel.
|
|
1459
|
+
*/
|
|
1460
|
+
VIMAGE_PF vImage_Error vImageInterpolatedLookupTable_PlanarF( const vImage_Buffer *src,
|
|
1461
|
+
const vImage_Buffer *dest,
|
|
1462
|
+
const Pixel_F *table,
|
|
1463
|
+
vImagePixelCount tableEntries,
|
|
1464
|
+
float maxFloat,
|
|
1465
|
+
float minFloat,
|
|
1466
|
+
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
/*
|
|
1470
|
+
* vImageMultidimensionalTable_Create
|
|
1471
|
+
*
|
|
1472
|
+
* Creates a vImage_MultidimensionalTable for use with vImageMultiDimensionalInterpolatedLookupTable_<fmt>(). The
|
|
1473
|
+
* input data is a contiguous array of N dimensional samples which define the lookup table grid points.
|
|
1474
|
+
* The samples have range [0,65535] interpreted as [0, 1.0f]. (Samples have an implict divide by 65535
|
|
1475
|
+
* in them, like the Planar16U format.)
|
|
1476
|
+
*
|
|
1477
|
+
* The vImage_MultidimensionalTable is not a CFType.
|
|
1478
|
+
*
|
|
1479
|
+
* Example:
|
|
1480
|
+
* Suppose the multidimensional table is intended to convert RGB (3 channel) data to CMYK (4 channel).
|
|
1481
|
+
* In each of the {R, G, B} dimensions, we have 17 samples. The table is then comprised of
|
|
1482
|
+
* 17x17x17=4913 uint16_t[4]'s, each of which contains {C,M,Y,K} for that position. The dimensions
|
|
1483
|
+
* are iterated in standard C order (row major). In this case, they would be:
|
|
1484
|
+
*
|
|
1485
|
+
* {CMYK for R0G0B0, CMYK for R0G0B1, CMYK for R0G0B2, ... CMYK for R0G0B16,
|
|
1486
|
+
* CMYK for R0G1B0, CMYK for R0G1B1, CMYK for R0G1B2, ... CMYK for R0G1B16,
|
|
1487
|
+
* ...
|
|
1488
|
+
* CMYK for R0G16B0, CMYK for R0G16B1, CMYK for R0G16B2, ... CMYK for R0G16B16,
|
|
1489
|
+
* CMYK for R1G0B0, CMYK for R1G0B1, CMYK for R1G0B2, ... CMYK for R1G0B16,
|
|
1490
|
+
* ...
|
|
1491
|
+
* CMYK for R1G16B0, CMYK for R1G16B1, CMYK for R1G16B2, ... CMYK for R1G16B16,
|
|
1492
|
+
* ...
|
|
1493
|
+
* CMYK for R16G16B0, CMYK for R16G16B1, CMYK for R16G16B2, ... CMYK for R16G16B16 }
|
|
1494
|
+
*
|
|
1495
|
+
* Parameters:
|
|
1496
|
+
* tableData A non-NULL pointer to the data used to build the table
|
|
1497
|
+
* numSrcChannels The number of channels in an input pixel
|
|
1498
|
+
* numDestChannels The number of channels in an output pixel
|
|
1499
|
+
* table_entries_per_dimension An array containing the number of table entries for each dimension in numSrcChannels
|
|
1500
|
+
* The entries are in the same order as the channels in the src pixel.
|
|
1501
|
+
* hint An indication of how the table would be used. Pass either kvImageMDTableHint_16Q12
|
|
1502
|
+
* or kvImageMDTableHint_Float or both. If only one is passed, we will save memory
|
|
1503
|
+
* and time skipping work to set up the table for unused formats.
|
|
1504
|
+
* flags The following flags are allowed:
|
|
1505
|
+
*
|
|
1506
|
+
* kvImageDoNotTile Turns off internal multithreading. You may
|
|
1507
|
+
* wish to do this if you have your own
|
|
1508
|
+
* multithreading scheme to avoid having the
|
|
1509
|
+
* two interfere with one another.
|
|
1510
|
+
* err A pointer to a vImage_Error. If err != NULL, on return, the memory pointed to by error
|
|
1511
|
+
* will be overwritten with an appropriate error or kvImageNoError. It is sufficient to
|
|
1512
|
+
* simply check the LHS return value against NULL to determine whether the function succeeeded.
|
|
1513
|
+
*
|
|
1514
|
+
* Return value:
|
|
1515
|
+
* On return a valid vImage_MultidimensionalTable for use with vImageMultiDimensionalInterpolatedLookupTable_<fmt>
|
|
1516
|
+
* if err is not NULL, the memory it points to will be overwritten with an appropriate error code. The
|
|
1517
|
+
* vImage_MultidimensionalTable will contain a copy of the data provided in tableData. It is safe to deallocate
|
|
1518
|
+
* the input tableData immediately after this call returns.
|
|
1519
|
+
*
|
|
1520
|
+
*
|
|
1521
|
+
*
|
|
1522
|
+
* Errors:
|
|
1523
|
+
* kvImageNoError Success
|
|
1524
|
+
* kvImageInvalidParameter hint must be kvImageMDTableHint_16Q12 or kvImageMDTableHint_Float or both
|
|
1525
|
+
* kvImageInvalidParameter numSrcChannels and numDestChannels must be non-zero.
|
|
1526
|
+
* kvImageNullPointerArgument tableData and table_entries_per_dimension must not be NULL.
|
|
1527
|
+
* kvImageUnknownFlagsBit An illegal or unknown flag was passed to the function.
|
|
1528
|
+
* kvImageMemoryAllocationError Can not allocate memory for buffer.
|
|
1529
|
+
*
|
|
1530
|
+
* Use vImageMultidimensionalTable_Release to destroy the vImage_MultidimensionalTable when you are done with it.
|
|
1531
|
+
* The vImage_MultidimensionalTable may be reused. The table is immutable, thread-safe and may be used by many
|
|
1532
|
+
* vImageMultiDimensionalInterpolatedLookupTable_<fmt> calls concurrently so long as care is taken that it is not
|
|
1533
|
+
* freed while it is being used. To support multithreaded concurrent access, the table follows standard retain/release
|
|
1534
|
+
* semantics. On creation the table has a retain count of 1. When the reference count drops to 0, the table is destroyed.
|
|
1535
|
+
*
|
|
1536
|
+
*/
|
|
1537
|
+
|
|
1538
|
+
typedef struct vImage_MultidimensionalTableData * vImage_MultidimensionalTable;
|
|
1539
|
+
|
|
1540
|
+
/* Hints to describe use of vImage_MultidimensionalTableData look up table. */
|
|
1541
|
+
typedef enum
|
|
1542
|
+
{
|
|
1543
|
+
kvImageMDTableHint_16Q12 VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 1,
|
|
1544
|
+
kvImageMDTableHint_Float VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 2,
|
|
1545
|
+
}vImageMDTableUsageHint;
|
|
1546
|
+
|
|
1547
|
+
VIMAGE_PF vImage_MultidimensionalTable vImageMultidimensionalTable_Create( const uint16_t *tableData,
|
|
1548
|
+
uint32_t numSrcChannels,
|
|
1549
|
+
uint32_t numDestChannels,
|
|
1550
|
+
const uint8_t table_entries_per_dimension[], /* uint8_t[numSrcChannels] */
|
|
1551
|
+
vImageMDTableUsageHint hint,
|
|
1552
|
+
vImage_Flags flags,
|
|
1553
|
+
vImage_Error *err )
|
|
1554
|
+
VIMAGE_NON_NULL(1,4)
|
|
1555
|
+
API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1556
|
+
|
|
1557
|
+
/*
|
|
1558
|
+
* vImageMultidimensionalTable_Retain
|
|
1559
|
+
* vImageMultidimensionalTable_Release
|
|
1560
|
+
*
|
|
1561
|
+
* A vImage_MultidimensionalTable follows Retain/Release semantics. On creation, the table has a retain count of 1.
|
|
1562
|
+
* If you call vImageMultidimensionalTable_Retain on it, the retain count is incremented. If you call
|
|
1563
|
+
* vImageMultidimensionalTable_Release on it, the retain count is decremented. When the retain count reaches 0,
|
|
1564
|
+
* the object is destroyed. If any vImage function is called on an object whose reference count has already reached
|
|
1565
|
+
* 0, behavior is undefined.
|
|
1566
|
+
*
|
|
1567
|
+
* Parameters:
|
|
1568
|
+
* table A pointer to vImage_MultidimensionalTableData. If NULL, then nothing happens.
|
|
1569
|
+
*
|
|
1570
|
+
* Errors:
|
|
1571
|
+
* kvImageNoError Success
|
|
1572
|
+
*/
|
|
1573
|
+
VIMAGE_PF vImage_Error vImageMultidimensionalTable_Retain( vImage_MultidimensionalTable table ) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1574
|
+
VIMAGE_PF vImage_Error vImageMultidimensionalTable_Release( vImage_MultidimensionalTable table ) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1575
|
+
|
|
1576
|
+
/*
|
|
1577
|
+
* vImageMultiDimensionalLookupTable_PlanarF
|
|
1578
|
+
*
|
|
1579
|
+
* vImageMultiDimensionalLookupTable_<fmt> uses the input color channel values (treated as a N-dimensional coordinate)
|
|
1580
|
+
* to index a N-dimensional lookup table to find a new color value, possibly in a new color space. The number of color channels
|
|
1581
|
+
* in the destination image does not need to match the number of color channels in the source image. The table is created using
|
|
1582
|
+
* vImageMultidimensionalTable_Create.
|
|
1583
|
+
*
|
|
1584
|
+
* In each dimension, the table must be of size (2**K[dimension])+1. The first entry corresponds to 0 and the last to 1.0. The rest
|
|
1585
|
+
* correspond to steps at 2**-K[dimension]. (K[] is the table_entries_per_dimension[] array in vImageMultidimensionalTable_Create.)
|
|
1586
|
+
* Thus a 17x17x17 3D lookup table defines the vertices that delineate a grid of 16x16x16 cubes, just as a ruler marked in 16ths of an
|
|
1587
|
+
* inch has 17 marks between 0 and 1 inch, inclusive. (SI units are usually awkwardly subdivided by powers of 10, rather than powers of 2
|
|
1588
|
+
* so we avoid them in this example. :-) The most significant portion of the color channel values are used to index the multidimensional
|
|
1589
|
+
* grid. Usually there will be some fractional precision left over. That is used to do a linear interpolation between nearby gridpoints
|
|
1590
|
+
* to find the value at that position. If the vImage_InterpolationMethod is kvImageFullInterpolation, then all 2**N (for N dimensions)
|
|
1591
|
+
* nearby gridpoints are considered. If the vImage_InterpolationMethod is kvImageHalfInterpolation, then the {0,0,0...}, {1,1,1...} verticies
|
|
1592
|
+
* along the gray axis are considered along with N-1 nearest other vertices.
|
|
1593
|
+
*
|
|
1594
|
+
*
|
|
1595
|
+
* Parameters:
|
|
1596
|
+
*
|
|
1597
|
+
* srcs An array of vImage_Buffers that reference the source image planes. The number of
|
|
1598
|
+
* such buffers is given by the numSrcChannels parameter passed to vImageMultidimensionalTable_Create.
|
|
1599
|
+
*
|
|
1600
|
+
* dests An array of vImage_Buffers that reference the destination image planes. The number of
|
|
1601
|
+
* such buffers is given by the numDestChannels parameter passed to vImageMultidimensionalTable_Create.
|
|
1602
|
+
*
|
|
1603
|
+
* tempBuffer May be NULL. If non-NULL, this is a pointer to a region of memory that vImage can use as a
|
|
1604
|
+
* scratch space for storing temporary data. The minimum size of the scratch space is obtained
|
|
1605
|
+
* by calling the function with identical parameters and the kvImageGetTempBufferSize flag.
|
|
1606
|
+
* If vImageMultiDimensionalInterpolatedLookupTable_<fmt> can be called from multiple threads
|
|
1607
|
+
* simultaneously, the temp buffer must be different (or NULL) for each thread.
|
|
1608
|
+
*
|
|
1609
|
+
* table A valid table created by vImageMultidimensionalTable_Create
|
|
1610
|
+
*
|
|
1611
|
+
* method either kvImageFullInterpolation or kvImageHalfInterpolation. See description above.
|
|
1612
|
+
*
|
|
1613
|
+
* flags Must be kvImageNoFlags or one or more from this list:
|
|
1614
|
+
*
|
|
1615
|
+
* kvImageDoNotTile turn off internal multithreading.
|
|
1616
|
+
* kvImageGetTempBufferSize Return the size of temp buffer. It may return 0. Do nothing.
|
|
1617
|
+
*
|
|
1618
|
+
* Error Values:
|
|
1619
|
+
* >= 0 Minimum temp buffer size, if kvImageGetTempBufferSize was specified.
|
|
1620
|
+
* kvImageNoError Success
|
|
1621
|
+
* kvImageNullPointerArgument srcs, dests and table may not be NULL
|
|
1622
|
+
* kvImageUnknownFlagsBit An illegal or unknown flag was passed to the function.
|
|
1623
|
+
* kvImageInvalidParameter An unknown or illegal interpolation method was indicated
|
|
1624
|
+
* kvImageInvalidParameter The interpolation method doesn't have a table for the requested data type.
|
|
1625
|
+
* This happened because an incorrect vImageMDTableUsageHint was passed to
|
|
1626
|
+
* vImageMultidimensionalTable_Create
|
|
1627
|
+
* kvImageBufferSizeMismatch Within srcs, all vImage_Buffers must have the same height and width.
|
|
1628
|
+
* Similarly, within dests, all vImage_Buffers must have the same height and width.
|
|
1629
|
+
* Otherwise this error is returned.
|
|
1630
|
+
* kvImageBufferSizeMismatch The src height and width must be greater than or equal to the destination height
|
|
1631
|
+
* and width.
|
|
1632
|
+
*
|
|
1633
|
+
*/
|
|
1634
|
+
|
|
1635
|
+
/* interpolation method for vImageMultiDimensionalInterpolatedLookupTable_<fmt>*/
|
|
1636
|
+
typedef enum
|
|
1637
|
+
{
|
|
1638
|
+
kvImageNoInterpolation VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 0, /* nearest neighbor. Fast but probably causes banding and will certainly quantize the histogram. */
|
|
1639
|
+
kvImageFullInterpolation VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 1, /* full linear interpolation */
|
|
1640
|
+
kvImageHalfInterpolation VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_4, __IPHONE_5_0 ) = 2 /* partial linear interpolation between vertices on gray axis and N-1 nearest vertices */
|
|
1641
|
+
}vImage_InterpolationMethod;
|
|
1642
|
+
|
|
1643
|
+
VIMAGE_PF vImage_Error vImageMultiDimensionalInterpolatedLookupTable_PlanarF( const vImage_Buffer srcs[],
|
|
1644
|
+
const vImage_Buffer dests[],
|
|
1645
|
+
void *tempBuffer,
|
|
1646
|
+
vImage_MultidimensionalTable table,
|
|
1647
|
+
vImage_InterpolationMethod method,
|
|
1648
|
+
vImage_Flags flags )
|
|
1649
|
+
VIMAGE_NON_NULL(1,2,4)
|
|
1650
|
+
API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1651
|
+
|
|
1652
|
+
/*
|
|
1653
|
+
* vImageMultiDimensionalInterpolatedLookupTable_Planar16Q12
|
|
1654
|
+
*
|
|
1655
|
+
* vImageMultiDimensionalInterpolatedLookupTable_Planar16Q12 is like vImageMultiDimensionalInterpolatedLookupTable_PlanarF
|
|
1656
|
+
* except that it operates on signed fixed-point data. The 16Q12 format is a signed 16-bit fixed-point value with 12 fractional
|
|
1657
|
+
* bits, 3 non-fractional bits and one sign bit. It can represent values in the range (-8,8). However the table always describes
|
|
1658
|
+
* a region between [0,1] in each dimension. Values outside this range are clamped to the nearest in-range value by Manhattan
|
|
1659
|
+
* distance before indexing the table. See vImageConvert_Planar8to16Q12 and vImageConvert_16Q12toPlanar8 for more on the format.
|
|
1660
|
+
*/
|
|
1661
|
+
VIMAGE_PF vImage_Error vImageMultiDimensionalInterpolatedLookupTable_Planar16Q12( const vImage_Buffer srcs[],
|
|
1662
|
+
const vImage_Buffer dests[],
|
|
1663
|
+
void *tempBuffer,
|
|
1664
|
+
vImage_MultidimensionalTable table,
|
|
1665
|
+
vImage_InterpolationMethod method,
|
|
1666
|
+
vImage_Flags flags )
|
|
1667
|
+
VIMAGE_NON_NULL(1,2,4)
|
|
1668
|
+
API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
|
|
1669
|
+
|
|
1670
|
+
/*
|
|
1671
|
+
* vImageFloodFill_Planar8, vImageFloodFill_ARGB8888,
|
|
1672
|
+
* vImageFloodFill_Planar16U, vImageFloodFill_ARGB16U
|
|
1673
|
+
*
|
|
1674
|
+
* These functions fill a connect component of an image with a new pixel value.
|
|
1675
|
+
* Flood, or seed, fill means that all pixels that are neighboring and identical to the seed pixel are
|
|
1676
|
+
* set to (painted) with a new value. The filling proceeds until the image boundary is reached or all
|
|
1677
|
+
* pixels within the connected component are set.
|
|
1678
|
+
*
|
|
1679
|
+
* Note that the 16U versions work also for image buffers with 16S and 16F pixels given that the 16-bit
|
|
1680
|
+
* storage format of the newValue pixel value parameter is interpreted as a 16S/16F value.
|
|
1681
|
+
*
|
|
1682
|
+
* Parameters:
|
|
1683
|
+
* ----------
|
|
1684
|
+
* srcDest A pointer to a vImage_Buffer that references the image to be filled.
|
|
1685
|
+
* This is an input/output image.
|
|
1686
|
+
*
|
|
1687
|
+
* tempBuffer Currently unsupported and must therefore be NULL.
|
|
1688
|
+
*
|
|
1689
|
+
* seedX The x-coordinate defining the position of the seed pixel inside the connected component.
|
|
1690
|
+
* seedY The y-coordinate defining the position of the seed pixel inside the connected component.
|
|
1691
|
+
*
|
|
1692
|
+
* newValue The new pixel value that overwrites the pixels in the connected component.
|
|
1693
|
+
*
|
|
1694
|
+
* connectivity Must be 4 or 8 and defines which pixels are neighboring, that is, are connected to each other.
|
|
1695
|
+
* The 4-connected neighborhood of a pixel are the pixels to the left/right and those above/below.
|
|
1696
|
+
* The 8-connected neighborhood also includes the pixels on the 4 diagonals.
|
|
1697
|
+
*
|
|
1698
|
+
* flags The following flags are allowed:
|
|
1699
|
+
*
|
|
1700
|
+
* kvImageDoNotTile Turns off internal multithreading. Multithreading of flood fill is actually not
|
|
1701
|
+
* supported so setting this flag has not effect.
|
|
1702
|
+
*
|
|
1703
|
+
* Return Value:
|
|
1704
|
+
* -------------
|
|
1705
|
+
* kvImageNoError Success!
|
|
1706
|
+
* kvImageNullPointerArgument srcDest or newValue (for ARGB formats) are NULL.
|
|
1707
|
+
* kvImageInvalidParameter connectivity is not equal to 4 or 8.
|
|
1708
|
+
* kvImageUnknownFlagsBit Unsupported flag bits set.
|
|
1709
|
+
*
|
|
1710
|
+
* This routine always work in place.
|
|
1711
|
+
*
|
|
1712
|
+
*/
|
|
1713
|
+
|
|
1714
|
+
VIMAGE_PF vImage_Error vImageFloodFill_Planar8(const vImage_Buffer *srcDest, void *tempBuffer,
|
|
1715
|
+
vImagePixelCount seedX, vImagePixelCount seedY, Pixel_8 newValue, int connectivity,
|
|
1716
|
+
vImage_Flags flags)
|
|
1717
|
+
VIMAGE_NON_NULL(1)
|
|
1718
|
+
API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
|
|
1719
|
+
|
|
1720
|
+
VIMAGE_PF vImage_Error vImageFloodFill_Planar16U(const vImage_Buffer *srcDest, void *tempBuffer,
|
|
1721
|
+
vImagePixelCount seedX, vImagePixelCount seedY, Pixel_16U newValue, int connectivity,
|
|
1722
|
+
vImage_Flags flags)
|
|
1723
|
+
VIMAGE_NON_NULL(1)
|
|
1724
|
+
API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
|
|
1725
|
+
|
|
1726
|
+
VIMAGE_PF vImage_Error vImageFloodFill_ARGB8888(const vImage_Buffer *srcDest, void *tempBuffer,
|
|
1727
|
+
vImagePixelCount seedX, vImagePixelCount seedY, Pixel_8888 newValue, int connectivity,
|
|
1728
|
+
vImage_Flags flags)
|
|
1729
|
+
VIMAGE_NON_NULL(1)
|
|
1730
|
+
API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
|
|
1731
|
+
|
|
1732
|
+
VIMAGE_PF vImage_Error vImageFloodFill_ARGB16U(const vImage_Buffer *srcDest, void *tempBuffer,
|
|
1733
|
+
vImagePixelCount seedX, vImagePixelCount seedY, Pixel_ARGB_16U newValue, int connectivity,
|
|
1734
|
+
vImage_Flags flags)
|
|
1735
|
+
VIMAGE_NON_NULL(1)
|
|
1736
|
+
API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
|
|
1737
|
+
|
|
1738
|
+
#endif
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
#ifdef __cplusplus
|
|
1742
|
+
}
|
|
1743
|
+
#endif
|
|
1744
|
+
|
|
1745
|
+
#endif /* vImage_TRANSFORM_H */
|
|
1746
|
+
|
|
1747
|
+
|